:root {
  --ink: #1a1a2e;
  --ink-soft: #3d3d5c;
  --ink-muted: #7070a0;
  --ink-faint: #b0b0cc;
  --paper: #fdf8f4;
  --cream: #f5ede3;
  --cream-deep: #ecddd0;
  --white: #ffffff;
  --pink: #c9436e;
  --pink-mid: #d4537e;
  --pink-light: #f0b8cb;
  --pink-pale: #fdf0f5;
  --pink-deep: #8b2349;
  --gold: #b8882e;
  --gold-pale: #fdf5e4;
  --teal: #2a7c6f;
  --teal-pale: #e6f4f1;
  --sage: #5a7a5e;
  --sage-pale: #eef4ee;
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --shadow-xs: 0 1px 4px rgba(26,26,46,0.06);
  --shadow-sm: 0 2px 12px rgba(26,26,46,0.08);
  --shadow-md: 0 4px 24px rgba(26,26,46,0.12);
  --shadow-lg: 0 8px 40px rgba(26,26,46,0.16);
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --nav-h: 68px;
  --top-h: 54px;
  --max-w: 480px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
}

/* ── SPLASH ── */
#splash {
  position: fixed; inset: 0;
  background: var(--ink);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.7s ease, transform 0.7s ease;
}
#splash.out { opacity: 0; pointer-events: none; transform: scale(1.05); }
.splash-inner { text-align: center; }
.splash-logo { display: flex; flex-direction: column; align-items: center; }
.splash-the { font-family: var(--font-body); font-size: 10px; font-weight: 300; letter-spacing: 0.35em; color: var(--pink-mid); text-transform: uppercase; }
.splash-heard { font-family: var(--font-display); font-size: 80px; color: var(--white); line-height: 0.9; letter-spacing: -0.03em; font-style: italic; }
.splash-journal { font-family: var(--font-body); font-size: 10px; font-weight: 300; letter-spacing: 0.35em; color: rgba(255,255,255,0.35); text-transform: uppercase; margin-top: 6px; }
.splash-sub { font-family: var(--font-display); font-style: italic; font-size: 17px; color: rgba(255,255,255,0.45); margin-top: 24px; }
.splash-bar { width: 48px; height: 2px; background: rgba(255,255,255,0.15); margin: 32px auto 0; border-radius: 1px; overflow: hidden; }
.splash-bar-fill { height: 100%; width: 0; background: var(--pink-mid); border-radius: 1px; animation: splashload 1.4s ease forwards; }
@keyframes splashload { to { width: 100%; } }

/* ── APP SHELL ── */
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
#app.hidden { display: none; }

/* ── TOPBAR ── */
.topbar {
  height: var(--top-h);
  background: rgba(253,248,244,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(26,26,46,0.06);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
}
.topbar-logo { display: flex; align-items: baseline; gap: 4px; }
.tl-the { font-size: 9px; font-weight: 300; letter-spacing: 0.3em; color: var(--pink-mid); text-transform: uppercase; }
.tl-heard { font-family: var(--font-display); font-size: 24px; color: var(--ink); letter-spacing: -0.02em; font-style: italic; }
.tl-journal { font-size: 8px; font-weight: 300; letter-spacing: 0.28em; color: var(--ink-muted); text-transform: uppercase; align-self: flex-end; padding-bottom: 3px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.streak-badge {
  display: flex; align-items: center; gap: 5px;
  background: var(--pink-pale);
  border: none; border-radius: 20px; padding: 5px 11px;
  font-size: 13px; font-weight: 500; color: var(--pink-deep);
  cursor: pointer;
}
.streak-flame { font-size: 14px; }

/* ── PAGES ── */
.pages { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; }
.page { display: none; padding: 0 0 calc(var(--nav-h) + 20px); min-height: calc(100% - var(--top-h)); }
.page.active { display: block; }

/* ── BOTTOM NAV ── */
.bottom-nav {
  height: var(--nav-h);
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(26,26,46,0.06);
  display: grid; grid-template-columns: repeat(4,1fr);
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom);
}
.bn-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; background: none; border: none; cursor: pointer;
  color: var(--ink-faint); font-family: var(--font-body); font-size: 10px; font-weight: 400;
  transition: color 0.15s;
}
.bn-item.active { color: var(--pink); }
.bn-svg { width: 22px; height: 22px; transition: transform 0.15s; }
.bn-item.active .bn-svg { transform: scale(1.1); }

