/* DECISION MATRIX — style.css
   The Lab: dark arcade / retro-terminal. Pixel type (Press Start 2P) for the
   title, panel tabs and HUD labels; clean mono/sans for the working grid.
   Tokens mirror /lab.css so the app feels native to the arcade. */

/* ---------- fonts (self-hosted, shared with the lab root) ---------- */
@font-face { font-family: "Press Start 2P"; font-style: normal; font-weight: 400; font-display: swap; src: url("/press-start-2p.woff2") format("woff2"); }
@font-face { font-family: "Press Start 2P Fallback"; src: local("Courier New"); size-adjust: 166.64%; ascent-override: 60%; descent-override: 0%; line-gap-override: 0%; }

/* ---------- tokens ---------- */
:root {
  color-scheme: dark;

  --bg: #0a0a12;
  --surface: #12121d;
  --surface-2: #1a1a2a;
  --line: #28283c;
  --control-line: #5e5e80; /* >=3:1 against --surface for field boundaries */
  --text: #e9e9f2;
  --dim: #9aa0b5;

  --cyan: #45f0ff;
  --magenta: #ff3d8b;
  --gold: #ffc857;
  --green: #41ff8b;
  --red: #ff5560;

  --pixel: "Press Start 2P", "Press Start 2P Fallback", "Courier New", monospace;
  --sans: -apple-system, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --glow-cyan: 0 0 14px rgba(69, 240, 255, 0.35);
  --glow-magenta: 0 0 14px rgba(255, 61, 139, 0.4);
  --glow-gold: 0 0 14px rgba(255, 200, 87, 0.35);
  --glow-green: 0 0 14px rgba(65, 255, 139, 0.35);

  --shadow-panel: 0 18px 40px rgba(0, 0, 0, 0.5);
  --gutter: clamp(1rem, 4vw, 2.5rem);
}

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

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--sans);
  font-size: clamp(0.95rem, 0.9rem + 0.3vw, 1.0625rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 520px at 50% -8%, rgba(69, 240, 255, 0.06), transparent 68%),
    radial-gradient(900px 520px at 100% 110%, rgba(255, 61, 139, 0.05), transparent 70%),
    var(--bg);
}

::selection { background: rgba(69, 240, 255, 0.3); color: #05050d; }

[hidden] { display: none !important; }

a { color: var(--cyan); }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(69, 240, 255, 0.18);
  border-radius: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- global scanline / CRT atmosphere ---------- */
.scanlines {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.05) 0 1px,
    transparent 1px 3px
  );
  mix-blend-mode: overlay;
  opacity: 0.5;
}

/* CRT mode — toggled on <body> by app.js */
body.crt::before {
  content: "";
  position: fixed; inset: 0; z-index: 9998; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.16) 0 1px, transparent 1px 3px);
}
body.crt::after {
  content: "";
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.42) 100%);
  box-shadow:
    inset 0 0 130px rgba(69, 240, 255, 0.07),
    inset 6px 0 30px rgba(255, 61, 139, 0.05),
    inset -6px 0 30px rgba(69, 240, 255, 0.06);
}

/* ---------- skip link ---------- */
.skip-link {
  position: absolute;
  left: 12px; top: -56px;
  z-index: 200;
  background: var(--cyan);
  color: #05050d;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-weight: 700;
  text-decoration: none;
  transition: transform var(--duration-fast) var(--ease-out);
}
.skip-link:focus { transform: translateY(64px); }

/* ---------- fixed back-to-lab link ---------- */
.lab-fixed {
  position: fixed;
  top: clamp(0.75rem, 2vw, 1.25rem);
  left: clamp(0.75rem, 2vw, 1.25rem);
  z-index: 120;
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--text);
  text-decoration: none;
  padding: 0.7rem 0.85rem;
  background: rgba(10, 10, 18, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  transition: color var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    transform var(--duration-fast) var(--ease-out),
    box-shadow var(--duration-fast) ease;
}
.lab-fixed:hover,
.lab-fixed:focus-visible {
  color: var(--cyan);
  border-color: var(--cyan);
  transform: translateX(-3px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5), var(--glow-cyan);
}

