/* ===========================================================================
   scutball -- 16-bit gridiron throwback skin
   SNES-era sports-title vibe: chunky beveled scoreboard panels, pixel fonts,
   CRT scanlines, AstroTurf-green play field. Original art; no trademarks.
   ========================================================================= */

:root {
  --bg: #0a0e1a;
  --field: #1f6b2c;
  --field-dark: #14501f;
  --chalk: #f4f1e8;
  --navy: #101a44;
  --royal: #2b50e0;
  --royal-lite: #5b7be0;
  --red: #d4332f;
  --gold: #f2c14e;
  --ink: #f4f1e8;
  --muted: #9fd6a8;

  /* gameplay swatches -- single source of truth; app.js reads these */
  --play: #3cc24a;
  --recharge: #2b6be0;
  --away: #7a8290;
  --girlfriend: #e85aa0;
  --coplay: #f2c14e;
  --offpeak: #2b8be0;
  --premium: #e0a52b;
  --target: #ef4d52;   /* the draggable / matched health-target point */

  --panel: #16225a;
  --bevel-lite: #4a63c8;
  --bevel-dark: #070b22;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  font-family: "VT323", "Courier New", monospace;
  font-size: 20px;
  line-height: 1.25;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -10%, #1b2c63 0%, #0a0e1a 60%),
    var(--bg);
  image-rendering: pixelated;
  -webkit-font-smoothing: none;
}

/* CRT scanlines + subtle vignette overlay */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  background:
    repeating-linear-gradient(rgba(0,0,0,0.22) 0 1px, rgba(0,0,0,0) 1px 3px),
    radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 55%, rgba(0,0,0,0.45) 100%);
  mix-blend-mode: multiply;
}

.pixel, h1, h2, .controls label, .legend, .hint, button {
  font-family: "Press Start 2P", "VT323", monospace;
}