/* ── HOME ── */
.home-hero {
  background: var(--ink);
  padding: 36px 24px 40px;
  position: relative; overflow: hidden;
}
.home-hero::before {
  content: ''; position: absolute; top: -60px; right: -40px;
  width: 220px; height: 220px; border-radius: 50%;
  background: radial-gradient(circle, rgba(201,67,110,0.28) 0%, transparent 70%);
  pointer-events: none;
}
.home-hero::after {
  content: ''; position: absolute; bottom: -40px; left: -20px;
  width: 160px; height: 160px; border-radius: 50%;
  background: radial-gradient(circle, rgba(42,124,111,0.18) 0%, transparent 70%);
  pointer-events: none;
}
.hero-eyebrow { font-size: 10px; letter-spacing: 0.25em; color: rgba(255,255,255,0.35); text-transform: uppercase; margin-bottom: 10px; position: relative; z-index: 1; }
.hero-title { font-family: var(--font-display); font-size: 46px; line-height: 1.0; color: var(--white); letter-spacing: -0.025em; position: relative; z-index: 1; }
.hero-title em { color: var(--pink-mid); font-style: italic; }
.hero-sub { font-size: 14px; color: rgba(255,255,255,0.4); margin-top: 12px; font-weight: 300; line-height: 1.5; position: relative; z-index: 1; }

.home-sections { padding: 22px 20px; display: flex; flex-direction: column; gap: 28px; }
.section-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-label { font-size: 11px; font-weight: 500; letter-spacing: 0.15em; color: var(--ink-muted); text-transform: uppercase; }
.section-link { font-size: 13px; color: var(--pink); background: none; border: none; cursor: pointer; font-family: var(--font-body); }

/* vocab teaser */
.home-vocab-teaser {
  background: var(--ink);
  border-radius: var(--radius-lg); padding: 20px;
  border: 1px solid rgba(201,67,110,0.2);
  cursor: pointer; transition: border-color 0.2s;
  display: flex; gap: 14px; align-items: flex-start;
}
.home-vocab-teaser:hover { border-color: rgba(201,67,110,0.45); }
.hvt-left { flex: 1; min-width: 0; }
.hvt-label { font-size: 10px; letter-spacing: 0.2em; color: var(--pink-mid); text-transform: uppercase; margin-bottom: 8px; }
.hvt-word { font-family: var(--font-display); font-size: 28px; color: var(--white); font-style: italic; letter-spacing: -0.01em; }
.hvt-pos { font-size: 12px; color: rgba(255,255,255,0.35); font-style: italic; margin-top: 2px; }
.hvt-def { font-size: 13px; color: rgba(255,255,255,0.55); line-height: 1.55; margin-top: 8px; }
.hvt-cta { font-size: 12px; color: var(--pink-mid); margin-top: 10px; }
.hvt-right { flex-shrink: 0; }
.hvt-pill { background: rgba(201,67,110,0.15); border-radius: 20px; padding: 6px 11px; font-size: 11px; color: var(--pink-mid); white-space: nowrap; }

/* course mini scroll */
.course-cards-scroll {
  display: flex; gap: 12px; overflow-x: auto; padding: 2px 20px 4px;
  scrollbar-width: none; -ms-overflow-style: none; margin: 0 -20px;
}
.course-cards-scroll::-webkit-scrollbar { display: none; }
.course-card-mini {
  flex-shrink: 0; width: 178px;
  background: var(--white); border: 1px solid rgba(26,26,46,0.07);
  border-radius: var(--radius-lg); padding: 16px; cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
}
.course-card-mini:hover { box-shadow: var(--shadow-sm); }
.course-card-mini:active { transform: scale(0.97); }
.ccm-icon-wrap { width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 20px; margin-bottom: 10px; }
.ccm-tag { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 3px; }
.ccm-title { font-size: 13px; font-weight: 500; color: var(--ink); line-height: 1.3; margin-bottom: 5px; }
.ccm-meta { font-size: 11px; color: var(--ink-muted); margin-bottom: 10px; }
.ccm-bar { height: 3px; background: rgba(26,26,46,0.07); border-radius: 2px; }
.ccm-bar-fill { height: 100%; border-radius: 2px; background: var(--pink); transition: width 0.4s; }

