/* Scroll Goblin – terminal/ASCII theme */
:root {
  --bg: #0a0a0a;
  --fg: #00ff00;
  --fg-dim: #006600;
  --font-mono: "SF Mono", "Consolas", "Monaco", "Courier New", monospace;
}

* { box-sizing: border-box; }

/* ── ASCII-themed scrollbars ── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--fg-dim, #006600) var(--bg, #0a0a0a);
}
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track {
  background: var(--bg, #0a0a0a);
  border-left: 1px solid var(--fg-dim, #006600);
}
::-webkit-scrollbar-thumb {
  background: var(--fg-dim, #006600);
  border: 1px solid var(--fg, #00ff00);
  border-radius: 0;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--fg, #00ff00);
}
::-webkit-scrollbar-corner {
  background: var(--bg, #0a0a0a);
}

body.terminal {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  margin: 0;
  min-height: 100vh;
}

/* ----- ASCII terminal: buttons, selects, inputs (unified) ----- */
body.terminal button,
body.terminal input[type="submit"],
body.terminal input[type="button"] {
  font-family: var(--font-mono);
  font-size: 1rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  padding: 4px 10px;
  cursor: pointer;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}
body.terminal button:hover,
body.terminal input[type="submit"]:hover,
body.terminal input[type="button"]:hover {
  color: var(--bg);
  background: var(--fg);
}
body.terminal button:disabled {
  color: var(--fg-dim);
  border-color: var(--fg-dim);
  cursor: not-allowed;
}

body.terminal select {
  font-family: var(--font-mono);
  font-size: 1rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  padding: 4px 8px;
  padding-right: 1.75rem;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
body.terminal select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%2300ff00' d='M5 7L1 3h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 6px center;
}
body.terminal.scheme-yellow select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23ff8c00' d='M5 7L1 3h8z'/%3E%3C/svg%3E"); }
body.terminal.scheme-purple select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23cc66ff' d='M5 7L1 3h8z'/%3E%3C/svg%3E"); }

body.terminal.scheme-nyancat select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23ff69b4' d='M5 7L1 3h8z'/%3E%3C/svg%3E"); }
body.terminal.scheme-toastercat select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'%3E%3Cpath fill='%23ff69b4' d='M5 7L1 3h8z'/%3E%3C/svg%3E"); }
body.terminal select:focus {
  outline: 1px solid var(--fg);
  outline-offset: 0;
}
body.terminal option {
  background: var(--bg);
  color: var(--fg);
}

body.terminal input[type="text"],
body.terminal input[type="password"],
body.terminal input[type="number"] {
  font-family: var(--font-mono);
  font-size: 1rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg-dim);
  padding: 4px 8px;
  border-radius: 0;
  -webkit-appearance: none;
  appearance: none;
}
body.terminal input:focus {
  outline: none;
  border-color: var(--fg);
}
body.terminal input::placeholder {
  color: var(--fg-dim);
}
body.terminal input[type="range"] {
  accent-color: var(--fg);
  background: var(--bg);
}

/* ASCII box frames for sections */
.ascii-page-title {
  font-family: var(--font-mono);
  white-space: pre;
  margin: 0 0 1rem 0;
  color: var(--fg);
  font-size: 1rem;
  line-height: 1.4;
}
.ascii-frame {
  border: 1px dashed var(--fg);
  margin-bottom: 1rem;
  padding: 0 1rem 1rem;
}
.ascii-frame .ascii-frame-head {
  border-bottom: 1px dashed var(--fg);
  margin: 0 -1rem 0.75rem -1rem;
  padding: 0.4rem 1rem;
  font-family: var(--font-mono);
  color: var(--fg);
}
body.terminal fieldset {
  border: 1px dashed var(--fg-dim);
  margin-bottom: 1rem;
  padding: 1rem;
  padding-top: 1.5rem;
}
body.terminal fieldset legend {
  font-family: var(--font-mono);
  color: var(--fg);
  padding: 0 0.5rem;
  margin-left: -0.25rem;
}
body.terminal fieldset legend::before {
  content: "── ";
  color: var(--fg-dim);
}
body.terminal fieldset legend::after {
  content: " ──";
  color: var(--fg-dim);
}
/* ASCII-style dashed lines (classic terminal) */
.ascii-divider {
  border: none;
  border-top: 1px dashed var(--fg-dim);
  margin: 1rem 0;
}
.ascii-divider.soft { border-top-style: dotted; }
.ascii-table {
  border: 1px dashed var(--fg-dim);
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.95rem;
}
.ascii-table th,
.ascii-table td {
  border: 1px dashed var(--fg-dim);
  padding: 0.35rem 0.5rem;
  text-align: left;
}
.ascii-table th {
  color: var(--fg);
  background: var(--bg);
}
.ascii-table tr:nth-child(even) td { color: var(--fg-dim); }
.totp-qr-container { margin: 0.5rem 0; }
.totp-qr-container img {
  display: block;
  border: 1px dashed var(--fg-dim);
  padding: 4px;
  background: #fff;
}
body.terminal label {
  display: block;
  margin-top: 0.5rem;
  font-family: var(--font-mono);
}
body.terminal label:first-of-type { margin-top: 0; }
body.terminal input[type="checkbox"] {
  margin-right: 0.5rem;
  accent-color: var(--fg);
}
.ascii-list { font-family: var(--font-mono); }
.ascii-list label { display: block; margin: 0.2rem 0; }
.ascii-bullet { color: var(--fg-dim); margin-right: 0.35rem; }

