/* Ôn tập — mobile first. Written for a 360px phone; wider screens only get a
   centred column and a little more air. */
:root {
  --bg: #0e0e10;
  --surface: #161618;
  --card: #1c1c20;
  --card-2: #232328;
  --line: #34343a;
  --line-soft: #2a2a2f;
  --text: #f4f0e8;
  --soft: #a8a29a;
  --accent: #ff7a00;
  --gold: #ffb326;
  --on: #120c06;
  --ok: #34d399;
  --bad: #f87171;
  --cyan: #38bdf8;
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
  --r: 20px;
  --tap: 48px;
  --pad: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--font);
  overflow-x: clip;
}
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, p { margin: 0; }

.ot-bg {
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 360px at 85% -5%, rgba(255, 122, 0, 0.22), transparent 70%),
    radial-gradient(520px 320px at -10% 30%, rgba(56, 189, 248, 0.10), transparent 70%),
    radial-gradient(500px 300px at 60% 110%, rgba(255, 179, 38, 0.10), transparent 70%);
}

/* ------------------------------------------------------------ top bar -- */
.ot-top {
  position: sticky; top: 0; z-index: 20;
  padding-top: var(--safe-t);
  background: var(--top-bg);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-bottom: 1px solid var(--line-soft);
}
.ot-top-in {
  max-width: 680px; margin: 0 auto; height: 56px; padding: 0 var(--pad);
  display: flex; align-items: center; justify-content: space-between;
}
.ot-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.1; text-decoration: none; color: var(--text); font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em; }
.ot-brand .ee { color: var(--gold); }
.ot-brand small { font-size: 0.78rem; font-weight: 700; color: var(--soft); letter-spacing: 0.08em; text-transform: uppercase; }
.ot-chip {
  min-height: 38px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card);
  font-weight: 700; font-size: 0.9rem; color: var(--gold);
  display: inline-flex; align-items: center; gap: 6px;
}
.ot-chip:active { transform: scale(0.97); }
.ot-chip.off { color: var(--text); border-color: rgba(255, 122, 0, 0.5); background: rgba(255, 122, 0, 0.12); }

.ot-main { max-width: 680px; margin: 0 auto; padding: 18px var(--pad) calc(96px + var(--safe-b)); }

/* ------------------------------------------------------------- generic -- */
.ot-h { font-size: 1.15rem; font-weight: 800; margin: 26px 0 12px; display: flex; align-items: center; justify-content: space-between; }
.ot-h:first-child { margin-top: 0; }
.ot-lead { color: var(--soft); font-size: 0.95rem; }
.ot-muted { color: var(--soft); }
.ot-err { color: var(--bad); margin: 8px 0; font-size: 0.92rem; }
.ot-btn {
  min-height: var(--tap); padding: 0 22px; border: 0; border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--gold)); color: var(--on);
  font-weight: 700; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 8px 24px rgba(255, 122, 0, 0.28);
  transition: transform 0.12s, box-shadow 0.2s, opacity 0.2s;
}
.ot-btn:active { transform: scale(0.97); }
.ot-btn[disabled] { opacity: 0.55; box-shadow: none; }
.ot-btn.sm { min-height: 40px; padding: 0 16px; border-radius: 12px; font-size: 0.92rem; }
.ot-btn.ghost { background: var(--card-2); color: var(--text); box-shadow: none; border: 1px solid var(--line); }
.ot-btn.block { width: 100%; }
.ot-link { background: none; border: 0; color: var(--soft); text-decoration: underline; padding: 8px 4px; min-height: 40px; }

/* --------------------------------------------------------------- hero -- */
.ot-hero { padding: 6px 0 4px; }
.ot-hero h1 { font-size: clamp(1.55rem, 6.4vw, 2.1rem); font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; }
.ot-hero h1 em { font-style: normal; background: linear-gradient(135deg, var(--accent), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ot-hero p { margin-top: 8px; }

/* ------------------------------------------------------ your subjects -- */
.ot-shelf { display: flex; gap: 14px; overflow-x: auto; padding: 4px var(--pad) 14px; margin: 0 calc(var(--pad) * -1); scroll-snap-type: x proximity; scrollbar-width: none; }
.ot-shelf::-webkit-scrollbar { display: none; }
.ot-bookwrap { position: relative; flex: none; scroll-snap-align: start; }
.ot-book {
  position: relative; display: flex; width: 150px; height: 190px;
  border: 0; border-radius: 8px 18px 18px 8px; padding: 16px 14px 14px 22px; text-align: left;
  color: #fff; flex-direction: column; justify-content: space-between;
  background: linear-gradient(145deg, var(--c1), var(--c2));
  box-shadow: 0 14px 28px -10px var(--c2), inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  transition: transform 0.18s;
}
.ot-book::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 12px; border-radius: 8px 0 0 8px; background: rgba(0, 0, 0, 0.28); box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.2); }
.ot-book:active { transform: scale(0.97) rotate(-0.4deg); }
.ot-book b { padding-right: 26px; font-size: 1.02rem; line-height: 1.25; font-weight: 800; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ot-book small { display: block; font-size: 0.78rem; opacity: 0.92; line-height: 1.5; }
.ot-del { position: absolute; z-index: 2; right: 8px; top: 8px; width: 32px; height: 32px; line-height: 1; border-radius: 50%; border: 0; background: rgba(0, 0, 0, 0.35); color: #fff; font-size: 1rem; }

/* ------------------------------------------------------------- library -- */
.ot-search { position: relative; display: block; margin-bottom: 12px; }
.ot-search input {
  width: 100%; height: var(--tap); border-radius: 16px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; padding: 0 16px 0 44px;
}
.ot-search input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.ot-search svg { position: absolute; left: 14px; top: 14px; width: 20px; height: 20px; color: var(--soft); }
.ot-tags { display: flex; gap: 8px; overflow-x: auto; margin: 0 calc(var(--pad) * -1) 14px; padding: 0 var(--pad); scrollbar-width: none; }
.ot-tags::-webkit-scrollbar { display: none; }
.ot-tag { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--soft); font-size: 0.88rem; font-weight: 600; }
.ot-tag[aria-pressed="true"] { background: rgba(255, 122, 0, 0.18); border-color: var(--accent); color: var(--gold); }

.ot-item { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--r); padding: 14px; margin-bottom: 12px; animation: rise 0.35s both; }
.ot-cover { flex: none; width: 52px; height: 64px; border-radius: 6px 12px 12px 6px; background: linear-gradient(145deg, var(--c1), var(--c2)); box-shadow: inset 5px 0 0 rgba(0, 0, 0, 0.25), 0 8px 16px -8px var(--c2); }
.ot-item-body { flex: 1; min-width: 0; }
.ot-item h3 { font-size: 1rem; font-weight: 700; line-height: 1.3; }
.ot-meta { color: var(--soft); font-size: 0.82rem; margin-top: 2px; display: flex; flex-wrap: wrap; gap: 2px 10px; }
.ot-hash { color: var(--gold); font-size: 0.78rem; margin-top: 4px; }