/* issue strip */
.issue-strip { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.issue-card {
  background: var(--cream); border-radius: var(--radius-lg); padding: 18px;
  border: 1px solid rgba(26,26,46,0.06); cursor: pointer; transition: box-shadow 0.15s;
}
.issue-card:hover { box-shadow: var(--shadow-xs); }
.issue-card.ic-open { background: var(--pink-pale); border-color: var(--pink-light); }
.ic-num { font-size: 10px; letter-spacing: 0.14em; color: var(--ink-muted); text-transform: uppercase; margin-bottom: 6px; }
.ic-open .ic-num { color: var(--pink-deep); }
.ic-title { font-family: var(--font-display); font-size: 17px; line-height: 1.3; color: var(--ink); margin-bottom: 5px; }
.ic-meta { font-size: 12px; color: var(--ink-muted); margin-bottom: 12px; line-height: 1.5; }
.ic-link { font-size: 13px; color: var(--pink); font-weight: 500; background: none; border: none; cursor: pointer; padding: 0; font-family: var(--font-body); }

/* ── COURSES PAGE ── */
.page-header { padding: 28px 20px 0; margin-bottom: 20px; }
.page-title { font-family: var(--font-display); font-size: 34px; color: var(--ink); letter-spacing: -0.02em; }
.page-desc { font-size: 14px; color: var(--ink-muted); margin-top: 6px; line-height: 1.65; }

.course-filter-row { display: flex; gap: 8px; overflow-x: auto; padding: 0 20px 2px; margin-bottom: 16px; scrollbar-width: none; }
.course-filter-row::-webkit-scrollbar { display: none; }
.cf-chip {
  flex-shrink: 0; padding: 7px 16px; border-radius: 20px;
  border: 1px solid rgba(26,26,46,0.12); background: none;
  font-size: 13px; font-family: var(--font-body); color: var(--ink-soft); cursor: pointer;
  transition: all 0.15s;
}
.cf-chip.active { background: var(--ink); color: white; border-color: var(--ink); }

.course-grid { display: flex; flex-direction: column; gap: 10px; padding: 0 20px; }
.course-card {
  background: var(--white); border: 1px solid rgba(26,26,46,0.07);
  border-radius: var(--radius-lg); padding: 18px; cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
  display: flex; gap: 14px; align-items: flex-start;
}
.course-card:hover { box-shadow: var(--shadow-sm); }
.course-card:active { transform: scale(0.99); }
.cc-icon { width: 50px; height: 50px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.cc-body { flex: 1; min-width: 0; }
.cc-tag { font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 4px; }
.cc-title { font-size: 16px; font-weight: 500; color: var(--ink); line-height: 1.3; margin-bottom: 4px; }
.cc-desc { font-size: 13px; color: var(--ink-muted); line-height: 1.55; margin-bottom: 10px; }
.cc-footer { display: flex; gap: 10px; align-items: center; }
.cc-lessons { font-size: 12px; color: var(--ink-muted); white-space: nowrap; flex-shrink: 0; }
.cc-progress-wrap { flex: 1; height: 3px; background: rgba(26,26,46,0.07); border-radius: 2px; min-width: 0; }
.cc-progress-fill { height: 100%; border-radius: 2px; transition: width 0.3s; }
.cc-pct { font-size: 12px; font-weight: 500; min-width: 28px; text-align: right; flex-shrink: 0; }

/* coming soon */
.coming-soon-block {
  background: var(--cream); border-radius: var(--radius-lg); padding: 32px 24px;
  text-align: center; border: 1px dashed rgba(26,26,46,0.15);
  margin: 20px 20px 0;
}
.csb-badge { display: inline-block; font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--pink-deep); background: var(--pink-pale); border-radius: 20px; padding: 4px 12px; margin-bottom: 14px; }
.csb-title { font-family: var(--font-display); font-size: 24px; color: var(--ink); margin-bottom: 8px; }
.csb-desc { font-size: 14px; color: var(--ink-muted); line-height: 1.65; margin-bottom: 20px; max-width: 290px; margin-left: auto; margin-right: auto; }

/* ── LESSON PLAYER ── */
.lesson-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid rgba(26,26,46,0.06);
  position: sticky; top: 0; background: rgba(253,248,244,0.95);
  backdrop-filter: blur(8px); z-index: 10;
}
.back-btn {
  background: none; border: 1px solid rgba(26,26,46,0.12); border-radius: 20px;
  padding: 6px 14px; font-size: 13px; color: var(--ink-soft); cursor: pointer;
  font-family: var(--font-body); flex-shrink: 0; transition: background 0.15s;
}
.back-btn:hover { background: var(--cream); }
.lesson-prog-wrap { flex: 1; display: flex; align-items: center; gap: 8px; }
.lesson-prog-bar { flex: 1; height: 4px; background: rgba(26,26,46,0.08); border-radius: 2px; }
.lesson-prog-fill { height: 100%; background: var(--pink); border-radius: 2px; transition: width 0.4s ease; }
.lesson-prog-label { font-size: 12px; color: var(--ink-muted); white-space: nowrap; }

