/* Student page only. Shared pieces live in app.css. */

/* ---------- type: a serif for headings and big numbers, the sans for everything else; 1rem is the body size ---------- */
html { font-size: 106.25%; }
body { font-size: 1rem; }
h1 { font-size: 1.6rem; margin: 6px 0 10px; }
h2 { font-size: 1.24rem; margin: 22px 0 8px; }
h3 { font-size: 1rem; font-weight: 650; margin: 16px 0 6px; }
.small { font-size: 0.882rem; }
.stem, .rule { font-size: 1.176rem; }
.book { font-size: 0.882rem; }
.chip { font-size: 0.765rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.ico { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- surfaces ---------- */
main { padding: 12px 16px calc(32px + env(safe-area-inset-bottom)); }
.card { padding: 20px; }
.card + .card { margin-top: 16px; }
.card > h1:first-child, .card > h2:first-child { margin-top: 0; }
.btn { min-height: 48px; }
.btn.primary { min-height: 52px; font-weight: 650; }
.btn.small { min-height: 44px; font-size: 0.882rem; padding: 0 12px; }
.btn.primary.small { min-height: 44px; }
.btn.block + .btn.block, .card .btn.block { margin-top: 12px; }
.card > .btn.block:first-child { margin-top: 0; }
.choice { padding: 14px 16px; min-height: 54px; align-items: baseline; } /* the letter sits on the first line of a long choice */
.letter { font-weight: 650; min-width: 1.4em; color: var(--dim); font-variant-numeric: tabular-nums; }
fieldset { border: 0; padding: 0; margin: 16px 0 0; min-width: 0; }
legend { font-weight: 600; font-size: 0.94rem; padding: 0; margin-bottom: 8px; }
.hint { font-size: 0.882rem; color: var(--dim); margin: 6px 0 0; }

.topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 48px; padding: 2px 0 8px; }
.topbar .btn { flex: none; white-space: nowrap; }

/* ---------- sign in: one calm card in the middle of the paper ---------- */
.topbar.auth-top { justify-content: center; padding-top: max(4vh, 16px); padding-bottom: 18px; }
.topbar.auth-top .brand { font-size: 1.3rem; }
.topbar.auth-top .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 1.1rem; }
.card.auth-card { max-width: 440px; margin: 0 auto; padding: 28px 24px 24px; box-shadow: var(--shadow-lift); }
.card.auth-card h1 { font-size: 1.85rem; margin-bottom: 4px; }
.card.auth-card .seg { margin: 18px 0 4px; }

/* ---------- the bar pinned to the bottom: one main action, on frosted paper ---------- */
.actionbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--card); border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); box-shadow: 0 -8px 24px rgb(23 32 56 / 0.06); }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .actionbar, .tabbar { background: var(--glass); -webkit-backdrop-filter: saturate(1.4) blur(16px); backdrop-filter: saturate(1.4) blur(16px); }
}
.actionbar-in { max-width: 648px; margin: 0 auto; display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; }
.actionbar .btn.primary, .actionbar .btn.main { flex: 1 1 150px; }
.bar-note { flex: 0 0 auto; font-size: 0.882rem; font-weight: 600; color: var(--dim); font-variant-numeric: tabular-nums; }
.bar-note.wide { flex: 1 1 100%; }
.bar-note:empty { display: none; }
.bar-space { height: 108px; }

