/* ============================================================
   DEADLOCK // ITEM REVIEW -- 80s TERMINAL EDITION
   Monochrome CRT: black glass, phosphor green, amber alarms,
   ASCII frames, scanlines, flicker, no rounded corners.
   ============================================================ */

:root {
  --bg: #0a0a0a;

  /* Phosphor inks. Everything is green or amber, only dimmed. */
  --green: #33ff00;
  --green-bright: #7dff57;
  --green-dim: #25c400;
  --green-faint: rgba(51, 255, 0, 0.42);
  --amber: #ffb000;
  --amber-dim: #c98500;

  --text: var(--green);
  --text-dim: var(--green-dim);
  --text-faint: var(--green-faint);

  --font-mono: "Share Tech Mono", "VT323", ui-monospace, "Cascadia Mono",
    Consolas, monospace;
  --font-display: "VT323", "Share Tech Mono", ui-monospace, monospace;
}

/* Category inks: green for positive, amber for warnings. */
.cat--brilliant { --cat: var(--amber); }
.cat--best { --cat: var(--green); }
.cat--good { --cat: var(--green-dim); }
.cat--inaccuracy { --cat: var(--amber); }
.cat--mistake { --cat: var(--amber); }
.cat--blunder { --cat: var(--amber); }
.cat--base { --cat: var(--green-faint); }

*,
*::before,
*::after {
  box-sizing: border-box;
  border-radius: 0 !important;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: var(--app-height, 100vh);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.55;
  color: var(--green);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  text-shadow:
    0 0 5px rgba(51, 255, 0, 0.85),
    0 0 12px rgba(51, 255, 0, 0.28);
}

::selection {
  background: var(--green);
  color: var(--bg);
  text-shadow: none;
}

/* ------------------------------------------------------------
   CRT layers
   ------------------------------------------------------------ */

/* Scanlines + slight flicker. Sits above the UI, ignores clicks. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.26) 2px,
    rgba(0, 0, 0, 0.26) 4px
  );
  animation: crt-flicker 5s steps(1, end) infinite;
}

/* Vignette: dark edges, brighter phosphor in the center. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    rgba(0, 0, 0, 0) 38%,
    rgba(0, 0, 0, 0.28) 72%,
    rgba(0, 0, 0, 0.72) 100%
  );
}

@keyframes crt-flicker {
  0%,
  100% { opacity: 0.84; }
  3% { opacity: 0.74; }
  6% { opacity: 0.9; }
  9% { opacity: 0.8; }
  11% { opacity: 0.94; }
  46% { opacity: 0.82; }
  48% { opacity: 0.9; }
  50% { opacity: 0.74; }
  52% { opacity: 0.88; }
  78% { opacity: 0.83; }
  80% { opacity: 0.72; }
  82% { opacity: 0.92; }
}

/* ------------------------------------------------------------
   Boot screen
   Full-viewport CRT warm-up: ASCII masthead, eye, tape counter.
   Hidden by script.js once the meter reaches 100%.
   ------------------------------------------------------------ */

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  overflow: hidden;
  font-family: Consolas, "Courier New", ui-monospace, monospace;
  color: var(--green);
  background: #000;
  text-shadow:
    0 0 5px rgba(51, 255, 0, 0.72),
    0 0 14px rgba(51, 255, 0, 0.22);
  opacity: 1;
}

/* Everything that belongs to the picture on the tube. Collapsing this
   wrapper is what makes the whole screen fold, ticker included. */
.boot-tube {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 44px;
  transform-origin: center center;
}

/* Scanlines live above the boot content, not just behind it. */
.boot-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.16) 2px,
    rgba(0, 0, 0, 0.16) 4px
  );
  animation: crt-flicker 4s steps(1, end) infinite;
}

/* Slow phosphor sweep drifting down the tube. */
.boot-screen::after {
  content: "";
  position: absolute;
  top: -35%;
  right: 0;
  left: 0;
  height: 35%;
  pointer-events: none;
  background: linear-gradient(
    to bottom,
    rgba(51, 255, 0, 0) 0%,
    rgba(51, 255, 0, 0.07) 50%,
    rgba(51, 255, 0, 0) 100%
  );
  animation: boot-sweep 5.5s linear infinite;
}