/* Color schemes */
body.terminal.scheme-green { --fg: #00ff00; --fg-dim: #006600; }
body.terminal.scheme-yellow { --fg: #ff8c00; --fg-dim: #995300; }
body.terminal.scheme-purple { --fg: #cc66ff; --fg-dim: #663399; }

body.terminal.scheme-nyancat { --fg: #ff69b4; --fg-dim: #9370db; } /* legacy alias */
body.terminal.scheme-toastercat { --fg: #ff69b4; --fg-dim: #9370db; }

.classic-glow .main {
  text-shadow: 0 0 4px currentColor, 0 0 8px currentColor;
}

/* Shooting stars: Atari-style pixelated star field background */
.shooting-stars {
  position: relative;
}
/* Layer 1 (::before) — large bright Atari-style block stars */
.shooting-stars::before {
  content: "";
  position: fixed;
  inset: -20px;
  pointer-events: none;
  z-index: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background-image:
    /* Large 4px bright stars — the signature Atari look */
    radial-gradient(4px 4px at  7%  5%, rgba(255,255,255,0.55) 100%, transparent),
    radial-gradient(4px 4px at 23% 19%, rgba(200,220,255,0.50) 100%, transparent),
    radial-gradient(4px 4px at 42% 11%, rgba(255,255,200,0.45) 100%, transparent),
    radial-gradient(4px 4px at 61% 38%, rgba(255,255,255,0.50) 100%, transparent),
    radial-gradient(4px 4px at 78%  8%, rgba(200,200,255,0.55) 100%, transparent),
    radial-gradient(4px 4px at 91% 52%, rgba(255,255,230,0.45) 100%, transparent),
    radial-gradient(4px 4px at 15% 71%, rgba(255,255,255,0.50) 100%, transparent),
    radial-gradient(4px 4px at 53% 85%, rgba(220,220,255,0.45) 100%, transparent),
    radial-gradient(4px 4px at 85% 77%, rgba(255,255,255,0.50) 100%, transparent),
    radial-gradient(4px 4px at 35% 62%, rgba(255,240,200,0.40) 100%, transparent),
    /* Medium 3px stars */
    radial-gradient(3px 3px at 11% 33%, rgba(255,255,255,0.35) 100%, transparent),
    radial-gradient(3px 3px at 29% 48%, rgba(200,220,255,0.30) 100%, transparent),
    radial-gradient(3px 3px at 47% 27%, rgba(255,255,255,0.35) 100%, transparent),
    radial-gradient(3px 3px at 67% 68%, rgba(255,255,220,0.30) 100%, transparent),
    radial-gradient(3px 3px at 81% 43%, rgba(255,255,255,0.35) 100%, transparent),
    radial-gradient(3px 3px at 94% 22%, rgba(220,220,255,0.30) 100%, transparent),
    radial-gradient(3px 3px at  4% 91%, rgba(255,255,255,0.30) 100%, transparent),
    radial-gradient(3px 3px at 72% 14%, rgba(255,255,255,0.35) 100%, transparent);
  background-size: 400px 400px;
  opacity: 0.35;
  animation: starfield-drift 60s linear infinite;
}
/* Layer 2 (::after) — small dim background dust */
.shooting-stars::after {
  content: "";
  position: fixed;
  inset: -20px;
  pointer-events: none;
  z-index: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background-image:
    radial-gradient(2px 2px at  3% 12%, rgba(255,255,255,0.20) 100%, transparent),
    radial-gradient(2px 2px at 17% 44%, rgba(255,255,255,0.18) 100%, transparent),
    radial-gradient(2px 2px at 33% 76%, rgba(200,200,255,0.15) 100%, transparent),
    radial-gradient(2px 2px at 51%  3%, rgba(255,255,255,0.18) 100%, transparent),
    radial-gradient(2px 2px at 64% 55%, rgba(255,255,220,0.15) 100%, transparent),
    radial-gradient(2px 2px at 79% 31%, rgba(255,255,255,0.20) 100%, transparent),
    radial-gradient(2px 2px at 88% 89%, rgba(200,220,255,0.15) 100%, transparent),
    radial-gradient(2px 2px at 44% 44%, rgba(255,255,255,0.18) 100%, transparent),
    radial-gradient(2px 2px at 22% 88%, rgba(255,255,255,0.15) 100%, transparent),
    radial-gradient(2px 2px at 97% 66%, rgba(255,255,255,0.18) 100%, transparent),
    radial-gradient(2px 2px at  8% 55%, rgba(255,255,255,0.15) 100%, transparent),
    radial-gradient(2px 2px at 56% 21%, rgba(220,220,255,0.18) 100%, transparent);
  background-size: 300px 300px;
  opacity: 0.25;
  animation: starfield-drift-slow 90s linear infinite;
}
@keyframes starfield-drift {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-200px, 80px, 0); }
}
@keyframes starfield-drift-slow {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-80px, 40px, 0); }
}

/* Toastercat / Nyan Cat theme */
.toastercat-theme,
.nyancat-theme {
  position: relative;
}
.toastercat-theme .main,
.nyancat-theme .main { position: relative; z-index: 1; }

/* Stars layer — soft twinkle dots in toastercat colors */
.toastercat-theme::before,
.nyancat-theme::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background-image:
    radial-gradient(3px 3px at  9%  7%, rgba(255,255,255,0.25) 100%, transparent),
    radial-gradient(3px 3px at 27% 21%, rgba(255,182,193,0.22) 100%, transparent),
    radial-gradient(3px 3px at 45% 14%, rgba(255,255,200,0.20) 100%, transparent),
    radial-gradient(3px 3px at 63% 41%, rgba(255,255,255,0.22) 100%, transparent),
    radial-gradient(3px 3px at 81% 10%, rgba(200,200,255,0.25) 100%, transparent),
    radial-gradient(3px 3px at 93% 55%, rgba(255,255,230,0.20) 100%, transparent),
    radial-gradient(3px 3px at 18% 73%, rgba(255,255,255,0.22) 100%, transparent),
    radial-gradient(3px 3px at 55% 87%, rgba(255,200,255,0.20) 100%, transparent),
    radial-gradient(3px 3px at 88% 80%, rgba(255,255,255,0.22) 100%, transparent),
    radial-gradient(3px 3px at 37% 65%, rgba(255,240,200,0.18) 100%, transparent),
    radial-gradient(2px 2px at 14% 36%, rgba(255,255,255,0.15) 100%, transparent),
    radial-gradient(2px 2px at 72% 48%, rgba(255,200,230,0.13) 100%, transparent),
    radial-gradient(2px 2px at  4% 92%, rgba(255,255,255,0.13) 100%, transparent);
  background-size: 350px 350px;
  opacity: 0.3;
  animation: nyan-twinkle 4s ease-in-out infinite alternate;
}

