/* ============================================================
   Flashcards — redesigned UI
   Warm cream / near-black / yellow, Fraunces + Instrument Sans.
   Desktop-first sidebar shell, responsive down to mobile.
   ============================================================ */

:root {
  color-scheme: light;
  --bg: #F3F1EA;            /* page */
  --panel: #ffffff;         /* cards */
  --panel-2: #FBFAF6;       /* sidebar / inputs */
  --ink: #17150F;           /* text / solid buttons */
  --soft: #6E6A5E;          /* secondary text */
  --gray: #A6A08E;          /* labels / muted */
  --gray-2: #8A8577;
  --line: rgba(23, 21, 15, 0.08);
  --line-2: rgba(23, 21, 15, 0.14);
  --line-3: rgba(23, 21, 15, 0.2);
  --dash: rgba(23, 21, 15, 0.22);
  --yellow: #FFD43B;
  --coral: #FF7A59;
  --coral-ink: #C4561B;
  --danger: #B23A20;
  --danger-bg: #FBE9E5;
  --warn-bg: #FFF6E0;
  --warn-line: #F2DCA6;
  --warn-ink: #8A5B00;
  --hover-row: #FBFAF6;
  --hover-menu: #F7F5EE;
  --good: #1E7A3C;
  --good-2: #2FA45C;

  --card-color: var(--yellow);

  /* solid/filled controls — inverts in dark mode */
  --solid-bg: #17150F;
  --solid-ink: #ffffff;
}

[data-theme="dark"] {
  color-scheme: dark;
  --solid-bg: #FFD43B;
  --solid-ink: #17150F;
  --bg: #17150F;
  --panel: #211F18;
  --panel-2: #1C1A14;
  --ink: #F3F1EA;
  --soft: #B8B2A2;
  --gray: #8A8577;
  --gray-2: #9A9484;
  --line: rgba(243, 241, 234, 0.10);
  --line-2: rgba(243, 241, 234, 0.16);
  --line-3: rgba(243, 241, 234, 0.24);
  --dash: rgba(243, 241, 234, 0.24);
  --hover-row: #262319;
  --hover-menu: #262319;
  --warn-bg: #3A2E12;
  --warn-line: #5C4A1E;
  --warn-ink: #F2DCA6;
  --danger-bg: #3A211C;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --solid-bg: #FFD43B;
    --solid-ink: #17150F;
    --bg: #17150F;
    --panel: #211F18;
    --panel-2: #1C1A14;
    --ink: #F3F1EA;
    --soft: #B8B2A2;
    --gray: #8A8577;
    --gray-2: #9A9484;
    --line: rgba(243, 241, 234, 0.10);
    --line-2: rgba(243, 241, 234, 0.16);
    --line-3: rgba(243, 241, 234, 0.24);
    --dash: rgba(243, 241, 234, 0.24);
    --hover-row: #262319;
    --hover-menu: #262319;
    --warn-bg: #3A2E12;
    --warn-line: #5C4A1E;
    --warn-ink: #F2DCA6;
    --danger-bg: #3A211C;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Instrument Sans", -apple-system, "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

a { color: var(--ink); }
a:hover { color: var(--coral-ink); }
button { font-family: inherit; color: inherit; cursor: pointer; transition: transform .12s ease, opacity .12s ease, background .15s ease, color .15s ease, border-color .15s ease; }
input, select, textarea { font-family: inherit; }
input::placeholder, textarea::placeholder { color: var(--gray); }

.serif { font-family: "Fraunces", Georgia, serif; }
.dot { color: var(--coral); }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes popIn { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.06); } 100% { transform: scale(1); opacity: 1; } }
@keyframes confettiFall {
  0% { transform: translate3d(0, -6vh, 0) rotate(0deg); opacity: 1; }
  85% { opacity: 1; }
  100% { transform: translate3d(var(--dx, 0), 104vh, 0) rotate(var(--rot, 540deg)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .001ms !important; } }

/* ============================================================
   APP SHELL — sidebar + topbar + content
   ============================================================ */

.shell { display: flex; min-height: 100dvh; }

.sidebar {
  width: 238px;
  flex: none;
  background: var(--panel-2);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 24px 16px 18px;
  position: sticky;
  top: 0;
  height: 100dvh;
}

.brand {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 900;
  font-size: 25px;
  padding: 0 10px;
  margin-bottom: 30px;
  letter-spacing: -0.01em;
}

.brand-link { cursor: pointer; user-select: none; }

.nav-section { margin-bottom: 24px; }
.nav-head {
  font-size: 11px; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--gray);
  padding: 0 12px; margin-bottom: 8px;
}
.nav-items { display: flex; flex-direction: column; gap: 3px; }

.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 10px;
  border: none; background: none; width: 100%;
  font-size: 14px; font-weight: 600; color: var(--soft);
  text-align: left; cursor: pointer;
}
.nav-link svg { width: 18px; height: 18px; flex: none; }
.nav-link span.label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.nav-link:hover { background: var(--line); color: var(--ink); }
.nav-link.active { background: var(--line); color: var(--ink); }
.nav-link .nav-badge {
  margin-left: auto; background: var(--yellow); color: #17150F;
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; flex: none;
}

.sidebar-spacer { flex: 1; }

.persona {
  border-top: 1px solid var(--line);
  padding: 14px 10px 0;
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; flex: none;
  background: var(--ink); color: #fff;
}
.persona-meta { min-width: 0; }
.persona-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.persona-role { font-size: 11px; color: var(--gray); text-transform: capitalize; }
.icon-only {
  margin-left: auto; flex: none; background: none; border: none;
  color: var(--gray); padding: 8px; border-radius: 10px;
  display: grid; place-items: center;
}
.icon-only svg { width: 16px; height: 16px; display: block; }
.icon-only:hover { color: var(--ink); background: var(--line); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 64px; flex: none;
  display: flex; align-items: center; gap: 14px;
  padding: 0 32px;
  border-bottom: 1px solid rgba(23, 21, 15, 0.07);
}
[data-theme="dark"] .topbar { border-bottom-color: var(--line); }
.topbar-search {
  width: 320px; max-width: 40vw;
  border: 1px solid var(--line-2); background: var(--panel-2);
  border-radius: 999px; padding: 9px 18px; font-size: 13px; color: var(--ink);
  outline: none;
}
.topbar-search:focus { border-color: var(--ink); }
.topbar-spacer { flex: 1; }
.topbar-btn {
  background: none; border: none; color: var(--gray);
  padding: 8px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 6px;
}
.topbar-btn:hover { color: var(--ink); background: var(--line); }

.theme-icon-btn {
  background: none; border: none; color: var(--gray);
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; flex: none;
}
.theme-icon-btn svg { width: 18px; height: 18px; display: block; }
.theme-icon-btn:hover { color: var(--ink); background: var(--line); }

.content { flex: 1; overflow-y: auto; }
.content-inner { max-width: 1120px; margin: 0 auto; padding: 38px 40px 90px; }

