/* OCS study platform: one stylesheet.
   Colour carries meaning (see PLAN.md section 4): an era or a subject is always the same colour. */

:root {
  --paper: #f6f7f9;
  --card: #ffffff;
  --ink: #18212f;
  --ink-soft: #3a4556;
  --muted: #5d6878;
  --rule: #dce1e8;
  --accent: #23408e;          /* Ashoka blue: the Constitution, links, focus */
  --accent-soft: #e6ecfa;

  --era-company: #b8700f;     /* amber */
  --era-company-soft: #fdf1dc;
  --era-crown: #a32035;       /* crimson */
  --era-crown-soft: #fbe7ea;
  --era-india: #23408e;       /* Ashoka blue */
  --era-india-soft: #e6ecfa;
  --rights: #1e7a52;          /* green */
  --rights-soft: #e2f3ea;
  --court: #6a3fa0;           /* violet */
  --court-soft: #efe8f8;
  --odisha: #d9640f;          /* saffron */
  --odisha-soft: #fdecdd;
  --trap: #c62828;
  --trap-soft: #fdeaea;
  --mark: #ffe680;            /* the student's own highlights */

  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Public Sans", "Segoe UI", system-ui, sans-serif;

  --measure: 66ch;
  --radius-s: 6px;
  --radius-m: 12px;
  --shadow: 0 1px 2px rgba(24, 33, 47, 0.06), 0 6px 20px rgba(24, 33, 47, 0.06);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121823; --card: #1a2230; --ink: #e8ecf2; --ink-soft: #c6cdd8; --muted: #95a0b0; --rule: #2c3647;
    --accent: #8fa8ec; --accent-soft: #1f2b47;
    --era-company: #e9a94a; --era-company-soft: #33270f; --era-crown: #ef7d8d; --era-crown-soft: #3a1a20;
    --era-india: #8fa8ec; --era-india-soft: #1f2b47; --rights: #63c495; --rights-soft: #15332a;
    --court: #b99be3; --court-soft: #2b2140; --odisha: #f29a55; --odisha-soft: #3a2614;
    --trap: #ff7b72; --trap-soft: #3b1c1c; --mark: #6b5a12;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121823; --card: #1a2230; --ink: #e8ecf2; --ink-soft: #c6cdd8; --muted: #95a0b0; --rule: #2c3647;
  --accent: #8fa8ec; --accent-soft: #1f2b47;
  --era-company: #e9a94a; --era-company-soft: #33270f; --era-crown: #ef7d8d; --era-crown-soft: #3a1a20;
  --era-india: #8fa8ec; --era-india-soft: #1f2b47; --rights: #63c495; --rights-soft: #15332a;
  --court: #b99be3; --court-soft: #2b2140; --odisha: #f29a55; --odisha-soft: #3a2614;
  --trap: #ff7b72; --trap-soft: #3b1c1c; --mark: #6b5a12;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--serif); font-size: 1.125rem; line-height: 1.7; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3, h4 { font-family: var(--sans); line-height: 1.2; color: var(--ink); }
h2 { font-size: 1.75rem; margin: 3.5rem 0 1rem; letter-spacing: -0.01em; }
h3 { font-size: 1.25rem; margin: 2.25rem 0 0.5rem; }
h4 { font-size: 1.05rem; margin: 1.5rem 0 0.25rem; }
p { margin: 0 0 1rem; }
strong { font-weight: 650; }
small, .small { font-size: 0.85rem; }
button { font: inherit; }
.sans { font-family: var(--sans); }
.muted { color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem; padding: 0.6rem 1rem;
  background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); font-family: var(--sans); font-size: 0.95rem; }
