/* MindShield design tokens: one neutral palette, one accent. */
:root {
  --bg: #f4f3ef;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --text: #1b1b19;
  --muted: #5d5c57;
  --line: #e2e0d9;
  --line-strong: #c9c6bd;
  --accent: #1f5f8b;
  --accent-ink: #ffffff;
  --accent-soft: #e6eff6;
  --ok: #24693f;
  --ok-soft: #e3f1e7;
  --bad: #9b2d3a;
  --bad-soft: #f8e5e7;
  --warn: #8a5312;
  --warn-soft: #fbf0dc;
  --notice: #fff7dd;
  --notice-line: #d9a441;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tap: 44px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 1rem; line-height: 1.45; }
.boot { padding: 3rem 1rem; text-align: center; color: var(--muted); }
button { font: inherit; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout ---------- */
.page { max-width: 34rem; margin: 0 auto; padding: 1rem 1rem calc(2rem + env(safe-area-inset-bottom)); }
.stack > * + * { margin-top: 1rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .5rem 0 .75rem; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; }
.brand svg { width: 28px; height: 28px; }
.footer-note { font-size: .8rem; color: var(--muted); text-align: center; padding: 1.5rem 0 0; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: var(--tap); padding: .6rem 1rem; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.block { width: 100%; }
.btn.lg { font-size: 1.1rem; min-height: 52px; }
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-row { display: flex; gap: .5rem; }
.btn-row > .btn { flex: 1; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: .9rem; }
.field span { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .3rem; }
.input { width: 100%; min-height: var(--tap); padding: .55rem .75rem; font: inherit; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); }
.input.code { text-transform: uppercase; letter-spacing: .25em; font-size: 1.3rem; font-weight: 700; text-align: center; }
.input:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.error { color: var(--bad); background: var(--bad-soft); border-radius: 8px; padding: .5rem .75rem; font-size: .9rem; }
.hint { font-size: .85rem; color: var(--muted); }

/* ---------- waiting ---------- */
.waiting { text-align: center; padding: 2.5rem 1rem; }
.pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); margin: 0 auto 1rem; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: .5; } 50% { transform: scale(1.5); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* ---------- inoculation notice (deliberately unlike a feed) ---------- */
.notice { background: var(--notice); border: 2px solid var(--notice-line); border-radius: 6px; padding: 1.25rem 1.1rem; font-family: Georgia, "Times New Roman", serif; }
.notice .kicker { font-family: var(--font); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--warn); font-weight: 700; margin-bottom: .4rem; }
.notice h1 { font-size: 1.5rem; margin-bottom: .75rem; }
.notice p { font-size: 1.02rem; }
.technique { border-top: 1px solid var(--notice-line); padding-top: .9rem; margin-top: .9rem; }
.technique h2 { font-size: 1.1rem; display: flex; gap: .5rem; align-items: baseline; }
.technique .num { font-family: var(--font); background: var(--warn); color: #fff; border-radius: 50%; width: 1.5rem; height: 1.5rem; display: inline-flex; align-items: center; justify-content: center; font-size: .85rem; flex: none; }
.technique .example { background: rgba(255,255,255,.7); border-left: 3px solid var(--line-strong); padding: .5rem .75rem; margin: .5rem 0; font-style: italic; }
.technique .refute { display: flex; gap: .5rem; }
.technique .refute b { font-family: var(--font); color: var(--ok); flex: none; }
.ready-bar { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 70%, transparent); padding: 1rem 0 .25rem; display: flex; align-items: center; gap: .75rem; }
.ring { width: 44px; height: 44px; flex: none; }
.ring circle { fill: none; stroke-width: 4; }
.ring .track { stroke: var(--line); }
.ring .prog { stroke: var(--accent); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dashoffset .5s linear; }

/* ---------- quick check ---------- */
.qc-snippet { font-size: 1.1rem; font-style: italic; padding: .75rem; background: var(--surface-2); border-radius: 8px; margin-bottom: .75rem; }
.choice-list { display: grid; gap: .5rem; }
.choice { text-align: left; justify-content: flex-start; }
.choice.correct { border-color: var(--ok); background: var(--ok-soft); }
.choice.wrong { border-color: var(--bad); background: var(--bad-soft); }
.feedback { border-radius: 8px; padding: .6rem .75rem; margin-top: .6rem; font-size: .92rem; display: flex; gap: .5rem; align-items: flex-start; min-height: 3.2rem; }
.feedback.ok { background: var(--ok-soft); color: var(--ok); }
.feedback.bad { background: var(--bad-soft); color: var(--bad); }
.feedback .fb-icon { flex: none; font-weight: 800; }
.feedback .fb-text { color: var(--text); }