.screen { animation: rise .3s ease; }
.screen.narrow { max-width: 720px; }
.screen.study-wrap { max-width: 820px; margin: 0 auto; }

/* mobile top brand + hamburger, hidden on desktop */
.mobile-head { display: none; }
.scrim { display: none; }

/* ============================================================
   TYPOGRAPHY / SHARED
   ============================================================ */

.page-title { font-weight: 700; letter-spacing: -0.02em; font-size: 31px; margin: 0 0 6px; }
.page-sub { margin: 0; color: var(--soft); font-size: 14px; }
.section-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.09em;
  color: var(--gray); text-transform: uppercase;
}
.back-btn {
  background: none; border: none; padding: 0; margin-bottom: 14px;
  font-size: 13px; font-weight: 600; color: var(--soft); cursor: pointer;
}
.back-btn:hover { color: var(--ink); }
.muted { color: var(--gray); }

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  border: none; border-radius: 999px; padding: 11px 22px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; line-height: 1.2;
}
.btn-primary { background: var(--solid-bg); color: var(--solid-ink); }
.btn-primary:hover { opacity: 0.88; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line-3); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-block { width: 100%; padding: 14px; font-size: 14px; }
.btn-sm { padding: 8px 16px; font-size: 12px; }
.btn-lg { padding: 14px 30px; font-size: 15px; }
.btn:disabled { opacity: 0.55; cursor: wait; }
.btn-danger-ghost { background: transparent; color: var(--danger); border: 1px solid rgba(178, 58, 32, 0.4); border-radius: 999px; padding: 10px 20px; font-size: 12px; font-weight: 600; }
.btn-danger-ghost:hover { border-color: var(--danger); }

.icon-btn-round {
  background: transparent; border: 1px solid var(--line-3);
  border-radius: 999px; width: 42px; height: 42px;
  font-size: 17px; font-weight: 700; color: var(--ink); line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn-round:hover { border-color: var(--ink); }

/* ============================================================
   FORMS
   ============================================================ */

.input, .textarea, select.input {
  width: 100%; border: 1px solid var(--line-2); background: var(--panel-2);
  border-radius: 12px; padding: 11px 14px; font-size: 14px; color: var(--ink);
  outline: none;
}
.textarea { line-height: 1.5; resize: vertical; min-height: 150px; }
.input:focus, .textarea:focus, select.input:focus { border-color: var(--ink); }
input[type="date"].input { padding: 10px 14px; }
/* personal deck generator */
.field-hint { display: block; margin-top: 6px; font-size: 12px; color: var(--gray); }
.deck-quota { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 13px; }
.deck-form-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-top: 14px; flex-wrap: wrap;
}
.deck-form-foot .muted { font-size: 12px; }
.deck-form-foot .muted.over { color: var(--danger); font-weight: 600; }
#deck-content { resize: vertical; min-height: 150px; font: inherit; line-height: 1.5; }

.field { display: block; }
.field > .section-label { display: block; margin-bottom: 8px; }
.field + .field { margin-top: 18px; }

.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--gray); padding: 8px;
  display: grid; place-items: center;
}
.pw-toggle svg { width: 16px; height: 16px; display: block; }
.pw-toggle:hover { color: var(--ink); }

.seg-pill {
  display: inline-flex; background: var(--line); border-radius: 999px; padding: 3px;
}
.seg-pill button {
  border: none; background: none; border-radius: 999px;
  padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--soft);
  white-space: nowrap;
}
.seg-pill button.active { background: var(--solid-bg); color: var(--solid-ink); }

.status { margin: 0; font-size: 13px; font-weight: 500; color: var(--soft); }
.status.error { color: var(--danger); }

/* ============================================================
   CARDS / PANELS
   ============================================================ */

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.panel.pad { padding: 20px; }
.panel-lg { border-radius: 18px; }
.card-shadow { box-shadow: 0 1px 2px rgba(23, 21, 15, 0.04); }

.dashed-card {
  border: 1.5px dashed var(--dash); border-radius: 18px; padding: 24px;
}
.empty-state { text-align: center; padding: 40px; }
.empty-state .es-title { font-weight: 700; letter-spacing: -0.01em; font-size: 19px; margin-bottom: 8px; }
.empty-state p { margin: 0 0 16px; font-size: 14px; color: var(--soft); }