.topbar a.home { font-weight: 700; color: var(--ink); text-decoration: none; }
.topbar .where { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.topbar .tool { border: 1px solid var(--rule); background: var(--card); color: var(--ink); border-radius: 999px; padding: 0.3rem 0.8rem; cursor: pointer; }
.topbar .tool:hover { border-color: var(--accent); }
.progress-line { position: fixed; top: 0; left: 0; height: 3px; background: var(--accent); width: 0; z-index: 40; transition: width 0.1s linear; }

/* ---------- reading layout: toc | text | margin ---------- */
.page { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, var(--measure)) minmax(0, 1fr); column-gap: 2.5rem; padding: 0 1rem 6rem; }
.page > * { grid-column: 2; }
.toc { grid-column: 1; grid-row: 2 / span 999; justify-self: end; width: 220px; position: sticky; top: 4rem; align-self: start; max-height: calc(100vh - 5rem); overflow: auto; font-family: var(--sans); font-size: 0.9rem; padding-top: 2rem; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0.15rem 0; }
.toc a { display: block; padding: 0.3rem 0.6rem; border-left: 3px solid transparent; color: var(--muted); text-decoration: none; border-radius: 0 6px 6px 0; }
.toc a:hover { color: var(--ink); background: var(--card); }
.toc a.active { color: var(--ink); border-left-color: var(--era, var(--accent)); background: var(--card); font-weight: 600; }
.wide { grid-column: 2 / 4; }
@media (max-width: 1180px) { .toc { display: none; } .page { grid-template-columns: minmax(0, 1fr) minmax(0, var(--measure)) minmax(0, 1fr); } .wide { grid-column: 2; } }
@media (max-width: 720px) { .page { grid-template-columns: 0 minmax(0, 1fr) 0; column-gap: 0; padding: 0 16px 5rem; } body { font-size: 1.06rem; } }

/* margin notes sit to the right of the paragraph on wide screens, inline on narrow ones */
.with-margin { display: grid; grid-template-columns: minmax(0, var(--measure)) 230px; column-gap: 2.5rem; grid-column: 2 / 4; }
.with-margin > .side { font-family: var(--sans); font-size: 0.86rem; line-height: 1.5; color: var(--ink-soft); border-left: 3px solid var(--era, var(--accent)); padding: 0.2rem 0 0.2rem 0.8rem; align-self: start; }
.with-margin > .side b { color: var(--ink); }
@media (max-width: 1180px) { .with-margin { grid-template-columns: minmax(0, 1fr); grid-column: 2; } .with-margin > .side { margin: 0 0 1rem; background: var(--card); border-radius: 0 var(--radius-s) var(--radius-s) 0; padding: 0.6rem 0.8rem; } }

/* ---------- eras: a section sets --era and everything inside follows ---------- */
.era-company { --era: var(--era-company); --era-soft: var(--era-company-soft); }
.era-crown { --era: var(--era-crown); --era-soft: var(--era-crown-soft); }
.era-india { --era: var(--era-india); --era-soft: var(--era-india-soft); }
.part-head { margin-top: 5rem; padding: 2rem 0 1rem; border-top: 6px solid var(--era); }
.part-head .span { font-family: var(--sans); font-weight: 700; color: var(--era); font-size: 1rem; }
.part-head h2 { margin: 0.3rem 0 0.6rem; font-size: 2.2rem; }
.part-head p { font-size: 1.15rem; color: var(--ink-soft); }

