/* VOICE: playful neon arcade, but readable for long study sessions
   IDEA: an 80s synthwave arcade cabinet: every panel is a glowing screen on a moving grid floor
   PICTURE: perspective grid floor + sun on every page, cyan/pink neon-outlined panels
   COLOUR and TYPE: deep violet night, cyan #00e5ff + pink #ff2bd6 lines, green/red status; Orbitron for labels, Outfit for text
   LAYOUT: single centred column (max 560px) like the sketches; panels stack; drawers slide over */
:root {
  color-scheme: dark;
  --bg: #05010f;
  --bg2: #1a0433;
  --panel: rgba(10, 4, 24, 0.84);
  --panel-solid: #0d0620;
  --ink: #f2ecff;
  --muted: #a99cc8;
  --cyan: #00e5ff;
  --pink: #ff2bd6;
  --yellow: #ffd23f;
  --green: #3dff6a;
  --red: #ff3d5a;
  --glow-c: 0 0 10px rgba(0, 229, 255, 0.9), 0 0 34px rgba(0, 229, 255, 0.35);
  --glow-p: 0 0 10px rgba(255, 43, 214, 0.9), 0 0 34px rgba(255, 43, 214, 0.35);
  --r: 26px;
}
* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 'Outfit', system-ui, sans-serif;
  overflow-x: clip;
  -webkit-tap-highlight-color: transparent;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cyan); }
img { max-width: 100%; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; }

/* ---------- synthwave stage (fixed background) ---------- */
#stage { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: linear-gradient(#05010f 0%, #1a0433 52%, #2a0646 60%, #05010f 100%); }
#stage .sun { position: absolute; left: 50%; top: 44%; width: min(70vw, 420px); aspect-ratio: 1; transform: translate(-50%, -62%); border-radius: 50%;
  background: repeating-linear-gradient(to bottom, transparent 0 58%, rgba(5, 1, 15, 0.9) 58% 61%, transparent 61% 66%), linear-gradient(#ffd23f, #ff2bd6 70%);
  opacity: 0.34; filter: blur(0.5px); }
#stage .grid { position: absolute; left: -60%; right: -60%; bottom: -12%; height: 58%;
  background-image: linear-gradient(rgba(255, 43, 214, 0.9) 1.5px, transparent 1.5px), linear-gradient(90deg, rgba(255, 43, 214, 0.9) 1.5px, transparent 1.5px);
  background-size: 64px 64px; transform: perspective(300px) rotateX(64deg); transform-origin: 50% 0;
  -webkit-mask-image: linear-gradient(transparent 0%, #000 45%); mask-image: linear-gradient(transparent 0%, #000 45%);
  opacity: 0.5; animation: gridmove 2.4s linear infinite; }
