/* Online radio page. Look: a 90s Japanese car head unit with a green VFD.
   Skins only swap the variables below. No external fonts (works behind the GFW). */
:root {
  --page: #0c151b;
  --fg: #e4ecf0;
  --muted: #93a5af;
  --acc: #4ff0c0;
  --ghost: #0e2a23;
  --led: #4ff0c0;
  --led-off: #2c3e49;
  --bezel: linear-gradient(180deg, #172632, #101b22);
  --bezel-r: 18px;
  --bezel-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 0 1px #25353f, 0 12px 32px rgba(0, 0, 0, 0.5);
  --screen: radial-gradient(ellipse at 50% 40%, #061612, #020605);
  --scr-solid: #030a08;
  --screen-r: 8px;
  --key-bg: #1b2b35;
  --key-fg: #e4ecf0;
  --key-r: 3px;
  --key-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 -2px 0 rgba(0, 0, 0, 0.5), 0 3px 0 #050506;
  --tile-r: 4px;
  --tile-shadow: none;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --sans: "IBM Plex Sans Condensed", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --zh: "PingFang SC", "Noto Sans SC", "Noto Sans CJK SC", "Microsoft YaHei", "WenQuanYi Zen Hei", sans-serif;
}
[data-skin="2"] {
  --acc: #f2b632; --ghost: #2e2610; --led: #f2b632;
  --bezel: linear-gradient(180deg, #121a20, #0b1115); --bezel-r: 6px;
  --bezel-shadow: 0 0 0 1px #25353f;
  --screen: #05090c; --scr-solid: #05090c; --screen-r: 3px; --tile-r: 3px;
}
[data-skin="3"] {
  --acc: #ff6a4a; --ghost: #2a1210; --led: #ff6a4a;
  --screen: #060c10; --scr-solid: #060c10; --screen-r: 14px; --tile-r: 14px;
  --tile-shadow: inset 0 6px 10px rgba(0, 0, 0, 0.45);
}
[data-skin="4"] {
  --acc: #cfe8ff; --ghost: #1c2630; --led: #e0602a; --led-off: #9aa2a8;
  --bezel: linear-gradient(180deg, #d9dde0, #b9bfc4); --bezel-r: 4px;
  --bezel-shadow: 0 0 0 1px #8e969c, 0 14px 34px rgba(0, 0, 0, 0.55);
  --screen: linear-gradient(180deg, #0d1418, #05080a); --scr-solid: #090f12; --screen-r: 2px;
  --key-bg: linear-gradient(180deg, #eceef0, #c7ccd0); --key-fg: #1a2228; --key-r: 2px;
  --key-shadow: inset 0 1px 0 #ffffff, 0 1px 2px rgba(0, 0, 0, 0.35);
  --tile-r: 2px;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--page); color: var(--fg); }
body {
  font-family: var(--sans);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
}
button { font: inherit; cursor: pointer; }
button:focus-visible { outline: 2px solid var(--acc); outline-offset: 3px; }

.radio { width: 100%; max-width: 1200px; }
.bezel {
  display: flex; flex-direction: column; gap: 20px;
  padding: clamp(14px, 2.2vw, 26px);
  background: var(--bezel); border-radius: var(--bezel-r); box-shadow: var(--bezel-shadow);
}

/* ── the VFD ── */
.screen {
  display: flex; flex-direction: column; gap: 10px;
  padding: 16px clamp(12px, 2vw, 22px);
  background: var(--screen); border-radius: var(--screen-r);
  box-shadow: inset 0 4px 14px rgba(0, 0, 0, 0.95), 0 0 0 2px #1b2b35;
  user-select: none;
}
.lg { color: var(--ghost); font-size: 14px; letter-spacing: 0.12em; font-weight: 600; transition: color 0.08s; }
.lg.on { color: var(--acc); text-shadow: 0 0 6px var(--acc); }
.row.top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.push { margin-left: auto; }
.sk {
  height: 32px; padding: 0 10px; background: transparent; border: 1px solid var(--ghost); border-radius: 3px;
  color: var(--acc); text-shadow: 0 0 6px var(--acc);
}
.discs { display: flex; gap: 6px; margin-left: 4px; }
.discs button {
  width: 24px; height: 24px; padding: 0; display: flex; align-items: center; justify-content: center; background: transparent;
  font: 600 13px var(--sans); color: var(--ghost); border: 1px solid transparent; border-radius: 2px;
}
.discs button.avail { color: color-mix(in srgb, var(--acc) 45%, var(--ghost)); }
.discs button.on { color: var(--acc); border-color: var(--acc); text-shadow: 0 0 6px var(--acc); box-shadow: 0 0 6px var(--acc); }
.discs button:disabled { cursor: default; }

.mid { display: flex; gap: clamp(8px, 1.6vw, 18px); }
.side { width: 44px; display: flex; flex-direction: column; gap: 14px; padding-top: 10px; }
.side.right { width: 70px; align-items: flex-end; }
.center { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }

.digits { display: flex; align-items: flex-end; gap: clamp(10px, 2vw, 22px); min-height: 70px; }
.seg { display: flex; align-items: flex-end; gap: 4px; filter: drop-shadow(0 0 5px var(--acc)); }
.seg svg polygon { fill: var(--ghost); }
.seg svg polygon.on { fill: var(--acc); }
.seg.small svg { width: clamp(20px, 2.6vw, 30px); height: auto; }
.seg.big svg { width: clamp(28px, 3.6vw, 40px); height: auto; }
.seg .colon { display: flex; flex-direction: column; gap: 14px; padding-bottom: 14px; }
.seg .colon i { width: 7px; height: 7px; background: var(--acc); }

.vol { margin-left: auto; width: min(300px, 40%); display: flex; flex-direction: column; gap: 6px; }
.vol[hidden] { display: none; }
.vol-head { display: flex; justify-content: space-between; color: var(--acc); text-shadow: 0 0 6px var(--acc); font: 600 13px var(--sans); letter-spacing: 0.12em; }
.vol-bars { display: flex; gap: 3px; height: 30px; align-items: flex-end; filter: drop-shadow(0 0 5px var(--acc)); }
.vol-bars span { flex: 1; background: var(--ghost); clip-path: polygon(0 18%, 100% 0, 100% 100%, 0 100%); }
.vol-bars span.on { background: var(--acc); }

.line { display: flex; align-items: baseline; gap: 18px; min-width: 0; }
/* Dot-matrix look without a font file: bold mono glyphs under a fixed grid of dark gaps.
   No mask and no filter on the text — phones re-rasterise those and the letters shimmer. */
.dot {
  position: relative; isolation: isolate;
  font: 800 clamp(22px, 3vw, 34px) / 1.1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--acc); text-shadow: 0 0 6px var(--acc);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.dot::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle, transparent 55%, var(--scr-solid) 66%) 0 0 / 3px 3px;
}
.cn { font: 500 clamp(20px, 2.4vw, 26px) / 1.1 var(--zh); color: var(--acc); text-shadow: 0 0 6px var(--acc); white-space: nowrap; }
.bar { display: flex; gap: 3px; height: 8px; }
.bar span { flex: 1; background: var(--ghost); }
.bar span.on { background: var(--acc); box-shadow: 0 0 4px var(--acc); }

/* ── queue ── */
.tiles { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 14px; padding: 4px; }
.tiles button {
  aspect-ratio: 1; border: 0; padding: 10px; border-radius: var(--tile-r); box-shadow: var(--tile-shadow);
  display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; text-align: left;
  color: #fff; overflow: hidden;
}
.tiles button.cur { outline: 3px solid var(--led); outline-offset: 4px; }
.tiles button.in { animation: tile-in 0.28s ease-out both; }
.tiles.shift button { animation: tile-shift 0.35s ease-out both; }
@keyframes tile-shift {
  0% { opacity: 0.35; transform: translateX(45%); }
  100% { opacity: 1; transform: none; }
}
@keyframes tile-in {
  0% { opacity: 0; transform: scale(0.9); filter: brightness(2.2); }
  55% { opacity: 1; }
  100% { opacity: 1; transform: none; filter: none; }
}
.tiles .n { font: 700 14px var(--mono); }
.tiles .t { font: 500 16px / 1.1 var(--zh); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── keys ── */
.keys { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; }
.keys button {
  height: 72px; border: 0; border-radius: var(--key-r); background: var(--key-bg); color: var(--key-fg);
  box-shadow: var(--key-shadow); display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; font-weight: 600; font-size: 16px; letter-spacing: 0.1em; white-space: nowrap;
}
.keys button b { font-weight: 600; }
.keys button:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.keys i { width: 22px; height: 4px; border-radius: 1px; background: var(--led-off); }
.keys button.on i { background: var(--led); box-shadow: 0 0 6px var(--led); }
.keys button.blink i { animation: blink 0.8s steps(2, start) infinite; }
@keyframes blink { to { background: var(--led-off); box-shadow: none; } }

/* ── preset keys 1–6 (stations), as on a car radio ── */
.keys.presets { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.keys.presets button { height: 60px; font: 700 20px var(--mono); }
.keys.presets button:disabled { color: var(--muted); opacity: 0.55; cursor: default; }


/* Tablet: 12 keys in one row, a bit tighter. */
@media (max-width: 1100px) and (min-width: 761px) {
  .keys { gap: 8px; }
  .keys button { font-size: 14px; letter-spacing: 0.04em; }
}
@media (max-width: 760px) {
  .tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
  .keys { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  .keys button { height: 60px; font-size: 13px; letter-spacing: 0.04em; }
  .side { width: 30px; }
  .side.right { width: 52px; }
  .lg { font-size: 12px; }
  .row.top { gap: 8px; flex-wrap: nowrap; }
  .discs { gap: 2px; margin-left: 0; }
  .discs button { width: 20px; height: 20px; font-size: 11px; }
  .sk { height: 28px; padding: 0 6px; }
  .vol { width: 45%; }
  .tiles button { padding: 6px; }
  .keys.presets { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .keys.presets button { height: 52px; font-size: 18px; }
  .tiles .n { display: none; }
  .tiles .t { font-size: 13px; }
}
/* ── MY button and the library panel ── */
.side-btn { background: transparent; border: 1px solid var(--ghost); border-radius: 3px; padding: 4px 4px; color: var(--acc); text-shadow: 0 0 6px var(--acc); min-height: 32px; }
.lib {
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 18px; border: 0; border-radius: var(--bezel-r);
  background: var(--bezel); box-shadow: var(--bezel-shadow); color: var(--fg); font-family: var(--sans);
}
.lib::backdrop { background: rgba(4, 8, 10, 0.72); }
.lib-head { display: flex; justify-content: space-between; align-items: baseline; color: var(--acc); text-shadow: 0 0 6px var(--acc); letter-spacing: 0.1em; }
.lib-head span { font: 600 14px var(--mono); }
.lib-bar { height: 8px; margin: 10px 0 14px; background: var(--ghost); border-radius: 1px; overflow: hidden; }
.lib-bar span { display: block; height: 100%; width: 0; background: var(--acc); }
.lib-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.lib-tabs button, .lib-btn {
  min-height: 44px; border: 0; border-radius: var(--key-r); background: var(--key-bg); color: var(--key-fg);
  box-shadow: var(--key-shadow); font: 600 14px var(--sans); letter-spacing: 0.08em; display: inline-flex; align-items: center; justify-content: center; padding: 0 14px; cursor: pointer;
}
.lib-tabs button[aria-pressed="true"] { color: var(--acc); box-shadow: var(--key-shadow), inset 0 0 0 1px var(--acc); }
.lib-list { list-style: none; margin: 0; padding: 0; max-height: 40vh; overflow: auto; display: grid; gap: 6px; }
.lib-list li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 4px; background: rgba(0, 0, 0, 0.25); }
.lib-list .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font: 500 14px var(--zh); }
.lib-list .d { font: 500 13px var(--mono); color: var(--muted); }
.lib-list button { min-width: 44px; min-height: 40px; border: 0; border-radius: var(--key-r); background: var(--key-bg); color: var(--key-fg); box-shadow: var(--key-shadow); }
.lib-list .empty { color: var(--muted); background: none; }
.lib-check { display: flex; gap: 10px; align-items: center; margin: 0 0 10px; font-size: 13px; color: var(--fg); min-height: 32px; }
.lib-check input { width: 18px; height: 18px; accent-color: var(--acc); }
.lib-list .where { font: 600 10px var(--sans); letter-spacing: 0.08em; color: var(--muted); border: 1px solid #25353f; border-radius: 3px; padding: 1px 5px; }
.lib-list .warn { color: #f2b632; font-weight: 700; cursor: help; }
.lib-code { font: 700 34px var(--mono); letter-spacing: 0.18em; color: var(--acc); text-shadow: 0 0 8px var(--acc); text-align: center; margin: 10px 0 4px; }
.lib-pair-info { text-align: center; font: 500 13px var(--mono); color: var(--fg); min-height: 1.4em; }
.lib-pair[hidden], #libConnectRow[hidden], #libJoinRow[hidden], #libPairAsk[hidden] { display: none; }
.lib-list .me { font: 600 10px var(--sans); color: var(--acc); letter-spacing: 0.08em; }
.lib-msg { min-height: 1.4em; margin: 10px 0; color: var(--acc); font: 500 13px var(--mono); }
.lib-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lib-actions .lib-btn { flex: 1; }
.lib-key { margin-top: 14px; color: var(--muted); font-size: 13px; }
.lib-key summary { cursor: pointer; min-height: 32px; }
.lib-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.lib-row code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 12px var(--mono); color: var(--fg); }
.lib-row input { flex: 1; min-width: 0; min-height: 40px; border-radius: 4px; border: 1px solid #25353f; background: #081016; color: var(--fg); padding: 0 10px; font: 13px var(--mono); }

@media (prefers-reduced-motion: reduce) { .keys button.blink i, .tiles button.in, .tiles.shift button { animation: none; } }
