/* ============================================================
   WEBAMPINATOR PWA — Classic skin styles, mobile-first
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* ── CSS Variables ──────────────────────────────────────────── */

:root {
  /* Webampinator classic palette */
  --w-bg:           #1a1a1a;
  --w-surface:      #232323;
  --w-surface2:     #2d2d2d;
  --w-border-hi:    #5a5a5a;
  --w-border-lo:    #0d0d0d;
  --w-text:         #c8c8c8;
  --w-text-muted:   #ababab;
  --w-text-dim:     #949494;
  --w-lcd-bg:       #000000;
  --w-lcd-text:     #00ff41;
  --w-lcd-dim:      #008800;
  --w-lcd-time:     #00e87a;
  --w-accent:       #01bce2;
  --w-accent-dark:  #0090b8;
  --w-title-start:  #2266aa;
  --w-title-end:    #0f3d6e;
  --w-btn-face:     #2a2a2a;
  --w-btn-hi:       #4a4a4a;
  --w-btn-lo:       #111111;
  --w-pl-bg:        #0f0f0f;
  --w-pl-text:      #b4b4b4;
  --w-pl-active:    #1a3f7a;
  --w-pl-active-t:  #ffffff;
  --w-pl-hover:     #1e1e1e;
  --w-error:        #ff4444;
  --w-success:      #00ff41;
  --w-warn:         #f5a524;   /* a lit amber LED: reconnecting, no buffer */
  --w-led-ink:      var(--w-lcd-text);   /* the LED colour as drawable on a key face — set per skin by Skins._syncLedInk */
  --w-aod-green:    #00ff41;   /* the AOD's one alternative to the skin's LCD colour */

  /* Layout */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius:      4px;

  /* Font scale multipliers (1 = default, 0.5–2.0 range) */
  --fs-lcd:      1;
  --fs-controls: 1;
  --fs-playlist: 1;
  --fs-ab:       1;
  --fs-ui:       1;
}

/* Light theme overrides — keep Webampinator dark even in light mode */
[data-theme="light"] {
  --w-bg:       #2a2a2a;
  --w-surface:  #323232;
  --w-surface2: #3a3a3a;
}

/* ── Base ───────────────────────────────────────────────────── */

html {
  height: 100%;
  overflow: hidden;
}

body {
  height: 100%;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size: 13px;
  line-height: 1.4;
  background: var(--w-bg);
  color: var(--w-text);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.hidden { display: none !important; }

/* ── App header ─────────────────────────────────────────────── */

#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  padding-top: var(--safe-top);
  height: calc(36px + var(--safe-top));
  background: var(--w-surface);
  border-bottom: 1px solid var(--w-border-lo);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04),
              0 1px 0 var(--w-border-hi);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}

#app-header.hidden { display: none; }

.header-right {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-title {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  min-width: 0;          /* yield to .header-right: a scaled-up name is cut, never the ⋮ menu */
  font-family: 'Courier New', Courier, monospace;
  font-size: calc(0.8rem * var(--fs-ui));
  font-weight: 700;
  color: var(--w-accent);
  text-shadow: 0 0 8px color-mix(in srgb, var(--w-accent) 45%, transparent);   /* the skin's own glow */
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* The app icon in front of the name, in place of a 🎵 whose look was the device font's
   choice. It is the brand tile, fixed navy and green — deliberately NOT skinned.
   It grows with --fs-ui, but only up to 28 px: #app-header is a fixed 36 px, and an
   uncapped 1.9em was 49 px at 200 % (the 0.1.36 lesson — a px box beside an --fs-* font).
   Not a target: a long-press would offer "Download image" over the player. The width/height
   attributes in index.html hold its size if a stale style.css ever arrives without this rule. */
.header-logo {
  width: min(1.9em, 28px);
  height: min(1.9em, 28px);
  pointer-events: none;
}
.header-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-btn {
  width: 30px;
  height: 22px;
  background: var(--w-btn-face);
  border: 1px solid;
  border-color: var(--w-btn-hi) var(--w-btn-lo) var(--w-btn-lo) var(--w-btn-hi);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--w-text-muted);
  transition: color 0.1s;
}
.icon-btn:hover  { color: var(--w-text); background: var(--w-surface2); }
.icon-btn:active {
  border-color: var(--w-btn-lo) var(--w-btn-hi) var(--w-btn-hi) var(--w-btn-lo);
  color: var(--w-accent);
}
#share-btn, #aod-btn { width: 36px; font-size: 14px; }

/* ── Open-btn long-press menu ───────────────────────────────── */
.wamp-transport { position: relative; }
.open-btn-menu {
  position: absolute;
  bottom: calc(100% + 4px);
  right: 0;
  min-width: 120px;
  background: var(--w-surface2);
  border: 1px solid var(--w-border-hi);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  z-index: 30;
  overflow: hidden;
  animation: menuIn 0.15s ease both;
}
.open-btn-menu.hidden { display: none; }
.open-btn-menu .menu-item { padding: 10px 14px; }

.obm-recent-sep {
  height: 1px;
  background: var(--w-border-hi);
  margin: 2px 0;
}
.obm-recent-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
}
.obm-ri-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.78rem;
}
.obm-ri-time {
  flex-shrink: 0;
  font-size: 0.68rem;
  color: var(--w-text-muted);
}
.obm-recent-more {
  font-size: 0.72rem;
  color: var(--w-accent);
  padding: 6px 14px;
  width: 100%;
  text-align: left;
}

/* ── Recent streams dialog ──────────────────────────────────── */
.recent-list {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  max-height: 50vh;
}
.recent-list::-webkit-scrollbar       { width: 6px; }
.recent-list::-webkit-scrollbar-track { background: var(--w-pl-bg); }
.recent-list::-webkit-scrollbar-thumb { background: var(--w-surface2); border-radius: 3px; }
.recent-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--w-border-lo);
}
.recent-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 2px;
}
.recent-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--w-text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.recent-time {
  font-size: 0.68rem;
  color: var(--w-text-muted);
}
.recent-empty {
  font-size: 0.8rem;
  color: var(--w-text-muted);
  text-align: center;
  padding: 24px 0;
}

/* ── Header dropdown menu ───────────────────────────────────── */

.header-menu-wrap { position: relative; }

.header-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 220px;
  background: var(--w-surface2);
  border: 1px solid var(--w-border-hi);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  z-index: 30;
  overflow: hidden;
  animation: menuIn 0.15s ease both;
}

@keyframes menuIn {
  from { opacity: 0; transform: scale(0.96) translateY(-4px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.header-menu.hidden { display: none; }

.menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: none;
  background: transparent;
  color: var(--w-text);
  font-size: calc(0.88rem * var(--fs-ui));
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}
.menu-item:hover  { background: rgba(255,255,255,0.06); }
.menu-item:active { background: rgba(255,255,255,0.1); }
.menu-item svg { flex-shrink: 0; color: var(--w-text-muted); }

.menu-item-badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--w-text-muted);
  background: var(--w-surface);
  border: 1px solid var(--w-border-lo);
  border-radius: 4px;
  padding: 2px 6px;
  letter-spacing: 0.05em;
}
.plan-badge-pro {
  color: #f59e0b;
  border-color: #78350f;
  background: #1c0f00;
}

.menu-item-danger { color: var(--w-error); }
.menu-item-danger svg { color: var(--w-error); }

.menu-item-chevron { margin-left: auto; color: var(--w-text-dim); }

/* ── Settings sheet ─────────────────────────────────────────── */

.settings-sheet {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-bottom: calc(20px + var(--safe-bottom));
  overflow-y: auto;
}

.settings-group {
  display: flex;
  flex-direction: column;
}

.settings-sheet .menu-item {
  padding: 13px 4px;
  font-size: calc(0.9rem * var(--fs-ui));
}

.settings-sheet .menu-divider {
  margin: 4px 0;
}

.settings-section-label {
  margin: 14px 0 2px;
  padding: 0 4px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--w-text-muted);
}

.menu-divider {
  height: 1px;
  background: var(--w-border-lo);
  margin: 2px 0;
}

.menu-toggle {
  margin-left: auto;
  width: 34px;
  height: 18px;
  background: var(--w-border-lo);
  border-radius: 9px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
}
.menu-toggle.on { background: var(--w-accent); }
.menu-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  transition: transform 0.2s;
}
.menu-toggle.on .menu-toggle-thumb { transform: translateX(16px); }

/* Lang button */
.lang-btn {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--w-border-hi);
  background: transparent;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--w-text-muted);
  cursor: pointer;
  letter-spacing: 0.05em;
}
.lang-btn:hover { background: rgba(255,255,255,0.06); color: var(--w-text); }

/* ── Screens ────────────────────────────────────────────────── */

.screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}
.screen.hidden { display: none; }

/* ── Auth screen ────────────────────────────────────────────── */

#auth-screen {
  background: var(--w-bg);
  padding-top: var(--safe-top);
  justify-content: space-between;
  align-items: center;
}

.auth-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 32px 24px;
  text-align: center;
  gap: 16px;
}

.auth-icon {
  width: 96px;
  height: 96px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 1px rgba(1,188,226,0.3);
}
.auth-icon img { width: 100%; height: 100%; display: block; }

.auth-title {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--w-accent);
  text-shadow: 0 0 20px rgba(1,188,226,0.4);
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--w-text-muted);
  max-width: 280px;
  line-height: 1.6;
}