/* ------------------------------------------------------------- skeleton -- */
.ot-skel { display: grid; gap: 12px; }
.ot-skel i { display: block; height: 92px; border-radius: var(--r); background: linear-gradient(90deg, var(--card) 25%, var(--card-2) 50%, var(--card) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ----------------------------------------------------------------- quiz -- */
.ot-qcard { background: linear-gradient(180deg, var(--card), var(--surface)); border: 1px solid var(--line-soft); border-radius: 24px; padding: 20px 18px; animation: rise 0.3s both; }
.ot-qno { display: inline-block; font-size: 0.78rem; font-weight: 700; color: var(--gold); background: rgba(255, 179, 38, 0.12); border-radius: 99px; padding: 2px 10px; margin-bottom: 10px; }
.ot-q { font-size: 1.08rem; line-height: 1.65; overflow-wrap: anywhere; }
.rich pre { background: var(--code); border: 1px solid var(--line-soft); border-radius: 12px; padding: 10px 12px; overflow-x: auto; font-size: 0.9rem; line-height: 1.5; }
.rich code { font-family: ui-monospace, Menlo, Consolas, monospace; background: var(--code); border-radius: 6px; padding: 1px 5px; font-size: 0.92em; }
.rich pre code { background: none; padding: 0; }
.katex-display { overflow-x: auto; overflow-y: hidden; }

.ot-choices { display: grid; gap: 10px; margin-top: 14px; }
.ot-choice {
  display: flex; gap: 14px; align-items: flex-start; width: 100%; text-align: left;
  min-height: 58px; padding: 14px; border-radius: 18px; border: 1.5px solid var(--line);
  background: var(--card); line-height: 1.5; position: relative;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  animation: rise 0.3s both;
}
.ot-choice:nth-child(2) { animation-delay: 0.04s; } .ot-choice:nth-child(3) { animation-delay: 0.08s; } .ot-choice:nth-child(4) { animation-delay: 0.12s; }
.ot-choice:active:not([disabled]) { transform: scale(0.985); }
.ot-choice .k { flex: none; width: 30px; height: 30px; border-radius: 10px; background: var(--card-2); display: grid; place-items: center; font-weight: 800; font-size: 0.9rem; color: var(--gold); transition: background 0.15s, color 0.15s; }
.ot-choice .t { flex: 1; min-width: 0; overflow-wrap: anywhere; padding-top: 3px; }
.ot-choice[disabled] { cursor: default; }
.ot-choice.ok { border-color: var(--ok); background: rgba(52, 211, 153, 0.12); animation: pop 0.35s; }
.ot-choice.ok .k { background: var(--ok); color: #05241a; }
.ot-choice.bad { border-color: var(--bad); background: rgba(248, 113, 113, 0.12); animation: shake 0.35s; }
.ot-choice.bad .k { background: var(--bad); color: #2a0707; }
.ot-choice.dim { opacity: 0.55; }
@keyframes pop { 50% { transform: scale(1.02); } }
@keyframes shake { 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

/* ---- help buttons (Mẹo, Cách giải, Casio) ---- */
.ot-help:empty { display: none; }
.ot-help { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-top: 16px; }
.ot-help .ai {
  min-height: 50px; padding: 0 12px; border-radius: 16px; border: 1.5px solid var(--line);
  background: var(--card); font-weight: 700; font-size: 0.92rem;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.ot-help .ai svg { width: 20px; height: 20px; flex: none; }
.ot-help .ai.tip { color: var(--gold); }
.ot-help .ai[aria-pressed="true"] { background: var(--card-2); }
.ot-help .ai:active { transform: scale(0.97); }
.ot-casio {
  min-height: 50px; padding: 0 14px; border-radius: 16px; border: 1.5px solid var(--line);
  background: var(--card); color: #e5e7eb; font-weight: 700; font-size: 0.92rem; white-space: nowrap;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.ot-casio:active { transform: scale(0.97); }
.ot-casio svg { width: 20px; height: 20px; flex: none; }

.ot-out { margin-top: 14px; display: grid; gap: 12px; }
.ot-note { background: var(--card); border: 1px solid var(--line-soft); border-left: 4px solid var(--c, var(--accent)); border-radius: 16px; padding: 14px 16px; animation: rise 0.3s both; overflow-wrap: anywhere; }
.ot-note h4 { margin: 0 0 6px; font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--c, var(--accent)); }
.ot-note.tip { --c: var(--gold); } .ot-note.solution { --c: var(--cyan); } .ot-note.why { --c: var(--ok); } .ot-note.calc { --c: #9ca3af; background: linear-gradient(180deg, #1f2227, #17191d); }
.ot-note.load { color: var(--soft); }
.ot-dots::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75%, 100% { content: "..."; } }
.ot-steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; counter-reset: s; }
.ot-steps li { counter-increment: s; position: relative; padding-left: 34px; line-height: 1.7; }
.ot-steps li::before { content: counter(s); position: absolute; left: 0; top: 2px; width: 24px; height: 24px; border-radius: 8px; background: #2b2f36; color: #e5e7eb; display: grid; place-items: center; font-size: 0.78rem; font-weight: 800; }
kbd { font: 700 0.78em/1 ui-monospace, Menlo, monospace; color: #e5e7eb; background: linear-gradient(180deg, #3a3f48, #23262c); border: 1px solid #4b5160; border-bottom-width: 3px; border-radius: 7px; padding: 3px 7px; margin: 0 1px; white-space: nowrap; }
.ot-topics { margin-top: 10px; color: var(--soft); font-size: 0.8rem; }


/* --------------------------------------------------------------- result -- */
.ot-res { position: relative; text-align: center; padding: 8px 0 4px; }
.ot-res::before { content: ""; position: absolute; left: 50%; top: -20px; width: 300px; height: 300px; transform: translateX(-50%); border-radius: 50%; filter: blur(70px); opacity: 0.35; background: var(--glow, #ff7a00); z-index: -1; }
.ot-res.great { --glow: #34d399; } .ot-res.ok { --glow: #ff7a00; } .ot-res.low { --glow: #f87171; }
.ot-ring { position: relative; width: 168px; height: 168px; margin: 0 auto 10px; }
.ot-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ot-ring circle { fill: none; stroke-width: 13; stroke-linecap: round; }
.ot-ring .bg { stroke: var(--card-2); }
.ot-ring .fg { stroke-dasharray: 440; stroke-dashoffset: 440; transition: stroke-dashoffset 1.1s cubic-bezier(0.2, 0.8, 0.2, 1); }
.ot-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.3rem; font-weight: 800; line-height: 1; }
.ot-ring b small { display: block; margin-top: 6px; font-size: 0.85rem; font-weight: 600; color: var(--soft); }
.ot-res-title { font-size: 1.5rem; font-weight: 800; margin: 0 0 12px; }
.ot-stats { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.ot-stats .st { display: inline-flex; align-items: center; gap: 5px; min-height: 34px; padding: 0 14px; border-radius: 999px; font-weight: 700; font-size: 0.95rem; background: var(--card); border: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; }
.ot-stats .st svg { width: 16px; height: 16px; color: var(--soft); }
.ot-stats .ok { color: var(--ok); } .ot-stats .bad { color: var(--bad); } .ot-stats .skip { color: var(--soft); }
.ot-res-actions { display: grid; gap: 10px; margin: 22px 0 8px; }
.ot-res-actions .two { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }
.ot-badge { display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; margin-left: 8px; border-radius: 999px; background: rgba(248, 113, 113, 0.18); color: var(--bad); font-size: 0.85rem; }

/* review cards */
.ot-rv { background: var(--card); border: 1px solid var(--line-soft); border-radius: 18px; margin-bottom: 10px; overflow: hidden; }
.ot-rv summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; min-height: 56px; }
.ot-rv summary::-webkit-details-marker { display: none; }
.ot-rv .no { flex: none; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; background: var(--card-2); color: var(--gold); font-weight: 800; font-size: 0.82rem; }
.ot-rv .sum-text { flex: 1; min-width: 0; font-weight: 600; font-size: 0.92rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ot-rv .pair { flex: none; display: inline-flex; align-items: center; gap: 4px; }
.ot-rv .pair i { font-style: normal; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 0.82rem; }
.ot-rv .pair i.bad { background: rgba(248, 113, 113, 0.2); color: var(--bad); }
.ot-rv .pair i.ok { background: rgba(52, 211, 153, 0.2); color: var(--ok); }
.ot-rv .pair em { font-style: normal; color: var(--soft); font-size: 0.8rem; }
.ot-rv[open] .sum-text { display: none; }
.ot-rv[open] summary { justify-content: space-between; }
.ot-rv .body { padding: 0 14px 14px; display: grid; gap: 12px; min-width: 0; }
.ot-rv-q { font-weight: 600; line-height: 1.6; overflow-wrap: anywhere; }
.ot-minis { display: grid; gap: 8px; }
.ot-mini { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line-soft); font-size: 0.92rem; line-height: 1.5; min-width: 0; }
.ot-mini b { flex: none; width: 22px; height: 22px; border-radius: 7px; background: var(--card-2); color: var(--gold); display: grid; place-items: center; font-size: 0.78rem; }
.ot-mini span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ot-mini.ok { border-color: var(--ok); background: rgba(52, 211, 153, 0.1); }
.ot-mini.ok b { background: var(--ok); color: #05241a; }
.ot-mini.bad { border-color: var(--bad); background: rgba(248, 113, 113, 0.1); }
.ot-mini.bad b { background: var(--bad); color: #2a0707; }
.confetti { position: fixed; top: -12px; width: 9px; height: 14px; border-radius: 2px; z-index: 40; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: 0.9; } }

/* --------------------------------------------------------- sheet, toast -- */
.ot-sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.ot-sheet-wrap[hidden], .ot-toast[hidden] { display: none; }
.ot-scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); animation: fade 0.2s both; }
.ot-sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 92%; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border: 1px solid var(--line); border-bottom: 0;
  border-radius: 28px 28px 0 0; padding: 10px 20px calc(24px + var(--safe-b));
  animation: slide 0.28s cubic-bezier(0.2, 0.9, 0.2, 1) both;
}
.ot-sheet::before { content: none; }
.ot-sheet h2 { font-size: 1.25rem; font-weight: 800; margin-bottom: 6px; }
.ot-sheet .ot-lead { margin-bottom: 14px; }
@media (min-width: 640px) { .ot-sheet-wrap { align-items: center; } .ot-sheet { border-radius: 28px; border-bottom: 1px solid var(--line); } }
@keyframes slide { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.ot-field { width: 100%; height: var(--tap); border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: 600 1rem var(--font); letter-spacing: 0.04em; padding: 0 14px; margin-bottom: 12px; }
.ot-field:focus { outline: 2px solid var(--accent); border-color: transparent; }
.ot-seg { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 18px; }
.ot-seg button { min-height: 44px; padding: 0 16px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); font-weight: 600; }
.ot-seg button[aria-pressed="true"] { border-color: var(--accent); background: rgba(255, 122, 0, 0.16); color: var(--gold); }
.ot-label { font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--soft); font-weight: 700; }
.ot-toast { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); z-index: 60; background: #2a2a30; border: 1px solid var(--line); border-radius: 14px; padding: 10px 16px; font-size: 0.9rem; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: rise 0.2s both; max-width: calc(100vw - 32px); }

@media (min-width: 720px) {
  .ot-main { padding-top: 28px; }
  .ot-choices { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

.still *, .still *::before { animation: none !important; }

/* ---- add to home screen ---- */
.ot-install {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; margin: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 44px calc(10px + var(--safe-b)) 14px;
  border: 0; border-top: 1px solid rgba(255, 122, 0, 0.5); border-radius: 0;
  background: linear-gradient(135deg, rgba(60, 32, 8, 0.96), rgba(28, 24, 20, 0.96));
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  animation: slide-up 0.3s both;
}
@keyframes slide-up { from { transform: translateY(100%); } }
.ot-install-ico { flex: none; width: 38px; height: 38px; border-radius: 12px; background: linear-gradient(135deg, var(--accent), var(--gold)); color: var(--on); display: grid; place-items: center; }
.ot-install-ico svg { width: 22px; height: 22px; }
.ot-install-txt { flex: 1; min-width: 0; line-height: 1.35; }
.ot-install-txt b { display: block; font-size: 0.88rem; line-height: 1.3; }
.ot-install-txt span { display: block; color: var(--soft); font-size: 0.8rem; margin-top: 2px; }
.ot-install-x { position: absolute; top: 50%; right: 6px; margin-top: -16px; width: 32px; height: 32px; border: 0; background: none; color: var(--soft); border-radius: 50%; }
.ot-howto { margin: 4px 0 20px; padding: 0; list-style: none; counter-reset: h; display: grid; gap: 12px; }
.ot-howto li { counter-increment: h; position: relative; padding-left: 40px; line-height: 1.6; }
.ot-howto li::before { content: counter(h); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 10px; background: rgba(255, 122, 0, 0.18); color: var(--gold); display: grid; place-items: center; font-weight: 800; font-size: 0.9rem; }
.ot-ico-inline { display: inline-block; vertical-align: -5px; width: 22px; height: 22px; color: var(--cyan); }
.ot-ico-inline svg { width: 100%; height: 100%; }

/* ---- long formulas must scroll inside their box, never widen the page ---- */
.ot-main, .ot-out, .ot-choices, .ot-help, .ot-qcard { min-width: 0; }
.ot-out, .ot-choices, .ot-help, .ot-qcard { max-width: 100%; }
.ot-out > *, .ot-choices > *, .ot-note, .ot-wrong, .ot-wrong .body, .ot-q, .ot-choice .t { min-width: 0; max-width: 100%; }
.ot-note, .ot-qcard, .ot-wrong { overflow-x: auto; overscroll-behavior-x: contain; }
.rich .katex-display { margin: 0.6em 0; max-width: 100%; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; }
.rich .katex { max-width: 100%; }
.rich .pgap { display: block; height: 0.55em; }


/* close button shared by every bottom sheet */
.ot-sheet-x { position: absolute; top: 12px; right: 12px; z-index: 2; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--card-2); color: var(--text); font-size: 1rem; line-height: 1; display: grid; place-items: center; }
.ot-sheet-x:active { transform: scale(0.94); }
.ot-sheet h2 { padding-right: 36px; }

/* ---- developer card and donate sheet ---- */
.ot-dev { margin-top: 28px; padding: 18px; border-radius: 22px; border: 1px solid transparent;
  background: linear-gradient(var(--card), var(--card)) padding-box, linear-gradient(135deg, var(--accent), var(--gold)) border-box; animation: rise 0.35s both; }
.ot-dev-top { display: flex; align-items: center; gap: 12px; }
.ot-dev-av { flex: none; width: 46px; height: 46px; border-radius: 16px; display: grid; place-items: center; font-weight: 800; font-size: 1.2rem; color: var(--on); background: linear-gradient(135deg, var(--accent), var(--gold)); box-shadow: 0 8px 20px -8px var(--accent); }
.ot-dev-who b { display: block; font-size: 1.05rem; line-height: 1.2; }
.ot-dev-who span { display: block; font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft); margin-top: 2px; }
.ot-dev-bio { margin: 12px 0 0; color: var(--soft); font-size: 0.92rem; line-height: 1.55; }
.ot-dev-actions { display: flex; gap: 8px; margin-top: 12px; }
.ot-dev-actions .ot-btn { text-decoration: none; min-height: 34px; padding: 0 14px; border-radius: 11px; font-size: 0.85rem; gap: 6px; }
.ot-dev-actions svg { width: 15px; height: 15px; }
.ot-dev-actions a.ot-btn { flex: 1; min-height: 40px; }
.ot-dev-actions .heart { flex: none; }
.ot-btn.heart { background: linear-gradient(135deg, #fb7185, #ff7a00); color: #fff; box-shadow: 0 8px 24px rgba(251, 113, 133, 0.3); }
.ot-btn.heart svg { animation: beat 1.6s ease-in-out infinite; }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.2); } 30% { transform: scale(1); } 45% { transform: scale(1.14); } }
.ot-qr { display: grid; place-items: center; margin: 4px 0 12px; }
.ot-qr img { width: auto; max-width: min(260px, 72vw); height: auto; max-height: 44vh; object-fit: contain; background: #fff; border-radius: 20px; padding: 10px; box-shadow: 0 14px 34px -12px rgba(0, 0, 0, 0.6); }
.ot-qr-info-old { text-align: center; color: var(--soft); font-size: 0.88rem; margin: 0 0 14px; overflow-wrap: anywhere; }

.ot-dev-av.logo { background: #fff; padding: 8px; box-shadow: 0 8px 20px -8px rgba(255, 45, 61, 0.55); }
.ot-dev-av.logo img { display: block; width: 100%; height: 100%; object-fit: contain; }

/* Donate sheet: one centred column, a glowing heart, the QR and the number. */
.ot-don { display: grid; justify-items: center; text-align: center; gap: 6px; }
.ot-don-heart { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; color: var(--on); background: linear-gradient(135deg, var(--accent), var(--gold)); box-shadow: 0 0 0 7px rgba(255, 122, 0, 0.12), 0 12px 32px -8px rgba(255, 122, 0, 0.6); }
.ot-don-heart svg { width: 26px; height: 26px; }
.ot-don h2 { margin: 8px 0 0; }
.ot-don h2 em { font-style: normal; background: linear-gradient(135deg, var(--accent), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ot-don .ot-lead { margin: 0 0 6px; }
.ot-don .ot-qr img { box-shadow: 0 0 0 1px rgba(255, 179, 38, 0.5), 0 16px 40px -12px rgba(255, 122, 0, 0.55); }
.ot-don-who { margin: 2px 0 0; color: var(--soft); font-size: 0.85rem; }
.ot-don-num { margin: 0 0 8px; font-size: 1.35rem; font-weight: 800; letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }

/* Donate QR: the bundled image, square, on its own white card. */
.ot-qr img { width: min(240px, 66vw); height: auto; max-height: none; aspect-ratio: 1; padding: 10px; }

/* Donate sheet: everything centred on the sheet itself. */
.ot-don { padding-top: 6px; }
.ot-don h2, .ot-don .ot-lead { padding-right: 0; text-align: center; }
.ot-sheet { padding-top: 18px; }

/* ================================================================== quiz ==
   One screen, mobile first. Wide screens (900px+) get two panels: the question and
   choices on the left, the help on the right. Everything about the quiz screen lives here. */

:root { --wide: 900px; --quiz-max: 1560px; --fab: 56px; --fab-lane: 84px; --bar-solid: rgba(14, 14, 16, 0.98); --float: rgba(20, 20, 24, 0.92); --code: #0b0b0d; --track: rgba(255, 255, 255, 0.12); --top-bg: rgba(14, 14, 16, 0.72); --shade: rgba(0, 0, 0, 0.45); }

/* The page's top bar gives way to the quiz bar. */
.in-quiz .ot-top { display: none; }
body.in-quiz { overscroll-behavior-y: none; }
.in-quiz .ot-choice { min-height: 54px; padding: 12px 14px; }
.in-quiz .ot-main { padding-top: calc(16px + var(--safe-t)); }

/* --- HUD: the countdown, the question ring and the exit, as small circles --- */
.ot-hud {
  position: sticky; top: 0; z-index: 14; display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  margin: 0 calc(var(--pad) * -1) 6px; padding: calc(6px + var(--safe-t)) var(--pad) 6px; gap: 6px;
  background: transparent; box-shadow: none; pointer-events: none;
}
.ot-hud > * { pointer-events: auto; }
.ot-x { order: -1; margin-right: auto; flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); font-size: 0.95rem; line-height: 1; }
.ot-x:hover { border-color: var(--soft); }

/* the countdown: a ring that empties, the time in the middle */
.ot-timer, .ot-qring {
  position: relative; flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
  background: var(--float); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), inset 0 0 0 1px var(--line);
  font-variant-numeric: tabular-nums; color: var(--text);
}
.ot-timer svg, .ot-qring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ot-timer circle { fill: none; stroke-width: 4; }
.ot-timer .tr { stroke: var(--track); }
.ot-timer .fg { stroke: var(--gold); stroke-linecap: round; transition: stroke-dashoffset 1s linear, stroke 0.3s; }
.ot-timer b { position: relative; display: flex; flex-direction: column; align-items: center; font-size: 0.64rem; font-weight: 700; line-height: 1.05; letter-spacing: -0.01em; }
.ot-timer .pz svg { position: static; width: 9px; height: 9px; transform: none; }
.ot-timer.urgent .fg { stroke: var(--bad); }
.ot-timer.urgent b { color: var(--bad); animation: pulse 1.2s ease-in-out infinite; }
.ot-timer.paused .fg { stroke: var(--soft); }
.ot-timer.paused b { color: var(--gold); }
@keyframes pulse { 50% { opacity: 0.55; } }

/* the question ring: one arc per question */
.ot-qring path, .ot-qring circle { fill: none; stroke-width: 3.6; stroke-linecap: round; stroke: var(--track); transition: stroke 0.25s; }
.ot-qring path.ok { stroke: var(--ok); }
.ot-qring path.bad { stroke: var(--bad); }
.ot-qring path.cur { stroke: var(--gold); }
.ot-qring path.ok.cur { stroke: var(--ok); }
.ot-qring path.bad.cur { stroke: var(--bad); }
.ot-qring .fg { stroke: var(--gold); }
.ot-qring b { position: relative; font-size: 0.74rem; font-weight: 800; line-height: 1; }
.ot-qring small { font-size: 0.54rem; font-weight: 600; color: var(--soft); }

/* smaller while help is on screen */
.has-out .ot-timer, .has-out .ot-qring, .has-out .ot-hint { width: 36px; height: 36px; }
.has-out .ot-timer b { font-size: 0.58rem; }
.has-out .ot-qring b { font-size: 0.68rem; }
.has-out .ot-hud { padding-top: calc(4px + var(--safe-t)); padding-bottom: 4px; margin-bottom: 4px; }

/* --- full screen: a floating round button on every screen (inside the HUD during a quiz) --- */
.ot-fs {
  position: fixed; z-index: 16; right: 14px; bottom: calc(14px + var(--safe-b)); width: 44px; height: 44px; border-radius: 50%; border: 0;
  display: grid; place-items: center; color: var(--soft); background: var(--float);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45), inset 0 0 0 1px var(--line); cursor: pointer;
}
.ot-fs:hover { color: var(--text); }
.ot-fs svg { width: 20px; height: 20px; }
.ot-fs .i-off, .is-fs .ot-fs .i-on { display: none; }
.is-fs .ot-fs .i-off { display: block; }
.no-fs .ot-fs { display: none !important; }
.in-quiz > .ot-fs { display: none; }
.ot-hud .ot-fs { position: static; flex: none; width: 34px; height: 34px; box-shadow: none; border: 1px solid var(--line); background: var(--card); }
.ot-hint {
  position: relative; flex: none; width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; cursor: pointer;
  background: var(--float); color: var(--gold); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.ot-hint svg { width: 20px; height: 20px; }
.ot-hint.nudge { border-color: var(--gold); box-shadow: 0 0 0 0 rgba(255, 179, 38, 0.55), 0 6px 18px rgba(0, 0, 0, 0.45); animation: hint-nudge 1.6s ease-out infinite; }
.ot-hint.nudge svg { animation: hint-wiggle 1.6s ease-in-out infinite; transform-origin: 50% 80%; }
@keyframes hint-nudge { 0% { box-shadow: 0 0 0 0 rgba(255, 179, 38, 0.55), 0 6px 18px rgba(0, 0, 0, 0.45); } 70%, 100% { box-shadow: 0 0 0 14px rgba(255, 179, 38, 0), 0 6px 18px rgba(0, 0, 0, 0.45); } }
@keyframes hint-wiggle { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-14deg) scale(1.12); } 80% { transform: rotate(12deg) scale(1.12); } 90% { transform: rotate(-6deg); } }
@media (prefers-reduced-motion: reduce) { .ot-hint.nudge, .ot-hint.nudge svg { animation: none; } }
.ot-hint:active { transform: scale(0.94); }
.ot-hint.spent { opacity: 0.55; }
.ot-hint[aria-pressed="true"] { background: var(--card-2); }
.ot-hint-n { position: absolute; top: -3px; right: -3px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; display: grid; place-items: center; font-size: 0.62rem; color: var(--on); background: var(--gold); }
.ot-hint-n[hidden] { display: none; }
.ot-hud .ot-fs svg { width: 16px; height: 16px; }
.ot-hud .ot-x { order: -2; margin-right: 0; }
.ot-hud .ot-fs { order: -1; margin-right: auto; }

/* --- layout: stacked on a phone; the help panel is the part under the buttons --- */
.ot-left, .ot-right { min-width: 0; }
.ot-right { align-content: start; grid-auto-rows: max-content; }
.ot-right:empty, #ot-why:empty { display: none; }
#ot-why { margin-top: 14px; }
.ot-qno { font-size: 0.7rem; color: var(--soft); background: transparent; border: 1px solid var(--line); }
.ot-help .ai.spent { opacity: 0.55; }
.ot-keys { display: none; margin: 10px 0 0; font-size: 0.78rem; color: var(--soft); }
/* On a phone the help comes under the buttons, so its empty prompt is not shown at all. */
@media (max-width: 899px) { .ot-ph, .ot-right:has(> .ot-ph:only-child) { display: none; } }
.ot-ph-ic svg { width: 22px; height: 22px; }
.ot-keys kbd, .ot-ph kbd { font: inherit; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--card-2); border: 1px solid var(--line); color: var(--text); }

/* --- "Câu tiếp": a round floating button, bottom right --- */
.ot-fab-wrap { position: fixed; z-index: 15; right: 16px; bottom: calc(16px + var(--safe-b)); display: flex; align-items: center; gap: 10px; }
.ot-fab {
  flex: none; width: var(--fab); height: var(--fab); border-radius: 50%; border: 0; display: grid; place-items: center; color: var(--on); cursor: pointer;
  background: linear-gradient(135deg, var(--accent), var(--gold)); box-shadow: 0 10px 26px -6px rgba(255, 122, 0, 0.65); animation: pop 0.35s both;
}
.ot-fab svg { width: 26px; height: 26px; }
.ot-fab:hover { filter: brightness(1.08); }
.ot-fab:active { transform: scale(0.94); }
/* --- wide screens: two panels from the first question; the page stays put, each panel scrolls --- */
@media (min-width: 900px) {
  body.in-quiz { overflow: hidden; }
  .in-quiz .ot-main { max-width: var(--quiz-max); height: 100dvh; display: flex; flex-direction: column; padding: 14px 76px 0; }
  .in-quiz .ot-qcard { padding: 18px 20px; border-radius: 20px; }
  .in-quiz .ot-q { font-size: 1.04rem; line-height: 1.6; }

  .ot-timer, .ot-qring, .ot-hint { width: 48px; height: 48px; }
  .ot-timer b { font-size: 0.72rem; }
  .ot-qring b { font-size: 0.82rem; }
  .ot-qring small { font-size: 0.6rem; }
  .has-out .ot-timer, .has-out .ot-qring, .has-out .ot-hint { width: 42px; height: 42px; }
  .has-out .ot-timer b { font-size: 0.64rem; }
  .has-out .ot-qring b { font-size: 0.74rem; }
  .ot-x { width: 34px; height: 34px; }
  .ot-help-close { display: none; }
  .ot-hud {
    position: fixed; top: 12px; right: 12px; left: auto; margin: 0; padding: 0; flex-direction: column; justify-content: flex-start; align-items: center; gap: 8px;
    background: none; box-shadow: none;
  }
  .ot-hud .ot-x { order: -2; margin: 0; }
  .ot-hud .ot-fs { order: -1; margin: 0; }
  .has-out .ot-hud { padding: 0; margin: 0; }
  .ot-fab-wrap { right: 24px; bottom: 24px; }

  .in-quiz .ot-split {
    flex: 1; min-height: 0; display: grid; gap: 20px; padding-bottom: 14px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr);
  }
  .in-quiz .ot-left, .in-quiz .ot-right { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: 8px; scrollbar-width: thin; }
  .in-quiz .ot-left { padding-bottom: 8px; }
  .in-quiz .ot-right { margin-top: 0; }
  /* only the right panel keeps room for the floating button, so the left one reaches the bottom */
  .in-quiz:has(.ot-fab-wrap) .ot-right > :last-child { margin-bottom: var(--fab-lane); }

  .ot-right .ot-note { padding: 12px 16px; border-radius: 14px; }
  .ot-right .ot-note .rich { font-size: 0.97rem; line-height: 1.6; }

  /* the shortcuts: a small floating chip, bottom left (mouse and keyboard screens only) */
  .ot-keys {
    display: block; position: fixed; z-index: 12; left: 16px; bottom: 16px; margin: 0; padding: 6px 12px; border-radius: 999px;
    font-size: 0.68rem; color: var(--soft); white-space: nowrap; pointer-events: none;
    background: var(--float); box-shadow: inset 0 0 0 1px var(--line), 0 4px 14px rgba(0, 0, 0, 0.4);
  }
  .ot-keys kbd { padding: 0 5px; border-radius: 5px; font-size: 0.66rem; }
  .in-quiz .ot-left { padding-bottom: 52px; }
  .ot-ph {
    height: 100%; min-height: 220px; display: grid; align-content: center; justify-items: center; gap: 10px; text-align: center; padding: 28px 24px;
    border: 1.5px dashed var(--line); border-radius: 20px; color: var(--soft);
  }
  .in-quiz .ot-right > .ot-ph:last-child { height: 100%; margin-bottom: 0; }
  .in-quiz:has(.ot-fab-wrap) .ot-right > .ot-ph:last-child { height: calc(100% - var(--fab-lane)); }
  .ot-ph-ic { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); color: var(--gold); }
  .ot-ph-ic svg { width: 22px; height: 22px; }
  .ot-ph strong { color: var(--text); font-size: 1rem; }
  .ot-ph p { margin: 0; font-size: 0.9rem; line-height: 1.55; max-width: 34ch; }
}
/* --- phone: the help is a bottom sheet, so the question stays in view above it --- */
.ot-help-close { display: none; }
@media (max-width: 899px) {
  .has-out .ot-right {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 13; height: 46dvh; margin: 0; overflow-y: auto; overscroll-behavior: contain;
    padding: 12px var(--pad) calc(16px + var(--safe-b)); background: var(--surface); border-radius: 22px 22px 0 0;
    box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.55), inset 0 1px 0 var(--line); animation: rise 0.25s both;
  }
  .has-out .ot-main { padding-bottom: calc(46dvh + 16px); }
  .has-out .ot-fab-wrap { bottom: calc(46dvh + 12px + var(--safe-b)); }
  .has-out .ot-help-close {
    display: grid; place-items: center; position: sticky; top: 0; z-index: 2; margin: 0 0 6px auto; width: 30px; height: 30px; border-radius: 50%;
    border: 1px solid var(--line); background: var(--card-2); color: var(--text); font-size: 0.85rem; line-height: 1;
  }
}
@media (hover: none) { .ot-keys { display: none !important; } }
@media (prefers-reduced-motion: reduce) { .ot-timer.urgent b { animation: none; } .ot-timer .fg { transition: none; } }

/* --- HUD: every button is the same fixed size, whatever is open --- */
.ot-hud { --hud: 40px; }
@media (min-width: 900px) { .ot-hud { --hud: 46px; } }
.ot-hud > .ot-timer, .ot-hud > .ot-qring, .ot-hud > .ot-hint, .ot-hud > .ot-x, .ot-hud > .ot-fs,
.has-out .ot-hud > .ot-timer, .has-out .ot-hud > .ot-qring, .has-out .ot-hud > .ot-hint {
  width: var(--hud); height: var(--hud); min-width: var(--hud); flex: none; padding: 0; margin: 0; border-radius: 50%;
}
.ot-hud > .ot-x, .ot-hud > .ot-fs { display: grid; place-items: center; border: 1px solid var(--line); background: var(--float); color: var(--text); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45); }
.ot-hud > .ot-fs { color: var(--soft); }
.ot-hud > .ot-x { font-size: 1rem; }
.ot-hud .ot-fs svg, .ot-hud .ot-hint svg { width: 20px; height: 20px; }
.ot-hud > .ot-timer b, .has-out .ot-hud > .ot-timer b { font-size: 0.66rem; }
.ot-hud > .ot-qring b, .has-out .ot-hud > .ot-qring b { font-size: 0.78rem; }
.ot-hud > .ot-qring small { font-size: 0.56rem; }

.ot-hud > .ot-x { background: var(--bad); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(248, 113, 113, 0.35); }
.ot-hud > .ot-x:hover { filter: brightness(1.1); border-color: transparent; }

/* the empty help prompt is not shown; the right panel simply stays free until a hint is asked */
.ot-ph { display: none !important; }

/* wide screens, no help yet: one centred column; the right panel opens with the first hint */
@media (min-width: 900px) {
  body.in-quiz:not(.has-out) .ot-split { grid-template-columns: minmax(0, 860px); justify-content: center; }
  body.in-quiz:not(.has-out) .ot-right { display: none; }
}

.ot-hint[hidden] { display: none; }

/* wide screens: close and full screen float at the top left, the rest stay at the top right */
@media (min-width: 900px) {
  .ot-hud > .ot-x, .ot-hud > .ot-fs { position: fixed; left: 12px; right: auto; order: 0; }
  .ot-hud > .ot-x { top: 12px; }
  .ot-hud > .ot-fs { top: calc(12px + var(--hud) + 8px); }
}

.ot-calc {
  position: relative; flex: none; display: grid; place-items: center; cursor: pointer; border-radius: 50%; border: 1px solid var(--line);
  background: var(--float); color: var(--text); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.ot-calc:active { transform: scale(0.94); }
.ot-calc[aria-pressed="true"] { background: var(--card-2); border-color: var(--gold); }
.ot-hud > .ot-calc { width: var(--hud); height: var(--hud); min-width: var(--hud); padding: 0; margin: 0; }
.ot-hud .ot-calc svg { width: 20px; height: 20px; }

/* phone: close and full screen on the left of the HUD row, the rest on the right */
@media (max-width: 899px) {
  .ot-hud > .ot-x { order: -2; }
  .ot-hud > .ot-fs { order: -1; margin-right: auto; }
}

/* --- light theme (the dark one is the default) --- */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f3ec; --surface: #ffffff; --card: #ffffff; --card-2: #efeae0; --line: #d8d1c3; --line-soft: #e5dfd2;
  --text: #1f1b14; --soft: #6a6357; --gold: #b86e00; --ok: #059669; --bad: #dc2626; --cyan: #0284c7;
  --bar-solid: rgba(246, 243, 236, 0.98); --float: rgba(255, 255, 255, 0.94); --code: #f1ece1; --track: rgba(0, 0, 0, 0.1);
  --top-bg: rgba(246, 243, 236, 0.8); --shade: rgba(60, 40, 10, 0.18);
}
:root[data-theme="light"] .ot-bg {
  background:
    radial-gradient(600px 360px at 85% -5%, rgba(255, 122, 0, 0.14), transparent 70%),
    radial-gradient(520px 320px at -10% 30%, rgba(56, 189, 248, 0.10), transparent 70%);
}
:root[data-theme="light"] .ot-note.calc { background: linear-gradient(180deg, #f3f4f6, #e9ebef); --c: #6b7280; }
:root[data-theme="light"] .ot-steps li::before { background: #e3e6eb; color: #1f2937; }
:root[data-theme="light"] kbd { color: #1f2937; background: linear-gradient(180deg, #ffffff, #e8eaee); border-color: #c4c9d2; }
:root[data-theme="light"] .ot-toast { background: #ffffff; color: var(--text); }
:root[data-theme="light"] .ot-choice, :root[data-theme="light"] .ot-help .ai { color: var(--text); }
:root[data-theme="light"] .ot-hud > .ot-x { color: #fff; }
:root[data-theme="light"] .ot-keys { background: var(--float); }
:root[data-theme="light"] .ot-timer, :root[data-theme="light"] .ot-qring, :root[data-theme="light"] .ot-hint, :root[data-theme="light"] .ot-calc,
:root[data-theme="light"] .ot-fs, :root[data-theme="light"] .ot-theme { box-shadow: 0 6px 18px var(--shade), inset 0 0 0 1px var(--line); }

/* --- the light/dark switch: small, floating bottom right on every page --- */
.ot-theme {
  position: fixed; z-index: 16; right: 66px; bottom: calc(14px + var(--safe-b)); width: 34px; height: 34px; margin: 5px 0 0; border-radius: 50%; border: 0;
  display: grid; place-items: center; color: var(--soft); background: var(--float); cursor: pointer;
  box-shadow: 0 6px 18px var(--shade), inset 0 0 0 1px var(--line);
}
.ot-theme:hover { color: var(--text); }
.ot-theme svg { width: 18px; height: 18px; }
.ot-theme .i-sun { display: none; }
:root[data-theme="light"] .ot-theme .i-sun { display: block; }
:root[data-theme="light"] .ot-theme .i-moon { display: none; }
.no-fs .ot-theme, .in-quiz .ot-theme { right: 14px; margin: 0; }
.in-quiz .ot-fab-wrap { bottom: calc(60px + var(--safe-b)); }
@media (min-width: 900px) { .in-quiz .ot-fab-wrap { bottom: 64px; } }
@media (max-width: 899px) {
  body.in-quiz.has-out .ot-fab-wrap { bottom: calc(46dvh + 12px + var(--safe-b)); }
  .has-out .ot-theme { display: none; }
}

/* --- the activation code sheet: a little pass card --- */
.ot-pass {
  position: relative; overflow: hidden; margin: 6px 0 14px; padding: 18px 18px 16px; border-radius: 22px; border: 1px solid rgba(255, 179, 38, 0.35);
  background: radial-gradient(260px 160px at 100% 0%, rgba(255, 122, 0, 0.30), transparent 70%), radial-gradient(220px 140px at 0% 100%, rgba(56, 189, 248, 0.14), transparent 70%), var(--card);
  box-shadow: 0 18px 40px -18px rgba(255, 122, 0, 0.5);
}
.ot-pass-top { display: flex; align-items: center; gap: 12px; padding-right: 44px; }
.ot-pass-top h2 { margin: 0; padding: 0; font-size: 1.1rem; }
.ot-pass-top p { margin: 2px 0 0; font-size: 0.78rem; color: var(--ok); font-weight: 700; }
.ot-pass-top p::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.2); vertical-align: 1px; }
.ot-pass-ic { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: var(--on); background: linear-gradient(135deg, var(--accent), var(--gold)); box-shadow: 0 8px 18px -6px rgba(255, 122, 0, 0.7); }
.ot-pass-ic svg { width: 22px; height: 22px; }
.ot-pass-bal { display: flex; align-items: baseline; gap: 8px; margin: 16px 0 12px; }
.ot-pass-bal b { font-size: 2.4rem; line-height: 1; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; background: linear-gradient(135deg, var(--accent), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ot-pass-bal span { color: var(--soft); font-size: 0.9rem; }
.ot-pass-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ot-chip2 { padding: 5px 11px; border-radius: 999px; font-size: 0.76rem; font-weight: 600; color: var(--text); background: var(--card-2); border: 1px solid var(--line); }
.ot-chip2.warn { color: var(--bad); border-color: var(--bad); }
.ot-pass-note { margin: 0 0 14px; color: var(--soft); font-size: 0.86rem; line-height: 1.5; text-align: center; }
.ot-donate { display: flex; align-items: center; justify-content: center; gap: 8px; }
.ot-donate svg { width: 18px; height: 18px; color: #c2185b; animation: beat 1.8s ease-in-out infinite; }
@keyframes beat { 0%, 60%, 100% { transform: scale(1); } 70% { transform: scale(1.25); } 80% { transform: scale(0.95); } 90% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .ot-donate svg { animation: none; } }
:root[data-theme="light"] .ot-pass { box-shadow: 0 18px 40px -22px rgba(255, 122, 0, 0.6); }

/* the brand gradient stays bright in the light theme too (the text gold is darker there) */
:root[data-theme="light"] .ot-btn:not(.ghost):not(.heart), :root[data-theme="light"] .ot-fab, :root[data-theme="light"] .ot-pass-ic {
  background: linear-gradient(135deg, #ff7a00, #ffb326);
}
.ot-actions { display: grid; gap: 10px; justify-items: stretch; }
.ot-actions .ot-link { justify-self: center; margin-top: 2px; }

/* --- developer pill: one slim row at the top of the home screen --- */
.ot-dev { display: flex; align-items: center; gap: 10px; margin: 12px 0 14px; padding: 6px 6px 6px 8px; border-radius: 999px; border: 1px solid var(--line-soft); background: var(--card); box-shadow: 0 10px 28px -16px var(--shade); animation: rise 0.35s both; }
.ot-dev .ot-dev-av { width: 36px; height: 36px; border-radius: 50%; padding: 6px; font-size: 1rem; box-shadow: 0 4px 12px -4px rgba(255, 45, 61, 0.5); }
.ot-dev .ot-dev-who { flex: 1; min-width: 0; line-height: 1.15; }
.ot-dev .ot-dev-who b { font-size: 0.95rem; }
.ot-dev .ot-dev-who span { margin-top: 1px; font-size: 0.64rem; letter-spacing: 0.1em; }
.ot-dev-ic, .ot-dev-love { flex: none; height: 36px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; cursor: pointer; border: 0; font-weight: 700; font-size: 0.85rem; }
.ot-dev-ic { width: 36px; background: var(--card-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.ot-dev-ic svg, .ot-dev-love svg { width: 16px; height: 16px; }
.ot-dev-love { padding: 0 14px; color: #fff; background: linear-gradient(135deg, #fb7185, #ff7a00); box-shadow: 0 6px 16px -6px rgba(251, 113, 133, 0.7); }
.ot-dev-love svg { animation: beat 1.8s ease-in-out infinite; }
.ot-dev-love:active, .ot-dev-ic:active { transform: scale(0.95); }
@media (prefers-reduced-motion: reduce) { .ot-dev-love svg { animation: none; } }

.ot-brand-row { display: flex; align-items: baseline; gap: 8px; }
.ot-by { margin-top: 1px; font-size: 0.812rem; font-weight: 400; letter-spacing: 0.16em; text-transform: uppercase; color: #e5262f; }
.ot-top-r { display: flex; align-items: center; gap: 8px; }
.ot-top-ic { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; border: 0; cursor: pointer; text-decoration: none; color: var(--text); background: var(--card-2); box-shadow: inset 0 0 0 1px var(--line); }
.ot-top-ic svg { width: 17px; height: 17px; }
.ot-top-ic:active { transform: scale(0.94); }
.ot-top-ic.love { color: #fff; border: 0; background: linear-gradient(135deg, #fb7185, #ff7a00); box-shadow: 0 6px 16px -6px rgba(251, 113, 133, 0.7); }
.ot-top-ic.love svg { animation: beat 1.8s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .ot-top-ic.love svg { animation: none; } }
.in-quiz .ot-top { display: none; }

/* practising: no text selection, no long-press menu */
body.in-quiz { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body.in-quiz img, body.in-quiz svg { -webkit-user-drag: none; user-drag: none; }

.ot-inline-link { color: var(--gold); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.ot-inline-link:hover { filter: brightness(1.15); }

/* the two floating switches: same size, stacked (full screen at the bottom, light/dark above it) */
.ot-theme { right: 14px; width: 44px; height: 44px; margin: 0; bottom: calc(14px + 44px + 10px + var(--safe-b)); }
.ot-theme svg { width: 20px; height: 20px; }
.no-fs .ot-theme, .in-quiz .ot-theme { bottom: calc(14px + var(--safe-b)); }

@media (max-width: 600px) { .ot-brand small { display: none; } }

.ot-pass.warn { border-color: rgba(248, 113, 113, 0.45); background: radial-gradient(260px 160px at 100% 0%, rgba(248, 113, 113, 0.22), transparent 70%), var(--card); box-shadow: 0 18px 40px -20px rgba(248, 113, 113, 0.45); }
.ot-pass.warn .ot-pass-ic { color: #fff; background: linear-gradient(135deg, #f87171, #fb923c); box-shadow: 0 8px 18px -6px rgba(248, 113, 113, 0.7); }
.ot-pass.warn .ot-pass-top p { color: var(--bad); }
.ot-pass.warn .ot-pass-top p::before { background: var(--bad); box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.2); }
.ot-pass-why { margin: 14px 0 2px; color: var(--soft); font-size: 0.9rem; line-height: 1.55; }
a.ot-btn { text-decoration: none; display: flex; align-items: center; justify-content: center; }

/* a very small reminder */
.ot-note-ref { margin: 18px 0 0; font-size: 0.66rem; line-height: 1.4; text-align: center; color: var(--soft); opacity: 0.7; }
.in-quiz .ot-note-ref { margin: 10px 0 0; text-align: left; }
@media (min-width: 900px) { .in-quiz .ot-left { padding-bottom: 60px; } }

.ot-ver { margin-left: 0.4em; opacity: 0.7; white-space: nowrap; }