.lesson-content { padding: 24px 20px; }

.lesson-course-info {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--ink-muted); margin-bottom: 14px;
}
.lci-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.lesson-header-block { margin-bottom: 20px; }
.lhb-num { font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--pink); margin-bottom: 6px; font-weight: 500; }
.lhb-title { font-family: var(--font-display); font-size: 28px; color: var(--ink); letter-spacing: -0.02em; line-height: 1.15; }
.lhb-desc { font-size: 14px; color: var(--ink-muted); margin-top: 8px; line-height: 1.65; }

/* chapter nav dots */
.lesson-chapter-nav {
  display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 26px;
  padding: 14px; background: var(--cream); border-radius: var(--radius-md);
}
.lcn-item {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 20px;
  cursor: pointer; transition: background 0.12s;
  font-size: 12px; color: var(--ink-muted);
}
.lcn-item:hover { background: rgba(26,26,46,0.06); }
.lcn-item.active { background: var(--pink-pale); color: var(--pink-deep); }
.lcn-item.done { color: var(--ink-faint); }
.lcn-dot {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 500;
  border: 1.5px solid rgba(26,26,46,0.14); color: var(--ink-muted);
}
.lcn-item.active .lcn-dot { background: var(--pink); border-color: var(--pink); color: white; }
.lcn-item.done .lcn-dot { background: var(--teal); border-color: var(--teal); color: white; font-size: 9px; }
.lcn-title { line-height: 1.3; }

.lesson-body-text { font-size: 15px; line-height: 1.82; color: var(--ink-soft); margin-bottom: 28px; }
.lesson-body-text p { margin-bottom: 16px; }
.lesson-body-text p:last-child { margin-bottom: 0; }
.lesson-body-text strong { color: var(--ink); font-weight: 500; }
.lesson-body-text em { font-style: italic; }

/* exercise block */
.exercise-block {
  background: var(--cream); border-radius: var(--radius-lg); padding: 20px;
  margin-bottom: 24px; border-left: 3px solid var(--pink);
}
.eb-label { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--pink); margin-bottom: 10px; font-weight: 500; }
.eb-prompt { font-size: 14px; color: var(--ink-soft); line-height: 1.72; margin-bottom: 14px; font-style: italic; }
.eb-textarea {
  width: 100%; min-height: 130px; padding: 12px;
  font-size: 14px; font-family: var(--font-body); line-height: 1.72;
  border: 1px solid rgba(26,26,46,0.12); border-radius: var(--radius-sm);
  background: var(--white); color: var(--ink); resize: vertical;
  transition: border-color 0.15s;
}
.eb-textarea:focus { outline: none; border-color: var(--pink); }
.eb-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; flex-wrap: wrap; gap: 8px; }
.eb-wc { font-size: 11px; color: var(--ink-muted); }
.eb-btns { display: flex; gap: 8px; }