/* ---------- header ---------- */
.app-header {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: clamp(0.75rem, 2vw, 1.1rem);
  text-align: center;
  max-width: 56rem;
  margin: 0 auto;
  padding: clamp(4.5rem, 9vw, 6.5rem) var(--gutter) clamp(1.5rem, 4vw, 2.5rem);
}

.level-tag {
  margin: 0;
  font-family: var(--pixel);
  font-size: clamp(8px, 1.7vw, 10px);
  letter-spacing: 0.22em;
  color: var(--gold);
  text-shadow: var(--glow-gold);
}

.title {
  margin: 0;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: clamp(1.5rem, 0.5rem + 6.2vw, 3.75rem);
  line-height: 1.18;
  letter-spacing: 0.01em;
  color: var(--text);
  text-shadow: 0 0 18px rgba(69, 240, 255, 0.4), 0 0 52px rgba(69, 240, 255, 0.16);
}

/* glitch hover on the pixel title */
.glitch { position: relative; }
.glitch::before,
.glitch::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  text-shadow: none;
}
.glitch::before { color: var(--cyan); }
.glitch::after { color: var(--magenta); }
.glitch:hover::before { animation: glitch-a 0.42s steps(3, jump-none) 1; }
.glitch:hover::after { animation: glitch-b 0.42s steps(3, jump-none) 1; }

@keyframes glitch-a {
  0%   { opacity: 0.85; clip-path: inset(8% 0 72% 0);  transform: translate3d(-5px, -2px, 0); }
  33%  { opacity: 0.85; clip-path: inset(54% 0 22% 0); transform: translate3d(4px, 1px, 0); }
  66%  { opacity: 0.85; clip-path: inset(28% 0 50% 0); transform: translate3d(-3px, 2px, 0); }
  100% { opacity: 0;    clip-path: inset(45% 0 45% 0); transform: none; }
}
@keyframes glitch-b {
  0%   { opacity: 0.85; clip-path: inset(64% 0 16% 0); transform: translate3d(5px, 2px, 0); }
  33%  { opacity: 0.85; clip-path: inset(12% 0 70% 0); transform: translate3d(-4px, -1px, 0); }
  66%  { opacity: 0.85; clip-path: inset(42% 0 36% 0); transform: translate3d(3px, -2px, 0); }
  100% { opacity: 0;    clip-path: inset(45% 0 45% 0); transform: none; }
}

.tagline {
  margin: 0;
  max-width: 42rem;
  color: var(--dim);
  font-size: clamp(0.95rem, 0.9rem + 0.5vw, 1.15rem);
}

.ink { font-weight: 700; }
.ink--cyan { color: var(--cyan); }
.ink--magenta { color: var(--magenta); }
.ink--gold { color: var(--gold); }
.ink--green { color: var(--green); }

.badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--dim);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
}
.badge--green { color: var(--green); border-color: rgba(65, 255, 139, 0.4); }
.badge__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(65, 255, 139, 0.8);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.35; } }

/* ---------- app shell / responsive layout ---------- */
.app-shell {
  position: relative;
  z-index: 2;
  display: grid;
  gap: clamp(1rem, 2.5vw, 1.5rem);
  width: min(100%, 84rem);
  margin: 0 auto;
  padding: 0 var(--gutter) clamp(2rem, 5vw, 3.5rem);
}

/* ---------- panel ---------- */
.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface) 65%);
  box-shadow: var(--shadow-panel);
  padding: clamp(1.1rem, 2.5vw, 1.6rem);
}