/* Nyan Cat flyby — pixel-art recreation with outlines (4px/pixel) */
.toastercat-theme::after,
.nyancat-theme::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  width: 4px;
  height: 4px;
  top: var(--nyan-y, 40%);
  left: -120px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: transparent;
  box-shadow:
    /* === Ear tips (row 0) === */
    60px  0px 0 0 #999, 88px  0px 0 0 #999,
    /* === Ears with pink inner (row 1) === */
    56px  4px 0 0 #999, 60px  4px 0 0 #ffaaaa, 64px  4px 0 0 #999,
    84px  4px 0 0 #999, 88px  4px 0 0 #ffaaaa, 92px  4px 0 0 #999,
    /* === Head top + ear bases (row 2) === */
    56px  8px 0 0 #999, 60px  8px 0 0 #999, 64px  8px 0 0 #999,
    68px  8px 0 0 #999, 72px  8px 0 0 #999, 76px  8px 0 0 #999,
    80px  8px 0 0 #999, 84px  8px 0 0 #999, 88px  8px 0 0 #999,
    92px  8px 0 0 #999, 96px  8px 0 0 #999,
    /* === Pop-Tart crust top + head (row 3) === */
    12px 12px 0 0 #fad695, 16px 12px 0 0 #fad695, 20px 12px 0 0 #fad695,
    24px 12px 0 0 #fad695, 28px 12px 0 0 #fad695, 32px 12px 0 0 #fad695,
    36px 12px 0 0 #fad695, 40px 12px 0 0 #fad695, 44px 12px 0 0 #fad695,
    48px 12px 0 0 #fad695,
    56px 12px 0 0 #999, 60px 12px 0 0 #999, 64px 12px 0 0 #999,
    68px 12px 0 0 #999, 72px 12px 0 0 #999, 76px 12px 0 0 #999,
    80px 12px 0 0 #999, 84px 12px 0 0 #999, 88px 12px 0 0 #999,
    92px 12px 0 0 #999, 96px 12px 0 0 #999, 100px 12px 0 0 #999,
    /* === Frosting row 1 + head (row 4) === */
     8px 16px 0 0 #fad695,
    12px 16px 0 0 #fc9dff, 16px 16px 0 0 #fc9dff, 20px 16px 0 0 #fc9dff,
    24px 16px 0 0 #fc9dff, 28px 16px 0 0 #fc9dff, 32px 16px 0 0 #fc9dff,
    36px 16px 0 0 #fc9dff, 40px 16px 0 0 #fc9dff, 44px 16px 0 0 #fc9dff,
    48px 16px 0 0 #fc9dff, 52px 16px 0 0 #fad695,
    60px 16px 0 0 #999, 64px 16px 0 0 #999, 68px 16px 0 0 #999,
    72px 16px 0 0 #999, 76px 16px 0 0 #999, 80px 16px 0 0 #999,
    84px 16px 0 0 #999, 88px 16px 0 0 #999, 92px 16px 0 0 #999,
    96px 16px 0 0 #999, 100px 16px 0 0 #999,
    /* === Frosting + sprinkles + eyes (row 5) === */
     8px 20px 0 0 #fad695,
    12px 20px 0 0 #fc9dff, 16px 20px 0 0 #ff3399, 20px 20px 0 0 #fc9dff,
    24px 20px 0 0 #fc9dff, 28px 20px 0 0 #fc9dff, 32px 20px 0 0 #fc9dff,
    36px 20px 0 0 #fc9dff, 40px 20px 0 0 #ff3399, 44px 20px 0 0 #fc9dff,
    48px 20px 0 0 #fc9dff, 52px 20px 0 0 #fad695,
    60px 20px 0 0 #999, 64px 20px 0 0 #999, 68px 20px 0 0 #333,
    72px 20px 0 0 #999, 76px 20px 0 0 #999, 80px 20px 0 0 #999,
    84px 20px 0 0 #333, 88px 20px 0 0 #999, 92px 20px 0 0 #999,
    96px 20px 0 0 #999, 100px 20px 0 0 #999,
    /* === Tail + frosting + cheeks (row 6) === */
     0px 24px 0 0 #999,  4px 24px 0 0 #999,  8px 24px 0 0 #fad695,
    12px 24px 0 0 #fc9dff, 16px 24px 0 0 #fc9dff, 20px 24px 0 0 #fc9dff,
    24px 24px 0 0 #fc9dff, 28px 24px 0 0 #fc9dff, 32px 24px 0 0 #fc9dff,
    36px 24px 0 0 #fc9dff, 40px 24px 0 0 #fc9dff, 44px 24px 0 0 #fc9dff,
    48px 24px 0 0 #fc9dff, 52px 24px 0 0 #fad695,
    60px 24px 0 0 #999, 64px 24px 0 0 #ff9999, 68px 24px 0 0 #999,
    72px 24px 0 0 #999, 76px 24px 0 0 #999, 80px 24px 0 0 #999,
    84px 24px 0 0 #999, 88px 24px 0 0 #ff9999, 92px 24px 0 0 #999,
    96px 24px 0 0 #999,
    /* === Tail + frosting + sprinkle + mouth (row 7) === */
     0px 28px 0 0 #999,  8px 28px 0 0 #fad695,
    12px 28px 0 0 #fc9dff, 16px 28px 0 0 #fc9dff, 20px 28px 0 0 #fc9dff,
    24px 28px 0 0 #ff3399, 28px 28px 0 0 #fc9dff, 32px 28px 0 0 #fc9dff,
    36px 28px 0 0 #fc9dff, 40px 28px 0 0 #fc9dff, 44px 28px 0 0 #fc9dff,
    48px 28px 0 0 #fc9dff, 52px 28px 0 0 #fad695,
    64px 28px 0 0 #999, 68px 28px 0 0 #999, 72px 28px 0 0 #999,
    76px 28px 0 0 #333, 80px 28px 0 0 #999, 84px 28px 0 0 #999,
    88px 28px 0 0 #999, 92px 28px 0 0 #999,
    /* === Frosting + sprinkle + chin (row 8) === */
     8px 32px 0 0 #fad695,
    12px 32px 0 0 #fc9dff, 16px 32px 0 0 #fc9dff, 20px 32px 0 0 #fc9dff,
    24px 32px 0 0 #fc9dff, 28px 32px 0 0 #fc9dff, 32px 32px 0 0 #fc9dff,
    36px 32px 0 0 #ff3399, 40px 32px 0 0 #fc9dff, 44px 32px 0 0 #fc9dff,
    48px 32px 0 0 #fc9dff, 52px 32px 0 0 #fad695,
    68px 32px 0 0 #999, 72px 32px 0 0 #999, 76px 32px 0 0 #999,
    80px 32px 0 0 #999, 84px 32px 0 0 #999, 88px 32px 0 0 #999,
    /* === Pop-Tart crust bottom (row 9) === */
    12px 36px 0 0 #fad695, 16px 36px 0 0 #fad695, 20px 36px 0 0 #fad695,
    24px 36px 0 0 #fad695, 28px 36px 0 0 #fad695, 32px 36px 0 0 #fad695,
    36px 36px 0 0 #fad695, 40px 36px 0 0 #fad695, 44px 36px 0 0 #fad695,
    48px 36px 0 0 #fad695,
    /* === Feet (row 10) === */
    16px 40px 0 0 #999, 20px 40px 0 0 #999,
    36px 40px 0 0 #999, 40px 40px 0 0 #999,
    68px 40px 0 0 #999, 72px 40px 0 0 #999,
    88px 40px 0 0 #999, 92px 40px 0 0 #999;
  filter:
    drop-shadow(4px 0 0 #000)
    drop-shadow(-4px 0 0 #000)
    drop-shadow(0 4px 0 #000)
    drop-shadow(0 -4px 0 #000);
}

/* Rainbow trail — injected by JS as a sibling div */
.nyan-rainbow-trail {
  position: fixed;
  pointer-events: none;
  z-index: 1;
  height: 24px;
  width: 0;
  top: calc(var(--nyan-y, 40%) + 16px);
  left: -120px;
  opacity: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: repeating-linear-gradient(to bottom,
    #ff0000 0px, #ff0000 4px,
    #ff9900 4px, #ff9900 8px,
    #ffff00 8px, #ffff00 12px,
    #33ff00 12px, #33ff00 16px,
    #0099ff 16px, #0099ff 20px,
    #6633ff 20px, #6633ff 24px);
}

.toastercat-flyby .nyan-rainbow-trail {
  animation: rainbow-trail 12s linear 1;
}

.toastercat-flyby.toastercat-theme::after,
.toastercat-flyby.nyancat-theme::after {
  animation: nyancat-cross 12s linear 1, nyan-bounce 0.35s ease-in-out infinite;
}
@keyframes nyan-twinkle {
  0% { opacity: 0.15; }
  100% { opacity: 0.35; }
}
@keyframes nyan-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}
@keyframes nyancat-cross {
  0%   { opacity: 0; left: -120px; }
  5%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { opacity: 0; left: calc(100vw + 120px); }
}
@keyframes rainbow-trail {
  0%   { opacity: 0; left: -120px; width: 0; }
  5%   { opacity: 0.9; width: 200px; }
  50%  { width: 350px; }
  95%  { opacity: 0.9; }
  100% { opacity: 0; left: calc(100vw - 200px); width: 0; }
}

/* When shooting stars AND toastercat are both active: Nyan Cat deep space background */
.shooting-stars.toastercat-theme,
.shooting-stars.nyancat-theme {
  background: linear-gradient(135deg, #003 0%, #006 30%, #003 60%, #002 100%) !important;
}
.shooting-stars.toastercat-theme::before,
.shooting-stars.nyancat-theme::before {
  background-image:
    /* Bright nyan-style colored stars */
    radial-gradient(4px 4px at  8%  6%, rgba(255,255,255,0.7) 100%, transparent),
    radial-gradient(4px 4px at 24% 18%, rgba(255,200,220,0.6) 100%, transparent),
    radial-gradient(4px 4px at 43% 12%, rgba(255,255,150,0.55) 100%, transparent),
    radial-gradient(4px 4px at 62% 39%, rgba(255,255,255,0.65) 100%, transparent),
    radial-gradient(4px 4px at 79%  9%, rgba(200,220,255,0.7) 100%, transparent),
    radial-gradient(4px 4px at 92% 53%, rgba(255,230,150,0.55) 100%, transparent),
    radial-gradient(4px 4px at 16% 72%, rgba(255,255,255,0.65) 100%, transparent),
    radial-gradient(4px 4px at 54% 86%, rgba(255,150,255,0.55) 100%, transparent),
    radial-gradient(4px 4px at 86% 78%, rgba(255,255,255,0.65) 100%, transparent),
    radial-gradient(4px 4px at 36% 63%, rgba(255,200,100,0.5) 100%, transparent),
    /* Medium pink/white stars */
    radial-gradient(3px 3px at 12% 34%, rgba(255,255,255,0.45) 100%, transparent),
    radial-gradient(3px 3px at 30% 49%, rgba(255,180,220,0.40) 100%, transparent),
    radial-gradient(3px 3px at 48% 28%, rgba(255,255,255,0.45) 100%, transparent),
    radial-gradient(3px 3px at 68% 69%, rgba(255,255,180,0.40) 100%, transparent),
    radial-gradient(3px 3px at 82% 44%, rgba(255,255,255,0.45) 100%, transparent),
    radial-gradient(3px 3px at 95% 23%, rgba(200,200,255,0.40) 100%, transparent),
    /* Tiny dust */
    radial-gradient(2px 2px at  5% 90%, rgba(255,255,255,0.30) 100%, transparent),
    radial-gradient(2px 2px at 73% 15%, rgba(255,200,255,0.25) 100%, transparent),
    radial-gradient(2px 2px at 40% 50%, rgba(255,255,255,0.25) 100%, transparent),
    radial-gradient(2px 2px at 60%  4%, rgba(255,255,200,0.25) 100%, transparent);
  background-size: 400px 400px;
  opacity: 0.6;
  animation: starfield-drift 60s linear infinite;
}
.shooting-stars.toastercat-theme::after,
.shooting-stars.nyancat-theme::after {
  filter:
    drop-shadow(4px 0 0 #000)
    drop-shadow(-4px 0 0 #000)
    drop-shadow(0 4px 0 #000)
    drop-shadow(0 -4px 0 #000);
}

/* VTY mode: progressive reveal curtain */
.vty-curtain {
  display: none;
}
.vty-mode .vty-curtain {
  display: block;
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 9998;
  animation: vty-reveal 1.5s ease-out forwards;
}
.vty-mode .vty-curtain.hidden { display: none; }
@keyframes vty-reveal {
  to { opacity: 0; pointer-events: none; }
}

/* Main content area */
.main { padding: 1rem; }

/* Dashboard grid 2x2 */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 1rem;
  padding: 0;
  min-height: calc(100vh - 80px);
}
@media (max-width: 768px) {
  .dashboard-grid { grid-template-columns: 1fr; grid-template-rows: auto; }
}

.panel {
  border: 1px dashed var(--fg-dim);
  padding: 0.75rem;
  overflow: auto;
}
.panel-title {
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
  color: var(--fg);
}
.panel-title.ascii-panel-title { font-family: var(--font-mono); }

.source-bar {
  margin-bottom: 0.5rem;
  border-left: 3px solid var(--source-color, var(--fg));
}
.source-toggle {
  width: 100%;
  text-align: left;
  background: var(--bg);
  color: var(--source-color, var(--fg));
  border: none;
  padding: 0.4rem 0.5rem;
  font-family: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}
.source-toggle::before {
  content: "[+] ";
  color: var(--fg-dim);
}
.source-toggle[aria-expanded="true"]::before {
  content: "[-] ";
}
.source-toggle:hover { opacity: 0.9; }
.source-content {
  padding: 0.5rem;
  max-height: none;
  overflow-y: visible;
}
.source-content .article-list {
  max-height: calc(5 * (1.5em + 0.5rem) + 0.5rem);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--fg-dim, #006600) var(--bg, #0a0a0a);
  border-right: 1px dashed var(--fg-dim, #006600);
  padding-right: 0.4rem;
}
.source-content .article-list::-webkit-scrollbar { width: 10px; }
.source-content .article-list::-webkit-scrollbar-track {
  background: var(--bg, #0a0a0a);
  border-left: 1px solid var(--fg-dim, #006600);
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0px,
      transparent 9px,
      var(--fg-dim, #006600) 9px,
      var(--fg-dim, #006600) 10px
    );
}
.source-content .article-list::-webkit-scrollbar-thumb {
  background: var(--fg-dim, #006600);
  border: 1px solid var(--fg, #00ff00);
  border-radius: 0;
}
.source-content .article-list::-webkit-scrollbar-thumb:hover {
  background: var(--fg, #00ff00);
}
.source-content[hidden] { display: none; }
.article-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.article-list li { margin: 0.25rem 0; }
.article-row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.article-row .article-link { flex: 1; min-width: 0; }
.taste-buttons { display: flex; gap: 2px; }
.taste-plus, .taste-minus {
  font-family: inherit;
  background: var(--bg);
  color: var(--fg-dim);
  border: 1px solid var(--fg-dim);
  width: 1.6rem;
  height: 1.6rem;
  padding: 0;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.taste-plus:hover, .taste-minus:hover { color: var(--fg); border-color: var(--fg); }
.taste-plus.active { color: #0f0; border-color: #0f0; text-shadow: 0 0 6px #0f0; }
.taste-minus.active { color: #f44; border-color: #f44; text-shadow: 0 0 6px #f44; }
.article-link {
  color: var(--fg);
  text-decoration: none;
}
.article-link:hover { text-decoration: underline; }

.empty { color: var(--fg-dim); font-size: 0.9rem; }

.podcast-source .source-toggle { color: var(--fg); }
.add-feed-btn {
  margin-top: 0.5rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  padding: 4px 8px;
  font-family: inherit;
  cursor: pointer;
}
.manual-refresh {
  position: fixed;
  bottom: 60px;
  right: 1rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  padding: 6px 12px;
  font-family: inherit;
  cursor: pointer;
}
.show-motd-btn {
  position: fixed;
  bottom: 60px;
  right: 9rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  padding: 6px 12px;
  font-family: inherit;
  cursor: pointer;
}
.collapse-all-btn {
  position: fixed;
  bottom: 60px;
  right: 15.5rem;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  padding: 6px 12px;
  font-family: inherit;
  cursor: pointer;
}
.motd-content .motd-text { white-space: pre-wrap; margin: 0 0 1rem 0; font-family: inherit; }
.motd-content .motd-generating {
  color: var(--fg-dim);
  text-align: center;
  animation: motd-pulse 1.5s ease-in-out infinite;
}
@keyframes motd-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}
.override-badge { font-size: 0.75rem; color: var(--fg-dim); margin-left: 0.5rem; }
.settings-msg { font-size: 0.9rem; margin-left: 0.5rem; }

.dashboard-footer {
  position: fixed;
  bottom: 0;
  right: 0;
  padding: 1rem;
}
.settings-btn {
  margin-right: 0.75rem;
  color: var(--fg);
  text-decoration: none;
  font-family: inherit;
  font-size: 1rem;
}
.settings-btn:hover { text-decoration: underline; }
.login-btn {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}
.logout-inline {
  display: inline;
  margin: 0;
  padding: 0;
}
.logout-btn {
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  margin-left: 4px;
}
.logout-btn:hover {
  background: var(--fg);
  color: var(--bg);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal[aria-hidden="true"] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  cursor: pointer;
}
.modal-content {
  position: relative;
  background: var(--bg);
  border: 1px dashed var(--fg);
  padding: 1.5rem;
  min-width: 280px;
}
.modal-content h2 { margin-top: 0; font-family: var(--font-mono); }
.modal-content h2::before { content: "> "; color: var(--fg-dim); }
.login-intro { font-size: 0.9rem; color: var(--fg-dim); margin: 0.25rem 0 0.75rem; line-height: 1.4; }
.login-form label { display: block; margin-top: 0.5rem; }
.login-form input[type="password"] { width: 100%; }
.login-form button { margin-top: 0.75rem; }
.login-message { margin-top: 0.5rem; font-size: 0.9rem; }

/* MOTD overlay */
.motd-overlay {
  position: fixed;
  inset: 0;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
}
.motd-overlay[hidden] { display: none; }
.motd-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.8); cursor: pointer; }
.motd-content {
  position: relative;
  background: var(--bg);
  border: 1px dashed var(--fg);
  padding: 1.5rem;
  max-width: 90%;
  max-height: 80vh;
  overflow: auto;
}
.motd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.motd-content h2 { margin: 0; font-family: var(--font-mono); }
.motd-content h2::before { content: "[ "; color: var(--fg-dim); }
.motd-content h2::after { content: " ]"; color: var(--fg-dim); }
.motd-goblin-btn {
  background: var(--bg);
  border: 1px solid var(--fg-dim);
  font-size: 1.2rem;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  image-rendering: pixelated;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.motd-goblin-btn:hover { border-color: var(--fg); }
.motd-goblin-btn.active {
  border-color: #4a9a3a;
  box-shadow: 0 0 8px #4a9a3a;
  background: #1a2a1a;
}
.motd-actions { display: flex; gap: 0.75rem; margin-top: 1rem; }
.motd-actions button { font-family: var(--font-mono); background: var(--bg); color: var(--fg); border: 1px solid var(--fg-dim); padding: 0.25rem 0.5rem; cursor: pointer; }
.motd-actions button:hover { border-color: var(--fg); }
.motd-actions button:disabled { opacity: 0.5; cursor: wait; }
#motd-refresh-msg { display: block; margin-top: 0.5rem; font-size: 0.85rem; }

/* Tab strip (in-app tabs) — full overlay when viewing a tab */
.tab-strip {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.tab-strip[hidden] { display: none; }
.tab-list {
  display: flex;
  gap: 0;
  border-bottom: 1px dashed var(--fg-dim);
  padding: 0 0.5rem;
  flex-shrink: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-handle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px dashed var(--fg-dim);
  border-bottom: none;
  padding: 4px 2px 4px 0;
  margin-right: -1px;
}
@media (max-width: 768px) {
  .tab-handle { padding: 8px 4px; gap: 4px; }
}
.tab-handle.active {
  border-color: var(--fg);
  background: var(--bg);
}
.tab-label {
  background: none;
  border: none;
  color: var(--fg-dim);
  padding: 2px 6px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tab-handle.active .tab-label { color: var(--fg); }
.tab-label:hover { color: var(--fg); background: none; }
.tab-popout, .tab-close {
  background: none;
  border: none;
  color: var(--fg-dim);
  padding: 2px 4px;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1;
}
@media (max-width: 768px) {
  .tab-popout, .tab-close { padding: 6px 10px; font-size: 1rem; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
  .tab-label { padding: 6px 8px; font-size: 0.9rem; max-width: 140px; }
}
.tab-popout:hover, .tab-close:hover {
  color: var(--fg);
  background: none;
}
.tab-panels {
  flex: 1;
  min-height: 0;
  position: relative;
}
.tab-panel { display: none; position: absolute; inset: 0; }
.tab-panel.active { display: block; }
.tab-panel iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: var(--bg);
}
.tab-reader {
  padding: 2rem 2.5rem;
  max-width: 48rem;
  margin: 0 auto;
  overflow-y: auto;
  height: 100%;
  font-family: var(--font);
  color: var(--fg);
}
.tab-reader-title {
  font-size: 1.3rem;
  margin: 0 0 0.5rem;
  color: var(--fg);
  line-height: 1.3;
}
.tab-reader-source {
  display: inline-block;
  font-size: 0.8rem;
  color: var(--fg-dim);
  margin-bottom: 1rem;
  border: 1px solid var(--fg-dim);
  padding: 0.1rem 0.5rem;
}
.tab-reader-snippet {
  font-size: 0.95rem;
  color: var(--fg-dim);
  line-height: 1.6;
  margin: 1rem 0 1.5rem;
  white-space: pre-wrap;
}
.tab-reader-link {
  display: inline-block;
  color: var(--accent, var(--fg));
  font-size: 1rem;
  margin-top: 0.5rem;
  text-decoration: none;
}
.tab-reader-link:hover {
  text-decoration: underline;
}

/* Bar-only mode: tab bar sits at the top, dashboard visible beneath */
.tab-strip.bar-only {
  bottom: auto;
  background: none;
  pointer-events: none;
}
.tab-strip.bar-only .tab-panels {
  display: none;
}
.tab-strip.bar-only .tab-list {
  pointer-events: auto;
  background: var(--bg);
  transform: translateY(-100%);
  opacity: 0;
  transition: transform 0.25s ease-out, opacity 0.2s ease-out;
}
.tab-strip.bar-only.peek .tab-list {
  transform: translateY(0);
  opacity: 1;
}

/* Hotzone: invisible trigger area at the top of the viewport */
.tab-hotzone {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 8px;
  z-index: 901;
}
.tab-hotzone::after {
  content: "";
  display: block;
  width: 32px;
  height: 2px;
  background: var(--fg-dim);
  opacity: 0.3;
  margin: 3px auto 0;
  border-radius: 1px;
  transition: opacity 0.3s;
}
.tab-hotzone:hover::after {
  opacity: 0.7;
}
@media (max-width: 768px) {
  .tab-hotzone { height: 28px; }
  .tab-hotzone::after {
    width: 48px;
    height: 4px;
    margin: 10px auto 0;
    opacity: 0.5;
    border-radius: 2px;
  }
}

/* Podcast player */
.podcast-player { padding: 0.5rem; border: 1px dashed var(--fg-dim); margin: 0.5rem 0; }
.now-playing { margin-bottom: 0.5rem; font-size: 0.9rem; }
.player-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.player-controls input[type="range"] { width: 120px; }

/* Add podcast modal: search results */
.podcast-search { margin-top: 0.75rem; }
.podcast-search input[type="text"] { width: 100%; margin-bottom: 0.5rem; }
.podcast-search-results { margin-top: 0.5rem; max-height: 200px; overflow: auto; }
.podcast-search-results ul { list-style: none; margin: 0; padding: 0; }
.podcast-search-results .podcast-search-result-btn {
  display: block;
  width: 100%;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--fg);
  border: none;
  padding: 0.35rem 0;
  cursor: pointer;
  border-bottom: 1px dashed var(--fg-dim);
}
.podcast-search-results .podcast-search-result-btn:hover { color: var(--fg-dim); }

/* Refresh progress bar */
.refresh-progress {
  position: fixed;
  bottom: 0;
  left: 0;
  max-width: 380px;
  z-index: 800;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}
.refresh-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg);
  border: 1px dashed var(--fg-dim);
  padding: 4px 8px;
  cursor: pointer;
  user-select: none;
}
.refresh-header:hover { border-color: var(--fg); }
.refresh-bar-wrap {
  width: 100px;
  height: 6px;
  border: 1px solid var(--fg-dim);
  flex-shrink: 0;
  overflow: hidden;
}
.refresh-bar-fill {
  height: 100%;
  width: 0;
  background: var(--fg);
  transition: width 0.4s ease;
}
.refresh-status {
  color: var(--fg-dim);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.refresh-log {
  background: var(--bg);
  border: 1px dashed var(--fg-dim);
  border-top: none;
  max-height: 180px;
  overflow-y: auto;
  padding: 4px 8px;
}
.refresh-log[hidden] { display: none; }
.refresh-log-line {
  color: var(--fg-dim);
  font-size: 0.75rem;
  line-height: 1.5;
  white-space: pre;
}
.refresh-progress.dismissing {
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

/* --- Source Editor --- */
.edit-sources-btn {
  background: none;
  border: 1px solid var(--fg, #33ff33);
  color: var(--fg, #33ff33);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75em;
  margin-left: 0.5em;
  padding: 0 0.4em;
  vertical-align: middle;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.edit-sources-btn:hover { opacity: 1; }

.source-editor-content {
  max-width: 560px;
  width: 90vw;
  max-height: 80vh;
  overflow-y: auto;
}
.source-editor-section { margin: 0.8em 0; }
.source-editor-section h3 {
  font-size: 0.9em;
  margin: 0 0 0.5em;
  color: var(--fg, #33ff33);
  opacity: 0.8;
}
.source-editor-list { display: flex; flex-direction: column; gap: 0.35em; }
.source-editor-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5em;
  padding: 0.3em 0.5em;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 2px;
  background: rgba(255,255,255,0.03);
}
.source-editor-row.disabled { opacity: 0.45; }
.source-editor-row.suggestion { border-color: rgba(99,102,241,0.3); }
.source-editor-label {
  flex: 1;
  font-size: 0.85em;
  word-break: break-word;
}
.source-editor-label small {
  display: block;
  opacity: 0.6;
  margin-top: 0.2em;
}
.source-editor-rm,
.source-editor-add {
  white-space: nowrap;
  font-size: 0.8em;
  flex-shrink: 0;
}
.source-editor-add.added { color: #0f0; border-color: #0f0; cursor: default; }
.source-editor-add-row {
  display: flex;
  gap: 0.4em;
  flex-wrap: wrap;
}
.source-editor-add-row .ascii-input {
  flex: 1;
  min-width: 100px;
}
.source-editor-count-row {
  display: flex;
  align-items: center;
  gap: 0.5em;
  flex-wrap: wrap;
}
.source-editor-count-row label {
  font-size: 0.85em;
}
.source-editor-footer {
  text-align: right;
  margin-top: 1em;
}
.ascii-input {
  background: var(--bg, #0a0a0a);
  color: var(--fg, #33ff33);
  border: 1px solid var(--fg, #33ff33);
  font-family: inherit;
  font-size: 0.85em;
  padding: 0.3em 0.5em;
}
.ascii-btn {
  background: none;
  color: var(--fg, #33ff33);
  border: 1px solid var(--fg, #33ff33);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85em;
  padding: 0.3em 0.6em;
}
.ascii-btn:hover { background: rgba(255,255,255,0.08); }
.ascii-btn:disabled { opacity: 0.4; cursor: default; }

/* --- Welcome Overlay --- */
.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg, #0a0a0a);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.8s ease;
}
.welcome-overlay.fading {
  opacity: 0;
  pointer-events: none;
}
.welcome-overlay.gone { display: none; }
.welcome-goblin {
  color: var(--fg, #33ff33);
  font-family: var(--font-mono);
  font-size: clamp(6px, 1.3vw, 14px);
  line-height: 1.15;
  text-align: center;
  white-space: pre;
  margin: 0;
  text-shadow: 0 0 8px var(--fg, #33ff33);
}
.welcome-hint {
  color: var(--fg-dim, #006600);
  font-size: 0.75em;
  margin-top: 1.5em;
  opacity: 0.6;
  animation: welcome-blink 1.5s steps(2, start) infinite;
}
@keyframes welcome-blink {
  50% { opacity: 0.2; }
}
.welcome-selector {
  margin-top: 1em;
  z-index: 10000;
}
.welcome-selector select {
  font-family: var(--font-mono);
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  padding: 2px 6px;
}

.legend-toggle {
  background: none;
  border: none;
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: inherit;
  cursor: pointer;
  padding: 0;
}
.legend-toggle:hover { text-decoration: underline; }

.votes-fieldset { margin-top: 2rem; }
.votes-list { max-height: 50vh; overflow-y: auto; padding: 0.5rem 0; }
.vote-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.25rem;
  border-bottom: 1px solid var(--fg-dim);
}
.vote-row:first-child { border-top: 1px solid var(--fg-dim); }
.vote-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vote-up { color: #0f0; margin-right: 0.4rem; }
.vote-down { color: #f44; margin-right: 0.4rem; }
.vote-rm { flex-shrink: 0; margin-left: 0.75rem; font-size: 0.85rem; }

.reddit-picker-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.reddit-picker-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  border: 1px solid var(--fg-dim);
  padding: 0.2rem 0.4rem;
  font-size: 0.85rem;
}
.reddit-picker-label { color: #ff4500; font-weight: bold; }
.reddit-picker-btn { font-size: 0.8rem; padding: 0.15rem 0.3rem; }
.reddit-picker-btn.active { color: #0f0; border-color: #0f0; cursor: default; }

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  max-width: 90rem;
  margin: 0 auto;
}
@media (max-width: 900px) { .stats-grid { grid-template-columns: 1fr; } }
.stats-panel {
  border: 1px solid var(--fg-dim);
  padding: 0.5rem;
  overflow-x: auto;
}
.stats-panel legend {
  color: var(--fg);
  font-weight: bold;
}
.ascii-graph {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.35;
  white-space: pre;
  color: var(--fg);
  overflow-x: auto;
}

.stats-range-bar {
  display: flex;
  align-items: center;
  gap: 0;
  max-width: 90rem;
  margin: 0 auto 1rem;
  font-family: var(--font-mono);
}
.stats-range-label {
  color: var(--fg-dim);
  margin-right: 0.75rem;
  font-size: 0.85rem;
}
.stats-range-btn {
  background: var(--bg);
  color: var(--fg-dim);
  border: 1px solid var(--fg-dim);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, text-shadow 0.15s;
  position: relative;
  z-index: 1;
}
.stats-range-btn:hover { color: var(--fg); border-color: var(--fg); }
.stats-range-btn.active {
  color: var(--fg);
  border-color: var(--fg);
  text-shadow: 0 0 8px var(--fg);
}
.stats-range-track {
  width: 2.5rem;
  height: 3px;
  background: var(--fg-dim);
  position: relative;
  flex-shrink: 0;
}
.stats-range-fill {
  position: absolute;
  left: 0; top: 0;
  height: 100%;
  width: 0%;
  background: var(--fg);
  box-shadow: 0 0 6px var(--fg);
  transition: width 0.3s;
}
