/* Speak & Spell: a late-1970s talking learning toy. A bright orange case
   (the top bar, the footer and a frame round the window) with a yellow
   and red stripe under its top; the page a black screen; the LCD a
   glowing green VFD; buttons are the toy's yellow keys. pistar.js plays
   its power-on chirp and, now and then, has it speak (both made as they
   play: no recordings). Meets 4.5:1 like every theme; the motion stops
   for reduced motion. */
:root[data-theme="speakspell-dark"] {
  --ps-bg-primary: #0b0b0b;
  --ps-bg-secondary: #151515;
  --ps-bg-tertiary: #202020;
  --ps-border: #3d3d3d;
  --ps-text-primary: #f4f4f4;
  --ps-text-secondary: #bdbdbd;
  --ps-text-inverse: #111111;
  --ps-accent: #ff7a1a;
  --ps-accent-hover: #ff9b52;
  --ps-accent-subtle: #2b1405;
  --ps-success: #4dffa6;
  --ps-warning: #ffd21a;
  --ps-danger: #ff5a4f;
  --ps-info: #5cd6ff;
  /* The case */
  --ps-nav-bg: #f26a1e;
  --ps-nav-text: #111111;
  --ps-input-bg: #0f0f0f;
  --ps-input-border: #4d4d4d;
  --ps-table-header-bg: #202020;
  /* A VFD: glowing green on black */
  --lcd-bg: #03140d;
  --lcd-ink: #5cffb0;
  /* The accent and state colours as text, and the buttons (the toy's
     yellow keys): readable (4.5:1) on this theme */
  --ps-accent-text: #ff8a33;
  --ps-info-text: #5cd6ff;
  --ps-success-text: #4dffa6;
  --ps-warning-text: #ffd21a;
  --ps-danger-text: #ff6a60;
  --ps-on-accent: #111111;
  --ps-accent-btn: #ffc81a;
  --ps-accent-btn-hover: #ffd95c;
  --ss-case: #f26a1e;
  --ss-case-dark: #dc5f16;
  --ss-yellow: #ffc81a;
  /* The keys: bright yellow, bright orange, dark orange; black legends */
  --ss-key-1: #ffd21a;
  --ss-key-2: #ff7a1a;
  --ss-key-3: #d9600f;
  --ss-red: #d62a1e;
}

/* The case shows below the footer on a short page; inside the orange
   frame the page is the toy's yellow, its panels black screens on it */
:root[data-theme="speakspell-dark"] { background: var(--ss-case); }
:root[data-theme="speakspell-dark"] body { background: var(--ss-yellow); }

/* The case: the top bar moulded orange, a yellow and red stripe under
   it, as the toy has under its display */