/* ---------- hero ---------- */
.hero { grid-column: 1 / 4; grid-row: 1; margin: 0 -1rem 2rem; padding: 4rem 1rem 3rem; color: #fff;
  background: radial-gradient(circle at 80% 20%, rgba(255,255,255,0.08), transparent 45%), linear-gradient(135deg, #12204a 0%, #23408e 55%, #3a2a6a 100%); }
.hero-inner { max-width: calc(var(--measure) + 260px); margin: 0 auto; }
.hero .kicker { font-family: var(--sans); opacity: 0.8; font-size: 1rem; }
.hero h1 { color: #fff; font-size: clamp(2.2rem, 5vw, 3.6rem); margin: 0.4rem 0 1rem; letter-spacing: -0.02em; max-width: 18ch; }
.hero p { font-size: 1.2rem; max-width: 58ch; opacity: 0.92; }
.hero .facts { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.6rem; font-family: var(--sans); font-size: 0.92rem; }
.hero .facts span { background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.22); padding: 0.35rem 0.8rem; border-radius: 999px; }

/* ---------- the scene: a short story that opens a section ---------- */
.scene { position: relative; margin: 1.5rem 0 2rem; padding: 1.4rem 1.5rem 1.4rem 1.6rem; background: var(--era-soft, var(--accent-soft)); border-radius: var(--radius-m); font-size: 1.12rem; }
.scene::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 4px; background: var(--era, var(--accent)); }
.scene .when { display: block; font-family: var(--sans); font-weight: 700; color: var(--era, var(--accent)); margin-bottom: 0.4rem; font-size: 0.95rem; }
.scene p:last-child { margin-bottom: 0; }

/* ---------- boxes ---------- */
.box { margin: 1.6rem 0; padding: 1rem 1.2rem; border-radius: var(--radius-m); background: var(--card); box-shadow: var(--shadow); }
.box > .label { font-family: var(--sans); font-weight: 700; font-size: 0.95rem; margin-bottom: 0.4rem; display: flex; gap: 0.5rem; align-items: center; }
.box p:last-child, .box ul:last-child, .box ol:last-child { margin-bottom: 0; }
.box.hook { background: #fff7c7; color: #2a2410; border: 1px solid #f1df7c; transform: rotate(-0.4deg); }
:root[data-theme="dark"] .box.hook { background: #3a3414; color: #f4ecc4; border-color: #5d5321; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .box.hook { background: #3a3414; color: #f4ecc4; border-color: #5d5321; } }
.box.trap { background: var(--trap-soft); border: 2px solid var(--trap); box-shadow: none; }
.box.trap > .label { color: var(--trap); }
.box.odisha { background: var(--odisha-soft); border-left: 6px solid var(--odisha); box-shadow: none; }
.box.odisha > .label { color: var(--odisha); }
.box.lens { background: var(--accent-soft); border-left: 6px solid var(--accent); box-shadow: none; }
.box.lens > .label { color: var(--accent); }
.box.why { border-left: 6px solid var(--era, var(--accent)); }
.box ul, .box ol { padding-left: 1.2rem; }

/* tables */
.table-wrap { overflow-x: auto; margin: 1.2rem 0 1.6rem; }
table { border-collapse: collapse; width: 100%; font-family: var(--sans); font-size: 0.95rem; line-height: 1.45; background: var(--card); border-radius: var(--radius-s); overflow: hidden; }
th, td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { background: var(--era-soft, var(--accent-soft)); font-weight: 700; }
tr:last-child td { border-bottom: 0; }

/* figures */
figure { margin: 1.8rem 0; }
figure img { border-radius: var(--radius-s); box-shadow: var(--shadow); background: var(--card); }
figcaption { font-family: var(--sans); font-size: 0.86rem; color: var(--muted); margin-top: 0.5rem; line-height: 1.45; }
figcaption .credit { display: block; font-size: 0.78rem; opacity: 0.85; }
figure.side-by-side { display: grid; grid-template-columns: 180px 1fr; gap: 1rem; align-items: start; }
@media (max-width: 560px) { figure.side-by-side { grid-template-columns: 1fr; } }

/* ---------- release-notes timeline (the memorable element) ---------- */
.releases { position: relative; margin: 2rem 0; padding-left: 1.6rem; }
.releases::before { content: ""; position: absolute; left: 0.45rem; top: 0.5rem; bottom: 0.5rem; width: 3px; background: linear-gradient(var(--era-company), var(--era-crown) 55%, var(--era-india)); border-radius: 3px; }
.release { position: relative; margin: 0 0 1.6rem; padding: 1rem 1.2rem 1.1rem; background: var(--card); border-radius: var(--radius-m); box-shadow: var(--shadow); border-top: 4px solid var(--era, var(--accent));
  opacity: 0; transform: translateY(14px); transition: opacity 0.5s ease, transform 0.5s ease; }
.release.seen { opacity: 1; transform: none; }
.release::before { content: ""; position: absolute; left: -1.55rem; top: 1.25rem; width: 15px; height: 15px; border-radius: 50%; background: var(--card); border: 4px solid var(--era, var(--accent)); }
.release .ver { font-family: var(--sans); font-weight: 800; font-size: 1.6rem; color: var(--era, var(--accent)); line-height: 1; }
.release .name { font-family: var(--sans); font-weight: 700; font-size: 1.05rem; margin-left: 0.4rem; }
.release .aka { font-family: var(--sans); color: var(--muted); font-size: 0.88rem; display: block; margin-top: 0.2rem; }
.release .oneline { margin: 0.7rem 0 0.6rem; font-size: 1.08rem; }
.release .oneline b { background: linear-gradient(transparent 60%, color-mix(in srgb, var(--era) 25%, transparent) 60%); }
.release .notes { display: grid; grid-template-columns: 1fr 2fr 1fr; gap: 0.8rem; font-family: var(--sans); font-size: 0.9rem; line-height: 1.45; }
.release .notes > div { background: var(--era-soft, var(--paper)); border-radius: var(--radius-s); padding: 0.6rem 0.7rem; }
.release .notes h5 { margin: 0 0 0.3rem; font-size: 0.82rem; color: var(--era); }
.release .notes ul { margin: 0; padding-left: 1rem; }
@media (max-width: 720px) { .release .notes { grid-template-columns: 1fr; } }
.release details { margin-top: 0.6rem; font-family: var(--sans); font-size: 0.92rem; }
.release details summary { cursor: pointer; color: var(--era); font-weight: 600; }

/* ---------- scroll journey: sticky panel + steps ---------- */
.journey { grid-column: 2 / 4; display: grid; grid-template-columns: minmax(0, var(--measure)) 300px; column-gap: 2.5rem; }
.journey .steps { grid-column: 1; }
.journey .panel { grid-column: 2; grid-row: 1; position: sticky; top: 5rem; align-self: start; background: var(--card); border-radius: var(--radius-m); box-shadow: var(--shadow); padding: 1rem 1.1rem; font-family: var(--sans); }
@media (max-width: 1180px) {
  .journey { grid-column: 2; grid-template-columns: minmax(0, 1fr); }
  .journey .panel { grid-column: 1; grid-row: 1; position: sticky; top: 3.2rem; z-index: 5; padding: 0.6rem 0.8rem; margin-bottom: 1rem; }
  .journey .panel .detail { display: none; }
}
.panel .year { font-size: 3rem; font-weight: 800; line-height: 1; color: var(--panel-era, var(--accent)); transition: color 0.4s; font-variant-numeric: tabular-nums; }
.panel .ruler { font-weight: 700; margin: 0.2rem 0 0.8rem; color: var(--panel-era, var(--accent)); transition: color 0.4s; }
.meter { margin: 0.7rem 0; }
.meter .m-label { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--muted); }
.meter .m-track { height: 10px; background: var(--rule); border-radius: 999px; overflow: hidden; margin-top: 0.25rem; }
.meter .m-fill { height: 100%; width: 0; background: var(--panel-era, var(--accent)); border-radius: 999px; transition: width 0.7s cubic-bezier(.2,.8,.2,1), background 0.4s; }
.balance { margin: 0.9rem 0 0.2rem; }
.balance .b-track { position: relative; height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--accent) 0%, var(--rule) 50%, var(--court) 100%); }
.balance .b-dot { position: absolute; top: 50%; width: 20px; height: 20px; border-radius: 50%; background: var(--card); border: 4px solid var(--ink); transform: translate(-50%, -50%); left: 50%; transition: left 0.7s cubic-bezier(.2,.8,.2,1); }
.balance .b-ends { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); margin-top: 0.35rem; }
.panel .detail { font-size: 0.86rem; color: var(--ink-soft); margin-top: 0.9rem; border-top: 1px solid var(--rule); padding-top: 0.7rem; min-height: 4.5em; }

