/* STACK3D - dark neon-cyberpunk chrome. #101020 background, #ff3355 / #33ffcc accents.
   No web fonts, no images, no @import: every byte is local. */

:root {
  --bg: #101020;
  --hot: #ff3355;
  --cool: #33ffcc;
  --ink: #e8f4ff;
  --dim: #7f8ea8;
  --panel: rgba(12, 12, 26, 0.72);
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, "Liberation Mono", monospace;
  --sans: system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
}

/* The WebGL surface must own every gesture: drag = orbit, pinch = zoom. */
#renderCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  outline: none;
}

/* Scanline + vignette overlay; purely decorative and click-through. */
#overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(51, 255, 204, 0.05), transparent 60%),
    radial-gradient(100% 100% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55) 100%),
    repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.022) 0 1px, transparent 1px 3px);
}

#hud {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: max(12px, env(safe-area-inset-left));
  width: min(320px, calc(100vw - 24px));
  padding: 14px 16px 12px;
  border: 1px solid rgba(51, 255, 204, 0.28);
  border-radius: 10px;
  background: var(--panel);
  backdrop-filter: blur(6px);
  box-shadow: 0 0 0 1px rgba(255, 51, 85, 0.08), 0 18px 40px rgba(0, 0, 0, 0.55);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.35;
}

#hud h1 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.22em;
  color: var(--cool);
  text-shadow: 0 0 12px rgba(51, 255, 204, 0.45);
}

#hud .sub {
  margin: 2px 0 10px;
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.03em;
}

#hud .sub b { color: var(--hot); font-weight: 600; }

#stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
  margin: 0 0 12px;
  padding: 8px 0 0;
  border-top: 1px solid rgba(51, 255, 204, 0.16);
}

#stats > div { display: flex; justify-content: space-between; gap: 8px; min-width: 0; }
#stats dt { color: var(--dim); text-transform: uppercase; font-size: 10px; letter-spacing: 0.08em; }
#stats dd {
  margin: 0;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#stats > div:nth-child(-n+2) dd { color: var(--cool); }
#stats > div:nth-last-child(-n+2) { grid-column: 1 / -1; }

#controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

#controls button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 40px;               /* comfortable touch target */
  padding: 8px 10px;
  border: 1px solid rgba(51, 255, 204, 0.3);
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(51, 255, 204, 0.09), rgba(51, 255, 204, 0.02));
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 120ms ease, background 120ms ease, transform 60ms ease;
}

#controls button:hover { border-color: var(--cool); }
#controls button:active { transform: translateY(1px) scale(0.99); }
#controls button:focus-visible { outline: 2px solid var(--hot); outline-offset: 2px; }
#controls button[aria-pressed="true"] {
  border-color: var(--hot);
  background: linear-gradient(180deg, rgba(255, 51, 85, 0.22), rgba(255, 51, 85, 0.05));
  color: #fff;
}

kbd {
  padding: 1px 5px;
  border: 1px solid rgba(232, 244, 255, 0.22);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
}

#note {
  margin: 0 0 2px;
  min-height: 16px;
  color: var(--cool);
  font-size: 11px;
  overflow-wrap: anywhere;
}

#hud .hint { margin: 0; color: var(--dim); font-size: 10px; }

/* Off-screen but present in the DOM: `--dump-dom` must be able to read it. */
#slice-report {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  white-space: pre;
  font-family: var(--mono);
  font-size: 10px;
}

@media (max-width: 560px) {
  #hud { width: calc(100vw - 20px); font-size: 11px; }
  #stats { grid-template-columns: 1fr 1fr; }
  #controls { grid-template-columns: 1fr 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  #controls button { transition: none; }
}
