/* ==========================================================================
   klol.at — design tokens
   ========================================================================== */
:root {
  --bg: #0a0a0b;
  --surface: rgba(17, 17, 19, 0.92);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --fg: #fafafa;
  --fg-2: #d4d4d8;
  --fg-3: #a1a1aa;
  --fg-4: #71717a;
  --correct: #22a06b;
  --present: #d4a72c;
  --absent: #27272a;
  --radius: 22px;
  --ease-spring: cubic-bezier(.2, .9, .25, 1.15);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
svg { display: block; }
[hidden] { display: none !important; }
.tab { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   Stage: spotlight, dot grid, eyes, vignette
   ========================================================================== */
.stage { position: fixed; inset: 0; --mx: 50vw; --my: 45vh; cursor: crosshair; }
.stage > * { position: absolute; inset: 0; }
.spot, .dots, .vignette { pointer-events: none; }
.spot { background: radial-gradient(560px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.045), transparent 60%); }
.dots {
  background-image: radial-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: center;
  -webkit-mask-image: radial-gradient(260px circle at var(--mx) var(--my), #000, transparent 72%);
          mask-image: radial-gradient(260px circle at var(--mx) var(--my), #000, transparent 72%);
}
.eyes { width: 100%; height: 100%; }
.vignette { background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, 0.6) 100%); }
.relics { pointer-events: none; }

/* Hidden relic tiles */
.relic {
  position: absolute; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  opacity: 0.03; pointer-events: none;
  transition: transform .4s var(--ease-spring);
  will-change: opacity, filter;
}
.relic:hover, .relic:focus-visible { transform: translate(-50%, calc(-50% - 3px)); outline: none; }
.relic .tile {
  width: 68px; height: 68px; border-radius: 19px; display: grid; place-items: center;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10), 0 24px 44px -18px rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
  transition: border-color .2s;
}
.relic:hover .tile, .relic:focus-visible .tile { border-color: rgba(255, 255, 255, 0.24); }
.relic .label { font-size: 12px; font-weight: 500; letter-spacing: .02em; color: var(--fg-3); }
.mini-grid { display: grid; grid-template-columns: repeat(3, 8px); gap: 3px; }
.mini-grid i { width: 8px; height: 8px; border-radius: 2px; background: #52525b; }
.mini-grid i.c { background: var(--correct); }
.mini-grid i.p { background: var(--present); }
.relic .tile svg {
  width: 26px; height: 26px; color: var(--fg-2);
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.relic { touch-action: manipulation; }

/* Keyboard focus always reveals a relic: these !important rules win over
   the JS-driven inline opacity/filter so focused relics are never invisible. */
.relic:focus, .relic:focus-visible {
  opacity: 1 !important;
  filter: none !important;
}
.relic:focus .tile, .relic:focus-visible .tile {
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.22), 0 24px 44px -18px rgba(0, 0, 0, 0.9);
}
.relic:focus .label, .relic:focus-visible .label { color: var(--fg); }
.relic:active .tile { border-color: rgba(255, 255, 255, 0.4); }

/* Restore keyboard focus rings where the component styles use outline: none. */
.dock-btn:focus-visible, .close:focus-visible, .btn:focus-visible,
.key:focus-visible, .seg button:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.45);
  outline-offset: 2px;
}

/* ==========================================================================
   Footer dock
   ========================================================================== */