/* thin top accent rail per panel — colour set by modifier */
.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--cyan), transparent 70%);
  opacity: 0.85;
}
.scores-panel::before { background: linear-gradient(90deg, var(--magenta), transparent 70%); }
.ranking-panel::before { background: linear-gradient(90deg, var(--gold), transparent 70%); }
.sensitivity-panel::before { background: linear-gradient(90deg, var(--green), transparent 70%); }
.storage-panel::before { background: linear-gradient(90deg, var(--cyan), transparent 70%); }

.panel-heading {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1.1rem;
}

.panel-title-block {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
}

.panel-tab {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 2.1rem; height: 2.1rem;
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--bg);
  background: var(--cyan);
  border-radius: var(--radius-sm);
  box-shadow: var(--glow-cyan);
}
.panel-tab--magenta { background: var(--magenta); box-shadow: var(--glow-magenta); }
.panel-tab--gold { background: var(--gold); box-shadow: var(--glow-gold); }
.panel-tab--green { background: var(--green); box-shadow: var(--glow-green); }
.panel-tab--cyan { background: var(--cyan); box-shadow: var(--glow-cyan); }

h1, h2, h3, p { margin-top: 0; }

h2 {
  margin: 0 0 0.15rem;
  font-family: var(--mono);
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

.hint {
  margin: 0;
  color: var(--dim);
  font-size: 0.85rem;
  line-height: 1.5;
}

/* setup status pill (decorative) */
.status-text {
  justify-self: start;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--cyan);
  background: rgba(69, 240, 255, 0.08);
  border: 1px solid rgba(69, 240, 255, 0.3);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
}

/* ---------- form fields ---------- */
.field {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}
.field:last-child { margin-bottom: 0; }

.compact-field {
  margin-bottom: 0;
  max-width: 12rem;
  justify-self: start;
}

.field > span,
.field-label,
.inline-label {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.text-input,
.number-input,
input[type="text"],
input[type="number"] {
  width: 100%;
  border: 1px solid var(--control-line);
  border-radius: var(--radius-sm);
  background: #0c0c16;
  color: var(--text);
  min-height: 2.85rem;
  padding: 0.55rem 0.75rem;
  font-family: var(--mono);
  transition: border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease,
    background-color var(--duration-fast) ease;
}

.number-input { max-width: 7rem; }

.text-input:hover:not(:disabled),
.number-input:hover:not(:disabled),
input:hover:not(:disabled) { border-color: var(--cyan); }

.text-input:focus,
.number-input:focus,
input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(69, 240, 255, 0.2);
}

/* ---------- buttons ---------- */
.button-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  min-height: 2.85rem;
  min-width: 2.85rem;
  border: 1px solid var(--control-line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  padding: 0.55rem 0.95rem;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) ease,
    color var(--duration-fast) ease,
    background-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}
.button__glyph { font-size: 1em; line-height: 1; }

.button:hover:not(:disabled) {
  border-color: var(--cyan);
  color: var(--cyan);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), var(--glow-cyan);
}
.button:active:not(:disabled) { transform: translateY(0); }

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.button-secondary { background: transparent; color: var(--dim); }
.button-secondary:hover:not(:disabled) {
  border-color: var(--red);
  color: var(--red);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), 0 0 14px rgba(255, 85, 96, 0.3);
}

.button-primary {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--bg);
  box-shadow: 0 0 18px rgba(255, 200, 87, 0.25);
}
.button-primary:hover:not(:disabled) {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--bg);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), 0 0 26px rgba(255, 200, 87, 0.5);
}

.button-danger {
  border-color: rgba(255, 85, 96, 0.55);
  background: transparent;
  color: var(--red);
  min-height: 2.5rem;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.4rem 0.7rem;
}
.button-danger:hover:not(:disabled) {
  border-color: var(--red);
  color: var(--red);
  background: rgba(255, 85, 96, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4), 0 0 14px rgba(255, 85, 96, 0.3);
}

/* ---------- score grid (terminal table) ---------- */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #0c0c16;
  scrollbar-color: var(--control-line) transparent;
}