.ai-feedback-block {
  background: var(--pink-pale); border-radius: var(--radius-md); padding: 16px;
  border-left: 3px solid var(--pink); margin-top: 14px;
}
.afb-label { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--pink-deep); margin-bottom: 8px; font-weight: 500; }
.afb-text { font-size: 14px; color: var(--ink-soft); line-height: 1.78; }

.lesson-nav-btns { display: flex; gap: 10px; justify-content: space-between; margin-top: 28px; padding-top: 24px; border-top: 1px solid rgba(26,26,46,0.07); }

/* course complete */
.course-complete-state {
  text-align: center; padding: 56px 24px 40px;
}
.ccs-emoji { font-size: 52px; margin-bottom: 18px; }
.ccs-title { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 8px; }
.ccs-subtitle { font-family: var(--font-display); font-size: 28px; color: var(--ink); margin-bottom: 14px; font-style: italic; }
.ccs-desc { font-size: 14px; color: var(--ink-muted); line-height: 1.75; max-width: 300px; margin: 0 auto 24px; }

/* ── VOCAB PAGE ── */
.vocab-header-block { padding: 28px 20px 0; margin-bottom: 20px; }
.vocab-stats-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; padding: 0 20px; margin-bottom: 24px; }
.vsr-item {
  background: var(--white); border: 1px solid rgba(26,26,46,0.07);
  border-radius: var(--radius-md); padding: 14px 10px; text-align: center;
}
.vsr-num { display: block; font-family: var(--font-display); font-size: 30px; color: var(--ink); line-height: 1; }
.vsr-label { font-size: 11px; color: var(--ink-muted); margin-top: 4px; display: block; }

.vocab-session-wrap { padding: 0 20px; }
.vocab-card {
  background: var(--white); border: 1px solid rgba(26,26,46,0.07);
  border-radius: var(--radius-xl); padding: 28px 24px;
  margin-bottom: 10px;
}
.vc-progress { display: flex; gap: 5px; margin-bottom: 22px; }
.vc-pip { flex: 1; height: 3px; border-radius: 2px; background: rgba(26,26,46,0.08); }
.vc-pip.done { background: var(--pink); }
.vc-pip.current { background: var(--pink-light); }
.vc-tag-pill { display: inline-block; font-size: 11px; padding: 3px 10px; border-radius: 20px; background: var(--gold-pale); color: var(--gold); margin-bottom: 16px; font-weight: 500; }
.vc-word { font-family: var(--font-display); font-size: 42px; color: var(--ink); letter-spacing: -0.02em; line-height: 1; margin-bottom: 4px; font-style: italic; }
.vc-pos { font-size: 12px; color: var(--ink-muted); font-style: italic; }
.vc-pronunciation { font-size: 14px; color: var(--pink); margin: 10px 0 16px; font-weight: 500; }
.vc-divider { height: 1px; background: rgba(26,26,46,0.06); margin: 0 0 16px; }
.vc-def { font-size: 15px; color: var(--ink); line-height: 1.72; margin-bottom: 14px; }
.vc-example {
  font-size: 14px; color: var(--ink-muted); font-style: italic; line-height: 1.65;
  padding-left: 14px; border-left: 2px solid var(--pink-light); margin-bottom: 22px;
}
.vc-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.vc-counter { font-size: 12px; color: var(--ink-faint); text-align: center; margin-top: 6px; }

.vocab-done-state {
  text-align: center; padding: 52px 20px;
  background: var(--white); border-radius: var(--radius-xl);
  border: 1px solid rgba(26,26,46,0.07);
}
.vds-icon { font-size: 52px; margin-bottom: 18px; }
.vds-title { font-family: var(--font-display); font-size: 28px; color: var(--ink); margin-bottom: 10px; }
.vds-desc { font-size: 14px; color: var(--ink-muted); line-height: 1.75; max-width: 260px; margin: 0 auto; }