.auth-actions {
  width: 100%;
  padding: 24px 24px calc(24px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.btn-google {
  width: 100%;
  max-width: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 13px 24px;
  background: var(--w-surface2);
  border: 1px solid var(--w-border-hi);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--w-text);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: background 0.15s, transform 0.1s;
}
.btn-google:hover  { background: var(--w-surface); }
.btn-google:active { transform: scale(0.97); }

.btn-text {
  background: none;
  border: none;
  color: var(--w-text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 8px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-text:hover { color: var(--w-text); }

.auth-version { font-size: 0.75rem; color: var(--w-text-dim); }

/* ── Player screen ──────────────────────────────────────────── */

#player-screen {
  background: var(--w-bg);
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

#player-screen.drag-active {
  outline: 2px dashed var(--w-accent);
  outline-offset: -4px;
}

/* ── AOD overlay ───────────────────────────────────────────── */

/* ONE colour. Everything the AOD draws — every line of text, every icon, every outline —
   is the LED colour at some intensity, in the LCD's typeface: one instrument, readable at
   a glance on a night ride. The colour follows the skin's LCD (green in Obsidian, cyan in
   Classic); the only alternative is green. There used to be four colour pickers, white
   text at four opacities and a sans-serif face.
   Two intensities, both AA on the AOD's dark backgrounds: LIT for the title and the
   clock, DIM for everything else. Amber and red stay what they are everywhere else —
   state (reconnecting, the alarm getting close), never decoration. */
.aod-overlay {
  --aod-led: var(--w-lcd-text);
  --aod-dim: color-mix(in srgb, var(--aod-led) 72%, transparent);
  font-family: 'Courier New', Courier, monospace;
  color: var(--aod-dim);
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--aod-bg, #000);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
.aod-overlay.hidden { display: none; }
.aod-overlay[data-led="green"] { --aod-led: var(--w-aod-green); }
.aod-overlay button { font-family: inherit; }

/* Close button */
/* The AOD runs edge-to-edge behind the system bars (Android shell), so both corner
   buttons must clear them — the ✕ sat under the battery icon. */
.aod-close-btn {
  position: absolute;
  top: calc(14px + var(--safe-top));
  right: 14px;
  z-index: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
/* AOD buttons as LEDs: LED-coloured outline and glyph at low intensity — this is a screen
   that stays on all night — lit fully on press or when the button is "on". */
.aod-close-btn, .aod-save-gps-btn, .aod-save-parking-btn, .aod-fav-song-btn {
  border: 1px solid color-mix(in srgb, var(--aod-led) 45%, transparent);
  background: color-mix(in srgb, var(--aod-led) 6%, transparent);
  color: var(--aod-dim);
  text-shadow: 0 0 6px color-mix(in srgb, var(--aod-led) 50%, transparent);
}
.aod-close-btn:hover, .aod-save-gps-btn:hover, .aod-save-parking-btn:hover, .aod-fav-song-btn:hover,
.aod-close-btn:active, .aod-save-gps-btn:active, .aod-save-parking-btn:active, .aod-fav-song-btn:active,
.aod-fav-song-btn[aria-pressed="true"] {
  background: color-mix(in srgb, var(--aod-led) 16%, transparent);
  color: var(--aod-led);
  text-shadow: 0 0 8px var(--aod-led);
  filter: drop-shadow(0 0 4px var(--aod-led));
}

/* Save-GPS button (bottom-right corner of AOD) — mobile/touch only */
@media (hover: hover) and (pointer: fine) {
  .aod-save-gps-btn, .aod-save-parking-btn { display: none !important; }
}
/* The two bottom corners mirror each other: parking on the left, the pin on the right. */
.aod-save-parking-btn { left: 14px; }
.aod-save-gps-btn     { right: 14px; }
.aod-save-gps-btn, .aod-save-parking-btn {
  position: absolute;
  bottom: calc(14px + var(--safe-bottom));
  z-index: 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

/* AOD one-time long-press hint */
.aod-hint {
  position: absolute;
  bottom: 28%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--aod-bg, #000);
  color: var(--aod-led);
  font-size: 0.78rem;
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--aod-dim);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
  white-space: nowrap;
  z-index: 10;
}
.aod-hint.aod-hint--show { opacity: 1; }

/* Info zone (top in portrait, left in landscape) */
.aod-info {
  flex: 1;
  min-height: 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 24px;
  text-align: center;
  overflow: hidden;
}

.aod-clock {
  font-size: clamp(1.6rem, 7vw, 2.6rem);
  color: var(--aod-led);
  text-shadow: 0 0 10px var(--aod-led);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  line-height: 1;
}

.aod-track {
  font-size: clamp(1.5rem, 6.5vw, 2.4rem);
  color: var(--aod-led);
  text-shadow: 0 0 12px var(--aod-led);   /* the title is the big LED */
  padding: 0 16px;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: aod-breathe 5s ease-in-out infinite;
}
.aod-track-inner {
  display: inline-block;
  white-space: nowrap;
}
.aod-track.marquee {
  text-overflow: clip;
}
.aod-track.marquee .aod-track-inner {
  animation: aod-marquee var(--marquee-dur, 8s) ease-in-out 1s infinite alternate;
}
@keyframes aod-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(var(--marquee-dist, 0px)); }
}

.aod-artist {
  font-size: clamp(0.95rem, 3.8vw, 1.3rem);
  color: var(--aod-dim);
  text-shadow: 0 0 8px color-mix(in srgb, var(--aod-led) 40%, transparent);
  padding: 0 8px;
  max-width: 100%;
}

/* Inline ♥ "save song" button on the AOD overlay (radio now-playing only) */
.aod-fav-song-btn {
  margin: 10px auto 0;
  padding: 5px 16px;
  border-radius: 999px;
  font-size: calc(clamp(0.8rem, 3vw, 1rem) * var(--aod-fs, 1));
  letter-spacing: 0.04em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.aod-fav-song-btn.saved {                 /* saved = the LED is on */
  color: var(--aod-led);
  border-color: var(--aod-led);
  background: color-mix(in srgb, var(--aod-led) 16%, transparent);
}
.aod-fav-song-btn.hidden { display: none; }

.aod-station {
  font-size: clamp(1.1rem, 4.5vw, 1.6rem);
  color: var(--aod-dim);
  text-shadow: 0 0 8px color-mix(in srgb, var(--aod-led) 40%, transparent);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 8px;
  max-width: 100%;
}
.aod-station:empty { display: none; }

@keyframes aod-breathe {
  0%, 100% { opacity: 0.55; }
  50%       { opacity: 1;    }
}
/* AOD font-size scale */
.aod-overlay { --aod-fs: 1; }
.aod-track  { font-size: calc(clamp(1.5rem, 6.5vw, 2.4rem) * var(--aod-fs)); }
.aod-artist { font-size: calc(clamp(0.95rem, 3.8vw, 1.3rem) * var(--aod-fs)); }

/* D-pad zone (bottom in portrait, right in landscape) */
.aod-dpad-zone {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px 8px;
  position: relative;
}

.aod-dpad-svg {
  width: min(240px, 78vw, 46vh);
  height: min(240px, 78vw, 46vh);
  touch-action: manipulation;
}

/* Volume indicator (brief popup) */
.aod-vol-indicator {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--aod-led) 16%, transparent);
  color: var(--aod-led);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 12px;
  pointer-events: none;
  transition: opacity 0.4s;
}
.aod-vol-indicator.hidden { display: none; }
.aod-vol-indicator.fading { opacity: 0; }

/* D-pad SVG elements */
.dpad-sector {
  fill: color-mix(in srgb, var(--aod-led) 5%, transparent);
  stroke: color-mix(in srgb, var(--aod-led) 30%, transparent);
  stroke-width: 1.5;
  cursor: pointer;
  transition: fill 0.12s;
}
.dpad-sector:hover  { fill: color-mix(in srgb, var(--aod-led) 12%, transparent); }
.dpad-sector:active { fill: color-mix(in srgb, var(--aod-led) 30%, transparent); stroke: var(--aod-led); }

.dpad-center {
  fill: color-mix(in srgb, var(--aod-led) 8%, transparent);
  stroke: color-mix(in srgb, var(--aod-led) 40%, transparent);
  stroke-width: 1.5;
  cursor: pointer;
  transition: fill 0.12s;
}
.dpad-center:hover  { fill: color-mix(in srgb, var(--aod-led) 16%, transparent); }
.dpad-center:active { fill: color-mix(in srgb, var(--aod-led) 35%, transparent); }

.dpad-icon {
  fill: color-mix(in srgb, var(--aod-led) 70%, transparent);
  pointer-events: none;
}
.dpad-sublabel {
  fill: color-mix(in srgb, var(--aod-led) 40%, transparent);
  font-size: 6.5px;
  letter-spacing: 0.04em;
  pointer-events: none;
}
.dpad-center-icon {
  fill: color-mix(in srgb, var(--aod-led) 85%, transparent);
  pointer-events: none;
}
/* Same LED language as the transport row: lit while playing, amber while recovering */
.dpad-center-icon .ic-pause                       { display: none; }
.dpad-center-icon.playing .ic-play                { display: none; }
.dpad-center-icon.playing .ic-pause               { display: block; }
.dpad-center-icon.playing                         { fill: var(--aod-led); filter: drop-shadow(0 0 5px var(--aod-led)); }
.dpad-center.playing                              { stroke: var(--aod-led); stroke-width: 2; }
.dpad-center-icon.warn, .dpad-center-icon.warn.playing { fill: var(--w-warn); filter: drop-shadow(0 0 5px var(--w-warn)); }
.dpad-center.warn                                 { stroke: var(--w-warn); stroke-width: 2; }
.aod-close-btn svg, .aod-save-gps-btn svg, .aod-save-parking-btn svg { width: 18px; height: 18px; display: block; margin: 0 auto; }

/* Landscape: info left, d-pad right */
@media (orientation: landscape) {
  .aod-overlay  { flex-direction: row; }
  .aod-info     { padding: 8px 20px 8px 28px; }
  .aod-dpad-zone { padding: 20px 28px 20px 8px; flex: 0 0 auto; }
  .aod-dpad-svg {
    width: min(240px, 44vw, 80vh);
    height: min(240px, 44vw, 80vh);
  }
}

/* AOD settings toggle rows */
.aod-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 0.9rem;
}
.aod-toggle-row:last-of-type { border-bottom: none; }
.aod-toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent, #4af);
  cursor: pointer;
}

/* AOD per-element colour table */
.aod-color-table  { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.aod-color-row    { display: flex; align-items: center; gap: 8px; }
.aod-color-lbl    { font-size: 0.78rem; color: var(--text-dim, rgba(255,255,255,0.55)); min-width: 58px; flex-shrink: 0; }
.aod-color-swatches { display: flex; gap: 7px; flex-wrap: wrap; }
.aod-swatch-skin  { background: var(--w-lcd-text); }
.aod-swatch-green { background: var(--w-aod-green); }
.aod-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.1);
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.aod-swatch:hover { transform: scale(1.18); border-color: rgba(255,255,255,0.4); }
.aod-swatch.selected {
  border-color: rgba(255,255,255,0.88);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.22);
  transform: scale(1.1);
}

/* ── Share banner ──────────────────────────────────────────── */
.share-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--w-accent) 14%, var(--w-surface));
  border-bottom: 1px solid color-mix(in srgb, var(--w-accent) 35%, transparent);
  font-size: 0.82rem;
  color: var(--w-text);
  flex-shrink: 0;
}
.share-banner.hidden { display: none; }
.share-banner-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.share-banner-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-banner-meta { font-size: 0.72rem; color: var(--w-text-muted); }
.share-banner-play { font-weight: 600; color: var(--w-accent); flex-shrink: 0; }
.share-banner-close {
  background: none; border: none; cursor: pointer;
  color: var(--w-text-muted); font-size: 1rem; padding: 2px 6px;
  flex-shrink: 0;
}
.share-banner-close:hover { color: var(--w-text); }

/* ── Webampinator window ──────────────────────────────────────────── */

.wamp-window {
  background: var(--w-surface);
  border: 1px solid var(--w-border-hi);
  border-top: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

/* ── Display area ───────────────────────────────────────────── */

.wamp-display {
  display: flex;
  flex-direction: column;
  background: var(--w-surface);
  padding: 8px 10px 6px;
  gap: 6px;
  border-bottom: 1px solid var(--w-border-lo);
}

/* Visualizer canvas */
#visualizer {
  width: 100%;
  height: 52px;
  display: block;
  background: var(--w-lcd-bg);
  border: 1px solid var(--w-border-lo);
  border-right-color: var(--w-border-hi);
  border-bottom-color: var(--w-border-hi);
  image-rendering: pixelated;
}

/* LCD info panel */
.wamp-lcd {
  background: var(--w-lcd-bg);
  border: 1px solid var(--w-border-lo);
  border-right-color: var(--w-border-hi);
  border-bottom-color: var(--w-border-hi);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Track name marquee */
.wamp-marquee-wrapper {
  overflow: hidden;
  white-space: nowrap;
  height: 18px;
}

#track-name {
  display: inline-block;
  font-family: 'Courier New', Courier, monospace;
  font-size: calc(0.85rem * var(--fs-lcd));
  font-weight: 700;
  color: var(--w-lcd-text);
  text-shadow: 0 0 6px color-mix(in srgb, var(--w-lcd-text) 60%, transparent);
  letter-spacing: 0.05em;
  animation: marquee 16s linear infinite;
  white-space: nowrap;
}

@keyframes marquee {
  0%   { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}

/* Pause marquee on hover */
.wamp-marquee-wrapper:hover #track-name { animation-play-state: paused; }

/* Time + seek row */
.wamp-time-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wamp-time-display {
  font-family: 'Courier New', Courier, monospace;
  font-size: calc(1rem * var(--fs-lcd));
  font-weight: 700;
  color: var(--w-lcd-time);
  text-shadow: 0 0 8px rgba(0,232,122,0.7);
  letter-spacing: 0.1em;
  white-space: nowrap;
  min-width: 38px;
  text-align: center;
}

.wamp-seek-wrap {
  flex: 1;
  display: flex;
  align-items: center;
}

/* Seek slider */
.wamp-seek {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--w-lcd-dim);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}
.wamp-seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--w-lcd-text);
  box-shadow: 0 0 6px rgba(0,255,65,0.6);
  cursor: pointer;
}
.wamp-seek::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: none;
  background: var(--w-lcd-text);
  box-shadow: 0 0 6px rgba(0,255,65,0.6);
  cursor: pointer;
}
.wamp-seek::-webkit-slider-runnable-track { background: transparent; }

/* Track meta (artist — album) */
.wamp-track-meta {
  font-family: 'Courier New', Courier, monospace;
  font-size: calc(0.72rem * var(--fs-lcd));
  color: var(--w-lcd-dim);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-height: 14px;
}

/* Status text (inside lcd as overlay concept) */
.wamp-status-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#wamp-status {
  font-family: 'Courier New', Courier, monospace;
  font-size: calc(0.7rem * var(--fs-lcd));
  font-weight: 700;
  color: var(--w-lcd-dim);
  letter-spacing: 0.15em;
}

/* ── Controls area ──────────────────────────────────────────── */

.wamp-controls-area {
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Transport buttons */
.wamp-transport {
  display: flex;
  align-items: center;
  gap: 4px;
}

.wamp-btn {
  flex: 1;
  height: 36px;
  background: var(--w-btn-face);
  border: 1px solid;
  border-color: var(--w-btn-hi) var(--w-btn-lo) var(--w-btn-lo) var(--w-btn-hi);
  border-radius: 2px;
  color: var(--w-text);
  font-size: calc(1rem * var(--fs-controls));
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.08s;
  min-width: 36px;
}
.wamp-btn:hover  { background: var(--w-surface2); }
.wamp-btn:active {
  border-color: var(--w-btn-lo) var(--w-btn-hi) var(--w-btn-hi) var(--w-btn-lo);
  transform: scale(0.96);
}
/* Rewind button when the stream doesn't allow CORS buffering — visually
   degraded but still clickable, since shadow-seek (method B) sometimes works. */
/* ── Transport icons as LEDs ──────────────────────────────────
   The six transport icons are inline SVGs, not Unicode glyphs: which of ⏮ ▶ ⏹ ⏪ ⏭ ⏏ a
   phone drew as an orange colour-emoji depended on its font fallback (Xiaomi: pause,
   stop, rewind; desktop Linux: prev, stop, next), which read as state and was not.
   Now colour IS state, the same way the mode buttons (REP/KEY) light up:
     idle  — muted glyph
     lit   — the current function glows in LCD green (playing, stopped)
     warn  — amber: something is not right (reconnecting; rewind with no buffer) */
.wamp-btn svg {
  width:  calc(1.05em);
  height: calc(1.05em);
  fill:   currentColor;
  display: block;
  margin: 0 auto;
}
.wamp-btn { color: var(--w-text-muted); }
/* The six transport ICON keys: the icon is ALWAYS the LED colour — "green inside". Named
   one by one: the speed button ("1×") lives in the same row and is TEXT, which needs
   4.5:1 where an icon needs 3:1 — the contrast test caught it inheriting the ink.
   :where() keeps the specificity at one class, so .lit / .warn still win. */
.wamp-btn:where(#prev-btn, #play-btn, #stop-btn, #rewind-btn, #next-btn, #open-btn) { color: var(--w-led-ink); }
.wamp-btn.lit  { color: var(--w-lcd-text); filter: drop-shadow(0 0 5px var(--w-lcd-text)); }
.wamp-btn.warn { color: var(--w-warn);     filter: drop-shadow(0 0 5px var(--w-warn)); }
#rewind-btn.no-cors { color: var(--w-warn); opacity: 0.8; }

/* Play button — bigger, and the only key that can be green OUTSIDE: a lit ring and a
   halo, `.on`, from the moment play or pause is pressed until Stop. Inside it is like its
   neighbours — the LED colour, always; ▶ / ⏸ says whether it is running. Amber while a
   stream is being recovered.
   How it got here, all tried on the phone: (0.1.9) accent at rest, LED while playing —
   blue in Classic, and it read as press feedback: playing → press → blue ("nothing lit")
   → press → green; (trial) a dim LED on an LCD-coloured face — rejected; (trial) grey at
   rest, lit only while playing — rejected. box-shadow, not filter: a filter on the button
   blurs its face. The icon flips between the play and pause SVGs on data-playing. */
#play-btn {
  flex: 2;
  font-size: calc(1.1rem * var(--fs-controls));
}
#play-btn .ic-pause                 { display: none; }
#play-btn[data-playing="1"] .ic-play  { display: none; }
#play-btn[data-playing="1"] .ic-pause { display: block; }
#play-btn.on {
  border-color: var(--w-led-ink);
  box-shadow: 0 0 10px color-mix(in srgb, var(--w-lcd-text) 60%, transparent), inset 0 0 8px color-mix(in srgb, var(--w-lcd-text) 16%, transparent);
}
#play-btn.warn { color: var(--w-warn); }
#play-btn.on.warn {
  border-color: var(--w-warn);
  box-shadow: 0 0 10px color-mix(in srgb, var(--w-warn) 60%, transparent), inset 0 0 8px color-mix(in srgb, var(--w-warn) 16%, transparent);
}