/* ---------- tabs: at the bottom on a phone, under the top bar on a laptop ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabbar-in { max-width: 680px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.tabbar a { min-height: 58px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 0.765rem; font-weight: 600; color: var(--dim); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.tabbar a:hover { color: var(--ink); }
.tabbar a[aria-current="page"] { color: var(--accent); }
.tab-space { height: 76px; }
@media (min-width: 740px) {
  .tabbar { position: static; background: transparent; border: 0; padding: 0; margin: 0 0 18px; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .tabbar-in { display: flex; gap: 4px; padding: 4px; background: var(--sunk); border: 1px solid var(--line); border-radius: 999px; width: max-content; margin: 0; }
  .tabbar a { flex-direction: row; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; font-size: 0.882rem; }
  .tabbar a .ico { width: 18px; height: 18px; }
  .tabbar a[aria-current="page"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
  .tabbar a[aria-current="page"] .ico { color: var(--accent); }
  .tab-space { display: none; }
}

/* ---------- pick one of a few: minutes, days, sections, tabs ---------- */
.seg { display: grid; gap: 8px; }
.seg.n2 { grid-template-columns: repeat(2, 1fr); } .seg.n3 { grid-template-columns: repeat(3, 1fr); } .seg.n7 { grid-template-columns: repeat(7, 1fr); gap: 5px; }
.tog { min-width: 0; padding: 0 4px; }
.tog[aria-pressed="true"], .tog[aria-selected="true"], .tog[aria-pressed="true"]:hover {
  background: var(--accent-soft); border-color: var(--accent); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); }
.field-row { display: flex; gap: 8px; align-items: stretch; }
.field-row input { flex: 1 1 auto; min-width: 0; }
.planbox { margin-top: 8px; padding: 14px 16px; border-radius: var(--r-md); background: var(--accent-soft); }
.planbox p { margin: 4px 0; }