@keyframes boot-sweep {
  from { transform: translateY(0); }
  to { transform: translateY(390%); }
}

.boot {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 3vh, 24px);
  width: 100%;
  max-width: 620px;
  animation: boot-switch-on 0.7s steps(1, end) both;
}

/* Old tube switching on: a couple of hard fades, no smooth ramp. */
@keyframes boot-switch-on {
  0% { opacity: 0; }
  12% { opacity: 1; }
  18% { opacity: 0.15; }
  26% { opacity: 1; }
  38% { opacity: 0.5; }
  50%,
  100% { opacity: 1; }
}

.boot-bios {
  margin: -4px 0 0;
  font-family: inherit;
  font-size: clamp(7px, 2.2vw, 11px);
  line-height: 1.45;
  letter-spacing: 0.05em;
  text-align: left;
  white-space: pre;
  color: var(--green-faint);
  text-shadow: 0 0 5px rgba(51, 255, 0, 0.45);
}

/* Block masthead. It is an inline SVG, not a <pre>: a phone's monospace
   fallback may give U+2588 a different advance than U+0020, which smears
   the glyph grid. The SVG keeps every cell aligned on every device. */
.boot-word {
  display: block;
  width: min(86%, 440px);
  height: auto;
  margin: 0;
  color: var(--green-bright);
  filter:
    drop-shadow(0 0 3px rgba(51, 255, 0, 0.95))
    drop-shadow(0 0 12px rgba(51, 255, 0, 0.4));
  overflow: visible;
}

.boot-eye {
  display: inline-block;
  margin: 0;
  font-family: inherit;
  font-size: clamp(8px, 3vw, 18px);
  line-height: 0.98;
  letter-spacing: 0;
  text-align: left;
  white-space: pre;
  color: var(--green);
  animation: boot-eye-pulse 2.6s ease-in-out infinite;
}

@keyframes boot-eye-pulse {
  0%,
  100% { opacity: 0.82; }
  50% { opacity: 1; }
}

.boot-progress {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.55em;
  margin: 0;
  font-family: inherit;
  font-size: clamp(10px, 3vw, 16px);
  line-height: 1.2;
  letter-spacing: 0.06em;
  white-space: pre;
  font-variant-numeric: tabular-nums;
}

.boot-progress-label {
  color: var(--green-dim);
}

.boot-progress-bar {
  letter-spacing: 0;
  color: var(--green-bright);
}

/* Fixed width so the bar never shifts between 0% and 100%. */
.boot-progress-pct {
  min-width: 4ch;
  text-align: right;
  color: var(--green-bright);
}

/* Boot trace: same left edge as the prompt, stable size while it fills. */
.boot-trace {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 42ch;
  min-height: calc(4 * 1.5em);
  margin: 0;
  font-family: inherit;
  font-size: clamp(9px, 2.6vw, 13px);
  line-height: 1.5;
  letter-spacing: 0.04em;
  text-align: left;
  white-space: pre;
  color: var(--green-dim);
}

.boot-trace span::before {
  content: "> ";
  color: var(--green-faint);
}

.boot-prompt {
  width: 42ch;
  margin: 0;
  font-family: inherit;
  font-size: clamp(9px, 2.7vw, 13px);
  letter-spacing: 0.08em;
  text-align: left;
  color: var(--green-dim);
  white-space: pre;
}

/* ------------------------------------------------------------
   News wire (bottom of the tube)
   ------------------------------------------------------------ */

.boot-ticker {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  overflow: hidden;
  padding: 7px 0;
  border-top: 1px dashed rgba(51, 255, 0, 0.2);
  background: rgba(51, 255, 0, 0.035);
  font-family: inherit;
  font-size: clamp(9px, 2.2vw, 11px);
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--green-dim);
}

.boot-ticker-track {
  display: inline-block;
  white-space: nowrap;
  animation: boot-ticker 16s linear infinite;
}

/* Two identical copies → translating by half loops seamlessly. */
.boot-ticker-track::before,
.boot-ticker-track::after {
  content: attr(data-text);
  padding-right: 3ch;
}