/* Eject button */
#open-btn { font-size: calc(0.85rem * var(--fs-controls)); }

/* ── Volume / Balance sliders ───────────────────────────────── */

.wamp-sliders-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wamp-slider-lbl {
  font-size: calc(0.65rem * var(--fs-controls));
  font-weight: 700;
  color: var(--w-text-muted);
  letter-spacing: 0.08em;
  white-space: nowrap;
  min-width: 20px;
  text-align: center;
}

.wamp-vol-slider,
.wamp-bal-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--w-btn-lo);
  border: 1px solid var(--w-btn-hi);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.wamp-vol-slider { flex: 3; }
.wamp-bal-slider { flex: 2; }

.wamp-vol-slider::-webkit-slider-thumb,
.wamp-bal-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--w-btn-face);
  border: 1px solid;
  border-color: var(--w-btn-hi) var(--w-btn-lo) var(--w-btn-lo) var(--w-btn-hi);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.wamp-vol-slider::-moz-range-thumb,
.wamp-bal-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--w-btn-hi);
  background: var(--w-btn-face);
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ── Mode buttons row ───────────────────────────────────────── */

.wamp-mode-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
/* When every button is shown (no profile active) the row can exceed the window
   width. Wrapping keeps the mode group reachable: because the modes are a single
   flex child, the whole PL/GS/QZ/AB/BC set drops to a second line as a unit. */


.wamp-mode-btn {
  padding: 4px 10px;
  height: 26px;
  background: var(--w-btn-face);
  border: 1px solid;
  border-color: var(--w-btn-hi) var(--w-btn-lo) var(--w-btn-lo) var(--w-btn-hi);
  border-radius: 2px;
  color: var(--w-text-muted);
  font-size: calc(0.7rem * var(--fs-controls));
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.1s;
  white-space: nowrap;
}
.wamp-mode-btn:active {
  border-color: var(--w-btn-lo) var(--w-btn-hi) var(--w-btn-hi) var(--w-btn-lo);
}
.wamp-mode-btn.active {
  /* Lit-segment look, borrowed from the LCD panel. Was a hardcoded #0a1a2a
     with accent text, which ignored the skin entirely — in the light skin that
     left dark-navy chips whose text could not reach AA. lcd-bg/lcd-text is the
     one pairing every skin already guarantees is readable. */
  color: var(--w-lcd-text);
  text-shadow: 0 0 6px rgba(1,188,226,0.5);
  border-color: var(--w-btn-lo) var(--w-btn-hi) var(--w-btn-hi) var(--w-btn-lo);
  background: var(--w-lcd-bg);
}

/* Locked mode button (plan gate) */
.wamp-mode-btn.mode-locked {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Repeat-one: amber/gold so it reads differently from repeat-all */
#repeat-btn[data-repeat="one"] {
  color: #ffcc00;
  text-shadow: 0 0 6px rgba(255,204,0,0.5);
  background: #1a1400;
}

.wamp-spacer { flex: 1; }

/* Mode switcher group — segmented set of true modes (PL/GS/QZ/AB/BC),
   separated from the audio-tool toggles (EQ/NRM/XFD/BPM/ADJ) to its left
   by a divider so the two kinds of button no longer read as one row. */
.wamp-mode-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-left: 8px;
  margin-left: 4px;
  border-left: 1px solid var(--w-btn-lo);
}
/* Collapse the group (and its divider) when a profile hides every mode button. */
.wamp-mode-group:not(:has(.wamp-mode-btn:not(.profile-hidden))) {
  display: none;
}
/* Tab buttons read as a "selected one of a set": the active mode gets an
   underline accent bar that tool toggles never get. */
.wamp-tab-btn.active {
  box-shadow: inset 0 -2px 0 var(--w-accent);
}

/* ── Playlist window ────────────────────────────────────────── */

.wamp-playlist-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--w-pl-bg);
  border: 1px solid var(--w-border-hi);
  border-top: 0;
  min-height: 0;
}

/* Playlist titlebar */
.wamp-pl-titlebar {
  background: var(--w-surface);
  padding: 4px 6px 4px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  border-bottom: 1px solid var(--w-border-lo);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04),
              0 1px 0 var(--w-border-hi);
}

.wamp-pl-title {
  font-family: 'Courier New', Courier, monospace;
  font-size: calc(0.65rem * var(--fs-playlist));
  font-weight: 700;
  color: var(--w-accent);
  text-shadow: 0 0 8px color-mix(in srgb, var(--w-accent) 45%, transparent);   /* the skin's own glow */
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* Mode icon in a mode-window titlebar — sits just left of the title text. */
.wamp-mode-icon {
  /* A drawn note in the title's accent (it was a 🎵 emoji): same size the glyph had. */
  width: calc(0.95rem * var(--fs-playlist));
  height: calc(0.95rem * var(--fs-playlist));
  margin-right: 6px;
  flex-shrink: 0;
  color: var(--w-accent);
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--w-accent) 45%, transparent));
}
/* Header keys and the share banner drawn from Profiles' icon table ([data-icon]). */
#share-btn svg, #aod-btn svg { width: 15px; height: 15px; }
#share-banner-icon { display: flex; color: var(--w-accent); flex-shrink: 0; }
#share-banner-icon svg { width: 22px; height: 22px; }
/* Keep icon + title hugged left; any title-bar buttons get pushed to the right.
   Scoped to mode windows so the EQ/NRM/XFD (.wamp-norm-window) titlebars are
   untouched. */
/* The title opens the playlist menu; + and the view keys sit right. */
.pl-title-wrap { position: relative; min-width: 0; margin-right: auto; display: flex; }
.pl-switch {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 2px 6px 2px 0;
  background: none;
  border: 0;
  border-radius: 3px;
  color: inherit;
  cursor: pointer;
}
.pl-switch:hover, .pl-switch:focus-visible { background: var(--w-surface2); }
.pl-switch .wamp-pl-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-switch-caret { width: 12px; height: 12px; margin-left: 4px; flex-shrink: 0; color: var(--w-text-muted); }

.pl-add-wrap { position: relative; margin-right: 6px; }
/* A compact key beside # and × — a step larger, being the bar's main action. */
.pl-add-btn {
  display: flex; align-items: center; justify-content: center;
  height: 22px; min-width: 26px; padding: 0 4px;
  color: var(--w-led-ink);
}
.pl-add-btn svg { width: 15px; height: 15px; stroke-width: 2.6; }
.pl-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 230px;
  padding: 4px;
  background: var(--w-surface);
  border: 1px solid var(--w-border-hi);
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.pl-menu button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 12px;
  background: none;
  border: 0;
  border-radius: 4px;
  color: var(--w-text);
  font-size: calc(0.8rem * var(--fs-playlist));
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.pl-menu button:hover, .pl-menu button:focus-visible { background: var(--w-surface2); }
.pl-menu [data-icon] { display: flex; color: var(--w-led-ink); }
.pl-menu svg { width: 18px; height: 18px; }
.pl-menu small { display: block; margin-top: 1px; font-size: 0.85em; font-weight: 400; color: var(--w-text-muted); }

/* The title's menu opens under the title, from the left. */
.pl-title-menu { left: 0; right: auto; min-width: 240px; max-width: calc(100vw - 32px); }
.pl-menu .pl-menu-danger [data-icon] { color: var(--w-error); }
.pl-menu-sep { height: 1px; margin: 4px 8px; background: var(--w-border-lo); }
.pl-menu-list { font-weight: 500 !important; }
.pl-menu-list svg { width: 16px; height: 16px; color: var(--w-text-muted); }
.pl-menu-list.active { box-shadow: inset 3px 0 0 var(--w-lcd-text); background: color-mix(in srgb, var(--w-lcd-text) 8%, transparent); }
.pl-menu-list.active svg { color: var(--w-led-ink); }
/* • after the title while the screen differs from the loaded saved list. */
.pl-dirty { margin-left: 4px; color: var(--w-warn); font-weight: 700; }

/* Empty playlist: the ways to fill it, as tiles where the songs will be. */
.pl-empty-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 96px));
  justify-content: center;
  gap: 8px;
}
.pl-empty-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 6px;
  background: var(--w-surface);
  border: 1px dashed var(--w-border-hi);
  border-radius: 8px;
  color: var(--w-text);
  font-size: calc(0.7rem * var(--fs-playlist));
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}
.pl-empty-tile:hover, .pl-empty-tile:focus-visible { background: var(--w-surface2); }
.pl-empty-tile [data-icon] { display: flex; color: var(--w-led-ink); }
.pl-empty-tile svg { width: 26px; height: 26px; }

/* Light up the active mode window's titlebar so the current mode reads as the
   live context. Only one .wamp-playlist-window is ever un-hidden, so this
   tracks the active mode with no JS. The 3px accent bar replaces 3px of the
   existing 10px left padding to keep the title text aligned. */
.wamp-playlist-window:not(.hidden) > .wamp-pl-titlebar {
  border-left: 3px solid var(--w-accent);
  padding-left: 7px;
}

.wamp-pl-view-btns {
  display: flex;
  gap: 3px;
}

.wamp-pl-view-btns .wamp-mode-btn {
  font-size: calc(0.75rem * var(--fs-playlist));
  padding: 0 5px;
  height: 18px;
  min-width: 18px;
}

/* Playlist container display toggles */
.pl-hide-nums .pl-num { display: none; }
.pl-hide-del  .pl-del { display: none; }

/* Playlist controls */



/* The playlist window's keys (0.1.38): a drawn LED icon (Profiles' table, [data-icon]) with
   an uppercase label, or the icon alone. Sizes in em of the playlist font, so a pinch zoom
   grows icon and key together (the button's height is a floor, never a box). */
.pl-tool {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8em;
  min-height: 30px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.pl-tool [data-icon] { display: flex; }
/* Capitals have no descenders: in a normal line box they ride above the icon's middle. */
.pl-tool > span[data-i18n] { line-height: 1; padding-top: 0.12em; }
.pl-tool svg {
  width: 1.55em;
  height: 1.55em;
  color: var(--w-led-ink);
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--w-led-ink) 50%, transparent));
}
.pl-tool--icon svg { width: 1.75em; height: 1.75em; }
.pl-tool.wamp-pl-btn--danger svg { color: var(--w-error); filter: none; }

.wamp-pl-btn {
  padding: 3px 8px;
  /* A floor, not a height: the label scales with the playlist's pinch zoom
     (--fs-playlist), and at a fixed 22 px a zoomed "▶ Play" grew out of its own
     button — border and face cut through the text (radio dialog, phone, 0.1.36). */
  min-height: 22px;
  line-height: 1.2;
  background: var(--w-btn-face);
  border: 1px solid;
  border-color: var(--w-btn-hi) var(--w-btn-lo) var(--w-btn-lo) var(--w-btn-hi);
  border-radius: 2px;
  color: var(--w-text-muted);
  font-size: calc(0.65rem * var(--fs-playlist));
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.1s, background 0.1s;
}
.wamp-pl-btn:hover       { color: var(--w-text); background: var(--w-surface2); }
.wamp-pl-btn.active      { background: var(--w-surface2); color: var(--w-accent); border-color: var(--w-accent); }
.wamp-pl-btn:active {
  border-color: var(--w-btn-lo) var(--w-btn-hi) var(--w-btn-hi) var(--w-btn-lo);
}
.wamp-pl-btn--danger:hover { color: var(--w-error); }

/* Playlist items container */
#playlist-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding-bottom: calc(4px + var(--safe-bottom));
}

#playlist-container::-webkit-scrollbar { width: 6px; }
#playlist-container::-webkit-scrollbar-track { background: var(--w-pl-bg); }
#playlist-container::-webkit-scrollbar-thumb { background: var(--w-surface2); border-radius: 3px; }

/* Empty state */
#pl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  color: var(--w-text-dim);
  text-align: center;
  font-size: calc(0.82rem * var(--fs-playlist));
  line-height: 1.7;
  min-height: 120px;
}
#pl-empty.hidden { display: none !important; }

/* Playlist item */
.pl-item {
  display: flex;
  align-items: center;
  padding: 6px 8px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  transition: background 0.08s;
  gap: 6px;
}
.pl-item:hover  { background: var(--w-pl-hover); }
/* The current row is an LED, like the transport keys: a faint tint of the LCD colour,
   a lit edge, and the row number rendered as a tiny LCD segment (lcd-bg/lcd-text is the
   one pairing every skin guarantees readable — the number is text). The old filled
   navy row (--w-pl-active) survives for chips, where "selected" is a different idea. */