/* ---------- home ---------- */
.hello { margin: 4px 0 0; color: var(--dim); font-weight: 600; }
.count { font-family: var(--serif); font-size: 2.15rem; font-weight: 560; line-height: 1.08; letter-spacing: -0.022em; margin: 2px 0 8px; font-variant-numeric: lining-nums; }
.pace { margin: 0 0 14px; color: var(--dim); }
.week { margin: 0 0 18px; }
.week-dots { display: flex; justify-content: space-between; margin-top: 8px; }
.week-dot { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-size: 0.765rem; font-weight: 650; color: var(--dim); background: var(--card); box-shadow: inset 0 0 0 1px var(--line); }
.week-dot.off { background: transparent; box-shadow: inset 0 0 0 1px var(--line); opacity: 0.75; }
.week-dot.done { background: var(--good); color: var(--card); box-shadow: none; }
.week-dot.today { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.streak { font-weight: 700; }
.steps { list-style: none; margin: 12px 0 16px; padding: 0; }
.steps li { display: flex; align-items: baseline; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps .what { font-weight: 650; flex: 0 0 5.4em; }
.steps .how { color: var(--dim); min-width: 0; }
.steps-list { margin: 8px 0 14px; padding-left: 1.2em; }
.steps-list li { margin: 4px 0; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.tile { background: var(--sunk); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 6px 12px; text-align: center; }
.tile b { display: block; font-family: var(--serif); font-size: 1.8rem; font-weight: 560; line-height: 1.05; font-variant-numeric: lining-nums tabular-nums; }
.tile span { display: block; margin-top: 4px; font-size: 0.765rem; font-weight: 600; color: var(--dim); }
.tile.win b { color: var(--good); }
.stackbar { display: flex; gap: 2px; height: 10px; border-radius: 999px; overflow: hidden; background: var(--line); }
.stackbar span { display: block; min-width: 4px; }
.stackbar .lv0 { background: transparent; }
.sec-row { margin: 14px 0; }
.sec-row .spread { margin-bottom: 6px; font-weight: 600; }
.sec-row .spread .dim { font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 12px 0 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 0.882rem; }
.linkbtn { background: none; border: 0; padding: 0; min-height: 44px; font: inherit; font-weight: 600; color: var(--accent); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.linkbtn:hover { color: var(--accent-hover); }
.more-box { margin-top: 6px; padding: 14px; border-radius: var(--r-md); background: var(--sunk); border: 1px solid var(--line); }
.more-box p { margin: 0 0 8px; }

/* ---------- a session ---------- */
.progress { z-index: 4; margin: 0 -16px 12px; padding: 8px 16px 12px; border-bottom: 1px solid transparent; }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .progress, .timerbar { background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: saturate(1.3) blur(14px); backdrop-filter: saturate(1.3) blur(14px); }
}
.progress .bar { margin-top: 6px; height: 6px; }
.progress .spread > span { font-weight: 600; color: var(--dim); }
.teststrip { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.teststrip p { margin: 0; min-width: 0; }
.teststrip .btn { flex: none; white-space: nowrap; }
.big { font-family: var(--serif); font-size: 2rem; font-weight: 560; line-height: 1.1; margin: 4px 0; letter-spacing: -0.02em; font-variant-numeric: lining-nums; }
.bubbles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 16px 0 12px; }
.bubbles.five { grid-template-columns: repeat(5, 1fr); }
.bubbles .bubble { width: 100%; height: 58px; border-radius: var(--r-md); font-size: 1.3rem; font-weight: 650; }
.notsure { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px 0 12px; border-radius: var(--r-md);
  border: 1px solid var(--edge); background: var(--card); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; }
.notsure:hover { border-color: var(--ink); }
.notsure .box { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--edge); display: grid; place-items: center; color: transparent; }
.notsure .box .ico { width: 16px; height: 16px; stroke-width: 3; }
.notsure[aria-pressed="true"] { background: var(--warn-soft); border-color: var(--warn); }
.notsure[aria-pressed="true"] .box { background: var(--warn); border-color: var(--warn); color: var(--card); }
.notsure:focus-visible, .linkbtn:focus-visible, .rule-row:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* The result: the verdict and what it did to the level, together at the top. */
.result { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: var(--r-md); margin: 14px 0; border: 1px solid transparent; }
.result.good { background: var(--good-soft); border-color: color-mix(in srgb, var(--good) 22%, transparent); }
.result.miss { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 22%, transparent); }
.result.neutral { background: var(--sunk); border-color: var(--line); }
.result-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--card); }
.result-ico .ico { stroke-width: 2.6; width: 20px; height: 20px; }
.result.good .result-ico { background: var(--good); } .result.miss .result-ico { background: var(--bad); } .result.neutral .result-ico { background: var(--dim); }
.result-title { display: block; font-family: var(--serif); font-size: 1.3rem; font-weight: 580; letter-spacing: -0.01em; line-height: 1.25; }
.result.good .result-title { color: var(--good); } .result.miss .result-title { color: var(--bad); }
.result p { margin: 4px 0 0; }
.level { margin-top: 10px; }
.level-text { font-weight: 650; }
.meter { display: flex; gap: 4px; margin: 6px 0 2px; }
.meter .seg { flex: 1; height: 8px; border-radius: 4px; background: rgb(127 132 150 / 0.22); }
.meter.lvl-0 .seg.on { background: var(--lv0); } .meter.lvl-1 .seg.on { background: var(--lv1); } .meter.lvl-2 .seg.on { background: var(--lv2); }
.meter.lvl-3 .seg.on { background: var(--lv3); } .meter.lvl-4 .seg.on { background: var(--lv4); }
.meter .seg.lv0 { background: var(--lv0); } .meter .seg.lv1 { background: var(--lv1); } .meter .seg.lv2 { background: var(--lv2); }
.meter .seg.lv3 { background: var(--lv3); } .meter .seg.lv4 { background: var(--lv4); }
.meter-names { display: flex; gap: 4px; margin: 4px 0 10px; }
.meter-names span { flex: 1; text-align: center; font-size: 0.765rem; color: var(--dim); }