.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat-cards.four { grid-template-columns: repeat(4, 1fr); }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.stat-card.accent { background: var(--yellow); border-color: transparent; color: #17150F; }
.stat-card .sc-value { font-weight: 700; letter-spacing: -0.02em; font-size: 25px; }
.stat-card .sc-label { font-size: 12px; color: var(--soft); margin-top: 2px; }
.stat-card.accent .sc-label { color: rgba(23, 21, 15, 0.65); }

/* progress bar */
.bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar.tall { height: 8px; }
.bar > i { display: block; height: 100%; background: var(--solid-bg); border-radius: 999px; }
.bar.good > i { background: var(--good-2); }

/* code chip */
.code-chip {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 4px 10px; font-weight: 700; letter-spacing: 3px; font-size: 13px; color: var(--ink);
}
.mini-copy { background: none; border: none; color: var(--soft); padding: 4px; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; }
.mini-copy svg { width: 13px; height: 13px; display: block; }
.mini-copy:hover { color: var(--ink); }

/* badge chips */
.chip {
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px;
  background: var(--line); color: var(--ink);
}
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.chip.danger { background: var(--danger-bg); color: var(--danger); }
.chip.role { background: var(--line); }
.chip.pill-gray { background: var(--panel-2); border: 1px solid var(--line); }

/* status pills for admin/roster */
.pill-status { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; display: inline-block; }
.pill-status.approved { background: #E4F2E6; color: var(--good); }
.pill-status.pending { background: var(--warn-bg); color: var(--warn-ink); }
.pill-status.rejected { background: var(--danger-bg); color: var(--danger); }
.pill-status.admin { background: var(--ink); color: #fff; }
[data-theme="dark"] .pill-status.approved { background: #22331F; color: #8FD9A0; }
[data-theme="dark"] .pill-status.admin { background: var(--yellow); color: #17150F; }

/* ============================================================
   CLASSES GRID (teacher)
   ============================================================ */

.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 20px; margin-top: 28px; }
.class-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 24px; display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 1px 2px rgba(23, 21, 15, 0.04);
}
.class-card .cc-title { font-weight: 700; letter-spacing: -0.01em; font-size: 19px; }
.class-card .cc-code-row { display: flex; align-items: center; gap: 8px; }
.cc-stats { display: flex; gap: 22px; font-size: 13px; color: var(--soft); flex-wrap: wrap; }
.cc-stats b { color: var(--ink); }
.class-card .cc-stats b { color: var(--ink); }
.create-class {
  border: 1.5px dashed var(--dash); border-radius: 18px; padding: 24px;
  display: flex; flex-direction: column; gap: 14px; justify-content: center;
}
.checkbox-row { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; cursor: pointer; }
.checkbox-row input { width: 16px; height: 16px; accent-color: var(--ink); cursor: pointer; }

/* ============================================================
   TABS
   ============================================================ */

.tabs { display: flex; gap: 6px; margin: 26px 0 22px; border-bottom: 1px solid rgba(23, 21, 15, 0.09); }
[data-theme="dark"] .tabs { border-bottom-color: var(--line); }
.tab {
  background: none; border: none; padding: 10px 4px; margin-bottom: -1px;
  font-size: 14px; font-weight: 600; color: var(--soft);
  border-bottom: 2px solid transparent;
}
.tab + .tab { margin-left: 14px; }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }
.tab:hover { color: var(--ink); }

.dropdown { position: relative; }
.menu {
  position: absolute; top: 48px; right: 0; background: var(--panel);
  border: 1px solid var(--line-2); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(23, 21, 15, 0.14);
  padding: 6px; min-width: 190px; z-index: 30; animation: rise .18s ease;
  display: flex; flex-direction: column;
}
.menu button {
  background: none; border: none; text-align: left;
  padding: 10px 14px; font-size: 13px; font-weight: 600; border-radius: 9px; color: var(--ink);
}
.menu button:hover { background: var(--hover-menu); }
.menu button.danger { color: var(--danger); }
.menu button.danger:hover { background: var(--danger-bg); }

/* ============================================================
   DATA TABLES (lessons, roster, admin accounts)
   ============================================================ */

.table { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.table-head, .table-row {
  display: grid; gap: 14px; align-items: center; padding: 13px 20px;
}
.table-head {
  font-size: 10px; font-weight: 700; letter-spacing: 0.09em; color: var(--gray);
  text-transform: uppercase; border-bottom: 1px solid rgba(23, 21, 15, 0.07);
  padding: 12px 20px;
}
[data-theme="dark"] .table-head { border-bottom-color: var(--line); }
.table-row { border-bottom: 1px solid rgba(23, 21, 15, 0.05); }
[data-theme="dark"] .table-row { border-bottom-color: var(--line); }
.table-row:last-child { border-bottom: none; }
.table-row.clickable { cursor: pointer; }
.table-row.clickable:hover, .table-row.hoverable:hover { background: var(--hover-row); }

/* column templates */
.cols-lessons { grid-template-columns: 2.4fr 0.8fr 1.6fr; }
.cols-decks { grid-template-columns: 2.6fr 0.7fr auto; }
.cols-roster { grid-template-columns: 2.2fr 0.8fr 1.3fr 0.8fr 0.9fr auto; }
.cols-accounts { grid-template-columns: 2.4fr 0.8fr 1.6fr 0.8fr 0.9fr auto; }
.cols-teachers { grid-template-columns: 2.2fr 2fr 0.9fr; }
/* admin teacher/class cards: per-item lines (class in a teacher profile,
   student in a class card) */
.tc-classes { display: flex; flex-direction: column; gap: 0; }
.tc-class {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  font-size: 13px; padding: 7px 0; border-top: 1px dashed var(--line-2);
}
.tc-class.no-line { border-top: none; padding-top: 2px; }
.tc-class .t { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tc-class .s { color: var(--gray); font-size: 12px; flex-shrink: 0; }
.class-card .pill-status { align-self: flex-start; }

.cell-primary { font-size: 14px; font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--gray); margin-top: 1px; }
.cell-text { font-size: 13px; color: var(--soft); }
.cell-mut { font-size: 12px; color: var(--gray); }
.name-cell { display: flex; align-items: center; gap: 12px; }
.name-cell .avatar { width: 32px; height: 32px; }
.progress-cell { display: flex; align-items: center; gap: 10px; }
.progress-cell .bar { flex: 1; }
.progress-cell span { font-size: 12px; color: var(--soft); white-space: nowrap; }
.view-link { font-size: 13px; font-weight: 600; color: var(--soft); }
.row-actions { display: flex; gap: 12px; }
.text-action { background: none; border: none; font-size: 12px; font-weight: 600; color: var(--soft); padding: 0; }
.text-action:hover { color: var(--ink); }
.text-action.danger { color: var(--danger); }

/* pending banner */
.pending-banner {
  background: var(--warn-bg); border: 1px solid var(--warn-line);
  border-radius: 16px; padding: 18px 20px; margin-bottom: 16px; animation: rise .3s ease;
}
.pending-banner .pb-title { font-size: 13px; font-weight: 700; margin-bottom: 12px; }
.pending-row { display: flex; align-items: center; gap: 12px; }
.pending-row + .pending-row { margin-top: 10px; }
.pending-row .avatar { width: 30px; height: 30px; background: var(--panel); color: var(--ink); border: 1px solid var(--line-2); }

/* overview split */
.overview-split { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.overview-col { display: flex; flex-direction: column; gap: 16px; }
.mini-list { display: flex; flex-direction: column; gap: 12px; }
.mini-list-row { display: flex; align-items: center; gap: 12px; }
.mini-list-row .grow { flex: 1; font-size: 14px; font-weight: 600; }
.ann-row { display: flex; gap: 12px; align-items: baseline; }
.ann-row .grow { flex: 1; font-size: 14px; }
.ann-when { font-size: 11px; color: var(--gray); flex: none; }
.ann-form { display: flex; gap: 10px; margin-bottom: 16px; }
.ann-form .input { border-radius: 999px; padding: 10px 16px; font-size: 13px; }

/* leaderboard */
.lb-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; }
.lb-row:hover { background: var(--hover-menu); }
.lb-row.me { background: var(--yellow); color: #17150F; }
.lb-rank { width: 20px; font-weight: 700; font-size: 13px; color: var(--gray); }
.lb-row.me .lb-rank { color: rgba(23,21,15,.6); }
.lb-avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: 700; flex: none; }
.lb-name { font-size: 14px; font-weight: 600; flex: 1; }
.lb-pts { font-size: 13px; color: var(--soft); }
.lb-row.me .lb-pts { color: rgba(23,21,15,.7); }

/* ============================================================
   STUDENT HOME
   ============================================================ */

.due-banner {
  background: var(--yellow); color: #17150F; border-radius: 18px;
  padding: 26px 30px; margin-top: 26px;
  display: flex; align-items: center; gap: 24px;
}
.due-banner .db-big { font-weight: 700; letter-spacing: -0.02em; font-size: 34px; line-height: 1.1; }
.due-banner .db-sub { font-size: 14px; margin-top: 8px; color: rgba(23, 21, 15, 0.72); }
.due-banner .grow { flex: 1; }

.badge-row { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.badge-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; font-size: 13px; font-weight: 600;
}
.badge-chip.locked { opacity: 0.4; filter: grayscale(1); }

.home-classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; align-items: stretch; margin-top: 14px; }
.home-class-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.home-class-card .hcc-title { font-weight: 700; letter-spacing: -0.01em; font-size: 19px; }

/* compact join-a-class: a small button that expands on demand */
/* with no class there's no leaderboard, so the calendar takes the full row */
.mini-grid-2:has(> .panel[hidden]) { grid-template-columns: 1fr; }

/* admin: password reset result */
.reset-pw {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 16px 18px; margin-top: 18px;
}
.reset-pw code { font-size: 19px; font-weight: 700; letter-spacing: 0.5px; color: var(--ink); }

/* deck generation progress */
.gen-progress { margin-top: 18px; }
.gp-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.gp-phase { font-size: 13.5px; font-weight: 600; color: var(--ink); }
.gp-time { font-size: 12px; color: var(--gray); font-variant-numeric: tabular-nums; }
.gp-track { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; }
.gp-fill {
  height: 100%; width: 0%; border-radius: 999px; background: var(--yellow);
  transition: width .6s cubic-bezier(.22,.61,.36,1);
  position: relative; overflow: hidden;
}
/* a moving sheen, so a slow stretch still reads as "working" */
.gp-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.55), transparent);
  animation: gpSheen 1.4s ease-in-out infinite;
}
.gp-fill.done { background: var(--good-2); }
.gp-fill.done::after { animation: none; }
@keyframes gpSheen { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.gp-steps { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; }
.gp-step { font-size: 11px; font-weight: 600; color: var(--gray); transition: color .3s; }
.gp-step.active { color: var(--ink); }
.gp-step.done { color: var(--soft); }
.gp-step.done::before { content: "✓ "; }

/* landing: install strip */
.lp-install { display: flex; flex-direction: column; align-items: center; gap: 18px; margin-top: 28px; }
.lp-install-hints { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 22px; }
.lp-install-hints span { font-size: 13px; color: var(--soft); }
.lp-install-hints b { color: var(--ink); font-weight: 700; margin-right: 5px; }

/* install / save to device */
.install-hero {
  margin-top: 22px; background: var(--yellow); color: #17150F; border-radius: 18px;
  padding: 26px 28px; display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.install-hero .ih-big { font-weight: 700; letter-spacing: -0.02em; font-size: 25px; }
.install-hero .ih-sub { font-size: 14px; margin-top: 4px; opacity: .8; }
.install-hero .grow { flex: 1 1 240px; }
.install-guides { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.install-guide .ig-head { display: flex; align-items: center; gap: 10px; font-size: 14.5px; margin-bottom: 12px; }
.install-guide .ig-ico { font-size: 20px; }
.install-guide ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 9px; }
.install-guide li { font-size: 13.5px; line-height: 1.5; color: var(--soft); }
.install-guide li b { color: var(--ink); font-weight: 700; }
.install-guide .ig-note { margin: 12px 0 0; font-size: 12px; color: var(--gray); }

/* "join a class" sits in the class grid as a dashed sibling card */
.home-class-card.join-card {
  background: transparent; border-style: dashed; border-color: var(--line-2);
  justify-content: center;
}
.home-class-card.join-card .hcc-title { font-size: 17px; }
.join-card-row { display: flex; gap: 10px; align-items: center; }
.join-card-row .input {
  flex: 1 1 auto; min-width: 0; text-transform: uppercase; letter-spacing: 2px;
}
.join-card-row .btn { flex: 0 0 auto; }

.join-inline { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.join-inline .join-row { display: flex; gap: 10px; }

/* badges page */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 26px; }
.badge-tile { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; }
.badge-tile .b-emoji { font-size: 30px; }
.badge-tile .b-name { font-weight: 700; font-size: 15px; margin-top: 8px; }
.badge-tile .b-desc { font-size: 12.5px; color: var(--soft); line-height: 1.4; margin-top: 2px; }
.badge-tile .b-when { font-size: 11px; color: var(--gray); margin-top: 8px; }
.badge-tile.locked { opacity: 0.45; filter: grayscale(1); }

/* home dashboard extras: calendar + xp */
.mini-grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 16px; align-items: start; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; max-width: 260px; }
.cal-day { aspect-ratio: 1; border-radius: 5px; background: var(--line); }
.cal-day.on { background: var(--good-2); }
.xp-line { display: flex; justify-content: space-between; font-size: 12px; color: var(--soft); margin-bottom: 6px; }

/* ============================================================
   STUDY
   ============================================================ */

.study-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.study-title { font-weight: 700; letter-spacing: -0.02em; font-size: 26px; margin: 0; flex: 1; }
.study-pos { background: var(--panel); border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 700; }
.dir-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.study-progress { margin: 20px 0 24px; }

.mode-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin: 18px 0 4px; scrollbar-width: none; }
.mode-row::-webkit-scrollbar { display: none; }
.mode-chip {
  flex: none; border: 1px solid var(--line-3); background: transparent; border-radius: 999px;
  padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap;
}
.mode-chip.active { background: var(--solid-bg); color: var(--solid-ink); border-color: var(--solid-bg); }