.pl-item.active {
  background: color-mix(in srgb, var(--w-lcd-text) 7%, transparent);
  box-shadow: inset 3px 0 0 var(--w-lcd-text), inset 6px 0 8px -4px color-mix(in srgb, var(--w-lcd-text) 55%, transparent);
}
.pl-item.dragging  { opacity: 0.5; }
.pl-item.drag-over { background: rgba(1,188,226,0.15); }

.pl-num {
  font-family: 'Courier New', Courier, monospace;
  font-size: calc(0.7rem * var(--fs-playlist));
  color: var(--w-text-dim);
  min-width: 22px;
  text-align: right;
  flex-shrink: 0;
}
.pl-item.active .pl-num {
  background: var(--w-lcd-bg);
  color: var(--w-lcd-text);
  text-shadow: 0 0 6px var(--w-lcd-text);
  border-radius: 3px;
  padding: 1px 4px;
  min-width: 26px;
  text-align: center;
}

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

.pl-title {
  font-size: calc(0.82rem * var(--fs-playlist));
  color: var(--w-pl-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.pl-item.active .pl-title { color: var(--w-text); font-weight: 700; }

.pl-sub {
  font-size: calc(0.7rem * var(--fs-playlist));
  color: var(--w-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pl-item.active .pl-sub { color: var(--w-text-muted); }

.pl-dur {
  font-family: 'Courier New', Courier, monospace;
  font-size: calc(0.72rem * var(--fs-playlist));
  color: var(--w-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.pl-item.active .pl-dur { color: var(--w-text-muted); }

.pl-bpm {
  display: none; /* hidden until body.bpm-visible */
  font-family: 'Courier New', Courier, monospace;
  font-size: calc(0.62rem * var(--fs-playlist));
  color: var(--w-accent);
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 0.8;
}
body.bpm-visible:not(.profile-no-bpm) .pl-bpm:not(.hidden) { display: inline-block; }

.pl-key {
  display: none; /* hidden until body.key-visible */
  font-family: 'Courier New', Courier, monospace;
  font-size: calc(0.62rem * var(--fs-playlist));
  color: #ffcc00; /* gold — distinct from the cyan BPM badge */
  white-space: nowrap;
  flex-shrink: 0;
  opacity: 0.85;
  font-weight: 700;
}
body.key-visible:not(.profile-no-key) .pl-key:not(.hidden) { display: inline-block; }

.aod-bpm {
  display: none; /* hidden until body.bpm-visible */
  font-size: calc(0.75rem * var(--aod-fs, 1));
  color: var(--aod-dim);
  letter-spacing: 0.08em;
  min-height: 1em;
}
body.bpm-visible:not(.profile-no-bpm) #aod-bpm:not(:empty) { display: block; }

.pl-del {
  background: none;
  border: none;
  color: var(--w-text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 3px;
  flex-shrink: 0;
  transition: color 0.15s, transform 0.15s;
}
.pl-del:hover       { color: var(--w-error); }
.pl-del.armed       { color: var(--w-error); transform: scale(1.9); }

.pl-item--offline {
  border-left: 2px solid rgba(0, 255, 65, 0.35);
}
.pl-item--offline.active {
  border-left-color: rgba(0, 255, 65, 0.7);
}

.pl-dl {
  background: none;
  border: none;
  color: var(--w-text-muted);
  line-height: 1;
  cursor: pointer;
  padding: 0 3px;
  flex-shrink: 0;
  font-size: 0.65rem;
  font-family: 'Courier New', Courier, monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  transition: color 0.15s;
}
.pl-dl:hover         { color: var(--w-accent); }
.pl-dl.cached        { color: var(--w-lcd-text); flex-direction: column; gap: 1px; min-width: 24px; }
.pl-dl.cached:hover  { color: var(--w-error); }

.pl-dl-size {
  font-size: 0.55rem;
  line-height: 1;
  letter-spacing: -0.02em;
  color: inherit;
  opacity: 0.8;
}
.pl-dl.downloading   { color: var(--w-text-muted); cursor: default; pointer-events: none; }
.pl-dl.error         { color: var(--w-error); }
.pl-dl:disabled      { pointer-events: none; }

/* ── Offline settings overlay ───────────────────────────────── */

.offline-settings-sheet {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.offline-storage-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.offline-storage-bar {
  flex: 1;
  height: 5px;
  background: var(--w-surface);
  border-radius: 3px;
  overflow: hidden;
}

.offline-storage-fill {
  height: 100%;
  background: var(--w-lcd-text);
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s;
}

.offline-storage-label {
  font-size: 0.72rem;
  color: var(--w-text-muted);
  white-space: nowrap;
}

.offline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.offline-row-label {
  font-size: 0.82rem;
  color: var(--w-text-muted);
}

.offline-ttl-select {
  background: var(--w-btn-face);
  color: var(--w-text);
  border: 1px solid var(--w-border-hi);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
}
.offline-ttl-select:focus { border-color: var(--w-accent); }

.offline-track-list {
  flex: 1;
  overflow-y: auto;
  min-height: 60px;
  max-height: 40vh;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.offline-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  border-radius: 4px;
}
.offline-item:hover { background: var(--w-pl-hover); }

.offline-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.offline-item-title {
  font-size: 0.82rem;
  color: var(--w-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.offline-item-meta {
  font-size: 0.7rem;
  color: var(--w-text-muted);
}

.offline-empty {
  text-align: center;
  color: var(--w-text-muted);
  font-size: 0.82rem;
  padding: 24px 0;
}

.offline-footer {
  display: flex;
  gap: 8px;
}
.offline-footer .btn-secondary { flex: 1; }

/* Filled rather than red-on-surface: --w-error (#ff4444) is a single global
   constant used as text, and no one red clears 4.5:1 on both a dark (#2d2d2d)
   and a light (#f1f5f9) surface. Owning its background makes it theme-proof
   (white on #b3261e = 6.5:1) and keeps the destructive-action cue. */
.offline-danger              { color: #fff !important; background: #b3261e !important; border-color: #b3261e !important; }
.offline-danger:hover        { background: #a52019 !important; }

/* ── Toast ──────────────────────────────────────────────────── */

#toast {
  --toast-gap: 16px;
  position: fixed;
  bottom: calc(var(--toast-gap) + var(--safe-bottom));
  left: 50%;
  /* Hidden = slid fully below the viewport. A fixed 60px was enough when the viewport
     ended above the navigation bar; edge-to-edge put the bar INSIDE the viewport, the
     resting position gained --safe-bottom, and the same 60px left an empty 22px box
     sitting under the home button, permanently. Slide by the toast's own height plus
     everything below its resting position, whatever the inset. */
  transform: translateX(-50%) translateY(calc(100% + var(--toast-gap) + var(--safe-bottom)));
  background: var(--w-surface2);
  color: var(--w-text);
  border: 1px solid var(--w-border-hi);
  padding: 10px 18px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 500;
  max-width: calc(100vw - 32px);
  text-align: center;
  z-index: 200;
  /* …and painted not at all once it has gone: its 20px shadow still bled up over the
     bottom edge of the glass. visibility flips after the slide-out, at once on show. */
  visibility: hidden;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0s 0.25s;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  pointer-events: none;
  white-space: nowrap;
}
#toast.show      { transform: translateX(-50%) translateY(0); visibility: visible; transition-delay: 0s; }
#toast.error     { background: #4a0000; color: var(--w-error); border-color: var(--w-error); }
#toast.success   { background: #003300; color: var(--w-lcd-text); border-color: var(--w-lcd-text); }
#toast.has-action { pointer-events: auto; display: flex; align-items: center; gap: 12px; white-space: normal; }
.toast-action {
  background: none;
  border: 1px solid currentColor;
  border-radius: 3px;
  color: var(--color-accent, #1db954);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  flex-shrink: 0;
  white-space: nowrap;
}
.toast-action:hover { background: rgba(255,255,255,0.08); }

/* ── Banners ────────────────────────────────────────────────── */

.update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: var(--w-accent-dark);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  flex-shrink: 0;
}
.update-banner.hidden { display: none; }

.update-reload-btn {
  padding: 4px 12px;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.5);
  border-radius: var(--radius);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.update-reload-btn:hover { background: rgba(255,255,255,0.35); }

.offline-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 14px;
  background: #333;
  color: #bbb;
  font-size: 0.8rem;
  font-weight: 500;
  flex-shrink: 0;
}
.offline-banner.hidden { display: none; }

#install-banner {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--w-surface2);
  border-bottom: 1px solid var(--w-accent-dark);
  font-size: 0.82rem;
  color: var(--w-accent);
  flex-shrink: 0;
}
#install-banner.visible { display: flex; }
.install-actions { display: flex; gap: 6px; align-items: center; }
.install-btn {
  padding: 5px 12px;
  background: var(--w-accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
.install-dismiss {
  background: none;
  border: none;
  color: var(--w-text-muted);
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  padding: 2px 4px;
}

/* iOS install hint */
.ios-install-banner {
  position: fixed;
  bottom: calc(var(--safe-bottom) + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 420px;
  z-index: 50;
  background: var(--w-surface2);
  border: 1px solid var(--w-border-hi);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ios-install-banner.hidden { display: none; }
.ios-install-icon { width: 36px; height: 36px; border-radius: 8px; overflow: hidden; flex-shrink: 0; }
.ios-install-text { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 0.8rem; }
.ios-install-text strong { font-weight: 700; color: var(--w-text); }
.ios-install-text span   { color: var(--w-text-muted); }
.ios-install-dismiss {
  background: none; border: none; color: var(--w-text-muted);
  font-size: 1.2rem; cursor: pointer; padding: 3px; flex-shrink: 0; align-self: flex-start;
}

/* ── Overlays (Drive, URL, About, Lock) ─────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: flex-end;
  animation: fadeIn 0.15s ease both;
}
.overlay.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.overlay-sheet {
  width: 100%;
  max-height: 85vh;
  background: var(--w-surface2);
  border: 1px solid var(--w-border-hi);
  border-radius: 8px 8px 0 0;
  padding: 12px 20px calc(20px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slideUp 0.22s cubic-bezier(0.32,1,0.28,1) both;
  overflow: hidden;
}
.overlay-sheet.settings-sheet {
  overflow-y: auto;
}

@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.sheet-handle {
  width: 32px;
  height: 3px;
  background: var(--w-border-hi);
  border-radius: 2px;
  margin: 0 auto 8px;
}

.sheet-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--w-text);
  letter-spacing: 0.05em;
}

/* Drive browser inner */
.drive-browser-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
}
.drive-browser-inner.hidden { display: none !important; }

/* Drive browser */
#drive-auth-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 24px 0;
  text-align: center;
  color: var(--w-text-muted);
  font-size: 0.88rem;
}

.drive-search-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.drive-search-input {
  flex: 1;
  padding: 8px 12px;
  background: var(--w-pl-bg);
  border: 1px solid var(--w-border-hi);
  border-radius: var(--radius);
  color: var(--w-text);
  font-size: 0.88rem;
  outline: none;
}
.drive-search-input:focus { border-color: var(--w-accent); }

.drive-select-all-btn {
  padding: 0 10px;
  height: 36px;
  background: var(--w-btn-face);
  border: 1px solid;
  border-color: var(--w-btn-hi) var(--w-btn-lo) var(--w-btn-lo) var(--w-btn-hi);
  border-radius: 2px;
  color: var(--w-text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.1s, background 0.1s;
  flex-shrink: 0;
}
.drive-select-all-btn:hover  { color: var(--w-text); background: var(--w-surface2); }
.drive-select-all-btn:active {
  border-color: var(--w-btn-lo) var(--w-btn-hi) var(--w-btn-hi) var(--w-btn-lo);
}
.drive-select-all-btn.all-selected { color: var(--w-accent); }

#drive-file-list {
  flex: 1;
  overflow-y: auto;
  min-height: 120px;
  max-height: 40vh;
  border: 1px solid var(--w-border-lo);
  background: var(--w-pl-bg);
  border-radius: var(--radius);
}
#drive-file-list::-webkit-scrollbar { width: 5px; }
#drive-file-list::-webkit-scrollbar-track { background: var(--w-pl-bg); }
#drive-file-list::-webkit-scrollbar-thumb { background: var(--w-surface2); }

.drive-item {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  gap: 10px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  transition: background 0.08s;
}
.drive-item:hover    { background: var(--w-pl-hover); }
.drive-item.selected { background: rgba(1,188,226,0.12); }

.drive-check { font-size: 1rem; color: var(--w-text-muted); flex-shrink: 0; }
.drive-item.selected .drive-check { color: var(--w-accent); }

.drive-item-info { flex: 1; display: flex; flex-direction: column; min-width: 0; gap: 2px; }
.drive-item-name { font-size: 0.82rem; color: var(--w-pl-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drive-item-size { font-size: 0.7rem; color: var(--w-text-dim); }

.drive-loading, .drive-empty, .drive-error {
  padding: 24px;
  text-align: center;
  font-size: 0.82rem;
  color: var(--w-text-muted);
}
.drive-error { color: var(--w-error); }

.drive-load-more-btn {
  width: 100%;
  padding: 8px;
  background: none;
  border: none;
  color: var(--w-accent);
  font-size: 0.8rem;
  cursor: pointer;
  border-top: 1px solid var(--w-border-lo);
}

.drive-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* URL overlay */
.url-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--w-pl-bg);
  border: 1px solid var(--w-border-hi);
  border-radius: var(--radius);
  color: var(--w-text);
  font-size: 0.88rem;
  outline: none;
}
.url-input:focus { border-color: var(--w-accent); }

.url-hint { margin: 0 0 10px; font-size: 12px; line-height: 1.4; color: var(--w-text-muted); }
.url-actions { display: flex; gap: 8px; }

/* Shared buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--w-accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s, transform 0.1s;
  letter-spacing: 0.04em;
}
.btn-primary:hover  { background: #02d4fc; }
.btn-primary:active { transform: scale(0.97); }
.btn-muted { opacity: 0.3; cursor: default; pointer-events: none; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 20px;
  background: transparent;
  color: var(--w-accent);
  border: 1px solid var(--w-accent);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, transform 0.1s;
}
.btn-secondary:hover  { background: rgba(1,188,226,0.1); }
.btn-secondary:active { transform: scale(0.97); }
.btn-secondary:disabled { opacity: 0.4; cursor: default; pointer-events: none; }
.btn-danger {
  background: #c0392b !important;
  color: #fff !important;
  border-color: #c0392b !important;
}
.btn-danger:hover { background: #e74c3c !important; }

/* ── About sheet ────────────────────────────────────────────── */

.about-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: flex-end;
  animation: fadeIn 0.15s ease both;
}
.about-overlay.hidden { display: none; }

.about-sheet {
  width: 100%;
  background: var(--w-surface2);
  border: 1px solid var(--w-border-hi);
  border-radius: 8px 8px 0 0;
  padding: 12px 24px calc(28px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.22s cubic-bezier(0.32,1,0.28,1) both;
}

.about-icon { width: 64px; height: 64px; border-radius: 14px; overflow: hidden; box-shadow: 0 4px 20px rgba(0,0,0,0.5); }
.about-icon img { width: 100%; height: 100%; display: block; }
.about-app-name { font-size: 1.2rem; font-weight: 700; letter-spacing: 0.05em; color: var(--w-accent); }
.about-version-line { font-size: 0.78rem; color: var(--w-text-muted); margin-top: -4px; }
.about-desc { font-size: 0.85rem; color: var(--w-text-muted); text-align: center; line-height: 1.6; max-width: 300px; }
.about-divider { width: 36px; height: 1px; background: var(--w-border-hi); margin: 4px 0; }
.about-privacy { font-size: 0.78rem; color: var(--w-text-dim); text-align: center; line-height: 1.5; max-width: 300px; }
.about-links { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 4px 0; }
.about-link { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--w-accent); text-decoration: none; font-weight: 500; }
.about-link:hover { text-decoration: underline; }
.about-copyright { font-size: 0.72rem; color: var(--w-text-dim); }
.about-close { width: 100%; margin-top: 6px; }

/* Lock settings sheet */
.lock-settings-sheet { text-align: left; }
.lock-settings-row { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 4px 0; font-size: 0.9rem; color: var(--w-text); }
.lock-options { display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 4px; }
.lock-settings-btn { width: 100%; }
.lock-timeout-select {
  background: var(--w-surface);
  color: var(--w-text);
  border: 1px solid var(--w-border-hi);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

/* ── Lock screen ────────────────────────────────────────────── */

.lock-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--w-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lock-sheet {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 32px 24px 40px;
  width: 100%;
  max-width: 340px;
}

.lock-icon { font-size: 2.2rem; line-height: 1; }
.lock-title { font-size: 1rem; font-weight: 600; color: var(--w-text); text-align: center; }

.lock-dots { display: flex; gap: 16px; justify-content: center; }
.lock-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--w-text-muted); background: transparent;
  transition: background 0.12s, border-color 0.12s;
}
.lock-dot.filled { background: var(--w-accent); border-color: var(--w-accent); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-6px); }
  80%       { transform: translateX(6px); }
}
.lock-dots.shake { animation: shake 0.45s ease; }

.lock-error { font-size: 0.82rem; color: var(--w-error); text-align: center; min-height: 1.2em; }

.lock-keypad { display: grid; grid-template-columns: repeat(3, 68px); gap: 10px; }
.lock-key {
  width: 68px; height: 68px; border-radius: 50%; border: none;
  background: var(--w-surface2);
  border: 1px solid var(--w-border-hi);
  font-size: 1.3rem; font-weight: 500; color: var(--w-text); cursor: pointer;
  transition: background 0.1s, transform 0.08s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.lock-key:active  { background: rgba(1,188,226,0.15); transform: scale(0.93); }
.lock-key:disabled { opacity: 0.3; cursor: default; }

.lock-bio-btn { margin-top: 4px; }
.lock-text-btn { background: none; border: none; color: var(--w-accent); font-size: 0.85rem; cursor: pointer; padding: 4px 8px; }
.lock-text-btn:hover { text-decoration: underline; }

/* ── Footer ─────────────────────────────────────────────────── */

.app-copyright {
  text-align: center;
  padding: 6px 16px calc(6px + var(--safe-bottom));
  font-size: 0.7rem;
  color: var(--w-text-muted);
  flex-shrink: 0;
  border-top: 1px solid var(--w-border-lo);
  background: var(--w-surface);
}
.app-copyright a { color: var(--w-text-muted); text-decoration: none; }
.app-copyright a:hover { color: var(--w-text); text-decoration: underline; }

/* ── Desktop centering ──────────────────────────────────────── */

@media (min-width: 560px) {
  html {
    display: flex;
    justify-content: center;
    background: #0d0d0d;
    align-items: stretch;
  }

  body {
    max-width: 480px;
    width: 100%;
    box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 20px 64px rgba(0,0,0,0.6);
  }

  .about-overlay { justify-content: center; }
  .about-sheet   { width: 480px; border-radius: 0; }
  .overlay       { justify-content: center; }
  .overlay-sheet { width: 480px; border-radius: 8px 8px 0 0; }
}

/* ── The player as a window, in a desktop tab ─────────────────
   html.desktop-tab is set by app.js (fine pointer, not installed, not the popped-out
   window). Where the tab is tall enough, the deck is drawn at the size of the window
   ⧉ opens — 480×700 — instead of a full-height column. The transform makes <body> the
   containing block for every position:fixed sheet and overlay, so they open inside
   the window and not across the page. */
@media (min-width: 560px) {
  html.desktop-tab { align-items: center; }
  html.desktop-tab body {
    /* 700 where it fits; a shorter tab gets the tallest deck that leaves 16 px round it */
    height: min(700px, calc(100vh - 32px));
    border-radius: 10px;
    overflow: hidden;
    transform: translateZ(0);
    box-shadow: 0 0 0 1px var(--w-border-hi), 0 24px 80px rgba(0,0,0,0.7);
  }
  html.desktop-tab .overlay-sheet { border-radius: 8px 8px 0 0; }
}

/* A window that is the deck — the installed app, or the window ⧉ opened: the same
   rounded deck as the tab, with a thin margin of the page's dark round it. The OS draws
   the window's own corners; these are the deck's. app.js sizes the window to include the
   margin (WIN_PAD), so the deck itself stays 480×700. */
html.deck-window {
  padding: 8px;
  box-sizing: border-box;
  background: #0d0d0d;
}
html.deck-window body {
  border-radius: 10px;
  overflow: hidden;
  transform: translateZ(0);
  box-shadow: 0 0 0 1px var(--w-border-hi);
}

/* While the window is open, the tab only says so. */
#popped-out {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  text-align: center;
  background: var(--w-lcd-bg);
  color: var(--w-lcd-text);
  font-family: 'Courier New', Courier, monospace;
}
#popped-out.hidden { display: none; }
html.popped-out #player-screen { display: none; }

/* ── Playlist manager ──────────────────────────────────────────── */
#pl-manager-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 55vh;
  overflow-y: auto;
  padding: 4px 0 8px;
}

.pl-manager-empty {
  text-align: center;
  color: var(--w-text-muted);
  font-size: 0.9rem;
  padding: 24px 0;
}

.pl-manager-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--w-surface);
  border-radius: 6px;
  border: 1px solid var(--w-border-lo);
  transition: background 0.15s;
}

.pl-manager-item:hover {
  background: var(--w-surface2);
}

.pl-manager-name-wrap {   /* was .pl-manager-info, a class nothing used: the keys sat against the name */
  flex: 1;
  min-width: 0;
}

.pl-manager-name {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--w-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.pl-manager-name:hover {
  color: var(--w-accent);
  text-decoration: underline;
}

.pl-manager-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--w-text-muted);
  margin-top: 2px;
}

.pl-manager-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.pl-manager-actions button {
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 4px;
  border: 1px solid var(--w-border-lo);
  background: var(--w-btn-face);
  color: var(--w-text);
  cursor: pointer;
  transition: background 0.15s;
}

.pl-manager-actions button:hover {
  background: var(--w-surface2);
}

/* Icon keys in a manager row: the playlist window's .pl-tool keys, not the text-button
   look above. The tokens in these rules were six that never existed (--w-txt, --w-bg-track
   …) until 0.1.38 — the manager drew with browser defaults in every skin. */
.pl-manager-actions .pl-tool--icon { padding: 3px 0; min-width: 36px; }

.pl-manager-rename-input {
  width: 100%;
  font-size: 0.9rem;
  font-weight: 600;
  background: var(--w-btn-face);
  color: var(--w-text);
  border: 1px solid var(--w-accent);
  border-radius: 4px;
  padding: 2px 6px;
  outline: none;
}

.pl-manager-footer {
  padding-top: 8px;
  display: flex;
  justify-content: flex-end;
}

/* ── Normalizer inline window ───────────────────────────────── */

.wamp-norm-window {
  display: flex;
  flex-direction: column;
  background: var(--w-pl-bg);
  border: 1px solid var(--w-border-hi);
  border-top: 0;
  flex-shrink: 0;
}
.wamp-norm-window.hidden { display: none; }

.wamp-norm-body {
  padding: 8px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.norm-mode-row {
  display: grid;
  /* One column per button, however many there are — a fixed repeat(4) orphaned the
     fifth mode (VOICE) on a row of its own. */
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 6px;
}

.norm-mode-btn {
  padding: 6px 4px;
  background: var(--w-btn-face);
  border: 1px solid;
  border-color: var(--w-btn-hi) var(--w-btn-lo) var(--w-btn-lo) var(--w-btn-hi);
  border-radius: 2px;
  color: var(--w-text-muted);
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.1s;
}
.norm-mode-btn:hover { color: var(--w-text); background: var(--w-surface2); }
.norm-mode-btn:disabled { opacity: 0.3; cursor: not-allowed; pointer-events: none; }
.norm-mode-btn.active {
  color: var(--w-accent);
  text-shadow: 0 0 6px rgba(1,188,226,0.5);
  border-color: var(--w-btn-lo) var(--w-btn-hi) var(--w-btn-hi) var(--w-btn-lo);
  background: #0a1a2a;
}

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

.norm-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.norm-lbl {
  font-size: 0.8rem;
  color: var(--w-text-muted);
}

.norm-val {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.78rem;
  color: var(--w-accent);
}

.norm-slider {
  width: 100%;
  accent-color: var(--w-accent);
  cursor: pointer;
}

/* norm-status-val lives in the titlebar now */
.norm-status-val {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.72rem;
  color: var(--w-lcd-text);
  margin-left: auto;
  opacity: 0.9;
}

/* keep .norm-status-lbl for legacy — unused but harmless */
.norm-status-lbl {
  font-size: 0.75rem;
  color: var(--w-text-dim);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.norm-status-val {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.82rem;
  color: var(--w-lcd-text);
}

/* ── Norm live indicator (LCD status line) ───────────────────── */

.norm-live {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.65rem;
  color: var(--w-accent);
  opacity: 0.85;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  margin-left: auto;
  padding-right: 6px;
}

/* ── Stream rewind: LIVE badge + back-to-live button ─────────── */

.stream-live-badge {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.65rem;
  font-weight: 700;
  color: #00e55a;
  letter-spacing: 0.1em;
  flex-shrink: 0;
  margin-left: auto;
  padding-right: 4px;
  animation: live-pulse 1.8s ease-in-out infinite;
}
.stream-live-badge.dimmed {
  color: var(--w-text-muted);
  animation: none;
  opacity: 0.5;
}
@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

.back-to-live-btn {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--w-accent);
  background: transparent;
  border: 1px solid var(--w-accent);
  border-radius: 2px;
  cursor: pointer;
  padding: 1px 4px;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  transition: background 0.1s;
}
.back-to-live-btn:hover {
  background: color-mix(in srgb, var(--w-accent) 20%, transparent);
}

.stream-retry-btn {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--w-error, #e05);
  background: transparent;
  border: 1px solid var(--w-error, #e05);
  border-radius: 2px;
  cursor: pointer;
  padding: 1px 4px;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  transition: background 0.1s;
}
.stream-retry-btn:hover {
  background: color-mix(in srgb, var(--w-error, #e05) 20%, transparent);
}

/* ── Heard-on-radio: LCD ♥ save button ──────────────────────── */

.radio-fav-song-btn {
  font-size: 0.85rem;
  line-height: 1;
  color: var(--w-accent);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0 3px;
  flex-shrink: 0;
  transition: transform 0.1s, color 0.1s;
}
.radio-fav-song-btn:hover { transform: scale(1.2); }
.radio-fav-song-btn.saved { color: var(--w-error, #e05); }

/* ── Heard-on-radio: wishlist window ────────────────────────── */

.wishlist-clear-btn {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6rem;
  font-weight: 700;
  /* Filled, not red-on-surface: --w-error is one global constant and no single
     red clears 4.5:1 on both a light and a dark surface. Owning its background
     makes it theme-proof (white on #b3261e = 6.5:1) and keeps the danger cue. */
  color: #fff;
  background: #b3261e;
  border: 1px solid #b3261e;
  border-radius: 2px;
  cursor: pointer;
  padding: 1px 6px;
  letter-spacing: 0.06em;
  margin-left: auto;
}
.wishlist-clear-btn:hover {
  background: #a52019;
}

.wishlist-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 50vh;
  overflow-y: auto;
}
.wishlist-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--w-accent) 12%, transparent);
}
.wishlist-main { flex: 1; min-width: 0; }
.wishlist-title {
  font-size: 0.8rem;
  color: var(--w-text, #ddd);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wishlist-sub {
  font-size: 0.68rem;
  color: var(--w-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wishlist-search,
.wishlist-del {
  flex-shrink: 0;
  font-size: 0.85rem;
  line-height: 1;
  background: transparent;
  border: none;
  cursor: pointer;
  text-decoration: none;
  padding: 2px 4px;
  opacity: 0.8;
}
.wishlist-search:hover,
.wishlist-del:hover { opacity: 1; transform: scale(1.15); }
.wishlist-del { color: var(--w-error, #e05); }

.wishlist-empty {
  font-size: 0.75rem;
  color: color-mix(in srgb, var(--w-text, #ddd) 50%, transparent);
  text-align: center;
  padding: 16px 8px;
}
.wishlist-empty.hidden { display: none; }

/* ── Equalizer window ───────────────────────────────────────── */

.eq-header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.eq-presets-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 8px 2px;
}

.eq-preset-btn {
  flex: 1 1 auto;
  min-width: 0;
  padding: 5px 2px;
  background: var(--w-btn-face);
  border: 1px solid;
  border-color: var(--w-btn-hi) var(--w-btn-lo) var(--w-btn-lo) var(--w-btn-hi);
  border-radius: 2px;
  color: var(--w-text-muted);
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.1s;
  white-space: nowrap;
}
.eq-preset-btn:hover { color: var(--w-text); background: var(--w-surface2); }
/* The chosen preset is an LED, like a lit mode button: the lcd-bg/lcd-text pairing every
   skin guarantees readable. It was accent text on a hardcoded #0a1a2a — barely a change
   in the dark skin, unreadable in the light one. */
.eq-preset-btn.active {
  color: var(--w-lcd-text);
  background: var(--w-lcd-bg);
  text-shadow: 0 0 6px var(--w-lcd-text);
  border-color: color-mix(in srgb, var(--w-lcd-text) 55%, transparent);
  box-shadow: 0 0 6px color-mix(in srgb, var(--w-lcd-text) 40%, transparent);
}

.eq-bands-row {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  padding: 6px 8px 8px;
  gap: 2px;
}

.eq-band {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 1;
  min-width: 0;
}

.eq-band-db {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.6rem;
  color: var(--w-accent);
  line-height: 1;
  min-width: 2.4em;
  text-align: center;
}

.eq-band-slider {
  writing-mode: vertical-lr;
  direction: rtl;
  width: 32px;
  height: 100px;
  cursor: pointer;
  accent-color: var(--w-accent);
  padding: 0;
  flex-shrink: 0;
}

.eq-band-freq {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.58rem;
  color: var(--w-text-muted);
  line-height: 1;
  text-align: center;
}

/* ── Quiz mode (in-layout, replaces playlist window) ────────── */

.quiz-title-label {
  color: var(--w-accent) !important;
  text-shadow: 0 0 6px rgba(1,188,226,0.4);
}

/* ── GS / QZ idle windows ───────────────────────────────────── */

.mode-playlist-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* File input embedded in label — visually hidden but accessible on mobile */
.mode-file-label {
  position: relative;
  cursor: pointer;
}
.mode-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.pl-empty-msg {
  padding: 20px 12px;
  text-align: center;
  color: var(--w-text-muted);
  font-size: 0.75rem;
}

.mode-start-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  border-top: 1px solid var(--w-border-lo);
  flex-shrink: 0;
}

.qz-json-info {
  padding: 3px 8px;
  font-size: 0.75rem;
  color: var(--w-text-lo);
  border-top: 1px solid var(--w-border-lo);
  text-align: center;
  flex-shrink: 0;
}

/* ── Quiz packs ─────────────────────────────────────────────── */
.qz-pack-name-input {
  flex: 2;            /* wider than the two buttons — room to type a pack name */
  min-width: 0;
  box-sizing: border-box;
  height: 22px;       /* match .wamp-pl-btn so the row aligns */
  background: var(--w-pl-bg);
  border: 1px solid var(--w-border-lo);
  border-radius: 2px;
  color: var(--w-text);
  font-size: calc(0.75rem * var(--fs-playlist));
  padding: 0 8px;
}
.qz-pack-name-input::placeholder { color: var(--w-text-lo); }

.qz-pack-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 0 2px;
}
.qz-pack-row {
  display: flex;
  align-items: stretch;
  gap: 3px;
}
.qz-pack-load {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--w-btn-face);
  border: 1px solid;
  border-color: var(--w-btn-hi) var(--w-btn-lo) var(--w-btn-lo) var(--w-btn-hi);
  border-radius: 2px;
  color: var(--w-text);
  font-size: calc(0.75rem * var(--fs-playlist));
  padding: 4px 8px;
  cursor: pointer;
  text-align: left;
}
.qz-pack-load:hover { background: var(--w-surface); }
.qz-pack-name  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qz-pack-count { color: var(--w-accent); flex-shrink: 0; opacity: 0.8; font-size: 0.9em; }
.qz-pack-btn {
  flex-shrink: 0;
  width: 28px;
  background: var(--w-btn-face);
  border: 1px solid;
  border-color: var(--w-btn-hi) var(--w-btn-lo) var(--w-btn-lo) var(--w-btn-hi);
  border-radius: 2px;
  color: var(--w-text-muted);
  cursor: pointer;
  font-size: 0.85rem;
}
.qz-pack-btn:hover { color: var(--w-text); }
.qz-pack-del:hover { color: var(--w-error); }

.mode-start-btn {
  width: 100%;
  justify-content: center;
  font-weight: 600;
  letter-spacing: 0.04em;
  height: 48px;
  font-size: 0.9rem;
}

.mode-start-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.mode-track-count {
  font-size: 0.65rem;
  color: var(--w-text-muted);
  font-family: 'Courier New', Courier, monospace;
  margin-left: 6px;
}

.quiz-progress-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.quiz-progress {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.68rem;
  color: var(--w-text-muted);
}

.quiz-elapsed {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.68rem;
  color: var(--w-lcd-time);
  min-width: 28px;
  text-align: right;
}

.quiz-instr-bar {
  padding: 4px 10px;
  font-size: 0.72rem;
  color: var(--w-text-muted);
  border-bottom: 1px solid var(--w-border-lo);
  flex-shrink: 0;
  background: var(--w-surface);
}

.quiz-question-title {
  padding: 7px 10px 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--w-text);
  border-bottom: 1px solid var(--w-border-lo);
  flex-shrink: 0;
  line-height: 1.35;
}

.quiz-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 10px;
  flex-shrink: 0;
}

.quiz-tag-pill {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--w-surface2, #2d2d2d);
  color: var(--w-text-muted);
  border: 1px solid var(--w-border-lo);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

.quiz-description {
  padding: 6px 10px;
  font-size: 0.71rem;
  color: var(--w-text-muted);
  border-top: 1px solid var(--w-border-lo);
  border-left: 2px solid var(--w-accent, #01bce2);
  background: var(--w-surface2, #2d2d2d);
  flex-shrink: 0;
  line-height: 1.5;
  white-space: pre-wrap;
}

.quiz-manual-cue {
  padding: 5px 10px;
  font-size: 0.71rem;
  color: var(--w-accent, #01bce2);
  text-align: center;
  flex-shrink: 0;
  letter-spacing: 0.04em;
  animation: quiz-cue-blink 1.2s ease-in-out infinite;
}

@keyframes quiz-cue-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.35; }
}

#next-btn.quiz-waiting-next,
#prev-btn.quiz-waiting-next {
  color: var(--w-accent, #01bce2);
}

.quiz-choices {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.quiz-choice-btn {
  width: 100%;
  padding: 7px 10px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--w-border-lo);
  color: var(--w-text);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.08s, color 0.08s;
  white-space: normal;
  word-break: break-word;
  flex-shrink: 0;
}
.quiz-choice-btn:hover:not(:disabled) {
  background: rgba(1,188,226,0.06);
  color: var(--w-accent);
}
.quiz-choice-btn:disabled { cursor: default; }
.quiz-choice-btn.quiz-correct {
  background: rgba(0,255,65,0.08);
  color: var(--w-success);
  border-bottom-color: rgba(0,255,65,0.2);
}
.quiz-choice-btn.quiz-wrong {
  background: rgba(255,68,68,0.08);
  color: var(--w-error);
  border-bottom-color: rgba(255,68,68,0.2);
}
.quiz-choice-btn.quiz-selected {
  background: rgba(1,188,226,0.12);
  color: var(--w-accent);
  border-bottom-color: rgba(1,188,226,0.3);
}
.quiz-choice-btn.quiz-missed {
  background: rgba(0,255,65,0.03);
  color: var(--w-success);
  opacity: 0.45;
  border-bottom-color: rgba(0,255,65,0.1);
}
.quiz-multi-submit {
  width: 100%;
  margin-top: 6px;
  padding: 8px;
  background: var(--w-accent);
  color: var(--w-bg);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
}
.quiz-multi-submit:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ── Quiz speech buttons ────────────────────────────────────── */

#quiz-mic-btn.listening {
  color: var(--w-accent);
  animation: mic-pulse 1s ease-in-out infinite;
}

@keyframes mic-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Quiz results ───────────────────────────────────────────── */

.quiz-result-sheet {
  max-height: 90vh;
}

.quiz-result-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--w-pl-bg);
  border: 1px solid var(--w-border-hi);
  border-radius: 6px;
  padding: 14px 18px;
  flex-shrink: 0;
}

.quiz-result-score-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.quiz-result-score {
  font-size: 2rem;
  font-weight: 800;
  color: var(--w-accent);
  font-family: 'Courier New', Courier, monospace;
  line-height: 1;
}

.quiz-result-pct {
  font-size: 0.85rem;
  color: var(--w-text-muted);
  font-family: 'Courier New', Courier, monospace;
}

.quiz-result-time-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.quiz-result-time-label {
  font-size: 0.72rem;
  color: var(--w-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.quiz-result-total-time {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--w-text);
  font-family: 'Courier New', Courier, monospace;
}

.quiz-result-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

.quiz-result-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 4px;
  border-left: 3px solid transparent;
}
.quiz-result-row.qr-correct {
  background: rgba(0,255,65,0.06);
  border-left-color: var(--w-success);
}
.quiz-result-row.qr-wrong {
  background: rgba(255,68,68,0.06);
  border-left-color: var(--w-error);
}
.quiz-result-row.qr-partial {
  background: rgba(1,188,226,0.06);
  border-left-color: var(--w-accent);
}

.qr-num {
  font-size: 0.72rem;
  color: var(--w-text-muted);
  font-family: 'Courier New', Courier, monospace;
  width: 22px;
  flex-shrink: 0;
}

.qr-icon {
  font-size: 0.9rem;
  width: 16px;
  flex-shrink: 0;
}
.qr-correct .qr-icon { color: var(--w-success); }
.qr-wrong   .qr-icon { color: var(--w-error); }
.qr-partial .qr-icon { color: var(--w-accent); font-size: 0.75em; }

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

.qr-song {
  font-size: 0.85rem;
  color: var(--w-text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qr-guess {
  font-size: 0.72rem;
  color: var(--w-error);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.qr-dur {
  font-size: 0.72rem;
  color: var(--w-text-muted);
  font-family: 'Courier New', Courier, monospace;
  flex-shrink: 0;
}

.quiz-result-footer {
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
  padding-top: 4px;
}

/* ── Radio stations overlay ─────────────────────────────────── */

.radio-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.radio-filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.radio-country-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.radio-chip {
  padding: 3px 10px;
  font-size: 0.72rem;
  background: var(--w-btn-face);
  border: 1px solid var(--w-border-lo);
  border-radius: 12px;
  color: var(--w-text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.radio-chip.chip-active {
  background: var(--w-pl-active);
  border-color: var(--w-pl-active);
  color: var(--w-pl-active-t);
}
.radio-chip--recent.chip-active {
  background: #b45309;
  border-color: #b45309;
}
.radio-chip--fav.chip-active {
  background: #9b1c4a;
  border-color: #9b1c4a;
}
/* 📍 Local: country picker row and the directory credit */
#radio-local-locate {
  height: auto;
  min-height: 28px;   /* .wamp-pl-btn's floor is 22px — under the 24px touch-target floor */
  flex-shrink: 0;
}
#radio-genre-filter:disabled {
  opacity: 0.45;
  cursor: default;
}
.radio-local-credit {
  font-size: 0.68rem;
  padding: 10px 0 2px;
}
.radio-recent-time {
  font-size: 0.62rem;
  color: #b45309;
  flex-shrink: 0;
}

/* Favourite star button in radio rows */
.radio-fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--w-text-muted);
  padding: 2px 4px;
  flex-shrink: 0;
  transition: color 0.15s;
}
.radio-fav-btn:hover { color: #e0487a; }
.radio-fav-btn.is-fav { color: #e0487a; }

/* BPM button pulse when first result arrives */
@keyframes bpmPulse {
  0%, 100% { background: var(--w-btn-face); color: var(--w-btn-text); box-shadow: none; }
  50% { background: var(--w-accent); color: #000; box-shadow: 0 0 8px var(--w-accent); }
}
.bpm-btn-pulse { animation: bpmPulse 0.7s ease 3; }

.radio-station-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 50vh;
}
.radio-station-list::-webkit-scrollbar       { width: 6px; }
.radio-station-list::-webkit-scrollbar-track { background: var(--w-pl-bg); }
.radio-station-list::-webkit-scrollbar-thumb { background: var(--w-surface2); border-radius: 3px; }

/* The station that is playing: the same LED as the current playlist row */
.radio-station-row.is-playing {
  background: color-mix(in srgb, var(--w-lcd-text) 7%, var(--w-surface));
  box-shadow: inset 3px 0 0 var(--w-lcd-text), inset 6px 0 8px -4px color-mix(in srgb, var(--w-lcd-text) 55%, transparent);
}
.radio-station-row.is-playing .radio-station-name { font-weight: 700; }
.radio-station-row.is-playing .wamp-pl-btn { color: var(--w-lcd-text); filter: drop-shadow(0 0 4px var(--w-lcd-text)); }
.radio-station-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: var(--w-surface);
  border: 1px solid var(--w-border-lo);
  border-radius: var(--radius);
}

.radio-station-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 2px;
}

.radio-station-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--w-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.radio-station-meta {
  font-size: 0.68rem;
  color: var(--w-text-muted);
  letter-spacing: 0.03em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.radio-bitrate {
  font-size: 0.62rem;
  font-weight: 600;
  border-radius: 3px;
  padding: 1px 4px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
/* No quality-tier hue. The badge already prints the exact bitrate ("128k"),
   so the amber/green/blue coding was redundant — and it was conveying the tier
   by colour alone (1.4.1), with hardcoded hues that could not clear AA on both
   a light and a dark surface. Neutral, token-driven, readable in every skin. */
.radio-bitrate {
  color: var(--w-text-muted);
  border: 1px solid var(--w-border-hi);
}

/* ── Appearance / Font scale overlay ───────────────────────────── */

.appearance-sheet {
  max-height: 85vh;
  overflow-y: auto;
}

.appearance-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--w-text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 12px 0 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.profile-active-indicator {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--w-text-dim);
  letter-spacing: 0;
  text-transform: none;
}
.profile-active-indicator span { color: var(--w-accent); }

.fs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

.fs-zone-name {
  font-size: 0.85rem;
  color: var(--w-text);
}

.fs-ctrl {
  display: flex;
  align-items: center;
  gap: 12px;
}

.fs-btn {
  width: 32px;
  height: 32px;
  background: var(--w-btn-face);
  border: 1px solid;
  border-color: var(--w-btn-hi) var(--w-btn-lo) var(--w-btn-lo) var(--w-btn-hi);
  border-radius: 2px;
  color: var(--w-text);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.08s;
  flex-shrink: 0;
}
.fs-btn:hover  { background: var(--w-surface2); color: var(--w-accent); }
.fs-btn:active { border-color: var(--w-btn-lo) var(--w-btn-hi) var(--w-btn-hi) var(--w-btn-lo); }
.fs-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.fs-val {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.82rem;
  color: var(--w-accent);
  min-width: 40px;
  text-align: center;
}

.appearance-divider {
  border: none;
  border-top: 1px solid var(--w-border-hi);
  margin: 14px 0 0;
}

.profile-save-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.profile-save-row .url-input { flex: 1; min-width: 0; }
.profile-save-row .btn-primary { white-space: nowrap; flex-shrink: 0; }

.profile-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 16px;
}

.profile-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: var(--w-surface);
  border-radius: var(--radius);
  border: 1px solid transparent;
  gap: 8px;
}
.profile-item.active { border-color: var(--w-accent); }

.profile-item-name {
  font-size: 0.82rem;
  color: var(--w-text);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-item.active .profile-item-name { color: var(--w-accent); font-weight: 600; }

.profile-item-actions { display: flex; gap: 4px; flex-shrink: 0; }

.profile-empty {
  font-size: 0.75rem;
  color: var(--w-text-dim);
  text-align: center;
  padding: 10px 0;
}

.appearance-footer { margin-top: 14px; }
.appearance-footer .btn-secondary { width: 100%; }

/* ── Skins overlay ──────────────────────────────────────────── */

.skins-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 4px 0 12px;
}

.skin-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.skin-preview {
  width: 100%;
  aspect-ratio: 5 / 3;
  border-radius: 6px;
  border: 2px solid var(--w-border-lo);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s;
}

.skin-card.active .skin-preview,
.skin-card:hover  .skin-preview {
  border-color: var(--w-accent);
}

.skin-preview-lcd {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.5rem;
  letter-spacing: 0.05em;
  padding: 4px;
  white-space: nowrap;
  overflow: hidden;
}

.skin-preview-bar {
  height: 18px;
  display: flex;
  align-items: center;
  padding: 0 6px;
  gap: 4px;
  flex-shrink: 0;
}

.skin-preview-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skin-name {
  font-size: 0.7rem;
  color: var(--w-text-muted);
}

.skin-card.active .skin-name {
  color: var(--w-accent);
  font-weight: 600;
}

.skin-badge-dl {
  font-size: 0.55rem;
  color: var(--w-accent);
  opacity: 0.7;
  margin-left: 3px;
  vertical-align: middle;
}

/* ── AB (Audiobook) window ──────────────────────────────────── */

.ab-lang-select {
  flex: 1;
  background: var(--w-surface);
  color: var(--w-text);
  border: 1px solid var(--w-border-lo);
  border-radius: var(--radius, 4px);
  padding: 4px 6px;
  font-size: 0.75rem;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

.ab-lang-select:focus {
  border-color: var(--w-accent);
}

#ab-lang-select::-webkit-scrollbar       { width: 10px; }
#ab-lang-select::-webkit-scrollbar-track { background: var(--w-pl-bg); }
#ab-lang-select::-webkit-scrollbar-thumb { background: var(--w-surface2); border-radius: 5px; min-height: 44px; }

.ab-titlebar-btns {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

/* ── TOC / CFG panels ────────────────────────────────────── */

.ab-cfg-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
}




.ab-toc-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--w-border-lo);
  color: var(--w-pl-text);
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.1s, color 0.1s;
}
.ab-toc-item:hover { background: var(--w-pl-hover); color: var(--w-text); }
.ab-toc-item[data-level="0"] { font-weight: 600; color: var(--w-text); }
.ab-toc-item[data-level="1"] { color: var(--w-text-muted); }
.ab-toc-item[data-level="2"] { color: var(--w-text-dim); font-size: 0.75rem; }

/* ── PDF text ────────────────────────────────────────────── */

.ab-pdf-text {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
}
.ab-lang-suggest {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 10px;
  margin-bottom: 8px;
  background: color-mix(in srgb, var(--w-accent) 12%, var(--w-surface));
  border: 1px solid color-mix(in srgb, var(--w-accent) 35%, transparent);
  border-radius: 4px;
  font-size: 0.78rem;
  color: var(--w-text);
  flex-shrink: 0;
}
.ab-lang-suggest span { flex: 1; }
.ab-lang-suggest-apply { color: var(--w-accent); font-weight: 600; }
.ab-lang-suggest-skip  { opacity: 0.6; }

#ab-pdf-text::-webkit-scrollbar { width: 10px; }
#ab-pdf-text::-webkit-scrollbar-track { background: var(--w-pl-bg); }
#ab-pdf-text::-webkit-scrollbar-thumb { background: var(--w-surface2); border-radius: 5px; min-height: 44px; }

.ab-page-text {
  font-size: calc(0.8rem * var(--fs-ab));
  line-height: 1.55;
  color: var(--w-text);
  margin-bottom: 1rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.ab-page-text + .ab-page-text {
  border-top: 1px solid var(--w-border-lo);
  padding-top: 0.75rem;
}

.ab-toc-header {
  display: flex;
  align-items: center;
  padding: 4px 10px;
  border-bottom: 1px solid var(--w-border-lo);
  gap: 6px;
}

.ab-toc-filename {
  flex: 1;
  font-size: 0.65rem;
  color: var(--w-text-muted);
  font-family: 'Courier New', Courier, monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ab-page-info {
  font-size: 0.65rem;
  color: var(--w-text-muted);
  font-family: 'Courier New', Courier, monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

.ab-loading {
  padding: 12px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--w-text-muted);
  animation: ab-blink 1s step-end infinite;
}

@keyframes ab-blink {
  50% { opacity: 0.3; }
}

/* Audiobook mode — TTS controls in player, PDF reader in window */
body.mode-ab .wamp-controls-area > .wamp-transport,
body.mode-ab .wamp-time-row { display: none; }
/* Hide balance slider in AB mode — irrelevant for TTS */
body.mode-ab .wamp-bal-slider,
body.mode-ab .wamp-slider-lbl:last-of-type { display: none; }

/* TTS transport: only show inside AB mode; always visible there (buttons guard themselves) */
body:not(.mode-ab) #ab-pdf-loaded-controls { display: none !important; }
body.mode-ab #ab-pdf-loaded-controls { display: block !important; }

#ab-no-book-hint { display: none; }


.ab-hint {
  font-size: 0.68rem;
  color: var(--w-text-dim, var(--w-text-muted));
  margin-top: 4px;
}

.ab-sent {
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s;
}

.ab-sent:hover {
  background: var(--w-hover, rgba(255,255,255,0.07));
}

.ab-sent-active {
  background: var(--w-accent, #01bce2);
  color: #000;
  border-radius: 3px;
  padding: 0 1px;
}

/* ── Shortcuts overlay (double-tap) ─────────────────────────── */

.shortcuts-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0,0,0,0.88);
  display: flex;
  justify-content: center;
  overflow-y: auto;            /* taller than the window: scroll, never clip the title or ✕ */
  padding: 16px 0;
  animation: fadeIn 0.12s ease both;
}
.shortcuts-overlay.hidden { display: none; }
.shortcuts-overlay-inner { margin: auto 0; }   /* centred when it fits, top-aligned when it does not */

/* The desktop deck is 480×700 — nine cards in two columns stood ~900 px tall and lost their
   top row and title off the deck. Three columns of tighter cards fit with room to spare. */
html.desktop-tab .shortcuts-overlay-grid,
html.deck-window .shortcuts-overlay-grid { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 10px; }
html.desktop-tab .shortcuts-overlay-card,
html.deck-window .shortcuts-overlay-card { padding: 14px 6px; gap: 8px; }
html.desktop-tab .shortcuts-overlay-card-label,
html.deck-window .shortcuts-overlay-card-label { font-size: 0.78rem; letter-spacing: 0.08em; }
html.desktop-tab .shortcuts-overlay-card-icon svg,
html.deck-window .shortcuts-overlay-card-icon svg { width: 2.1rem; height: 2.1rem; }

.shortcuts-overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: min(92vw, 420px);
}

/* The cards are an LCD panel. Same LED language as the transport row, the playlist row
   and the AOD: lcd-bg / lcd-text — the one pairing every skin guarantees readable — dim at
   rest, LIT on press and while a toggle is ON. They were surface-coloured tiles with
   colour-emoji icons, the accent for "on", and one hardcoded tint (rgba(1,188,226,.12)). */
.shortcuts-overlay-inner {
  --sc-led: var(--w-lcd-text);
  --sc-dim: color-mix(in srgb, var(--sc-led) 78%, transparent);
  font-family: 'Courier New', Courier, monospace;
}
.shortcuts-overlay-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--sc-led);
  text-shadow: 0 0 10px var(--sc-led);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.shortcuts-overlay-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  width: 100%;
}

.shortcuts-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px 12px;
  background: var(--w-lcd-bg);
  border: 1px solid color-mix(in srgb, var(--sc-led) 38%, transparent);
  border-radius: 12px;
  cursor: pointer;
  font-family: inherit;
  color: var(--sc-dim);
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.shortcuts-overlay-card:hover,
.shortcuts-overlay-card:active,
.shortcuts-overlay-card.active {
  color: var(--sc-led);
  border-color: var(--sc-led);
  background: color-mix(in srgb, var(--sc-led) 10%, var(--w-lcd-bg));
  box-shadow: 0 0 12px color-mix(in srgb, var(--sc-led) 35%, transparent), inset 0 0 14px color-mix(in srgb, var(--sc-led) 12%, transparent);
}
.shortcuts-overlay-card:active { transform: scale(0.96); }
.shortcuts-overlay-card:hover  .shortcuts-overlay-card-icon,
.shortcuts-overlay-card:active .shortcuts-overlay-card-icon,
.shortcuts-overlay-card.active .shortcuts-overlay-card-icon { filter: drop-shadow(0 0 6px var(--sc-led)); }

.shortcuts-overlay-card-icon  { font-size: 2.4rem; line-height: 1; display: flex; }
.shortcuts-overlay-card-icon svg { width: 2.6rem; height: 2.6rem; display: block; }
.shortcuts-overlay-card-label {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.shortcuts-overlay-card-state {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.shortcuts-overlay-card.active .shortcuts-overlay-card-label,
.shortcuts-overlay-card.active .shortcuts-overlay-card-state { text-shadow: 0 0 8px var(--sc-led); }

.shortcuts-overlay-close {
  background: var(--w-lcd-bg);
  border: 1px solid color-mix(in srgb, var(--sc-led) 38%, transparent);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  color: var(--sc-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shortcuts-overlay-close svg { width: 18px; height: 18px; display: block; }
.shortcuts-overlay-close:hover, .shortcuts-overlay-close:active { color: var(--sc-led); border-color: var(--sc-led); filter: drop-shadow(0 0 4px var(--sc-led)); }

/* ── Use-case profiles ─────────────────────────────────────── */

/* Hides an element when the active profile excludes it */
.profile-hidden { display: none !important; }

.use-profile-sheet {
  max-height: 90vh;
}

.use-profile-hint {
  font-size: 0.78rem;
  color: var(--w-text-muted);
  margin: 0;
  line-height: 1.4;
}

.use-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  overflow-y: auto;
  padding-right: 2px;
}

.use-profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 14px 10px 12px;
  background: var(--w-surface);
  border: 1px solid var(--w-border-lo);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
  color: var(--w-text);
}

.use-profile-card:hover {
  background: var(--w-surface2);
  border-color: var(--w-border-hi);
}

.use-profile-card.active {
  border-color: var(--w-accent);
  background: rgba(1,188,226,0.08);
}

.use-profile-card-icon {
  font-size: 1.6rem;
  line-height: 1;
}

.use-profile-card-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--w-text);
}

.use-profile-card.active .use-profile-card-label {
  color: var(--w-accent);
}

.use-profile-card-desc {
  font-size: 0.68rem;
  color: var(--w-text-muted);
  line-height: 1.35;
}

.use-profile-card.pro-locked {
  opacity: 0.45;
  cursor: default;
  border-style: dashed;
}
.use-profile-card.pro-locked:hover {
  background: var(--w-surface);
  border-color: var(--w-border-lo);
}
.use-profile-card-pro-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--w-text-muted);
  text-transform: uppercase;
}