@keyframes boot-ticker {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.boot-cursor {
  display: inline-block;
  width: 0.65em;
  color: var(--green-bright);
  animation: boot-blink 1.05s steps(1, end) infinite;
}

@keyframes boot-blink {
  0%,
  49% { opacity: 1; }
  50%,
  100% { opacity: 0; }
}

/* Frame change the way a CRT does it: the new picture is drawn from the
   top down, the old one is still below the tear, and the black vertical
   blanking band runs between them. */
.boot-screen.is-tearing {
  pointer-events: none;
  animation: boot-tear 0.2s steps(8, end) forwards;
}

.boot-screen.is-tearing::after {
  display: none; /* the sweep has no place in a switching picture */
}

@keyframes boot-tear {
  from {
    clip-path: inset(0 0 0 0);
  }
  to {
    clip-path: inset(100% 0 0 0);
  }
}

/* Horizontal sync is off while it tears: the old picture shears a touch. */
.boot-screen.is-tearing .boot-tube {
  animation: tear-skew 0.2s linear forwards;
}

@keyframes tear-skew {
  from { transform: skewX(0deg); }
  to { transform: skewX(-1.1deg); }
}

/* The band itself: black vertical blanking with a hot retrace edge. */
.boot-tear {
  position: fixed;
  z-index: 10000;
  top: 0;
  right: 0;
  left: 0;
  height: 9px;
  margin-top: -9px;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(
    to bottom,
    #000 0%,
    #000 55%,
    rgba(125, 255, 87, 0.9) 88%,
    rgba(51, 255, 0, 0) 100%
  );
  box-shadow: 0 0 14px 2px rgba(51, 255, 0, 0.18);
}

.boot-tear.is-tearing {
  animation: boot-tear-run 0.2s steps(8, end) forwards;
}

@keyframes boot-tear-run {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 1;
    transform: translateY(100vh);
  }
}

/* The freshly drawn frame settles: one short over-bright field. */
body.is-ready .app {
  animation: app-settle 0.25s linear both;
}

@keyframes app-settle {
  from { filter: brightness(1.22); }
  to { filter: brightness(1); }
}

/* ------------------------------------------------------------
   Exit: the tube dies when the Mini App goes away
   ------------------------------------------------------------ */

.exit-screen {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: none;
  overflow: hidden;
  pointer-events: none;
}

.exit-screen.is-on {
  display: block;
}

/* Two black caps closing on the centre line = raster collapse. */
.exit-cap {
  position: absolute;
  right: 0;
  left: 0;
  height: 50%;
  background: #000;
  transform: scaleY(0);
}

.exit-cap--top {
  top: 0;
  transform-origin: top center;
}

.exit-cap--bottom {
  bottom: 0;
  transform-origin: bottom center;
}

.exit-screen.is-on .exit-cap {
  animation: exit-cap 0.18s steps(4, end) forwards;
}

@keyframes exit-cap {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}

.exit-line {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 2px;
  margin-top: -1px;
  background: #c9f5b4;
  box-shadow:
    0 0 5px 1px rgba(125, 255, 87, 0.6),
    0 0 16px 4px rgba(51, 255, 0, 0.28);
  opacity: 0;
}

.exit-screen.is-on .exit-line {
  animation: exit-line 0.32s steps(5, end) 0.14s forwards;
}

@keyframes exit-line {
  0% {
    opacity: 0;
    transform: scale(1, 2);
  }
  10% {
    opacity: 0.85;
    transform: scale(1, 2);
  }
  100% {
    opacity: 0;
    transform: scale(0.02, 0.7);
  }
}

/* Keep the report off screen (and unscrollable) while booting. */
body.is-booting {
  overflow: hidden;
}

body.is-booting .app {
  visibility: hidden;
  pointer-events: none;
}

/* Short viewports: shrink the masthead instead of overflowing. */
@media (max-height: 520px) {
  .boot {
    gap: 10px;
  }

  .boot-bios {
    display: none;
  }

  .boot-word {
    width: min(90%, 330px);
  }

  .boot-eye {
    font-size: clamp(6px, 2vw, 9px);
  }
}

/* Very short viewports: the wire would eat the last row. */
@media (max-height: 420px) {
  .boot-ticker {
    display: none;
  }

  .boot-screen .boot-tube {
    padding-bottom: 24px;
  }
}

/* ------------------------------------------------------------
   Shell
   ------------------------------------------------------------ */

.app {
  position: relative;
  width: 100%;
  max-width: 640px;
  min-height: var(--app-height, 100vh);
  margin: 0 auto;
  padding: 18px 16px 48px;
}