.dock {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 4px; padding: 4px; z-index: 20;
  border-radius: 16px; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.8);
}
.dock-btn {
  position: relative; width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; color: var(--fg-3);
  transition: color .2s, background .2s;
}
.dock-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.dock-btn:hover, .dock-btn:focus-visible { color: var(--fg); background: rgba(255, 255, 255, 0.07); outline: none; }
.dock-btn::after {
  content: attr(data-tip); position: absolute; bottom: 48px; left: 50%;
  transform: translate(-50%, 4px); padding: 4px 9px; border-radius: 8px;
  font-size: 12px; white-space: nowrap; color: var(--fg-2);
  background: #18181b; border: 1px solid var(--line);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.dock-btn:hover::after, .dock-btn:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.dock-sep { width: 1px; height: 20px; background: rgba(255, 255, 255, 0.1); margin: 0 2px; }

/* ==========================================================================
   Modals & sheets
   ========================================================================== */
.modal {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px;
  background: rgba(6, 6, 7, 0.55); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.modal.open { opacity: 1; pointer-events: auto; }
.sheet {
  width: 100%; max-height: calc(100dvh - 32px); overflow: auto; padding: 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 40px 80px -30px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transform: scale(.96) translateY(10px); transition: transform .5s var(--ease-spring);
}
.modal.open .sheet { transform: none; }
.sheet-wordle { max-width: 380px; }
.sheet-pacman { max-width: 520px; }
.sheet-lb { max-width: 400px; }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.sheet-head .title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.sheet-head .meta { font-size: 13px; color: var(--fg-4); }
.sheet-head .close { margin-left: auto; }
.close {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: var(--fg-4);
  transition: color .2s, background .2s;
}
.close svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.close:hover, .close:focus-visible { color: var(--fg); background: rgba(255, 255, 255, 0.08); outline: none; }
.hint { margin: 14px 0 0; text-align: center; font-size: 12px; color: var(--fg-4); }
.row { display: flex; gap: 8px; }

.btn {
  height: 34px; padding: 0 14px; border-radius: 10px; font-size: 13px; font-weight: 500;
  background: rgba(255, 255, 255, 0.08); transition: background .15s, transform .1s;
}
.btn:hover { background: rgba(255, 255, 255, 0.14); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--fg); color: #09090b; }
.btn-primary:hover { background: #e4e4e7; }

/* Segmented control */
.seg {
  position: relative; display: inline-flex; padding: 2px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.06);
  max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 0 0 auto; white-space: nowrap; position: relative; z-index: 1; height: 28px; padding: 0 10px; font-size: 12px; font-weight: 500; color: var(--fg-3); transition: color .2s; }
.seg button.active { color: var(--fg); }
.seg-pill {
  position: absolute; top: 2px; bottom: 2px; left: 0; width: 0; border-radius: 10px;
  background: rgba(255, 255, 255, 0.12); transition: transform .35s var(--ease-spring), width .35s var(--ease-spring);
}

/* Toast */
.toast {
  position: fixed; top: max(16px, env(safe-area-inset-top)); left: 50%; z-index: 50;
  transform: translate(-50%, -8px); padding: 7px 14px; border-radius: 999px;
  font-size: 13px; background: rgba(24, 24, 27, 0.95); border: 1px solid var(--line);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .3s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   Wordle
   ========================================================================== */
.w-grid { display: grid; gap: 6px; justify-content: center; margin-bottom: 18px; perspective: 500px; }
.w-row { display: grid; grid-template-columns: repeat(5, 52px); gap: 6px; }
.w-row.shake { animation: shake .4s; }
.wt {
  height: 52px; border-radius: 12px; display: grid; place-items: center;
  font-size: 22px; font-weight: 650; color: var(--fg);
  border: 1px solid rgba(255, 255, 255, 0.09); background: rgba(255, 255, 255, 0.02);
  transition: background .1s, border-color .1s;
}
.wt.filled { border-color: rgba(255, 255, 255, 0.3); animation: pop .12s ease; }
.wt.flip { animation: flip .5s ease forwards; }
.wt.c { background: var(--correct); border-color: var(--correct); }
.wt.p { background: var(--present); border-color: var(--present); }
.wt.a { background: var(--absent); border-color: var(--absent); color: var(--fg-3); }
.wt.win { animation: bounce .5s ease; }
@keyframes flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
@keyframes pop { 50% { transform: scale(1.08); } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
@keyframes bounce { 40% { transform: translateY(-10px); } 70% { transform: translateY(2px); } }

.w-kb { display: grid; gap: 6px; }
.w-kb .krow { display: flex; justify-content: center; gap: 5px; }
.key {
  flex: 1; max-width: 32px; height: 44px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--fg-2);
  background: rgba(255, 255, 255, 0.08); transition: background .15s, transform .08s;
}
.key.wide { max-width: 56px; flex: 1.6; font-size: 12px; }
.key:hover { background: rgba(255, 255, 255, 0.14); }
.key:active { transform: scale(.95); }
.key.c { background: var(--correct); color: #fff; }
.key.p { background: var(--present); color: #fff; }
.key.a { background: #18181b; color: #52525b; }

.result {
  margin-top: 16px; padding: 12px; border-radius: 14px; display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.06); font-size: 13px; color: var(--fg-2);
}
.result .grow { flex: 1; }

/* ==========================================================================
   Pac-Man
   ========================================================================== */
.pac-wrap { position: relative; display: grid; place-items: center; }
.pac { display: block; width: 100%; max-width: 456px; aspect-ratio: 19 / 20; border-radius: 14px; background: #0c0c0e; touch-action: none; }
.pac-overlay {
  position: absolute; inset: 0; margin: auto; width: 100%; max-width: 456px; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: rgba(8, 8, 10, 0.72); backdrop-filter: blur(4px); transition: opacity .25s;
}
.pac-overlay.hide { opacity: 0; pointer-events: none; }
.over-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.over-sub { font-size: 13px; color: var(--fg-3); margin-bottom: 6px; }
.lives { display: flex; gap: 4px; }
.lives i { width: 10px; height: 10px; border-radius: 50%; background: #fde047; clip-path: polygon(50% 50%, 100% 20%, 100% 0, 0 0, 0 100%, 100% 100%, 100% 80%); }

/* ==========================================================================
   Abyss — Krillion (deep-ocean arcade)
   ========================================================================== */
#m-abyss {
  --abyss-deep: #050a14;
  --abyss-cyan: #4de3ff;
  --abyss-pink: #ff5d8f;
  --abyss-gold: #ffd166;
  --abyss-drift: #7d93b8;
}
#m-abyss .ds-px {
  clip-path: polygon(
    7px 0, calc(100% - 7px) 0, 100% 7px,
    100% calc(100% - 7px), calc(100% - 7px) 100%,
    7px 100%, 0 calc(100% - 7px), 0 7px
  );
}
.sheet-abyss {
  position: relative;
  max-width: 440px;
  background:
    radial-gradient(130% 70% at 50% -8%, rgba(77, 227, 255, 0.16), transparent 58%),
    linear-gradient(180deg, #071426 0%, var(--abyss-deep) 60%);
  border-color: rgba(77, 227, 255, 0.16);
}
/* CRT scanlines + phosphor vignette */
.sheet-abyss::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  pointer-events: none; opacity: .55; mix-blend-mode: multiply;
  background:
    radial-gradient(120% 100% at 50% 0%, transparent 55%, rgba(0, 0, 0, 0.5) 100%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px);
}
.sheet-abyss .abyss-kicker { margin: 0; font-size: 10px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--abyss-drift); }
.sheet-abyss .abyss-prompt { margin: 0 0 14px; font-size: 19px; line-height: 1.32; font-weight: 650; letter-spacing: -0.012em; color: #eaf6ff; }
.sheet-abyss .hint { color: var(--abyss-drift); }

/* HUD: depth pod · pips + kicker · score pod */
.abyss-hud { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; margin-bottom: 10px; }
.abyss-pod {
  display: inline-flex; align-items: baseline; gap: 3px; padding: 6px 10px;
  background: rgba(77, 227, 255, 0.06);
  box-shadow: inset 0 0 0 1px rgba(77, 227, 255, 0.22), 0 0 14px rgba(77, 227, 255, 0.08);
}
.abyss-pod b { font: 700 16px/1 var(--mono); font-variant-numeric: tabular-nums; color: var(--abyss-cyan); text-shadow: 0 0 10px rgba(77, 227, 255, 0.55); }
.abyss-pod i { font: 700 9px/1 var(--mono); font-style: normal; letter-spacing: .1em; color: var(--abyss-drift); transform: translateY(-1px); }
#a-score b { color: var(--abyss-gold); text-shadow: 0 0 10px rgba(255, 209, 102, 0.5); }
.abyss-center { display: grid; justify-items: center; gap: 5px; min-width: 0; }
.abyss-dots { display: flex; gap: 7px; }
.abyss-dots i {
  width: 9px; height: 9px; border-radius: 50%;
  background: #0b1d33; box-shadow: inset 0 0 0 1px rgba(125, 147, 184, 0.4);
}
.abyss-dots i.done { background: var(--abyss-gold); box-shadow: 0 0 8px rgba(255, 209, 102, 0.6), inset 0 0 0 1px rgba(255, 255, 255, 0.3); }
.abyss-dots i.miss { background: #2a1522; box-shadow: inset 0 0 0 1px rgba(255, 93, 143, 0.45); }
.abyss-dots i.cur { background: var(--abyss-pink); box-shadow: 0 0 10px rgba(255, 93, 143, 0.85), inset 0 0 0 1px rgba(255, 255, 255, 0.3); animation: ds-pip 1.1s var(--ease-out) infinite; }
@keyframes ds-pip { 50% { transform: scale(1.3); } }

/* Descent bar: points earned so far */
.abyss-progress { height: 4px; border-radius: 999px; overflow: hidden; margin-bottom: 12px; background: rgba(77, 227, 255, 0.08); }
.abyss-progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--abyss-cyan), var(--abyss-gold)); transition: width .3s var(--ease-out); }

/* Sonar radar timer */
.abyss-card {
  position: relative; padding: 16px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(77, 227, 255, 0.07), rgba(77, 227, 255, 0.015) 60%), #050d1c;
  box-shadow: inset 0 0 0 1px rgba(77, 227, 255, 0.16), 0 0 24px rgba(77, 227, 255, 0.08);
}
.abyss-sonar {
  position: relative; float: right; width: 74px; height: 74px; margin: 0 0 8px 10px;
  border-radius: 50%; overflow: hidden;
  background:
    repeating-radial-gradient(circle at 50% 50%, rgba(77, 227, 255, 0.09) 0 1px, transparent 1px 9px),
    radial-gradient(circle at 50% 50%, rgba(77, 227, 255, 0.14), rgba(5, 12, 24, 0.2) 70%, #041223 100%);
  box-shadow: inset 0 0 0 2px rgba(77, 227, 255, 0.4), 0 0 18px rgba(77, 227, 255, 0.22);
}
.abyss-sonar::before, .abyss-sonar::after { content: ""; position: absolute; inset: 0; margin: auto; background: rgba(77, 227, 255, 0.28); }
.abyss-sonar::before { width: 64%; height: 1px; }
.abyss-sonar::after { width: 1px; height: 64%; }
.ds-sweep {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(77, 227, 255, 0.55), rgba(77, 227, 255, 0.08) 46deg, transparent 70deg);
  animation: ds-spin 2.4s linear infinite;
}
.ds-sweep::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 3px; height: 3px;
  border-radius: 50%; background: var(--abyss-cyan);
  box-shadow: 0 0 7px var(--abyss-cyan); transform: translate(-50%, -50%);
}
@keyframes ds-spin { to { transform: rotate(360deg); } }
.ds-time {
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 700 15px/1 var(--mono); font-variant-numeric: tabular-nums;
  color: var(--abyss-cyan); text-shadow: 0 0 12px rgba(77, 227, 255, 0.8);
  z-index: 1;
}
.ds-time.low { color: var(--abyss-pink); text-shadow: 0 0 12px rgba(255, 93, 143, 0.85); animation: ds-blink 1s steps(2, jump-none) infinite; }
@keyframes ds-blink { 50% { opacity: .5; } }
.abyss-sonar.low { box-shadow: inset 0 0 0 2px rgba(255, 93, 143, 0.55), 0 0 18px rgba(255, 93, 143, 0.3); }

/* Arcade input + 3D dive button */
.abyss-form { display: flex; gap: 8px; }
.abyss-form input {
  flex: 1; min-width: 0; height: 40px; padding: 0 12px; border-radius: 8px;
  font: 600 14px var(--mono); letter-spacing: .02em; color: #eaf9ff;
  background: rgba(4, 14, 28, 0.9);
  border: 1px solid rgba(77, 227, 255, 0.32);
  box-shadow: inset 0 0 12px rgba(77, 227, 255, 0.08), 0 0 0 rgba(77, 227, 255, 0);
  outline: none; user-select: text;
}
.abyss-form input::placeholder { color: var(--abyss-drift); font-weight: 400; }
.abyss-form input:focus {
  border-color: var(--abyss-cyan);
  box-shadow: inset 0 0 14px rgba(77, 227, 255, 0.16), 0 0 14px rgba(77, 227, 255, 0.35);
}
.abyss-form input:disabled { opacity: .5; }
#m-abyss #a-submit {
  height: 40px; padding: 0 16px; border: 0; border-radius: 8px;
  font: 800 12px var(--mono); letter-spacing: .18em; text-transform: uppercase;
  color: #23060f;
  background: linear-gradient(180deg, #ff7fa4 0%, #ff5d8f 45%, #f03e74 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -2px 0 rgba(130, 20, 55, 0.6),
    0 4px 0 #b03260,
    0 8px 16px rgba(255, 93, 143, 0.35);
  transition: transform .08s, box-shadow .08s, filter .15s;
}
#m-abyss #a-submit:hover { filter: brightness(1.08); }
#m-abyss #a-submit:active {
  transform: translateY(4px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -2px 0 rgba(130, 20, 55, 0.6),
    0 0 0 #b03260,
    0 3px 8px rgba(255, 93, 143, 0.25);
}
#m-abyss #a-submit:disabled { opacity: .55; box-shadow: none; transform: none; }

/* Fuse timer bar under the input */
.ds-fuse { height: 6px; margin-top: 8px; border-radius: 3px; overflow: hidden; background: rgba(255, 255, 255, 0.06); box-shadow: inset 0 0 0 1px rgba(125, 147, 184, 0.15); }
.ds-fuse i {
  display: block; width: 100%; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--abyss-gold), var(--abyss-pink));
  box-shadow: 0 0 10px rgba(255, 209, 102, 0.4);
  transition: width .25s linear;
}
.ds-fuse i.burn { filter: saturate(1.3); animation: ds-fuse-blink .5s steps(2, jump-none) infinite; }
.ds-fuse i.out { width: 0 !important; }
@keyframes ds-fuse-blink { 50% { opacity: .35; } }