.use-profile-footer {
  display: flex;
  gap: 8px;
}

/* ── Destination alarm ─────────────────────────────────────── */

.alarm-sheet { max-height: 90vh; overflow-y: auto; }

.alarm-search-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.alarm-search-input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  background: var(--input-bg, rgba(255,255,255,0.07));
  color: inherit;
  font-size: 0.95rem;
  outline: none;
}
.alarm-search-input:focus { border-color: var(--accent, #1264a3); }

.alarm-search-btn { white-space: nowrap; padding: 8px 14px; }

.alarm-search-results {
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
}
.alarm-search-results.hidden { display: none; }

.alarm-result-item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 0.88rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,0.07));
  transition: background 0.12s;
}
.alarm-result-item:last-child { border-bottom: none; }
.alarm-result-item:hover, .alarm-result-item:focus { background: var(--hover, rgba(255,255,255,0.08)); outline: none; }
.alarm-result-name { font-weight: 600; }
.alarm-result-sub  { color: var(--text-dim, rgba(255,255,255,0.5)); font-size: 0.78rem; margin-top: 1px; }

.alarm-dest-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--hover, rgba(255,255,255,0.06));
  margin-bottom: 10px;
  color: var(--accent-text, #5bc8f5);
}
.alarm-dest-row.hidden { display: none; }
.alarm-dest-name { flex: 1; font-size: 0.9rem; font-weight: 600; }
.alarm-dest-clear {
  background: none; border: none; cursor: pointer;
  color: var(--text-dim, rgba(255,255,255,0.4));
  font-size: 1.2rem; line-height: 1; padding: 0 2px;
}
.alarm-dest-clear:hover { color: #fff; }

.alarm-radius-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.alarm-radius-label { font-size: 0.88rem; color: var(--text-dim, rgba(255,255,255,0.55)); }
.alarm-radius-select {
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid var(--border, rgba(255,255,255,0.12));
  background: var(--input-bg, rgba(255,255,255,0.07));
  color: inherit;
  font-size: 0.88rem;
}

.alarm-status {
  font-size: 0.85rem;
  color: var(--text-dim, rgba(255,255,255,0.55));
  text-align: center;
  padding: 6px 0 10px;
}
.alarm-status.hidden { display: none; }
.alarm-status.alarm-status-near { color: #f4a522; font-weight: 600; }

.alarm-footer {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}
.alarm-footer .btn-primary,
.alarm-footer .btn-secondary { flex: 1; }

/* Active badge — sits above the player, below the header */
.alarm-active-badge {
  position: fixed;
  top: 44px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(18, 100, 163, 0.88);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  backdrop-filter: blur(6px);
  z-index: 120;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  transition: opacity 0.2s;
  white-space: nowrap;
}
.alarm-active-badge.hidden { display: none; }
.alarm-active-badge:hover { opacity: 0.85; }

/* Fired overlay */
.alarm-fired-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
}
.alarm-fired-overlay.hidden { display: none; }

.alarm-fired-inner {
  background: var(--sheet-bg, #1a1a2e);
  border-radius: 20px;
  padding: 36px 28px 28px;
  text-align: center;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: alarm-pulse 0.6s ease-in-out infinite alternate;
}

@keyframes alarm-pulse {
  from { box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 0 rgba(244,165,34,0.7); }
  to   { box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 0 20px rgba(244,165,34,0); }
}

.alarm-fired-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  animation: alarm-ring 0.4s ease-in-out infinite alternate;
}
@keyframes alarm-ring {
  from { transform: rotate(-15deg); }
  to   { transform: rotate(15deg); }
}

.alarm-fired-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: #f4a522;
}