.matrix-table,
.sensitivity-table {
  width: 100%;
  min-width: 46rem;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.85rem;
}

.matrix-table th,
.matrix-table td,
.sensitivity-table th,
.sensitivity-table td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 0.7rem;
  text-align: left;
  vertical-align: top;
}

.matrix-table th:last-child,
.matrix-table td:last-child,
.sensitivity-table th:last-child,
.sensitivity-table td:last-child {
  border-right: 0;
}

.matrix-table thead th,
.sensitivity-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  color: var(--cyan);
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: 0.04em;
  vertical-align: top;
  box-shadow: inset 0 -1px 0 var(--line);
}

/* criterion header cells carry editable controls — relax the pixel font there */
.matrix-table thead .criterion-header,
.matrix-table thead .option-header { font-family: var(--mono); }

.matrix-table tbody tr:last-child th,
.matrix-table tbody tr:last-child td,
.sensitivity-table tbody tr:last-child td { border-bottom: 0; }

.matrix-table tbody tr:hover td,
.matrix-table tbody tr:hover th { background: rgba(69, 240, 255, 0.04); }

.option-header { min-width: 12rem; }
.criterion-header { min-width: 12rem; }
.score-cell { min-width: 7rem; }

/* row-header (option name) sits on the left edge */
.matrix-table th[scope="row"] {
  background: rgba(255, 61, 139, 0.05);
  color: var(--text);
}

.cell-stack,
.criterion-stack {
  display: grid;
  gap: 0.45rem;
}

.inline-label {
  font-size: 0.62rem;
  letter-spacing: 0.06em;
}

.criterion-name-input { color: var(--cyan); }
.option-name-input { color: var(--magenta); }
.score-input { max-width: 5rem; text-align: center; }
.criterion-weight-input { color: var(--gold); max-width: 6rem; }

.row-actions,
.criterion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ---------- summary stats ---------- */
.summary-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  margin: 0 0 1.1rem;
}

.summary-stat {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(10, 10, 18, 0.45);
  padding: 0.8rem 0.85rem;
}

.summary-stat dt {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.summary-stat dd {
  margin: 0.3rem 0 0;
  font-family: var(--pixel);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text);
}

/* ---------- ranking list ---------- */
.ranking-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: rank;
}

.ranking-item {
  display: grid;
  gap: 0.65rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(10, 10, 18, 0.4);
  padding: 0.9rem;
  transition: border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}
.ranking-item:hover { border-color: var(--control-line); }

/* leader gets the gold treatment */
.ranking-item--leader {
  border-color: rgba(255, 200, 87, 0.55);
  background: linear-gradient(180deg, rgba(255, 200, 87, 0.08), rgba(10, 10, 18, 0.4) 60%);
  box-shadow: inset 0 0 24px rgba(255, 200, 87, 0.08);
}

.ranking-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 0.85rem;
}

.rank-label {
  font-family: var(--pixel);
  font-size: 11px;
  color: var(--cyan);
  margin-right: 0.5rem;
}
.ranking-item--leader .rank-label { color: var(--gold); text-shadow: var(--glow-gold); }

.ranking-name {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  overflow-wrap: anywhere;
}

.ranking-score {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--dim);
}
.ranking-item--leader .ranking-score { color: var(--gold); }

.bar-meter {
  position: relative;
  width: 100%;
  height: 0.85rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
}

.bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  box-shadow: 0 0 12px rgba(69, 240, 255, 0.4);
  transition: width var(--duration-normal) var(--ease-out);
}
.ranking-item--leader .bar-fill {
  background: linear-gradient(90deg, var(--gold), var(--magenta));
  box-shadow: 0 0 14px rgba(255, 200, 87, 0.5);
}

/* ---------- sensitivity shifts ---------- */
.sensitivity-table tbody td { color: var(--text); }
.sensitivity-table tbody tr:hover td { background: rgba(65, 255, 139, 0.05); }