/* ------------------------------------------------------------
   Preview banner
   ------------------------------------------------------------ */

.preview-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  padding: 4px 8px;
  border: 1px dashed var(--amber);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--amber);
  text-shadow:
    0 0 5px rgba(255, 176, 0, 0.9),
    0 0 12px rgba(255, 176, 0, 0.3);
}

.preview-hint::before {
  content: "[!]";
  flex-shrink: 0;
}

.preview-dot {
  display: none;
}

/* ------------------------------------------------------------
   Masthead / terminal header
   ------------------------------------------------------------ */

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  margin-bottom: 14px;
  padding: 10px 12px 12px;
  border: 1px dashed var(--green-dim);
  background: rgba(51, 255, 0, 0.025);
}

.ascii-banner {
  flex: 1 0 100%;
  min-width: 0;
  margin: 0 0 4px;
  padding: 0;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: clamp(7px, 2.25vw, 11px);
  line-height: 1.15;
  letter-spacing: 0;
  white-space: pre;
  color: var(--green);
  text-shadow:
    0 0 5px rgba(51, 255, 0, 0.9),
    0 0 14px rgba(51, 255, 0, 0.35);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: none;
}

.brand-text {
  min-width: 0;
}

.brand-title,
.brand-sub {
  margin: 0;
}

.brand-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green);
  overflow-wrap: anywhere;
  text-shadow:
    0 0 6px rgba(51, 255, 0, 0.95),
    0 0 18px rgba(51, 255, 0, 0.4);
}

.brand-title::before {
  content: "> ";
  color: var(--amber);
  text-shadow: 0 0 5px var(--amber);
}

.brand-sub {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green-dim);
}

.match-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--green-dim);
}

.match-chip::before {
  content: "[#]";
  color: var(--green-faint);
}

.match-chip b {
  color: var(--green);
  font-weight: 400;
}

/* ------------------------------------------------------------
   Boot log
   ------------------------------------------------------------ */

.boot-log {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin: 0 0 22px;
  padding: 0 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
  letter-spacing: 0.02em;
  color: var(--green-dim);
}

.boot-log span::before {
  content: "> ";
  color: var(--green-faint);
}

.boot-log b {
  color: var(--green);
  font-weight: 400;
}

/* ------------------------------------------------------------
   Layout / ASCII panels
   ------------------------------------------------------------ */

.content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.card {
  position: relative;
}

.block {
  min-width: 0;
  padding: 12px;
  border: 1px dashed var(--green-dim);
  background: rgba(51, 255, 0, 0.018);
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  margin: -12px -12px 12px;
  padding: 5px 10px;
  border-bottom: 1px dashed var(--green-dim);
  background: rgba(51, 255, 0, 0.045);
}

.block-title {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--green);
}

.block-title::before {
  content: "+--- ";
  color: var(--green-dim);
  white-space: pre;
}

.block-title::after {
  content: " ---+";
  color: var(--green-dim);
  white-space: pre;
}

.block-note {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--green-faint);
}

.ghost-btn {
  flex-shrink: 0;
  padding: 2px 6px;
  border: 1px dashed var(--green-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green-dim);
  background: transparent;
  cursor: pointer;
  transition: color 0.12s steps(2, end), background 0.12s steps(2, end);
}

.ghost-btn:hover,
.ghost-btn:focus-visible {
  color: var(--bg);
  background: var(--green);
  border-color: var(--green);
  outline: none;
  text-shadow: none;
}

.ghost-btn:active {
  color: var(--bg);
  background: var(--amber);
  border-color: var(--amber);
  text-shadow: none;
}

/* ------------------------------------------------------------
   Player switcher
   ------------------------------------------------------------ */

.player-nav .block-head {
  margin-bottom: 8px;
}

.player-nav-list {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--green-dim) transparent;
}

.player-btn {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 0 0 auto;
  width: 136px;
  min-width: 0;
  padding: 5px 7px;
  border: 1px dashed var(--green-dim);
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.35;
  letter-spacing: 0.02em;
  text-align: left;
  color: var(--green-dim);
  background: transparent;
  cursor: pointer;
  transition: color 0.12s steps(2, end), background 0.12s steps(2, end);
}

