/* Prism Breaker — one stylesheet, no framework.
 * Dark glass palette. Every text/background pair below clears WCAG 2.1 AA
 * (4.5:1 for body text, 3:1 for large text and UI borders).
 */

:root {
  --bg: #0b0d18;
  --bg-2: #10132250;
  --panel: #141830;
  --panel-2: #1b2040;
  --line: #2b3260;
  --ink: #eef1fb;          /* on --bg  → 16.8:1 */
  --ink-2: #b9c2e0;        /* on --bg  →  9.4:1 */
  --ink-3: #97a2c8;        /* on --bg  →  6.4:1 */
  --cyan: #6fe3ff;
  --cyan-ink: #a9eeff;     /* link color on dark → 9.9:1 */
  --mint: #63f2c0;
  --amber: #ffd166;
  --rose: #ff8095;
  --focus: #ffd166;
  --radius: 12px;
  --wrap: 1080px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 50% -12%, #1a2050 0%, transparent 62%),
    radial-gradient(760px 420px at 92% 4%, #2a1a4a 0%, transparent 58%);
  background-repeat: no-repeat;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
}

.wrap { width: min(100% - 2.4rem, var(--wrap)); margin-inline: auto; }

/* ---------- accessibility primitives ---------- */

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 50;
  background: var(--amber); color: #12142a; font-weight: 700;
  padding: 0.6rem 1rem; border-radius: 8px; text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 8px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

a { color: var(--cyan-ink); text-underline-offset: 3px; }
a:hover { color: #ffffff; }

/* ---------- header ---------- */

.site-head {
  border-bottom: 1px solid var(--line);
  background: #0a0c16cc;
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.head-row { display: flex; align-items: center; gap: 0.85rem; padding: 0.7rem 0; flex-wrap: wrap; }
.brand {
  width: 22px; height: 22px; flex: none; border-radius: 6px;
  background: linear-gradient(135deg, #6fe3ff 0%, #8f7bff 48%, #ff7bd0 100%);
  box-shadow: 0 0 16px #6fe3ff66;
}
.brand-name { margin: 0; font-family: var(--mono); font-weight: 700; letter-spacing: 0.04em; font-size: 1rem; }
.navlist { list-style: none; display: flex; gap: 1rem; margin: 0 0 0 auto; padding: 0; flex-wrap: wrap; }
.navlist a { color: var(--ink-2); text-decoration: none; font-size: 0.92rem; }
.navlist a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- typography ---------- */

h1 {
  font-size: clamp(1.75rem, 4.2vw, 2.65rem);
  line-height: 1.18;
  letter-spacing: -0.015em;
  margin: 2rem 0 1rem;
  background: linear-gradient(100deg, #ffffff 0%, #a9eeff 42%, #d7b6ff 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--ink);
}
h2 { font-size: clamp(1.25rem, 2.6vw, 1.6rem); margin: 2.6rem 0 0.85rem; letter-spacing: -0.01em; }
h3 { font-size: 1.08rem; margin: 1.6rem 0 0.4rem; color: var(--cyan-ink); }
p { margin: 0 0 1rem; }

.intro { font-size: 1.06rem; color: var(--ink-2); max-width: 74ch; }
.note { color: var(--ink-3); font-size: 0.95rem; }

main section { scroll-margin-top: 4.5rem; }

/* ---------- HUD ---------- */

.hud {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 0.5rem;
  margin: 1.4rem 0 0.6rem;
}
.hud-cell {
  margin: 0; padding: 0.45rem 0.7rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  display: flex; flex-direction: column; min-width: 0;
}
.hud-key { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--ink-3); }
.hud-val { font-family: var(--mono); font-size: 1.12rem; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-wide .hud-val { font-size: 0.95rem; }

/* ---------- stage ----------
   The wrapper reserves the exact 11:8 box before the canvas paints, so the
   page never shifts once JavaScript runs. */

.stage-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 880 / 640;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #070810;
  box-shadow: 0 24px 70px -30px #000, 0 0 0 1px #ffffff0a inset;
}
#stage { display: block; width: 100%; height: 100%; touch-action: none; }
#stage:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }

/* ---------- overlays ---------- */

.overlay {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 1rem;
  background: linear-gradient(180deg, #070810e6, #070810f7);
  overflow: auto;
}
.overlay[hidden] { display: none; }

.panel {
  width: min(560px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.3rem;
  text-align: left;
  box-shadow: 0 20px 60px -24px #000;
}
.panel h2 { margin: 0 0 0.35rem; font-size: 1.3rem; }
.panel-sub { color: var(--ink-2); font-size: 0.92rem; margin: 0 0 0.85rem; }
.panel-meta { color: var(--ink-2); font-size: 0.9rem; margin: 0.8rem 0 0.9rem; }
.panel-meta strong { font-family: var(--mono); color: var(--ink); }
.panel-note { color: var(--ink-3); font-size: 0.86rem; margin: 0.5rem 0 0; }
.panel-foot { color: var(--ink-3); font-size: 0.84rem; margin: 0.7rem 0 0; }
.big-score { font-family: var(--mono); font-size: 2.6rem; font-weight: 700; margin: 0.2rem 0 0.3rem; color: var(--cyan); }

/* ---------- difficulty picker ---------- */

.tier-picker { border: 0; margin: 0; padding: 0; display: grid; gap: 0.4rem; }

.tier-option {
  display: flex; gap: 0.65rem; align-items: flex-start;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
}
.tier-option:hover { border-color: #46508f; }
.tier-option input { margin: 0.35rem 0 0; accent-color: var(--cyan); flex: none; width: 17px; height: 17px; }
.tier-option:has(input:checked) { border-color: var(--cyan); box-shadow: 0 0 0 1px var(--cyan) inset; }
.tier-option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.tier-body { display: block; }
.tier-name { display: block; font-weight: 700; font-size: 0.98rem; letter-spacing: 0.01em; }
.tier-name em { font-style: normal; font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: #10142a; background: var(--cyan); border-radius: 999px; padding: 0.08rem 0.42rem; margin-left: 0.4rem; vertical-align: 0.12em; }
.tier-blurb { display: block; color: var(--ink-2); font-size: 0.86rem; line-height: 1.5; }

/* ---------- buttons and fields ---------- */

.btn {
  font: inherit; font-size: 0.94rem; font-weight: 600;
  color: var(--ink); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 9px;
  padding: 0.52rem 1.05rem; cursor: pointer;
}
.btn:hover { background: #262c56; border-color: #46508f; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: linear-gradient(135deg, #6fe3ff, #8f7bff); color: #0b0d18; border-color: transparent; }
.btn-primary:hover { background: linear-gradient(135deg, #8beeff, #a692ff); }
.btn-small { font-size: 0.85rem; padding: 0.38rem 0.8rem; }
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1rem; }
#btn-start { margin-top: 0.2rem; width: 100%; padding: 0.65rem 1rem; font-size: 1rem; }

.field { display: flex; align-items: center; gap: 0.6rem; margin: 0.6rem 0 0; }
.field label { font-size: 0.9rem; color: var(--ink-2); }
select {
  font: inherit; font-size: 0.92rem; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 0.35rem 0.6rem;
}

.controls-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin: 0.6rem 0 0; }

.effects { list-style: none; display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0; padding: 0; }
.fx {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.03em;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 0.2rem 0.62rem; color: var(--ink-2); background: var(--panel);
}
.fx span { color: var(--cyan); }
.fx-bad { border-color: #7a3350; color: var(--rose); }
.fx-floor { border-color: #2f6f5c; color: var(--mint); }
.fx-none { color: var(--ink-3); }

.noscript {
  margin-top: 0.8rem; padding: 0.7rem 0.9rem;
  border: 1px solid var(--line); border-left: 3px solid var(--amber);
  border-radius: 8px; background: var(--panel); color: var(--ink-2); font-size: 0.92rem;
}

/* ---------- prose lists ---------- */

.steps, .features, .tier-list { max-width: 82ch; }
.steps { padding-left: 1.25rem; }
.steps li { margin-bottom: 0.5rem; color: var(--ink-2); }
.steps li strong, .features li strong, .tier-list li strong { color: var(--ink); }

.features, .tier-list { list-style: none; padding: 0; display: grid; gap: 0.5rem; }
.features li, .tier-list li {
  color: var(--ink-2); font-size: 0.95rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line); border-left: 3px solid var(--cyan);
  border-radius: 8px; background: var(--bg-2);
}
.tier-list li { border-left-color: #8f7bff; }

#faq p { color: var(--ink-2); max-width: 82ch; }
#about-build p { color: var(--ink-2); max-width: 82ch; }

/* ---------- footer ---------- */

.site-foot {
  margin-top: 3.5rem; padding: 1.6rem 0 2.4rem;
  border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: 0.92rem;
}
.site-foot p { margin: 0 0 0.45rem; max-width: 82ch; }
.fine { font-size: 0.82rem; color: var(--ink-3); }

/* ---------- legal pages ---------- */

.legal { max-width: 74ch; }
.legal h2 { margin-top: 2rem; }
.legal li { color: var(--ink-2); margin-bottom: 0.4rem; }
.legal code {
  font-family: var(--mono); font-size: 0.86em;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 5px; padding: 0.08em 0.36em; color: var(--cyan-ink);
}
.legal table { border-collapse: collapse; width: 100%; margin: 0.6rem 0 1.2rem; font-size: 0.92rem; }
.legal th, .legal td { text-align: left; padding: 0.5rem 0.7rem; border: 1px solid var(--line); vertical-align: top; }
.legal th { background: var(--panel-2); color: var(--ink); }
.legal td { color: var(--ink-2); }

/* ---------- small screens ---------- */

@media (max-width: 640px) {
  body { font-size: 16px; }
  .navlist { gap: 0.7rem; width: 100%; margin-left: 0; }
  .hud { grid-template-columns: repeat(3, 1fr); }
  .hud-wide { grid-column: span 3; }
  .panel { padding: 0.9rem 0.95rem 1.05rem; }
  .tier-blurb { font-size: 0.82rem; }
}

/* ---------- reduced motion ----------
   The canvas honors this too: shake, trail, bloom and most particles are
   switched off in game.js when this setting is on. */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .skip-link { transition: none; }
}
