:root {
  --navy:#123a63; --navy-deep:#082844; --red:#b71c2b; --cream:#fffaf2;
  --paper:#ffffff; --gray:#5b6269; --light:#eef3f7; --gold:#c69a34;
  --green:#1f7a46; --shadow:0 14px 34px rgba(8,40,68,.15);
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
html { scroll-behavior:auto; -webkit-text-size-adjust:100%; text-size-adjust:100%; overflow-anchor:none; }
body { margin:0; min-height:100vh; color:#17212b; background:linear-gradient(160deg,#f5f8fb 0%,#fffaf2 55%,#eef3f7 100%); font-family:Inter,ui-sans-serif,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif; }
button,select,input { font:inherit; font-size:16px; }
button,a,select,input { -webkit-tap-highlight-color:transparent; touch-action:manipulation; }
button { cursor:pointer; }
.skip-link { position:absolute; left:-9999px; top:8px; z-index:1000; background:#fff; color:#000; padding:10px; }
.skip-link:focus { left:8px; }
.topbar { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:14px clamp(16px,3vw,44px); padding-top:max(14px, env(safe-area-inset-top)); background:var(--navy-deep); color:#fff; border-bottom:5px solid var(--red); position:sticky; top:0; z-index:30; box-shadow:0 5px 20px rgba(0,0,0,.18); }
.brand-wrap { display:flex; align-items:center; gap:15px; min-width:0; text-decoration:none; color:inherit; cursor:pointer; }
.brand-logo { width:68px; height:52px; object-fit:contain; background:#fff; border-radius:8px; padding:4px; }
.eyebrow { font-size:.72rem; letter-spacing:.16em; font-weight:900; color:#f3c55b; }
.book-title { font:800 clamp(1rem,2.5vw,1.5rem)/1.15 Georgia,serif; }
.book-subtitle { opacity:.86; font-size:.8rem; margin-top:3px; }
.top-actions { display:flex; align-items:center; gap:8px; flex:none; }
.lang-switch { display:flex; gap:4px; background:rgba(255,255,255,.1); padding:3px; border-radius:10px; }
.lang-switch button { min-width:40px; min-height:36px; border:0; border-radius:8px; background:transparent; color:#fff; font-weight:900; font-size:.82rem; }
.lang-switch button.is-on { background:#fff; color:var(--navy-deep); }
.return-button { flex:none; border:1px solid rgba(255,255,255,.5); background:rgba(255,255,255,.1); color:#fff; padding:11px 15px; border-radius:10px; font-weight:800; }
.return-button:hover { background:#fff; color:var(--navy); }
.lang-pick { display:grid; gap:10px; margin-top:8px; }
.lang-pick button { min-height:52px; border:0; border-radius:12px; background:var(--navy); color:#fff; font-weight:900; font-size:1.05rem; }
main { width:min(1220px,96vw); margin:22px auto 40px; }
.toolbar { display:grid; grid-template-columns:150px 190px minmax(220px,0.9fr) minmax(240px,1.1fr); gap:12px; background:rgba(255,255,255,.92); padding:14px; border:1px solid #cfd9e2; border-radius:14px; box-shadow:0 8px 22px rgba(8,40,68,.08); }
.toolbar-group { display:flex; flex-direction:column; gap:6px; min-width:0; }
.toolbar label { font-size:.75rem; font-weight:900; text-transform:uppercase; color:var(--navy); letter-spacing:.05em; }
.toolbar select,.toolbar input { min-height:42px; border:1px solid #aebdca; border-radius:8px; background:#fff; padding:8px 10px; color:#18232d; }
.jump-row { display:flex; align-items:center; gap:6px; }
.jump-row span { font-weight:900; color:var(--navy); }
.jump-row input { width:64px; }
.jump-row button { min-height:42px; border:0; border-radius:10px; background:var(--navy); color:#fff; font-weight:800; padding:0 12px; box-shadow:0 2px 0 #061525; }
.toolbar small { color:var(--gray); line-height:1.25; }
.speed-row { display:flex; align-items:center; gap:8px; }
.speed-row input[type=range] { flex:1; min-width:0; height:32px; accent-color:var(--navy); }
.speed-row button { width:44px; min-width:44px; min-height:44px; border:1px solid #aebdca; border-radius:8px; background:#fff; color:var(--navy); font-weight:900; font-size:1.25rem; line-height:1; }
.speed-presets { display:flex; gap:6px; }
.speed-presets button { flex:1; min-height:38px; border:1px solid #aebdca; border-radius:8px; background:#fff; color:var(--navy); font-weight:800; font-size:.82rem; }
.speed-presets button.is-on { background:var(--navy); color:#fff; border-color:var(--navy); }
.now-card { background:var(--navy-deep); color:#fff; border-radius:16px; padding:14px 16px 16px; margin:0 0 14px; position:sticky; top:72px; z-index:24; box-shadow:0 10px 28px rgba(8,40,68,.28); border-left:6px solid var(--gold); }
.now-kicker { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:8px; }
.now-kicker strong { font-size:.85rem; letter-spacing:.04em; opacity:.9; }
.now-question { margin:0; font:800 clamp(1.28rem,4vw,1.9rem)/1.28 Georgia,serif; }
.now-translation { margin:8px 0 0; font:italic 1.02rem/1.45 Georgia,serif; opacity:.92; }
.tools-drawer { margin:28px 0 16px; }
.tools-drawer > summary {
  cursor:pointer; list-style:none;
  display:flex; align-items:center; justify-content:center; gap:12px;
  min-height:58px; text-align:center;
  padding:14px 18px; border-radius:12px;
  font-family:inherit; font-weight:800; font-size:1.05rem; line-height:1.3;
  letter-spacing:.01em;
  color:var(--navy-deep);
  background:linear-gradient(180deg,#f6e7b8 0%,#e2c36a 48%,#c69a34 100%);
  border:1.5px solid #8a6418;
  box-shadow:0 3px 0 #5a3e0c, 0 8px 18px rgba(8,40,68,.18), inset 0 1px 0 rgba(255,255,230,.75);
}
.tools-drawer > summary::after {
  content:"";
  width:0; height:0;
  border-left:7px solid transparent;
  border-right:7px solid transparent;
  border-top:8px solid currentColor;
  flex:none;
}
.tools-drawer > summary::-webkit-details-marker { display:none; }
.tools-drawer > summary:active { transform:translateY(2px); box-shadow:0 1px 0 #5a3e0c, inset 0 1px 0 rgba(255,255,230,.5); }
.tools-drawer[open] > summary {
  margin-bottom:10px;
  color:#f6e7b8;
  background:linear-gradient(180deg,#1a4a73 0%,#123a63 50%,#082844 100%);
  border-color:#c69a34;
  box-shadow:0 2px 0 #061525, inset 0 1px 0 rgba(243,197,91,.28);
}
.tools-drawer[open] > summary::after { transform:rotate(180deg); }
.share-drawer { margin:0 0 12px; }
.share-drawer > summary { cursor:pointer; list-style:none; background:#fff; border:1px solid #cfd9e2; border-radius:12px; padding:12px 14px; font-weight:800; color:var(--navy); }
.share-drawer > summary::-webkit-details-marker { display:none; }
.share-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; padding:12px 0; text-align:center; }
.share-grid img { width:min(220px,42vw); height:auto; background:#fff; padding:8px; border:1px solid #d8e0e6; border-radius:12px; }
.share-grid figcaption { font-size:.8rem; margin-top:6px; line-height:1.35; }
.share-grid a { color:var(--navy); font-weight:800; word-break:break-all; }
.install-hint { margin:0; font-size:.82rem; color:#5b6269; line-height:1.4; }
.plane-card {
  display:grid;
  grid-template-columns:92px 1fr;
  gap:14px;
  align-items:center;
  margin:28px 0 8px;
  padding:12px 14px 14px;
  border-radius:18px;
  background:linear-gradient(165deg,#123a63 0%,#1a5a8a 55%,#0d3a66 100%);
  color:#fff;
  box-shadow:0 12px 28px rgba(8,40,68,.22);
  overflow:hidden;
  position:relative;
}
.plane-sky {
  position:relative;
  height:72px;
  border-radius:14px;
  background:linear-gradient(#7ec8e8 0%,#c5e7f7 70%,#eef6fb 100%);
  overflow:hidden;
}
.plane-cloud {
  position:absolute;
  background:#fff;
  border-radius:999px;
  opacity:.9;
  height:10px;
}
.plane-cloud.c1 { width:28px; top:14px; left:8px; animation:cloud-drift 9s linear infinite; }
.plane-cloud.c2 { width:18px; top:36px; left:40px; height:8px; animation:cloud-drift 12s linear infinite reverse; }
.plane-cloud.c3 { width:22px; top:22px; right:6px; animation:cloud-drift 10s linear infinite; }
.plane-svg {
  position:absolute;
  width:52px;
  height:28px;
  left:8px;
  top:22px;
  filter:drop-shadow(0 4px 4px rgba(18,58,99,.25));
  animation:plane-bob 2.4s ease-in-out infinite;
}
.plane-card[data-state="run"] .plane-svg { animation:plane-fly 1.8s linear infinite; }
.plane-card[data-state="done"] .plane-svg { left:42px; animation:none; }
.plane-copy { min-width:0; }
.plane-title { display:block; font:800 1.05rem/1.2 Georgia,serif; letter-spacing:.02em; }
#plane-msg { margin:6px 0 10px; font-size:.88rem; line-height:1.4; opacity:.94; }
.plane-runway {
  height:8px;
  border-radius:999px;
  background:rgba(255,255,255,.22);
  overflow:hidden;
  margin:0 0 10px;
}
#plane-fill {
  height:100%;
  width:0;
  border-radius:inherit;
  background:linear-gradient(90deg,#f3c55b,#fff);
  transition:width .25s ease;
}
.plane-actions { display:flex; gap:8px; flex-wrap:wrap; }
#plane-btn {
  border:0;
  border-radius:999px;
  min-height:42px;
  padding:0 16px;
  font-weight:900;
  background:#f3c55b;
  color:#123a63;
}
.plane-later {
  border:0;
  background:transparent;
  color:#fff;
  font-weight:800;
  text-decoration:underline;
  text-underline-offset:3px;
  min-height:42px;
}
.plane-card[data-state="done"] #plane-btn,
.plane-card[data-state="done"] .plane-later { display:none; }
.plane-card[data-state="done"] { background:linear-gradient(165deg,#1f7a46 0%,#123a63 100%); }
@keyframes plane-bob {
  0%,100% { transform:translateY(0) rotate(-8deg); }
  50% { transform:translateY(-6px) rotate(-4deg); }
}
@keyframes plane-fly {
  0% { left:-8px; transform:translateY(4px) rotate(-12deg); }
  50% { transform:translateY(-4px) rotate(-4deg); }
  100% { left:52px; transform:translateY(2px) rotate(-10deg); }
}
@keyframes cloud-drift {
  from { transform:translateX(-8px); }
  to { transform:translateX(18px); }
}
body.exam-on .plane-card { display:none; }
.progress-section { margin:14px 0; }
.progress-meta { color:var(--navy); font-size:.9rem; }
.spread { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:20px; align-items:stretch; }
.image-page,.text-page { min-height:690px; background:var(--paper); border:1px solid #cbd6df; box-shadow:var(--shadow); border-radius:16px; padding:clamp(18px,2.5vw,30px); position:relative; overflow:hidden; }
.image-page { display:flex; flex-direction:column; justify-content:center; background:#fdfdfc; }
.image-frame { width:100%; aspect-ratio:1/1; display:grid; place-items:center; border:8px solid var(--navy); outline:3px solid var(--red); outline-offset:-12px; background:#fff; padding:8px; box-shadow:8px 8px 0 #dce3e8; }
.image-frame img { width:100%; height:100%; object-fit:contain; }
.image-instruction { text-align:center; color:var(--gray); font-style:italic; margin:24px 0 0; }
.text-page::before { content:""; position:absolute; inset:0 0 auto 0; height:7px; background:linear-gradient(90deg,var(--navy) 0 68%,var(--red) 68%); }
.badges { display:flex; gap:8px; flex-wrap:wrap; margin:4px 0 10px; }
.text-page #q-badge,
.text-page h1,
.text-page .translation {
  position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0;
}
.badge { display:inline-flex; align-items:center; min-height:29px; padding:5px 10px; border-radius:999px; font-weight:900; font-size:.78rem; letter-spacing:.04em; }
.q-badge { color:#fff; background:var(--navy); }
.special-badge { color:#7d151e; background:#ffe6e9; border:1px solid #e8a7ae; }
.variable-badge { color:#6c4a00; background:#fff3c9; border:1px solid #e2c46f; }
h1 { margin:0; color:var(--navy-deep); font:800 clamp(1.35rem,2.3vw,2rem)/1.2 Georgia,serif; }
.translation { margin:10px 0 24px; color:var(--gray); font:italic 1.03rem/1.45 Georgia,serif; }
.answer-heading-row { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top:14px; }
.micro-label { display:block; font-size:.74rem; color:var(--gray); font-weight:900; letter-spacing:.08em; }
#required-count { color:var(--red); font-size:.96rem; display:block; }
#required-count.need-many { font-size:1.05rem; font-weight:900; letter-spacing:.01em; }
.reveal-button {
  display:inline-flex; align-items:center; justify-content:center; gap:12px;
  border:1.5px solid #8a6418; border-radius:12px; padding:12px 18px;
  color:var(--navy-deep); font-weight:800; font-family:inherit; font-size:1.02rem;
  background:linear-gradient(180deg,#f6e7b8 0%,#e2c36a 48%,#c69a34 100%);
  box-shadow:0 3px 0 #5a3e0c, 0 8px 18px rgba(8,40,68,.16), inset 0 1px 0 rgba(255,255,230,.75);
}
.reveal-button::after {
  content:"";
  width:0; height:0;
  border-left:7px solid transparent;
  border-right:7px solid transparent;
  border-top:8px solid currentColor;
  flex:none;
}
.reveal-button:active { transform:translateY(2px); box-shadow:0 1px 0 #5a3e0c, inset 0 1px 0 rgba(255,255,230,.5); }
.reveal-button[aria-expanded="true"] {
  color:#f6e7b8;
  background:linear-gradient(180deg,#1a4a73 0%,#123a63 50%,#082844 100%);
  border-color:#c69a34;
  box-shadow:0 2px 0 #061525, inset 0 1px 0 rgba(243,197,91,.28);
}
.reveal-button[aria-expanded="true"]::after { transform:rotate(180deg); }
.answer-panel { margin:10px 0 14px; padding:17px; background:#f3f6f8; border-left:7px solid var(--red); border-radius:0 11px 11px 0; }
.answer-panel.answer-hidden { display:none; }
.answer-text { color:var(--red); font-size:clamp(1.25rem,2vw,1.65rem); line-height:1.3; font-weight:900; margin-bottom:12px; }
.answer-meta { color:#263644; font-size:.9rem; line-height:1.45; margin-top:5px; }
.pron-hint { margin:6px 0 0; color:#5b6269; font-size:.78rem; line-height:1.35; }
.custom-answer-box { padding:12px; background:#fff8dd; border:1px solid #e7c967; border-radius:9px; margin-bottom:12px; }
.custom-answer-box label { display:block; font-weight:900; color:#624500; margin-bottom:8px; }
.custom-row { display:flex; gap:8px; }
.custom-row input { flex:1; min-width:0; border:1px solid #b7a45f; border-radius:8px; padding:10px; }
.custom-row button { border:0; border-radius:8px; background:var(--green); color:#fff; font-weight:900; padding:10px 14px; }
.custom-answer-box small { display:block; margin-top:7px; color:#6e6033; }
.variable-tools { display:grid; grid-template-columns:1fr auto auto; gap:10px; align-items:center; background:#fff8dd; border:1px solid #e7c967; border-radius:10px; padding:12px; margin:12px 0; }
.variable-tools p { margin:3px 0 0; color:#655a35; font-size:.84rem; }
.variable-tools a,.variable-tools button { white-space:nowrap; border:0; border-radius:8px; padding:9px 11px; font-weight:900; text-decoration:none; }
.variable-tools a { background:var(--navy); color:#fff; }
.variable-tools button { background:#fff; color:var(--navy); border:1px solid #aabac8; }
.accepted-details { margin:12px 0; border-top:1px solid #d8e0e6; border-bottom:1px solid #d8e0e6; padding:10px 0; }
.accepted-details summary { cursor:pointer; font-weight:800; color:var(--navy); }
.accepted-details ol { margin:10px 0 0 22px; padding:0; color:#394956; font-size:.88rem; line-height:1.45; }
.audio-grid { display:grid; grid-template-columns:1fr 1fr; gap:10px; margin-top:14px; }
.audio-more { margin-top:4px; }
.tools-extra { display:grid; gap:12px; margin-top:12px; }
.audio-button { border:0; min-height:76px; border-radius:12px; color:#fff; font-weight:800; font-family:inherit; line-height:1.2; padding:12px 10px; box-shadow:0 4px 0 #061525; font-size:1.05rem; }
.audio-button span { display:block; font-size:1.1rem; }
.audio-button small { opacity:.83; }
.audio-button.navy { background:var(--navy); }
.audio-button.red { background:var(--red); box-shadow:0 4px 0 #7a121c; }
.audio-button:active { transform:translateY(2px); box-shadow:0 2px 0 #061525; }
.training-panel { margin-top:15px; background:#eef3f7; border:1px solid #cfd9e2; border-radius:11px; padding:12px; }
.training-title { font-weight:900; color:var(--navy); margin:0 0 8px; }
.training-buttons { display:grid; grid-template-columns:repeat(4,1fr); gap:7px; }
.training-buttons button { min-height:46px; border:1px solid #aebdca; border-radius:10px; background:#fff; color:var(--navy); font-weight:800; font-family:inherit; padding:8px; }
.training-buttons .stop-button { color:#fff; background:#343a40; border-color:#343a40; }
.audio-status { margin-top:9px; min-height:22px; font-size:.86rem; color:#354958; font-weight:700; }
.mastery-card {
  margin-top:16px;
  padding:16px 16px 14px;
  border-radius:18px;
  background:linear-gradient(180deg,#ffffff 0%,#f4f7fa 100%);
  border:1px solid #cfd9e2;
  box-shadow:0 12px 28px rgba(8,40,68,.14), inset 0 1px 0 #fff;
}
.mastery-line { display:grid; grid-template-columns:1fr auto auto; align-items:baseline; gap:10px; margin-bottom:10px; }
.mastery-line:not(.is-known) { display:none; }
.mastery-line.is-known { margin:10px 0 0; }
.mastery-kicker { font-size:1.05rem; font-weight:900; letter-spacing:.04em; text-transform:none; color:var(--navy-deep); }
.mastery-line strong { font:800 1.2rem/1 Georgia,serif; color:var(--navy-deep); }
.mastery-line em { font:800 1.2rem/1 Georgia,serif; font-style:normal; color:var(--navy); }
.mastery-line.is-known strong { font-size:clamp(1.35rem,4.5vw,1.75rem); }
.mastery-line.is-known em { font-size:clamp(1.5rem,5vw,2rem); color:var(--red); }
.mastery-bar {
  padding:6px;
  border-radius:16px;
  background:linear-gradient(180deg,#e8c56a 0%,#c69a34 38%,#8a6418 100%);
  box-shadow:0 3px 0 #5a3e0c, 0 8px 14px rgba(8,40,68,.2), inset 0 1px 0 rgba(255,255,230,.7);
}
.mastery-bar-3d {
  position:relative;
  height:28px;
  border-radius:10px;
  overflow:hidden;
  background:linear-gradient(180deg,#07111c,#123a63 70%,#082844);
  box-shadow:inset 0 3px 8px rgba(0,0,0,.55);
}
.mastery-bar-fill {
  height:100%;
  width:0;
  border-radius:10px 0 0 10px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.08) 42%, rgba(0,0,0,.18) 100%),
    linear-gradient(90deg,#ffe9a8 0%,#f3c55b 45%,#c69a34 100%);
  box-shadow:inset 0 2px 0 rgba(255,255,255,.7);
  transition:width .35s ease;
}
.mastered-button { width:100%; margin-top:12px; border:0; min-height:50px; border-radius:12px; color:#fff; background:var(--green); font-weight:800; font-family:inherit; box-shadow:0 4px 0 #14532d; }
.mastered-button.is-mastered { background:var(--navy); box-shadow:0 4px 0 #061525; }
.mastery-known { margin:8px 0 0; text-align:center; font-size:.82rem; font-weight:800; color:var(--navy); }
.fest-canvas, .fest-sky {
  position:fixed; inset:0; z-index:91;
  width:100%; height:100%;
  pointer-events:none;
  display:none;
}
.fest-canvas.is-on, .fest-sky.is-on { display:block; pointer-events:none; }
.fest-sky { z-index:90; overflow:hidden; }
.fest-banner {
  position:fixed; left:50%; top:22%;
  transform:translate(-50%,-50%) scale(.86);
  z-index:94; pointer-events:none;
  min-width:min(88vw,440px);
  text-align:center;
  padding:20px 24px;
  border-radius:20px;
  background:var(--navy-deep);
  color:#f3c55b;
  border:3px solid #c69a34;
  font:800 1.45rem/1.2 Georgia,serif;
  box-shadow:0 18px 48px rgba(8,40,68,.45), inset 0 1px 0 rgba(255,255,255,.18);
  display:none;
}
.fest-banner.is-on { display:block; transform:translate(-50%,-50%) scale(1); }
.fest-banner.is-half { font-size:1.85rem; padding:28px 30px; border-width:4px; }
.fest-banner.is-full { font-size:2rem; padding:32px 34px; border-width:5px; color:#fff; background:linear-gradient(165deg,#082844,#123a63 55%,#b71c2b); }
#restart-yes, #review-yes { width:100%; min-height:52px; margin-top:8px; border:0; border-radius:10px; background:var(--red); color:#fff; font-weight:900; }
#restart-modal, #review-modal { z-index:200; place-items:center; pointer-events:auto; }
#review-modal .setup-card { pointer-events:auto; }
#restart-modal .setup-card { pointer-events:auto; }
.balloon {
  position:absolute;
  top:-80px;
  width:34px; height:44px;
  border-radius:50% 50% 48% 48%;
  animation:balloon-fall 5.2s linear forwards;
}
.balloon::before {
  content:"";
  position:absolute; left:22%; top:12%;
  width:28%; height:22%;
  border-radius:50%;
  background:rgba(255,255,255,.45);
}
.balloon::after {
  content:"";
  position:absolute; left:50%; top:100%;
  width:2px; height:46px;
  margin-left:-1px;
  background:rgba(255,255,255,.55);
}
@keyframes balloon-fall {
  0% { transform:translateY(0) rotate(-10deg); }
  100% { transform:translateY(115vh) rotate(8deg); }
}
@media (prefers-reduced-motion: reduce) {
  .mastery-bar-fill { transition:none; }
  .fest-canvas, .fest-sky { display:none !important; }
}
.bottom-nav { display:grid; grid-template-columns:1fr auto 1fr; gap:12px; margin-top:20px; }
.bottom-nav button { border:0; border-radius:11px; padding:14px; font-weight:800; font-family:inherit; background:var(--navy); color:#fff; min-height:48px; box-shadow:0 3px 0 #061525; }
.bottom-nav #random-button { background:#fff; color:var(--navy); border:1px solid #aebdca; }
.study-dock { display:none; }
.legal-drawer { margin:16px 0 12px; }
.legal-drawer > summary {
  cursor:pointer; list-style:none;
  display:flex; align-items:center; justify-content:center; gap:12px;
  min-height:58px; text-align:center;
  padding:14px 18px; border-radius:12px;
  font-family:inherit; font-weight:800; font-size:1.05rem; line-height:1.3;
  color:var(--navy-deep);
  background:linear-gradient(180deg,#f6e7b8 0%,#e2c36a 48%,#c69a34 100%);
  border:1.5px solid #8a6418;
  box-shadow:0 3px 0 #5a3e0c, 0 8px 18px rgba(8,40,68,.18), inset 0 1px 0 rgba(255,255,230,.75);
}
.legal-drawer > summary::after {
  content:"";
  width:0; height:0;
  border-left:7px solid transparent;
  border-right:7px solid transparent;
  border-top:8px solid currentColor;
  flex:none;
}
.legal-drawer > summary::-webkit-details-marker { display:none; }
.legal-drawer > summary:active { transform:translateY(2px); box-shadow:0 1px 0 #5a3e0c, inset 0 1px 0 rgba(255,255,230,.5); }
.legal-drawer[open] > summary {
  margin-bottom:10px;
  color:#f6e7b8;
  background:linear-gradient(180deg,#1a4a73 0%,#123a63 50%,#082844 100%);
  border-color:#c69a34;
  box-shadow:0 2px 0 #061525, inset 0 1px 0 rgba(243,197,91,.28);
}
.legal-drawer[open] > summary::after { transform:rotate(180deg); }
.legal-body {
  padding:16px;
  background:#fffaf2;
  border:1px solid #c69a34;
  border-left:6px solid var(--navy);
  border-radius:12px;
  color:var(--navy-deep);
  font-size:.92rem;
  line-height:1.45;
}
.legal-body p { margin:0 0 10px; }
.legal-brand {
  display:flex; align-items:center; gap:12px;
  margin-top:6px; padding:10px 12px;
  background:#fff; border:1px solid #d8e0e6; border-radius:12px;
  text-decoration:none; color:var(--navy-deep); font-weight:800;
}
.legal-brand img { width:64px; height:50px; object-fit:contain; background:#fff; border-radius:8px; }
.legal-brand span { word-break:break-all; }
footer a { color:var(--navy); font-weight:800; }
footer { text-align:center; padding:16px 16px 40px; color:#52606a; font-size:.8rem; }
footer p { margin:5px auto; max-width:900px; }
button:focus-visible,select:focus-visible,input:focus-visible,a:focus-visible,summary:focus-visible { outline:3px solid #f1b83f; outline-offset:2px; }
button[disabled] { opacity:.45; cursor:not-allowed; }
.place-button { margin-top:6px; min-height:42px; border:1px solid #aebdca; border-radius:10px; background:#fff; color:var(--navy); font-weight:800; }
.place-button.exam-open { background:var(--red); color:#fff !important; border-color:#7a121c !important; box-shadow:0 2px 0 #7a121c; }
.setup-modal { position:fixed; inset:0; z-index:80; background:rgba(8,40,68,.55); display:grid; place-items:end center; padding:12px 12px max(12px, env(safe-area-inset-bottom)); overflow:auto; }
.setup-modal[hidden] { display:none !important; }
.setup-card { width:min(560px,100%); background:#fff; border-radius:18px 18px 12px 12px; padding:22px 18px 16px; box-shadow:0 -12px 40px rgba(8,40,68,.28); color:#17212b; }
.setup-card h2 { margin:0 0 8px; color:var(--navy-deep); font:800 1.25rem/1.25 Georgia,serif; }
.setup-card p { margin:0 0 14px; color:#3d4a55; line-height:1.45; }
.setup-card label { display:block; font-size:.75rem; font-weight:900; text-transform:uppercase; letter-spacing:.04em; color:var(--navy); margin:10px 0 5px; }
.setup-card input,.setup-card select { width:100%; min-height:46px; border:1px solid #aebdca; border-radius:8px; padding:8px 10px; background:#fff; font-size:16px; }
.setup-preview { margin:14px 0; padding:12px; background:#eef3f7; border-radius:10px; font-size:.9rem; line-height:1.45; }
.setup-preview strong { color:var(--navy); }
#setup-save { width:100%; min-height:50px; margin-top:8px; border:0; border-radius:10px; background:var(--red); color:#fff; font-weight:900; }
.setup-skip { width:100%; min-height:44px; margin-top:8px; border:0; background:transparent; color:var(--navy); font-weight:800; }
.setup-legal { font-size:.75rem; color:#6a7680; margin-top:10px; }
.zip-hint { display:block; margin:6px 0 0; color:#5b6269; font-size:.78rem; line-height:1.35; }
.exam-bar { background:#fff8dd; border:1px solid #e7c967; border-radius:12px; padding:12px; margin:0 0 12px; }
.exam-bar strong { display:block; color:#624500; margin-bottom:8px; }
.exam-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.exam-actions button { min-height:46px; border:0; border-radius:10px; font-weight:900; }
#exam-knew { background:var(--green); color:#fff; }
#exam-miss { background:var(--red); color:#fff; }
.exam-exit { grid-column:1 / -1; background:#fff; color:var(--navy); border:1px solid #aebdca !important; }
#exam-std, #exam-again { width:100%; min-height:50px; margin-top:8px; border:0; border-radius:10px; background:var(--red); color:#fff; font-weight:900; }
body.exam-on .tools-drawer { display:none; }
.install-banner { position:fixed; left:10px; right:10px; bottom:calc(72px + env(safe-area-inset-bottom)); z-index:56; background:#fff; border:2px solid var(--navy); border-radius:14px; padding:12px 14px; box-shadow:0 12px 32px rgba(8,40,68,.28); }
.install-top { display:flex; gap:12px; align-items:flex-start; margin-bottom:10px; }
.install-top img { width:48px; height:48px; border-radius:12px; flex-shrink:0; }
.install-banner strong { display:block; color:var(--navy-deep); margin-bottom:4px; }
.install-banner p { margin:0; color:#3d4a55; font-size:.86rem; line-height:1.4; }
.install-row { display:flex; gap:8px; }
.install-row button { flex:1; min-height:42px; border-radius:10px; font-weight:900; border:1px solid #aebdca; background:#fff; color:var(--navy); }
#install-btn { background:var(--navy); color:#fff; border-color:var(--navy); }
@media (min-width:721px) {
  .install-banner { left:auto; right:20px; width:min(380px,90vw); bottom:20px; }
}
@media (min-width:721px) {
  .tools-drawer { margin-bottom:12px; }
  main { padding-bottom:24px; }
}
@media (max-width:960px) {
  .toolbar { grid-template-columns:1fr 1fr; }
  .training-buttons { grid-template-columns:1fr 1fr; }
  .spread { grid-template-columns:1fr; }
  .image-page,.text-page { min-height:auto; }
  .image-page { order:1; }
  .text-page { order:2; }
  .image-frame { max-width:680px; margin:auto; }
  .now-card { top:58px; }
}
@media (max-width:960px) and (orientation:landscape) and (max-height:500px) {
  .spread { grid-template-columns:minmax(180px,.7fr) minmax(0,1.3fr); }
  .image-page { order:0; padding:12px; }
  .text-page { order:0; }
  .image-frame { max-width:none; aspect-ratio:1/1; padding:8px; border-width:5px; }
  .image-instruction { display:none; }
}
@media (max-width:640px) {
  .topbar { align-items:center; gap:10px; padding:8px 12px; padding-top:max(8px, env(safe-area-inset-top)); }
  .brand-logo { width:42px; height:36px; }
  .book-title { font-size:.95rem; }
  .book-subtitle { display:none; }
  .return-button { padding:8px 10px; font-size:.74rem; display:none; }
  .lang-switch button { min-width:36px; min-height:34px; }
  main { width:94vw; margin:10px auto 0; padding-bottom:118px; }
  .progress-section { display:none; }
  .now-card { top:52px; margin-bottom:10px; padding:12px 12px 14px; }
  .plane-card { grid-template-columns:68px 1fr; gap:10px; padding:10px 12px 12px; border-radius:16px; }
  .plane-sky { height:60px; }
  .plane-svg { width:36px; height:36px; top:12px; }
  .plane-title { font-size:.98rem; }
  #plane-msg { font-size:.82rem; margin:4px 0 8px; }
  #plane-btn { width:100%; }
  .bottom-nav { display:none; }
  .toolbar { grid-template-columns:1fr 1fr; padding:8px; gap:8px; }
  .toolbar-group.voice-group { grid-column:1 / -1; }
  .toolbar-group.speed-group { grid-column:1 / -1; }
  .toolbar small#voice-note { display:none; }
  .toolbar select,.toolbar input,.jump-row button { min-height:44px; }
  .image-page,.text-page { padding:10px; border-radius:12px; }
  .image-frame { max-width:min(92vw,420px); width:100%; padding:6px; border-width:6px; outline-width:2px; outline-offset:-10px; box-shadow:4px 4px 0 #dce3e8; }
  .image-instruction { margin-top:8px; font-size:.8rem; }
  h1 { font-size:1.28rem; }
  .audio-grid { grid-template-columns:1fr 1fr; }
  .audio-button { min-height:72px; font-size:1.05rem; }
  .training-buttons { grid-template-columns:1fr 1fr; }
  .training-buttons button { min-height:48px; }
  .variable-tools { grid-template-columns:1fr; }
  .bottom-nav { grid-template-columns:1fr 1fr; margin-top:16px; }
  .bottom-nav #random-button { grid-column:1 / -1; grid-row:2; }
  .mastery-bar-3d { height:28px; }
  .mastery-card { padding:14px 12px 12px; }
  .answer-heading-row { flex-wrap:wrap; }
  .reveal-button { min-height:44px; width:100%; }
  .study-dock {
    display:grid;
    grid-template-columns:52px 1fr 1fr 52px;
    gap:7px;
    position:fixed;
    left:0; right:0; bottom:0;
    z-index:50;
    background:var(--navy-deep);
    padding:8px 8px max(8px, env(safe-area-inset-bottom));
    box-shadow:0 -8px 24px rgba(8,40,68,.28);
  }
  .study-dock button {
    min-height:48px;
    border:0;
    border-radius:10px;
    font-weight:900;
    color:#fff;
    background:rgba(255,255,255,.12);
  }
  .study-dock .dock-play { background:var(--red); font-size:.92rem; }
  .study-dock .dock-stop { grid-column:1 / -1; background:#1b1f24; min-height:40px; }
  body.is-playing .study-dock .dock-stop { background:#c62828; }
  footer { padding-bottom:24px; }
}
@media (max-width:640px) and (orientation:landscape) {
  main { padding-bottom:86px; }
  .study-dock { grid-template-columns:48px 1fr 1fr 1fr 48px; }
  .study-dock .dock-stop { grid-column:auto; min-height:44px; }
}
@media print {
  .topbar,.toolbar,.progress-section,.audio-grid,.training-panel,.bottom-nav,.study-dock,.return-button,.mastery-card,.fest-canvas,.fest-banner,.fest-sky { display:none !important; }
  body { background:#fff; }
  .spread { grid-template-columns:1fr 1fr; }
  .image-page,.text-page { box-shadow:none; border:0; }
  .answer-panel.answer-hidden { display:block !important; }
}