:root[data-theme="speakspell-dark"] header[role="banner"] {
  background: linear-gradient(180deg, #ff7f33 0%, var(--ss-case) 55%, var(--ss-case-dark) 100%);
  box-shadow: 0 3px 0 var(--ss-yellow), 0 6px 0 var(--ss-red), 0 10px 18px rgba(0, 0, 0, 0.6);
}
:root[data-theme="speakspell-dark"] footer[role="contentinfo"] {
  background: linear-gradient(0deg, #ff7f33 0%, var(--ss-case) 55%, var(--ss-case-dark) 100%);
  box-shadow: 0 -3px 0 var(--ss-yellow), 0 -6px 0 var(--ss-red);
}

/* The orange frame round the black screen (the window): drawn over the
   page's edges, never in the way of a click */
:root[data-theme="speakspell-dark"] body::after {
  content: "";
  position: fixed;
  inset: 0 10px 10px;
  border-radius: 0 0 22px 22px;
  /* Solid shadows only: a blurred one over the whole window is costly to
     draw on every repaint beneath it */
  box-shadow: 0 0 0 40px var(--ss-case), inset 0 0 0 2px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  z-index: 90;
}
@media (max-width: 575px) {
  :root[data-theme="speakspell-dark"] body::after { inset: 0 5px 5px; border-radius: 0 0 14px 14px; }
}

/* Panels: smoked black glass with a fine edge */
:root[data-theme="speakspell-dark"] .card {
  background: linear-gradient(180deg, #181818, #111111);
  border-color: #333333;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 10px rgba(0, 0, 0, 0.6);
}

/* Headings: lit on the VFD */
:root[data-theme="speakspell-dark"] .card h2,
:root[data-theme="speakspell-dark"] main h1 {
  color: var(--lcd-ink);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-shadow: 0 0 6px rgba(92, 255, 176, 0.65);
}

/* Buttons: the toy's chunky yellow keys */
:root[data-theme="speakspell-dark"] .btn-primary,
:root[data-theme="speakspell-dark"] .btn.btn-primary {
  border-radius: 0.6rem;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.25), 0 2px 0 #8a6a00;
}
:root[data-theme="speakspell-dark"] .btn-primary:active {
  transform: translateY(1px);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25), 0 1px 0 #8a6a00;
}

/* On Air: each stop a key of the toy's keyboard, in its yellow, orange
   and dark orange in turn, with black legends; raised, as the keys are */
:root[data-theme="speakspell-dark"] .lr-node {
  --ss-key: var(--ss-key-1);
  background: var(--ss-key);
  border: 0;
  border-bottom: 4px solid color-mix(in srgb, var(--ss-key) 62%, #000);
  border-radius: 0.7rem;
  color: #111111;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 3px 6px rgba(0, 0, 0, 0.55);
}
:root[data-theme="speakspell-dark"] .lr-route > .lr-node:nth-child(6n+3) { --ss-key: var(--ss-key-2); }
:root[data-theme="speakspell-dark"] .lr-route > .lr-node:nth-child(6n+5) { --ss-key: var(--ss-key-3); }
:root[data-theme="speakspell-dark"] .lr-node .lr-icon,
:root[data-theme="speakspell-dark"] .lr-node .lr-label,
:root[data-theme="speakspell-dark"] .lr-node .lr-title,
:root[data-theme="speakspell-dark"] .lr-node .lr-title .lr-id,
:root[data-theme="speakspell-dark"] .lr-node .lr-sub {
  color: #111111;
}
:root[data-theme="speakspell-dark"] .lr-node .lr-label { font-weight: 700; }
:root[data-theme="speakspell-dark"] .lr-node .lr-stats span {
  background: rgba(0, 0, 0, 0.14);
  color: #111111;
}
/* Live: the hotspot's key lit from behind; past calls stay readable */
:root[data-theme="speakspell-dark"] .lr-live .lr-node-hotspot {
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.35), 0 0 0 2px #fff6c2, 0 0 18px 2px rgba(255, 210, 26, 0.8);
}
:root[data-theme="speakspell-dark"] .lr-past .lr-node { opacity: 0.85; filter: none; }
/* Narrow screens: the stops are rows; each still a key */
@media (max-width: 860px) {
  :root[data-theme="speakspell-dark"] .lr-route { background: #0b0b0b; }
  :root[data-theme="speakspell-dark"] .lr-node,
  :root[data-theme="speakspell-dark"] .lr-size-half .lr-node {
    padding: 0.35rem 0.55rem;
    border-radius: 0.55rem;
    border-bottom-width: 3px;
  }
  :root[data-theme="speakspell-dark"] .lr-live .lr-node-hotspot .lr-icon { box-shadow: none; }
  :root[data-theme="speakspell-dark"] .lr-size-slim .lr-node { padding: 0.1rem 0.45rem; border-bottom-width: 2px; }
}

/* The LCD panel is the VFD, in the toy's black bezel */
:root[data-theme="speakspell-dark"] .lcd-bezel {
  background: linear-gradient(145deg, #1c1c1c 0%, #050505 60%, #141414 100%);
  box-shadow: 0 0 0 3px var(--ss-case-dark), 0 4px 12px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
:root[data-theme="speakspell-dark"] .lcd-screen {
  position: relative;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at 50% 40%, #062418 0%, var(--lcd-bg) 70%);
  text-shadow: 0 0 5px rgba(92, 255, 176, 0.8);
}
:root[data-theme="speakspell-dark"] .lcd-callsign,
:root[data-theme="speakspell-dark"] .lcd-row-status .lcd-status,
:root[data-theme="speakspell-dark"] .lcd-freq,
:root[data-theme="speakspell-dark"] .lcd-label {
  text-shadow: 0 0 5px rgba(92, 255, 176, 0.8);
}
/* Modes that are off are unlit segments */
:root[data-theme="speakspell-dark"] .lcd-mode:not(.enabled) {
  color: color-mix(in srgb, var(--lcd-ink) 16%, transparent);
  text-shadow: none;
}

/* What the toy says, spelled out on the VFD (pistar.js): over the LCD
   panel, or a strip under the top bar on a page without one */
.ss-say {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: inherit;
  background: var(--lcd-bg, #03140d);
  color: var(--lcd-ink, #5cffb0);
  font-family: var(--ps-font-lcd-dot, monospace);
  font-size: clamp(1rem, 3.2vw, 1.6rem);
  line-height: 1.3;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-shadow: 0 0 8px rgba(92, 255, 176, 0.9), 0 0 2px #5cffb0;
  overflow-wrap: anywhere;
}
.ss-say.ss-say-strip {
  position: fixed;
  inset: auto 1rem auto 1rem;
  top: 4.25rem;
  min-height: 3.2rem;
  z-index: 95;
  border: 3px solid #0a0a0a;
  border-radius: 10px;
  box-shadow: 0 0 0 3px var(--ss-case-dark, #dc5f16), 0 6px 18px rgba(0, 0, 0, 0.7);
}
.ss-say .ss-caret { animation: ss-blink 0.5s steps(1) infinite; }
@keyframes ss-blink { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .ss-say .ss-caret { animation: none; }
  :root[data-theme="speakspell-dark"] .btn-primary:active { transform: none; }
}

/* Every page's content sits on a black screen panel, the yellow round it
   (the dashboard's panels already are): the admin pages, the manual, the
   Link Manager and the login form */
:root[data-theme="speakspell-dark"] .admin-layout,
:root[data-theme="speakspell-dark"] .manual-layout,
:root[data-theme="speakspell-dark"] .links-public,
:root[data-theme="speakspell-dark"] .login-container {
  background: var(--ps-bg-primary);
  border-radius: 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 0 3px #111111, 0 6px 18px rgba(0, 0, 0, 0.45);
}
:root[data-theme="speakspell-dark"] .admin-layout,
:root[data-theme="speakspell-dark"] .manual-layout {
  margin: 1rem auto;
}
/* Not overflow: hidden (it would clip dropdowns): the sidebars take the
   panel's rounded corners instead */
:root[data-theme="speakspell-dark"] .admin-sidebar,
:root[data-theme="speakspell-dark"] .manual-sidebar { border-radius: 1rem 0 0 1rem; }
:root[data-theme="speakspell-dark"] .manual-layout { max-width: calc(100% - 2rem); }
:root[data-theme="speakspell-dark"] .links-public { margin-top: 1rem; margin-bottom: 1rem; padding: 1rem 1.25rem; }
:root[data-theme="speakspell-dark"] .login-container { padding: 2rem; }
@media (max-width: 575px) {
  :root[data-theme="speakspell-dark"] .admin-layout,
  :root[data-theme="speakspell-dark"] .manual-layout { margin: 0.5rem; max-width: none; }
  :root[data-theme="speakspell-dark"] .links-public { margin: 0.5rem; padding: 0.75rem; }
  :root[data-theme="speakspell-dark"] .login-container { padding: 1.25rem; }
}