/* ---- header / title card ------------------------------------------------ */
header {
  padding: 22px 28px 18px;
  text-align: center;
  background:
    repeating-linear-gradient(90deg, #0c1330 0 18px, #0e1740 18px 36px);
  border-bottom: 4px solid #000;
  box-shadow: inset 0 -8px 0 rgba(0,0,0,0.5);
}
header h1 {
  margin: 0 0 12px;
  font-size: 30px;
  letter-spacing: 2px;
  color: var(--gold);
  text-transform: uppercase;
  text-shadow:
    3px 3px 0 #000, -3px 0 0 var(--red), 3px 0 0 var(--royal),
    0 6px 0 rgba(0,0,0,0.6);
}
.sub {
  margin: 0 auto;
  max-width: 760px;
  color: var(--muted);
  font-size: 19px;
}
code {
  color: var(--gold);
  background: #000;
  border: 2px solid var(--royal);
  padding: 0 5px;
}

/* ---- layout ------------------------------------------------------------- */
main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  padding: 22px 28px;
}
@media (max-width: 980px) { main { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 4px solid #000;
  padding: 14px 16px 18px;
  box-shadow:
    inset 4px 4px 0 var(--bevel-lite),
    inset -4px -4px 0 var(--bevel-dark),
    0 8px 0 rgba(0,0,0,0.55);
}
.panel h2 {
  margin: -2px -2px 12px;
  padding: 8px 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(var(--royal), var(--navy));
  border: 3px solid #000;
  box-shadow: inset 2px 2px 0 var(--royal-lite), inset -2px -2px 0 #0a1030;
}

.hint { color: var(--muted); font-size: 9px; line-height: 1.8; margin: 0 0 8px; }
.dot { font-weight: 700; }
.dot.target { color: var(--target); text-shadow: 1px 1px 0 #000; }
.dot.sol { color: var(--play); text-shadow: 1px 1px 0 #000; }

svg { width: 100%; display: block; }
#vector-svg {
  height: 420px;
  touch-action: none;
  cursor: grab;
  background: radial-gradient(circle at 50% 40%, #111c3e 0%, #060912 80%);
  border: 3px solid #000;
  box-shadow: inset 2px 2px 0 #2a3a78, inset -2px -2px 0 #03060f;
}

/* schedule rendered over an AstroTurf field with chalk yard lines */
#schedule-svg {
  height: 300px;
  background:
    repeating-linear-gradient(90deg,
      rgba(244,241,232,0.16) 0 2px, rgba(244,241,232,0) 2px 9.8%),
    repeating-linear-gradient(0deg, var(--field) 0 14px, var(--field-dark) 14px 28px);
  border: 3px solid #000;
  box-shadow: inset 2px 2px 0 #2f8a40, inset -2px -2px 0 #0a3315;
}

.readout {
  margin-top: 10px;
  font-size: 19px;
  color: var(--play);
  text-shadow: 0 0 6px rgba(60,194,74,0.6);
  font-variant-numeric: tabular-nums;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.ro-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.ro-k {
  flex: 0 0 auto; min-width: 104px;
  font-family: "Press Start 2P", monospace; font-size: 8.5px; line-height: 1.7;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--muted); text-shadow: none;
}
.ro-v { color: var(--play); }
.ro-dim { color: var(--muted); text-shadow: none; font-size: 0.72em; }
.ro-tag {
  font-family: "Press Start 2P", monospace; font-size: 7.5px;
  color: var(--muted); text-shadow: none;
  border: 1px solid var(--muted); border-radius: 2px;
  padding: 2px 5px; margin-left: 8px; white-space: nowrap;
}

.controls { display: flex; gap: 26px; flex-wrap: wrap; margin: 4px 0 14px; }
.controls label {
  font-size: 9px;
  line-height: 1.8;
  text-transform: uppercase;
  color: var(--gold);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 240px;
}
.controls input[type=range] {
  width: 100%;
  height: 16px;
  accent-color: var(--gold);
  background: #000;
  border: 2px solid #000;
}
.controls select {
  font-family: "Press Start 2P", monospace;
  font-size: 9px;
  color: #fff;
  background: #000;
  border: 3px solid var(--gold);
  padding: 6px;
  cursor: pointer;
}

#coplay-readout { color: var(--coplay); text-shadow: 0 0 6px rgba(242,193,78,0.7); font-variant-numeric: tabular-nums; }
/* re-solve in flight: signal "working", not "stuck" (only for slow solves) */
#coplay-readout.solving { color: var(--muted); text-shadow: none; animation: hv-pulse 1.1s ease-in-out infinite; }
#schedule-svg.solving-dim { opacity: 0.5; transition: opacity 0.12s ease; }
@keyframes hv-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; align-items: center; font-size: 8.5px; line-height: 1.8; text-transform: uppercase; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }

.axis-key {
  display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 2px;
  font-family: "Press Start 2P", monospace; font-size: 8.5px; line-height: 1.8;
  color: var(--muted);
}
.axis-key span { display: inline-flex; align-items: center; gap: 6px; }
.axis-key i { width: 12px; height: 12px; border: 2px solid #000; display: inline-block; }
.axis-key b { font-weight: normal; }
.sw { width: 14px; height: 14px; display: inline-block; border: 2px solid #000; box-shadow: inset 1px 1px 0 rgba(255,255,255,0.4); }
.sw.play { background: var(--play); }
.sw.recharge { background: var(--recharge); }
.sw.away { background: var(--away); }
.sw.girlfriend { background: var(--girlfriend); }
.sw.coplay { background: var(--coplay); }
.sw.offpeak { background: var(--offpeak); }
.sw.premium { background: var(--premium); }

footer {
  padding: 16px 28px 26px;
  color: var(--muted);
  font-size: 16px;
  text-align: center;
  border-top: 4px solid #000;
  background: #0c1330;
}

/* d3 svg text */
.axis-label { fill: var(--chalk); font-family: "Press Start 2P", monospace; font-size: 8px; }
.tick text { fill: var(--chalk); font-family: "Press Start 2P", monospace; font-size: 7px; }
.tick line { stroke: rgba(244,241,232,0.35); }

/* the hierholzer_v text stays visually identical -- only the cursor hints it clicks */
code.hh-link { cursor: pointer; }

/* about modal (retro scoreboard panel) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: none; align-items: center; justify-content: center; padding: 20px;
  background: rgba(5, 8, 16, 0.82);
}
.modal-overlay.open { display: flex; }
.modal {
  width: 100%; max-width: 660px; max-height: 86vh; overflow: auto;
  background: var(--panel); border: 4px solid #000; padding: 14px 20px 20px;
  box-shadow: inset 4px 4px 0 var(--bevel-lite), inset -4px -4px 0 var(--bevel-dark), 0 10px 0 rgba(0,0,0,0.6);
}
.modal h3 {
  font-family: "Press Start 2P", monospace; font-size: 14px; color: var(--gold);
  text-transform: uppercase; letter-spacing: 1px; margin: 2px 0 14px;
  text-shadow: 2px 2px 0 #000;
}
.modal p { font-size: 19px; line-height: 1.35; color: var(--ink); margin: 0 0 12px; }
.modal p.tiny { font-size: 16px; color: var(--muted); margin-top: 4px; }
.modal .close {
  float: right; font-family: "Press Start 2P", monospace; font-size: 12px;
  color: #fff; background: var(--red); border: 3px solid #000; cursor: pointer;
  padding: 6px 9px; box-shadow: inset 2px 2px 0 #ef7a7a, inset -2px -2px 0 #7a1512;
}

/* ---- phones: the pixel fonts are wide, so scale the headings down -------- */
@media (max-width: 560px) {
  body { font-size: 18px; }
  header { padding: 14px 14px 12px; }
  header h1 {
    font-size: 15px; letter-spacing: 1px; line-height: 1.6;
    text-shadow: 2px 2px 0 #000, -2px 0 0 var(--red), 2px 0 0 var(--royal);
  }
  .sub { font-size: 16px; }
  main { padding: 14px; gap: 14px; }
  .panel { padding: 12px 12px 14px; }
  .panel h2 { font-size: 10px; line-height: 1.5; }
  .hint { font-size: 8px; }
  .controls { gap: 16px; }
  .controls label { min-width: 100%; font-size: 8px; }
  .legend { font-size: 7.5px; gap: 10px; }
  .axis-key { font-size: 7.5px; gap: 10px; }
  .readout { gap: 9px; }
  .ro-row { flex-direction: column; gap: 1px; }
  .ro-k { min-width: 0; }
  .modal h3 { font-size: 11px; }
  .modal p { font-size: 17px; }
  .modal p.tiny { font-size: 15px; }
  .axis-label { font-size: 7px; }
  #vector-svg { height: 360px; }
  #schedule-svg { height: 280px; }
  footer { font-size: 14px; }
}