/* ---------- pause and recall ---------- */
.recall { margin: 2rem 0; border: 2px dashed var(--era, var(--accent)); border-radius: var(--radius-m); padding: 1rem 1.2rem; background: var(--card); font-family: var(--sans); }
.recall > .label { font-weight: 800; color: var(--era, var(--accent)); margin-bottom: 0.5rem; }
.recall ol { margin: 0 0 0.6rem; padding-left: 1.3rem; }
.recall li { margin: 0.5rem 0; }
.recall .ans { display: none; margin-top: 0.25rem; padding: 0.4rem 0.6rem; background: var(--rights-soft); border-radius: var(--radius-s); color: var(--ink); }
.recall.revealed .ans { display: block; animation: pop 0.35s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.btn { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--sans); font-weight: 650; font-size: 0.95rem; padding: 0.55rem 1rem; border-radius: 999px; border: 0; cursor: pointer; background: var(--accent); color: #fff; }
.btn.secondary { background: var(--card); color: var(--ink); border: 1px solid var(--rule); }
.btn.good { background: var(--rights); }
.btn.bad { background: var(--trap); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.8rem; }

/* ---------- "don't confuse" ---------- */
.confuse th:first-child { width: 28%; }

/* ---------- seat builder (dot field) ---------- */
.seats { margin: 1.8rem 0; padding: 1.2rem; background: var(--card); border-radius: var(--radius-m); box-shadow: var(--shadow); font-family: var(--sans); }
.seats .stage-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.seats .stage-tabs button { border: 1px solid var(--rule); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 0.35rem 0.8rem; cursor: pointer; font-size: 0.9rem; }
.seats .stage-tabs button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.seats .field { display: grid; grid-template-columns: repeat(26, 1fr); gap: 3px; }
.seats .dot { aspect-ratio: 1; border-radius: 50%; background: var(--rule); transition: background 0.5s ease, transform 0.5s ease, opacity 0.5s ease; }
.seats .dot.gone { opacity: 0.12; transform: scale(0.6); }
.seats .dot.hollow { background: transparent; box-shadow: inset 0 0 0 2px var(--muted); }
.seats .big { font-size: 2.6rem; font-weight: 800; line-height: 1; margin: 0.8rem 0 0.2rem; font-variant-numeric: tabular-nums; }
.seats .legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; font-size: 0.86rem; margin-top: 0.6rem; }
.seats .legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 0.35rem; vertical-align: -1px; }
.seats .caption { color: var(--ink-soft); font-size: 0.95rem; margin-top: 0.6rem; }
@media (max-width: 560px) { .seats .field { grid-template-columns: repeat(20, 1fr); gap: 2px; } }

