/* =====================================================================
   Abyss: deep-sea UI. The game is all canvas; these styles dress the
   HUD, the touch pad and the panels in sonar-screen blues.
   ===================================================================== */

:root {
  --deep: #04101c;
  --panel: #0a1e30;
  --glow: #59d2f5;
  --glow-dim: #2a7a9c;
  --ink: #cfeefc;
  --muted: #6d97ad;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  overflow: hidden;
  background: var(--deep);
  touch-action: manipulation;
}

#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.nav-back-games {
  position: fixed; top: 14px; left: 16px; z-index: 50;
  font-size: 14px; font-weight: 600; letter-spacing: 1px;
  color: var(--glow); text-decoration: none;
  background: rgba(4, 16, 28, 0.8);
  border: 1px solid var(--glow-dim); border-radius: 6px;
  padding: 7px 13px;
}
.nav-back-games:hover { border-color: var(--glow); color: #fff; }

/* ---- HUD: a sonar readout strip -------------------------------------- */
.hud {
  position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 20;
  display: flex; gap: 22px; align-items: baseline;
  font-family: "Courier New", monospace;
  background: rgba(4, 16, 28, 0.75);
  border: 1px solid var(--glow-dim); border-radius: 8px;
  padding: 6px 20px;
  pointer-events: none;
  text-shadow: 0 0 8px rgba(89, 210, 245, 0.5);
}
.hud #hud-score { font-size: 22px; font-weight: 700; color: var(--glow); }
.hud #hud-lines { font-size: 14px; color: var(--ink); }
.hud #hud-depth { font-size: 14px; color: var(--muted); }

/* ---- touch pad --------------------------------------------------------- */
#pad {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(2, 8, 16, 0.85) 30%);
}
#pad[hidden] { display: none; }
/* a real mouse means keyboard play: no pad, whatever the touch sensors say */
@media (hover: hover) and (pointer: fine) { #pad { display: none !important; } }
#pad button {
  font-size: 24px; line-height: 1; cursor: pointer;
  color: var(--glow);
  background: rgba(10, 30, 48, 0.9);
  border: 1.5px solid var(--glow-dim); border-radius: 12px;
  padding: 16px 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: none; user-select: none;
}
#pad button:active { background: rgba(42, 122, 156, 0.5); }

/* ---- panels -------------------------------------------------------------- */
.panel {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  padding: 26px 16px; overflow-y: auto;
  background: rgba(1, 5, 12, 0.55);
}
.panel[hidden] { display: none; }
/* centred while it fits; a card taller than the screen starts at the top and
   the panel scrolls (centring alone would put its heading out of reach) */
.panel > .card { margin: auto; }

.card {
  width: min(430px, 100%);
  background: linear-gradient(180deg, rgba(10, 30, 48, 0.96), rgba(5, 16, 28, 0.96));
  border: 1px solid var(--glow-dim); border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(89, 210, 245, 0.12), 0 18px 50px rgba(0, 0, 0, 0.7),
    inset 0 0 60px rgba(20, 80, 110, 0.15);
  padding: 24px 24px 20px;
}
.card h1, .card h2 {
  font-weight: 700; letter-spacing: 8px; color: var(--glow);
  text-shadow: 0 0 18px rgba(89, 210, 245, 0.6);
}
.card h1 { font-size: 32px; }
.card h2 { font-size: 22px; letter-spacing: 4px; }
.card .tag { color: var(--muted); font-style: italic; margin: 4px 0 12px; }
.card .how { font-size: 14.5px; line-height: 1.55; margin-bottom: 10px; }
.card .how b { color: var(--glow); }
/* the sweep is Visual FX on only; with it off the help names the wall marks */
html.fx-off .fx-on-word, html:not(.fx-off) .fx-off-word { display: none; }
.card .keys { font-size: 12.5px; line-height: 2; color: var(--muted); margin-bottom: 12px; }

kbd {
  font-family: "Courier New", monospace; font-size: 11px;
  background: rgba(89, 210, 245, 0.12); color: var(--glow);
  border: 1px solid var(--glow-dim); border-radius: 4px; padding: 1px 6px;
}

.pick .seg { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.seg button {
  font-family: inherit; font-size: 16px; text-align: left; cursor: pointer;
  color: var(--ink); background: rgba(255, 255, 255, 0.03);
  border: 1px solid #1e3d54; border-radius: 9px; padding: 9px 13px;
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
}
.seg button small { font-size: 12.5px; color: var(--muted); text-align: right; }
.seg button.on { border-color: var(--glow); background: rgba(89, 210, 245, 0.08); }
.seg button.on b { color: var(--glow); }

.playbtn {
  font-family: inherit; font-size: 20px; font-weight: 700; letter-spacing: 4px;
  width: 100%; cursor: pointer;
  color: #04101c; background: linear-gradient(170deg, #a5e8fa, var(--glow) 60%, #2fa3c9);
  border: 0; border-radius: 10px; padding: 12px;
  box-shadow: 0 0 22px rgba(89, 210, 245, 0.4);
}
.playbtn:hover { filter: brightness(1.08); }
.playbtn:active { transform: translateY(2px); }
.playbtn kbd { background: rgba(4, 16, 28, 0.25); color: #04101c; border-color: transparent; }

.bests { margin-top: 12px; font-size: 13px; color: var(--muted); min-height: 17px; text-align: center; font-family: "Courier New", monospace; }

.card .big {
  font-size: 40px; font-weight: 700; color: var(--glow);
  font-family: "Courier New", monospace; margin: 8px 0 2px;
  text-shadow: 0 0 18px rgba(89, 210, 245, 0.5);
}
.card .stats { font-size: 14px; color: var(--muted); margin: 4px 0 16px; white-space: pre-line; line-height: 1.6; }
.card .row { display: flex; gap: 10px; flex-wrap: wrap; }
.card .row button {
  font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer;
  color: var(--ink); background: rgba(255, 255, 255, 0.04);
  border: 1px solid #1e3d54; border-radius: 9px; padding: 10px 18px;
}
.card .row button:first-child {
  color: #04101c; background: linear-gradient(170deg, #a5e8fa, var(--glow));
  border-color: transparent;
}
.card .row button:hover { filter: brightness(1.1); }
.card .row button:active { transform: translateY(1px); }

@media (max-width: 640px) {
  .panel { padding-top: 62px; }      /* (a card starts below the corner buttons) */
  .card h1 { font-size: 26px; letter-spacing: 5px; }
  .hud { top: 58px; gap: 12px; padding: 5px 12px; }
  .hud #hud-score { font-size: 18px; }
  .hud #hud-lines, .hud #hud-depth { font-size: 12px; }
}