/* ---------- social feed ---------- */
.feed-head { position: sticky; top: 0; z-index: 5; background: var(--bg); padding: .5rem 0; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); margin-bottom: .75rem; }
.feed-brand { display: flex; align-items: center; gap: .45rem; font-weight: 800; font-size: 1.1rem; }
.feed-brand svg { width: 26px; height: 26px; }
.score-pill { font-size: .85rem; color: var(--muted); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .25rem .65rem; font-variant-numeric: tabular-nums; }
.post { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; margin-bottom: .75rem; box-shadow: var(--shadow); }
.post-head { display: flex; gap: .6rem; align-items: center; margin-bottom: .5rem; }
.avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.post-who { display: flex; flex-direction: column; min-width: 0; }
.post-who b { font-size: .95rem; }
.post-who span { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-text { font-size: 1rem; margin-bottom: .6rem; white-space: pre-wrap; }
.post-img { width: 100%; aspect-ratio: 16 / 9; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); display: block; margin-bottom: .6rem; }
.post-meta { display: flex; gap: 1rem; font-size: .82rem; color: var(--muted); margin-bottom: .6rem; }
.post-actions { display: flex; gap: .5rem; }
.post-actions .btn { flex: 1; }
.post-actions .btn.chosen { border-color: var(--accent); background: var(--accent-soft); }
.post-actions .btn.ok-chosen { border-color: var(--ok); }
.post-actions .btn.bad-chosen { border-color: var(--bad); }
.headline { font-weight: 700; font-size: 1.08rem; margin-bottom: .3rem; }
.teaser { color: var(--muted); font-size: .92rem; margin-bottom: .6rem; }
.icon-btn { display: inline-flex; align-items: center; gap: .35rem; min-height: var(--tap); padding: .4rem .6rem; border: 1px solid transparent; background: transparent; border-radius: 8px; color: var(--muted); font-weight: 600; cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.active { color: var(--accent); }
.icon-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.locked { opacity: .55; pointer-events: none; }
.banner { background: var(--warn-soft); color: var(--warn); border: 1px solid var(--notice-line); border-radius: 8px; padding: .6rem .8rem; font-weight: 600; text-align: center; margin-bottom: .75rem; }

/* ---------- fact-check labels (Module 2) ---------- */
.fc { border-radius: 8px; padding: .55rem .7rem; margin-bottom: .6rem; font-size: .9rem; }
.fc-head { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin-bottom: .2rem; }
.fc-head svg { width: 16px; height: 16px; flex: none; }
.fc-body { color: var(--text); }
.fc-pro { border: 1px solid var(--line-strong); background: var(--surface-2); }
.fc-pro.false .fc-head b { color: var(--bad); }
.fc-pro.accurate .fc-head b { color: var(--ok); }
.fc-pro.false { border-left: 4px solid var(--bad); }
.fc-pro.accurate { border-left: 4px solid var(--ok); }
.fc-crowd { background: var(--accent-soft); border: 1px solid #c6d8e6; }
.fc-crowd .fc-head b { color: var(--accent); }

/* ---------- sheet (bottom drawer) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--surface); width: 100%; max-width: 34rem; border-radius: 16px 16px 0 0; padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom)); }
.sheet h3 { margin-bottom: .75rem; }

/* ---------- accuracy prompt (full screen, unlike the feed) ---------- */
.interstitial { position: fixed; inset: 0; z-index: 30; background: #17324a; color: #fff; display: flex; flex-direction: column; padding: max(1rem, env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom)); }
.interstitial .steps { display: flex; gap: .4rem; margin-bottom: 1.5rem; }
.interstitial .steps i { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.25); }
.interstitial .steps i.on { background: #fff; }
.interstitial h2 { font-size: 1.5rem; margin: auto 0 .75rem; }
.interstitial .quote { background: rgba(255,255,255,.1); border-radius: 10px; padding: .75rem; margin-bottom: 1rem; font-size: .95rem; }
.interstitial .choice-list { margin-bottom: auto; }
.interstitial .btn { background: rgba(255,255,255,.08); color: #fff; border-color: rgba(255,255,255,.35); }
.interstitial .btn.primary { background: #fff; color: #17324a; border-color: #fff; }
.interstitial .note { background: rgba(255,255,255,.12); padding: .6rem .75rem; border-radius: 8px; margin-bottom: 1rem; }
.interstitial .close { align-self: flex-end; }

/* ---------- article view ---------- */
.article { position: fixed; inset: 0; z-index: 25; background: var(--surface); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.article .inner { max-width: 34rem; margin: 0 auto; padding: 1rem 1rem 3rem; }
.article h1 { font-size: 1.5rem; }
.article p { font-size: 1.02rem; line-height: 1.6; }
.article .src { font-size: .85rem; color: var(--muted); margin-bottom: 1rem; }

/* ---------- results ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.stat { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; }
.stat .v { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat .l { font-size: .8rem; color: var(--muted); }
.stat .c { font-size: .85rem; color: var(--accent); margin-top: .2rem; }
.takeaway { border-left: 4px solid var(--accent); padding: .5rem .8rem; background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.result-list { list-style: none; padding: 0; margin: 0; }
.result-list li { display: flex; gap: .5rem; align-items: flex-start; padding: .5rem 0; border-top: 1px solid var(--line); font-size: .92rem; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: .15rem .45rem; border-radius: 4px; flex: none; }
.tag.false { background: var(--bad-soft); color: var(--bad); }
.tag.true { background: var(--ok-soft); color: var(--ok); }
.tag.neutral { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }

/* ---------- lecturer ---------- */
.lecturer-body { background: var(--bg); }
.lec { max-width: 72rem; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.lec-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.lec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); gap: 1rem; }
.code-big { font-size: 2.4rem; font-weight: 800; letter-spacing: .18em; font-variant-numeric: tabular-nums; }
.controls { display: grid; gap: .5rem; }
.control-row { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.state-pill { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: .2rem .55rem; border-radius: 999px; border: 1px solid var(--line-strong); }
.state-pill.open { background: var(--ok-soft); color: var(--ok); border-color: var(--ok); }
.state-pill.revealed { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.counter-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: .5rem; }
.login { max-width: 22rem; margin: 4rem auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { text-align: left; padding: .4rem .5rem; border-top: 1px solid var(--line); }
.tbl th { color: var(--muted); font-weight: 600; font-size: .8rem; }
.bars { display: grid; gap: .45rem; }
.bar-row { display: grid; grid-template-columns: minmax(6rem, 14rem) 1fr 3.5rem; align-items: center; gap: .6rem; font-size: .9rem; }
.bar-row .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 18px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); }
.bar-fill.bad { background: var(--bad); }
.bar-fill.ok { background: var(--ok); }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; }
.hist { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 1rem; }
.hist .col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; font-size: .7rem; color: var(--muted); }
.hist .col i { display: block; width: 100%; background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; }
.hist .col b { font-size: .75rem; color: var(--text); }
.checkbox { display: flex; align-items: center; gap: .5rem; min-height: var(--tap); }
.checkbox input { width: 22px; height: 22px; }
.qr-full { position: fixed; inset: 0; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5rem; color: #111; }
.qr-full img, .qr-full svg { width: min(60vh, 80vw); height: auto; }
.qr-inline svg { width: 180px; height: 180px; display: block; border: 1px solid var(--line); border-radius: 8px; }
.qr-full .code-big { font-size: clamp(2.5rem, 9vw, 7rem); }
.qr-full .url { font-size: clamp(1.1rem, 2.5vw, 2rem); color: #444; }

/* ---------- projector ---------- */
.proj { position: fixed; inset: 0; background: #0f1b26; color: #f4f6f8; display: flex; flex-direction: column; padding: 3vh 5vw; font-size: clamp(16px, 1.8vw, 30px); }
.proj h1 { font-size: 2.4em; margin-bottom: .3em; }
.proj .sub { color: #a7b4c0; font-size: 1.1em; margin-bottom: 1em; }
.proj .big-row { display: flex; gap: 4vw; flex-wrap: wrap; margin: auto 0; }
.proj .big { min-width: 8em; }
.proj .big .v { font-size: 4.2em; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.proj .big .l { font-size: 1em; color: #a7b4c0; margin-top: .3em; }
.proj .bars { margin: auto 0; gap: .5em; }
.proj .bar-row { grid-template-columns: minmax(8em, 16em) 1fr 4em; font-size: 1.1em; }
.proj .bar-track { height: 1.3em; background: #1f2f3f; border-color: #2c3f52; }
.proj .bar-fill { background: #6cb4e8; }
.proj .bar-fill.bad { background: #e57b7b; }
.proj .bar-fill.ok { background: #7bd3a0; }
.proj .hist { height: 45vh; margin: auto 0; }
.proj .hist .col { color: #a7b4c0; font-size: .8em; }
.proj .hist .col i { background: #6cb4e8; }
.proj .hist .col b { color: #fff; font-size: 1em; }
.proj .nav { display: flex; justify-content: space-between; color: #6d7d8c; font-size: .8em; margin-top: auto; }
.proj .qr-full { background: #fff; }
.proj .legend { display: flex; gap: 2em; color: #a7b4c0; font-size: .9em; margin-bottom: .5em; }
.proj .legend i { display: inline-block; width: 1em; height: 1em; border-radius: 3px; vertical-align: middle; margin-right: .4em; }

@media (min-width: 640px) { .page { padding-top: 2rem; } }

/* ---------- language switch ---------- */
.lang-switch { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; margin-bottom: .9rem; }
.lang-pill { min-height: 36px; padding: .3rem .8rem; border: 0; background: var(--surface); color: var(--muted); font-weight: 600; cursor: pointer; }
.lang-pill.on { background: var(--accent); color: var(--accent-ink); }
.lang-pill:focus-visible { outline: 3px solid var(--accent-soft); }
.lang-switch.compact { margin: 0; }
.lang-switch.compact .lang-pill { min-height: 30px; padding: .15rem .55rem; font-size: .8rem; }