/* ---------- games: order it, match it ---------- */
.game { margin: 2rem 0; padding: 1.2rem; background: var(--card); border-radius: var(--radius-m); box-shadow: var(--shadow); font-family: var(--sans); }
.game > .label { font-weight: 800; color: var(--era, var(--accent)); }
.order-list { list-style: none; margin: 0.8rem 0; padding: 0; }
.order-list li { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.7rem; margin: 0.35rem 0; background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius-s); cursor: grab; touch-action: none; }
.order-list li.dragging { opacity: 0.5; }
.order-list li .grip { color: var(--muted); }
.order-list li .txt { flex: 1; }
.order-list li .mv { border: 1px solid var(--rule); background: var(--card); color: var(--ink); border-radius: 6px; width: 2rem; height: 2rem; cursor: pointer; }
.order-list li.right { border-color: var(--rights); background: var(--rights-soft); }
.order-list li.wrong { border-color: var(--trap); background: var(--trap-soft); }
.order-list li .year { font-weight: 800; display: none; }
.order-list.checked li .year { display: inline; }
.match-row { display: grid; grid-template-columns: 1fr 170px; gap: 0.6rem; align-items: center; padding: 0.45rem 0; border-bottom: 1px solid var(--rule); }
.match-row select { font: inherit; padding: 0.35rem; border-radius: 6px; border: 1px solid var(--rule); background: var(--paper); color: var(--ink); }
.match-row.right select { border-color: var(--rights); background: var(--rights-soft); }
.match-row.wrong select { border-color: var(--trap); background: var(--trap-soft); }
.match-row .why { grid-column: 1 / -1; font-size: 0.86rem; color: var(--ink-soft); display: none; }
.match-row.wrong .why { display: block; }
.game .result { margin-top: 0.8rem; font-weight: 700; }
@media (max-width: 560px) { .match-row { grid-template-columns: 1fr; } }