/* Feedback, correction pill, mascot */
.abyss-feedback { min-height: 20px; margin: 10px 0 0; padding-right: 44px; font-size: 13px; color: var(--abyss-drift); }
.abyss-feedback.ok { color: #6ee7b7; }
.abyss-feedback.miss { color: #ff9dbb; }
.abyss-feedback.fix { color: var(--abyss-gold); }
.abyss-feedback .tier { font-weight: 600; }
.abyss-correction {
  display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  margin: 12px 0 2px; padding: 9px 48px 9px 12px;
  font-size: 12px; color: var(--abyss-gold);
  background: rgba(255, 209, 102, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.4), 0 0 18px rgba(255, 209, 102, 0.12);
  animation: fadeUp .3s var(--ease-out) both;
}
.abyss-correction .from { color: var(--abyss-drift); text-decoration: line-through; text-decoration-color: rgba(255, 93, 143, 0.7); font-weight: 600; }
.abyss-correction .ds-arrow { color: var(--abyss-pink); font-weight: 700; }
.abyss-correction .to { color: #8df5c0; font-weight: 700; letter-spacing: .02em; }
.abyss-correction .hint { color: var(--abyss-drift); }
.abyss-mascot {
  position: absolute; right: 12px; bottom: 10px; width: 26px; height: 26px;
  pointer-events: none; filter: drop-shadow(0 0 6px rgba(255, 93, 143, 0.5));
  animation: ds-bob 1s steps(2, jump-none) infinite alternate;
}
.abyss-mascot i { --u: 3px; display: block; width: var(--u); height: var(--u); box-shadow:
  calc(1*var(--u)) 0 var(--abyss-cyan), calc(5*var(--u)) 0 var(--abyss-cyan),
  calc(1*var(--u)) var(--u) var(--abyss-pink), calc(5*var(--u)) var(--u) var(--abyss-pink),
  0 calc(2*var(--u)) var(--abyss-pink), var(--u) calc(2*var(--u)) var(--abyss-pink), calc(2*var(--u)) calc(2*var(--u)) #ffe3ee, calc(3*var(--u)) calc(2*var(--u)) var(--abyss-pink), calc(4*var(--u)) calc(2*var(--u)) #ffe3ee, calc(5*var(--u)) calc(2*var(--u)) var(--abyss-pink),
  0 calc(3*var(--u)) var(--abyss-pink), var(--u) calc(3*var(--u)) var(--abyss-pink), calc(2*var(--u)) calc(3*var(--u)) var(--abyss-pink), calc(3*var(--u)) calc(3*var(--u)) var(--abyss-pink), calc(4*var(--u)) calc(3*var(--u)) var(--abyss-pink), calc(5*var(--u)) calc(3*var(--u)) var(--abyss-pink),
  0 calc(4*var(--u)) var(--abyss-pink), var(--u) calc(4*var(--u)) var(--abyss-pink), calc(2*var(--u)) calc(4*var(--u)) var(--abyss-pink), calc(3*var(--u)) calc(4*var(--u)) var(--abyss-pink), calc(4*var(--u)) calc(4*var(--u)) var(--abyss-pink), calc(5*var(--u)) calc(4*var(--u)) var(--abyss-pink),
  var(--u) calc(5*var(--u)) var(--abyss-pink), calc(2*var(--u)) calc(5*var(--u)) var(--abyss-pink), calc(3*var(--u)) calc(5*var(--u)) var(--abyss-pink), calc(4*var(--u)) calc(5*var(--u)) var(--abyss-pink),
  calc(2*var(--u)) calc(6*var(--u)) var(--abyss-gold), calc(4*var(--u)) calc(6*var(--u)) var(--abyss-gold),
  calc(2*var(--u)) calc(7*var(--u)) var(--abyss-pink), calc(4*var(--u)) calc(7*var(--u)) var(--abyss-pink); }
@keyframes ds-bob { from { transform: translate(0, 0) rotate(-3deg); } to { transform: translate(-4px, -6px) rotate(4deg); } }
.abyss-mascot.cheer { animation: ds-cheer .5s var(--ease-spring) 2; filter: drop-shadow(0 0 10px rgba(255, 209, 102, 0.9)); }
@keyframes ds-cheer { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-10px) rotate(8deg); } }
.abyss-mascot.ouch { animation: ds-ouch .4s steps(4, jump-none) 2; filter: drop-shadow(0 0 6px rgba(255, 93, 143, 0.8)); }
@keyframes ds-ouch { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-4px) rotate(-14deg); } }
.abyss-mascot.dive { animation: ds-dive .45s var(--ease-out) infinite alternate; }
@keyframes ds-dive { from { transform: translateY(-4px) rotate(-8deg) scaleY(1.1); } to { transform: translateY(3px) rotate(10deg) scaleY(.9); } }