.player-btn:hover,
.player-btn:focus-visible {
  color: var(--bg);
  background: var(--green-dim);
  border-color: var(--green-dim);
  outline: none;
  text-shadow: none;
}

.player-btn.is-active {
  color: var(--bg);
  background: var(--green);
  border-color: var(--green);
  text-shadow: none;
}

.player-btn:disabled {
  cursor: wait;
}

.player-btn-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.player-btn-hero {
  overflow: hidden;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.85;
}

.player-btn-award {
  flex-shrink: 0;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.player-btn-name {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--green);
}

.player-btn.is-active .player-btn-name,
.player-btn:hover .player-btn-name,
.player-btn:focus-visible .player-btn-name {
  color: var(--bg);
}

.player-btn-score {
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.player-nav.is-loading .player-nav-list {
  opacity: 0.45;
}

/* ------------------------------------------------------------
   Score card
   ------------------------------------------------------------ */

.score-card {
  padding: 0;
  border: 1px dashed var(--green);
  background: rgba(51, 255, 0, 0.02);
}

.score-card::before {
  content: "+--- PLAYER REPORT ---+";
  display: block;
  margin: -1px -1px 0;
  padding: 5px 10px;
  border-bottom: 1px dashed var(--green-dim);
  background: rgba(51, 255, 0, 0.05);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.1em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--green);
  text-shadow: inherit;
}

.score-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 14px 12px;
  border-bottom: 1px dashed var(--green-dim);
}

.score-top > div {
  min-width: 0;
}

.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  text-shadow:
    0 0 5px rgba(255, 176, 0, 0.85),
    0 0 12px rgba(255, 176, 0, 0.25);
}

.hero-chip::before {
  content: "[HERO]";
  color: var(--amber);
}

.score-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 400;
  line-height: 0.95;
  letter-spacing: 0.03em;
  color: var(--green);
  overflow-wrap: anywhere;
  text-shadow:
    0 0 7px rgba(51, 255, 0, 0.95),
    0 0 22px rgba(51, 255, 0, 0.4);
}

.score-name::before {
  content: "> ";
  color: var(--amber);
  text-shadow: 0 0 5px var(--amber);
}

.score-meta {
  margin: 6px 0 0;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.55;
  letter-spacing: 0.03em;
  color: var(--green-dim);
}

.award-badge {
  flex-shrink: 0;
  padding: 2px 6px;
  border: 1px solid var(--amber);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--amber);
  text-shadow:
    0 0 5px rgba(255, 176, 0, 0.9),
    0 0 12px rgba(255, 176, 0, 0.3);
}

/* ── big phosphor number ─────────────────────────────────── */

.score-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  padding: 16px 14px;
  border-bottom: 1px dashed var(--green-dim);
}

.score-ring {
  position: relative;
  flex: 0 0 auto;
}

.score-ring::before,
.score-ring::after,
.score-ring svg {
  display: none;
}

.ring-center {
  display: flex;
  align-items: baseline;
  gap: 6px;
  background: none;
  border: 0;
}

.ring-score {
  font-family: var(--font-display);
  font-size: 76px;
  font-weight: 400;
  line-height: 0.8;
  letter-spacing: 0;
  color: var(--green);
  text-shadow:
    0 0 8px rgba(51, 255, 0, 0.95),
    0 0 26px rgba(51, 255, 0, 0.45),
    0 0 48px rgba(51, 255, 0, 0.2);
}

.ring-max {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--green-dim);
}

.grade {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
  padding: 1px 5px;
  border: 1px solid var(--amber);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1;
  color: var(--amber);
  text-shadow:
    0 0 5px rgba(255, 176, 0, 0.9),
    0 0 12px rgba(255, 176, 0, 0.3);
}

.score-side {
  display: flex;
  flex: 1 1 180px;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.score-label {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--green-faint);
}

.score-verdict {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  color: var(--green);
}

.impact {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 2px;
}

.impact-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--green-dim);
}

.impact-line b {
  font-size: 14px;
  font-weight: 400;
  color: var(--green);
}

.impact-bar {
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.1;
  letter-spacing: 0;
  white-space: nowrap;
  color: var(--green);
  text-shadow:
    0 0 5px rgba(51, 255, 0, 0.85),
    0 0 12px rgba(51, 255, 0, 0.25);
}