/* One answer and why. The row and its reason are one box once it is open. */
.tapline { margin: 16px 0 0; font-weight: 600; }
.gate-item { margin-top: 10px; }
.answer-btn { display: grid; grid-template-columns: 24px minmax(0, 1fr) 16px; gap: 12px; align-items: center; margin: 0; white-space: normal; }
.answer-btn .tick { width: 24px; height: 24px; display: grid; place-items: center; color: var(--dim); }
.answer-btn .tick .ico { stroke-width: 2.6; }
.answer-btn.right .tick { color: var(--good); } .answer-btn.wrong .tick { color: var(--bad); }
.answer-btn .ans { display: block; font-weight: 600; overflow-wrap: anywhere; }
.yours { display: block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); margin-bottom: 2px; }
.answer-btn.wrong .yours { color: var(--bad); } .answer-btn.right .yours { color: var(--good); }
.chev { width: 9px; height: 9px; border-right: 2px solid var(--dim); border-bottom: 2px solid var(--dim); transform: translateY(-2px) rotate(45deg); justify-self: center; }
.answer-btn[aria-expanded="true"] { border-bottom-left-radius: 0; border-bottom-right-radius: 0; cursor: default; }
.answer-btn[aria-expanded="true"]:not(.right):not(.wrong):hover { background: var(--card); border-color: var(--edge); }
.answer-btn[aria-expanded="true"] .chev { transform: translateY(2px) rotate(-135deg); }
.gate-line { margin: 0; padding: 12px 16px 14px 52px; line-height: 1.55; background: var(--sunk); border: 1px solid var(--edge); border-top: 0;
  border-radius: 0 0 var(--r-md) var(--r-md); }
.gate-item.right .gate-line { border-color: var(--good); } .gate-item.wrong .gate-line { border-color: var(--bad); }
.tested { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.tested h3 { margin-top: 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.tested p { margin: 4px 0; }
.reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.reasons .btn { justify-content: flex-start; text-align: left; padding: 8px 12px; min-height: 52px; line-height: 1.25; font-weight: 550; }
.reasons .btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 650; }
.techtip { margin: 14px 0 0; padding: 14px 16px; border-radius: var(--r-md); background: var(--accent-soft); border-left: 3px solid var(--accent); border-top-left-radius: 4px; border-bottom-left-radius: 4px; }
.techtip h3 { margin-top: 0; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }
.techtip p { margin: 4px 0; }
.whybox { margin: 14px 0 0; padding: 16px; border-radius: var(--r-md); background: var(--sunk); border: 1px solid var(--line); }
.whybox h3 { margin-top: 0; font-family: var(--serif); font-size: 1.12rem; font-weight: 580; }
@media (max-width: 339px) { .reasons { grid-template-columns: 1fr; } }

details.rule-more { margin-top: 8px; }
details > summary { cursor: pointer; }
details.rule-more > summary { list-style: none; min-height: 44px; display: flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 600; }
details.rule-more > summary:hover { color: var(--accent-hover); }
details.rule-more > summary::-webkit-details-marker, details.group > summary::-webkit-details-marker, details.result-row > summary::-webkit-details-marker { display: none; }
details.rule-more > summary::after, details.group > summary::after, details.result-row > summary::after { content: ""; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); flex: none; }
details[open].rule-more > summary::after, details[open].group > summary::after, details[open].result-row > summary::after { transform: translateY(2px) rotate(-135deg); }

/* ---------- my map ---------- */
details.group { background: var(--card); border-radius: var(--r-md); margin-top: 10px; box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden; }
details.group > summary { list-style: none; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 16px; color: var(--dim); }
details.group > summary:hover { background: var(--sunk); }
.group-main { flex: 1 1 auto; min-width: 0; color: var(--ink); }
.group-name { font-weight: 650; display: block; }
.group-meta { font-size: 0.765rem; color: var(--dim); display: block; margin-top: 4px; }
.group .stackbar { height: 6px; margin-top: 6px; }
.rule-row { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 10px; align-items: center; width: 100%; min-height: 52px; padding: 8px 16px;
  border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.rule-row:hover { background: var(--sunk); }
.rule-row .lvl { font-size: 0.765rem; font-weight: 600; color: var(--dim); white-space: nowrap; }
.backdrop { position: fixed; inset: 0; z-index: 8; background: rgb(23 32 56 / 0.45); border: 0; padding: 0; width: 100%; height: 100%; cursor: default; }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .backdrop { -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); } }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 9; max-height: 86vh; overflow: auto; background: var(--card); border-radius: 24px 24px 0 0;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgb(23 32 56 / 0.2); border: 1px solid var(--line); border-bottom: 0; }
.sheet h2 { margin-top: 0; }
@media (min-width: 740px) { .sheet { left: 50%; right: auto; width: 620px; transform: translateX(-50%); bottom: 24px; border-radius: 24px; border-bottom: 1px solid var(--line); } }