/* Game over: landed tier celebration + summary */
.abyss-result {
  margin-top: 14px; padding: 14px; border-radius: 14px;
  background: linear-gradient(180deg, rgba(77, 227, 255, 0.06), rgba(255, 93, 143, 0.04)), #050d1c;
  box-shadow: inset 0 0 0 1px rgba(77, 227, 255, 0.18);
  animation: fadeUp .35s var(--ease-out) both;
}
.abyss-landed { padding: 12px 10px; margin-bottom: 10px; border-radius: 12px; text-align: center;
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.14), rgba(77, 227, 255, 0.1));
  box-shadow: inset 0 0 0 1px rgba(255, 209, 102, 0.35);
}
.abyss-landed .tier-name { display: block; font: 800 17px/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--abyss-gold); text-shadow: 0 0 14px rgba(255, 209, 102, 0.65); animation: ds-landed .6s var(--ease-spring) both; }
@keyframes ds-landed { from { opacity: 0; transform: translateY(8px) scale(.9); } }
.abyss-landed .tier-sub { display: block; margin-top: 4px; font-size: 11px; letter-spacing: .06em; color: var(--abyss-drift); }
.abyss-result-head { display: flex; align-items: baseline; gap: 8px; }
.abyss-result-head b { font-size: 26px; font-weight: 750; letter-spacing: -0.02em; color: var(--abyss-cyan); text-shadow: 0 0 14px rgba(77, 227, 255, 0.45); }
.abyss-result-head span { font-size: 12px; color: var(--abyss-drift); }
.abyss-result-sub { margin: 2px 0 0; font-size: 12px; color: var(--abyss-drift); }
.abyss-rows { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.abyss-rows li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 8px;
  min-width: 0; font-size: 12px;
}
.abyss-rows .q {
  grid-column: 1 / -1; min-width: 0; font-size: 11px;
  color: var(--abyss-drift); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.abyss-rows .a {
  grid-column: 1; grid-row: 2; min-width: 0; color: #cfe8ff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.abyss-rows .a.miss { color: #5b6f8d; }
.abyss-rows .pts { grid-column: 2; grid-row: 2; min-width: 38px; text-align: right; color: var(--abyss-drift); font-variant-numeric: tabular-nums; }
.abyss-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tier-drifter { color: #a1a1aa; }
.tier-minnow { color: #67e8f9; }
.tier-shoal { color: #5eead4; }
.tier-rare { color: #93c5fd; }
.tier-deepcut { color: #c4b5fd; }
.tier-abyssal { color: #fde047; }
.abyss-rows .a.tier-drifter { color: #a1a1aa; }
.abyss-rows .a.tier-minnow { color: #67e8f9; }
.abyss-rows .a.tier-shoal { color: #5eead4; }
.abyss-rows .a.tier-rare { color: #93c5fd; }
.abyss-rows .a.tier-deepcut { color: #c4b5fd; }
.abyss-rows .a.tier-abyssal { color: #fde047; }

/* ==========================================================================
   Dungeon & Skate — shared canvas shell, slot selector, end screen
   ========================================================================== */
.sheet-dungeon, .sheet-skate { max-width: 480px; }
.dg-wrap { position: relative; display: grid; place-items: center; }
.dg-canvas {
  display: block; width: 100%; border-radius: 14px; background: #0c0c0e;
  image-rendering: pixelated; touch-action: none;
}
.sheet-dungeon .dg-canvas { aspect-ratio: 256 / 176; }
.sheet-skate .dg-canvas { aspect-ratio: 320 / 180; }
.dg-canvas:focus { outline: none; }
.slot-overlay {
  position: absolute; inset: 0; border-radius: 14px; padding: 18px 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(8, 8, 10, 0.78); backdrop-filter: blur(4px);
  transition: opacity .25s; overflow: auto;
}
.slot-overlay.hide { opacity: 0; pointer-events: none; }
.slot-title {
  margin: 0; font-size: 12px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; color: var(--fg-3);
}
.slot-list { display: grid; gap: 8px; width: 100%; max-width: 360px; }
.slot-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.06);
}
.slot-label { display: flex; flex-direction: column; gap: 2px; min-width: 0; text-align: left; }
.slot-label b { font-size: 13px; }
.slot-label span {
  font-size: 12px; color: var(--fg-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.slot-hint { margin: 2px 0 0; font-size: 12px; color: var(--fg-4); text-align: center; }
.slot-code { display: flex; gap: 8px; width: 100%; max-width: 360px; }
.slot-code input {
  flex: 1; min-width: 0; height: 34px; padding: 0 10px; border-radius: 10px;
  font-size: 13px; text-transform: uppercase;
  background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.1);
  outline: none; user-select: text;
}
.slot-code input:focus { border-color: rgba(255, 255, 255, 0.3); }
.slot-end {
  position: absolute; inset: 0; border-radius: 14px; padding: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: rgba(8, 8, 10, 0.8); backdrop-filter: blur(4px); text-align: center;
}
.slot-end[hidden] { display: none; }
.over-score { font-size: 22px; font-weight: 700; letter-spacing: -.01em; color: #ffd166; }
.slot-end .row { flex-wrap: wrap; justify-content: center; }

/* ==========================================================================
   Leaderboard
   ========================================================================== */
.lb-submit {
  display: flex; align-items: center; gap: 8px; padding: 8px; margin-bottom: 12px;
  border-radius: 14px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.06);
}
.lb-submit span { font-size: 13px; color: var(--fg-3); padding-left: 4px; white-space: nowrap; }
.lb-submit input {
  flex: 1; min-width: 0; height: 34px; padding: 0 10px; border-radius: 10px; font-size: 13px;
  background: rgba(0, 0, 0, 0.4); border: 1px solid rgba(255, 255, 255, 0.1); outline: none; user-select: text;
}
.lb-submit input:focus { border-color: rgba(255, 255, 255, 0.3); }
.lb-list { list-style: none; margin: 0; padding: 0; min-height: 120px; }
.lb-list li { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 10px; border-radius: 12px; animation: fadeUp .35s var(--ease-out) both; }
.lb-list li.me { background: rgba(255, 255, 255, 0.06); }
.lb-list .rank { width: 16px; font-size: 12px; color: var(--fg-4); }
.lb-list .avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.lb-list .name { flex: 1; font-size: 14px; color: var(--fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-list .val { font-size: 14px; color: var(--fg-3); }
.lb-list li:first-child .name, .lb-list li:first-child .val { color: var(--fg); font-weight: 500; }
.lb-empty { display: grid; place-items: center; height: 120px; font-size: 13px; color: var(--fg-4); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } }

/* ==========================================================================
   Responsive & accessibility
   ========================================================================== */
@media (max-width: 420px) {
  .w-row { grid-template-columns: repeat(5, 46px); }
  .wt { height: 46px; font-size: 20px; }
  .sheet { padding: 14px; }
  .abyss-prompt { font-size: 17px; padding-right: 0; }
  .abyss-sonar { float: none; margin: 0 auto 10px; }
  .abyss-form input { height: 40px; font-size: 16px; }
  .abyss-result-head b { font-size: 23px; }
}
@media (max-width: 340px) {
  .w-row { grid-template-columns: repeat(5, 36px); gap: 4px; }
  .wt { height: 36px; font-size: 16px; border-radius: 9px; }
  .key { height: 38px; }
  .result { font-size: 12px; }
}
/* Short viewports: compact sheets so modals fully fit without scrolling. */
@media (max-height: 620px) {
  .modal { padding: 10px; }
  .sheet { padding: 12px; max-height: calc(100dvh - 20px); }
  .sheet-head { margin-bottom: 10px; }
  .w-grid { margin-bottom: 10px; }
  .w-row { grid-template-columns: repeat(5, 40px); gap: 5px; }
  .wt { height: 40px; font-size: 18px; }
  .key { height: 36px; }
  .result { margin-top: 10px; padding: 9px 10px; }
  .hint { margin-top: 8px; }
  .lb-list { min-height: 80px; }
  .lb-list li { height: 36px; }
  .lb-empty { height: 80px; }
  .pac-overlay .over-title { font-size: 16px; }
  .over-sub { font-size: 12px; margin-bottom: 2px; }
  .abyss-card { padding: 12px; }
  .abyss-prompt { font-size: 16px; margin-bottom: 10px; }
  .abyss-hud { margin-bottom: 9px; }
  .abyss-sonar { width: 64px; height: 64px; }
  .abyss-mascot { display: none; }
  .abyss-rows { gap: 4px; }
  .abyss-result { margin-top: 10px; padding: 11px; }
  .slot-overlay, .slot-end { padding: 10px; }
  .slot-row { padding: 8px 10px; }
}
@media (hover: none) {
  .stage { cursor: default; }
  .relic:active .tile { background: rgba(255, 255, 255, 0.14); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .relic { will-change: auto; }
}