/* ── tallies and ledger ──────────────────────────────────── */

.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 10px 14px;
  border-bottom: 1px dashed var(--green-dim);
}

.count-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--green-dim);
}

.count-badge em {
  display: inline;
  flex-shrink: 0;
  font-size: 10px;
  font-style: normal;
  line-height: 1;
  background: none;
  color: var(--cat);
  text-shadow: 0 0 5px currentColor;
}

.count-badge b {
  color: var(--green);
  font-weight: 400;
}

.breakdown {
  display: block;
  margin: 0;
  padding: 10px 14px 12px;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--green-dim);
}

.breakdown li {
  display: flex;
  align-items: baseline;
  gap: 0;
}

.breakdown li + li::before {
  content: none;
}

.breakdown-label {
  flex-shrink: 0;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.breakdown-dots {
  flex: 1 1 auto;
  min-width: 12px;
  margin: 0 6px;
  border-bottom: 1px dotted rgba(51, 255, 0, 0.35);
  transform: translateY(-3px);
}

.breakdown .pos {
  color: var(--green);
}

.breakdown .neg {
  color: var(--amber);
  text-shadow: 0 0 5px currentColor;
}

.breakdown .total {
  color: var(--amber);
  text-shadow: 0 0 5px currentColor;
}

/* ------------------------------------------------------------
   Macro figures
   ------------------------------------------------------------ */

.macro-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  padding: 1px;
  border: 1px solid rgba(51, 255, 0, 0.22);
  background: rgba(51, 255, 0, 0.22);
}

.macro-tile {
  position: relative;
  padding: 10px;
  background: var(--bg);
}

.macro-tile--wide {
  grid-column: 1 / -1;
}

.macro-label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green-dim);
}

.macro-label > span {
  display: inline;
  flex-shrink: 0;
  font-size: 10px;
  line-height: 1;
  background: none;
  color: var(--cat);
  text-shadow: 0 0 5px currentColor;
}

.macro-label > span::before {
  content: none;
}

.macro-value {
  margin: 0;
  padding-right: 30px;
  font-family: var(--font-mono);
  font-size: clamp(16px, 4.2vw, 20px);
  font-weight: 400;
  line-height: 1.2;
  color: var(--green);
  word-break: break-word;
}

.macro-value small {
  font-size: 10px;
  color: var(--green-faint);
}

.macro-verdict {
  margin: 5px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--green-dim);
}

.macro-verdict small {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--green-faint);
}

.points {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1;
}

.points--up {
  color: var(--green);
}

.points--down {
  color: var(--amber);
  text-shadow: 0 0 5px currentColor;
}

/* ------------------------------------------------------------
   Items
   ------------------------------------------------------------ */

.accordion {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.acc {
  border: 1px dashed var(--green-dim);
  background: rgba(51, 255, 0, 0.02);
}

.acc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  font-family: var(--font-mono);
  text-align: left;
  color: inherit;
  background: transparent;
  cursor: pointer;
}

.acc-head:hover {
  background: rgba(51, 255, 0, 0.06);
}

.acc-head:focus-visible {
  outline: 1px dashed var(--green);
  outline-offset: -3px;
}

.acc-emoji {
  display: inline;
  flex-shrink: 0;
  width: auto;
  height: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  letter-spacing: 0.02em;
  background: none;
  color: var(--cat);
  text-shadow: 0 0 5px currentColor;
}

.acc-emoji::before {
  content: none;
}

.acc-titles {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.acc-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--green);
}

.acc-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
  color: var(--green-dim);
}

.acc-count {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--green-faint);
}

.acc-count::before {
  content: "N=";
}

.chev {
  display: none;
}

.acc-head::after {
  content: "[+]";
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--green-dim);
}

.acc.is-open .acc-head {
  border-bottom: 1px dashed var(--green-dim);
  background: rgba(51, 255, 0, 0.06);
}

.acc.is-open .acc-head::after {
  content: "[-]";
  color: var(--amber);
}

.acc-panel {
  display: none;
}

.acc.is-open .acc-panel {
  display: block;
}

.acc-inner {
  overflow: hidden;
}

.acc-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 8px 10px 8px 16px;
  list-style: none;
}

.item {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px dashed rgba(51, 255, 0, 0.18);
}

.item:first-child {
  border-top: 0;
}