/* ---------- timed section ---------- */
.timerbar { position: sticky; top: 0; z-index: 4; background: var(--bg); margin: 0 -16px 12px; padding: 10px 16px 12px; display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.timer { font-size: 1.7rem; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin: 0; line-height: 1; }
.timer.over { color: var(--bad); }
.sheet-row { display: grid; grid-template-columns: 2.1em repeat(4, 44px) 44px; gap: 6px; align-items: center; justify-content: start; padding: 8px 0; }
.sheet-row.five { grid-template-columns: 2.1em repeat(5, 40px) 40px; }
.sheet-row.five .bubble { width: 40px; height: 40px; }
.qnum { width: auto; color: var(--dim); }
.bubble.q { border-style: dashed; color: var(--dim); margin-left: 6px; }
.bubble.q[aria-pressed="true"] { background: var(--warn-soft); border: 2px solid var(--warn); color: var(--ink); }
.confirm { margin-top: 12px; padding: 14px; border-radius: var(--r-md); background: var(--sunk); border: 1px solid var(--line); }
.confirm p { margin: 0 0 10px; }
.confirm .row .btn { flex: 1 1 130px; }
details.result-row { border-top: 1px solid var(--line); }
details.result-row > summary { list-style: none; min-height: 52px; display: flex; align-items: center; gap: 10px; color: var(--dim); }
details.result-row > summary .grow { color: var(--ink); font-weight: 600; }
details.result-row[open] { padding-bottom: 14px; }
.static-row { display: flex; gap: 12px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r-md); border: 1px solid var(--line); margin-top: 8px; }
.static-row.right { border-color: var(--good); background: var(--good-soft); } .static-row.wrong { border-color: var(--bad); background: var(--bad-soft); }
.static-row .tick { width: 24px; height: 24px; flex: none; color: var(--dim); }
.static-row.right .tick { color: var(--good); } .static-row.wrong .tick { color: var(--bad); }

/* ---------- waiting for the page ---------- */
.sk { height: 14px; border-radius: 7px; background: var(--line); margin: 14px 0; }
.sk.w40 { width: 40%; } .sk.w60 { width: 60%; } .sk.w90 { width: 90%; } .sk.tall { height: 52px; border-radius: var(--r-md); margin-top: 20px; }

@media (prefers-reduced-motion: no-preference) {
  .meter .seg.new { animation: grow 0.45s ease-out; transform-origin: left center; }
  .gate-line:not([hidden]) { animation: drop 0.16s ease-out; }
  .chev { transition: transform 0.15s; }
  .sheet { animation: rise 0.2s ease-out; }
  .sk { animation: pulse 1.2s ease-in-out infinite; }
  .rule-row, details.group > summary, .notsure { transition: background-color 0.15s ease, border-color 0.15s ease; }
  @keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
  @keyframes drop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
  @keyframes rise { from { opacity: 0.4; translate: 0 24px; } to { opacity: 1; translate: 0 0; } }
  @keyframes pulse { 50% { opacity: 0.5; } }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

.tryit { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
@media (min-width: 740px) { .week-dots { justify-content: flex-start; gap: 12px; } }
/* Messages sit above the pinned bar and never block a tap. */
.toast { bottom: calc(118px + env(safe-area-inset-bottom)); pointer-events: none; text-align: center; }
@media print { .actionbar, .tabbar, .bar-space, .tab-space { display: none !important; } .progress, .timerbar { position: static; } }