.flip-stage { perspective: 1400px; animation: cardIn .35s ease; }
.flipper {
  position: relative; width: 100%; height: clamp(360px, 52vh, 460px);
  transform-style: preserve-3d; transition: transform .55s cubic-bezier(.35,.1,.2,1); cursor: pointer;
}
.flipper.flipped { transform: rotateY(180deg); }
@media (prefers-reduced-motion: reduce) { .flipper { transition: none; } }
.flip-face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  border-radius: 22px; padding: 28px 32px; display: flex; flex-direction: column;
  box-shadow: 0 2px 6px rgba(23, 21, 15, 0.08); user-select: none;
}
.flip-front { background: var(--yellow); color: #17150F; }
.flip-back { background: var(--ink); color: var(--yellow); transform: rotateY(180deg); }
[data-theme="dark"] .flip-back { background: #000; }
.flip-top { display: flex; align-items: center; }
.flip-cat {
  background: rgba(23, 21, 15, 0.08); font-size: 10px; font-weight: 700; letter-spacing: 0.09em;
  padding: 4px 10px; border-radius: 999px; text-transform: uppercase;
}
.flip-back .flip-cat { background: rgba(255, 212, 59, 0.14); }
.speak-btn {
  background: rgba(255, 255, 255, 0.55); border: none; border-radius: 50%;
  width: 38px; height: 38px; color: #17150F; display: grid; place-items: center; margin-left: auto;
}
.speak-btn svg { width: 17px; height: 17px; display: block; }
.speak-btn:hover { background: #fff; }
.flip-back .speak-btn { background: rgba(255, 212, 59, 0.14); color: var(--yellow); }
.flip-back .speak-btn:hover { background: rgba(255, 212, 59, 0.28); }
.flip-body { flex: 1; display: grid; place-items: center; text-align: center; padding: 20px 0; }
.flip-word { font-family: "Fraunces", Georgia, serif; font-weight: 900; font-size: clamp(2rem, 6vw, 46px); line-height: 1.15; overflow-wrap: anywhere; }
.flip-word.back { font-size: clamp(1.7rem, 5vw, 38px); line-height: 1.2; }
.flip-ipa { font-size: 13px; margin-top: 12px; opacity: .45; letter-spacing: .02em; font-style: italic; }
/* label the phonetic line so nobody mistakes it for broken text */
.flip-ipa:not(:empty)::before, .mc-ipa:not(:empty)::before {
  content: "pronunciation";
  display: block;
  font-size: 9px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  font-style: normal; opacity: .8; margin-bottom: 2px;
}
.flip-ex { font-size: 15px; margin-top: 14px; color: rgba(255, 212, 59, 0.75); font-style: italic; }
.flip-hint-line { font-size: 12px; opacity: .55; }
.flip-back .flip-hint-line { color: rgba(255, 212, 59, 0.6); }
.flip-tools { display: flex; gap: 8px; }
.flip-tool {
  background: rgba(255,255,255,.5); border: none; border-radius: 50%; width: 34px; height: 34px;
  font-size: 14px; color: #17150F; display: grid; place-items: center;
}
.flip-tool:hover { background: #fff; }

.study-actions { display: flex; gap: 12px; justify-content: center; margin-top: 22px; }
.study-actions .btn { padding: 13px 30px; font-size: 14px; }

/* icon nav for flip (prev/flip/next) */
.flip-nav { display: flex; justify-content: center; gap: 18px; margin-top: 18px; }
.round-btn {
  width: 54px; height: 54px; border-radius: 50%; border: 1px solid var(--line-3);
  background: transparent; display: grid; place-items: center; color: var(--ink);
}
.round-btn svg { width: 20px; height: 20px; }
.round-btn:hover { background: var(--solid-bg); color: var(--solid-ink); }

/* deck complete */
.deck-done { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 48px; text-align: center; animation: popIn .4s ease; }
.deck-done .dd-title { font-weight: 700; letter-spacing: -0.02em; font-size: 28px; margin-bottom: 10px; }
.deck-done p { margin: 0 0 24px; font-size: 15px; color: var(--soft); }
.deck-done b { color: var(--ink); }
.confetti-layer { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 70; }
.confetti-layer span { position: absolute; top: 0; width: 9px; height: 14px; border-radius: 2px; animation: confettiFall 2.4s linear forwards; }

/* ============================================================
   LEARN / QUIZ / TYPE / MATCH (extra modes, restyled)
   ============================================================ */

.deck-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 6px 0 14px; }
.counter-chip { flex-shrink: 0; font-size: 13px; font-weight: 600; background: var(--panel); border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 14px; }

.mode-card {
  border-radius: 22px; background: var(--yellow); color: #17150F;
  padding: 26px 30px; min-height: 240px; display: flex; flex-direction: column;
  box-shadow: 0 2px 6px rgba(23, 21, 15, 0.08); margin-bottom: 16px; position: relative;
}
.mode-card .mc-cat { align-self: flex-start; background: rgba(23,21,15,.08); font-size: 10px; font-weight: 700; letter-spacing: .09em; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; }
.mode-card .mc-word { font-family: "Fraunces", Georgia, serif; font-weight: 900; font-size: clamp(1.7rem, 6vw, 40px); line-height: 1.1; margin: 16px 0 2px; overflow-wrap: anywhere; }
.mode-card .mc-ipa { font-size: 13px; opacity: .45; font-style: italic; letter-spacing: .02em; }
.mode-card .mc-hint { font-size: 14px; font-style: italic; opacity: .75; margin-top: 8px; }
.mode-card .speak-btn { position: absolute; right: 22px; top: 22px; margin-left: 0; }

#learn-answer { border-top: 2px dashed rgba(23,21,15,.25); margin-top: 16px; padding-top: 12px; display: flex; flex-direction: column; gap: 5px; }
.learn-back { font-weight: 700; font-size: 1.3rem; }
.learn-ex { font-size: .98rem; font-style: italic; opacity: .8; }

.grade-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.grade-btn { border: none; border-radius: 14px; padding: 12px 4px 10px; font-size: 14px; font-weight: 700; color: #17150F; display: flex; flex-direction: column; align-items: center; gap: 1px; }
.grade-btn small { font-size: 10.5px; font-weight: 600; opacity: .6; }
.g-again { background: var(--coral); }
.g-hard { background: var(--yellow); }
.g-good { background: #B7E3C0; }
.g-easy { background: #CBD9F2; }

.quiz-choices { display: grid; gap: 10px; }
.choice {
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px;
  padding: 15px 17px; text-align: left; font-size: 15px; font-weight: 500; line-height: 1.35; color: var(--ink);
}
.choice.correct { background: #B7E3C0; border-color: #B7E3C0; color: #17150F; font-weight: 600; }
.choice.wrong { background: var(--coral); border-color: var(--coral); color: #17150F; }
.choice.dim { opacity: 0.45; }
.choice:disabled { cursor: default; }
.quiz-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; }
.score-line { font-weight: 600; font-size: 14px; color: var(--soft); margin: 0; }
.quiz-timer { font-family: "Fraunces", Georgia, serif; font-weight: 800; font-size: 1.4rem; text-align: center; margin: 0 0 10px; }
.replay-btn { align-self: flex-start; margin-top: 12px; }

.type-feedback { font-weight: 600; margin: 12px 2px 0; }
.type-feedback.good { color: var(--good); }
.type-feedback.bad { color: var(--danger); }

.match-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.match-tile { border: 1px solid var(--line-2); background: var(--panel); border-radius: 14px; min-height: 84px; padding: 8px; font-size: 13px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--ink); }
.match-tile.sel { border-color: var(--ink); background: var(--line); }
.match-tile.matched { background: #B7E3C0; border-color: #B7E3C0; color: #17150F; opacity: .75; pointer-events: none; }
.match-tile.wrong { background: var(--coral); border-color: var(--coral); color: #17150F; }

.result-card { background: var(--yellow); color: #17150F; border-radius: 22px; padding: 40px 32px; text-align: center; margin-top: 2vh; animation: popIn .4s ease; }
.result-score { font-family: "Fraunces", Georgia, serif; font-weight: 900; font-size: 3.4rem; margin: 8px 0 0; line-height: 1; }
.result-line { font-weight: 600; margin: 6px 0 0; }
.result-xp { font-weight: 700; margin: 12px 0 0; }
.result-rank { font-weight: 500; opacity: .7; margin: 6px 0 0; }
.result-badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.result-actions { display: grid; gap: 10px; margin-top: 16px; max-width: 360px; margin-left: auto; margin-right: auto; }

/* ============================================================
   SEARCH RESULTS
   ============================================================ */
.search-list { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 8px; }
.search-item { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 12px 15px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.search-item .grow { flex: 1; min-width: 0; }
.search-item .grow .sub { display: block; font-size: 12px; color: var(--gray); }
.search-item .flip-tool { background: var(--panel-2); border: 1px solid var(--line-2); color: var(--ink); }

/* ============================================================
   LANDING PAGE
   ============================================================ */

.landing { min-height: 100dvh; }

.lp-nav {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 40px; max-width: 1240px; margin: 0 auto;
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
}
.lp-nav .brand { margin: 0; padding: 0; font-size: 23px; }
.lp-nav-links { display: flex; gap: 22px; margin-left: 34px; }
.lp-nav-links a { font-size: 14px; font-weight: 600; color: var(--soft); text-decoration: none; }
.lp-nav-links a:hover { color: var(--ink); }
.lp-nav-spacer { flex: 1; }

.lp-hero {
  max-width: 1240px; margin: 0 auto; padding: 40px 40px 70px;
  display: grid; grid-template-columns: 1.08fr 0.92fr; gap: 50px; align-items: center;
}
.lp-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.14em; color: var(--gray); }
.lp-title {
  font-family: "Fraunces", Georgia, serif; font-weight: 900;
  font-size: clamp(2.4rem, 4.2vw, 3.6rem); line-height: 1.06;
  letter-spacing: -0.02em; margin: 18px 0 0;
}
.lp-lede { font-size: 17px; line-height: 1.6; color: var(--soft); margin: 22px 0 0; max-width: 520px; }
.lp-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.lp-cta.center { justify-content: center; }
.lp-note { font-size: 12.5px; color: var(--gray); margin: 16px 0 0; }

/* hero art — two stacked cards + floating stat pills */
.lp-hero-art { position: relative; min-height: 400px; display: grid; place-items: center; }
.lp-card {
  position: absolute; width: min(310px, 74%); border-radius: 24px; padding: 26px;
  display: flex; flex-direction: column; box-shadow: 0 14px 40px rgba(23, 21, 15, 0.16);
}
.lp-card-front { background: var(--yellow); color: #17150F; transform: rotate(-4deg); z-index: 2; min-height: 300px; }
/* the back card is always near-black — it must not invert with the theme */
.lp-card-back { background: #17150F; color: var(--yellow); transform: rotate(6deg) translate(34px, 26px); min-height: 300px; }
[data-theme="dark"] .lp-card-back { background: #000; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .lp-card-back { background: #000; }
}
.lp-card-cat {
  align-self: flex-start; font-size: 10px; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; padding: 4px 10px; border-radius: 999px;
  background: rgba(23, 21, 15, 0.08);
}
.lp-card-back .lp-card-cat { background: rgba(255, 212, 59, 0.14); }
.lp-card-word {
  font-family: "Fraunces", Georgia, serif; font-weight: 900; font-size: 40px;
  line-height: 1.1; margin: auto 0; padding: 20px 0;
}
.lp-card-ipa { font-size: 12px; font-style: italic; opacity: 0.55; margin-top: -14px; padding-bottom: 16px; }
.lp-card-foot { font-size: 12px; opacity: 0.5; margin-top: auto; }
.lp-float {
  position: absolute; background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 16px; font-size: 13px; font-weight: 700;
  box-shadow: 0 8px 24px rgba(23, 21, 15, 0.12); z-index: 3;
  display: inline-flex; align-items: center; gap: 7px;
}
.lp-float-ico { width: 15px; height: 15px; flex: none; color: var(--coral); }
.lp-float-ico svg { width: 100%; height: 100%; display: block; }
.lp-float-1 { top: 8%; left: 0; }
.lp-float-2 { bottom: 10%; right: 2%; background: var(--yellow); color: #17150F; border-color: transparent; }

.lp-strip {
  max-width: 1240px; margin: 0 auto; padding: 0 40px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
}
.lp-strip > div {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px; text-align: center;
}
.lp-strip b { display: block; font-family: "Fraunces", Georgia, serif; font-weight: 900; font-size: 30px; line-height: 1; }
.lp-strip span { display: block; font-size: 12.5px; color: var(--soft); margin-top: 6px; }

.lp-section { max-width: 1240px; margin: 0 auto; padding: 80px 40px 0; }
.lp-h2 {
  font-family: "Fraunces", Georgia, serif; font-weight: 900;
  font-size: clamp(1.8rem, 3.4vw, 2.6rem); letter-spacing: -0.02em;
  line-height: 1.12; margin: 12px 0 0;
}
.lp-sub { font-size: 15px; color: var(--soft); margin: 12px 0 0; max-width: 620px; }

.lp-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 34px; }
.lp-step { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 28px; }
.lp-step-n {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  background: var(--solid-bg); color: var(--solid-ink); font-weight: 800; font-size: 16px;
}
.lp-step h3 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; margin: 16px 0 8px; }
.lp-step p { font-size: 14px; line-height: 1.55; color: var(--soft); margin: 0; }

.lp-modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 34px; }
.lp-mode {
  background: var(--panel); border: 1px solid var(--line); border-radius: 18px;
  padding: 22px; display: flex; flex-direction: column;
}
.lp-mode-ico { display: block; width: 26px; height: 26px; color: var(--ink); }
.lp-mode-ico svg { width: 100%; height: 100%; display: block; }
.lp-mode h3 { font-size: 17px; font-weight: 700; margin: 12px 0 6px; }
.lp-mode-desc { font-size: 13.5px; line-height: 1.5; color: var(--soft); margin: 0 0 14px; flex: 1; }
.lp-mode-tag {
  align-self: flex-start; font-size: 11px; font-weight: 700; padding: 4px 10px;
  border-radius: 999px; background: var(--line); color: var(--soft);
}

.lp-feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 34px; }
.lp-feature { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.lp-feat-ico { display: block; width: 24px; height: 24px; color: var(--ink); }
.lp-feat-ico svg { width: 100%; height: 100%; display: block; }
.lp-feature h3 { font-size: 17px; font-weight: 700; margin: 12px 0 6px; }
.lp-feature p { font-size: 13.5px; line-height: 1.55; color: var(--soft); margin: 0; }

.lp-final {
  max-width: 1240px; margin: 90px auto 0; padding: 0 40px;
}
.lp-final > h2 {
  background: var(--yellow); color: #17150F; border-radius: 26px 26px 0 0;
  font-family: "Fraunces", Georgia, serif; font-weight: 900;
  font-size: clamp(1.8rem, 3.4vw, 2.6rem); letter-spacing: -0.02em;
  margin: 0; padding: 54px 40px 0; text-align: center;
}
.lp-final > p { background: var(--yellow); color: rgba(23, 21, 15, 0.72); margin: 0; padding: 14px 40px 0; text-align: center; font-size: 15px; }
.lp-final .lp-cta { background: var(--yellow); margin: 0; padding: 28px 40px 54px; border-radius: 0 0 26px 26px; }
.lp-final .btn-ghost { border-color: rgba(23, 21, 15, 0.3); color: #17150F; }
.lp-final .btn-ghost:hover { border-color: #17150F; }
.lp-final .btn-primary { background: #17150F; color: var(--yellow); }

.lp-foot {
  max-width: 1240px; margin: 0 auto; padding: 40px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  font-size: 13px; color: var(--gray);
}
.lp-foot .brand { margin: 0; padding: 0; font-size: 19px; color: var(--ink); }

@media (max-width: 1023px) {
  .lp-nav { padding: 14px 18px; }
  .lp-nav-links { display: none; }
  .lp-hero { grid-template-columns: 1fr; gap: 0; padding: 24px 18px 50px; }
  .lp-hero-art { min-height: 330px; margin-top: 46px; }
  .lp-strip { grid-template-columns: repeat(2, 1fr); padding: 0 18px; }
  .lp-section { padding: 60px 18px 0; }
  .lp-steps, .lp-feature-grid { grid-template-columns: 1fr; }
  .lp-final { padding: 0 18px; margin-top: 64px; }
  .lp-final > h2 { padding: 38px 24px 0; }
  .lp-final > p { padding: 12px 24px 0; }
  .lp-final .lp-cta { padding: 24px 24px 38px; }
  .lp-foot { padding: 30px 18px; }
}
@media (max-width: 560px) {
  .lp-cta .btn { width: 100%; }
  .lp-strip { grid-template-columns: 1fr; }
  .lp-card { width: min(280px, 86%); }
  .lp-float-1 { top: 2%; }
}

/* ============================================================
   AUTH — full screen
   ============================================================ */

.auth-page { min-height: 100dvh; display: block; padding: 0; }
.auth-card {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  max-width: none; width: 100%; min-height: 100dvh; align-items: stretch;
}
.auth-hero {
  background: var(--yellow); color: #17150F; border-radius: 0;
  padding: 56px clamp(40px, 5vw, 76px); display: flex; flex-direction: column; justify-content: center;
  position: relative;
}
.auth-back {
  position: absolute; top: 30px; left: clamp(40px, 5vw, 76px);
  background: none; border: none; padding: 0;
  font-size: 13px; font-weight: 700; color: rgba(23, 21, 15, 0.65);
}
.auth-back:hover { color: #17150F; }
.auth-hero .ah-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; margin-bottom: 14px; }
.auth-hero .ah-title { font-family: "Fraunces", Georgia, serif; font-weight: 900; font-size: clamp(56px, 6vw, 76px); line-height: 1.02; }
.auth-hero p { margin: 22px 0 0; font-size: 15px; line-height: 1.55; max-width: 380px; }
.ah-points { list-style: none; margin: 30px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; max-width: 380px; }
.ah-points li { position: relative; padding-left: 26px; font-size: 14px; line-height: 1.45; }
.ah-points li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  font-weight: 800; color: rgba(23, 21, 15, 0.55);
}
.auth-form {
  background: var(--panel); border: none; border-radius: 0;
  padding: 56px clamp(28px, 4vw, 64px); display: flex; flex-direction: column;
  gap: 16px; justify-content: center; overflow-y: auto;
}
.auth-form > * { width: 100%; max-width: 420px; margin-left: auto; margin-right: auto; }
.auth-form .af-title { font-weight: 700; letter-spacing: -0.02em; font-size: 24px; }
.auth-form .af-sub { font-size: 13px; color: var(--soft); margin-top: 4px; }
.role-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.role-btn { border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 12px; padding: 12px; text-align: left; color: var(--ink); }
.role-btn.active { border-color: var(--ink); background: var(--panel); }
.role-btn .rb-title { font-size: 14px; font-weight: 700; display: block; }
.role-btn .rb-desc { font-size: 11.5px; font-weight: 400; display: block; margin-top: 3px; opacity: .75; }
/* onboarding — centred single column, reusing the auth screen's palette */
.ob-box { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center;
  gap: 14px; max-width: 460px; margin: 0 auto; padding: 40px 22px; }
.ob-box > * { width: 100%; }
.ob-title { font-weight: 700; letter-spacing: -0.02em; font-size: 26px; margin: 0; }
.ob-sub { font-size: 13.5px; color: var(--soft); margin: 6px 0 0; line-height: 1.5; }
.ob-progress { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.ob-dot { width: 26px; height: 4px; border-radius: 2px; background: var(--line-2); }
.ob-dot.active { background: var(--ink); }
.ob-levels { grid-template-columns: 1fr; }
.ob-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ob-chip { border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink);
  border-radius: 999px; padding: 6px 13px; font-size: 12.5px; font-weight: 600; }
.ob-chip.active { border-color: var(--ink); background: var(--panel); }
.ob-loading { text-align: center; padding: 26px 0; font-size: 13px; opacity: .7; }
.ob-suggest-list { display: flex; flex-direction: column; gap: 10px; }
.ob-suggest { border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 12px;
  padding: 14px; text-align: left; color: var(--ink); width: 100%; }
.ob-suggest:hover:not(:disabled) { border-color: var(--ink); background: var(--panel); }
.ob-suggest:disabled { opacity: .5; }
.ob-suggest .obs-title { font-size: 14px; font-weight: 700; display: block; }
.ob-suggest .obs-why { font-size: 11.5px; display: block; margin-top: 3px; opacity: .75; }
/* forgot password */
.forgot-steps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 22px; }
.forgot-steps li { display: flex; gap: 14px; align-items: flex-start; }
.forgot-steps .fg-n {
  flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--yellow); color: #17150F;
  display: grid; place-items: center; font-size: 12px; font-weight: 800; margin-top: 1px;
}
.forgot-steps b { font-size: 14px; font-weight: 700; display: block; }
.forgot-steps p { margin: 5px 0 0; font-size: 13px; line-height: 1.5; color: var(--soft); }
.fg-mail {
  display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
}
.fg-mail code { font-size: 13px; font-weight: 700; color: var(--ink); word-break: break-all; }
.fg-note {
  margin: 4px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--soft);
  border-left: 3px solid var(--yellow); padding-left: 12px;
}

.auth-swap { margin: 0; font-size: 13px; color: var(--soft); text-align: center; }
.auth-swap button { background: none; border: none; padding: 0; font-size: 13px; font-weight: 700; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.auth-swap button:hover { color: var(--coral-ink); }

/* ============================================================
   STUDENT DETAIL PANEL (slide-over)
   ============================================================ */
.panel-overlay { position: fixed; inset: 0; z-index: 50; }
.panel-scrim { position: absolute; inset: 0; background: rgba(23, 21, 15, 0.35); }
.side-panel {
  position: absolute; top: 0; right: 0; bottom: 0; width: 440px; max-width: 92vw;
  background: var(--panel-2); padding: 30px; overflow-y: auto;
  animation: rise .25s ease; box-shadow: -8px 0 30px rgba(23, 21, 15, 0.12);
}
.sp-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.sp-head .avatar { width: 46px; height: 46px; font-size: 14px; }
.sp-name { font-weight: 700; letter-spacing: -0.01em; font-size: 20px; }
.sp-meta { font-size: 12px; color: var(--soft); }
.sp-close { background: none; border: none; font-size: 18px; color: var(--soft); margin-left: auto; }
.sp-close:hover { color: var(--ink); }
.sp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 20px; }
.sp-stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.sp-stat .v { font-weight: 700; font-size: 18px; }
.sp-stat .l { font-size: 11px; color: var(--soft); }
.sp-lessons { display: flex; flex-direction: column; gap: 12px; }
.sp-lesson .sp-l-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.sp-lesson .sp-l-head span:first-child { font-weight: 600; }
.sp-lesson .sp-l-head span:last-child { color: var(--soft); }

/* ============================================================
   MODE PICKER
   ============================================================ */
.mode-sheet {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(520px, 92vw); max-height: 86vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  padding: 26px; animation: popIn .25s ease;
}
.mode-pick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-pick {
  border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 14px;
  padding: 14px; text-align: left; color: var(--ink);
  display: flex; flex-direction: column; gap: 2px;
}
.mode-pick:hover { border-color: var(--ink); }
.mode-pick .mp-ico { display: block; width: 21px; height: 21px; color: var(--ink); }
.mode-pick .mp-ico svg { width: 100%; height: 100%; display: block; }
.mode-pick .mp-name { font-size: 14px; font-weight: 700; margin-top: 4px; }
.mode-pick .mp-desc { font-size: 11.5px; color: var(--soft); line-height: 1.35; }
@media (max-width: 480px) { .mode-pick-grid { grid-template-columns: 1fr; } }

/* ============================================================
   HOW TO PLAY
   ============================================================ */
.howto-sheet {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(560px, 92vw); max-height: 88vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  padding: 28px; animation: popIn .25s ease;
}
.howto-head { display: flex; align-items: center; gap: 14px; }
.howto-ico {
  width: 52px; height: 52px; flex: none; border-radius: 16px;
  background: var(--yellow); color: #17150F; display: grid; place-items: center;
}
.howto-ico svg { width: 25px; height: 25px; display: block; }
.howto-title { font-weight: 700; letter-spacing: -0.02em; font-size: 22px; }
.howto-tag { font-size: 12px; color: var(--gray); font-weight: 600; margin-top: 1px; }
.howto-head .sp-close { margin-left: auto; align-self: flex-start; }
.howto-goal { font-size: 14.5px; line-height: 1.55; color: var(--soft); margin: 20px 0 0; }

.howto-steps { margin: 0; padding: 0; list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: 12px; }
.howto-steps li {
  counter-increment: step; position: relative; padding-left: 36px;
  font-size: 14px; line-height: 1.5;
}
.howto-steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: -1px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--solid-bg); color: var(--solid-ink);
  font-size: 12px; font-weight: 800; display: grid; place-items: center;
}

.howto-scoring {
  margin: 0; font-size: 14px; line-height: 1.55; color: var(--soft);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 14px 16px;
}
.howto-keys { display: flex; flex-direction: column; gap: 8px; }
.howto-key { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--soft); }
.howto-key kbd {
  font-family: inherit; font-size: 11.5px; font-weight: 700; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--line-2);
  border-bottom-width: 2px; border-radius: 7px; padding: 3px 9px; min-width: 34px; text-align: center;
}
/* keep the action row reachable — the steps list can overflow the sheet */
.howto-foot {
  position: sticky; bottom: -28px; margin: 24px -28px -28px;
  padding: 16px 28px 20px; background: var(--panel);
  border-top: 1px solid var(--line);
}
.howto-foot .btn-block { margin: 0; }
.howto-skip {
  display: flex; align-items: center; gap: 9px; justify-content: center;
  margin-top: 12px; font-size: 12.5px; color: var(--gray); cursor: pointer;
}
.howto-skip input { width: 15px; height: 15px; accent-color: var(--ink); cursor: pointer; }

.howto-btn { flex-shrink: 0; width: 40px; height: 40px; font-size: 16px; font-weight: 800; }

@media (max-width: 560px) { .howto-sheet { padding: 22px 18px; } }

/* ============================================================
   FOCUS / ZEN MODE
   ============================================================ */
body.zen .sidebar, body.zen .topbar, body.zen .mobile-head { display: none !important; }
body.zen .content-inner { max-width: 900px; padding-top: 30px; }
.zen-toggle { flex-shrink: 0; width: 40px; height: 40px; font-size: 15px; }
.zen-toggle svg { width: 17px; height: 17px; }

/* zen = just the card: strip titles, counters, mode chips, direction toggle */
body.zen .view .back-btn,
body.zen .study-title,
body.zen .study-pos,
body.zen .dir-row,
body.zen .mode-row,
body.zen #view-study .center-row,
body.zen .counter-chip { display: none !important; }
body.zen .study-top, body.zen .deck-head { justify-content: flex-end; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: var(--solid-bg); color: var(--solid-ink); padding: 12px 22px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; z-index: 80; animation: rise .25s ease;
  box-shadow: 0 6px 20px rgba(23, 21, 15, 0.25); max-width: 90vw; text-align: center;
}

/* ============================================================
   PENDING (account awaiting approval)
   ============================================================ */
.pending-screen { min-height: 100dvh; display: grid; place-items: center; padding: 40px 20px; }
.pending-box { background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 44px 40px; text-align: center; max-width: 440px; }
.pending-box .pb-word { font-family: "Fraunces", Georgia, serif; font-weight: 900; font-size: 2.2rem; margin: 0 0 12px; }
.pending-box p { color: var(--soft); margin: 0 0 20px; }
.pending-box .btn + .btn { margin-top: 10px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1023px) {
  .sidebar { display: none; }
  .shell { flex-direction: column; }
  .mobile-head {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 18px; border-bottom: 1px solid var(--line);
    position: sticky; top: 0; background: var(--bg); z-index: 30;
  }
  .mobile-head .brand { margin: 0; font-size: 21px; padding: 0; }
  .mobile-head .mh-spacer { flex: 1; }
  .hamburger { background: none; border: none; padding: 8px; color: var(--ink); display: grid; place-items: center; }
  .hamburger svg { width: 24px; height: 24px; }

  .topbar { display: none; }
  .content-inner { padding: 22px 18px 96px; }
  .page-title, .study-title { font-size: 25px; }

  /* mobile drawer for sidebar */
  .sidebar.drawer-open {
    display: flex; position: fixed; top: 0; left: 0; bottom: 0; height: 100dvh;
    width: 260px; z-index: 60; animation: rise .2s ease;
  }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(23,21,15,.4); z-index: 55; }

  /* grids collapse */
  .stat-cards, .stat-cards.four { grid-template-columns: repeat(2, 1fr); }
  .overview-split, .home-classes, .mini-grid-2 { grid-template-columns: 1fr; }
  .class-grid { grid-template-columns: 1fr; }
  /* full-screen auth on mobile: compact hero on top, form fills the rest */
  .auth-card { grid-template-columns: 1fr; grid-template-rows: auto 1fr; max-width: none; }
  .auth-hero { padding: 58px 22px 28px; }
  .auth-back { top: 20px; left: 22px; }
  .auth-hero .ah-title { font-size: 40px; }
  .auth-hero p { margin-top: 14px; font-size: 14px; }
  .ah-points { display: none; }
  .auth-form { padding: 30px 22px 44px; }
  .due-banner { flex-direction: column; align-items: flex-start; }

  /* tables -> horizontal scroll wrapper */
  .table { overflow-x: auto; }
  .table-head, .table-row { min-width: 640px; }
  .side-panel { width: 100%; }
}

@media (max-width: 560px) {
  .stat-cards, .stat-cards.four { grid-template-columns: 1fr 1fr; }
  .content-inner { padding: 20px 14px 96px; }
  .study-actions { flex-direction: column; }
  .study-actions .btn { width: 100%; }
}
