/* ===================== PaperPilot styles ===================== */
:root {
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --line: #d2d2d7;
  --bg: #ffffff;
  --bg-2: #f5f5f7;
  --blue: #0071e3;
  --blue-2: #0077ed;
  --green: #1fae5b;
  --red: #e5484d;
  --amber: #f5a524;
  --radius: 22px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --grad: linear-gradient(92deg, #4f8bff 0%, #9b6bff 45%, #ff6fb5 100%);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: #000;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.01em;
}
body.app-mode { background: var(--bg-2); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ===================== NAV ===================== */
.nav {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  transition: background 0.4s var(--ease), border-color 0.4s;
}
body.app-mode .nav, body.nav-light .nav { background: rgba(255, 255, 255, 0.75); border-bottom-color: rgba(0, 0, 0, 0.08); }
.nav-inner { max-width: 1080px; margin: 0 auto; padding: 0 24px; height: 52px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; color: #f5f5f7; transition: color 0.4s; }
body.app-mode .brand, body.nav-light .brand { color: var(--ink); }
.brand-mark svg { width: 26px; height: 26px; display: block; }
.brand-mark rect { fill: var(--blue); }
.brand-mark path { stroke: #fff; stroke-width: 6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.nav-links { display: flex; align-items: center; gap: 24px; font-size: 14px; color: rgba(245, 245, 247, 0.8); }
body.app-mode .nav-links, body.nav-light .nav-links { color: var(--ink-2); }
.nav-links a:hover { color: #fff; }
body.app-mode .nav-links a:hover, body.nav-light .nav-links a:hover { color: var(--ink); }
.nav-cta { background: var(--blue); color: #fff !important; padding: 6px 14px; border-radius: 980px; transition: background 0.2s; }
.nav-cta:hover { background: var(--blue-2); }

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 980px; padding: 11px 22px; font-size: 16px; font-weight: 500;
  transition: transform 0.2s var(--ease), background 0.2s, box-shadow 0.3s;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-2); box-shadow: 0 8px 30px rgba(0, 113, 227, 0.35); }
.btn-primary:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
.btn-lg { padding: 15px 30px; font-size: 18px; }
.btn-ghost { background: rgba(0, 0, 0, 0.05); color: var(--ink); }
.btn-ghost:hover { background: rgba(0, 0, 0, 0.09); }
.link-arrow { color: #2997ff; font-size: 17px; background: none; border: 0; padding: 0; }
.link-arrow::after { content: " ›"; transition: margin 0.2s; }
.link-arrow:hover::after { margin-left: 4px; }
body.app-mode .link-arrow { color: var(--blue); }

/* ===================== TEXT ===================== */
.eyebrow { font-size: 15px; font-weight: 600; letter-spacing: 0.02em; color: #a1a1a6; margin: 0 0 14px; text-transform: none; }
.eyebrow.dark { color: var(--ink-2); }
.h2 { font-size: clamp(40px, 6.2vw, 72px); line-height: 1.05; letter-spacing: -0.035em; font-weight: 700; margin: 0 0 22px; }
.h2.white, .white { color: #f5f5f7; }
.lead { font-size: clamp(18px, 2vw, 22px); line-height: 1.45; color: var(--ink-2); max-width: 560px; letter-spacing: -0.01em; }
.lead.white { color: #a1a1a6; }
.grad {
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
  background-size: 200% 100%; animation: gradShift 8s ease-in-out infinite alternate;
}
@keyframes gradShift { to { background-position: 100% 0; } }

/* ===================== LOAD + REVEAL ANIMATIONS ===================== */
.load-in { opacity: 0; transform: translateY(24px); filter: blur(10px); animation: loadIn 1.1s var(--ease) forwards; animation-delay: var(--d, 0ms); }
@keyframes loadIn { to { opacity: 1; transform: none; filter: blur(0); } }
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 1s var(--ease), transform 1s var(--ease); transition-delay: var(--d, 0ms); }
.reveal.in { opacity: 1; transform: none; }

/* ===================== HERO ===================== */
.hero {
  position: relative; overflow: hidden; background: #000; color: #f5f5f7;
  text-align: center; padding: 150px 24px 0; min-height: 100vh;
}
.hero-title { font-size: clamp(52px, 10vw, 112px); line-height: 1; letter-spacing: -0.045em; font-weight: 700; margin: 0 0 26px; }
.hero-title .line { display: block; }
.hero-sub { font-size: clamp(19px, 2.2vw, 24px); line-height: 1.4; color: #a1a1a6; max-width: 640px; margin: 0 auto 34px; }
.hero-cta { display: flex; gap: 28px; justify-content: center; align-items: center; flex-wrap: wrap; }

.hero-glow { position: absolute; inset: 0; pointer-events: none; filter: blur(90px); opacity: 0.55; }
.hero-glow span { position: absolute; border-radius: 50%; animation: float 18s ease-in-out infinite alternate; }
.hero-glow span:nth-child(1) { width: 520px; height: 520px; background: #2a5cff; left: -120px; top: 40px; }
.hero-glow span:nth-child(2) { width: 460px; height: 460px; background: #8b3dff; right: -120px; top: 180px; animation-duration: 22s; }
.hero-glow span:nth-child(3) { width: 380px; height: 380px; background: #ff3d8b; left: 35%; top: 520px; animation-duration: 26s; opacity: 0.6; }
.hero-glow.small { opacity: 0.35; }
@keyframes float { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(60px, -40px) scale(1.12); } 100% { transform: translate(-40px, 50px) scale(0.95); } }

.device-wrap { perspective: 1600px; margin: 70px auto 0; max-width: 860px; padding-bottom: 80px; }
.device {
  transform-origin: 50% 0%;
  transform: rotateX(var(--rx, 28deg)) scale(var(--sc, 0.9)) translateY(var(--ty, 0px));
  transition: transform 0.1s linear;
  border-radius: 28px; padding: 14px;
  background: linear-gradient(180deg, #2b2b30, #121214);
  box-shadow: 0 60px 140px rgba(80, 100, 255, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  will-change: transform;
}
.mock { background: #fbfbfd; color: var(--ink); border-radius: 18px; padding: 26px 26px 14px; text-align: left; }
.mock-head { display: flex; justify-content: space-between; align-items: center; padding-bottom: 16px; border-bottom: 1px solid #ececf0; margin-bottom: 8px; }
.mock-title { font-weight: 700; font-size: 22px; letter-spacing: -0.02em; }
.mock-meta { color: var(--ink-2); font-size: 14px; margin-top: 3px; }
.mock-badge { background: #e8f8ee; color: var(--green); font-weight: 600; font-size: 13px; padding: 5px 12px; border-radius: 980px; }
.mock-q { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; padding: 16px 0; border-bottom: 1px solid #f0f0f3; align-items: start; }
.mock-q:last-child { border-bottom: 0; }
.mq-n { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 14px; font-weight: 600; }
.mq-text { font-size: 16px; line-height: 1.4; }
.mq-m { font-size: 13px; color: var(--ink-3); border: 1px solid var(--line); border-radius: 8px; padding: 2px 8px; }
.mq-input { margin-top: 10px; border: 1.5px solid var(--green); background: #f3fbf6; border-radius: 12px; padding: 9px 14px; display: flex; justify-content: space-between; max-width: 320px; font-weight: 500; }
.mq-input .tick { color: var(--green); font-style: normal; font-weight: 700; }
.mq-input.empty { border-color: var(--blue); background: #fff; height: 40px; }
.caret { width: 2px; height: 20px; background: var(--blue); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.mq-hint { margin-top: 10px; background: #f3efff; color: #5b3fd6; border-radius: 12px; padding: 9px 14px; font-size: 14px; animation: hintPulse 3s ease-in-out infinite; }
@keyframes hintPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(123, 92, 255, 0); } 50% { box-shadow: 0 0 0 6px rgba(123, 92, 255, 0.12); } }

/* ===================== SECTIONS ===================== */
.section { padding: 140px 0; }
.section.light { background: var(--bg); color: var(--ink); }
.section.dark-soft { background: #0b0b0d; color: #f5f5f7; overflow: hidden; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 60px; }
.step { background: var(--bg-2); border-radius: var(--radius); padding: 30px 28px 28px; overflow: hidden; transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease), opacity 1s var(--ease); }
.step:hover { transform: translateY(-6px); box-shadow: 0 30px 60px rgba(0, 0, 0, 0.08); }
.step-n { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 600; font-size: 15px; }
.step h3 { font-size: 24px; letter-spacing: -0.02em; margin: 18px 0 8px; }
.step p { color: var(--ink-2); line-height: 1.5; margin: 0 0 24px; font-size: 16px; }
.step-visual { height: 120px; border-radius: 16px; background: #fff; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 8px; padding: 14px; }
.pills-demo span, .chips-demo span { font-size: 13px; padding: 7px 12px; border-radius: 980px; background: var(--bg-2); color: var(--ink-2); transition: all 0.4s var(--ease); }
.pills-demo span.on { background: var(--ink); color: #fff; }
.chips-demo span.on { background: var(--blue); color: #fff; transform: scale(1.05); }
.mini-paper { flex-direction: column; align-items: stretch; gap: 10px; padding: 18px 24px; }
.mini-paper i { display: block; height: 8px; border-radius: 4px; background: #e9e9ee; transform-origin: left; transform: scaleX(0); transition: transform 0.8s var(--ease); }
.mini-paper i.short { width: 60%; }
.step.in .mini-paper i { transform: scaleX(1); }
.step.in .mini-paper i:nth-child(2) { transition-delay: 0.15s; }
.step.in .mini-paper i:nth-child(3) { transition-delay: 0.3s; }
.step.in .mini-paper i:nth-child(4) { transition-delay: 0.45s; }
.step.in .mini-paper i:nth-child(5) { transition-delay: 0.6s; }

/* sticky story */
.story { background: #000; height: 320vh; position: relative; }
.story-sticky { position: sticky; top: 0; height: 100vh; display: flex; align-items: center; overflow: hidden; }
.story-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; width: 100%; }
.story-sub { color: #a1a1a6; font-size: 20px; line-height: 1.45; max-width: 440px; }
.story-card { background: #161618; border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 26px; padding: 28px; color: #f5f5f7; min-height: 430px; box-shadow: 0 40px 120px rgba(120, 90, 255, 0.18); }
.sc-tag { font-size: 12px; font-weight: 600; color: #b9a8ff; background: rgba(155, 107, 255, 0.15); padding: 4px 10px; border-radius: 980px; }
.sc-q p { font-size: 19px; line-height: 1.45; margin: 14px 0 20px; }
.sc-hint, .sc-answer { opacity: 0; transform: translateY(18px) scale(0.98); transition: all 0.6s var(--ease); }
.sc-hint { background: rgba(255, 255, 255, 0.06); border-radius: 14px; padding: 13px 16px; margin-bottom: 10px; font-size: 16px; line-height: 1.4; color: #e5e5ea; }
.sc-hint b { color: #b9a8ff; margin-right: 8px; font-weight: 600; }
.sc-answer { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; border: 1.5px solid var(--green); background: rgba(31, 174, 91, 0.12); border-radius: 14px; padding: 13px 16px; font-weight: 600; font-size: 18px; }
.sc-answer i { color: #4ade80; font-style: normal; font-size: 15px; }
.sc-hint.on, .sc-answer.on { opacity: 1; transform: none; }
.story-progress { position: absolute; left: 50%; bottom: 40px; width: 160px; height: 3px; margin-left: -80px; background: rgba(255, 255, 255, 0.12); border-radius: 3px; overflow: hidden; }
.story-progress span { display: block; height: 100%; width: 0; background: var(--grad); }

/* marking */
.mark-grid, .print-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 70px; align-items: center; }
.score-card { background: var(--bg-2); border-radius: 30px; padding: 40px; position: relative; display: grid; grid-template-columns: 170px 1fr; gap: 30px; align-items: center; }
.ring { width: 170px; height: 170px; transform: rotate(-90deg); }
.ring.big { width: 180px; height: 180px; }
.ring-bg { fill: none; stroke: #e3e3e8; stroke-width: 10; }
.ring-fg { fill: none; stroke: var(--blue); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 1.8s var(--ease), stroke 0.4s; }
.ring-box { position: relative; width: 170px; height: 170px; }
.ring-label { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 42px; font-weight: 700; letter-spacing: -0.03em; }
.nw { white-space: nowrap; }
.sheet u { display: block; height: 46px; border: 1px dashed #e2e2e8; border-radius: 6px; text-decoration: none; }
.bars { display: grid; gap: 14px; }
.bar span { font-size: 14px; color: var(--ink-2); display: block; margin-bottom: 5px; }
.bar div { height: 8px; background: #e3e3e8; border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--blue); border-radius: 4px; transition: width 1.4s var(--ease); }
.bar.weak i { background: var(--amber); }
.score-card.in .bar i { width: var(--w); }
.score-card.in .bar:nth-child(2) i { transition-delay: 0.1s; }
.score-card.in .bar:nth-child(3) i { transition-delay: 0.2s; }
.score-card.in .bar:nth-child(4) i { transition-delay: 0.3s; }

/* print sheets */
.sheets { position: relative; height: 420px; }
.sheet { position: absolute; left: 50%; top: 10px; width: 270px; height: 370px; margin-left: -135px; background: #fff; border-radius: 10px; padding: 28px 24px; color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); transition: transform 1.2s var(--ease); display: flex; flex-direction: column; gap: 14px; }
.sheet b { font-size: 17px; }
.sheet small { color: var(--ink-3); font-size: 12px; }
.sheet i { display: block; height: 7px; background: #ececf0; border-radius: 4px; }
.sheet i:nth-of-type(2n) { width: 70%; }
.sheets.in .s1 { transform: rotate(-2deg) translateX(-30px); }
.sheets.in .s2 { transform: rotate(6deg) translateX(60px) translateY(10px); }
.sheets.in .s3 { transform: rotate(14deg) translateX(140px) translateY(28px); }
.s3 b { color: var(--blue); }

/* stats */
.stats-sec { padding: 110px 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; text-align: center; }
.stat b { display: block; font-size: clamp(54px, 7vw, 84px); letter-spacing: -0.04em; font-weight: 700; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1.05; }
.stat span { color: var(--ink-2); font-size: 16px; }

/* final */
.final { position: relative; overflow: hidden; background: #000; color: #f5f5f7; text-align: center; padding: 170px 24px; }
.final .h2 { position: relative; }
.final .btn { position: relative; margin-top: 14px; }
.soon { color: #6e6e73; margin-top: 26px; position: relative; }
.footer { background: #000; color: #6e6e73; font-size: 13px; border-top: 1px solid #1d1d1f; padding: 24px 0 40px; }
.footer .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* ===================== APP VIEWS ===================== */
.app-view { min-height: 100vh; background: var(--bg-2); padding: 96px 0 120px; }
.app-wrap { max-width: 860px; margin: 0 auto; padding: 0 20px; animation: viewIn 0.7s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
.app-title { font-size: clamp(34px, 5vw, 48px); letter-spacing: -0.035em; margin: 0 0 6px; }
.app-sub { color: var(--ink-2); font-size: 19px; margin: 0 0 30px; }
.panel { background: #fff; border-radius: var(--radius); padding: 26px; margin-bottom: 16px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03); }
.panel-h { font-size: 15px; font-weight: 600; color: var(--ink); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.panel-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.panel-tools { display: flex; gap: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 22px; }
.mini { background: var(--bg-2); border: 0; border-radius: 980px; padding: 5px 12px; font-size: 13px; color: var(--ink-2); }
.mini:hover { color: var(--ink); background: #ebebf0; }

.seg { display: inline-flex; background: var(--bg-2); border-radius: 14px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg.wrapit { display: flex; }
.seg button { border: 0; background: transparent; padding: 9px 16px; border-radius: 11px; font-size: 15px; color: var(--ink-2); transition: all 0.25s var(--ease); }
.seg button:hover:not(:disabled) { color: var(--ink); }
.seg button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08); }
.seg button:disabled { opacity: 0.45; cursor: not-allowed; }
.seg small { font-size: 11px; background: #e3e3e8; padding: 1px 6px; border-radius: 6px; margin-left: 4px; }

.tgroup { margin-top: 18px; }
.tgroup-h { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 10px; }
.tgroup-h button { text-transform: none; letter-spacing: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 980px; padding: 8px 14px; font-size: 14.5px; color: var(--ink); transition: all 0.2s var(--ease); }
.chip:hover { border-color: #a1a1a6; }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.chip:active { transform: scale(0.95); }

textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 14px; padding: 14px; font: inherit; font-size: 15px; resize: vertical; outline: none; transition: border 0.2s, box-shadow 0.2s; }
textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12); }
textarea:disabled { background: var(--bg-2); }
.hint-text { color: var(--ink-3); font-size: 14px; margin: 8px 0 0; line-height: 1.45; }
.ai-pill { font-size: 11px; font-weight: 700; color: #fff; background: var(--grad); padding: 2px 8px; border-radius: 980px; letter-spacing: 0.04em; }
.ai-pill.off { background: #c7c7cc; }
.build-actions { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; margin-top: 26px; }
.error { color: var(--red); font-size: 15px; min-height: 22px; margin: 12px 0 0; }
.existing { margin-top: 20px; background: #fff; border-radius: var(--radius); padding: 24px; animation: viewIn 0.5s var(--ease); }
.existing h3 { margin: 0; }
.ex-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid #f0f0f3; font-size: 15px; }
.ex-row:last-child { border-bottom: 0; }
.ex-row a { color: var(--blue); white-space: nowrap; }

/* loading */
.loading { position: fixed; inset: 0; z-index: 60; background: rgba(245, 245, 247, 0.8); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); display: grid; place-items: center; animation: viewIn 0.3s; }
.loading-card { background: #fff; border-radius: 26px; padding: 36px 40px; width: min(420px, 90vw); text-align: center; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.12); }
.loading-card p { font-size: 18px; font-weight: 600; margin: 18px 0 22px; }
.loader { display: flex; justify-content: center; gap: 8px; }
.loader span { width: 12px; height: 12px; border-radius: 50%; background: var(--blue); animation: bounce 1.1s var(--ease) infinite; }
.loader span:nth-child(2) { animation-delay: 0.12s; background: #9b6bff; }
.loader span:nth-child(3) { animation-delay: 0.24s; background: #ff6fb5; }
@keyframes bounce { 0%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-14px); } }
.skeleton { display: grid; gap: 10px; }
.skeleton i { display: block; height: 10px; border-radius: 5px; background: linear-gradient(90deg, #eee 0%, #f8f8f8 50%, #eee 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.skeleton i.short { width: 60%; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* paper */
.paper-head { margin-bottom: 18px; }
.paper-head .app-sub { margin-bottom: 18px; }
.paper-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-2); background: #fff; border-radius: 980px; padding: 10px 16px; margin-right: 4px; }
.source-note { font-size: 13.5px; color: var(--ink-3); margin: 0 0 18px; }
.questions, .review { list-style: none; padding: 0; margin: 0; }
.qcard { background: #fff; border-radius: var(--radius); padding: 24px 24px 22px; margin-bottom: 14px; display: grid; grid-template-columns: 38px 1fr; gap: 14px; opacity: 0; transform: translateY(20px); animation: viewIn 0.6s var(--ease) forwards; transition: box-shadow 0.3s; }
.qcard:focus-within { box-shadow: 0 0 0 2px rgba(0, 113, 227, 0.25), 0 16px 40px rgba(0, 0, 0, 0.06); }
.qnum { width: 32px; height: 32px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 15px; }
.qtop { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 8px; }
.qtag { font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--bg-2); padding: 4px 10px; border-radius: 980px; }
.qmarks { font-size: 13px; color: var(--ink-3); }
.qtext { font-size: 18px; line-height: 1.5; margin: 0 0 16px; }
.qtext sup { font-size: 0.7em; }
.qrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ans { flex: 1; min-width: 200px; display: flex; align-items: center; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; transition: border 0.2s, box-shadow 0.2s; overflow: hidden; }
.ans:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12); }
.ans input { flex: 1; border: 0; outline: none; padding: 12px 14px; font: inherit; font-size: 17px; min-width: 0; background: transparent; }
.ans .unit { padding: 0 14px; color: var(--ink-3); font-size: 15px; }
.ans .unit.pre { padding: 0 0 0 14px; }
.hint-btn { border: 0; background: #f3efff; color: #5b3fd6; border-radius: 12px; padding: 12px 14px; font-size: 14.5px; font-weight: 500; transition: background 0.2s; }
.hint-btn:hover { background: #ebe4ff; }
.hint-btn:disabled { opacity: 0.45; cursor: default; }
.hints { margin-top: 10px; display: grid; gap: 8px; }
.hint { background: #f7f5ff; border-radius: 12px; padding: 11px 14px; font-size: 15px; line-height: 1.45; color: #3d2a99; animation: hintIn 0.5s var(--ease); }
.hint b { margin-right: 6px; }
@keyframes hintIn { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: none; } }
.kbd-tip { font-size: 12.5px; color: var(--ink-3); margin-top: 8px; }
.submit-bar { position: sticky; bottom: 16px; margin-top: 24px; background: rgba(255, 255, 255, 0.85); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); border-radius: 980px; padding: 10px 10px 10px 24px; display: flex; justify-content: space-between; align-items: center; box-shadow: 0 16px 50px rgba(0, 0, 0, 0.12); }
.submit-bar span { color: var(--ink-2); font-size: 15px; }

/* results */
.result-hero { display: grid; grid-template-columns: 200px 1fr; gap: 34px; align-items: center; margin-bottom: 26px; }
.result-ring { position: relative; width: 180px; height: 180px; }
.result-ring .ring-label { font-size: 40px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.topic-bars { display: grid; gap: 14px; }
.tbar { display: grid; grid-template-columns: 200px 1fr 60px; gap: 14px; align-items: center; font-size: 15px; }
.tbar .track { height: 10px; background: var(--bg-2); border-radius: 5px; overflow: hidden; }
.tbar .fill { height: 100%; width: 0; border-radius: 5px; transition: width 1.2s var(--ease); }
.tbar .pct { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rv { border-top: 1px solid #f0f0f3; padding: 18px 0; display: grid; grid-template-columns: 34px 1fr; gap: 14px; }
.rv:first-child { border-top: 0; }
.rv-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; }
.rv-icon.ok { background: var(--green); }
.rv-icon.no { background: var(--red); }
.rv-q { margin: 0 0 8px; line-height: 1.5; }
.rv-line { font-size: 15px; color: var(--ink-2); margin: 3px 0; }
.rv-line b { color: var(--ink); }
.check-link { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; font-size: 13px; color: var(--ink-2); text-decoration: none; border-bottom: 1px dotted currentColor; vertical-align: middle; }
.check-link:hover { color: var(--ink); }
.check-link svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.rv-note { font-size: 14px; color: #b25c00; margin: 4px 0; }
.rv details { margin-top: 8px; }
.rv summary { cursor: pointer; color: var(--blue); font-size: 15px; }
.rv ol { margin: 8px 0 0; padding-left: 20px; color: var(--ink); line-height: 1.6; }
.rv .override { margin-top: 8px; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 860px) {
  .steps { grid-template-columns: 1fr; }
  .story-grid, .mark-grid, .print-grid { grid-template-columns: 1fr; gap: 40px; }
  .story-card { min-height: 0; }
  .story-copy .h2 { font-size: 40px; }
  .story-sub { font-size: 17px; }
  .story { height: 280vh; }
  .score-card { grid-template-columns: 1fr; justify-items: center; }
  .bars { width: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); row-gap: 40px; }
  .sheets { height: 380px; }
  .row2 { grid-template-columns: 1fr; }
  .result-hero { grid-template-columns: 1fr; justify-items: start; }
  .tbar { grid-template-columns: 120px 1fr 48px; }
  .nav-links .nl-how { display: none; }
  .section { padding: 100px 0; }
}
@media (max-width: 560px) {
  .story-grid { gap: 24px; }
  .story-copy .h2 { font-size: 34px; margin-bottom: 12px; }
  .story-sub { display: none; }
  .sc-q p { font-size: 16px; }
  .sc-hint { font-size: 14px; padding: 10px 12px; }
  .mock { padding: 18px 16px 8px; }
  .mq-text { font-size: 14px; }
  .qcard { grid-template-columns: 1fr; }
  .submit-bar { border-radius: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .load-in, .reveal, .qcard { opacity: 1; transform: none; filter: none; }
  .sc-hint, .sc-answer { opacity: 1; transform: none; }
}

/* ===================== V2: TOPICS, DOWNLOADS, CORRECTIONS ===================== */
.topic-summary { color: var(--ink-2); font-size: 15px; line-height: 1.5; margin: 14px 0 0; }
.topic-summary b { color: var(--ink); }
.search-row { display: flex; gap: 12px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
.search { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 10px; background: var(--bg-2); border: 1.5px solid transparent; border-radius: 14px; padding: 0 14px; transition: border 0.2s, background 0.2s, box-shadow 0.2s; }
.search:focus-within { background: #fff; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12); }
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; flex: none; }
.search input { flex: 1; border: 0; background: transparent; outline: none; font: inherit; font-size: 16px; padding: 12px 0; min-width: 0; }
.picked-count { font-size: 13.5px; color: var(--ink-3); margin: 10px 0 0; }
.no-match { color: var(--ink-3); font-size: 15px; padding: 18px 0 4px; margin: 0; }
.chip .tag, .tag { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 6px; margin-left: 6px; vertical-align: 1px; letter-spacing: 0.02em; }
.tag.ai { background: #efe9ff; color: #6b47e0; }
.tag.h { background: #fff1dc; color: #a35a00; }
.chip.on .tag { background: rgba(255, 255, 255, 0.25); color: #fff; }
.chip.needs-ai:not(.on) { color: var(--ink-3); border-style: dashed; }
.legend { margin-top: 16px; }
.opt { font-size: 12px; font-weight: 500; color: var(--ink-3); background: var(--bg-2); padding: 2px 8px; border-radius: 980px; }
mark { background: #fff3a8; color: inherit; border-radius: 3px; padding: 0 1px; }
.chip.on mark { background: rgba(255, 255, 255, 0.3); }

.downloads { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 10px; }
.dl { display: flex; align-items: center; gap: 16px; text-align: left; background: #fff; border: 1.5px solid transparent; border-radius: 20px; padding: 18px 20px; transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.2s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04); }
.dl:hover { transform: translateY(-2px); border-color: rgba(0, 113, 227, 0.35); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.08); }
.dl:active { transform: scale(0.98); }
.dl:disabled { opacity: 0.6; cursor: progress; }
.dl-icon { width: 48px; height: 48px; flex: none; border-radius: 14px; background: #e8f1fd; display: grid; place-items: center; }
.dl-icon.green { background: #e6f6ec; }
.dl-icon svg { width: 26px; height: 26px; fill: none; stroke: var(--blue); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dl-icon.green svg { stroke: var(--green); }
.dl-text { display: flex; flex-direction: column; gap: 3px; }
.dl-text b { font-size: 17px; letter-spacing: -0.01em; }
.dl-text small { font-size: 13.5px; color: var(--ink-2); }
.dl.busy .dl-text b::after { content: " · making…"; color: var(--ink-3); font-weight: 500; }
.dl-sub { font-size: 14px; color: var(--ink-3); margin: 0 0 22px; }
.text-btn { background: none; border: 0; padding: 0; color: var(--blue); font-size: 14px; }
.text-btn:hover { text-decoration: underline; }

.correct-banner { background: #fff4e5; border: 1px solid #ffd9a8; color: #7a4100; border-radius: 16px; padding: 14px 18px; font-size: 15px; line-height: 1.5; margin-bottom: 16px; animation: viewIn 0.5s var(--ease); }
.qcard.locked { opacity: 0.6; }
.qcard.locked .ans { border-color: var(--green); background: #f3fbf6; }
.qcard.locked input { color: var(--ink-2); }
.qcard.fix .ans { border-color: var(--red); background: #fff6f6; }
.qcard.fix .ans:focus-within { border-color: var(--blue); background: #fff; }
.qstate { font-size: 12.5px; font-weight: 600; padding: 3px 9px; border-radius: 980px; margin-left: 8px; }
.qstate.ok { background: #e6f6ec; color: #13793d; }
.qstate.no { background: #fdeaea; color: #b4262b; }
.prev-note { font-size: 13.5px; color: #b25c00; margin: 8px 0 0; }
.attempts { display: inline-flex; align-items: center; gap: 10px; background: #fff; border-radius: 980px; padding: 8px 16px; font-size: 15px; color: var(--ink-2); margin: -14px 0 22px; }
.attempts b { color: var(--ink); }
.attempts .arrow { color: var(--green); font-weight: 700; }
.fixed-tag { font-size: 12px; font-weight: 600; color: #13793d; background: #e6f6ec; padding: 2px 8px; border-radius: 980px; margin-left: 6px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: rgba(29, 29, 31, 0.92); color: #fff; padding: 12px 20px; border-radius: 980px; font-size: 15px; z-index: 80; animation: viewIn 0.3s var(--ease); max-width: 90vw; text-align: center; }
@media (max-width: 640px) {
  .downloads { grid-template-columns: 1fr; }
  .attempts { margin-top: -6px; }
}

/* ===================== PAPER DOCUMENT (print + PDF) ===================== */
#print-root { display: none; }
.pr-doc { color: #000; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 11.5pt; background: #fff; letter-spacing: 0; }
.pr-doc .pr-cover { border-bottom: 2px solid #000; padding-bottom: 12px; margin-bottom: 14px; }
.pr-doc .pr-cover h1 { font-size: 22pt; margin: 0 0 4px; letter-spacing: -0.02em; }
.pr-doc .pr-cover p { margin: 2px 0; }
.pr-doc .pr-fields { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; margin-top: 12px; }
.pr-doc .pr-fields div { border-bottom: 1px solid #000; padding-bottom: 4px; font-size: 10pt; }
.pr-doc .pr-instr { font-size: 10pt; margin: 10px 0 0; padding-left: 18px; }
.pr-doc .pr-q { break-inside: avoid; page-break-inside: avoid; border-bottom: 1px solid #bbb; padding: 10px 0 8px; }
.pr-doc .pr-qtop { display: flex; justify-content: space-between; gap: 12px; }
.pr-doc .pr-qtop b { min-width: 24px; }
.pr-doc .pr-qtop .pr-text { flex: 1; line-height: 1.45; }
.pr-doc .pr-ansline { display: flex; justify-content: flex-end; align-items: flex-end; gap: 8px; margin-top: 4px; }
.pr-doc .pr-ansline span.line { display: inline-block; width: 55mm; border-bottom: 1px solid #000; height: 16px; }
.pr-doc .pr-ansline span.mk { width: 12mm; text-align: right; }
.pr-doc .pr-end { text-align: center; font-weight: 700; margin-top: 16px; }
.pr-doc table.pr-ms { width: 100%; border-collapse: collapse; font-size: 10pt; }
.pr-doc table.pr-ms th, .pr-doc table.pr-ms td { border: 1px solid #999; padding: 5px 7px; text-align: left; vertical-align: top; }
.pr-doc table.pr-ms th { background: #eee; }
.pr-doc table.pr-ms tr { break-inside: avoid; page-break-inside: avoid; }
.pdf-stage { position: fixed; left: -10000px; top: 0; width: 700px; padding: 0; }

@media print {
  @page { size: A4; margin: 16mm 16mm 18mm; }
  body { background: #fff !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
}

/* small v2 extras */
.submit-bar .timer { background: var(--bg-2); padding: 6px 12px; margin-right: 8px; font-size: 14px; }
.reveal-ans summary { color: var(--ink-2); font-size: 15px; cursor: pointer; margin: 3px 0; }
.result-actions .btn[hidden] { display: none; }
.covers { font-size: 12px; color: var(--ink-3); margin-left: 4px; }
.chip.on .covers { color: rgba(255, 255, 255, 0.8); }
.ai-pill, .opt { white-space: nowrap; }

/* ===================== V3 ===================== */
/* bigger primary actions */
.btn-xl { padding: 19px 44px; font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.btn-glow { box-shadow: 0 10px 40px rgba(0, 113, 227, 0.45); animation: ctaPulse 3s ease-in-out infinite; }
.btn-glow:hover { box-shadow: 0 14px 50px rgba(0, 113, 227, 0.6); transform: translateY(-2px); }
@keyframes ctaPulse { 0%, 100% { box-shadow: 0 10px 40px rgba(0, 113, 227, 0.4); } 50% { box-shadow: 0 10px 60px rgba(80, 140, 255, 0.7); } }
.hero-cta { flex-direction: column; gap: 18px; }
.link-arrow.small { font-size: 15px; opacity: 0.9; }
.nav-cta { padding: 8px 18px; font-size: 15px; font-weight: 600; }

/* builder */
.build-view { padding-top: 52px; padding-bottom: 160px; }
.build-hero { background: radial-gradient(1200px 400px at 50% -10%, #dfe9ff 0%, rgba(245, 245, 247, 0) 70%); text-align: center; padding: 64px 20px 24px; }
.build-title { font-size: clamp(38px, 6vw, 60px); letter-spacing: -0.04em; margin: 0 0 22px; line-height: 1.05; }
.subject-pills { display: inline-flex; gap: 8px; background: #fff; padding: 6px; border-radius: 980px; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06); }
.subject-pills button { border: 0; background: transparent; padding: 10px 22px; border-radius: 980px; font-size: 16px; color: var(--ink-2); }
.subject-pills button.on { background: var(--ink); color: #fff; font-weight: 600; }
.subject-pills button:disabled { opacity: 0.5; cursor: not-allowed; }
.subject-pills small { font-size: 11px; background: #ececf0; color: var(--ink-3); padding: 1px 6px; border-radius: 6px; margin-left: 4px; }
.build-wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; animation: viewIn 0.7s var(--ease); }
.step-block { background: #fff; border-radius: 28px; padding: 30px 30px 32px; margin-top: 18px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03); }
.step-head { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.step-head h2 { font-size: 26px; letter-spacing: -0.025em; margin: 0; }
.step-num { width: 36px; height: 36px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 17px; flex: none; }
.mini-h { font-size: 14px; font-weight: 600; color: var(--ink-2); margin: 0 0 10px; }
.setup-grid { display: grid; grid-template-columns: 1fr; gap: 22px; }
.setup-grid .tiles.two { max-width: 640px; }
.setup-grid .tiles.three { max-width: 640px; }

.tiles { display: grid; gap: 12px; }
.tiles.two { grid-template-columns: 1fr 1fr; }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.level-tiles { grid-template-columns: repeat(5, 1fr); }
.tile { position: relative; border: 2px solid #e6e6eb; background: #fff; border-radius: 20px; padding: 18px 14px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: border-color 0.2s, box-shadow 0.25s var(--ease), transform 0.25s var(--ease), background 0.2s; }
.tile:hover { border-color: #c7c7d0; transform: translateY(-2px); }
.tile:active { transform: scale(0.98); }
.tile b { font-size: 16.5px; letter-spacing: -0.01em; }
.tile small { font-size: 13px; color: var(--ink-3); line-height: 1.35; }
.tile.on { border-color: var(--blue); background: #f4f8ff; box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12), 0 10px 30px rgba(0, 113, 227, 0.12); }
.tile.on::after { content: "✓"; position: absolute; top: 10px; right: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--blue); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.tile-big { font-size: 40px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; margin-bottom: 6px; background: linear-gradient(160deg, #1d1d1f, #6e6e73); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tile.on .tile-big { background: var(--grad); -webkit-background-clip: text; background-clip: text; }
.tile.row { flex-direction: row; text-align: left; gap: 14px; padding: 18px 20px; }
.tile.row .tile-txt { display: flex; flex-direction: column; gap: 3px; }
.tile-ico { width: 46px; height: 46px; flex: none; border-radius: 14px; background: var(--bg-2); display: grid; place-items: center; transition: background 0.2s; }
.tile-ico svg { width: 24px; height: 24px; fill: none; stroke: var(--ink-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tile-ico .strike { stroke: var(--red); stroke-width: 2.2; }
.tile.on .tile-ico { background: #e1edff; }
.tile.on .tile-ico svg { stroke: var(--blue); }
.tile.on .tile-ico .strike { stroke: var(--red); }
.rec { position: absolute; top: -11px; left: 18px; font-style: normal; font-size: 11.5px; font-weight: 700; color: #fff; background: var(--grad); padding: 3px 10px; border-radius: 980px; }
.pick-area { margin-top: 6px; animation: viewIn 0.4s var(--ease); }
.teacher { margin-top: 22px; border-top: 1px solid #f0f0f3; padding-top: 18px; }
.teacher summary { cursor: pointer; font-weight: 600; font-size: 16px; color: var(--ink); list-style: none; display: flex; align-items: center; gap: 8px; }
.teacher summary::-webkit-details-marker { display: none; }
.teacher summary::before { content: "+"; width: 26px; height: 26px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; font-size: 18px; color: var(--ink-2); transition: transform 0.25s var(--ease); }
.teacher[open] summary::before { transform: rotate(45deg); }
.teacher textarea { margin-top: 14px; }
.find-existing { text-align: center; margin: 26px 0 0; }

.build-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, 0.82); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid rgba(0, 0, 0, 0.07); }
.bb-inner { max-width: 980px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.bb-summary { font-size: 16px; color: var(--ink-2); line-height: 1.4; }
.bb-summary b { color: var(--ink); }
#view-build[hidden] + * .build-bar, .view[hidden] .build-bar { display: none; }

/* paper: bigger, clearer */
.qtext { font-size: 20px; line-height: 1.5; }
.ans input { font-size: 19px; padding: 14px 16px; }
.hint-btn { font-size: 15.5px; padding: 13px 16px; font-weight: 600; }
.answer-as { font-size: 13.5px; font-weight: 600; color: var(--blue); margin: 0 0 8px; }
.frac-in { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 16px; background: #fff; transition: border 0.2s, box-shadow 0.2s; }
.frac-in:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12); }
.frac-in input { width: 92px; text-align: center; font: inherit; font-size: 22px; font-weight: 600; border: 0; outline: none; padding: 6px 4px; border-radius: 8px; background: var(--bg-2); }
.frac-in input:focus { background: #eaf2ff; }
.frac-in .fbar { width: 104px; height: 3px; border-radius: 2px; background: var(--ink); }
.frac-wrap { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.frac-wrap .unit { color: var(--ink-3); font-size: 15px; }
.qcard.locked .frac-in { border-color: var(--green); background: #f3fbf6; }
.qcard.fix .frac-in { border-color: var(--red); background: #fff6f6; }
.hint.formula { background: #eef6ff; color: #0b4a91; border: 1px solid #cfe3ff; font-size: 17px; }
.hint.formula b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--blue); margin-bottom: 4px; }
.hint.formula span { font-weight: 600; }

/* results: reveal buttons that stand out */
.review-head { align-items: center; }
.btn-reveal { background: #fff4e0; color: #8a4b00; border: 1.5px solid #ffcf8a; font-size: 15px; font-weight: 600; padding: 10px 18px; }
.btn-reveal:hover { background: #ffe9c4; }
.reveal-btn { margin-top: 8px; background: #fff4e0; color: #8a4b00; border: 1.5px solid #ffcf8a; border-radius: 12px; padding: 10px 16px; font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; transition: background 0.2s, transform 0.2s var(--ease); }
.reveal-btn:hover { background: #ffe9c4; transform: translateY(-1px); }
.reveal-btn::before { content: "👁"; display: none; }
.answer-box { margin-top: 8px; display: inline-block; background: #e9f8ef; border: 1.5px solid #9fdcb7; color: #0f5e31; border-radius: 12px; padding: 10px 16px; font-size: 17px; animation: hintIn 0.4s var(--ease); }
.answer-box b { color: #0b4d27; }
.result-actions .btn { font-size: 17px; padding: 13px 24px; }

@media (max-width: 860px) {
  .level-tiles { grid-template-columns: repeat(3, 1fr); }
  .setup-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .level-tiles { grid-template-columns: repeat(2, 1fr); }
  .level-tiles .tile:last-child { grid-column: span 2; }
  .tiles.two { grid-template-columns: 1fr; }
  .tiles.three { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .tiles.three .tile { padding: 14px 6px; }
  .step-block { padding: 22px 18px 24px; border-radius: 22px; }
  .step-head h2 { font-size: 22px; }
  .bb-summary { display: none; }
  .bb-inner .btn-xl { width: 100%; }
  .btn-xl { padding: 17px 30px; font-size: 19px; }
  .qtext { font-size: 18px; }
}
.pr-doc .pr-frac { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; }
.pr-doc .pr-frac i { display: block; width: 18mm; height: 8mm; border: 1px solid #000; border-radius: 2px; }
.pr-doc .pr-frac u { display: block; width: 22mm; border-top: 2px solid #000; }
@media (max-width: 560px) {
  .tiles.three .tile.on::after { display: none; }
  .subject-pills button { padding: 10px 14px; font-size: 15px; white-space: nowrap; }
  .subject-pills small { display: none; }
}

/* v4 */
.diff { display: inline-flex; gap: 3px; margin-top: 4px; }
.diff i { width: 12px; height: 5px; border-radius: 3px; background: #e3e3e8; }
.diff i.on { background: var(--blue); }
.tile.on .diff i.on { background: linear-gradient(90deg, #4f8bff, #9b6bff); }
.tag.later { background: #e8f1fd; color: #0b58b8; }
.later-toggle { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-size: 15px; color: var(--ink); cursor: pointer; }
.later-toggle input { width: 20px; height: 20px; accent-color: var(--blue); }

/* v5: quick search */
.quick { max-width: 720px; margin: 26px auto 0; }
.quick-search { display: flex; align-items: center; gap: 12px; background: #fff; border: 2px solid #e1e1e8; border-radius: 22px; padding: 8px 8px 8px 20px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.07); transition: border-color 0.2s, box-shadow 0.2s; }
.quick-search:focus-within { border-color: var(--blue); box-shadow: 0 0 0 5px rgba(0, 113, 227, 0.12), 0 14px 40px rgba(0, 113, 227, 0.12); }
.quick-search svg { width: 22px; height: 22px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; flex: none; }
.quick-search input { flex: 1; border: 0; outline: none; background: transparent; font: inherit; font-size: 19px; padding: 12px 0; min-width: 0; }
.quick-search .btn { padding: 14px 26px; font-size: 17px; font-weight: 600; border-radius: 16px; }
.quick-suggest { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; min-height: 8px; }
.qs-chip { border: 1.5px solid #d7e6fb; background: #f4f8ff; color: var(--ink); border-radius: 980px; padding: 9px 16px; font-size: 15px; transition: all 0.2s var(--ease); }
.qs-chip:hover { background: var(--blue); color: #fff; border-color: var(--blue); transform: translateY(-1px); }
.qs-chip:hover mark { background: rgba(255, 255, 255, 0.3); }
.qs-chip.needs-ai { border-style: dashed; color: var(--ink-3); }
.qs-none { color: var(--ink-2); font-size: 15px; }
.quick-or { color: var(--ink-3); font-size: 14px; margin: 16px 0 0; }
@media (max-width: 560px) {
  .quick-search { padding: 6px 6px 6px 14px; border-radius: 18px; }
  .quick-search input { font-size: 16px; }
  .quick-search .btn { padding: 12px 16px; font-size: 15px; }
}

/* v6 brand icon */
.brand-icon { width: 28px; height: 28px; border-radius: 7px; display: block; }

/* ===================== V6: MODERN TEST SCREEN ===================== */
.paper-view { padding: 52px 0 140px; background: linear-gradient(180deg, #eef3ff 0, var(--bg-2) 340px); }
.paper-top { position: sticky; top: 52px; z-index: 30; background: rgba(247, 248, 252, 0.82); backdrop-filter: saturate(180%) blur(18px); -webkit-backdrop-filter: saturate(180%) blur(18px); border-bottom: 1px solid rgba(0, 0, 0, 0.06); }
.pt-inner { max-width: 820px; margin: 0 auto; padding: 14px 20px 0; }
.pt-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.pt-title h1 { font-size: 20px; letter-spacing: -0.02em; margin: 0; line-height: 1.2; }
.pt-title p { font-size: 13.5px; color: var(--ink-2); margin: 2px 0 0; }
.pt-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.paper-view .timer { display: inline-flex; align-items: center; gap: 6px; background: #fff; border-radius: 980px; padding: 7px 12px; font-size: 14px; font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); margin: 0; }
.paper-view .timer svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.pill-btn { border: 0; background: var(--ink); color: #fff; border-radius: 980px; padding: 8px 14px; font-size: 13.5px; font-weight: 600; transition: transform 0.2s var(--ease), background 0.2s; }
.pill-btn:hover { background: #333; }
.progress { height: 4px; background: rgba(0, 0, 0, 0.06); border-radius: 4px; margin-top: 12px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #0f9d63, #34c88a); border-radius: 4px; transition: width 0.5s var(--ease); }

.paper-wrap { max-width: 820px; margin: 0 auto; padding: 22px 20px 0; animation: viewIn 0.6s var(--ease); }
.dl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.dl-pill { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; border: 1.5px solid #cfe0fb; background: #fff; color: #0b58b8; border-radius: 14px; padding: 11px 16px; font-size: 15px; font-weight: 600; transition: transform 0.2s var(--ease), box-shadow 0.2s, background 0.2s; }
.dl-pill:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(0, 113, 227, 0.14); background: #f6faff; }
.dl-pill svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dl-pill small { font-size: 11px; font-weight: 700; background: #e8f1fd; padding: 2px 6px; border-radius: 6px; }
.dl-pill.green { border-color: #bfe6d1; color: #0b7a4c; }
.dl-pill.green small { background: #e3f6ec; }
.dl-pill.green:hover { background: #f4fbf7; box-shadow: 0 8px 22px rgba(15, 157, 99, 0.14); }
.dl-pill.busy::after { content: "making…"; font-weight: 500; color: var(--ink-3); font-size: 13px; }
.dl-pill:disabled { opacity: 0.6; cursor: progress; }
.dl-print { font-size: 13.5px; color: var(--ink-3); }
.paper-view .source-note { margin: 0 0 14px; }

/* question card */
.paper-view .qcard { display: block; background: #fff; border-radius: 28px; padding: 30px 34px 30px; margin-bottom: 16px; border: 1px solid rgba(0, 0, 0, 0.04); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 18px 50px rgba(30, 50, 110, 0.07); opacity: 1; transform: none; animation: none; }
.paper-view .qcard:focus-within { box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18), 0 22px 60px rgba(30, 50, 110, 0.1); }
.qhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.paper-view .qnum { width: auto; height: auto; border-radius: 0; background: none; color: var(--ink); display: block; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.paper-view .qnum small { font-weight: 500; color: var(--ink-3); font-size: 15px; }
.qchips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.paper-view .qtag { background: #f0f4ff; color: #3653a8; font-size: 12.5px; padding: 5px 11px; }
.paper-view .qmarks { background: var(--bg-2); color: var(--ink-2); font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 980px; }
.paper-view .qtext { font-size: 23px; line-height: 1.5; letter-spacing: -0.015em; margin: 0 0 24px; color: var(--ink); }
.qanswer { background: #f8f9fc; border-radius: 20px; padding: 18px 18px 16px; }
.answer-label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 0 0 10px; }
.paper-view .ans { background: #fff; border-radius: 14px; }
.paper-view .ans input { font-size: 20px; padding: 15px 16px; }
.paper-view .frac-in { background: #fff; }
.paper-view .hint-btn { background: #fff; border: 1.5px solid #e2dbff; color: #5b3fd6; border-radius: 14px; padding: 13px 16px; }
.paper-view .hint-btn:hover { background: #f6f3ff; }
.paper-view .hints:not(:empty) { margin-top: 12px; }
.paper-view .kbd-tip { margin: 14px 0 0; text-align: center; }
.paper-view .qcard.locked { opacity: 0.75; }
.paper-view .qcard.locked .qanswer { background: #f1faf5; }
.paper-view .qcard.fix .qanswer { background: #fff6f6; }

/* focus view: one question at a time */
.questions.focus .qcard { display: none; }
.questions.focus .qcard.current { display: block; }
.questions.focus .qcard.enter { animation: qIn 0.45s var(--ease); }
@keyframes qIn { from { opacity: 0; transform: translateX(26px) scale(0.99); } to { opacity: 1; transform: none; } }
.questions.focus .qcard.current { min-height: 380px; display: flex; flex-direction: column; }
.questions.focus .qcard.current .qtext { flex: 1; }

/* navigator */
.qnav { position: sticky; bottom: 16px; z-index: 20; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin-top: 18px; background: rgba(255, 255, 255, 0.9); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-radius: 22px; padding: 10px; box-shadow: 0 16px 50px rgba(0, 0, 0, 0.12); }
.nav-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 16px; padding: 14px 18px; font-size: 16px; font-weight: 600; transition: background 0.2s, transform 0.2s var(--ease); }
.nav-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.nav-btn.back { background: var(--bg-2); color: var(--ink); }
.nav-btn.back:hover:not(:disabled) { background: #ebebf0; }
.nav-btn.back:disabled { opacity: 0.35; cursor: default; }
.nav-btn.next { background: var(--blue); color: #fff; padding: 14px 22px; }
.nav-btn.next:hover { background: var(--blue-2); }
.nav-btn.next.finish { background: #0f9d63; }
.nav-btn.next.finish:hover { background: #0b8754; }
.nav-btn:active { transform: scale(0.97); }
.dots { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; min-width: 0; }
.dot { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid #dcdce3; background: #fff; color: var(--ink-2); font-size: 13px; font-weight: 600; display: grid; place-items: center; padding: 0; transition: all 0.2s var(--ease); }
.dot:hover { border-color: #a1a1a6; }
.dot.done { background: #e8f1fd; border-color: #b8d4f8; color: #0b58b8; }
.dot.ok { background: #e3f6ec; border-color: #9fdcb7; color: #0b7a4c; }
.dot.no { background: #fdeaea; border-color: #f5b5b5; color: #b4262b; }
.dot.cur { background: var(--ink); border-color: var(--ink); color: #fff; transform: scale(1.08); }

/* list view keeps the old sticky submit bar */
.paper-view .submit-bar { max-width: 820px; }

@media (max-width: 640px) {
  .paper-top { top: 52px; }
  .pt-title h1 { font-size: 17px; }
  .pt-title p { display: none; }
  .pill-btn { padding: 7px 11px; font-size: 12.5px; }
  .paper-view .qcard { padding: 22px 18px; border-radius: 22px; }
  .paper-view .qtext { font-size: 19px; }
  .qanswer { padding: 14px 12px; }
  .questions.focus .qcard.current { min-height: 300px; }
  .qnav { grid-template-columns: auto 1fr auto; padding: 8px; gap: 8px; border-radius: 18px; }
  .nav-btn { padding: 13px 14px; }
  .nav-btn.back span { display: none; }
  .dots { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; padding: 2px; }
  .dots::-webkit-scrollbar { display: none; }
  .dot { width: 30px; height: 30px; flex: none; }
  .dl-row { gap: 8px; }
  .dl-pill { flex: 1 1 0; justify-content: center; padding: 11px 8px; font-size: 14px; gap: 6px; }
  .dl-pill svg { width: 18px; height: 18px; }
  .dl-word { display: none; }
  .dl-name { display: inline-block; }
  .dl-name::first-letter { text-transform: uppercase; }
  .dl-pill small { display: none; }
  .dl-print { width: 100%; text-align: center; font-size: 12.5px; }
  .paper-view .source-note { font-size: 12.5px; }
}

/* ===================== V8: ANSWER FORMAT BOXES ===================== */
.answer-label { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.fmt-hint { display: inline-flex; align-items: center; gap: 6px; background: #eef4ff; color: #0b58b8; border-radius: 980px; padding: 5px 11px 5px 8px; font-size: 13px; font-weight: 600; }
.fmt-hint svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; flex: none; }
.fmt-row { flex: 1; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 10px 12px; min-height: 60px; transition: border 0.2s, box-shadow 0.2s; }
.fmt-row:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12); }
.fmt-txt { font-size: 21px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.fmt-txt.unit-txt { color: var(--ink-3); font-size: 17px; }
.fmt-box { font: inherit; font-size: 20px; font-weight: 600; text-align: center; border: 1.5px dashed #b9c6dc; background: #f6f8fc; border-radius: 10px; padding: 8px 6px; outline: none; transition: border 0.15s, background 0.15s; }
.fmt-box:focus { border-style: solid; border-color: var(--blue); background: #fff; }
.fmt-box:not(:placeholder-shown) { border-style: solid; border-color: #cfd8e8; background: #fff; }
.fmt-box::placeholder { color: #a5b0c4; font-weight: 500; font-size: 13px; }
.fmt-box.s { width: 84px; }
.fmt-box.m { width: 130px; }
.fmt-box.l { width: 190px; }
.fmt-box.sup { width: 58px; font-size: 15px; padding: 5px 4px; align-self: flex-start; margin-top: -6px; margin-left: -4px; }
.fmt-pick { font: inherit; font-size: 20px; font-weight: 600; border: 1.5px solid #cfd8e8; border-radius: 10px; padding: 7px 8px; background: #fff; color: var(--ink); }
.qcard.locked .fmt-row { border-color: var(--green); background: #f3fbf6; }
.qcard.fix .fmt-row { border-color: var(--red); background: #fff6f6; }
.pr-doc .pr-shape { display: inline-flex; align-items: flex-end; gap: 6px; }
.pr-doc .pr-shape b { font-weight: 600; }
.pr-doc .pr-blank { display: inline-block; height: 9mm; border: 1px solid #000; border-radius: 2px; }
.pr-doc .pr-blank.s { width: 16mm; }
.pr-doc .pr-blank.m { width: 26mm; }
.pr-doc .pr-blank.l { width: 36mm; }
.pr-doc .pr-blank.sup { width: 10mm; height: 6mm; align-self: flex-start; }
@media (max-width: 640px) {
  .fmt-box.s { width: 64px; }
  .fmt-box.m { width: 100px; }
  .fmt-txt { font-size: 18px; }
  .fmt-hint { font-size: 12px; }
}
.fmt-row { flex: 1 1 280px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.fmt-row::-webkit-scrollbar { display: none; }
@media (max-width: 640px) {
  .qrow { flex-direction: column; align-items: stretch; }
  .qrow .fmt-row { flex: 1 1 auto; }
  .qrow .hint-btn { width: 100%; }
  .qrow .frac-wrap { justify-content: center; }
}

/* ===================== V9: SUBJECTS, OPTION TILES, WRITTEN ANSWERS, SLIM BARS ===================== */
/* subject picker */
.subject-scroll { max-width: 100%; overflow-x: auto; scrollbar-width: none; padding: 4px 2px 10px; margin: 0 -20px; padding-left: 20px; padding-right: 20px; }
.subject-scroll::-webkit-scrollbar { display: none; }
.subject-pills { flex-wrap: nowrap; }
.subject-pills button { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-weight: 500; transition: background 0.2s, color 0.2s; }
.subject-pills button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.subject-pills button:not(.on):hover { background: var(--bg-2); color: var(--ink); }
.subject-pills button.own:not(.on) { color: #7a3fd1; }
.subject-pills button.own.on { background: linear-gradient(135deg, #7a3fd1, #0071e3); }

/* a calmer builder header */
.build-hero { padding: 40px 20px 14px; }
.build-title { font-size: clamp(30px, 5vw, 50px); margin-bottom: 18px; }
.setup-grid > [hidden] { display: none !important; }
.setup-grid:has(> #calcBlock[hidden]) { grid-template-columns: 1fr; }

/* slim top bars once you're building or doing a test */
.nav-inner, .brand-icon { transition: height 0.3s var(--ease), width 0.3s var(--ease); }
body.mode-build.scrolled .nav-inner { height: 44px; }
body.mode-build.scrolled .brand-icon { width: 24px; height: 24px; }
body.mode-build.scrolled .nav-links a:not(.nav-cta) { display: none; }
body.mode-build.scrolled .nav-cta { padding: 6px 14px; font-size: 14px; }
.nav { transition: background 0.4s var(--ease), border-color 0.4s, transform 0.35s var(--ease); }
body.mode-paper .nav { transform: translateY(-100%); }
body.mode-paper .paper-view { padding-top: 0; }
body.mode-paper .paper-top { top: 0; }
.pt-home { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; transition: transform 0.2s var(--ease), width 0.3s var(--ease), height 0.3s var(--ease); }
.pt-home:hover { transform: scale(1.06); }
.pt-home img { width: 100%; height: 100%; border-radius: 10px; display: block; }
.pt-row { justify-content: flex-start; }
.pt-title { flex: 1; min-width: 0; }
.pt-title h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: font-size 0.3s var(--ease); }
.pt-title p { transition: opacity 0.25s, max-height 0.3s var(--ease); max-height: 40px; overflow: hidden; }
.pt-inner { transition: padding 0.3s var(--ease); }
.progress { transition: margin 0.3s var(--ease); }
body.mode-paper.scrolled .pt-inner { padding-top: 8px; }
body.mode-paper.scrolled .pt-title h1 { font-size: 16px; }
body.mode-paper.scrolled .pt-title p { opacity: 0; max-height: 0; margin: 0; }
body.mode-paper.scrolled .pt-home { width: 30px; height: 30px; }
body.mode-paper.scrolled .progress { margin-top: 8px; }
body.mode-paper.scrolled .paper-view .timer { padding: 5px 10px; font-size: 13px; }
body.mode-paper.scrolled .pill-btn { padding: 6px 12px; font-size: 13px; }

/* Sparx-style option tiles */
.qrow.block { flex-direction: column; align-items: stretch; }
.qrow.block .hint-btn { align-self: flex-start; }
.opt-grid { display: grid; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); gap: 12px; width: 100%; }
.opt { position: relative; min-height: 68px; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 16px; background: #fff; border: 2px solid #d4d7de; border-radius: 16px; font-size: 21px; color: var(--ink); text-align: center; line-height: 1.3; transition: border-color 0.15s, background 0.15s, transform 0.15s var(--ease), box-shadow 0.15s; }
.opt:hover:not(:disabled) { border-color: #9bb8ea; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0, 113, 227, 0.1); }
.opt:active:not(:disabled) { transform: scale(0.98); }
.opt.on { border-color: var(--blue); background: #eaf2ff; box-shadow: inset 0 0 0 1px var(--blue); }
.opt:disabled { cursor: default; }
.qcard.locked .opt.on { border-color: #0f9d63; background: #e9f8f0; box-shadow: inset 0 0 0 1px #0f9d63; }
.opt-txt sup { font-size: 0.65em; }
.opt-grid.long .opt { justify-content: flex-start; text-align: left; font-size: 17px; min-height: 58px; padding: 12px 16px; }
.opt-key { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 14px; font-weight: 700; background: var(--bg-2); color: var(--ink-2); }
.opt.on .opt-key { background: var(--blue); color: #fff; }
.opt-grid.multi .opt { padding-right: 40px; }
.opt-tick { position: absolute; top: 50%; right: 12px; width: 20px; height: 20px; margin-top: -10px; border-radius: 6px; border: 2px solid #c4c8d0; background: #fff; }
.opt.on .opt-tick { background: var(--blue); border-color: var(--blue); }
.opt.on .opt-tick::after { content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }

/* written answers */
.written-wrap { position: relative; width: 100%; }
.written { width: 100%; display: block; font: inherit; font-size: 17px; line-height: 1.6; padding: 16px 18px 30px; border: 2px solid #d4d7de; border-radius: 16px; background: #fff; resize: vertical; color: var(--ink); transition: border-color 0.15s, box-shadow 0.15s; }
.written:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12); }
.written[readonly] { background: #f3fbf7; border-color: #bfe6d1; }
.wc { position: absolute; right: 14px; bottom: 8px; font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; pointer-events: none; }

/* reading extracts, code and tables */
.passage { background: #fbfaf6; border: 1px solid #ece6d6; border-radius: 18px; margin: 4px 0 18px; overflow: hidden; }
.passage summary { list-style: none; cursor: pointer; padding: 14px 18px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.passage summary::-webkit-details-marker { display: none; }
.passage summary::after { content: "Show"; margin-left: auto; font-size: 13px; font-weight: 600; color: var(--blue); }
.passage[open] summary::after { content: "Hide"; }
.ps-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #a2803c; }
.passage summary b { font-size: 16.5px; }
.passage summary small { color: var(--ink-3); font-size: 12.5px; width: 100%; }
.ps-text { padding: 0 22px 18px; font-family: Georgia, "Times New Roman", serif; font-size: 17px; line-height: 1.75; color: #2b2b2b; max-height: 60vh; overflow-y: auto; border-top: 1px solid #ece6d6; }
.ps-text p { margin: 14px 0 0; white-space: pre-line; }
.qcode { background: #0f1523; color: #e6edf7; font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 15px; line-height: 1.6; padding: 16px 18px; border-radius: 14px; overflow-x: auto; margin: 0 0 16px; white-space: pre; }
.qcode.small { font-size: 13px; padding: 10px 12px; margin: 6px 0; }
.qtable { overflow-x: auto; margin: 0 0 14px; }
.qtable table { border-collapse: collapse; font-size: 15px; min-width: 320px; }
.qtable th, .qtable td { border: 1px solid #dfe2e8; padding: 7px 12px; text-align: left; }
.qtable th { background: var(--bg-2); font-weight: 600; }

/* results: partial marks, AI feedback, self-marking */
.rv-icon.part { background: #fff4e0; color: #b26a00; }
.part-tag { font-size: 12.5px; font-weight: 700; color: #b26a00; background: #fff4e0; border-radius: 6px; padding: 2px 7px; margin-left: 6px; }
.rv-written { white-space: pre-wrap; background: var(--bg-2); border-radius: 12px; padding: 12px 14px; font-size: 15px; line-height: 1.6; max-height: 260px; overflow-y: auto; margin: 4px 0 10px; }
.ai-mark { border: 1.5px solid #d9e6fb; background: #f7faff; border-radius: 16px; padding: 14px 16px; margin: 8px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; }
.am-top { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.am-score { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.am-level { font-size: 13px; font-weight: 600; background: #e7efff; color: #0b58b8; border-radius: 8px; padding: 3px 9px; }
.am-by { font-size: 12.5px; color: var(--ink-3); margin-left: auto; }
.am-col b { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
.am-col.www b { color: #0b7a4c; }
.am-col.ebi b { color: #b26a00; }
.am-col ul { margin: 6px 0 0; padding-left: 18px; font-size: 14.5px; line-height: 1.5; }
.self-mark { border: 1.5px dashed #e0b25c; background: #fffaf0; border-radius: 16px; padding: 12px 16px; margin: 8px 0; }
.self-mark p { margin: 0 0 10px; font-size: 14.5px; }
.self-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.self-btns .mini { min-width: 40px; font-size: 15px; padding: 8px 10px; }
details.ms { margin: 6px 0; }
details.ms ul { font-size: 14px; line-height: 1.5; padding-left: 18px; }
details.ms .model { font-size: 14.5px; background: #f3fbf7; border-radius: 10px; padding: 10px 12px; }

/* make your own */
.custom-text { width: 100%; font: inherit; font-size: 16px; line-height: 1.5; padding: 14px 16px; border: 2px solid #d4d7de; border-radius: 16px; margin-top: 14px; resize: vertical; }
.custom-text:focus, .own-row textarea:focus, .own-row input:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12); }
#customOwn { margin-top: 14px; }
.own-row { background: #fff; border: 1px solid rgba(0, 0, 0, 0.06); border-radius: 18px; padding: 14px 16px; margin-bottom: 12px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03); }
.own-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 14px; }
.own-row textarea, .own-row input { width: 100%; font: inherit; font-size: 15.5px; padding: 10px 12px; border: 1.5px solid #d4d7de; border-radius: 12px; background: #fff; }
.own-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.own-row label span { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.own-row label i { font-weight: 400; color: var(--ink-3); font-style: normal; }
.own-wrong { display: block; margin-top: 10px; }
.add-row { width: 100%; justify-content: center; border: 2px dashed #c9d6ee; background: #f7faff; color: var(--blue); }

/* PDF extras */
.pr-doc .pr-source { border: 1px solid #999; padding: 8px 12px; margin: 10px 0; font-family: Georgia, serif; font-size: 10.5pt; line-height: 1.5; }
.pr-doc .pr-source p { margin: 6px 0 0; white-space: pre-line; }
.pr-doc .pr-opts { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 8px 0 0 22px; }
.pr-doc .pr-opts p { width: 100%; margin: 0; font-size: 10pt; }
.pr-doc .pr-opts span { display: inline-flex; align-items: center; gap: 6px; }
.pr-doc .pr-opts .box { width: 12px; height: 12px; border: 1.2px solid #000; display: inline-block; }
.pr-doc .pr-lines i { display: block; height: 8.5mm; border-bottom: 1px solid #aaa; }
.pr-doc .pr-code { font-family: Menlo, Consolas, monospace; font-size: 9.5pt; background: #f2f2f2; padding: 6px 8px; white-space: pre; }
.pr-doc .pr-q.long { break-inside: auto; page-break-inside: auto; }
.pr-doc .qtable table { font-size: 10pt; }

@media (max-width: 640px) {
  .build-hero { padding: 26px 16px 8px; }
  .build-title { font-size: 30px; margin-bottom: 14px; }
  .subject-pills { justify-content: flex-start; }
  .subject-pills button { padding: 9px 13px; font-size: 14.5px; gap: 6px; }
  .subject-pills button svg { width: 16px; height: 16px; }
  .opt-grid { grid-template-columns: repeat(var(--mcols, 2), minmax(0, 1fr)); gap: 10px; }
  .opt { font-size: 18px; min-height: 60px; padding: 12px 10px; border-radius: 14px; }
  .opt-grid.long .opt { font-size: 15.5px; }
  .ai-mark { grid-template-columns: 1fr; }
  .own-grid { grid-template-columns: 1fr; }
  .ps-text { font-size: 16px; padding: 0 16px 14px; }
  .qcode { font-size: 13.5px; }
  .pt-home { width: 32px; height: 32px; }
}
/* answer box and subject pills on phones */
.qrow > * { max-width: 100%; box-sizing: border-box; }
.ans input { width: 100%; }
@media (max-width: 640px) {
  .qrow .ans { width: 100%; min-width: 0; flex: none; }
  .subject-scroll { margin: 0; padding: 0 0 6px; overflow: visible; }
  .subject-pills { display: flex; flex-wrap: wrap; justify-content: center; background: none; box-shadow: none; padding: 0; gap: 8px; }
  .subject-pills button { background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 14px rgba(0, 0, 0, 0.05); }
  .subject-pills button.on { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); }
}

/* ===== V9.1: roomier, clearer top of the builder ===== */
.build-hero { padding: 84px 20px 34px; }
.build-eyebrow { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--blue); margin: 0 0 10px; }
.build-title { font-size: clamp(34px, 5.4vw, 56px); margin-bottom: 26px; }
.hero-card { max-width: 820px; margin: 0 auto; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(10px); border: 1px solid rgba(0, 0, 0, 0.06); border-radius: 30px; padding: 22px 26px 18px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03), 0 24px 60px rgba(0, 60, 160, 0.1); }
.hero-label { font-size: 13px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; margin: 0 0 10px; }
.hero-card .subject-pills { background: var(--bg-2); box-shadow: none; padding: 5px; }
.hero-card .subject-pills button { padding: 11px 18px; font-size: 16px; }
.hero-card .subject-pills button.on { box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16); }
.hero-card .quick { margin-top: 20px; padding-top: 20px; border-top: 1px solid rgba(0, 0, 0, 0.06); }
.hero-card .quick-search { box-shadow: 0 6px 24px rgba(0, 0, 0, 0.06); }
.hero-card .quick-or { margin-top: 12px; }
@media (max-width: 640px) {
  .build-hero { padding: 48px 14px 22px; }
  .build-title { font-size: 31px; margin-bottom: 18px; }
  .build-eyebrow { font-size: 11.5px; }
  .hero-card { padding: 16px 14px 14px; border-radius: 24px; }
  .hero-card .subject-pills { background: none; padding: 0; }
  .hero-card .subject-pills button { padding: 9px 13px; font-size: 14.5px; background: var(--bg-2); box-shadow: none; }
  .hero-card .subject-pills button.on { background: var(--ink); }
  .hero-card .subject-pills button.own.on { background: linear-gradient(135deg, #7a3fd1, #0071e3); }
  .hero-card .quick { margin-top: 14px; padding-top: 14px; }
  .hero-label { font-size: 11.5px; margin-bottom: 8px; }
}

/* ===================== V10: PROGRESS, INSIGHTS, FLAGS, CALCULATOR, EXPLANATIONS, LOADING ===================== */
/* nav */
.nav-progress { display: inline-flex; align-items: center; gap: 6px; }
.np-flame { font-size: 12.5px; font-weight: 700; background: #fff1e6; color: #c2410c; border-radius: 980px; padding: 2px 7px; }

/* loading */
.loading-card { text-align: left; padding: 28px 28px 24px; width: min(460px, 92vw); }
.ld-top { display: flex; align-items: center; gap: 16px; }
.ld-orb { position: relative; width: 52px; height: 52px; flex: none; }
.ld-orb span { position: absolute; inset: 0; border-radius: 50%; border: 3px solid transparent; border-top-color: var(--blue); animation: spin 1.1s linear infinite; }
.ld-orb span:nth-child(2) { inset: 7px; border-top-color: #9b6bff; animation-duration: 1.6s; animation-direction: reverse; }
.ld-orb span:nth-child(3) { inset: 14px; border-top-color: #ff6fb5; animation-duration: 0.9s; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-card .ld-title { font-size: 19px; font-weight: 700; margin: 0; }
.loading-card .ld-sub { font-size: 14px; font-weight: 400; color: var(--ink-3); margin: 3px 0 0; }
.ld-bar { height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; margin: 20px 0 16px; }
.ld-bar span { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--blue), #9b6bff, #ff6fb5); background-size: 200% 100%; animation: shimmerBar 2s linear infinite; transition: width 0.25s linear; }
@keyframes shimmerBar { to { background-position: -200% 0; } }
.ld-steps { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 9px; }
.ld-steps li { display: flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--ink-3); transition: color 0.3s; }
.ld-steps li i { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #d4d7de; flex: none; position: relative; transition: all 0.3s; }
.ld-steps li.now { color: var(--ink); font-weight: 600; }
.ld-steps li.now i { border-color: var(--blue); border-top-color: transparent; animation: spin 0.8s linear infinite; }
.ld-steps li.done { color: var(--ink-2); }
.ld-steps li.done i { background: #0f9d63; border-color: #0f9d63; }
.ld-steps li.done i::after { content: ""; position: absolute; left: 4.5px; top: 1.5px; width: 4px; height: 8px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.ld-skel { display: grid; gap: 10px; }
.sk-card { border: 1px solid var(--bg-2); border-radius: 14px; padding: 12px 14px; display: grid; gap: 7px; }
.sk-card i, .sk-card b { display: block; height: 10px; border-radius: 6px; background: linear-gradient(90deg, #eef0f4 25%, #f8f9fb 50%, #eef0f4 75%); background-size: 200% 100%; animation: shimmerBar 1.4s linear infinite; }
.sk-card i.w40 { width: 40%; } .sk-card i.w30 { width: 30%; } .sk-card i.w70 { width: 70%; } .sk-card i.w60 { width: 60%; }
.sk-card b { height: 30px; border-radius: 10px; margin-top: 4px; }
.loading.done .loading-card { transform: scale(0.98); opacity: 0.6; transition: all 0.25s; }
#buildError .retry-link { font-weight: 700; margin-left: 6px; }

/* paper: saved note, flags, jumps */
.paper-top .pt-inner { position: relative; }
.saved-note { position: absolute; right: 20px; bottom: -22px; font-size: 12px; font-weight: 600; color: #0f9d63; opacity: 0; transform: translateY(-3px); transition: opacity 0.3s, transform 0.3s; pointer-events: none; }
.saved-note::before { content: "✓ "; }
.saved-note.on { opacity: 1; transform: none; }
.qnum { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.flag-btn { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); background: transparent; border: 1.5px solid #e1e3e8; border-radius: 99px; padding: 3px 10px 3px 8px; transition: all 0.15s; }
.flag-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.flag-btn:hover { border-color: #f0b44c; color: #b26a00; }
.flag-btn.on { background: #fff4e0; border-color: #f0b44c; color: #b26a00; }
.flag-btn.on svg { fill: #f0b44c; }
.qcard.flagged { box-shadow: inset 4px 0 0 #f0b44c, 0 2px 10px rgba(0, 0, 0, 0.04); }
.dot.flag { box-shadow: inset 0 0 0 2px #f0b44c; }
.sb-left { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sb-links { display: flex; gap: 12px; flex-wrap: wrap; }
.sb-links .text-btn { font-size: 13px; padding: 0; }
.flag-link { display: inline-flex; align-items: center; gap: 4px; color: #b26a00 !important; }
.flag-link svg { width: 13px; height: 13px; fill: #f0b44c; stroke: #b26a00; stroke-width: 1.5; }

/* calculator */
.calc-open { display: inline-flex; align-items: center; gap: 6px; }
.calc-open svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.calc { position: fixed; right: 20px; bottom: 96px; z-index: 55; width: 320px; background: #1d1d1f; color: #fff; border-radius: 24px; padding: 14px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35); animation: viewIn 0.25s; }
.calc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.calc-head span { font-size: 12px; color: #9a9aa0; }
.calc-x { margin-left: auto; width: 30px; height: 30px; border-radius: 50%; background: #333; color: #fff; font-size: 18px; line-height: 1; }
.calc-screen { width: 100%; background: #000; color: #fff; border: 0; border-radius: 14px; font: inherit; font-size: 22px; padding: 12px 14px 4px; text-align: right; font-variant-numeric: tabular-nums; }
.calc-screen:focus { outline: 2px solid #0a84ff; }
.calc-out { background: #000; border-radius: 0 0 14px 14px; margin-top: -6px; padding: 2px 14px 10px; text-align: right; font-size: 26px; font-weight: 600; min-height: 42px; font-variant-numeric: tabular-nums; overflow-x: auto; white-space: nowrap; }
.calc-out.err { color: #ff6b6b; font-size: 16px; }
.calc-keys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin-top: 12px; }
.calc-keys button { height: 44px; border-radius: 12px; background: #333336; color: #fff; font-size: 16px; font-weight: 500; transition: background 0.1s, transform 0.1s; }
.calc-keys button:active { transform: scale(0.95); background: #4a4a4e; }
.calc-keys .op { background: #ff9f0a; font-size: 20px; }
.calc-keys .eq { background: #0a84ff; font-size: 20px; }
.calc-keys .clr, .calc-keys .del { background: #a5a5aa; color: #000; }
.calc-keys .use { background: #30d158; color: #000; font-weight: 700; font-size: 14px; }

/* results insights + unlocks */
.insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 0 0 16px; }
.insights:empty { display: none; }
.ins { background: #fff; border-radius: 20px; padding: 16px 18px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04); display: flex; flex-direction: column; gap: 4px; }
.ins-k { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.ins-big { font-size: 40px; line-height: 1.05; font-weight: 700; letter-spacing: -0.03em; }
.ins-big.word { font-size: 24px; line-height: 1.2; padding: 6px 0 4px; }
.ins-big.up { color: #0f9d63; } .ins-big.down { color: #d83a34; }
.ins-mid { font-size: 20px; line-height: 1.25; font-weight: 700; }
.ins-mid .inl { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.ins small { color: var(--ink-3); font-size: 13px; line-height: 1.4; }
.ins-btn { align-self: flex-start; margin-top: 8px; }
.ins-slow { list-style: none; padding: 0; margin: 6px 0 0; font-size: 13.5px; display: grid; gap: 4px; }
.ins-slow li { display: flex; gap: 6px; }
.ins-slow li span { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.unlocks { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 16px; }
.unlock { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, #fff7e6, #fff); border: 1.5px solid #f6d48b; border-radius: 18px; padding: 10px 16px 10px 12px; animation: pop 0.5s var(--ease); }
.unlock .u-ico { font-size: 28px; }
.unlock b { display: block; font-size: 14.5px; }
.unlock small { color: var(--ink-3); font-size: 12.5px; }
@keyframes pop { 0% { transform: scale(0.85); opacity: 0; } 60% { transform: scale(1.04); opacity: 1; } 100% { transform: none; } }

/* explain my mistake */
.btn-explain { display: inline-flex; align-items: center; gap: 6px; margin: 8px 8px 0 0; padding: 8px 14px; border-radius: 99px; font-size: 14px; font-weight: 600; color: #6d28d9; background: #f3edff; border: 1.5px solid #ddd0ff; transition: all 0.15s; }
.btn-explain svg { width: 15px; height: 15px; fill: currentColor; }
.btn-explain:hover:not(:disabled) { background: #e9e0ff; }
.btn-explain:disabled { opacity: 0.55; cursor: default; }
.explain { margin-top: 10px; }
.ex-loading { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 14.5px; padding: 12px 0; }
.dotty { display: inline-flex; gap: 4px; }
.dotty i { width: 7px; height: 7px; border-radius: 50%; background: #9b6bff; animation: bounce 1s infinite; }
.dotty i:nth-child(2) { animation-delay: 0.12s; } .dotty i:nth-child(3) { animation-delay: 0.24s; }
.ex { background: #faf8ff; border: 1px solid #e9e0ff; border-radius: 16px; padding: 14px 16px; }
.ex-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #6d28d9; margin: 0 0 6px; }
.ex-h:not(:first-child) { margin-top: 12px; }
.ex-why { margin: 0; font-size: 15px; line-height: 1.5; }
.ex-steps { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.6; }
.ex-formula, .ex-tip { margin: 10px 0 0; font-size: 14.5px; background: #fff; border-radius: 10px; padding: 8px 12px; }
.ex-by { margin: 10px 0 0; font-size: 12px; color: var(--ink-3); }
.sim { margin-top: 10px; border: 1.5px dashed #c9d6ee; border-radius: 16px; padding: 14px 16px; background: #f7faff; }
.sim-h { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--blue); margin: 0 0 6px; }
.sim-q { margin: 0 0 10px; font-size: 16px; }
.sim-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sim-in { flex: 1; min-width: 140px; font: inherit; font-size: 16px; padding: 10px 12px; border: 1.5px solid #d4d7de; border-radius: 12px; }
.sim-in:focus { outline: 0; border-color: var(--blue); }
.sim-unit { color: var(--ink-3); }
.sim-check { padding: 10px 18px; }
.sim-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.sim-opt.on { background: var(--blue); color: #fff; }
.sim-res { margin: 10px 0 0; font-size: 14.5px; }
.sim-res:empty { display: none; }
.sim-res.ok { color: #0b7a4c; font-weight: 600; }
.sim-res.no { color: #b42318; }
.sim-res details { color: var(--ink); margin-top: 4px; }

/* progress page */
.progress-wrap { padding-top: 40px; }
.pg-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.pg-grid { display: grid; grid-template-columns: 1fr 1.35fr 1fr; gap: 14px; }
.pg-card { background: #fff; border-radius: 24px; padding: 20px; box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04); display: flex; flex-direction: column; }
.pg-k { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin: 0 0 10px; }
.pg-sub { color: var(--ink-3); font-size: 14px; margin: 8px 0 0; }
.xp-card { align-items: center; text-align: center; }
.xp-card .pg-k { align-self: flex-start; }
.xp-ring { position: relative; width: 150px; height: 150px; }
.xp-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.xp-fg { fill: none; stroke: var(--blue); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.xp-mid { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.xp-mid small { color: var(--ink-3); font-size: 13px; }
.xp-mid b { font-size: 44px; line-height: 1; letter-spacing: -0.03em; }
.streak-big { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.heat { display: grid; grid-template-rows: repeat(7, 1fr); grid-auto-flow: column; gap: 4px; margin-top: 14px; }
.heat i, .heat-key i { display: block; aspect-ratio: 1; border-radius: 4px; background: #eceef2; }
.heat i.l1, .heat-key i.l1 { background: #a8d8ff; } .heat i.l2, .heat-key i.l2 { background: #4aa8ff; } .heat i.l3, .heat-key i.l3 { background: #0071e3; }
.heat i.fut { background: transparent; }
.heat-key { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); margin-top: 8px; }
.heat-key span:last-child { display: inline-flex; align-items: center; gap: 3px; }
.heat-key i { width: 10px; }
.next-card { background: linear-gradient(160deg, #eef5ff, #fff 60%); }
.next-subj { font-size: 13px; color: var(--blue); font-weight: 600; margin: 0; }
.next-topic { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin: 2px 0 0; line-height: 1.2; }
.next-card .btn { margin-top: auto; align-self: flex-start; }
.next-card .pg-sub { margin-bottom: 16px; }
.pg-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 14px 0 16px; }
.pg-stats div { background: #fff; border-radius: 18px; padding: 14px 16px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04); }
.pg-stats b { display: block; font-size: 26px; letter-spacing: -0.02em; }
.pg-stats span { font-size: 13px; color: var(--ink-3); }
.bests { display: flex; flex-wrap: wrap; gap: 10px; }
.best { background: var(--bg-2); border-radius: 14px; padding: 8px 14px; display: flex; flex-direction: column; }
.best small { color: var(--ink-3); font-size: 12px; }
.best b { font-size: 20px; }
.weak-list { display: grid; gap: 10px; }
.weak { display: grid; grid-template-columns: minmax(120px, 1.2fr) 2fr auto auto; align-items: center; gap: 12px; }
.w-name b { display: block; font-size: 15px; } .w-name small { color: var(--ink-3); font-size: 12px; }
.weak .track { height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.weak .fill { height: 100%; border-radius: 99px; }
.weak .pct { font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.ach { border-radius: 18px; padding: 14px; background: var(--bg-2); display: flex; flex-direction: column; gap: 2px; opacity: 0.55; filter: grayscale(1); }
.ach.got { opacity: 1; filter: none; background: linear-gradient(160deg, #fff7e6, #fff); box-shadow: inset 0 0 0 1.5px #f6d48b; }
.ach-ico { font-size: 28px; margin-bottom: 4px; }
.ach b { font-size: 14.5px; } .ach small { font-size: 12.5px; color: var(--ink-3); line-height: 1.35; }
.history { list-style: none; padding: 0; margin: 0 0 14px; }
.history li { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--bg-2); }
.hs-date { font-size: 13px; color: var(--ink-3); }
.hs-name small { display: block; font-size: 12.5px; color: var(--ink-3); }
.hs-score { font-size: 20px; font-weight: 700; }
.text-btn.danger { color: #d83a34; }
.pg-empty { text-align: center; background: #fff; border-radius: 28px; padding: 56px 24px; }
.pg-empty-ico { font-size: 48px; }
.pg-empty p { color: var(--ink-3); max-width: 420px; margin: 8px auto 22px; }

@media (max-width: 860px) {
  .pg-grid { grid-template-columns: 1fr; }
  .pg-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .calc { right: 10px; left: 10px; width: auto; bottom: 88px; }
  .calc-keys button { height: 46px; }
  .weak { grid-template-columns: 1fr auto; }
  .weak .track { grid-column: 1 / -1; grid-row: 2; }
  .weak .pct { display: none; }
  .ins-big { font-size: 34px; }
  .saved-note { right: 12px; }
  .pg-head .btn { display: none; }
  .sb-links .text-btn { font-size: 12.5px; }
}
.insights { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 520px) { .insights { grid-template-columns: 1fr; } }

/* ===== V11: flag spacing, quick practice tucked into the Topics step ===== */
.qnum .flag-btn { margin-left: 18px; }
.hero-card .subject-scroll { margin-bottom: 0; padding-bottom: 0; }
.quick.quick-low { max-width: none; margin: 22px 0 0; padding-top: 18px; border-top: 1px solid rgba(0, 0, 0, 0.06); }
.quick-low .quick-label { font-size: 14px; color: var(--ink-3); margin: 0 0 8px; }
.quick-low .quick-search { border-width: 1.5px; border-radius: 16px; padding: 5px 5px 5px 14px; box-shadow: none; }
.quick-low .quick-search input { font-size: 16px; padding: 8px 0; }
.quick-low .quick-search .btn { padding: 9px 18px; font-size: 15px; border-radius: 12px; }
.quick-low .quick-search svg { width: 18px; height: 18px; }
.quick-low .quick-suggest { justify-content: flex-start; margin-top: 10px; }

/* ===== V12: four length options ===== */
.tiles.three.four { grid-template-columns: repeat(4, 1fr); }
.setup-grid .tiles.three.four { max-width: 760px; }
@media (max-width: 640px) { .tiles.three.four { grid-template-columns: repeat(2, 1fr); } }

/* ===== V16: question dots slide with you on phones ===== */
.dots { position: relative; scroll-behavior: smooth; }
@media (max-width: 640px) {
  .dots { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 14px), transparent 100%); padding: 2px 10px; }
  .qnav .nav-btn.back { width: 44px; padding: 0; justify-content: center; }
  .qnav .nav-btn.back span { display: none; }
}

/* ===== V16: calculator switch by the topic search ===== */
.quick-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.quick-head .quick-label { margin: 0; }
.quick-calc { display: inline-flex; align-items: center; gap: 2px; background: var(--bg-2); border-radius: 99px; padding: 3px; font-size: 13px; }
.quick-calc[hidden] { display: none; }
.quick-calc span { color: var(--ink-3); font-weight: 600; padding: 0 8px 0 6px; }
.quick-calc button { background: none; border-radius: 99px; padding: 4px 12px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.quick-calc button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }

/* ===== V16: question numbers on phones: 5 at a time around the current one ===== */
.dot[hidden] { display: none !important; }
@media (max-width: 640px) {
  .qnav { grid-template-columns: 44px minmax(0, 1fr) auto; }
  .dots { overflow: visible !important; -webkit-mask-image: none !important; mask-image: none !important; justify-content: center !important; flex-wrap: nowrap; padding: 2px 0 !important; gap: 5px; }
  .dot { width: 32px; height: 32px; flex: none; }
  .dot.cur { transform: none; box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.12); }
}
@media (max-width: 640px) { .dots { overflow: hidden !important; } }
.quick-calc button { border: 0; -webkit-appearance: none; appearance: none; }

/* ===== V17: big Calculator button on phones ===== */
.calc-fab { display: none; }
.calc-keys button, .calc-x { border: 0; -webkit-appearance: none; appearance: none; }
@media (max-width: 640px) {
  #calcBtn { display: none !important; }
  .calc-fab { position: fixed; right: 16px; bottom: calc(108px + env(safe-area-inset-bottom)); z-index: 54; display: inline-flex; align-items: center; gap: 9px;
    height: 54px; padding: 0 22px 0 18px; border: 0; border-radius: 99px; background: #1d1d1f; color: #fff; font-size: 17px; font-weight: 700;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28); -webkit-tap-highlight-color: transparent; transition: transform 0.15s; }
  .calc-fab:active { transform: scale(0.95); }
  .calc-fab[hidden] { display: none; }
  .calc-fab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
  body.mode-paper .calc { bottom: calc(96px + env(safe-area-inset-bottom)); }
}

/* ===== V18: bigger Calculator Off/On switch by the topic search on phones ===== */
@media (max-width: 640px) {
  .quick-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .quick-calc { display: grid; grid-template-columns: auto 1fr 1fr; align-items: center; padding: 4px; border-radius: 16px; font-size: 16px; }
  .quick-calc[hidden] { display: none; }
  .quick-calc span { font-size: 15px; padding: 0 12px 0 10px; }
  .quick-calc button { height: 44px; border-radius: 12px; font-size: 16px; padding: 0 14px; }
  .quick-calc button.on { background: var(--ink); color: #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18); }
}


/* ---------- past papers ---------- */
.pp-search { position: relative; margin: 6px 0 12px; }
.pp-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; }
.pp-search input { width: 100%; box-sizing: border-box; padding: 13px 14px 13px 42px; font: inherit; font-size: 16px; border: 1.5px solid var(--bg-3, #e3e6ee); border-radius: 14px; background: #fff; color: var(--ink); outline: none; }
.pp-search input:focus { border-color: var(--brand, #2a5bd7); box-shadow: 0 0 0 4px rgba(42, 91, 215, 0.12); }
.pp-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pp-filters .chip { border: 1.5px solid var(--bg-3, #e3e6ee); background: #fff; color: var(--ink-2); border-radius: 999px; padding: 6px 13px; font: inherit; font-size: 14px; cursor: pointer; }
.pp-filters .chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pp-list { list-style: none; padding: 0; margin: 0 0 18px; }
.pp-item { background: #fff; border: 1px solid var(--bg-2); border-radius: 16px; margin-bottom: 10px; overflow: hidden; }
.pp-item.open { box-shadow: 0 6px 24px rgba(20, 30, 60, 0.07); }
.pp-head { width: 100%; display: grid; grid-template-columns: 112px 1fr auto 20px; align-items: center; gap: 12px; padding: 14px 16px; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; color: var(--ink); }
.pp-head:hover { background: var(--bg-1, #f7f8fb); }
.pp-date { font-size: 13px; color: var(--ink-3); }
.pp-name { font-size: 15px; } .pp-name small { display: block; color: var(--ink-3); font-size: 13px; margin-top: 2px; }
.pp-name mark, .pp-qs mark { background: #fff1a8; border-radius: 3px; padding: 0 2px; }
.pp-score { font-weight: 700; font-size: 17px; text-align: right; } .pp-score small { display: block; font-weight: 500; font-size: 12px; color: var(--ink-3); }
.pp-chev { color: var(--ink-3); transition: transform 0.2s; } .pp-item.open .pp-chev { transform: rotate(180deg); }
.pp-body { padding: 4px 16px 16px; border-top: 1px solid var(--bg-2); }
.pp-qs { list-style: none; padding: 0; margin: 10px 0 0; }
.pp-qs li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--bg-1, #f1f3f7); }
.pp-qs li:last-child { border-bottom: 0; }
.pp-q { margin: 0; font-size: 15px; } .pp-topic { display: inline-block; margin-left: 8px; color: var(--ink-3); font-size: 12px; }
.pp-a { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); } .pp-a b { color: var(--ink); }
.pp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
@media (max-width: 640px) { .pp-head { grid-template-columns: 1fr auto 20px; } .pp-date { grid-column: 1 / -1; } }

/* ---------- feedback ---------- */
.fb-form textarea, .fb-form input[type=text] { width: 100%; box-sizing: border-box; font: inherit; font-size: 15px; padding: 11px 13px; border: 1.5px solid var(--bg-3, #e3e6ee); border-radius: 12px; background: #fff; color: var(--ink); outline: none; }
.fb-form textarea:focus, .fb-form input[type=text]:focus { border-color: var(--brand, #2a5bd7); box-shadow: 0 0 0 4px rgba(42, 91, 215, 0.12); }
.fb-form textarea { resize: vertical; margin-bottom: 10px; }
.fb-row { display: flex; gap: 10px; align-items: center; } .fb-row input { flex: 1; }
.fb-rate { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.fb-rate small { color: var(--ink-3); font-size: 13px; }
.fb-rate .stars { display: inline-flex; flex-direction: row-reverse; }
.fb-rate label { cursor: pointer; } .fb-rate input { position: absolute; opacity: 0; width: 0; height: 0; }
.fb-rate span.stars span { font-size: 26px; color: #d9dde6; transition: color 0.12s; padding: 0 1px; }
.fb-rate .stars label:hover span, .fb-rate .stars label:hover ~ label span, .fb-rate .stars label:has(input:checked) span, .fb-rate .stars label:has(input:checked) ~ label span { color: #f5b301; }
.fb-done { margin: 10px 0 0; font-size: 14px; color: var(--ink-2); }
@media (max-width: 640px) { .fb-row { flex-direction: column; align-items: stretch; } }


/* ===================== V26: NAV ICONS, PAST TESTS, FEEDBACK PAGE AND PROMPT ===================== */
.nl-icon { display: inline-flex; align-items: center; gap: 6px; position: relative; }
.nl-icon svg { display: none; width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.nav-links a.on:not(.nav-cta) { color: var(--ink); font-weight: 600; }
@media (max-width: 860px) {
  .nav-links { gap: 6px; }
  .nl-icon { width: 40px; height: 40px; justify-content: center; border-radius: 12px; }
  .nl-icon .nl-text { display: none; }
  .nl-icon svg { display: block; }
  .nl-icon.on { background: rgba(0, 0, 0, 0.06); }
  .nl-icon .np-flame { position: absolute; top: -2px; right: -6px; font-size: 10.5px; padding: 1px 5px; line-height: 1.4; }
  .nav-cta { margin-left: 4px; white-space: nowrap; }
}
@media (max-width: 360px) { .brand { font-size: 15px; } .nav-cta { padding: 6px 11px; font-size: 13.5px; } }

.past-tests { scroll-margin-top: 70px; }
.pt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.pt-count { color: var(--ink-3); font-size: 14px; }
.past-tests #resetProgress { margin-top: 6px; }
.pp-actions.top { margin: 12px 0 2px; }
.pp-actions:empty { display: none; }
.mini.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.mini.primary:hover { background: var(--blue-2); }

.fb-wrap { max-width: 720px; }
.fb-note { color: var(--ink-3); font-size: 14px; margin: 12px 4px 0; }

.fb-nudge { position: fixed; right: 20px; bottom: 20px; z-index: 60; width: min(360px, calc(100vw - 32px)); background: #fff; border-radius: 18px; padding: 18px 18px 14px;
  box-shadow: 0 18px 50px rgba(15, 20, 40, 0.22), 0 0 0 1px rgba(0, 0, 0, 0.05); transform: translateY(16px); opacity: 0; transition: transform 0.35s var(--ease), opacity 0.35s; }
.fb-nudge.on { transform: none; opacity: 1; }
.fbn-x { position: absolute; top: 8px; right: 10px; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--ink-3); cursor: pointer; padding: 4px 6px; }
.fbn-t { font-weight: 700; font-size: 17px; margin: 0 0 4px; padding-right: 24px; }
.fbn-p { margin: 0 0 12px; color: var(--ink-2); font-size: 15px; }
.fbn-btns { display: flex; gap: 8px; }
.fbn-btns .btn { flex: 1; justify-content: center; text-align: center; }
.fbn-small { margin: 10px 0 0; font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 640px) { .fb-nudge { left: 16px; right: 16px; bottom: 16px; width: auto; } }
@media (prefers-reduced-motion: reduce) { .fb-nudge { transition: none; } }
@media print { .fb-nudge { display: none !important; } }
@media (max-width: 560px) { #markBtn { white-space: nowrap; padding-left: 20px; padding-right: 20px; } .submit-bar .sb-left, .submit-bar small { font-size: 13px; } }
/* answer buttons must wrap long text (the old badge rule ".opt { white-space: nowrap }" was hitting them) */
.opt-grid .opt { white-space: normal; min-width: 0; overflow-wrap: break-word; }
.opt-grid .opt-txt { min-width: 0; }

/* V26 phone tidy-up for the progress page */
@media (max-width: 640px) {
  .app-view { padding-top: 72px; }
  .app-sub { font-size: 16px; margin-bottom: 18px; }
  .pg-head { margin-bottom: 14px; }
  .pg-head > .btn { display: none; } /* "Make a paper" is already in the top bar */
  .pg-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .pg-grid .next-card { grid-column: 1 / -1; }
  .pg-card { padding: 14px; border-radius: 20px; }
  .xp-ring { width: 96px; height: 96px; margin-top: 4px; }
  .xp-mid b { font-size: 30px; }
  .xp-card .pg-sub { font-size: 12.5px; }
  .streak-big { font-size: 20px; }
  .streak-big + .pg-sub { font-size: 12.5px; }
  .heat { gap: 2px; margin-top: 8px; }
  .heat i { border-radius: 2px; }
  .heat-key { display: none; }
  .next-topic { font-size: 20px; }
  .pg-stats { grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 12px; }
  .pg-stats div { padding: 10px 8px; border-radius: 14px; text-align: center; }
  .pg-stats b { font-size: 19px; }
  .pg-stats span { font-size: 11px; line-height: 1.2; display: block; }
  .panel { padding: 18px; }
  .ach-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .ach { padding: 10px 6px; align-items: center; text-align: center; border-radius: 14px; }
  .ach-ico { font-size: 22px; margin-bottom: 2px; }
  .ach b { font-size: 12px; line-height: 1.25; }
  .ach small { display: none; }
  .pp-topics { display: none; }
  .pp-head { padding: 12px 14px; gap: 4px 10px; }
}

/* V27: Progress gets a labelled button on phones (an icon on its own was easy to miss) */
.nl-short { display: none; }
@media (max-width: 860px) {
  .nav-progress.nl-icon { width: auto; padding: 0 12px 0 10px; gap: 6px; background: rgba(0, 113, 227, 0.08); color: var(--blue); font-weight: 600; font-size: 14.5px; }
  body:not(.app-mode):not(.nav-light) .nav-progress.nl-icon { background: rgba(255, 255, 255, 0.14); color: #fff; }
  .nav-progress.nl-icon .nl-short { display: inline; }
  .nav-progress.nl-icon svg { width: 18px; height: 18px; }
  .nav-progress.nl-icon .np-flame { position: static; font-size: 11px; padding: 1px 5px; }
  .nav-progress.nl-icon.on { background: var(--blue); color: #fff; }
}
@media (max-width: 430px) {
  .brand { font-size: 0; gap: 0; }          /* logo only, to make room */
  .nav-inner { padding: 0 14px; }
  .nav-cta { padding: 7px 13px; font-size: 14px; }
}
@media (max-width: 340px) { .nav-progress.nl-icon svg { display: none; } .nl-icon:not(.nav-progress) { width: 34px; } }

/* V29: Print is the big button, Download is the small blue link */
.dl-print .text-btn { color: var(--blue); font-weight: 600; }
.dl-print .text-btn.busy { opacity: 0.6; cursor: progress; }
.dl-print .text-btn.busy::after { content: " (making…)"; font-weight: 500; color: var(--ink-3); }
.res-dl { margin: 0 0 16px; text-align: center; }
@media (max-width: 640px) { #paperDownloads .dl-word { display: inline; } #paperDownloads .dl-name::first-letter { text-transform: none; } }

/* V30: "To get the next mark" box on AI-marked written answers */
.am-next { margin-top: 10px; padding: 12px 14px; border-radius: 12px; background: rgba(0, 113, 227, 0.07); border: 1px solid rgba(0, 113, 227, 0.18); }
.am-next b { display: block; font-size: 14px; color: var(--blue); margin-bottom: 2px; }
.am-next p { margin: 0; font-size: 15px; }
.am-next .am-eg { margin-top: 6px; color: var(--ink-2); }

/* ===================== V30: SHARING, TEACHERS, PARENTS, ABOUT ===================== */
.dl-pill.share { color: var(--ink); border-color: var(--line); }
.dl-pill.share svg { stroke: var(--ink); }
.teacher-note { max-width: 760px; margin: 28px auto 40px; padding: 14px 18px; border-radius: 16px; background: var(--bg-2); font-size: 15px; color: var(--ink-2); }
.teacher-note a { color: var(--blue); font-weight: 600; }
.foot-links a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }

/* the pop-up */
body.modal-open { overflow: hidden; }
.pp-modal { position: fixed; inset: 0; z-index: 80; background: rgba(10, 12, 20, 0.45); display: grid; place-items: center; padding: 16px; animation: shIn 0.2s ease; }
.pp-modal[hidden] { display: none; }
.ppm-card { position: relative; width: min(540px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: #fff; border-radius: 22px; padding: 26px 24px 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25); }
.ppm-card h2 { font-size: 24px; margin: 0 30px 6px 0; letter-spacing: -0.02em; }
.ppm-sub { color: var(--ink-2); margin: 0 0 16px; font-size: 15px; }
.ppm-x { position: absolute; top: 12px; right: 14px; border: 0; background: var(--bg-2); width: 36px; height: 36px; border-radius: 50%; font-size: 22px; line-height: 1; cursor: pointer; color: var(--ink-2); }
.ppm-steps { margin: 16px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 14.5px; display: grid; gap: 6px; }
.ppm-steps a { color: var(--blue); }
.share-opts { display: grid; gap: 10px; }
.share-opt { text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 16px; padding: 14px 16px; cursor: pointer; font: inherit; display: grid; gap: 3px; transition: border-color 0.15s, background 0.15s; }
.share-opt:hover, .share-opt:focus-visible { border-color: var(--blue); background: rgba(0, 113, 227, 0.04); outline: none; }
.share-opt b { font-size: 16.5px; }
.share-opt span { color: var(--ink-2); font-size: 14.5px; }
.link-box { display: grid; gap: 10px; margin-top: 4px; }
.link-box input { width: 100%; font: 14px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg-2); color: var(--ink-2); text-overflow: ellipsis; }
.link-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.link-btns .btn { flex: 1; justify-content: center; min-width: 130px; }
@keyframes shIn { from { opacity: 0; } }
@media (max-width: 640px) {
  .pp-modal { place-items: end stretch; padding: 0; }
  .ppm-card { width: 100%; border-radius: 22px 22px 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); max-height: 88vh; }
}

/* results: send / challenge */
.send-panel.is-class { border: 2px solid var(--blue); background: rgba(0, 113, 227, 0.035); }
.send-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.send-row input { flex: 1 1 220px; font-size: 16px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; min-height: 46px; }
.send-row input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15); }
.send-row input.need { border-color: var(--red); }
.send-row .btn { white-space: nowrap; }
.ins.kind { background: #fff8ec; }
@media (max-width: 560px) { .send-row .btn { flex: 1; justify-content: center; } }

/* progress page tools */
.pg-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.chip-btn { display: inline-flex; align-items: center; gap: 7px; font: 600 14px var(--font); padding: 9px 14px; min-height: 40px; border-radius: 980px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.chip-btn:hover { border-color: var(--ink-3); }
.chip-btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* teacher page */
.tc-wrap { max-width: 1080px; }
.tc-steps { list-style: none; counter-reset: s; padding: 0; margin: 6px 0 22px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.tc-steps li { counter-increment: s; background: var(--bg-2); border-radius: 18px; padding: 16px; display: grid; gap: 4px; align-content: start; }
.tc-steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 700; display: grid; place-items: center; font-size: 14px; margin-bottom: 4px; }
.tc-steps b { font-size: 15.5px; }
.tc-steps span { font-size: 14px; color: var(--ink-2); }
.tc-papers { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; }
.tc-pill { flex: none; display: grid; gap: 2px; padding: 10px 14px; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; max-width: 260px; }
.tc-pill b { font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-pill small { font-size: 13px; color: var(--ink-2); }
.tc-pill.on { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue) inset; }
.tc-head { display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: flex-start; }
.tc-tools { display: flex; gap: 8px; flex-wrap: wrap; }
.tc-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 14px 0; }
.tc-stats div { background: var(--bg-2); border-radius: 16px; padding: 12px 14px; }
.tc-stats b { display: block; font-size: 26px; letter-spacing: -0.02em; }
.tc-stats span { font-size: 13px; color: var(--ink-2); }
.tc-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
.tc-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.tc-table th, .tc-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tc-table th { background: var(--bg-2); font-size: 13px; color: var(--ink-2); font-weight: 600; position: sticky; top: 0; }
.tc-table .nm { font-weight: 600; position: sticky; left: 0; background: #fff; }
.tc-table .qh, .tc-table .qc { text-align: center; padding: 8px 6px; min-width: 38px; }
.qc.ok { color: var(--green); font-weight: 700; }
.qc.part { color: var(--amber); font-weight: 700; }
.qc.no { color: var(--red); font-weight: 700; }
.qc.pc { color: var(--ink-2); font-size: 12.5px; }
.tc-avg td { background: var(--bg-2); font-weight: 600; }
.tc-avg td:first-child { position: sticky; left: 0; }
.tc-x { border: 0; background: none; color: var(--ink-3); font-size: 20px; cursor: pointer; width: 32px; height: 32px; border-radius: 8px; }
.tc-x:hover { background: var(--bg-2); color: var(--red); }
.tc-sub { font-size: 17px; margin: 20px 0 8px; }
.tc-hard { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 8px; }
.tc-hard li { background: var(--bg-2); border-radius: 12px; padding: 10px 14px; font-size: 14.5px; }
.tc-hp { font-weight: 800; margin-right: 6px; }
.tc-qt { color: var(--ink-2); font-size: 14px; margin-top: 3px; }
.tc-none { color: var(--ink-2); }
.tc-paste { margin-top: 18px; display: grid; gap: 8px; }
.tc-paste label { font-weight: 600; font-size: 15px; }
.tc-paste textarea { font: 15px/1.4 var(--font); padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; resize: vertical; width: 100%; }
.tc-paste .btn { justify-self: start; }
.tc-panel #tcDel { margin-top: 14px; }
.tc-privacy { color: var(--ink-3); font-size: 13.5px; margin: 18px 4px 0; }
.tc-privacy a { color: var(--blue); }
@media (max-width: 860px) { .tc-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .tc-steps { grid-template-columns: minmax(0, 1fr); } .tc-steps li { grid-template-columns: auto 1fr; column-gap: 10px; } .tc-steps li::before { grid-row: span 2; } }

/* a results link or parent report someone opened */
.sh-wrap { max-width: 760px; }
.sh-card { background: #fff; border-radius: 24px; padding: clamp(18px, 4vw, 30px); box-shadow: 0 2px 30px rgba(0, 0, 0, 0.06); display: grid; gap: 14px; }
.sh-top { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.sh-ring { --p: 0; --c: var(--green); width: 108px; height: 108px; flex: none; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--bg-2) 0); position: relative; }
.sh-ring::before { content: ""; position: absolute; inset: 11px; border-radius: 50%; background: #fff; }
.sh-ring b { position: relative; font-size: 26px; letter-spacing: -0.02em; }
.sh-k { color: var(--ink-2); font-size: 14px; margin: 0 0 2px; }
.sh-saved { background: rgba(31, 174, 91, 0.1); border-radius: 12px; padding: 10px 14px; margin: 0; font-size: 15px; }
.sh-saved a { color: var(--blue); font-weight: 600; }
.sh-card .panel-h { margin: 6px 0 0; }
.qdots { display: flex; flex-wrap: wrap; gap: 6px; }
.qd { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; }
.qd.ok { background: var(--green); } .qd.part { background: var(--amber); } .qd.no { background: var(--red); }
.sh-next { background: #fff8ec; border-radius: 14px; padding: 12px 16px; }
.sh-next.good { background: rgba(31, 174, 91, 0.1); }
.sh-next b { display: block; margin-bottom: 2px; }
.sh-next p { margin: 0; color: var(--ink-2); }
.sh-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.tc-stats.rep { margin: 4px 0; }
.rep-trend { margin: 0; font-weight: 600; }
.rep-trend.up { color: var(--green); } .rep-trend.down { color: var(--amber); }
.rep-list { display: grid; gap: 6px; }
.rep-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 90px 44px; grid-template-areas: "d s bar pc" "d l bar pc"; column-gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--bg-2); }
.rep-row > span:first-child { grid-area: d; color: var(--ink-2); font-size: 14px; }
.rep-row > b:nth-of-type(1) { grid-area: s; font-size: 15px; }
.rep-row small { grid-area: l; color: var(--ink-2); font-size: 13px; }
.rep-bar { grid-area: bar; height: 8px; border-radius: 4px; background: var(--bg-2); overflow: hidden; }
.rep-bar i { display: block; height: 100%; border-radius: 4px; }
.rep-pc { grid-area: pc; text-align: right; }
@media (max-width: 420px) { .rep-row { grid-template-columns: 48px minmax(0, 1fr) 44px; grid-template-areas: "d s pc" "d l pc"; } .rep-bar { display: none; } .tbar { grid-template-columns: minmax(0, 1fr) 70px 46px; } }

/* about page */
.about-wrap { max-width: 980px; }
.about-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 20px; }
.about-grid .panel { margin: 0; }
.about-grid p { color: var(--ink-2); font-size: 15.5px; margin: 8px 0 0; }
.about-grid a { color: var(--blue); }
@media (max-width: 720px) { .about-grid { grid-template-columns: minmax(0, 1fr); } }

/* ===================== V31: JOIN WITH A CODE ===================== */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.join-hero { margin-left: 4px; }
.join-chip { display: inline-flex; gap: 6px; align-items: center; margin: 0 auto 14px; padding: 8px 16px; border-radius: 980px; background: rgba(0, 113, 227, 0.08); color: var(--ink); text-decoration: none; font-size: 15px; }
.join-chip b { color: var(--blue); }
.join-chip:hover b { text-decoration: underline; }
.join-wrap { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 90px 16px 40px; background: linear-gradient(160deg, #0b3b8c, #0071e3 55%, #36a3ff); }
.join-card { width: min(440px, 100%); background: #fff; border-radius: 28px; padding: 30px 26px 24px; box-shadow: 0 30px 80px rgba(0, 20, 60, 0.35); display: grid; gap: 12px; text-align: center; }
.join-title { font-size: clamp(30px, 6vw, 40px); letter-spacing: -0.03em; margin: 0; }
.join-sub { margin: 0 0 4px; color: var(--ink-2); }
.join-code { font: 700 clamp(34px, 9vw, 46px)/1 var(--font); letter-spacing: 0.12em; text-align: center; padding: 16px 10px; border: 2px solid var(--line); border-radius: 18px; width: 100%; font-variant-numeric: tabular-nums; }
.join-code::placeholder { color: #c9c9ce; }
.join-code:focus, .join-name:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15); }
.join-lab { text-align: left; font-weight: 600; font-size: 15px; margin-top: 6px; }
.join-name { font-size: 18px; padding: 14px 16px; border: 2px solid var(--line); border-radius: 16px; width: 100%; }
.join-card .btn-xl { width: 100%; justify-content: center; margin-top: 6px; }
.join-err { margin: 0; color: var(--red); font-weight: 600; }
.join-small { margin: 4px 0 0; font-size: 13.5px; color: var(--ink-3); }
.join-small a { color: var(--blue); }
.room-box { text-align: center; }
.room-code { font: 800 clamp(44px, 12vw, 64px)/1 var(--font); letter-spacing: 0.08em; margin: 6px 0 16px; font-variant-numeric: tabular-nums; color: var(--ink); }
.room-box .link-btns { justify-content: center; }
.ppm-sub.small { font-size: 13.5px; margin-top: 12px; }
.room-link { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; }
.room-link summary { cursor: pointer; color: var(--blue); font-weight: 600; font-size: 15px; }
.room-link .ppm-sub { margin-top: 8px; }
.board { position: fixed; inset: 0; z-index: 90; background: linear-gradient(160deg, #0b3b8c, #0071e3 55%, #36a3ff); color: #fff; display: grid; place-content: center; text-align: center; gap: 2vh; padding: 20px; }
.board[hidden] { display: none; }
.board-go { font-size: clamp(22px, 4vw, 44px); margin: 0; opacity: 0.92; }
.board-code { font: 800 clamp(70px, 18vw, 220px)/1 var(--font); letter-spacing: 0.06em; margin: 0; font-variant-numeric: tabular-nums; }
.board-live { font-size: clamp(18px, 3vw, 32px); margin: 0; opacity: 0.9; }
.board-x { position: absolute; top: 18px; right: 22px; width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.18); color: #fff; font-size: 30px; cursor: pointer; }
.tc-live { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0 0; padding: 10px 14px; border-radius: 12px; background: rgba(31, 174, 91, 0.1); font-size: 14.5px; }
.tc-live .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(31, 174, 91, 0.6); animation: livePulse 1.6s infinite; flex: none; }
@keyframes livePulse { 70% { box-shadow: 0 0 0 8px rgba(31, 174, 91, 0); } 100% { box-shadow: 0 0 0 0 rgba(31, 174, 91, 0); } }
@media (prefers-reduced-motion: reduce) { .tc-live .dot { animation: none; } }
.send-panel.is-sent { border-color: var(--green); background: rgba(31, 174, 91, 0.06); }
.send-panel.is-sent #sendBtn { display: none; }
@media (max-width: 600px) { .hero-cta .join-hero { margin: 8px 0 0; } }
.hero-cta .join-hero { color: #fff; background: rgba(255, 255, 255, 0.1); border: 1.5px solid rgba(255, 255, 255, 0.4); }
.hero-cta .join-hero:hover { background: rgba(255, 255, 255, 0.18); }
