/* Design tokens. --brand is overridden by the admin's brand color. */
@font-face { font-family: 'Figtree'; src: url('../fonts/figtree-latin-wght-normal.woff2') format('woff2'); font-weight: 300 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Figtree'; src: url('../fonts/figtree-latin-ext-wght-normal.woff2') format('woff2'); font-weight: 300 900; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Fraunces'; src: url('../fonts/fraunces-latin-standard-normal.woff2') format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Fraunces'; src: url('../fonts/fraunces-latin-ext-standard-normal.woff2') format('woff2'); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --brand: #1F6F5C;
  --on-brand: #fff;
  --accent: #D9542F;
  --bg: #F8F4EC;
  --surface: #FFFDF8;
  --surface-2: #F1ECE1;
  --ink: #1D2925;
  --muted: #5B6761;
  --line: #E4DCCD;
  --link: var(--brand);
  --mark: var(--brand);
  --brand-soft: color-mix(in srgb, var(--brand) 11%, var(--surface));
  --good: #1E7B4F;
  --bad: #B8392A;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(40, 35, 20, .05), 0 8px 24px rgba(40, 35, 20, .06);
  --serif: 'Fraunces', Georgia, 'Noto Serif Bengali', serif;
  --sans: 'Figtree', system-ui, -apple-system, 'Segoe UI', 'Noto Sans Bengali', sans-serif;
  color-scheme: light;
}
.dark {
  --bg: #111815;
  --surface: #19221E;
  --surface-2: #222D28;
  --ink: #ECF0EB;
  --muted: #A3AFA8;
  --line: #2E3A34;
  --accent: #F08A63;
  --link: color-mix(in srgb, var(--brand) 55%, #fff);
  --mark: color-mix(in srgb, var(--brand) 62%, #fff);
  --brand-soft: color-mix(in srgb, var(--brand) 24%, var(--surface));
  --good: #5CC796;
  --bad: #F0897A;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.7rem, 3vw, 2.2rem); }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
a { color: var(--link); }
small { font-size: .82rem; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.2rem 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--mark); outline-offset: 2px; }
[hidden] { display: none !important; }
.icon { flex: none; vertical-align: -3px; }
.muted { color: var(--muted); }
.lead { font-size: 1.05rem; }
.grow { flex: 1; min-width: 0; }
.clip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.small-note { font-size: .85rem; margin-top: .6rem; }
.error-text { color: var(--bad); }
.eyebrow { display: block; color: var(--muted); font-weight: 600; letter-spacing: .02em; margin-bottom: .3rem; }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; padding: .62rem 1.05rem; border-radius: 10px; border: 1px solid transparent; background: none; font-weight: 600; text-decoration: none; cursor: pointer; transition: background .15s, transform .05s, border-color .15s; white-space: nowrap; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: var(--on-brand); }
.btn.primary:hover:not(:disabled) { background: color-mix(in srgb, var(--brand) 86%, #000); }
.btn.ghost { border-color: var(--line); background: var(--surface); }
.btn.ghost:hover:not(:disabled) { border-color: var(--muted); }
.btn.danger { background: var(--bad); color: #fff; }
.dark .btn.danger { color: #1a0d0a; }
.danger-text { color: var(--bad) !important; }
.btn.wide { width: 100%; }
.btn.small { padding: .38rem .7rem; font-size: .88rem; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.tiny { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn.on { color: var(--accent); }
.icon-btn.send { background: var(--brand); color: var(--on-brand); }
.spin { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: block; margin-bottom: .9rem; }
.field > span { display: block; font-size: .88rem; font-weight: 600; margin-bottom: .3rem; }
input:not([type=checkbox]):not([type=radio]):not([type=color]), select, textarea { width: 100%; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--mark); outline-offset: 0; border-color: transparent; }
input[type=color] { width: 64px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
textarea { resize: vertical; }
.check { display: flex; gap: .5rem; align-items: center; margin-bottom: .9rem; }
.checks { border: 0; padding: 0; margin: 0 0 .9rem; display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; }
.checks legend { font-size: .88rem; font-weight: 600; padding: 0; margin-bottom: .3rem; }
.search { margin-bottom: 1rem; max-width: 360px; }

.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 1rem; }
.row.between { justify-content: space-between; }
.row.center { justify-content: center; }
.grid { display: grid; gap: 1rem; }
.grid.cols2 { grid-template-columns: 1fr 1fr; }
.grid.two-one { grid-template-columns: 3fr 2fr; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.tag { display: inline-block; padding: .08rem .55rem; border-radius: 99px; background: var(--brand-soft); color: var(--link); font-size: .76rem; font-weight: 700; }
.tag.warm { background: color-mix(in srgb, var(--accent) 15%, var(--surface)); color: var(--accent); }
.notice { background: color-mix(in srgb, var(--accent) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line)); border-radius: 10px; padding: .8rem 1rem; margin-bottom: 1rem; }
.meter { display: block; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 99px; background: var(--mark); transition: width .3s; }
.meter.big { height: 9px; flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .9rem; }
.chips.center { justify-content: center; }
.chip { display: inline-flex; align-items: center; gap: .3rem; border: 1px solid var(--line); background: var(--surface); padding: .3rem .75rem; border-radius: 99px; font-size: .87rem; cursor: pointer; }
.chip:hover { border-color: var(--mark); color: var(--link); }
.seg { display: inline-flex; flex-wrap: wrap; background: var(--surface-2); padding: 3px; border-radius: 10px; margin-bottom: 1rem; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: .32rem .8rem; border-radius: 8px; font-size: .9rem; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .1); }
.seg input:focus-visible + span { outline: 2px solid var(--mark); }

/* App shell */
.layout { display: flex; min-height: 100vh; }
.side { width: 244px; flex: none; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 1rem .75rem; background: var(--surface); border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .55rem; color: var(--ink); text-decoration: none; font-family: var(--serif); font-size: 1.2rem; padding: .25rem .5rem .9rem; }
.brand.center { justify-content: center; }
.brand b { font-weight: 600; }
.brand [data-site-logo] { display: inline-flex; }
.brand img { width: 28px; height: 28px; border-radius: 8px; object-fit: cover; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { display: flex; align-items: center; gap: .65rem; padding: .52rem .65rem; border-radius: 9px; color: var(--muted); font-weight: 550; text-decoration: none; }
.side nav a:hover { background: var(--surface-2); color: var(--ink); }
.side nav a.active { background: var(--brand-soft); color: var(--link); }
.side-foot { border-top: 1px solid var(--line); padding-top: .7rem; margin-top: .7rem; }
.usage { padding: 0 .5rem .6rem; }
.usage small { display: block; margin-top: .3rem; color: var(--muted); }
.who { display: flex; gap: .6rem; align-items: center; padding: .3rem .5rem; color: var(--ink); text-decoration: none; border-radius: 9px; }
.who:hover { background: var(--surface-2); }
.who b, .who small { display: block; line-height: 1.25; }
.who small { color: var(--muted); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex: none; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .5rem; padding: .5rem 1rem; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); }
.menu-btn { display: none; }
.pill { display: inline-flex; align-items: center; gap: .28rem; padding: .2rem .6rem; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: .88rem; color: var(--muted); }
.pill b { color: var(--ink); }
.pill.streak .icon { color: var(--accent); }
.scrim { display: none; }
main { flex: 1; outline: none; min-width: 0; }
.page { max-width: 1060px; margin: 0 auto; padding: .5rem 1.5rem 3rem; }
.page.narrow { max-width: 760px; }
.head-row { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-start; margin-bottom: 1.2rem; }
.section-title { margin-top: 1.6rem; }
.back { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); text-decoration: none; font-size: .9rem; margin-bottom: .8rem; }
.back:hover { color: var(--ink); }
.skeleton { height: 34px; width: 45%; border-radius: 8px; background: var(--surface-2); margin: 1rem 0; animation: pulse 1.2s infinite; }
.skeleton.short { height: 18px; width: 70%; }
@keyframes pulse { 50% { opacity: .5; } }
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--ink); }
.empty .icon { color: var(--mark); margin-bottom: .5rem; }

.steps { display: flex; flex-direction: column; gap: .5rem; }
.step { display: flex; gap: .75rem; align-items: center; padding: .7rem; border-radius: 11px; border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.step:hover { border-color: var(--mark); }
.step > span:nth-child(2) { flex: 1; min-width: 0; }
.step b, .step small { display: block; }
.step small { color: var(--muted); }
.step-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-soft); color: var(--link); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
.quick-tile { display: flex; flex-direction: column; gap: .15rem; padding: 1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.quick-tile:hover { border-color: var(--mark); }
.quick-tile .icon { color: var(--mark); margin-bottom: .35rem; }
.quick-tile small { color: var(--muted); }
.mini-stats { display: flex; justify-content: space-between; margin-top: 1rem; }
.mini-stats b { display: block; font: 600 1.25rem var(--serif); }
.mini-stats small { color: var(--muted); }
.list { display: flex; flex-direction: column; gap: .5rem; }
.list-row { display: flex; align-items: center; gap: .8rem; padding: .7rem .9rem; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
a.list-row:hover { border-color: var(--mark); }
.list-row b { display: block; }
.list-row small { color: var(--muted); display: block; }
.list-row a { color: inherit; text-decoration: none; }
.list-row .meter { margin-top: .4rem; }
.list-row.block { display: block; }
.list-row.block summary { display: flex; gap: .6rem; align-items: center; cursor: pointer; list-style: none; }
.list-row.block .prose { margin-top: .8rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: .9rem; }
.tile { display: flex; flex-direction: column; gap: .35rem; align-items: flex-start; padding: 1.1rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.tile:hover { border-color: var(--mark); box-shadow: var(--shadow); }
.tile .meter { width: 100%; margin-top: auto; }
.tile small { color: var(--muted); }
.tile p { margin: 0 0 .5rem; font-size: .92rem; }
.course-bar { display: flex; align-items: center; gap: .8rem; margin: .8rem 0 1rem; }
.course-bar small { color: var(--muted); white-space: nowrap; }
.module { margin-top: 1.8rem; }
.module h2 small { display: block; font: 600 .78rem var(--sans); color: var(--muted); letter-spacing: .03em; margin-bottom: .1rem; }
.lesson-row small { font-size: .85rem; }
.tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: inline-flex; align-items: center; justify-content: center; flex: none; color: var(--on-brand); }
.lesson-row.done .tick { background: var(--mark); border-color: var(--mark); }
.dark .lesson-row.done .tick { color: #10201a; }

/* Lesson */
.lesson-wrap { display: flex; align-items: flex-start; }
.lesson-wrap > article { flex: 1; min-width: 0; }
.lesson-chat { width: 380px; flex: none; position: sticky; top: 56px; height: calc(100vh - 66px); margin-right: 1rem; }
.tools-row { margin: .4rem 0 1.4rem; }
.after { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--line); }
.lesson-nav { margin-top: 1.2rem; }

.prose { line-height: 1.68; overflow-wrap: anywhere; }
.reading .prose { font-size: 1.05rem; }
.prose h1, .prose h2, .prose h3 { margin: 1.4em 0 .45em; }
.prose h2 { font-size: 1.3rem; }
.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose ul, .prose ol { padding-left: 1.35rem; margin: 0 0 .9em; }
.prose li { margin-bottom: .25em; }
.prose code { background: var(--surface-2); padding: .1em .32em; border-radius: 5px; font: .9em ui-monospace, Consolas, monospace; }
.prose pre { background: var(--surface-2); padding: .9rem; border-radius: 10px; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose blockquote { margin: 0 0 .9em; padding: .2rem 1rem; border-left: 3px solid var(--mark); color: var(--muted); }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; margin-bottom: 1em; }
.prose th, .prose td { border: 1px solid var(--line); padding: .35rem .65rem; text-align: left; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: .2rem 0; }
.thinking { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .92rem; }
.thinking span { width: 6px; height: 6px; border-radius: 50%; background: var(--mark); animation: bob 1.1s infinite; }
.thinking span:nth-child(2) { animation-delay: .15s; }
.thinking span:nth-child(3) { animation-delay: .3s; margin-right: .3rem; }
@keyframes bob { 0%, 60%, 100% { transform: none; opacity: .4; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Chat */
.tutor { display: flex; height: calc(100vh - 56px); padding: 0 1rem 1rem; gap: 1rem; }
.conv-list { width: 250px; flex: none; display: flex; flex-direction: column; gap: .7rem; }
.conv-items { overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.conv { display: flex; align-items: center; border-radius: 9px; }
.conv a { flex: 1; min-width: 0; padding: .45rem .6rem; color: var(--ink); text-decoration: none; }
.conv b { display: block; font-weight: 550; font-size: .92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv small { color: var(--muted); }
.conv:hover, .conv.active { background: var(--surface-2); }
.conv button { opacity: 0; }
.conv:hover button, .conv button:focus-visible { opacity: 1; }
.tutor-main { flex: 1; min-width: 0; }
.chat { display: flex; flex-direction: column; height: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.chat-head { display: flex; justify-content: space-between; align-items: center; padding: .4rem .5rem .4rem 1rem; border-bottom: 1px solid var(--line); }
.chat-log { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .9rem; }
.chat-empty { margin: auto; }
.msg { max-width: 84%; }
.msg.user { align-self: flex-end; background: var(--brand); color: var(--on-brand); padding: .55rem .85rem; border-radius: 14px 14px 3px 14px; }
.msg.user p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-img { display: block; max-height: 220px; border-radius: 9px; margin-bottom: .35rem; }
.msg.assistant { align-self: flex-start; max-width: 94%; }
.msg-actions { margin-top: .15rem; }
.chat-input { border-top: 1px solid var(--line); padding: .5rem .7rem .7rem; }
.chat-bar { padding: 0 .2rem .35rem; }
.switch { display: inline-flex; gap: .4rem; align-items: center; font-size: .84rem; color: var(--muted); cursor: pointer; }
.composer { display: flex; align-items: flex-end; gap: .25rem; }
.composer textarea { flex: 1; min-height: 40px; max-height: 160px; resize: none; }
.attach { position: relative; display: inline-block; margin-bottom: .4rem; }
.attach img, #preview img { max-height: 90px; border-radius: 8px; display: block; }
.attach button, #preview button { position: absolute; top: 2px; right: 2px; background: var(--surface); }
#preview { position: relative; display: inline-block; }
.drop { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; border: 1.5px dashed var(--line); border-radius: 10px; padding: .7rem; margin-bottom: 1rem; }

/* Quiz */
.quiz-title { font-size: 1.35rem; }
.q-text { font-size: 1.1rem; margin-bottom: 1rem; }
.options { display: flex; flex-direction: column; gap: .5rem; }
.option { display: flex; gap: .7rem; align-items: center; text-align: left; padding: .7rem .8rem; border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; }
.option:hover { border-color: var(--muted); }
.option.picked { border-color: var(--mark); background: var(--brand-soft); }
.letter { width: 26px; height: 26px; border-radius: 7px; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .84rem; flex: none; }
.option.picked .letter { background: var(--mark); color: var(--surface); }
.score { display: flex; align-items: center; gap: 1.4rem; flex-wrap: wrap; }
.score-num { font: 600 3rem var(--serif); color: var(--link); }
.review-q { border-left: 4px solid var(--line); margin-top: 1rem; }
.review-q.right { border-left-color: var(--good); }
.review-q.wrong { border-left-color: var(--bad); }
.review-q p { margin-bottom: .35rem; }

/* Flashcards */
.flashcard { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 2rem 1.6rem; min-height: 220px; box-shadow: var(--shadow); margin: .4rem 0 1rem; }
.flashcard .front { font-size: 1.2rem; }
.grow-input { flex: 1 1 200px; width: auto !important; }
#controls { display: flex; flex-direction: column; gap: .6rem; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.grade { padding: .55rem .2rem; border-radius: 11px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; }
.grade b, .grade small { display: block; }
.grade small { color: var(--muted); }
.grade.again:hover { border-color: var(--bad); }
.grade.good:hover, .grade.easy:hover { border-color: var(--good); }
.grade.hard:hover { border-color: var(--accent); }
.feedback { padding: .55rem .8rem; border-radius: 9px; background: var(--surface-2); }
.feedback.right b { color: var(--good); }
.feedback.wrong b { color: var(--bad); }
.flash .prose { font-size: .95rem; }
.flash .prose + .prose { margin-top: .25rem; }

/* Charts: one hue, thin marks, recessive axes. */
.bars { display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line); }
.bar-hit { position: relative; flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; outline-offset: -2px; }
.bar { width: 100%; max-width: 22px; border-radius: 4px 4px 0 0; background: var(--mark); }
.bar-hit:hover .bar { filter: brightness(1.15); }
.bar-hit:hover::after, .bar-hit:focus::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); z-index: 3; white-space: nowrap; background: var(--ink); color: var(--bg); padding: .2rem .5rem; border-radius: 6px; font-size: .78rem; pointer-events: none; }
.bar-hit:first-child:hover::after, .bar-hit:first-child:focus::after { left: 0; transform: none; }
.bar-hit:last-child:hover::after, .bar-hit:last-child:focus::after { left: auto; right: 0; transform: none; }
.bars-axis { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.hbars { display: flex; flex-direction: column; gap: .55rem; }
.hbar { display: grid; grid-template-columns: minmax(0, 1fr) 1.2fr 42px; gap: .6rem; align-items: center; font-size: .9rem; }
.hbar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 8px; }
.hbar-track i { display: block; height: 100%; border-radius: 0 4px 4px 0; background: var(--mark); }
.hbar b { text-align: right; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem 1rem; }
.stat b { display: block; font: 600 1.7rem var(--serif); }
.stat small { color: var(--muted); }

.preview-bar { margin: 0 1rem .5rem; padding: .35rem .8rem; border-radius: 9px; text-align: center; font-size: .86rem; background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--ink); }

/* Overlays */
.modal-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 1rem; background: rgba(15, 20, 18, .5); }
.modal { width: 100%; max-width: 470px; max-height: calc(100vh - 2rem); overflow-y: auto; background: var(--surface); border-radius: 16px; padding: 1.4rem; box-shadow: var(--shadow); }
.celebrate { text-align: center; }
.celebrate .icon { color: var(--accent); }
.toasts { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: .4rem; width: min(92vw, 420px); }
.toast { background: var(--ink); color: var(--bg); padding: .6rem .9rem; border-radius: 10px; box-shadow: var(--shadow); }
.toast.error { background: var(--bad); color: #fff; }
.dark .toast.error { color: #1a0d0a; }
.center-card { max-width: 420px; margin: 7vh auto; padding: 2rem; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); text-align: center; }
.center-card form { text-align: left; margin-top: 1rem; }
.center-card.wide { max-width: 560px; }
.links { margin: 1rem 0 0; font-size: .92rem; }
.reqs { list-style: none; padding: 0; margin: 1rem 0; text-align: left; }
.reqs li { display: flex; gap: .55rem; padding: .35rem 0; }
.reqs .ok { color: var(--good); }
.reqs .no { color: var(--bad); }

/* Marketing pages */
.site-nav { display: flex; align-items: center; gap: 1.3rem; max-width: 1120px; margin: 0 auto; padding: 1rem 1.5rem; }
.site-nav .brand { padding: 0; }
.site-nav a.nav-link { color: var(--muted); text-decoration: none; font-weight: 550; }
.site-nav a.nav-link:hover { color: var(--ink); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 1.5rem; }
.hero { display: grid; grid-template-columns: 1.05fr 1fr; gap: 3rem; align-items: center; padding: 3.2rem 0 4rem; }
.hero h1 { font-size: clamp(2.5rem, 5.4vw, 4rem); line-height: 1.05; font-weight: 600; letter-spacing: -.02em; margin-bottom: .45em; }
.hero h1 em { font-style: italic; color: var(--accent); font-weight: 500; }
.hero .lead { font-size: 1.18rem; color: var(--muted); max-width: 32rem; margin-bottom: 1.5rem; }
.hero small { display: block; margin-top: .8rem; color: var(--muted); }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 1.5rem; box-shadow: var(--shadow); scroll-margin: 2rem; }
.login-card h2 { margin-bottom: .2rem; }
.login-card > form > .muted, .login-card > .muted { margin-bottom: 1.1rem; }
.login-card input { font-size: 1.1rem; letter-spacing: .02em; }
.price-note { margin: 1.1rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .92rem; font-weight: 600; color: var(--ink); }
.price-note[hidden] { display: none; }
.band { padding: 4rem 0; }
.band.alt { background: var(--surface); border-block: 1px solid var(--line); }
.band h2.big { font-size: clamp(1.7rem, 3.4vw, 2.5rem); max-width: 22em; margin-bottom: .35em; }
.band .sub { color: var(--muted); font-size: 1.08rem; max-width: 38rem; margin-bottom: 2.2rem; }
.path { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; counter-reset: s; }
.path li { counter-increment: s; }
.path li::before { content: counter(s); display: block; font: italic 500 2.6rem var(--serif); color: var(--accent); margin-bottom: .2rem; }
.path h3 { font-size: 1.25rem; }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.feature { background: var(--surface); padding: 1.5rem; }
.band.alt .feature { background: var(--bg); }
.feature .icon { color: var(--mark); margin-bottom: .6rem; }
.feature p { color: var(--muted); margin: 0; }
.loop { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; align-items: center; }
.loop-card { background: var(--brand); color: var(--on-brand); border-radius: 20px; padding: 1.6rem; }
.loop-card ol { margin: 0; padding: 0; list-style: none; }
.loop-card li { padding: .7rem 0; border-bottom: 1px solid color-mix(in srgb, var(--on-brand) 22%, transparent); }
.loop-card li:last-child { border: 0; }
.loop-card b { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; display: block; }
.faq { max-width: 760px; }
.faq details { border-bottom: 1px solid var(--line); padding: .95rem 0; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 1.05rem; }
.faq p { margin: .6rem 0 0; color: var(--muted); }
.cta { text-align: center; padding: 4.5rem 1.5rem; }
.cta h2 { font-size: clamp(1.8rem, 3.6vw, 2.7rem); }
.site-foot { border-top: 1px solid var(--line); padding: 1.8rem 0; color: var(--muted); font-size: .92rem; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; }
.site-foot a { color: var(--muted); margin-left: 1rem; }
.doc { max-width: 720px; margin: 0 auto; padding: 1rem 1.5rem 4rem; }
.doc h2 { margin-top: 1.6em; }

/* Certificate */
.cert { max-width: 820px; margin: 2rem auto; padding: 3.2rem 2.5rem; background: var(--surface); border: 2px solid var(--mark); outline: 1px solid var(--mark); outline-offset: -12px; border-radius: 6px; text-align: center; }
.cert .who-name { font: 500 italic clamp(2rem, 5vw, 3rem) var(--serif); margin: .4em 0; color: var(--link); }
.cert .what { font: 600 1.4rem var(--serif); }

@media (max-width: 1180px) {
  .lesson-wrap { display: block; }
  .lesson-chat { position: fixed; inset: auto 0 0 0; width: auto; height: 72vh; margin: 0; z-index: 30; padding: 0 .5rem .5rem; }
}
@media (max-width: 900px) {
  .side { position: fixed; z-index: 40; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .scrim.show { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(15, 20, 18, .45); }
  .menu-btn { display: inline-flex; }
  .grid.two-one, .hero, .loop { grid-template-columns: 1fr; }
  .quick { grid-template-columns: 1fr 1fr; }
  .conv-list { display: none; }
  .tutor { padding: 0 .5rem .5rem; }
  .path, .feature-grid { grid-template-columns: 1fr; }
  .page { padding-inline: 1rem; }
  .site-nav .nav-link { display: none; }
  .hero { padding-top: 1.5rem; gap: 2rem; }
}
@media (max-width: 520px) {
  .grid.cols2 { grid-template-columns: 1fr; }
  .msg { max-width: 92%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; }
}
@media print {
  /* Browsers drop dark backgrounds on paper, so always print the light palette. */
  :root, .dark { --bg: #fff; --surface: #fff; --ink: #1D2925; --muted: #5B6761; --line: #ddd; --link: var(--brand); --mark: var(--brand); }
  body { background: #fff; }
  .no-print { display: none !important; }
  .cert { margin: 0 auto; }
}
