:root {
  --bg: #f6f4ee;
  --card: #ffffff;
  --ink: #1d2433;
  --muted: #667085;
  --line: #e4e0d5;
  --brand: #2f5bea;
  --brand-ink: #ffffff;
  --brand-soft: #e9eeff;
  --code-bg: #111827;
  --code-ink: #e5e7eb;
  --tip-bg: #fff6dc;
  --tip-line: #f0c95a;
  --warn-bg: #fdecec;
  --warn-ink: #9b1c1c;
  --note-bg: #fff6dc;
  --note-ink: #6b4e00;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

.muted { color: var(--muted); }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 5;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 18px; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none;
}
.brand-mark {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--brand); color: var(--brand-ink); font-size: 17px;
}
.course { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status {
  margin-left: auto; flex: none;
  font-size: 12.5px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  background: var(--note-bg); color: var(--note-ink);
}
.status.on { background: #e3f6ea; color: #17663a; }

/* ----------------------------------------------------------------- layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 24px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  align-items: start;
}

/* ----------------------------------------------------------------- lesson */
.lesson {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 36px 36px;
  min-width: 0;
}
.lesson .meta { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.lesson .chip {
  font-size: 12.5px; font-weight: 600;
  padding: 3px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
}
.lesson h1 { font-size: 32px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 10px; }
.lesson .summary { font-size: 17.5px; color: #414a5e; margin: 0 0 8px; }
.lesson h2 { font-size: 21px; letter-spacing: -0.01em; margin: 34px 0 8px; }
.lesson p { margin: 10px 0; }
.lesson ul { margin: 10px 0; padding-left: 22px; }
.lesson li { margin: 5px 0; }

pre {
  background: var(--code-bg); color: var(--code-ink);
  border-radius: 12px; padding: 14px 16px; margin: 12px 0;
  overflow-x: auto;
  font: 14px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tip {
  background: var(--tip-bg);
  border: 1px solid var(--tip-line);
  border-radius: 12px;
  padding: 14px 16px; margin: 12px 0;
}
.tip strong { display: block; margin-bottom: 2px; }

/* ------------------------------------------------------------------- quiz */
.main-col { min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.quiz {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 36px 32px;
}
.quiz-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 6px; }
.quiz-head h2 { font-size: 24px; letter-spacing: -0.01em; margin: 0; flex: 1 1 auto; }
.quiz-score {
  font-size: 13.5px; font-weight: 600;
  padding: 4px 11px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand);
}
.quiz-new {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-size: 14px; padding: 7px 13px; border-radius: 10px; cursor: pointer;
}
.quiz-new:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.quiz-note { font-size: 14px; color: var(--note-ink); background: var(--note-bg); padding: 9px 12px; border-radius: 10px; margin: 10px 0 0; }
.question { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 20px; }
.question .q-num { font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.question .q-text { font-weight: 600; margin: 4px 0 10px; }
.options { display: grid; gap: 8px; }
.option {
  text-align: left;
  border: 1px solid var(--line); background: #fbfaf7; color: var(--ink);
  font: inherit; font-size: 15px; padding: 10px 14px; border-radius: 10px; cursor: pointer;
}
.option:hover:not(:disabled) { border-color: var(--brand); }
.option:disabled { opacity: 1; cursor: default; }
.option.right { border-color: #2e9e5b; background: #e3f6ea; color: #14532d; font-weight: 600; }
.option.wrong { border-color: #d64545; background: var(--warn-bg); color: var(--warn-ink); }
.answer-box {
  width: 100%; min-height: 84px; resize: vertical;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  font: inherit; font-size: 15px; color: var(--ink); background: #fbfaf7;
}
.check-btn {
  margin-top: 8px;
  border: 0; border-radius: 10px; background: var(--brand); color: var(--brand-ink);
  font: inherit; font-weight: 600; font-size: 15px; padding: 9px 16px; cursor: pointer;
}
.verdict { margin-top: 10px; padding: 10px 13px; border-radius: 10px; font-size: 14.5px; }
.verdict strong { display: block; }
.verdict.right { background: #e3f6ea; color: #14532d; }
.verdict.wrong { background: var(--warn-bg); color: var(--warn-ink); }
.verdict.neutral { background: var(--note-bg); color: var(--note-ink); }
.verdict .model { display: block; margin-top: 6px; }

/* ------------------------------------------------------------------ tutor */
.tutor {
  position: sticky; top: calc(var(--topbar-h) + 24px);
  height: calc(100vh - var(--topbar-h) - 48px);
  min-height: 420px;
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.tutor-head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}
.tutor-head h2 { margin: 0; font-size: 16px; }
.tutor-head p { margin: 0; font-size: 13px; color: var(--muted); }
.tutor-avatar {
  display: grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink);
  font-weight: 700; font-size: 13px;
}

.chat {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.msg {
  max-width: 88%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 15px; line-height: 1.5;
  overflow-wrap: anywhere;
}
.msg p { margin: 0 0 8px; }
.msg p:last-child { margin-bottom: 0; }
.msg pre { margin: 8px 0; font-size: 13px; padding: 10px 12px; border-radius: 10px; }
.msg code.inline {
  background: rgba(17, 24, 39, 0.08);
  padding: 1px 5px; border-radius: 5px; font-size: 0.92em;
}
.msg.user {
  align-self: flex-end;
  background: var(--brand); color: var(--brand-ink);
  border-bottom-right-radius: 4px;
  white-space: pre-wrap;
}
.msg.tutor-msg {
  align-self: flex-start;
  background: #f1efe8;
  border-bottom-left-radius: 4px;
}
.msg.notice, .msg.error {
  align-self: stretch; max-width: none;
  font-size: 14px;
}
.msg.notice { background: var(--note-bg); color: var(--note-ink); }
.msg.error { background: var(--warn-bg); color: var(--warn-ink); }

.dots { display: inline-flex; gap: 4px; padding: 5px 0; }
.dots i {
  width: 7px; height: 7px; border-radius: 50%;
  background: #9aa1ae;
  animation: blink 1.2s infinite ease-in-out;
}
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .dots i { animation: none; } }

.quick {
  display: flex; gap: 8px;
  padding: 0 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.quick::-webkit-scrollbar { display: none; }
.quick button {
  flex: none;
  border: 1px solid var(--line);
  background: var(--card); color: var(--ink);
  font: inherit; font-size: 13.5px;
  padding: 6px 12px; border-radius: 999px;
  cursor: pointer;
}
.quick button:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }

.composer {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--line);
}
.composer textarea {
  flex: 1; min-width: 0;
  resize: none;
  max-height: 140px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit; font-size: 15px; line-height: 1.4;
  color: var(--ink); background: #fbfaf7;
}
.composer textarea:focus, .quick button:focus-visible, .composer button:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 1px;
}
.composer button {
  flex: none;
  border: 0; border-radius: 12px;
  background: var(--brand); color: var(--brand-ink);
  font: inherit; font-weight: 600; font-size: 15px;
  padding: 10px 16px;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ----------------------------------------------------------------- mobile */
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px 12px 24px; }
  .lesson { padding: 22px 18px 24px; }
  .quiz { padding: 22px 18px 24px; }
  .main-col { gap: 16px; }
  .lesson h1 { font-size: 26px; }
  .tutor { position: static; height: 560px; max-height: 80vh; }
  .course { display: none; }
}

/* ------------------------------------------------------- zones and pages */
[hidden] { display: none !important; }

.account { display: flex; align-items: center; gap: 10px; flex: none; }
.topbar .account { margin-left: auto; }
.status:not([hidden]) + .account { margin-left: 0; }
.account-name { font-size: 14px; font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 600; padding: 6px 12px; border-radius: 10px;
  cursor: pointer; text-decoration: none;
}
.account-btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }

.page { max-width: 1040px; margin: 0 auto; padding: 28px 20px 56px; }
.page.narrow { max-width: 460px; }
.back { display: inline-block; font-size: 14px; font-weight: 600; color: var(--brand); text-decoration: none; margin-bottom: 10px; }
.back:hover { text-decoration: underline; }
.page-title { font-size: 34px; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 6px; }
.page-intro { font-size: 17.5px; color: #414a5e; margin: 0 0 22px; }

.grid { display: grid; gap: 16px; margin-top: 18px; }
.grid.zones { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid.classes { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.grid.rhymes { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }

.card {
  --zone: var(--brand);
  display: flex; flex-direction: column; gap: 4px;
  background: var(--card); color: var(--ink); text-decoration: none;
  border: 1px solid var(--line); border-top: 5px solid var(--zone);
  border-radius: 16px; padding: 18px 18px 20px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(29, 36, 51, 0.09); }
.card:focus-visible, .back:focus-visible, .lesson-link:focus-visible, .account-btn:focus-visible,
.tab:focus-visible, .swatch:focus-visible, .count-btn:focus-visible, .option:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 2px;
}
.card-emoji { font-size: 34px; line-height: 1.1; }
.card-tag { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.card-title { font-size: 19px; letter-spacing: -0.01em; }
.card-text { font-size: 14.5px; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } .card:hover { transform: none; } }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px 22px; margin-top: 16px;
}
.panel h2 { font-size: 19px; margin: 0 0 8px; letter-spacing: -0.01em; }
.panel ul { margin: 0; padding-left: 20px; }
.panel li { margin: 6px 0; }
.panel p { margin: 6px 0; }
.notice-box { background: var(--note-bg); color: var(--note-ink); border-radius: 12px; padding: 12px 14px; font-size: 14.5px; margin: 0 0 4px; }
.notice-box a { color: inherit; font-weight: 600; }
.lesson-link {
  display: block; padding: 10px 14px; margin-top: 8px;
  background: var(--brand-soft); color: var(--brand); font-weight: 600;
  border-radius: 10px; text-decoration: none;
}
.lesson-link:hover { background: #dbe4ff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.topic { font-size: 14px; padding: 5px 12px; border-radius: 999px; background: #f1efe8; }
.course-head { display: flex; gap: 14px; align-items: flex-start; }
.course-head h2 { margin: 0; }
.course-head p { margin: 2px 0 4px; font-size: 14.5px; }

/* ------------------------------------------------------------------ kids */
.page.kids { text-align: center; max-width: 620px; }
.page.kids .back { float: left; }
.page.kids .page-title { clear: both; }
.kid-prompt {
  display: inline-block; margin: 6px 0 18px;
  font: inherit; font-size: 34px; font-weight: 800; letter-spacing: -0.01em;
  background: var(--card); color: var(--ink);
  border: 2px solid var(--line); border-radius: 18px; padding: 10px 22px; cursor: pointer;
}
.kid-prompt.plain { border: 0; background: none; cursor: default; }
.swatches { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.swatch {
  aspect-ratio: 1.25; border: 5px solid #fff; border-radius: 28px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(29, 36, 51, 0.16);
}
.swatch.won { outline: 6px solid #2e9e5b; }
.nope { animation: shake 0.4s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@media (prefers-reduced-motion: reduce) { .nope { animation: none; opacity: 0.5; } }
.kid-cheer { font-size: 24px; font-weight: 700; min-height: 38px; margin: 18px 0 4px; }
.kid-stars { font-size: 26px; min-height: 36px; margin: 0; }
.count-show { font-size: 64px; line-height: 1.3; background: var(--card); border: 1px solid var(--line); border-radius: 24px; padding: 24px 12px; }
.count-choices { display: flex; justify-content: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.count-btn {
  width: 72px; height: 72px; border-radius: 20px; border: 0; cursor: pointer;
  background: var(--brand); color: var(--brand-ink); font: inherit; font-size: 34px; font-weight: 800;
}
.rhyme { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; }
.rhyme-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.rhyme h2 { font-size: 20px; margin: 0; }
.rhyme p { margin: 3px 0; font-size: 17px; }
.rhyme-play { border: 1px solid var(--line); background: #fbfaf7; border-radius: 50%; width: 42px; height: 42px; font-size: 19px; cursor: pointer; }

/* ----------------------------------------------------------------- login */
.auth { padding: 22px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: #f1efe8; border-radius: 12px; padding: 4px; margin-bottom: 16px; }
.tab { border: 0; background: none; font: inherit; font-weight: 600; font-size: 15px; padding: 8px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.tab.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(29, 36, 51, 0.12); }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 14px; font-weight: 600; margin-bottom: 12px; }
.field input {
  font: inherit; font-size: 16px; font-weight: 400; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fbfaf7; color: var(--ink);
}
.field input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.check-btn.wide { width: 100%; margin-top: 4px; padding: 11px 16px; }
.form-error { background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 9px 12px; font-size: 14.5px; margin: 0 0 10px; }
.or { text-align: center; color: var(--muted); font-size: 14px; margin: 14px 0 10px; }
.google-holder { display: flex; justify-content: center; }
.page > .quiz { margin-top: 8px; }

@media (max-width: 900px) {
  .page { padding: 18px 12px 40px; }
  .page-title { font-size: 28px; }
  .account-name { display: none; }
  .status { display: none; }
  .kid-prompt { font-size: 28px; }
  .count-show { font-size: 48px; }
}

/* =========================================================== premium theme
   Loaded last on purpose: it restyles the base rules above. */
:root {
  --bg: #f5f6fb;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #5b6478;
  --line: #e6e8f0;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --brand-soft: #eef0ff;
  --gold: #f5b942;
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 55%, #c026d3 100%);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 2px 8px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 2px 4px rgba(15, 23, 42, 0.04), 0 12px 32px rgba(30, 27, 75, 0.10);
  --shadow-lg: 0 24px 60px rgba(49, 46, 129, 0.22);
  --topbar-h: 64px;
}
body {
  background:
    radial-gradient(1100px 520px at 88% -8%, rgba(124, 58, 237, 0.10), transparent 60%),
    radial-gradient(900px 480px at -5% 4%, rgba(79, 70, 229, 0.09), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  font-family: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, .page-title, .card-title, .brand {
  font-family: "SF Pro Display", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.topbar {
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: saturate(1.6) blur(16px);
  backdrop-filter: saturate(1.6) blur(16px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.07);
}
.brand { font-size: 20px; font-weight: 800; letter-spacing: -0.03em; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: var(--grad); box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35); }
.status { background: #fff4d6; }
.account-btn { border-radius: 999px; padding: 7px 16px; transition: box-shadow 0.15s ease, transform 0.15s ease; }
.account-btn.primary { background: var(--grad); border-color: transparent; box-shadow: 0 6px 16px rgba(79, 70, 229, 0.30); }
.account-btn.primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(79, 70, 229, 0.36); }

.page { max-width: 1120px; padding: 36px 28px 72px; }
.page-title { font-size: 40px; font-weight: 800; letter-spacing: -0.035em; }
.page-intro { font-size: 18px; color: var(--muted); margin-bottom: 26px; }
.back { color: var(--brand); background: var(--brand-soft); padding: 5px 12px; border-radius: 999px; font-size: 13.5px; margin-bottom: 16px; }
.back:hover { text-decoration: none; background: #e0e4ff; }

/* hero */
.hero {
  position: relative; overflow: hidden;
  background: var(--grad); color: #fff;
  border-radius: 32px; padding: 56px 52px 52px;
  box-shadow: var(--shadow-lg);
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.28), transparent 68%);
}
.hero::before { width: 520px; height: 520px; right: -160px; top: -220px; }
.hero::after { width: 380px; height: 380px; left: -140px; bottom: -220px; opacity: 0.6; }
.hero > * { position: relative; z-index: 1; }
.hero-eyebrow {
  display: inline-block; font-size: 12.5px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 6px 14px; border-radius: 999px;
}
.hero h1 { font-size: 58px; line-height: 1.04; font-weight: 800; letter-spacing: -0.045em; margin: 20px 0 14px; max-width: 760px; }
.hero h1 em { font-style: normal; color: #ffe08a; }
.hero p { font-size: 19px; line-height: 1.55; max-width: 600px; margin: 0 0 28px; color: rgba(255, 255, 255, 0.88); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 16px; text-decoration: none;
  padding: 13px 24px; border-radius: 999px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn.light { background: #fff; color: #312e81; box-shadow: 0 10px 24px rgba(15, 23, 42, 0.22); }
.btn.ghost { color: #fff; border: 1.5px solid rgba(255, 255, 255, 0.5); }
.btn:hover { transform: translateY(-2px); }
.btn:focus-visible { outline: 3px solid #ffe08a; outline-offset: 2px; }
.hero-points { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 34px; font-size: 14.5px; font-weight: 600; color: rgba(255, 255, 255, 0.92); }
.hero-points span::before { content: "✓"; display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 8px; border-radius: 50%; background: rgba(255, 255, 255, 0.22); font-size: 12px; }
.section-title { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin: 46px 0 4px; }
.section-sub { color: var(--muted); margin: 0 0 4px; }

/* cards */
.grid { gap: 20px; margin-top: 20px; }
.grid.zones { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card {
  position: relative; gap: 6px;
  border: 1px solid rgba(15, 23, 42, 0.06); border-top: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: 24px; padding: 26px 24px 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--zone) 35%, transparent); }
.card-emoji {
  display: grid; place-items: center; width: 60px; height: 60px; margin-bottom: 10px;
  font-size: 30px; border-radius: 18px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--zone) 22%, #fff), color-mix(in srgb, var(--zone) 9%, #fff));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--zone) 20%, transparent);
}
.card-tag { color: var(--zone); font-size: 11.5px; letter-spacing: 0.08em; }
.card-title { font-size: 21px; font-weight: 750; letter-spacing: -0.02em; }
.card-text { font-size: 15px; line-height: 1.5; }
.grid.zones .card::after {
  content: "→"; position: absolute; right: 22px; top: 26px;
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: #f3f4fa; color: var(--muted); font-size: 16px;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.grid.zones .card:hover::after { background: var(--zone); color: #fff; transform: translateX(3px); }
.grid.classes .card { padding: 20px; border-radius: 18px; }
.grid.classes .card-title { font-size: 18px; }

/* panels, lesson, quiz */
.panel, .lesson, .quiz, .rhyme {
  border: 1px solid rgba(15, 23, 42, 0.06); border-radius: 24px; box-shadow: var(--shadow-sm);
}
.panel { padding: 24px 26px; margin-top: 18px; }
.panel h2 { font-size: 20px; font-weight: 750; letter-spacing: -0.02em; }
.notice-box { border-radius: 16px; padding: 14px 18px; background: #fff7df; border: 1px solid #f6e3a6; }
.lesson-link { border-radius: 14px; padding: 13px 16px; transition: background 0.15s ease, transform 0.15s ease; }
.lesson-link:hover { background: #dfe3ff; transform: translateX(3px); }
.topic { background: #f3f4fa; border: 1px solid var(--line); padding: 7px 14px; }
.layout { max-width: 1280px; gap: 28px; padding: 28px 28px 56px; }
.lesson { padding: 40px 44px 44px; }
.lesson h1 { font-size: 38px; font-weight: 800; letter-spacing: -0.035em; }
.lesson .summary { font-size: 18.5px; color: var(--muted); }
.lesson h2 { font-size: 23px; font-weight: 750; letter-spacing: -0.02em; margin-top: 38px; }
.lesson .chip { background: var(--brand-soft); color: var(--brand); padding: 4px 12px; }
pre { background: #0b1020; border-radius: 16px; padding: 16px 18px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.tip { background: #fff7df; border: 1px solid #f6e3a6; border-radius: 16px; padding: 16px 18px; }
.quiz { padding: 34px 44px 38px; }
.quiz-head h2 { font-weight: 800; letter-spacing: -0.03em; }
.quiz-new { border-radius: 999px; padding: 8px 16px; font-weight: 600; }
.option { border-radius: 14px; padding: 13px 16px; background: #fafbff; transition: border-color 0.12s ease, background 0.12s ease; }
.option:hover:not(:disabled) { background: var(--brand-soft); }
.check-btn { background: var(--grad); border-radius: 999px; padding: 11px 22px; box-shadow: 0 8px 18px rgba(79, 70, 229, 0.28); }
.verdict { border-radius: 14px; padding: 12px 16px; }
.answer-box { border-radius: 14px; background: #fafbff; }

/* tutor */
.tutor { border: 1px solid rgba(15, 23, 42, 0.06); border-radius: 24px; box-shadow: var(--shadow-md); top: calc(var(--topbar-h) + 28px); height: calc(100vh - var(--topbar-h) - 56px); }
.tutor-head { background: var(--grad); color: #fff; border-bottom: 0; padding: 16px 18px; }
.tutor-head p { color: rgba(255, 255, 255, 0.82); }
.tutor-avatar { background: rgba(255, 255, 255, 0.2); border: 1px solid rgba(255, 255, 255, 0.35); }
.msg { border-radius: 18px; padding: 10px 14px; }
.msg.user { background: var(--grad); border-bottom-right-radius: 6px; }
.msg.tutor-msg { background: #f3f4fa; border-bottom-left-radius: 6px; }
.quick button { border-radius: 999px; background: #fafbff; }
.composer textarea { border-radius: 16px; background: #fafbff; }
.composer button { background: var(--grad); border-radius: 16px; box-shadow: 0 6px 14px rgba(79, 70, 229, 0.28); }

/* kids and login */
.kid-prompt { border-radius: 24px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.swatch { border-radius: 32px; border-width: 6px; box-shadow: 0 10px 26px rgba(15, 23, 42, 0.18); transition: transform 0.12s ease; }
.swatch:hover:not(:disabled) { transform: scale(1.03); }
.count-show { border-radius: 28px; box-shadow: var(--shadow-sm); border: 1px solid rgba(15, 23, 42, 0.06); }
.count-btn { background: var(--grad); border-radius: 22px; box-shadow: 0 8px 18px rgba(79, 70, 229, 0.3); }
.rhyme { padding: 22px 24px; }
.rhyme-play { background: var(--brand-soft); border: 0; }
.auth { padding: 28px; box-shadow: var(--shadow-md); }
.tabs { background: #f1f2f8; border-radius: 14px; }
.tab { border-radius: 11px; padding: 9px; }
.field input { border-radius: 12px; background: #fafbff; padding: 12px 14px; }
.check-btn.wide { padding: 13px 16px; font-size: 16px; }

@media (prefers-reduced-motion: reduce) {
  .card, .btn, .swatch, .lesson-link, .account-btn { transition: none; }
  .card:hover, .btn:hover, .swatch:hover, .lesson-link:hover { transform: none; }
}
@media (max-width: 900px) {
  .topbar { padding: 0 16px; }
  .page { padding: 20px 14px 48px; }
  .page-title { font-size: 30px; }
  .hero { border-radius: 24px; padding: 34px 24px 32px; }
  .hero h1 { font-size: 36px; }
  .hero p { font-size: 16.5px; }
  .btn { padding: 12px 20px; font-size: 15px; }
  .hero-points { gap: 8px 18px; margin-top: 26px; font-size: 13.5px; }
  .section-title { font-size: 22px; margin-top: 34px; }
  .grid.zones { grid-template-columns: 1fr; gap: 14px; }
  .layout { padding: 16px 14px 32px; gap: 16px; }
  .lesson { padding: 26px 20px 28px; border-radius: 20px; }
  .lesson h1 { font-size: 28px; }
  .quiz { padding: 24px 20px 26px; border-radius: 20px; }
  .tutor { position: static; height: 580px; max-height: 82vh; border-radius: 20px; }
}

@media (max-width: 900px) { .topbar .account { margin-left: auto !important; } }

/* ------------------------------------------------- Ask Tyeach and Apple button */
.layout.ask-mode { grid-template-columns: minmax(0, 1fr); max-width: 860px; }
.layout.ask-mode .main-col, .layout.ask-mode .quick { display: none; }
.layout.ask-mode .tutor { position: static; height: calc(100vh - var(--topbar-h) - 56px); min-height: 480px; }
.layout.ask-mode .msg { max-width: 80%; font-size: 16px; }
.apple-btn {
  display: block; width: 300px; max-width: 100%; margin: 12px auto 0;
  background: #000; color: #fff; border: 0; border-radius: 999px;
  font: inherit; font-weight: 600; font-size: 16px; padding: 11px 16px; cursor: pointer;
}
.apple-btn:disabled { opacity: 0.5; }

/* ----------------------------------------------------------- legal and footer */
.footer { max-width: 1120px; margin: 0 auto; padding: 8px 28px 40px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.footer p { margin: 0 0 6px; }
.footer a, .agree a, .legal a { color: var(--brand); font-weight: 600; }
.agree { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.45; color: var(--muted); margin: 2px 0 12px; }
.agree input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--brand); }
a.account-name { color: var(--ink); text-decoration: none; }
a.account-name:hover { text-decoration: underline; }
.danger-btn { border: 1px solid #f1b5b5; background: var(--warn-bg); color: var(--warn-ink); font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 999px; cursor: pointer; margin-top: 6px; }
.legal { max-width: 760px; }
.legal h2 { font-size: 21px; margin: 30px 0 6px; letter-spacing: -0.02em; }
.legal p, .legal li { color: #2b3346; }
.legal .fill { background: #fff1b8; padding: 0 4px; border-radius: 4px; font-weight: 600; }
@media (max-width: 900px) { .footer { padding: 8px 14px 32px; } }

/* ------------------------------------------------------------ scan a question */
.scan-btn {
  flex: none; width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line) !important; border-radius: 14px !important;
  background: #fafbff !important; box-shadow: none !important; font-size: 20px !important; cursor: pointer;
}
.scan-btn:hover:not(:disabled) { border-color: var(--brand) !important; }
.attached { display: flex; align-items: center; gap: 10px; margin: 0 16px 8px; padding: 8px 10px; background: var(--brand-soft); border-radius: 14px; font-size: 14px; font-weight: 600; color: var(--brand); }
.attached img { width: 44px; height: 44px; object-fit: cover; border-radius: 10px; }
.attached span { flex: 1; }
.attached button { border: 0; background: none; font-size: 16px; color: var(--brand); cursor: pointer; padding: 6px; }
.msg-photo { display: block; max-width: 100%; max-height: 220px; border-radius: 12px; margin-bottom: 8px; }

/* -------------------------------------------------------------- study room */
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row .check-btn { margin-top: 0; }
.code-input { font: inherit; font-size: 20px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; width: 220px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafbff; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; margin-top: 10px; }
.field select, .field textarea { font: inherit; font-size: 16px; font-weight: 400; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafbff; color: var(--ink); }
.field input[type=file] { padding: 9px; font-size: 14px; }
.items { margin-top: 16px; display: grid; gap: 10px; }
.item { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; background: #fafbff; }
.item-main { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.item-main span { font-size: 13.5px; }
.item-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.item-actions .quiz-new { text-decoration: none; background: var(--card); }
.quiz-new.quiet { color: var(--muted); }
.results { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.result-line { display: flex; justify-content: space-between; padding: 5px 0; font-size: 15px; }
.option.picked { border-color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.score-box { margin-top: 16px; padding: 18px 20px; border-radius: 18px; background: var(--grad); color: #fff; display: flex; flex-direction: column; gap: 4px; }
.score-box strong { font-size: 24px; letter-spacing: -0.02em; }

/* ------------------------------------------------------------ account gate */
.gate { text-align: center; padding: 30px 26px; }
.gate .card-emoji { margin: 0 auto 10px; --zone: var(--brand); }
.gate-btn { display: inline-block; text-decoration: none; margin-top: 10px; }
.quiz > .gate { border: 0; box-shadow: none; margin: 0; padding: 8px 0; }

/* ------------------------------------------- premium, progress, flashcards */
.premium-link { font-size: 13.5px; font-weight: 700; color: #92400e; background: #fef3c7; padding: 6px 12px; border-radius: 999px; text-decoration: none; }
.grid.plans { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); align-items: stretch; }
.plan { background: var(--card); border: 1px solid rgba(15, 23, 42, 0.07); border-radius: 24px; padding: 26px 24px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.plan.featured { border: 2px solid var(--brand); box-shadow: var(--shadow-md); }
.plan h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.plan .muted { margin: 2px 0 10px; font-size: 14.5px; }
.price { margin: 0 0 12px; color: var(--muted); }
.price strong { font-size: 38px; font-weight: 800; letter-spacing: -0.03em; color: var(--ink); }
.plan ul { list-style: none; margin: 0 0 16px; padding: 0; flex: 1; }
.plan li { padding: 5px 0 5px 26px; position: relative; font-size: 15px; }
.plan li::before { content: "✓"; position: absolute; left: 0; color: #16a34a; font-weight: 800; }
.plan-current { align-self: flex-start; font-size: 13px; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); }
.plan-how { font-size: 14px; color: var(--muted); margin: 0; }
.plan-how a, .form-error a { color: var(--brand); font-weight: 600; }
.progress { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 20px; }
.stat { background: var(--card); border: 1px solid rgba(15, 23, 42, 0.06); border-radius: 18px; padding: 14px 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.stat strong { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.stat span { font-size: 13px; color: var(--muted); }
.flashcard {
  display: flex; flex-direction: column; justify-content: center; gap: 12px; width: 100%; min-height: 280px;
  background: var(--card); color: var(--ink); border: 1px solid rgba(15, 23, 42, 0.07); border-radius: 28px;
  padding: 30px 28px; box-shadow: var(--shadow-md); cursor: pointer; text-align: center; font: inherit;
}
.flashcard.flipped { background: var(--grad); color: #fff; }
.flash-side { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.7; }
.flash-text { font-size: 24px; font-weight: 700; line-height: 1.35; letter-spacing: -0.01em; white-space: pre-wrap; }
.flash-nav { justify-content: space-between; margin-top: 16px; }
.page.narrow-wide { max-width: 680px; }
@media (max-width: 900px) { .premium-link { display: none; } .flash-text { font-size: 20px; } }
