/* LingoVerse — Neon Arcade · base, tokens, shell and shared components */
:root {
  --bg: #0b0820; --bg2: #110b30; --panel: #171041; --panel2: #201858; --line: #33297a; --ink: #f2efff; --muted: #aaa3dc; --dim: #6f68a8;
  --cy: #22e6ff; --mag: #ff3df2; --lime: #a6ff3d; --amb: #ffc23d; --red: #ff4d6d; --ok: #3dffa0;
  --acc: var(--cy); --acc2: var(--mag); --acc-ink: #04121a;
  --shadow: rgba(0, 0, 0, .55); --glow-a: .65; --scan: .06;
  --on-acc2: #1e0019; --on-red: #1a0008; --on-amb: #1f1300; /* text on neon fills: dark ink in the dark theme (AA) */
  --r: 16px; --r-sm: 10px;
  --font-d: 'Baloo 2', 'Baloo Bhaijaan 2', system-ui, sans-serif;
  --font-b: 'Nunito', 'Baloo Bhaijaan 2', system-ui, sans-serif;
  --hud-h: 64px;
  color-scheme: dark;
}
[data-neon="magenta"] { --acc: var(--mag); --acc2: var(--cy); --acc-ink: #1e0019; }
[data-neon="lime"] { --acc: var(--lime); --acc2: var(--mag); --acc-ink: #0d1a00; }
[data-neon="amber"] { --acc: var(--amb); --acc2: var(--cy); --acc-ink: #1f1300; }
[data-neon="frost"] { --acc: #a8dcff; --acc2: #c9a8ff; --acc-ink: #06142a; }
[data-theme="light"] {
  --bg: #f3f0ff; --bg2: #e8e2ff; --panel: #ffffff; --panel2: #f4f1ff; --line: #d3caf6; --ink: #1b1440; --muted: #5a5390; --dim: #8f88c0;
  --cy: #006b85; --mag: #b4128f; --lime: #336e00; --amb: #a35f00; --red: #c8123a; --ok: #0a8050;
  --acc-ink: #ffffff; --on-acc2: #ffffff; --on-red: #ffffff; --on-amb: #ffffff; --shadow: rgba(40, 20, 110, .28); --glow-a: .25; --scan: .025;
  color-scheme: light;
}
[data-theme="light"][data-neon="frost"] { --acc: #1d6fb8; --acc2: #7a3fd0; }
[dir="rtl"] { --font-d: 'Baloo Bhaijaan 2', 'Baloo 2', system-ui, sans-serif; --font-b: 'Baloo Bhaijaan 2', 'Nunito', system-ui, sans-serif; }
/* English course content inside the Arabic UI keeps the Latin type pair (same look as the English UI). */
[dir="rtl"] [lang="en"] { --font-d: 'Baloo 2', 'Baloo Bhaijaan 2', system-ui, sans-serif; --font-b: 'Nunito', 'Baloo Bhaijaan 2', system-ui, sans-serif; font-family: var(--font-b); }
[lang="ar"] { --font-d: 'Baloo Bhaijaan 2', system-ui, sans-serif; --font-b: 'Baloo Bhaijaan 2', system-ui, sans-serif; font-family: var(--font-b); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: var(--font-b); font-size: 16px; line-height: 1.5;
  background-image:
    radial-gradient(900px 500px at 85% -10%, color-mix(in srgb, var(--acc2) 22%, transparent), transparent 70%),
    radial-gradient(700px 500px at -10% 30%, color-mix(in srgb, var(--acc) 16%, transparent), transparent 70%);
  background-attachment: fixed; overflow-x: hidden;
}
body::before { /* synthwave floor grid */
  content: ''; position: fixed; inset: auto 0 0 0; height: 38vh; pointer-events: none; z-index: 0; opacity: .5;
  background:
    linear-gradient(to top, color-mix(in srgb, var(--acc2) 18%, transparent), transparent),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--acc) 22%, transparent) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--acc) 22%, transparent) 0 1px, transparent 1px 40px);
  transform: perspective(300px) rotateX(55deg); transform-origin: bottom; mask-image: linear-gradient(to top, #000, transparent);
}
body::after { /* CRT scanlines */
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 200;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, var(--scan)) 0 1px, transparent 1px 3px);
}
img { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--acc); }
:focus-visible { outline: 3px solid var(--acc); outline-offset: 3px; border-radius: 8px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 12px; top: -60px; z-index: 300; background: var(--acc); color: var(--acc-ink); padding: 10px 16px; border-radius: 10px; font-weight: 800; }
.skip:focus { top: 12px; }
.ic { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
.muted { color: var(--muted); font-weight: 600; font-size: .9em; }
.hint { color: var(--muted); font-size: .88rem; margin: .4rem 0; }
.hint.warn, .warn { color: var(--amb); }
.center { text-align: center; }
.mono { font-family: ui-monospace, Consolas, monospace; letter-spacing: .05em; }
kbd { font-family: var(--font-d); font-size: .72rem; font-weight: 800; min-width: 1.7em; padding: 0 .4em; height: 1.7em; display: inline-grid; place-items: center; border-radius: 6px; background: var(--bg2); color: var(--muted); border: 1px solid var(--line); box-shadow: 0 2px 0 var(--line); }
.eyebrow { font-family: var(--font-d); font-weight: 800; letter-spacing: .16em; font-size: .74rem; color: var(--acc); margin: 0; text-transform: uppercase; }
.arcade-h { font-family: var(--font-d); font-weight: 800; font-size: clamp(1.7rem, 3.2vw, 2.5rem); line-height: 1.05; margin: .1rem 0 .3rem; letter-spacing: .01em; text-shadow: 0 0 18px color-mix(in srgb, var(--acc) calc(var(--glow-a) * 100%), transparent), 3px 3px 0 color-mix(in srgb, var(--acc2) 55%, transparent); }
.arcade-h.sm { font-size: clamp(1.3rem, 2.4vw, 1.8rem); }
.px { clip-path: polygon(0 6px, 6px 6px, 6px 0, calc(100% - 6px) 0, calc(100% - 6px) 6px, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 6px calc(100% - 6px), 0 calc(100% - 6px)); }
.glitch { position: relative; }
.glitch::before, .glitch::after { content: attr(data-text); position: absolute; inset: 0; pointer-events: none; opacity: .7; }
.glitch::before { color: var(--cy); transform: translate(-2px, 0); clip-path: inset(0 0 55% 0); animation: glitch 2.6s infinite steps(1); mix-blend-mode: screen; }
.glitch::after { color: var(--mag); transform: translate(2px, 0); clip-path: inset(55% 0 0 0); animation: glitch 2.2s infinite reverse steps(1); mix-blend-mode: screen; }
[data-theme="light"] .glitch::before, [data-theme="light"] .glitch::after { mix-blend-mode: multiply; opacity: .35; }
@keyframes glitch { 0%, 88%, 100% { transform: translate(0, 0); } 90% { transform: translate(-3px, 1px); } 94% { transform: translate(3px, -1px); } }

/* ---------- buttons ---------- */
.btn {
  --b: var(--panel2); --bd: var(--line); --fg: var(--ink); --sh: color-mix(in srgb, var(--line) 80%, #000);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em; min-height: 46px; padding: .55em 1.2em; border-radius: 14px;
  font-family: var(--font-d); font-weight: 800; font-size: 1rem; letter-spacing: .02em; text-decoration: none; line-height: 1.1;
  background: var(--b); color: var(--fg); border: 2px solid var(--bd); box-shadow: 0 5px 0 var(--sh); transition: transform .08s, box-shadow .08s, filter .15s;
  position: relative; top: 0;
}
.btn:hover:not(:disabled) { filter: brightness(1.08); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 1px 0 var(--sh); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-go { --b: var(--acc); --bd: color-mix(in srgb, var(--acc) 70%, #fff); --fg: var(--acc-ink); --sh: color-mix(in srgb, var(--acc) 45%, #000); box-shadow: 0 5px 0 var(--sh), 0 0 22px color-mix(in srgb, var(--acc) calc(var(--glow-a) * 60%), transparent); }
.btn-alt { --b: var(--panel2); }
.btn-ok { --b: var(--lime); --bd: var(--lime); --fg: #0d1a00; --sh: color-mix(in srgb, var(--lime) 45%, #000); }
.btn-no { --b: var(--red); --bd: var(--red); --fg: var(--on-red); --sh: color-mix(in srgb, var(--red) 45%, #000); }
.btn-warn { --b: var(--amb); --bd: var(--amb); --fg: #1f1300; --sh: color-mix(in srgb, var(--amb) 45%, #000); }
[data-theme="light"] .btn-ok, [data-theme="light"] .btn-warn { --fg: #fff; }
.btn.sm { min-height: 36px; padding: .35em .85em; font-size: .9rem; border-radius: 11px; box-shadow: 0 4px 0 var(--sh); }
.btn.big { min-height: 58px; font-size: 1.2rem; padding: .6em 1.6em; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel2); color: var(--ink); box-shadow: 0 4px 0 color-mix(in srgb, var(--line) 80%, #000); flex: none; text-decoration: none; }
.icon-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--line) 80%, #000); }
.icon-btn .ic { width: 22px; height: 22px; }
.link { background: none; border: 0; padding: 0; color: var(--acc); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.chip { display: inline-flex; align-items: center; gap: .35em; min-height: 36px; padding: .3em .85em; border-radius: 999px; border: 2px solid var(--line); background: var(--panel); color: var(--ink); font-weight: 700; font-size: .9rem; }
.chip.on, .chip[aria-pressed="true"] { border-color: var(--acc); background: color-mix(in srgb, var(--acc) 18%, var(--panel)); color: var(--ink); box-shadow: 0 0 12px color-mix(in srgb, var(--acc) calc(var(--glow-a) * 50%), transparent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.pill { font-style: normal; font-size: .7rem; font-weight: 800; background: var(--acc2); color: var(--on-acc2); border-radius: 999px; padding: 0 .5em; min-width: 1.5em; text-align: center; }
.pill.hot { background: var(--amb); color: var(--on-amb); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .45; } }
.row-c { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 10px 0; }
.row-w { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- app shell ---------- */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 236px minmax(0, 1fr) 330px; grid-template-rows: auto 1fr; grid-template-areas: "side hud hud" "side view rail"; min-height: 100vh; }
.side { grid-area: side; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 18px 14px; border-inline-end: 2px solid var(--line); background: color-mix(in srgb, var(--bg2) 85%, transparent); backdrop-filter: blur(6px); }
.hud { grid-area: hud; position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; min-height: var(--hud-h); padding: 10px 22px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(10px); border-bottom: 2px solid var(--line); }
.view { grid-area: view; padding: 22px clamp(14px, 3vw, 36px) 60px; min-width: 0; outline: none; }
.rail { grid-area: rail; position: sticky; top: var(--hud-h); align-self: start; max-height: calc(100vh - var(--hud-h)); overflow: auto; padding: 22px 18px; display: flex; flex-direction: column; gap: 16px; }
.dock { display: none; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-mark { width: 40px; height: 40px; flex: none; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--acc) 60%, transparent)); }
.brand-t { font-family: var(--font-d); font-weight: 800; font-size: 1.15rem; line-height: 1; letter-spacing: .04em; }
.brand-t span { color: var(--acc); }
.brand-t small { display: block; font-size: .62rem; letter-spacing: .28em; color: var(--acc2); margin-top: 3px; }
.hud .brand { display: none; }
.side-brand { margin-bottom: 18px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.nav { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: var(--muted); text-decoration: none; font-family: var(--font-d); font-weight: 700; font-size: 1.02rem; border: 2px solid transparent; }
.nav:hover { color: var(--ink); background: var(--panel); }
.nav.on { color: var(--ink); background: color-mix(in srgb, var(--acc) 14%, var(--panel)); border-color: color-mix(in srgb, var(--acc) 60%, transparent); box-shadow: inset 4px 0 0 var(--acc), 0 0 16px color-mix(in srgb, var(--acc) calc(var(--glow-a) * 40%), transparent); }
[dir="rtl"] .nav.on { box-shadow: inset -4px 0 0 var(--acc), 0 0 16px color-mix(in srgb, var(--acc) calc(var(--glow-a) * 40%), transparent); }
.nav .ic { width: 22px; height: 22px; }
.nav .pill { margin-inline-start: auto; }
.side-play { margin-top: 14px; }
.side-foot { margin-top: auto; color: var(--muted); font-size: .8rem; text-align: center; }

.hud-lvl { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; max-width: 520px; }
.lvl-badge { display: inline-flex; align-items: baseline; gap: 3px; padding: 4px 10px; font-family: var(--font-d); font-weight: 800; font-size: .72rem; background: var(--acc2); color: var(--on-acc2); letter-spacing: .1em; clip-path: polygon(0 5px, 5px 5px, 5px 0, calc(100% - 5px) 0, calc(100% - 5px) 5px, 100% 5px, 100% calc(100% - 5px), calc(100% - 5px) calc(100% - 5px), calc(100% - 5px) 100%, 5px 100%, 5px calc(100% - 5px), 0 calc(100% - 5px)); }
.lvl-badge b { font-size: 1.15rem; letter-spacing: 0; }
.xpbar { position: relative; flex: 1; height: 22px; border-radius: 6px; background: var(--bg2); border: 2px solid var(--line); overflow: hidden; }
.xpbar i { position: absolute; inset-block: 0; inset-inline-start: 0; background: repeating-linear-gradient(90deg, var(--acc) 0 10px, color-mix(in srgb, var(--acc) 75%, #fff) 10px 12px); box-shadow: 0 0 14px var(--acc); transition: width .6s cubic-bezier(.2, .9, .3, 1.2); }
.xpbar span { position: relative; display: block; text-align: center; font-family: var(--font-d); font-weight: 800; font-size: .74rem; line-height: 18px; color: var(--ink); text-shadow: 0 0 3px var(--bg), 0 0 6px var(--bg); }
.xpbar.big { height: 28px; margin-top: 8px; } .xpbar.big span { line-height: 24px; font-size: .85rem; }
.hud-stats { display: flex; align-items: center; gap: 10px; margin-inline-start: auto; }
.hs { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-d); font-weight: 800; font-size: 1.05rem; padding: 4px 10px; border-radius: 10px; background: var(--panel); border: 2px solid var(--line); }
.hs .ic { width: 20px; height: 20px; }
.hs.streak { color: var(--muted); }
.hs.streak.lit { color: var(--amb); border-color: color-mix(in srgb, var(--amb) 60%, transparent); box-shadow: 0 0 12px color-mix(in srgb, var(--amb) calc(var(--glow-a) * 60%), transparent); }
.hs.streak.risk { color: var(--amb); animation: blink 1.6s infinite; }
.hs.freeze { color: var(--cy); }
.ring { position: relative; width: 42px; height: 42px; display: inline-grid; place-items: center; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
[dir="rtl"] .ring svg { transform: rotate(-90deg) scaleY(-1); }
.ring circle { fill: none; stroke-width: 4; }
.ring-bg { stroke: var(--line); }
.ring-fg { stroke: var(--lime); stroke-linecap: round; transition: stroke-dashoffset .6s; filter: drop-shadow(0 0 4px var(--lime)); }
.ring b { font-family: var(--font-d); font-size: .72rem; font-weight: 800; }
.ring b .ic { width: 16px; height: 16px; color: var(--lime); }

/* ---------- panels & common blocks ---------- */
.panel { background: color-mix(in srgb, var(--panel) 92%, transparent); border: 2px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: 0 6px 0 var(--shadow); }
.panel-h { display: flex; align-items: center; gap: 8px; font-family: var(--font-d); font-weight: 800; font-size: 1.05rem; margin: 0 0 10px; }
.panel-h .muted { margin-inline-start: auto; font-size: .8rem; }
.sec-h { display: flex; align-items: center; gap: 10px; font-family: var(--font-d); font-weight: 800; font-size: 1.25rem; margin: 30px 0 12px; }
.sec-h .ic { color: var(--acc); }
.view-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.empty { text-align: center; padding: 28px 16px; border: 2px dashed var(--line); border-radius: var(--r); color: var(--muted); }
.empty .ali { margin: 0 auto 6px; }
.empty.sm { padding: 14px; }
.only-narrow { display: none; }
.only-dock { display: none; }
.announcer { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: var(--r); background: linear-gradient(135deg, color-mix(in srgb, var(--acc) 16%, var(--panel)), var(--panel)); border: 2px solid color-mix(in srgb, var(--acc) 55%, transparent); box-shadow: 0 6px 0 var(--shadow), 0 0 24px color-mix(in srgb, var(--acc) calc(var(--glow-a) * 30%), transparent); }
.announcer p { margin: 2px 0 8px; font-weight: 700; }
.ann-body { min-width: 0; }

/* ---------- Ali ---------- */
.ali { position: relative; display: inline-block; width: 68px; flex: none; }
.ali > svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 0 1.5px var(--acc)) drop-shadow(0 0 7px color-mix(in srgb, var(--acc) calc(var(--glow-a) * 90%), transparent)); }
.ali .ali-fit { position: absolute; inset: 0; width: 100%; height: 100%; filter: none; }
.ali.big { width: 120px; }
.ali.sm { width: 46px; }
.ali.fb-ali { width: 64px; }
.mood-happy > svg { animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-4px); } }

/* ---------- toasts ---------- */
.toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 260; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { pointer-events: auto; padding: 11px 16px; border-radius: 12px; background: var(--panel2); border: 2px solid var(--acc); font-weight: 700; box-shadow: 0 6px 0 var(--shadow), 0 0 18px color-mix(in srgb, var(--acc) calc(var(--glow-a) * 50%), transparent); animation: toastIn .3s cubic-bezier(.2, .9, .3, 1.3); }
.toast.warn { border-color: var(--amb); }
.toast.good { border-color: var(--lime); }
.toast.ach { border-color: var(--amb); background: linear-gradient(90deg, color-mix(in srgb, var(--amb) 22%, var(--panel2)), var(--panel2)); }
.toast.out { opacity: 0; transform: translateY(-8px); transition: .35s; }
@keyframes toastIn { from { transform: translateY(-16px) scale(.96); opacity: 0; } }

/* ---------- sheets ---------- */
#layer:empty { display: none; }
.scrim { position: fixed; inset: 0; z-index: 150; background: color-mix(in srgb, #05030f 70%, transparent); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { position: relative; width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 2px solid var(--acc); border-radius: 20px; padding: 26px 24px 22px; box-shadow: 0 10px 0 var(--shadow), 0 0 40px color-mix(in srgb, var(--acc) calc(var(--glow-a) * 40%), transparent); animation: pop .25s cubic-bezier(.2, .9, .3, 1.3); outline: none; }
.sheet.wide { width: min(780px, 100%); }
.sheet-x { position: absolute; top: 12px; inset-inline-end: 12px; }
.sheet-h { font-family: var(--font-d); font-weight: 800; font-size: 1.35rem; margin: 0 40px 10px 0; display: flex; align-items: center; gap: 8px; }
[dir="rtl"] .sheet-h { margin: 0 0 10px 40px; }
.sheet-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 18px; }
@keyframes pop { from { transform: scale(.92) translateY(10px); opacity: 0; } }
.keys h3 { font-family: var(--font-d); margin: 14px 0 6px; color: var(--acc); }
.keys dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 18px; margin: 0; }
.keys dl div { display: flex; gap: 10px; align-items: center; }
.keys dt { min-width: 84px; } .keys dd { margin: 0; color: var(--muted); }

/* ---------- effects ---------- */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 240; overflow: hidden; }
.pt { position: absolute; width: 8px; height: 8px; margin: -4px; animation: pt .75s cubic-bezier(.1, .7, .3, 1) forwards; box-shadow: 0 0 8px currentColor; }
@keyframes pt { to { transform: translate(var(--dx), var(--dy)) scale(.2); opacity: 0; } }
.float { position: absolute; transform: translate(-50%, 0); font-family: var(--font-d); font-weight: 800; font-size: 1.15rem; color: var(--lime); text-shadow: 0 0 10px var(--lime), 2px 2px 0 #000; animation: floatUp 1.05s ease-out forwards; white-space: nowrap; }
.float.big { font-size: 1.8rem; color: var(--amb); text-shadow: 0 0 14px var(--amb), 3px 3px 0 #000; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.7); } 15% { opacity: 1; transform: translate(-50%, 0) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -60px) scale(1); } }
.cf { position: absolute; top: -12px; width: 9px; height: 14px; animation: cf linear forwards; }
@keyframes cf { to { transform: translate(var(--dx), 105vh) rotate(var(--r)); } }
.shake { animation: shake .4s; } .shake2 { animation: shake2 .45s; }
@keyframes shake { 20% { transform: translate(-4px, 1px); } 40% { transform: translate(4px, -1px); } 60% { transform: translate(-3px, 0); } 80% { transform: translate(2px, 1px); } }
@keyframes shake2 { 15% { transform: translate(-8px, 2px) rotate(-.4deg); } 30% { transform: translate(7px, -3px) rotate(.4deg); } 45% { transform: translate(-6px, 2px); } 60% { transform: translate(5px, -1px); } 80% { transform: translate(-2px, 1px); } }

/* ---------- boot ---------- */
.boot { min-height: 50vh; display: grid; place-content: center; text-align: center; }
.boot-logo { font-family: var(--font-d); font-weight: 800; font-size: 2.4rem; letter-spacing: .08em; } .boot-logo span { color: var(--acc); }
.boot-sub { color: var(--acc2); letter-spacing: .3em; font-family: var(--font-d); animation: blink 1s infinite; }

/* ---------- responsive shell ---------- */
@media (max-width: 1240px) {
  .app { grid-template-columns: 84px minmax(0, 1fr); grid-template-areas: "side hud" "side view"; }
  .rail { display: none; }
  .only-narrow { display: block; margin-bottom: 16px; }
  .side { padding: 14px 10px; align-items: center; }
  .side .brand-t, .side .nav span, .side-play span, .side-foot { display: none; }
  .side-brand { margin-bottom: 10px; }
  .nav { justify-content: center; padding: 12px; position: relative; }
  .nav .pill { position: absolute; top: 2px; inset-inline-end: 2px; }
  .side-play { padding: .55em; width: 52px; }
}
@media (max-width: 760px) {
  :root { --hud-h: 58px; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "hud" "view"; }
  .side { display: none; }
  .hud { padding: 8px 12px; gap: 8px; flex-wrap: nowrap; }
  .hud .brand { display: flex; } .hud .brand-t { display: none; } .hud .brand-mark { width: 34px; height: 34px; }
  .hud-lvl { gap: 6px; } .xpbar span { font-size: .66rem; }
  .hud-stats { gap: 6px; } .hs { padding: 3px 7px; font-size: .95rem; }
  .hide-sm { display: none !important; }
  .hs.freeze { display: none; }
  .view { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  .dock { display: flex; position: fixed; inset: auto 0 0 0; z-index: 30; justify-content: space-around; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg2) 92%, transparent); backdrop-filter: blur(10px); border-top: 2px solid var(--line); }
  .dk { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; color: var(--muted); text-decoration: none; font-family: var(--font-d); font-weight: 700; font-size: .72rem; border-radius: 10px; }
  .dk .ic { width: 24px; height: 24px; }
  .dk.on { color: var(--acc); background: color-mix(in srgb, var(--acc) 14%, transparent); text-shadow: 0 0 10px color-mix(in srgb, var(--acc) 60%, transparent); }
  .dk .pill { position: absolute; top: 0; inset-inline-end: 18%; }
  .only-dock { display: inline-flex; }
  .sheet { border-radius: 20px 20px 0 0; align-self: end; width: 100%; max-height: 88vh; padding: 22px 16px 18px; }
  .scrim { padding: 0; place-items: end center; }
  .sheet.wide { width: 100%; }
}

/* ---------- reduced motion ---------- */
.rm *, .rm *::before, .rm *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
.rm .timer i { animation-duration: 6s !important; }
.rm .glitch::before, .rm .glitch::after { display: none; }

/* Character art and an equal, always-unlocked choice on phones and desktop. */
.ali > .guide-art { display: block; width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: contain; filter: drop-shadow(0 0 5px color-mix(in srgb, var(--acc) 45%, transparent)); }
.mood-happy > .guide-art { animation: bob 2.4s ease-in-out infinite; }
.character-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: 100%; max-width: 440px; margin: 16px auto; }
.character-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-width: 0; min-height: 170px; padding: 16px 12px; border: 2px solid var(--muted); border-radius: 18px; background: var(--panel2); color: var(--ink); cursor: pointer; font: inherit; }
.character-card .ali { width: 76px; }
.character-card .ali > * { animation: none; }
.character-card b { font-size: 1.125rem; }
.character-card.on { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--acc); background: color-mix(in srgb, var(--acc) 10%, var(--panel2)); }
.character-card:focus-visible { outline: 3px solid var(--acc); outline-offset: 4px; }
.character-status { display: flex; align-items: center; gap: 5px; min-height: 24px; font-size: .875rem; }
.character-status svg { width: 18px; height: 18px; }
.character-panel { margin-bottom: 24px; }
.onb .character-choices { margin: 12px auto; }
.onb .character-card { min-height: 136px; padding: 10px; gap: 4px; }
.onb .character-card .ali { width: 54px; }
.onb .character-choices + .seg { margin-top: 14px; }
@media (prefers-reduced-motion: reduce) { .mood-happy > .guide-art { animation: none; } }