/* ---------- module test ---------- */
.quiz { font-family: var(--sans); }
.q { margin: 1.4rem 0; padding: 1rem 1.1rem; background: var(--card); border-radius: var(--radius-m); box-shadow: var(--shadow); }
.q .qn { font-weight: 800; color: var(--accent); margin-right: 0.3rem; }
.q .stem { font-family: var(--serif); font-size: 1.05rem; }
.q .stem ol { margin: 0.4rem 0; }
.q .opts { display: grid; gap: 0.4rem; margin-top: 0.6rem; }
.q label.opt { display: flex; gap: 0.6rem; align-items: flex-start; padding: 0.5rem 0.7rem; border: 1px solid var(--rule); border-radius: var(--radius-s); cursor: pointer; background: var(--paper); }
.q label.opt:hover { border-color: var(--accent); }
.q input[type="radio"] { margin-top: 0.35rem; accent-color: var(--accent); }
.q.done label.opt { cursor: default; }
.q label.opt.is-right { border-color: var(--rights); background: var(--rights-soft); }
.q label.opt.is-wrong { border-color: var(--trap); background: var(--trap-soft); }
.q .explain { display: none; margin-top: 0.7rem; padding: 0.7rem 0.8rem; background: var(--accent-soft); border-radius: var(--radius-s); font-size: 0.95rem; line-height: 1.5; }
.q.done .explain { display: block; }
.q .explain a { font-weight: 600; }
.q .tag { font-size: 0.78rem; color: var(--muted); }
.scorecard { position: sticky; bottom: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; padding: 0.8rem 1rem; background: var(--card); border-top: 3px solid var(--accent); box-shadow: 0 -6px 20px rgba(24,33,47,0.08); font-family: var(--sans); border-radius: var(--radius-m) var(--radius-m) 0 0; }
.scorecard .big { font-size: 1.6rem; font-weight: 800; }

/* ---------- flashcards ---------- */
.cards { font-family: var(--sans); }
.flash { perspective: 1200px; margin: 1rem 0; }
.flash .inner { position: relative; min-height: 190px; transition: transform 0.6s; transform-style: preserve-3d; }
.flash.flipped .inner { transform: rotateY(180deg); }
.flash .face { position: absolute; inset: 0; backface-visibility: hidden; display: flex; align-items: center; justify-content: center; text-align: center; padding: 1.4rem; border-radius: var(--radius-m); box-shadow: var(--shadow); font-size: 1.15rem; line-height: 1.45; }
.flash .front { background: var(--card); border-top: 5px solid var(--accent); font-family: var(--serif); }
.flash .back { background: var(--accent); color: #fff; transform: rotateY(180deg); }
.cards .meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.9rem; }