.alarm-fired-dest {
  font-size: 0.95rem;
  color: var(--text-dim, rgba(255,255,255,0.65));
  margin: 0 0 20px;
}

.alarm-fired-dismiss { width: 100%; }

/* AOD alarm distance line + progress bar */
.aod-alarm-wrap { padding: 4px 8px 0; }
.aod-alarm-wrap.hidden { display: none; }

.aod-alarm-info {
  font-size: clamp(0.85rem, 3.2vw, 1.1rem);
  color: var(--aod-dim);
  letter-spacing: 0.03em;
}
.aod-alarm-info.near { color: var(--w-warn); font-weight: 700; }

.aod-alarm-bar-track {
  margin-top: 5px;
  height: 4px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--aod-led, var(--w-lcd-text)) 14%, transparent);
  overflow: hidden;
}
.aod-alarm-bar-fill {
  height: 100%;
  border-radius: 2px;
  width: 0%;
  background: var(--aod-led, var(--w-lcd-text));
  transition: width 1s ease, background 0.6s ease;
}
.aod-alarm-bar-fill.near  { background: var(--w-warn); }
.aod-alarm-bar-fill.close { background: var(--w-error); }

/* ── touch-only utility ───────────────────────────────────────── */
@media (hover: hover) and (pointer: fine) {
  .touch-only { display: none !important; }
}

