/* sat.kim design system — Korean-portal clean: white cards on cool gray,
   Toss-blue primary, Naver-green success, Pretendard type, fast and dense. */

:root {
  --bg: #f2f4f7;
  --card: #ffffff;
  --ink: #191f28;
  --ink-2: #4e5968;
  --ink-3: #8b95a1;
  --line: #e5e8eb;
  --blue: #3182f6;
  --blue-dark: #1b64da;
  --blue-soft: #e8f3ff;
  --green: #03c75a;
  --green-soft: #e6f9ef;
  --red: #f04452;
  --red-soft: #fdecee;
  --amber: #f59f00;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(25, 31, 40, 0.06), 0 6px 16px rgba(25, 31, 40, 0.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; } /* a scrollbar appearing after an answer must not shift the page */
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Apple SD Gothic Neo", "Noto Sans KR", "Segoe UI", sans-serif;
  font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }

/* ---------- market voices: theme is data, not copied templates ---------- */
body.voice-army { --blue: #b8232f; --blue-dark: #8f1b24; --blue-soft: #fbeaec; }
body.voice-army h1, body.voice-army h2, body.voice-army .logo { font-family: Oswald, "Pretendard Variable", sans-serif; letter-spacing: 0.2px; }
body.voice-ac { --blue: #012169; --blue-dark: #001647; --blue-soft: #e8edf8; }
body.voice-ac h1, body.voice-ac h2 { font-family: "Playfair Display", Georgia, serif; letter-spacing: 0; }
body.voice-ac .logo { font-family: "Playfair Display", Georgia, serif; }

/* ---------- top bar ---------- */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.bar { display: flex; align-items: center; gap: 22px; height: 60px; }
.logo { font-weight: 800; font-size: 21px; color: var(--ink); letter-spacing: -0.5px; display: flex; align-items: center; gap: 8px; }
.logo-mark { height: 26px; width: auto; display: block; }
@media (max-width: 640px) { .logo-mark { height: 22px; } }
.logo:hover { text-decoration: none; }
.logo-dot { color: var(--blue); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--ink-2); padding: 7px 12px; border-radius: 9px; font-weight: 600; }
.nav a:hover { background: var(--bg); text-decoration: none; }
.nav a.on { color: var(--blue); background: var(--blue-soft); }
.bar-right { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.langswitch { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.langswitch a { color: var(--ink-3); font-weight: 600; }
/* phones: two-row header — logo + actions on top, nav on its own scrollable row */
@media (max-width: 640px) {
  .bar { flex-wrap: wrap; height: auto; padding-top: 8px; padding-bottom: 8px; gap: 8px 12px; row-gap: 2px; }
  .logo { font-size: 19px; }
  .bar-right { margin-left: auto; gap: 8px; }
  .bar-right .btn.sm { padding: 6px 10px; font-size: 13px; white-space: nowrap; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; gap: 2px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 6px 10px; font-size: 14px; white-space: nowrap; }
  .nav:empty { display: none; }
}
.langswitch a.on { color: var(--ink); }
.langswitch i { margin: 0 4px; font-style: normal; }
/* Log out stands apart from the language toggle (it sat right next to it
   and got hit by mistake): a gap and a divider between them */
.bar-right .logout { margin-left: 14px; padding-left: 16px; border-left: 1px solid var(--line); display: inline-flex; align-items: center; height: 26px; }
@media (max-width: 640px) { .bar-right .logout { margin-left: 8px; padding-left: 12px; } }
.inline { display: inline; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 12px; padding: 12px 20px; font-size: 15px;
  font-weight: 700; cursor: pointer; transition: transform .06s, background .12s;
  font-family: inherit; text-decoration: none !important;
}
.btn:active { transform: scale(0.985); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.ghost { background: var(--bg); color: var(--ink-2); }
.btn.ghost:hover { background: var(--line); }
.btn.green { background: var(--green); color: #fff; }
.btn.big { padding: 16px 28px; font-size: 17px; border-radius: 14px; }
.btn.sm { padding: 8px 14px; font-size: 13.5px; border-radius: 10px; }
.btn.block { width: 100%; }
/* payment buttons: brand colors are the recognition signal (2x2 grid,
   equal cells; each brand fills its cell, wordmarks centered) */
.paygrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn.pay { height: 46px; display: flex; gap: 0; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; border: none; border-radius: 12px; letter-spacing: -0.2px; }
.btn.kakao { background: #fee500; color: #191600; }
.btn.kakao b { font-weight: 800; }
.btn.kakao .kk { font-weight: 400; }
.kakao-bubble { width: 19px; height: 17px; margin-right: 6px; flex-shrink: 0; }
.btn.naver { background: #03c75a; color: #fff; }
.btn.naver .npay-n { font-weight: 900; font-size: 17px; margin-right: 5px; }
.btn.samsungpay { background: #000; color: #fff; }
.btn.samsungpay b { font-weight: 800; letter-spacing: 0.2px; }
.btn.cardpay { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.google { background: #fff; color: var(--ink); border: 1px solid var(--line); }

/* ---------- cards & layout ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 26px; margin: 18px 0;
}
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 760px) { .grid2, .grid3, .grid4 { grid-template-columns: minmax(0, 1fr); } }

h1 { font-size: 30px; letter-spacing: -0.8px; line-height: 1.25; margin: 26px 0 10px; }
h2 { font-size: 21px; letter-spacing: -0.4px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0 0 8px; }
.muted { color: var(--ink-3); }
.sub { color: var(--ink-2); font-size: 16px; }

/* ---------- landing v2 ---------- */
.hero2 {
  display: grid; grid-template-columns: 1fr 1.1fr; gap: 34px; align-items: center;
  padding: 56px 0 26px;
}
@media (max-width: 880px) { .hero2 { grid-template-columns: 1fr; } }
.hero2-copy h1 { font-size: 40px; margin: 10px 0 12px; }
@media (max-width: 640px) { .hero2-copy h1 { font-size: 30px; } }
.hero2-legend { display: flex; gap: 18px; margin-top: 18px; color: var(--ink-3); font-size: 13px; font-weight: 600; }
.hero2-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.hero2-viz {
  position: relative; background: linear-gradient(160deg, #eaf3ff, #f6f9ff 60%, #eef6ff);
  border-radius: 22px; box-shadow: var(--shadow); padding: 14px; min-height: 340px;
}
#hero-canvas { width: 100%; height: 340px; display: block; }
.chip {
  position: absolute; background: #fff; border-radius: 999px; padding: 8px 14px;
  font-size: 13px; font-weight: 700; box-shadow: var(--shadow); z-index: 2;
}
.chip-a { top: 20px; left: 22px; color: var(--ink-3); animation: float 5s ease-in-out infinite; }
.chip-b { bottom: 22px; right: 22px; color: var(--blue); animation: float 5s ease-in-out 1.2s infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }

.statrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 760px) { .statrow { grid-template-columns: repeat(2, 1fr); } }

.approw-card { padding: 30px 26px; }
.approw { display: flex; justify-content: center; gap: 30px; flex-wrap: wrap; margin-top: 18px; }
.appico { display: flex; flex-direction: column; align-items: center; gap: 9px; color: var(--ink); width: 86px; text-align: center; }
.appico:hover { text-decoration: none; transform: translateY(-3px); transition: transform .12s; }
.appico i {
  width: 60px; height: 60px; border-radius: 18px; display: flex; align-items: center;
  justify-content: center; font-size: 27px; font-style: normal; box-shadow: var(--shadow);
}
.appico b { font-size: 12.5px; }

.cohorts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 16px; }
@media (max-width: 880px) { .cohorts { grid-template-columns: repeat(2, 1fr); } }
.cohort {
  background: linear-gradient(150deg, var(--c1), var(--c2)); color: #fff; border-radius: 16px;
  padding: 20px 18px; display: flex; flex-direction: column; gap: 7px; min-height: 132px;
  box-shadow: var(--shadow); transition: transform .12s;
}
.cohort:hover { transform: translateY(-3px); text-decoration: none; }
.ctag { font-size: 12px; font-weight: 800; opacity: .85; text-transform: uppercase; letter-spacing: .5px; }
.ctitle { font-size: 20px; font-weight: 800; letter-spacing: -0.4px; }
.cbody { font-size: 13px; opacity: .92; line-height: 1.45; }

.newslist { list-style: none; padding: 0; margin: 0; }
.newslist li { padding: 10px 2px; border-bottom: 1px solid var(--line); font-size: 14.5px; color: var(--ink-2); }
.newslist li:last-child { border-bottom: 0; }
.supportgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.supportgrid .btn { justify-content: flex-start; }

/* ---------- hero / landing ---------- */
.hero { text-align: center; padding: 64px 0 30px; }
.hero h1 { font-size: 42px; margin-bottom: 14px; }
@media (max-width: 640px) { .hero h1 { font-size: 30px; } }
.hero .sub { max-width: 620px; margin: 0 auto 26px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.badge {
  display: inline-block; background: var(--blue-soft); color: var(--blue);
  font-weight: 700; font-size: 13px; border-radius: 999px; padding: 6px 14px; margin-bottom: 18px;
}
.feat h3 { display: flex; align-items: center; gap: 8px; }
.feat .ico { font-size: 22px; }

/* ---------- forms ---------- */
label { display: block; font-weight: 700; font-size: 13.5px; margin: 14px 0 6px; color: var(--ink-2); }
input[type=email], input[type=password], input[type=text], input[type=date], input[type=number], select {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px;
  font-size: 15px; font-family: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.formcard { max-width: 420px; margin: 40px auto; }
.error { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 10px 14px; font-weight: 600; margin: 12px 0; }
.flash { background: var(--green-soft); color: #0a7f3f; border-radius: 10px; padding: 10px 14px; font-weight: 600; margin: 12px 0; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 13px; margin: 18px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- stats ---------- */
.stat { text-align: center; padding: 18px 10px; }
.stat .num { font-size: 30px; font-weight: 800; letter-spacing: -1px; }
.stat .lbl { color: var(--ink-3); font-size: 13px; font-weight: 600; }
.stat.blue .num { color: var(--blue); }
.stat.green .num { color: var(--green); }
.stat.red .num { color: var(--red); }

.bar-meter { background: var(--bg); border-radius: 999px; height: 10px; overflow: hidden; }
.bar-meter > i { display: block; height: 100%; background: var(--blue); border-radius: 999px; }

/* ---------- game surfaces ---------- */
.game { max-width: 720px; margin: 24px auto; }
.qcard { position: relative; }
.qword { font-size: 40px; font-weight: 800; text-align: center; letter-spacing: -1px; margin: 18px 0 6px; }
.qmeta { display: flex; justify-content: space-between; color: var(--ink-3); font-size: 13px; font-weight: 600; }
.qstem { font-size: 17px; margin: 14px 0; }
.qpassage {
  background: var(--bg); border-radius: 12px; padding: 16px 18px; font-size: 15.5px;
  margin: 12px 0; white-space: pre-wrap;
}
.qgraph { display: block; margin: 10px auto; max-width: 100%; max-height: 44vh; width: auto; } /* a tall figure scales down instead of pushing the stem and choices off screen */
.choices { display: grid; gap: 10px; margin-top: 16px; }
.choice {
  text-align: left; background: #fff; border: 1.5px solid var(--line); border-radius: 14px;
  padding: 14px 16px; font-size: 15.5px; cursor: pointer; font-family: inherit;
  transition: border-color .1s, background .1s; display: flex; gap: 12px; align-items: baseline;
}
/* hover is a light tint only; the picked choice (a test answer that can
   still change) has a thick blue border, a blue letter and a check */
.choice:hover:not(:disabled) { background: #f6f9fe; }
.choice .cmark { margin-left: auto; align-self: center; font-weight: 800; color: var(--blue); }
/* no bold on select: bold text reflows the choice and moves the page */
.choice.selected { border-color: var(--blue); box-shadow: inset 0 0 0 1.5px var(--blue); }
.choice.selected .abc { color: var(--blue); }
.choice.selected .cmark::after { content: "\2713"; }
.choice .abc { font-weight: 800; color: var(--ink-3); }
.choice.correct { border-color: var(--green); background: var(--green-soft); }
.choice.correct .abc { color: var(--green); }
.choice.wrong { border-color: var(--red); background: var(--red-soft); }
.choice.wrong .abc { color: var(--red); }
.choice.flash { animation: flashCorrect 0.4s ease 3; }
.choice:disabled { cursor: default; }
@keyframes flashCorrect {
  0%, 100% { background: var(--green-soft); }
  50% { background: #b7f0cf; }
}
.shake { animation: shake .35s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(7px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
.explain { background: var(--blue-soft); border-radius: 10px; padding: 12px 16px; margin-top: 14px; font-size: 14.5px; }
.explain .trick { color: var(--ink-2); margin-top: 8px; font-size: 13.5px; }
/* "Show me how": the calculator walkthrough's narration under the calculator */
.wt-panel { background: var(--blue-soft); border-radius: 10px; padding: 10px 14px; margin-top: 10px; font-size: 14px; flex: none; }
.wt-panel .wt-text { line-height: 1.55; }
.wt-panel .wt-bar { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 8px; }
.wt-panel .wt-prog { margin-right: auto; font-size: 12px; }
.wt-start { margin: 0 0 10px; }
.rev-body .wt-start { margin: 12px 0 0; }
.rev-calc { margin-top: 12px; }
.rev-calc .rev-calc-pane { width: 100%; height: 380px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.monster { width: 88px; height: 88px; border-radius: 20px; position: absolute; top: -22px; right: 16px; box-shadow: var(--shadow); background: #fff; object-fit: cover; }
.monsterwrap { position: absolute; top: -22px; right: 16px; display: flex; }
.monsterwrap .monster-img { width: 88px; height: 88px; border-radius: 20px; box-shadow: var(--shadow); background: #fff; object-fit: cover; opacity: 0; transition: opacity .15s; }
.monsterwrap .monster-img.ready { opacity: 1; }
.has-two .monsterwrap .monster-img:first-child { margin-right: -26px; transform: rotate(-4deg); z-index: 1; }
.has-two .monsterwrap .monster-img:last-child { transform: rotate(4deg); }
/* the session line (count, timer, badges, End session) sits in the card's
   top band beside the mascot, which overlaps the card's top edge; its
   height keeps passages, figures and stems clear of the mascot */
.qcard-meta { min-height: 40px; margin: 0 112px 0 0; justify-content: flex-start; align-items: center; gap: 10px; flex-wrap: wrap; }
.has-two .qcard-meta { margin-right: 176px; }
.qbadges { font-size: 16px; filter: drop-shadow(0 1px 2px rgba(0,0,0,.25)); }
.monster-reveal img + img { margin-left: -18px; transform: rotate(5deg); }
@media (max-width: 640px) {
  .monster { width: 72px; height: 72px; top: -18px; right: 12px; } .monsterwrap { top: -18px; right: 12px; }
  .monsterwrap .monster-img { width: 72px; height: 72px; } .qcard { margin-top: 26px; }
  .qcard-meta { min-height: 32px; margin-right: 92px; gap: 8px; } .has-two .qcard-meta { margin-right: 138px; }
}
.monster-reveal { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.monster-reveal img { width: 96px; height: 96px; border-radius: 22px; box-shadow: var(--shadow); background: #fff; flex-shrink: 0; }
.monster-reveal b { display: block; font-size: 15px; }
.monster-reveal span { color: var(--ink-2); font-size: 13px; }

.timerbar { display: flex; align-items: center; gap: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.timerbar .clock { font-size: 22px; }
.timerbar.low .clock { color: var(--red); }

/* distraction modal */
.modal-back {
  position: fixed; inset: 0; background: rgba(25,31,40,.45); display: flex;
  align-items: center; justify-content: center; z-index: 50;
}
.modal { background: #fff; border-radius: 18px; padding: 26px; max-width: 380px; text-align: center; }
.modal .btnrow { display: flex; gap: 10px; margin-top: 18px; }
.modal .btnrow .btn { flex: 1; }

/* ---------- tables ---------- */
table.list, table.twoway { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th, table.list td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.list th { color: var(--ink-3); font-size: 12.5px; text-transform: uppercase; letter-spacing: .4px; }
table.twoway { max-width: 460px; margin: 10px 0; }
table.twoway th, table.twoway td { border: 1px solid var(--line); padding: 7px 12px; text-align: center; }
table.twoway th { background: var(--bg); }
table.twoway td.tot { font-weight: 700; background: var(--bg); }
/* Any other table inside question content (a function's value table, an
   x | f(x) row pair): ruled cells like the two-way tables, never the
   browser's bare unpadded grid. A wide table scrolls sideways inside the
   question on a narrow screen instead of widening the page. */
:where(.qstem, .qpassage, .choice, .explain, .rev-body) table:not(.list):not(.twoway) {
  border-collapse: collapse; margin: 10px 0; font-size: 15px; white-space: normal;
}
.qstem, .qpassage, .explain { overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; } /* overflow-x alone made y auto too: a superscript or fraction edge showed a tiny inner scrollbar */
:where(.qstem, .qpassage, .choice, .explain, .rev-body) table:not(.list):not(.twoway) :is(th, td) {
  border: 1px solid var(--line); padding: 7px 14px; text-align: center; min-width: 2.2em; font-variant-numeric: tabular-nums;
}
:where(.qstem, .qpassage, .choice, .explain, .rev-body) table:not(.list):not(.twoway) th { background: var(--bg); font-weight: 700; }

.pill { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; }
.pill.green { background: var(--green-soft); color: #0a7f3f; }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.amber { background: #fff4d6; color: #9a6700; }
.pill.red { background: var(--red-soft); color: var(--red); }

/* upcoming reviews */
.duebars { display: grid; gap: 4px; }
.duerow { display: grid; grid-template-columns: 44px 1fr 36px; align-items: center; gap: 8px; font-size: 13px; }
.duerow .dd { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.duerow.today .dd { color: var(--blue); font-weight: 700; }
.duerow .db { height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.duerow .db i { display: block; height: 100%; background: #8fc2ff; border-radius: 5px; }
.duerow.today .db i { background: var(--blue); }
.duerow .dn { text-align: right; font-variant-numeric: tabular-nums; }
.duerow .db { display: flex; }
.duerow .db i.extra { background: #cfe3ff; border-radius: 0 5px 5px 0; }
.duerow.today .db i.extra { background: #b9d6ff; }
/* today's short reviews and words, named under its bar (not in its count) */
.duenote { margin: -2px 0 2px 52px; font-size: 12px; color: var(--ink-3); }
/* reviews past the exam date */
.duesep { margin: 6px 0 2px; padding-top: 4px; border-top: 1px dashed var(--line); font-size: 12px; font-weight: 700; color: var(--ink-3); }
.duerow.after .dd, .duerow.after .dn { color: var(--ink-3); }
.duerow.after .db i { background: #d5dbe3; }
.exam-note { font-size: 13.5px; margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--bg); color: var(--ink-2); }
.stat.dday .num { color: var(--green); }
.stat.dday .lbl b { color: var(--ink); font-size: 14px; }

/* 7-day accuracy strip (parent view) */
.daystrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.daystrip .dcol { text-align: center; font-size: 12px; min-width: 0; }
.daystrip .dpct { font-weight: 700; font-variant-numeric: tabular-nums; }
.daystrip .dbar { height: 48px; background: var(--bg); border-radius: 6px; display: flex; align-items: flex-end; overflow: hidden; margin: 3px 0; }
.daystrip .dbar i { display: block; width: 100%; background: #8fc2ff; }
.daystrip .today .dbar i { background: var(--blue); }
.daystrip .dlbl { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.daystrip .today .dlbl { color: var(--blue); font-weight: 700; }
.duelist { margin: 6px 0 0; padding-left: 18px; font-size: 14px; }

/* score trend line */
.scorechart { width: 100%; max-width: 420px; height: auto; display: block; margin: 4px 0 10px; }
.scorechart polyline { fill: none; stroke: var(--blue); stroke-width: 2.5; stroke-linejoin: round; }
.scorechart circle { fill: var(--blue); }
.scorechart text { font-size: 11px; font-weight: 700; fill: var(--ink-2, #4e5968); text-anchor: middle; }
.sec-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; }

/* session start */
.gate-choices { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 18px; max-width: 420px; }
.gate-choices .btn { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.gate-choices .btn small { font-weight: 400; font-size: 12px; opacity: .85; }

/* wrong-answer notebook */
.wrongnote .choice { cursor: default; }

/* code display for linking */
.bigcode { font-size: 38px; font-weight: 800; letter-spacing: 8px; text-align: center; margin: 16px 0; font-variant-numeric: tabular-nums; }
#qr { display: flex; justify-content: center; margin: 12px 0; }
#qr img, #qr canvas { border-radius: 12px; }

/* admin monster hover-zoom: 28px thumb → 400px popup on mouse-over */
/* Hover-zoom without flicker: the wrapper keeps a FIXED 28px footprint (so
   the hover target never collapses when the image pops out) and the popped
   image ignores the pointer (so it can't steal the hover it depends on). */
.monwrap { position: relative; display: inline-block; width: 28px; height: 28px; vertical-align: middle; }
.monwrap img { height: 28px; width: 28px; border-radius: 7px; display: block; cursor: zoom-in; }
.monwrap:hover img {
  position: absolute; height: 400px; width: 400px; top: -186px; left: 36px;
  z-index: 99; background: #fff; border-radius: 24px; box-shadow: 0 12px 40px rgba(25,31,40,.25);
  pointer-events: none;
}

/* study: question left, Desmos panel right on desktop (math only) */
/* minmax(0,…): a type-in row's minimum width used to take the whole grid and
   squeeze Desmos to a sliver. The page widens while the panel is shown. */
.game:has(#study-split.with-calc) { max-width: 1080px; }
/* the calculator runs to the bottom of the window, so the footer starts below the fold */
@media (min-width: 981px) { .game:has(#study-split.with-calc) { min-height: calc(100vh - 110px); } }
#study-split.with-calc { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 18px; align-items: start; }
#q-spr-input { min-width: 0; }
@media (max-width: 980px) { #study-split.with-calc { grid-template-columns: 1fr; } }

/* admin try-it: question left, live calculator right on desktop */
.try-split { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 18px; align-items: start; }
@media (max-width: 980px) { .try-split { grid-template-columns: 1fr; } }

/* footer */
.foot { border-top: 1px solid var(--line); margin-top: 60px; padding: 26px 0; background: #fff; }
.footrow { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-3); font-size: 13.5px; flex-wrap: wrap; }

/* math helpers */
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 2px; font-size: .9em; line-height: 1.15; } /* tight, so an inline fraction doesn't open a gap between lines */
.frac .num { border-bottom: 1.5px solid currentColor; padding: 0 4px; }
.frac .den { padding: 0 4px; }
.sqrt-in { border-top: 1.5px solid currentColor; }

/* progress dots for mock */
.qnav { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.qnav .dot { width: 26px; height: 26px; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--ink-3); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.qnav .dot.done { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.qnav .dot.cur { background: var(--blue); color: #fff; border-color: transparent; }

/* calculator side panel */
.mock-flex { display: flex; gap: 16px; align-items: flex-start; }
.mock-main { flex: 1; min-width: 0; }
/* With the calculator open the page widens and the question keeps a
   readable width: expressions must not wrap mid-term beside it. */
main.wrap:has(#m-calc:not([style*="none"])) { max-width: 1440px; }
@media (min-width: 981px) { .mock-flex:has(#m-calc:not([style*="none"])) .mock-main { min-width: 480px; } }
.frac, .sqrt { white-space: nowrap; }
/* Desktop: beside the question, as tall as the window (above the bottom
   bar), its width draggable from the bottom-left corner or doubled with
   Expand. Narrow screens: under the question, 60% of the screen tall,
   draggable taller, or full screen. */
.calc-panel { flex: none; width: clamp(320px, 32vw, 520px); position: sticky; top: 72px; height: max(60vh, calc(100vh - 160px));
  display: flex; flex-direction: column; gap: 8px; resize: horizontal; overflow: hidden; direction: rtl; }
.calc-panel > * { direction: ltr; }
.calc-panel.calc-wide { width: min(50vw, 760px); }
/* desktop: whatever its size, the calculator leaves the question 480px */
@media (min-width: 981px) { .mock-flex .calc-panel { max-width: calc(100% - 496px); } }
.calc-panel .calc-pane { flex: 1; min-height: 0; width: 100%; border: 1px solid var(--line); border-radius: 14px; background: #fff; overflow: hidden; }
.calc-head { display: flex; align-items: center; gap: 6px; }
.calc-head b { font-size: 14px; margin-right: auto; }
.calc-tools { display: flex; gap: 6px; }
.calc-btn { padding: 5px 10px; font-size: 12.5px; border-radius: 9px; }
.calc-panel .calc-btn { background: #fff; border: 1px solid var(--line); }
@media (max-width: 980px) {
  .mock-flex { flex-direction: column; align-items: stretch; }
  .calc-panel, .calc-panel.calc-wide { width: 100%; position: static; height: calc(60vh + 44px); min-height: 360px; resize: vertical; direction: ltr; }
  .calc-expand { display: none; }
}
/* full screen (any width): the calculator covers the page until closed */
.calc-full, .calc-panel.calc-full { position: fixed !important; inset: 0 !important; width: auto !important; height: 100% !important; max-height: none !important;
  z-index: 45; margin: 0 !important; border-radius: 0; background: #fff; padding: 10px !important; resize: none; display: flex !important; flex-direction: column; }
.calc-full .calc-pane, .calc-full #calc-pane { flex: 1 !important; height: auto !important; min-height: 0; }
body.calc-full-open { overflow: hidden; }

/* mock: module complete / break screens */
.mock-screen { max-width: 560px; margin: 40px auto; text-align: center; padding: 36px 24px; }
.mock-screen h2 { margin: 6px 0 8px; }
.mock-screen-icon { width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 6px; background: var(--green-soft); color: var(--green); font-size: 28px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.mock-screen-next { font-weight: 600; margin: 16px 0 20px; }
.mock-break-clock { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 18px 0 6px; font-variant-numeric: tabular-nums; }
.mock-break-clock .clock { font-size: 44px; font-weight: 800; letter-spacing: -1px; color: var(--blue); }

/* mock results: scores and per-question review */
.stat .band { font-size: 14px; font-weight: 500; }
.stat .range { font-size: 12.5px; margin-top: 2px; }
.stat .raw { font-size: 14px; font-weight: 700; margin-top: 4px; color: var(--ink-2); }
.route-pill { display: inline-block; margin-top: 8px; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; background: var(--bg); color: var(--ink-2); }
h3.rev-mod { margin: 22px 0 8px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 16px; }
h3.rev-mod .route-pill { margin-top: 0; }
.rev-head, details.rev > summary { display: grid; grid-template-columns: 30px minmax(0, 1fr) 92px 92px 64px; gap: 8px; align-items: center; }
.rev-head { color: var(--ink-3); font-size: 12px; font-weight: 700; padding: 0 10px 6px; border-bottom: 1px solid var(--line); }
details.rev { border-bottom: 1px solid var(--line); }
details.rev > summary { list-style: none; cursor: pointer; padding: 9px 10px; font-size: 14px; }
details.rev > summary::-webkit-details-marker { display: none; }
details.rev > summary:hover { background: var(--bg); }
details.rev[open] > summary { background: var(--bg); }
details.rev.bad > summary .rev-num { color: var(--red); }
.rev-num { font-weight: 800; color: var(--ink-3); }
.rev-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rev-ans { font-weight: 700; overflow-wrap: anywhere; }
.rev-body { padding: 4px 10px 18px; }
.rev-body .choice { cursor: default; }
.weak-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 4px 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
@media (max-width: 640px) { .weak-row { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .rev-head, details.rev > summary { grid-template-columns: 22px minmax(0, 1fr) 44px 44px 50px; gap: 6px; font-size: 13px; }
  .rev-name { white-space: normal; }
  details.rev > summary .pill { padding: 3px 7px; }
  .rev-head { font-size: 11px; }
}

/* why the picked choice is wrong */
.trick.why { background: var(--red-soft); color: var(--ink); padding: 8px 12px; border-radius: 10px; margin: 0 0 10px; font-size: 14px; }

/* Parent view: linking cards fold away once a child is linked */
details.link-more { margin-top: 8px; }
details.link-more > summary { list-style: none; display: inline-block; cursor: pointer; margin-bottom: 12px; }
details.link-more > summary::-webkit-details-marker { display: none; }

/* ---------- mock: test-day navigation ---------- */
.mock-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 18px; flex-wrap: wrap; }
.mock-head-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding-bottom: 10px; margin-bottom: 4px; }
.qnum { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 8px; background: var(--ink); color: #fff; font-weight: 800; font-size: 14px; }
.markbtn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1.5px solid var(--line); border-radius: 10px; padding: 6px 11px; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.markbtn .flag { width: 14px; height: 14px; }
.markbtn .flag path { fill: none; stroke: currentColor; stroke-width: 2; }
.markbtn.on { border-color: #c2410c; color: #c2410c; background: #fff4ec; }
.markbtn.on .flag path { fill: currentColor; }
/* the bar under the question: navigator in the middle, Back / Next right */
.mock-bottom { position: sticky; bottom: 0; z-index: 20; margin-top: 16px; background: #fff; border: 1px solid var(--line); border-bottom: 0;
  box-shadow: 0 -4px 14px rgba(25,31,40,.06); display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-radius: 14px 14px 0 0; }
.mock-bottom .navbtns { display: flex; gap: 8px; }
.mock-bottom .navmid { position: relative; }
.qnav-toggle { background: var(--ink); color: #fff; border: 0; border-radius: 10px; padding: 9px 14px; font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.qnav-toggle .caret { font-size: 11px; transition: transform .15s; }
.qnav-toggle[aria-expanded="true"] .caret { transform: rotate(180deg); }
.qnav-pop { position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%); width: min(520px, calc(100vw - 24px)); background: #fff; border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 14px 40px rgba(25,31,40,.22); padding: 16px; z-index: 30; }
.qnav-pop h4 { margin: 0 0 8px; font-size: 15px; }
.qlegend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--ink-2); margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.qlegend span { display: inline-flex; align-items: center; gap: 5px; }
.qlegend i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1.5px dashed var(--ink-3); position: relative; }
.qlegend i.l-cur::before { content: ""; position: absolute; left: 1px; right: 1px; top: -6px; height: 3px; border-radius: 2px; background: var(--ink); }
.qlegend i.l-done { background: var(--blue); border: 1.5px solid var(--blue); }
.qlegend i.l-mark { border: 1.5px solid #c2410c; background: #fff4ec; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 9px; }
.qgrid button { position: relative; height: 40px; border-radius: 9px; border: 1.5px dashed var(--ink-3); background: #fff; color: var(--blue); font: inherit; font-weight: 800; font-size: 14px; cursor: pointer; }
.qgrid button.done { background: var(--blue); border: 1.5px solid var(--blue); color: #fff; }
.qgrid button.mark::after { content: ""; position: absolute; top: -5px; right: -5px; width: 12px; height: 12px; border-radius: 50%; background: #c2410c; border: 2px solid #fff; }
.qgrid button.cur::before { content: ""; position: absolute; left: 8px; right: 8px; top: -7px; height: 3px; border-radius: 2px; background: var(--ink); }
.qgrid button:hover { filter: brightness(.96); }
.qnav-pop .goreview { margin-top: 14px; width: 100%; }
/* check your work */
.mock-check h2 { margin: 0 0 6px; }
.mock-check .qgrid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); margin: 16px 0 4px; }
.mock-check .qgrid button { height: 46px; }
.check-sum { font-weight: 700; }
/* reference sheet */
.refback { align-items: flex-start; overflow-y: auto; padding: 24px 12px; }
.refmodal { max-width: 760px; width: 100%; text-align: left; }
.refmodal .refhead { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.refmodal .refhead h3 { margin: 0; }
.refsheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px 14px; }
.refsheet figure { margin: 0; border: 1px solid var(--line); border-radius: 12px; padding: 8px 8px 10px; display: flex; flex-direction: column; align-items: center; }
.refsheet figure.wide { grid-column: span 2; }
.refsheet svg { width: 100%; max-width: 150px; height: auto; color: var(--ink); }
.refsheet figure.wide svg { max-width: 300px; }
.refsheet svg :is(circle, rect, line, polygon, polyline, path, ellipse) { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.refsheet svg .dash { stroke-dasharray: 4 3; stroke-width: 1.2; }
.refsheet svg .thin { stroke-width: 1; }
.refsheet svg .dotf { fill: currentColor; stroke: none; }
.refsheet svg text { fill: currentColor; stroke: none; font-size: 12px; font-style: italic; font-family: "Times New Roman", serif; }
.refsheet svg text.ang { font-style: normal; font-size: 9.5px; font-family: inherit; }
.refsheet figcaption { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 13.5px; text-align: center; }
.refsheet figcaption b { font-size: 12.5px; color: var(--ink-2); font-weight: 700; }
.refsheet figcaption span { font-family: "Times New Roman", serif; font-style: italic; font-size: 15px; }
.refnotes { margin: 14px 0 0; padding-left: 18px; font-size: 14px; color: var(--ink-2); }
@media (max-width: 640px) {
  .refsheet { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mock-bottom { padding: 8px 10px; }
  .mock-bottom .navbtns .btn { padding: 9px 12px; }
  .qnav-toggle { padding: 8px 10px; font-size: 13px; }
  .mock-head { padding: 10px 12px; }
}

/* study: after an answer the result line sits above the explanation, in
   the card, and the bar holds only Next: a small button that floats at the
   bottom right of the question card while a long explanation is read
   (sticky), and rests below the tip at the end of it. A bar fixed across
   the window used to hide the last lines of the tip on most questions,
   however far the page scrolled. */
.q-nextbar { display: flex; justify-content: flex-end; align-items: center; margin-top: 14px; }
.q-nextbar.on { position: sticky; bottom: 12px; z-index: 6; pointer-events: none; margin-top: 16px; }
.q-nextbar.on .btn { pointer-events: auto; box-shadow: 0 6px 18px rgba(25,31,40,.22); }
@supports (bottom: env(safe-area-inset-bottom)) { .q-nextbar.on { bottom: calc(12px + env(safe-area-inset-bottom)); } }
/* above the confetti layer, so the result is never under the burst */
.q-result { display: block; position: relative; z-index: 101; margin: 16px 0 0; font-weight: 700; font-size: 15px; }
.q-result:empty { display: none; }
.q-result.ok { color: var(--green); }
.q-result.bad { color: var(--red); }
.end-session { margin-left: auto; padding: 5px 10px; font-size: 12.5px; border-radius: 9px; white-space: nowrap; flex: none; }
/* the next-review note under the result */
.q-result .q-due { display: block; font-weight: 500; font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }
/* between questions: the old one is gone at once; a spinner only if the
   next one takes a moment (none for a prefetched question) */
.qcard.loading { min-height: 240px; }
.qcard.loading::after { content: ""; position: absolute; left: 50%; top: 110px; width: 26px; height: 26px; margin-left: -13px;
  border: 3px solid var(--line); border-top-color: var(--blue); border-radius: 50%; opacity: 0;
  animation: qspin .8s linear infinite, qfadein .2s .15s forwards; }
@keyframes qspin { to { transform: rotate(360deg); } }
@keyframes qfadein { to { opacity: 1; } }
/* session end: where you stand, and what next */
.session-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px auto 0; max-width: 560px; }
.session-sum > div { background: var(--bg); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.session-sum span { color: var(--ink-3); font-size: 12.5px; font-weight: 600; }
.session-sum b { font-size: 15px; }
.session-do { margin: 14px 0 0; font-weight: 600; }
.session-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
@media (max-width: 640px) {
  .session-sum { grid-template-columns: 1fr; text-align: left; }
  .session-sum > div { flex-direction: row; justify-content: space-between; align-items: baseline; gap: 10px; }
}
/* dashboard: a test account's study date (its clock runs behind today) */
.account-date { display: inline-block; margin: -6px 0 14px; padding: 4px 10px; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); font-size: 13px; }

/* Korean wraps at word boundaries (spaces), never inside a word: the
   default broke 입니/다 and 2/단계 across lines. */
html[lang="ko"] body { word-break: keep-all; overflow-wrap: anywhere; }
.monster-reveal .en-name { display: block; font-size: 12px; color: var(--ink-3); font-weight: 500; margin-top: 1px; }
/* math is glued with no-break spaces; a very long run may still break
   anywhere rather than overflow a phone screen */
.qstem, .explain, .choice .ctext { overflow-wrap: anywhere; }
/* table cells keep words whole (city names broke as Cald/er); a wide table
   scrolls inside its question instead */
.qstem table td, .qstem table th, .explain table td, .explain table th, table.twoway td, table.twoway th, table.data td, table.data th { overflow-wrap: normal; word-break: keep-all; }
/* a long explanation folds after a few lines; the trap note above it stays */
.explain-body.folded { max-height: 9.5em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.explain-more { display: block; margin: 6px 0 2px; padding: 4px 10px; font-size: 13px; border-radius: 8px; background: #fff; border: 1px solid var(--line); cursor: pointer; }
#gate-sub { white-space: pre-line; } /* counts, session length and notes each on their own line */

/* parent view: the plain-language summary at the top of a child's card */
.psummary { margin: 4px 0 14px; padding: 12px 14px; border-radius: 12px; background: var(--blue-soft); font-size: 15px; line-height: 1.55; }
.psummary p { margin: 0; }
.psummary p.plan { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(0,0,0,.08); }

/* the current score estimate above the score table; marked when old */
.estimate { margin: 0 0 10px; padding: 10px 12px; border-radius: 10px; background: var(--bg); font-size: 14px; line-height: 1.5; }
.estimate .est-lbl { font-weight: 700; }
.estimate .est-num { font-size: 20px; }
.estimate .est-from { font-size: 13px; color: var(--ink-3); }
.estimate.stale { background: #fff6e0; border: 1px solid #f0d48a; }
.estimate .est-stale { margin-top: 4px; font-size: 13.5px; font-weight: 600; }
/* the score table fits its card: cells wrap instead of scrolling sideways,
   and on a phone each test is a two-line block with labelled scores */
table.scoretable td { vertical-align: top; }
table.scoretable .sec-sub { white-space: normal; word-break: keep-all; }
table.scoretable td.sc-date { white-space: nowrap; }
.sec-sub.route { cursor: help; text-decoration: underline dotted; text-underline-offset: 2px; }
.estimate .est-range { white-space: nowrap; }
@media (max-width: 640px) {
  table.list th, table.list td { padding: 8px 6px; }
  table.list th { letter-spacing: 0; }
  table.scoretable, table.scoretable tbody { display: block; }
  table.scoretable tr.head { display: none; }
  table.scoretable tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.scoretable td { border: 0; padding: 3px 2px; min-width: 0; }
  table.scoretable td.sc-kind { grid-column: span 2; }
  table.scoretable td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .3px; }
}
.focus-more > summary { cursor: pointer; font-size: 13.5px; margin: 8px 0 0; color: var(--blue-dark); }
/* scores: the second module's route as one marker, explained once under the table */
.route-mark { font-size: 11px; color: var(--ink-2); cursor: help; vertical-align: 1px; }
/* parent focus table: under 60% apart from the other missed types */
table.focus tr.grp td { padding-top: 12px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); border-bottom: 0; }
/* parent: today's due types, collapsed and grouped by area */
.due-more summary { cursor: pointer; font-size: 14px; color: var(--blue); font-weight: 600; margin-top: 6px; }
.due-more h4 { font-size: 13px; margin: 10px 0 2px; color: var(--ink-2); }
.acct-line { font-size: 13.5px; margin: -4px 0 8px; }
.link-more-sub { font-size: 13.5px; margin: 0 0 8px; }
/* the line symbol: an italic l in a serif, everywhere (some fonts drew the
   script-l character like a rupee sign) */
i.ell { font-family: "Times New Roman", Times, "Noto Serif", Georgia, serif; font-style: italic; font-weight: inherit; padding: 0 .04em; }
.link-another { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- "Show me how" teaching player (static/js/teach.js) ---------- */
.tp { background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; margin-top: 12px; outline: none; }
.tp:focus-visible { box-shadow: 0 0 0 3px var(--blue-soft); }
.tp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.tp-mon img { width: 40px; height: 40px; object-fit: contain; display: block; }
.tp-name { font-weight: 700; flex: 1; min-width: 0; line-height: 1.3; }
.tp-name small { display: block; font-weight: 400; font-size: 12px; }
.tp-x { border: 0; background: transparent; font-size: 18px; width: 36px; height: 36px; border-radius: 10px; cursor: pointer; color: var(--ink-2); }
.tp-x:hover { background: var(--line); }
.tp-grid { display: block; }
.tp-with-calc .tp-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
@media (min-width: 900px) { .tp-with-calc .tp-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
/* phone: the calculator sits above the bubbles and stays in view while
   they scroll under it; desktop: beside them */
.tp-calcbox { position: sticky; top: 60px; z-index: 4; background: #fff; padding: 4px 0 6px; order: -1; margin-top: 10px; }
.tp-with-calc .tp-grid { display: flex; flex-direction: column; }
.tp-calc { width: 100%; height: 260px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; color: var(--ink-3); font-size: 13px; }
@media (min-width: 900px) { .tp-with-calc .tp-grid { display: grid; } .tp-calcbox { top: 76px; align-self: start; order: 0; } .tp-calc { height: 420px; } }
.tp-decode { background: #fbfbfc; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 14px; }
.tp-passage { max-height: 160px; overflow: auto; font-size: 13.5px; color: var(--ink-2); border-bottom: 1px dashed var(--line); padding-bottom: 8px; margin-bottom: 8px; }
.tp-stem svg { display: none; }
.tp-hl { border-radius: 4px; padding: 0 2px; cursor: pointer; }
.tp-trigger { background: #e8f3ff; box-shadow: inset 0 -2px #3182f6; }
.tp-trap { background: #fdecee; box-shadow: inset 0 -2px #f04452; }
.tp-given { background: #e6f9ef; box-shadow: inset 0 -2px #03c75a; }
.tp-ask { background: #fff4d6; box-shadow: inset 0 -2px #f59f00; }
.tp-note { font-size: 13px; color: var(--ink-2); margin-top: 6px; min-height: 0; }
.tp-note:empty { display: none; }
.tp-role { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; margin-right: 4px; }
.tp-cue { margin-top: 8px; font-size: 13.5px; font-weight: 600; }
.tp-cue:empty { display: none; }
.tp-cue-l { color: var(--blue); }
.tp-chat { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; cursor: pointer; }
.tp-bubble { align-self: flex-start; max-width: 92%; background: #f1f3f6; border-radius: 18px 18px 18px 6px; padding: 9px 13px; font-size: 14.5px; line-height: 1.55; animation: tp-in .18s ease-out; }
@keyframes tp-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tp-bubble { animation: none; } }
.tp-bubble.tp-try { background: #fff7e6; }
.tp-bubble.tp-trap { background: #fdecee; }
.tp-bubble.tp-answer { background: #e6f9ef; }
.tp-bubble.tp-explain { background: #eef4ff; }
.tp-bubble.tp-empty { background: #fff7e6; cursor: default; }
.tp-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.tp-tag { font-size: 13px; margin-top: 4px; }
.tp-trap-tag { color: #c92a3a; }
.tp-ans-tag { color: #02903f; font-size: 15px; }
.tp-typed { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 12px; color: var(--ink-3); }
.tp-typed code { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 12px; color: var(--ink); overflow-wrap: anywhere; }
.tp-write { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13.5px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; margin: 2px 0 4px; overflow-wrap: anywhere; }
.tp-try { display: flex; gap: 8px; margin-top: 8px; }
.tp-run { margin-top: 10px; background: #eef4ff; border-radius: 12px; padding: 8px 12px; font-size: 13.5px; }
.tp-run ol { margin: 4px 0 0; padding-left: 20px; }
.tp-bar { display: flex; justify-content: flex-end; margin-top: 10px; min-height: 34px; }
/* definitions: a tappable blue term opens a block inline (blue inside
   peach); a term inside a definition opens a second level in purple */
.tp-term { border: 0; background: none; padding: 0; font: inherit; color: var(--blue); font-weight: 600; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.tp-term.tp-l2 { color: #8b5cf6; }
.tp-term[aria-expanded="true"] { text-decoration-style: solid; }
.tp-def { display: block; margin: 6px 0; padding: 8px 10px; border-radius: 10px; font-size: 13.5px; cursor: auto; }
.tp-def.tp-d1 { background: #fff1e6; border-left: 3px solid var(--blue); }
.tp-def.tp-d2 { background: #f3efff; border-left: 3px solid #8b5cf6; }
.tp-def b { color: var(--ink); }
.tp-term-flat { font-weight: 600; }
.tp-open { margin: 0 0 10px; }
.tp-name small.tp-trig { color: var(--ink-2); font-size: 12px; margin-top: 2px; }