.shift-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.shift-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  min-height: 1.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 10, 18, 0.5);
  padding: 0.25rem 0.65rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--dim);
}

.shift-up {
  border-color: rgba(65, 255, 139, 0.55);
  color: var(--green);
  box-shadow: 0 0 10px rgba(65, 255, 139, 0.18);
}
.shift-down {
  border-color: rgba(255, 85, 96, 0.55);
  color: var(--red);
  box-shadow: 0 0 10px rgba(255, 85, 96, 0.18);
}
.shift-same { color: var(--dim); }

.scenario-order {
  min-width: 14rem;
  color: var(--dim);
  line-height: 1.6;
}

.apply-nudge-button { min-height: 2.4rem; font-size: 0.74rem; }

/* ---------- status + empty ---------- */
.status-message {
  margin: 1rem 0 0;
  min-height: 1.4rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--green);
}

.empty-state {
  margin: 0;
  padding: 1.1rem;
  border: 1px dashed var(--control-line);
  border-radius: var(--radius-sm);
  background: rgba(10, 10, 18, 0.4);
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--dim);
}
.ranking-list .empty-state { border: 1px dashed var(--control-line); }

/* ---------- footer ---------- */
.app-footer {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 1rem;
  padding: clamp(2rem, 5vw, 3.5rem) var(--gutter) clamp(2.5rem, 5vw, 3.5rem);
  border-top: 1px solid var(--line);
  text-align: center;
}

.footer__copy {
  margin: 0;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--dim);
}
.footer__blink { display: inline-block; color: var(--gold); animation: blink 2.2s steps(2, jump-none) infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

.footer__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.footer__link {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--dim);
  text-decoration-color: var(--line);
  transition: color var(--duration-fast) ease;
}
.footer__link:hover { color: var(--cyan); }

.footer__crt {
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: 0.06em;
  background: transparent;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.85rem;
  cursor: pointer;
  transition: color var(--duration-fast) ease,
    border-color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease;
}
.footer__crt:hover { color: var(--cyan); border-color: var(--cyan); }
.footer__crt[aria-pressed="true"] {
  color: var(--green);
  border-color: var(--green);
  box-shadow: var(--glow-green);
}

.footer__flavor {
  margin: 0;
  font-family: var(--pixel);
  font-size: 8px;
  letter-spacing: 0.18em;
  color: var(--gold);
}

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: min(20rem, calc(100vw - 28px));
  pointer-events: none;
}

.toast {
  font-family: var(--pixel);
  font-size: 8px;
  line-height: 1.85;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--gold);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 14px rgba(255, 200, 87, 0.18);
  opacity: 0;
  transform: translate3d(0, 12px, 0);
  transition: opacity var(--duration-normal) var(--ease-out),
    transform var(--duration-normal) var(--ease-out);
}
.toast--cyan { border-color: var(--cyan); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 14px rgba(69, 240, 255, 0.2); }
.toast--green { border-color: var(--green); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 14px rgba(65, 255, 139, 0.2); }
.toast--red { border-color: var(--red); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55), 0 0 14px rgba(255, 85, 96, 0.2); }
.toast--in { opacity: 1; transform: none; }
.toast--out { opacity: 0; transform: translate3d(0, -10px, 0); }

/* ---------- responsive ---------- */
@media (min-width: 640px) {
  .panel-heading {
    grid-template-columns: 1fr auto;
    align-items: start;
  }
  .summary-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field { max-width: 28rem; }
  .compact-field { max-width: 12rem; }
}

@media (min-width: 960px) {
  .summary-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .glitch:hover::before,
  .glitch:hover::after { animation: none !important; opacity: 0 !important; }
  .button:hover:not(:disabled),
  .button-primary:hover:not(:disabled),
  .button-danger:hover:not(:disabled),
  .lab-fixed:hover,
  .lab-fixed:focus-visible { transform: none; }
}