/* ── Saved Locations overlay ─────────────────────────────────── */
.saved-locations-sheet {
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.saved-locations-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.saved-loc-empty {
  text-align: center;
  color: var(--w-text-muted);
  font-size: 0.85rem;
  padding: 24px 0;
}
.saved-loc-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  background: var(--w-surface, #1a1a1a);
  border: 1px solid var(--w-border, #333);
  border-radius: 8px;
}
.saved-loc-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}
.saved-loc-info {
  flex: 1;
  min-width: 0;
}
.saved-loc-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--w-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.saved-loc-coords {
  font-size: 0.72rem;
  color: var(--w-text-muted);
  margin-top: 1px;
  font-family: monospace;
}
.saved-loc-ts {
  font-size: 0.68rem;
  color: var(--w-text-dim);
  flex-shrink: 0;
  text-align: right;
}
.saved-loc-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.saved-loc-map-btn,
.saved-loc-copy-btn,
.saved-loc-del-btn {
  background: none;
  border: 1px solid var(--w-border, #444);
  border-radius: 6px;
  color: var(--w-text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px 8px;
  line-height: 1;
}
.saved-loc-map-btn:hover  { color: var(--w-text); border-color: var(--w-text-muted); }
.saved-loc-copy-btn:hover { color: var(--w-text); border-color: var(--w-text-muted); }
.saved-loc-del-btn:hover  { color: #e05; border-color: #e05; }
.saved-loc-map-picker {
  display: flex;
  gap: 6px;
  padding: 2px 0 0 32px;
  flex-wrap: wrap;
  width: 100%;
}
.saved-loc-map-picker.hidden { display: none; }
.saved-loc-map-link {
  font-size: 0.8rem;
  color: var(--color-accent, #1db954);
  text-decoration: none;
  padding: 4px 10px;
  border: 1px solid var(--color-accent, #1db954);
  border-radius: 12px;
}
.saved-loc-map-link:hover { background: var(--color-accent, #1db954); color: #000; }

/* ── Broadcasting mode ─────────────────────────────────────── */
.bc-queue {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.bc-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--w-border, #333);
  font-size: 0.78rem;
}
.bc-item[data-playlist-idx],
.bc-item-tts[data-tts-id] { cursor: pointer; }
.bc-item[data-playlist-idx]:hover,
.bc-item-tts[data-tts-id]:hover { background: var(--w-surface3, #2a2a2a); }
.bc-item.active {
  background: rgba(29,185,84,0.1);
  color: var(--color-accent, #1db954);
}
.bc-item.active.playing {
  background: rgba(29,185,84,0.18);
  font-weight: 600;
}
.bc-item-icon  { flex-shrink: 0; width: 16px; text-align: center; }
.bc-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--w-text);
}
.bc-item.active .bc-item-label { color: inherit; }
.bc-item-dur {
  flex-shrink: 0;
  color: var(--w-text-muted);
  font-size: 0.72rem;
  min-width: 32px;
  text-align: right;
}
.bc-item-lang {
  flex-shrink: 0;
  font-size: 0.65rem;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--w-surface3, #2a2a2a);
  color: var(--w-text-muted);
  line-height: 1.4;
  white-space: nowrap;
}
.bc-item-lang-missing { color: var(--w-accent, #f59e0b); }
.bc-item-btn {
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--w-text-muted);
  cursor: pointer;
  padding: 2px 5px;
  font-size: 0.85rem;
  border-radius: 3px;
  line-height: 1;
}
.bc-item-btn:hover { background: var(--w-surface3, #2a2a2a); color: var(--w-text); }
.bc-drag-handle {
  flex-shrink: 0;
  cursor: grab;
  color: var(--w-text-muted);
  font-size: 0.75rem;
  padding: 0 3px 0 0;
  user-select: none;
  opacity: 0.5;
}
.bc-drag-handle:active { cursor: grabbing; }
.bc-item.bc-dragging { opacity: 0.35; }
.bc-item.bc-drag-over { border-top: 2px solid var(--w-accent, #1db954); }
.bc-footer {
  padding: 3px 8px;
  font-size: 0.68rem;
  color: var(--w-text-muted);
  border-top: 1px solid var(--w-border, #333);
  text-align: right;
  min-height: 18px;
}
.bc-bulletin-textarea {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  background: var(--w-surface3, #1a1a1a);
  border: 1px solid var(--w-border, #333);
  border-radius: 4px;
  color: var(--w-text);
  padding: 8px;
  font-size: 0.85rem;
  font-family: inherit;
  box-sizing: border-box;
  line-height: 1.5;
}
.bc-bulletin-textarea:focus {
  outline: none;
  border-color: var(--color-accent, #1db954);
}

/* ── Screens and the header on a phone ───────────────────────────
   On a touch phone the header's right-hand buttons are gone: swipe right for the
   shortcut cards, swipe left for the last screen. One handle (⋯) stays — the
   accessible path, and the only affordance the gestures have. Keyed on the pointer,
   not on "is this a phone": a laptop with a touchscreen keeps its buttons. */
/* The handle shows on a desktop too (0.1.42): without it a mouse had no way to the cards
   at all — swipes are touch-only. There it sits beside ⋮ (order), on a phone alone. */
.shortcuts-handle { display: inline-flex; align-items: center; justify-content: center; order: 1; }
.header-right > .header-menu-wrap { order: 2; }
@media (hover: none) and (pointer: coarse) {
  .header-right > .icon-btn:not(.shortcuts-handle),
  .header-right > .header-menu-wrap { display: none !important; }
  .shortcuts-handle { display: inline-flex; align-items: center; justify-content: center; }
}
.shortcuts-handle svg { width: 18px; height: 18px; fill: var(--w-lcd-text); filter: drop-shadow(0 0 4px var(--w-lcd-text)); }

/* The LED button every screen leads with */
.screen-led-btn {
  width: 100%;
  margin: 4px 0 10px;
  color: var(--w-lcd-text) !important;
  background: var(--w-lcd-bg) !important;
  border: 1px solid color-mix(in srgb, var(--w-lcd-text) 45%, transparent) !important;
  text-shadow: 0 0 8px var(--w-lcd-text);
  box-shadow: 0 0 10px color-mix(in srgb, var(--w-lcd-text) 35%, transparent);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.screen-status { margin: 0 0 6px; min-height: 1.2em; font-size: 0.8rem; color: var(--w-text-muted); }
.screen-label  { margin: 8px 0 2px; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--w-text-muted); }
.parking-name  { margin: 0; font-size: 1.05rem; font-weight: 700; color: var(--w-text); word-break: break-word; }
.parking-meta  { margin: 2px 0 10px; font-size: 0.85rem; color: var(--w-text-muted); }
.parking-dist  { color: var(--w-lcd-text); text-shadow: 0 0 6px color-mix(in srgb, var(--w-lcd-text) 60%, transparent); font-variant-numeric: tabular-nums; }
.share-url     { margin: 2px 0 12px; font-family: "Courier New", Courier, monospace; font-size: 0.78rem; color: var(--w-text-muted); word-break: break-all; }

/* ── Podcasts screen ──────────────────────────────────────────── */
.podcast-row {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 8px; margin-bottom: 6px; cursor: pointer;
  background: var(--w-surface); border: 1px solid var(--w-border-lo); border-radius: 6px;
  color: var(--w-text); font: inherit;
}
.podcast-row:hover { border-color: var(--w-accent); }
.podcast-art { width: 48px; height: 48px; border-radius: 6px; flex-shrink: 0; background: var(--w-lcd-bg); object-fit: cover; }
.podcast-episode .radio-station-name { white-space: normal; }
#podcast-back { margin-bottom: 8px; }