/* ── SUBMIT PAGE ── */
.issue-banner-wrap { padding: 0 20px; margin-bottom: 24px; }
.issue-banner {
  background: var(--ink); border-radius: var(--radius-lg); padding: 22px 20px;
  display: flex; gap: 16px; align-items: flex-start;
}
.ib-left { flex: 1; min-width: 0; }
.ib-status { font-size: 10px; letter-spacing: 0.2em; color: var(--pink-mid); text-transform: uppercase; margin-bottom: 6px; }
.ib-theme { font-family: var(--font-display); font-size: 26px; color: var(--white); margin-bottom: 10px; letter-spacing: -0.02em; line-height: 1.1; font-style: italic; }
.ib-prompt { font-size: 13px; color: rgba(255,255,255,0.45); line-height: 1.62; }
.ib-right { text-align: right; flex-shrink: 0; }
.ib-dl-label { font-size: 10px; letter-spacing: 0.1em; color: rgba(255,255,255,0.3); text-transform: uppercase; margin-bottom: 2px; }
.ib-dl-date { font-family: var(--font-display); font-size: 26px; color: var(--pink-mid); line-height: 1.1; font-style: italic; }

.submit-form-wrap { padding: 0 20px; }
.submit-form { display: flex; flex-direction: column; gap: 18px; }
.sf-group { display: flex; flex-direction: column; gap: 6px; }
.sf-label { font-size: 13px; font-weight: 500; color: var(--ink); }
.sf-sublabel { font-size: 12px; color: var(--ink-muted); line-height: 1.5; }
.sf-input {
  padding: 11px 14px; font-size: 14px; font-family: var(--font-body);
  border: 1px solid rgba(26,26,46,0.14); border-radius: var(--radius-sm);
  background: var(--white); color: var(--ink); width: 100%;
  transition: border-color 0.15s;
}
.sf-input:focus { outline: none; border-color: var(--pink); }
.sf-textarea {
  padding: 12px 14px; font-size: 14px; font-family: var(--font-body); line-height: 1.72;
  border: 1px solid rgba(26,26,46,0.14); border-radius: var(--radius-sm);
  background: var(--white); color: var(--ink); width: 100%; resize: vertical; min-height: 180px;
  transition: border-color 0.15s;
}
.sf-textarea:focus { outline: none; border-color: var(--pink); }
.sf-textarea-sm { min-height: 72px; }
.sf-wc { font-size: 11px; color: var(--ink-muted); text-align: right; }
.sf-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.prereview-box {
  background: var(--sage-pale); border-radius: var(--radius-md); padding: 16px;
  border-left: 3px solid var(--sage); margin-top: 4px;
}
.prb-label { font-size: 10px; letter-spacing: 0.15em; text-transform: uppercase; color: var(--sage); margin-bottom: 8px; font-weight: 500; }
.prb-text { font-size: 14px; color: var(--ink-soft); line-height: 1.78; }

.submit-success { text-align: center; padding: 52px 20px; }
.ss-icon { font-size: 52px; margin-bottom: 18px; }
.ss-title { font-family: var(--font-display); font-size: 30px; color: var(--ink); margin-bottom: 10px; }
.ss-desc { font-size: 14px; color: var(--ink-muted); line-height: 1.75; max-width: 280px; margin: 0 auto 24px; }