.item-mark {
  display: block;
  flex-shrink: 0;
  width: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.5;
  color: var(--green-faint);
}

.item-body {
  min-width: 0;
  flex: 1;
}

.item-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}

.item-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--green);
}

.item-name .up {
  margin-right: 3px;
  font-size: 9px;
  color: var(--amber);
}

.item-name .up::before {
  content: none;
}

.item-time {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--green-faint);
}

.item-time::before {
  content: "@";
}

.item-cost {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--green-dim);
  white-space: nowrap;
}

.item-reason {
  margin: 4px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--green-dim);
}

.item-meta {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.5;
  color: var(--cat);
  text-shadow: 0 0 5px currentColor;
}

.item-meta::before {
  content: ">> ";
}

/* ------------------------------------------------------------
   Recommendations
   ------------------------------------------------------------ */

.recs-card {
  padding: 0;
  background: transparent;
  border: 0;
}

.recs-group + .recs-group {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--green-dim);
}

.recs-title {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
  text-shadow:
    0 0 5px rgba(255, 176, 0, 0.8),
    0 0 12px rgba(255, 176, 0, 0.25);
}

.recs-title > span {
  display: inline;
  margin-right: 7px;
}

.recs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.recs-list li {
  position: relative;
  padding-left: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: var(--green-dim);
}

.recs-list li::before {
  content: ">";
  position: absolute;
  left: 0;
  top: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--green);
}

.recs-list li b {
  color: var(--amber);
  font-weight: 400;
  text-shadow:
    0 0 5px rgba(255, 176, 0, 0.75),
    0 0 12px rgba(255, 176, 0, 0.22);
}

/* ------------------------------------------------------------
   Footer
   ------------------------------------------------------------ */

.footer {
  padding-top: 12px;
  margin-top: 2px;
  border-top: 1px dashed var(--green-dim);
  text-align: center;
}

.footer p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.5;
  color: var(--green-dim);
}

.footer-muted {
  margin-top: 5px !important;
  font-family: var(--font-mono) !important;
  font-size: 9px !important;
  letter-spacing: 0.1em !important;
  text-transform: uppercase;
  color: var(--green-faint) !important;
}

/* ------------------------------------------------------------
   Breakpoints
   ------------------------------------------------------------ */

@media (max-width: 600px) {
  .block-note {
    display: none;
  }
}

@media (max-width: 380px) {
  .app {
    padding: 14px 12px 36px;
  }

  .topbar {
    padding: 8px 9px 10px;
  }

  .brand-title {
    font-size: 24px;
  }

  .brand-sub {
    font-size: 9px;
  }

  .match-chip {
    font-size: 10px;
  }

  .content {
    gap: 20px;
  }

  .score-name {
    font-size: 36px;
  }

  .ring-score {
    font-size: 62px;
  }

  .score-side {
    flex-basis: 150px;
  }

  .block {
    padding: 10px;
  }

  .block-head {
    margin: -10px -10px 10px;
    padding: 5px 8px;
  }

  .block-title {
    font-size: 11px;
    letter-spacing: 0.06em;
  }

  .ghost-btn {
    font-size: 9px;
    padding: 2px 5px;
  }

  .acc-title {
    font-size: 11px;
  }

  .item-name {
    font-size: 11.5px;
  }

  .item-reason {
    font-size: 10.5px;
  }

  .recs-list li {
    font-size: 11px;
  }
}

@media (max-width: 340px) {
  .app {
    padding: 12px 10px 30px;
  }

  .brand-title {
    font-size: 21px;
  }

  .score-name {
    font-size: 31px;
  }

  .ring-score {
    font-size: 54px;
  }

  .block-title {
    font-size: 10px;
  }

  .item-head {
    gap: 4px;
  }
}

@media (min-width: 520px) {
  .app {
    padding: 26px 24px 54px;
  }

  .content {
    gap: 28px;
  }

  .brand-title {
    font-size: 32px;
  }

  .score-name {
    font-size: 50px;
  }

  .ring-score {
    font-size: 88px;
  }

  .score-side {
    flex-basis: 240px;
  }

  .item-name {
    font-size: 13px;
  }

  .item-reason {
    font-size: 12px;
  }
}

/* Keep the tiny flicker, kill it for readers who ask for less motion. */
@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