#stage .horizon { position: absolute; left: 0; right: 0; top: 42%; height: 2px; background: var(--pink); box-shadow: var(--glow-p); opacity: 0.8; }
#stage .stars { position: absolute; inset: 0 0 58% 0; background-image: radial-gradient(1px 1px at 12% 22%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 33% 8%, #fff 50%, transparent 51%),
  radial-gradient(1.5px 1.5px at 72% 18%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 88% 36%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 56% 30%, #fff 50%, transparent 51%),
  radial-gradient(1px 1px at 22% 40%, #fff 50%, transparent 51%), radial-gradient(1.5px 1.5px at 46% 12%, #cff 50%, transparent 51%), radial-gradient(1px 1px at 94% 6%, #fff 50%, transparent 51%);
  opacity: 0.7; animation: twinkle 4s ease-in-out infinite alternate; }
@keyframes gridmove { to { background-position: 0 64px; } }
@keyframes twinkle { to { opacity: 0.35; } }

/* ---------- layout ---------- */
#app { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; padding: max(18px, env(safe-area-inset-top)) 16px 40px; }
.col { width: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.wide { max-width: 980px; }
.brand { font-family: 'Orbitron', sans-serif; font-weight: 800; letter-spacing: 1px; text-align: center; font-size: clamp(22px, 6vw, 34px); line-height: 1.05;
  text-shadow: 0 0 12px var(--cyan), 0 0 28px rgba(0, 229, 255, 0.6); margin: 8px 0 0; }
.brand small { display: block; font-size: 13px; letter-spacing: 3px; color: var(--pink); text-shadow: var(--glow-p); margin-top: 8px; font-weight: 600; }
.panel { background: var(--panel); border: 2px solid var(--cyan); border-radius: var(--r); box-shadow: var(--glow-c), inset 0 0 18px rgba(0, 229, 255, 0.18); padding: 18px; }
.panel.pink { border-color: var(--pink); box-shadow: var(--glow-p), inset 0 0 18px rgba(255, 43, 214, 0.18); }
.muted { color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
h2.t { font-family: 'Orbitron', sans-serif; font-size: 18px; margin: 0; letter-spacing: 0.5px; }

/* neon buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 20px; border-radius: 999px;
  background: rgba(10, 4, 24, 0.85); border: 2px solid var(--cyan); box-shadow: var(--glow-c); font-weight: 600; letter-spacing: 0.3px; text-decoration: none; color: var(--ink);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s; }
.btn:hover { transform: translateY(-2px); background: rgba(0, 229, 255, 0.12); }
.btn:active { transform: scale(0.97); }
.btn.pink { border-color: var(--pink); box-shadow: var(--glow-p); }
.btn.pink:hover { background: rgba(255, 43, 214, 0.12); }
.btn.green { border-color: var(--green); box-shadow: 0 0 10px rgba(61, 255, 106, 0.8), 0 0 30px rgba(61, 255, 106, 0.3); }
.btn.ghost { border-color: rgba(169, 156, 200, 0.5); box-shadow: none; }
.btn.small { min-height: 38px; padding: 6px 14px; font-size: 14px; }
.btn[disabled] { opacity: 0.55; cursor: default; transform: none; }
.icon { width: 20px; height: 20px; flex: none; }

/* ---------- screen 1: welcome cards ---------- */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(12px, 4vw, 28px); align-items: start; }
.pcard-wrap { display: flex; flex-direction: column; gap: 8px; }
.pcard { position: relative; width: 100%; text-align: center; padding: 14px 12px 14px; border-radius: 28px; background: rgba(10, 4, 24, 0.86);
  border: 2px solid var(--cyan); box-shadow: 0 0 12px var(--cyan), 0 0 44px rgba(0, 229, 255, 0.45), 0 24px 50px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(0, 229, 255, 0.22);
  transition: transform 0.3s, box-shadow 0.3s; animation: hover 5s ease-in-out infinite; }
.pcard.pk { border-color: var(--pink); box-shadow: 0 0 12px var(--pink), 0 0 44px rgba(255, 43, 214, 0.45), 0 24px 50px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(255, 43, 214, 0.22); animation-delay: -2.5s; }
.pcard:hover { transform: translateY(-8px) scale(1.02); }
@keyframes hover { 50% { transform: translateY(-6px); } }
.photo { width: min(100%, 170px); aspect-ratio: 260 / 330; margin: 0 auto; border-radius: 20px; background: #111 center top / cover no-repeat;
  border: 2px solid #c48bff; box-shadow: 0 0 14px #a64dff; }
.pcard .name { font-weight: 600; font-size: clamp(16px, 4.4vw, 21px); margin-top: 10px; }
.pcard .pts { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: clamp(28px, 8vw, 40px); line-height: 1.1; margin-top: 4px; text-shadow: var(--glow-c); }
.pcard.pk .pts { text-shadow: var(--glow-p); }
.pcard .pts small { display: block; font-family: 'Outfit'; font-size: 12px; font-weight: 400; color: var(--muted); text-shadow: none; letter-spacing: 1px; }
.pcard .st { font-size: clamp(12px, 3.4vw, 14px); line-height: 1.6; margin-top: 6px; }
.pcard .foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 12px; font-size: clamp(11px, 3.2vw, 13px); text-align: left; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green), 0 0 20px var(--green); animation: beat 1.6s ease-in-out infinite; }
.dot.off { background: var(--red); box-shadow: 0 0 8px var(--red); }
@keyframes beat { 50% { transform: scale(0.8); opacity: 0.75; } }
.seen { font-size: 13px; text-align: center; color: var(--muted); }
.seen b { color: var(--green); font-weight: 600; }

/* ---------- modal (screen 2) ---------- */
.modal-bg { position: fixed; inset: 0; z-index: 50; background: rgba(5, 1, 15, 0.72); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.modal { width: 100%; max-width: 420px; text-align: center; animation: pop 0.25s ease-out; }
@keyframes pop { from { transform: scale(0.92); opacity: 0; } }
.modal .photo { width: min(70%, 240px); }
.modal h3 { font-weight: 400; font-size: 20px; margin: 16px 0 12px; }
.field { width: 100%; min-height: 50px; padding: 12px 18px; border-radius: 16px; background: rgba(80, 16, 120, 0.55); border: 2px solid rgba(255, 43, 214, 0.7);
  font-size: 18px; text-align: center; letter-spacing: 1px; outline: none; }
.field:focus { box-shadow: var(--glow-p); }
textarea.field { text-align: left; letter-spacing: 0; font-size: 16px; resize: vertical; }
.err { color: #ff8fa3; font-size: 14px; min-height: 20px; margin: 8px 0 0; }
.stack { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }

/* ---------- dashboard (screen 3) ---------- */
.topbar { display: flex; align-items: center; gap: 10px; }
.avatar { width: 44px; height: 44px; border-radius: 14px; background: #111 center top / cover; border: 2px solid #c48bff; box-shadow: 0 0 10px #a64dff; flex: none; }
.score-pill { text-align: center; padding: 12px 18px; border-radius: 999px; border: 2px solid var(--pink); box-shadow: var(--glow-p); background: rgba(10, 4, 24, 0.85);
  font-size: clamp(18px, 5vw, 24px); }
.score-pill b { font-weight: 700; text-shadow: var(--glow-p); }
.finished-title { text-align: center; font-size: clamp(22px, 6vw, 30px); color: var(--green); text-shadow: 0 0 10px rgba(61, 255, 106, 0.7); margin: 0 0 6px; font-weight: 400; }
.wheel { position: relative; height: 260px; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; -webkit-mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); mask-image: linear-gradient(transparent, #000 30%, #000 70%, transparent); }
.wheel::-webkit-scrollbar { display: none; }
.wheel .pad { height: 106px; }
.wheel button { display: block; width: 100%; height: 48px; scroll-snap-align: center; background: none; border: 0; padding: 0 6px; text-align: center; white-space: nowrap;
  font-size: 18px; color: var(--muted); transition: transform 0.12s, opacity 0.12s; transform-origin: center; }
.wheel button.done { color: var(--green); }
.wheel button.prog { color: var(--yellow); }
.wheel button .pc { margin-left: 10px; }
.wheel-hint { text-align: center; font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.start { display: flex; flex-direction: column; align-items: center; padding: 18px 20px; border-radius: 44px; width: 100%; background: rgba(10, 4, 24, 0.85);
  border: 2px solid var(--cyan); box-shadow: var(--glow-c); transition: transform 0.15s; }
.start:hover { transform: translateY(-2px) scale(1.01); }
.start .big { font-family: 'Orbitron'; font-size: clamp(22px, 6.5vw, 32px); font-weight: 700; letter-spacing: 1px; text-shadow: var(--glow-c); }
.start .sub { font-size: clamp(16px, 4.6vw, 22px); color: var(--muted); }
.msgbtn { position: relative; display: flex; align-items: center; gap: 16px; width: 100%; padding: 12px 22px; border-radius: 40px; background: rgba(10, 4, 24, 0.85);
  border: 2px solid var(--pink); box-shadow: var(--glow-p); text-align: left; font-size: clamp(13px, 3.8vw, 16px); letter-spacing: 0.5px; }
.msgbtn svg { width: 54px; height: 40px; flex: none; }
.badge { position: absolute; top: -8px; right: 14px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px; background: var(--red); color: #fff; font-weight: 700;
  font-size: 14px; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 12px var(--red); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }

/* ---------- screen 4: draw animation ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 16px; background: rgba(5, 1, 15, 0.55); }
.ocean { position: relative; width: min(86vw, 440px); aspect-ratio: 1; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 18px var(--cyan), inset 0 0 40px rgba(0, 229, 255, 0.35);
  overflow: hidden; background: radial-gradient(circle at 50% 30%, rgba(0, 229, 255, 0.12), rgba(10, 4, 40, 0.9)); }
.ocean .water { position: absolute; left: -50%; width: 200%; height: 60%; bottom: -8%; background: radial-gradient(ellipse at 50% 0%, rgba(0, 229, 255, 0.35), rgba(30, 60, 255, 0.25) 60%, transparent);
  border-radius: 45%; animation: wave 6s linear infinite; }
.ocean .water.w2 { bottom: -14%; opacity: 0.6; animation-duration: 9s; animation-direction: reverse; }
@keyframes wave { to { transform: rotate(360deg); } }
.orbit { position: absolute; inset: 0; animation: spin 7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.pdf { position: absolute; width: 15%; aspect-ratio: 0.78; transform: translate(-50%, -50%); }
.pdf > div { width: 100%; height: 100%; animation: spin 7s linear infinite reverse; }
.pdf svg { width: 100%; height: 100%; animation: bob 2.2s ease-in-out infinite; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.5)); }
@keyframes bob { 50% { transform: translateY(-14%) rotate(6deg); } }
.chosen { width: min(34vw, 150px); aspect-ratio: 0.78; animation: rise 0.9s cubic-bezier(0.2, 1.4, 0.4, 1) both; filter: drop-shadow(0 0 18px var(--cyan)); }
@keyframes rise { from { transform: translateY(-40vh) scale(0.3) rotate(-40deg); opacity: 0; } }
.chosen-label { font-size: clamp(18px, 5vw, 24px); text-shadow: var(--glow-c); animation: pop 0.5s 0.4s both; }

/* ---------- screen 5: book ---------- */
.book { position: relative; width: min(78vw, 400px); aspect-ratio: 0.72; perspective: 1600px; }
.book .page { position: absolute; inset: 0; background: #fff center / contain no-repeat; border-radius: 4px 10px 10px 4px; box-shadow: 0 0 30px rgba(0, 229, 255, 0.5); }
.book .cover { position: absolute; inset: 0; transform-origin: 0 50%; transform-style: preserve-3d; animation: open 1.6s 0.5s cubic-bezier(0.6, 0, 0.3, 1) forwards; }
.book .cover .front, .book .cover .back { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 4px 12px 12px 4px; }
.book .cover .front { background: linear-gradient(135deg, #2a0646, #05010f); border: 3px solid var(--pink); box-shadow: var(--glow-p); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 16px; }
.book .cover .back { background: #e9e4f5; transform: rotateY(180deg); }
.book .cover .front .ttl { font-family: 'Orbitron'; font-weight: 800; font-size: clamp(18px, 5vw, 26px); text-shadow: var(--glow-c); }
@keyframes open { to { transform: rotateY(-168deg); } }

/* ---------- screen 6: question ---------- */
.qcard { padding: 18px 16px 20px; }
.qcard h1 { font-weight: 400; font-size: clamp(28px, 8vw, 40px); margin: 0 6px 10px; line-height: 1.1; }
.qimg { display: block; width: 100%; background: #fff; border-radius: 10px; }
.qimg-wrap { background: #fff; border-radius: 12px; padding: 6px; overflow: hidden; }
.caption { text-align: center; font-weight: 600; margin: 12px 0 4px; color: var(--yellow); text-shadow: 0 0 8px rgba(255, 210, 63, 0.6); min-height: 24px; }
.qtools { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 10px; }
.upload { min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.upload .hint { font-size: clamp(18px, 5vw, 24px); }
.thumbs { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.thumbs .t { position: relative; width: 84px; height: 110px; border-radius: 12px; background: #222 center / cover; border: 2px solid var(--cyan); }
.thumbs .t button { position: absolute; top: -10px; right: -10px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--red); color: #fff; font-weight: 700; }
.result .mark { font-size: clamp(40px, 12vw, 60px); font-weight: 700; text-align: center; line-height: 1; }
.result .mark.ok { color: var(--green); text-shadow: 0 0 14px rgba(61, 255, 106, 0.8); }
.result .mark.mid { color: var(--yellow); text-shadow: 0 0 14px rgba(255, 210, 63, 0.8); }
.result .mark.bad { color: var(--red); text-shadow: 0 0 14px rgba(255, 61, 90, 0.8); }
.parts { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; }
.parts td { padding: 8px 6px; border-top: 1px solid rgba(169, 156, 200, 0.25); vertical-align: top; }
.parts td.n { white-space: nowrap; font-weight: 600; width: 1%; }
.parts td.m { white-space: nowrap; text-align: right; font-weight: 700; width: 1%; }
.md { line-height: 1.6; overflow-wrap: anywhere; }
.md p { margin: 0 0 10px; }
.md pre { overflow-x: auto; }
.md .katex-display { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.nav3 { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; }
.nav3 .btn { padding: 8px 10px; font-size: clamp(13px, 3.6vw, 16px); }
.pointsbar { text-align: center; padding: 14px; border-radius: 999px; border: 2px solid var(--cyan); box-shadow: var(--glow-c); background: rgba(10, 4, 24, 0.85); font-size: clamp(17px, 4.8vw, 22px); }
.pointsbar b { font-weight: 700; color: var(--cyan); }
.spin { width: 46px; height: 46px; border-radius: 50%; border: 4px solid rgba(0, 229, 255, 0.25); border-top-color: var(--cyan); animation: spin 0.9s linear infinite; }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 12px; }
.qtile { aspect-ratio: 1; border-radius: 18px; border: 2px solid rgba(169, 156, 200, 0.5); background: rgba(10, 4, 24, 0.85); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.qtile b { font-size: 24px; font-weight: 700; }
.qtile small { font-size: 12px; color: var(--muted); }
.qtile.graded { border-color: var(--green); box-shadow: 0 0 10px rgba(61, 255, 106, 0.5); }
.qtile.uploaded, .qtile.error { border-color: var(--yellow); }
.ms-img { background: #fff; border-radius: 10px; padding: 4px; margin-top: 10px; }
.ms-img img { display: block; width: 100%; }
details.box > summary { cursor: pointer; font-weight: 600; padding: 6px 0; }

/* ---------- drawers: chat + Claude ---------- */
.drawer { position: fixed; z-index: 70; top: 0; right: 0; bottom: 0; width: min(100vw, 460px); background: var(--panel-solid); border-left: 2px solid var(--pink); box-shadow: var(--glow-p);
  display: flex; flex-direction: column; transform: translateX(105%); transition: transform 0.28s ease; }
.drawer.open { transform: none; }
.drawer.cy { border-left-color: var(--cyan); box-shadow: var(--glow-c); }
.drawer header { display: flex; align-items: center; gap: 12px; padding: max(14px, env(safe-area-inset-top)) 14px 12px; border-bottom: 1px solid rgba(169, 156, 200, 0.25); }
.drawer header .who { line-height: 1.2; }
.drawer header .who small { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.drawer header .who small .dot { width: 9px; height: 9px; }
.close { width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgba(169, 156, 200, 0.5); background: none; font-size: 22px; line-height: 1; }
.msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 82%; padding: 9px 13px; border-radius: 18px; background: rgba(0, 229, 255, 0.12); border: 1px solid rgba(0, 229, 255, 0.55); align-self: flex-start; overflow-wrap: anywhere; white-space: pre-wrap; }
.bubble.me { align-self: flex-end; background: rgba(255, 43, 214, 0.16); border-color: rgba(255, 43, 214, 0.6); border-bottom-right-radius: 6px; }
.bubble:not(.me) { border-bottom-left-radius: 6px; }
.bubble img { display: block; border-radius: 12px; margin: 2px 0 4px; max-height: 260px; cursor: zoom-in; }
.bubble time { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; text-align: right; white-space: nowrap; }
.bubble.ai { max-width: 100%; white-space: normal; background: rgba(0, 229, 255, 0.07); }
.day { align-self: center; font-size: 12px; color: var(--muted); padding: 4px 10px; border-radius: 10px; background: rgba(169, 156, 200, 0.12); }
.composer { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px max(12px, env(safe-area-inset-bottom)); border-top: 1px solid rgba(169, 156, 200, 0.25); }
.composer textarea { flex: 1; min-height: 46px; max-height: 140px; padding: 11px 14px; border-radius: 22px; background: rgba(80, 16, 120, 0.45); border: 1.5px solid rgba(255, 43, 214, 0.6); resize: none; outline: none; font-size: 16px; }
.round { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--cyan); background: rgba(10, 4, 24, 0.85); display: flex; align-items: center; justify-content: center; flex: none; }
.round.pk { border-color: var(--pink); }
.modes { display: flex; gap: 8px; padding: 10px 12px 0; flex-wrap: wrap; }
.preview-strip { padding: 0 12px; display: flex; gap: 8px; }
.preview-strip img { height: 60px; border-radius: 8px; }

/* ---------- library ---------- */
.lib { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.lib .f { border-radius: 18px; overflow: hidden; border: 2px solid rgba(0, 229, 255, 0.6); background: rgba(10, 4, 24, 0.85); display: flex; flex-direction: column; }
.lib .f .th { aspect-ratio: 1; background: #1b1030 center / cover; display: flex; align-items: center; justify-content: center; font-family: 'Orbitron'; color: var(--pink); font-size: 28px; }
.lib .f .meta { padding: 8px 10px; font-size: 13px; }
.lib .f .meta b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; padding: 12px 18px; border-radius: 16px; background: var(--panel-solid);
  border: 2px solid var(--yellow); box-shadow: 0 0 14px rgba(255, 210, 63, 0.6); max-width: calc(100vw - 32px); animation: pop 0.2s; }
.zoom { position: fixed; inset: 0; z-index: 95; background: rgba(0, 0, 0, 0.92); overflow: auto; padding: 56px 8px 24px; cursor: zoom-out; -webkit-overflow-scrolling: touch; }
.zoom img { display: block; margin: 0 auto; width: auto; max-width: none; min-width: min(100%, 900px); background: #fff; border-radius: 8px; }
.zoom .zx { position: fixed; top: 10px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--cyan); background: #05010f; color: #fff; font-size: 22px; }
@media (max-width: 700px) { .zoom img { width: 200vw; min-width: 0; } }

@media (max-width: 380px) {
  .pcard { padding: 10px 8px 12px; border-radius: 22px; }
  .wheel button { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ---------- coursebook links + reader ---------- */
.col.wide { max-width: 900px; }
.booklinks { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.booklinks:empty { display: none; }
.bl-h { margin: 0; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cyan); text-align: center; }
.booklink { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; text-decoration: none; color: #fff;
  border: 2px solid var(--cyan); background: rgba(0, 229, 255, 0.08); box-shadow: 0 0 10px rgba(0, 229, 255, 0.35); transition: transform 0.15s, box-shadow 0.15s; }
.booklink:hover, .booklink:focus-visible { transform: translateY(-1px); box-shadow: 0 0 18px rgba(0, 229, 255, 0.7); }
.booklink .icon { flex: none; width: 26px; height: 26px; color: var(--cyan); }
.booklink span { display: flex; flex-direction: column; min-width: 0; }
.booklink b { font-weight: 600; font-size: 15px; }
.booklink small { color: rgba(255, 255, 255, 0.7); font-size: 13px; }
.bk-pages { display: flex; flex-direction: column; gap: 14px; }
.bk-page { position: relative; width: 100%; aspect-ratio: 0.707; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 0 14px rgba(0, 229, 255, 0.35); }
.bk-page canvas { display: block; width: 100%; height: auto; }
.bk-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #889; font-size: 14px; }
.bk-page.done { aspect-ratio: auto; }
.bk-page canvas { cursor: zoom-in; }