/* ---------- mains thinking studio ---------- */
.studio { margin: 2rem 0; padding: 1.3rem; background: var(--card); border-radius: var(--radius-m); box-shadow: var(--shadow); font-family: var(--sans); border-top: 5px solid var(--court); }
.studio .qtext { font-family: var(--serif); font-size: 1.15rem; margin: 0.3rem 0 0.4rem; }
.studio .meta { color: var(--muted); font-size: 0.9rem; }
.studio .step { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.studio .step h4 { margin: 0 0 0.4rem; color: var(--court); }
.studio .chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.studio .chips label { border: 1px solid var(--rule); border-radius: 999px; padding: 0.3rem 0.75rem; cursor: pointer; font-size: 0.9rem; background: var(--paper); }
.studio .chips input { margin-right: 0.35rem; accent-color: var(--court); }
.studio textarea { width: 100%; min-height: 4.5rem; font: inherit; font-size: 0.95rem; padding: 0.6rem; border-radius: var(--radius-s); border: 1px solid var(--rule); background: var(--paper); color: var(--ink); }
.studio .model { display: none; margin-top: 1rem; padding: 1rem; background: var(--court-soft); border-radius: var(--radius-s); }
.studio.planned .model { display: block; animation: pop 0.4s ease; }
.studio input[type="file"] { font: inherit; margin: 0.4rem 0; }
.studio .status { margin-top: 0.6rem; font-weight: 600; }
.directive { margin: 0.6rem 0; padding: 0.6rem 0.8rem; background: var(--court-soft); border-radius: var(--radius-s); font-size: 0.95rem; }

/* ---------- highlights and notes ---------- */
mark.hl { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; cursor: pointer; }
mark.hl.has-note { box-shadow: inset 0 -2px 0 var(--odisha); }
.sel-tools { position: absolute; z-index: 50; display: none; gap: 0.3rem; padding: 0.3rem; background: var(--ink); border-radius: 999px; box-shadow: var(--shadow); font-family: var(--sans); }
.sel-tools button { border: 0; background: transparent; color: var(--paper); padding: 0.35rem 0.7rem; border-radius: 999px; cursor: pointer; font-size: 0.9rem; }
.sel-tools button:hover { background: rgba(255,255,255,0.15); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 60; background: var(--card); box-shadow: -10px 0 30px rgba(0,0,0,0.15); transform: translateX(105%); transition: transform 0.3s ease; display: flex; flex-direction: column; font-family: var(--sans); }
.drawer.open { transform: none; }
.drawer header { display: flex; align-items: center; justify-content: space-between; padding: 1rem; border-bottom: 1px solid var(--rule); }
.drawer .list { overflow: auto; padding: 0.5rem 1rem 2rem; }
.drawer .note { border-bottom: 1px solid var(--rule); padding: 0.8rem 0; }
.drawer .note blockquote { margin: 0 0 0.4rem; padding-left: 0.6rem; border-left: 3px solid var(--mark); font-family: var(--serif); color: var(--ink-soft); }
.drawer .note textarea { width: 100%; font: inherit; font-size: 0.92rem; padding: 0.5rem; border-radius: var(--radius-s); border: 1px solid var(--rule); background: var(--paper); color: var(--ink); min-height: 3.5rem; }
.drawer .note .acts { display: flex; gap: 0.5rem; margin-top: 0.4rem; }
.drawer .note .acts button { font-size: 0.85rem; }
.toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%) translateY(150%); background: var(--ink); color: var(--paper); padding: 0.6rem 1rem; border-radius: 999px; font-family: var(--sans); font-size: 0.92rem; z-index: 70; transition: transform 0.3s ease; }
.toast.show { transform: translateX(-50%); }
.toast.error { background: var(--trap); color: #fff; }

/* ---------- home ---------- */
.modules { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; gap: 0.7rem; }
.modules li { display: grid; grid-template-columns: 3rem 1fr auto; gap: 1rem; align-items: center; padding: 0.9rem 1rem; background: var(--card); border-radius: var(--radius-m); box-shadow: var(--shadow); font-family: var(--sans); }
.modules li.locked { opacity: 0.55; box-shadow: none; background: transparent; border: 1px dashed var(--rule); }
.modules .n { font-weight: 800; font-size: 1.4rem; color: var(--accent); text-align: center; }
.modules .t { font-weight: 650; }
.modules .s { font-size: 0.86rem; color: var(--muted); }
.modules .stat { font-size: 0.86rem; text-align: right; color: var(--ink-soft); white-space: nowrap; }
.foot { grid-column: 1 / 4; margin-top: 4rem; padding: 2rem 1rem; border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 0.85rem; color: var(--muted); text-align: center; }

/* ---------- phone width ---------- */
.topbar a.home, .topbar .tool { white-space: nowrap; }
@media (max-width: 720px) {
  .topbar { gap: 0.5rem; padding: 0.5rem 12px; font-size: 0.88rem; }
  .topbar .where { display: none; }
  .topbar .tool { padding: 0.25rem 0.6rem; }
  .release::before { display: none; }
  .releases, .journey .steps { padding-left: 0; }
  /* the journey panel becomes one compact strip under the top bar */
  .journey .panel { top: 2.9rem; display: grid; grid-template-columns: auto 1fr; column-gap: 0.8rem; align-items: center; padding: 0.45rem 0.7rem; border-radius: 0 0 var(--radius-m) var(--radius-m); }
  .panel .year { font-size: 1.6rem; grid-row: 1 / span 2; }
  .panel .ruler { font-size: 0.8rem; margin: 0; line-height: 1.25; }
  .panel .meter { margin: 0.25rem 0 0; grid-column: 2; }
  .panel .meter .m-label { font-size: 0.72rem; }
  .panel .meter .m-track { height: 6px; }
  .panel .balance { grid-column: 1 / -1; margin: 0.35rem 0 0; }
  .panel .balance .b-track { height: 6px; }
  .panel .balance .b-dot { width: 14px; height: 14px; border-width: 3px; }
  .panel .balance .b-ends { font-size: 0.7rem; margin-top: 0.15rem; }
}