.past-issues-wrap { padding: 0 20px; margin-top: 36px; padding-bottom: 12px; }
.past-issue-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid rgba(26,26,46,0.06); cursor: pointer;
  transition: opacity 0.15s;
}
.past-issue-row:hover { opacity: 0.7; }
.pir-num { font-size: 11px; letter-spacing: 0.1em; color: var(--ink-muted); text-transform: uppercase; min-width: 52px; flex-shrink: 0; }
.pir-body { flex: 1; }
.pir-theme { font-family: var(--font-display); font-size: 17px; color: var(--ink); font-style: italic; }
.pir-meta { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.pir-arrow { color: var(--ink-faint); font-size: 16px; }

/* ── BUTTONS ── */
.btn-primary {
  background: var(--pink); color: white; border: none;
  border-radius: 20px; padding: 11px 22px;
  font-size: 14px; font-family: var(--font-body); font-weight: 500;
  cursor: pointer; transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: var(--pink-deep); }
.btn-primary:active { transform: scale(0.98); }
.btn-outline {
  background: none; color: var(--ink);
  border: 1px solid rgba(26,26,46,0.18); border-radius: 20px; padding: 10px 22px;
  font-size: 14px; font-family: var(--font-body); cursor: pointer; transition: all 0.15s;
}
.btn-outline:hover { background: var(--cream); }
.btn-ghost {
  background: none; color: var(--ink-muted); border: none;
  font-size: 13px; font-family: var(--font-body); cursor: pointer;
  padding: 8px 14px; border-radius: var(--radius-sm); transition: background 0.15s;
}
.btn-ghost:hover { background: var(--cream); }
.btn-dark {
  background: var(--ink); color: white; border: none;
  border-radius: 20px; padding: 11px 22px;
  font-size: 14px; font-family: var(--font-body);
  cursor: pointer; transition: opacity 0.15s;
}
.btn-dark:hover { opacity: 0.85; }

/* ── MODALS ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,26,46,0.55);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 500; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--paper); border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 28px 24px calc(28px + env(safe-area-inset-bottom));
  width: 100%; max-width: 480px; position: relative;
  animation: slideup 0.28s ease;
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle { width: 40px; height: 4px; border-radius: 2px; background: rgba(26,26,46,0.14); margin: 0 auto 22px; }
.modal-title { font-family: var(--font-display); font-size: 24px; margin-bottom: 8px; font-style: italic; }
.modal-desc { font-size: 14px; color: var(--ink-muted); margin-bottom: 20px; line-height: 1.65; }
.modal-close { position: absolute; top: 20px; right: 20px; background: none; border: none; font-size: 22px; color: var(--ink-muted); cursor: pointer; line-height: 1; padding: 4px 8px; }

/* ── LOADING ── */
.dot-flashing { display: inline-flex; gap: 5px; align-items: center; }
.dot-flashing span { width: 6px; height: 6px; border-radius: 50%; background: var(--pink); animation: dotflash 1.2s infinite; }
.dot-flashing span:nth-child(2) { animation-delay: 0.2s; }
.dot-flashing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes dotflash { 0%,80%,100%{opacity:0.2} 40%{opacity:1} }

/* ── DESKTOP SIDEBAR (hidden on mobile / tablet) ── */
.desktop-sidebar { display: none; }

/* ── TABLET: centre the 480px phone shell ── */
@media (min-width: 540px) {
  #app { align-items: center; background: var(--cream-deep); }
  .topbar { width: var(--max-w); position: fixed; top: 0; left: 50%; transform: translateX(-50%); z-index: 100; }
  .pages { width: var(--max-w); background: var(--paper); margin-top: var(--top-h); box-shadow: var(--shadow-lg); flex: 1; }
  .bottom-nav { width: var(--max-w); position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); }
  .page { padding-bottom: calc(var(--nav-h) + 24px); }
  .modal { max-width: var(--max-w); }
}

/* ── DESKTOP: full sidebar layout ── */
@media (min-width: 960px) {
  :root { --sidebar-w: 252px; }

  /* Full bleed layout */
  #app {
    flex-direction: row;
    align-items: stretch;
    background: var(--paper);
  }

  /* ── Sidebar ── */
  .desktop-sidebar {
    display: flex;
    flex-direction: column;
    width: var(--sidebar-w);
    min-height: 100vh;
    background: var(--ink);
    padding: 40px 26px 30px;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 200;
    flex-shrink: 0;
  }

  .ds-brand { display: flex; flex-direction: column; gap: 0; }
  .ds-the {
    font-family: var(--font-body);
    font-size: 8px; font-weight: 300;
    letter-spacing: 0.44em; color: var(--pink-mid);
    text-transform: uppercase;
  }
  .ds-heard {
    font-family: var(--font-display);
    font-size: 52px; color: var(--white);
    line-height: 0.88; letter-spacing: -0.03em; font-style: italic;
  }
  .ds-journal {
    font-family: var(--font-body);
    font-size: 8px; font-weight: 300;
    letter-spacing: 0.44em;
    color: rgba(255,255,255,0.22);
    text-transform: uppercase; margin-top: 8px;
  }
  .ds-tagline {
    font-family: var(--font-display); font-style: italic;
    font-size: 13px; color: rgba(255,255,255,0.28);
    margin-top: 16px; margin-bottom: 40px; line-height: 1.45;
  }

  .ds-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
  .ds-item {
    display: flex; align-items: center; gap: 13px;
    padding: 12px 14px; border-radius: var(--radius-md);
    background: none; border: none; cursor: pointer;
    font-family: var(--font-body); font-size: 14px; font-weight: 400;
    color: rgba(255,255,255,0.38); text-align: left; letter-spacing: 0.01em;
    transition: background 0.15s, color 0.15s;
  }
  .ds-item:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.72); }
  .ds-item.active { background: rgba(201,67,110,0.2); color: var(--pink-mid); }
  .ds-item.active .ds-icon { color: var(--pink-mid); }
  .ds-icon { width: 18px; height: 18px; flex-shrink: 0; }

  .ds-footer {
    margin-top: auto; padding-top: 22px;
    border-top: 1px solid rgba(255,255,255,0.07);
  }
  .ds-streak-card {
    display: flex; align-items: center; gap: 13px;
    padding: 13px 14px; border-radius: var(--radius-md);
    background: rgba(255,255,255,0.05);
  }
  .ds-streak-flame { font-size: 22px; }
  .ds-streak-info { display: flex; flex-direction: column; gap: 1px; }
  .ds-streak-num {
    font-family: var(--font-display); font-size: 26px;
    color: var(--white); line-height: 1; font-style: italic;
  }
  .ds-streak-label {
    font-size: 11px; color: rgba(255,255,255,0.3); letter-spacing: 0.04em;
  }

  /* ── Topbar ── */
  .topbar {
    position: fixed;
    left: var(--sidebar-w); right: 0; top: 0;
    width: auto; transform: none; z-index: 100;
  }
  .topbar-logo { display: none; } /* logo lives in sidebar */

  /* ── Pages ── */
  .pages {
    margin-left: var(--sidebar-w);
    flex: 1; width: auto; max-width: none;
    background: var(--paper);
    box-shadow: none;
    margin-top: var(--top-h);
    overflow-y: auto;
  }
  .page { padding-bottom: 56px; }

  /* ── Bottom nav ── */
  .bottom-nav { display: none; }

  /* ── Modal ── */
  .modal-overlay { align-items: center; }
  .modal { border-radius: var(--radius-xl); }

  /* ── Home ── */
  .home-hero { padding: 56px 52px 64px; }
  .hero-title { font-size: 66px; }
  .hero-eyebrow { font-size: 11px; }
  .hero-sub { font-size: 15px; max-width: 520px; }
  .home-sections { padding: 36px 52px; gap: 36px; }
  .course-cards-scroll { margin: 0 -52px; padding: 2px 52px 4px; }
  .issue-strip { grid-template-columns: 1fr 1fr; max-width: 640px; }

  /* ── Courses ── */
  .course-grid { display: grid; grid-template-columns: 1fr 1fr; padding: 0 52px; gap: 12px; }
  .page-header { padding: 40px 52px 0; }
  .course-filter-row { padding: 0 52px 2px; }
  .coming-soon-block { margin: 24px 52px 0; }

  /* ── Vocab ── */
  .vocab-header-block { padding: 40px 52px 0; }
  .vocab-stats-row { padding: 0 52px; }
  .vocab-session-wrap { padding: 0 52px; }
  .vocab-card { max-width: 620px; }
  .vocab-done-state { max-width: 620px; }

  /* ── Submit ── */
  .issue-banner-wrap { padding: 0 52px; }
  .submit-form-wrap { padding: 0 52px; }
  .submit-form { max-width: 660px; }
  .past-issues-wrap { padding: 0 52px; }
  .prereview-box { max-width: 660px; }

  /* ── Lesson ── */
  .lesson-content { padding: 36px 52px; max-width: 820px; }
  .exercise-block { max-width: 720px; }
  .lesson-topbar { padding: 14px 52px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
