/* ==========================================================================
   Site radio: a one-line bar along the bottom of every page that expands
   into the controls, plus the admin radio and feature-usage panels.
   ========================================================================== */

.radio-bar {
  --bar-h: 44px;
  position: fixed; z-index: 70; left: 0; right: 0; bottom: 0;
  color: #e3f1f4; font-size: 0.85rem;
  pointer-events: none; /* the panel and strip opt back in */
}
.radio-bar[hidden] { display: none; }
body.has-radio-bar { padding-bottom: var(--radio-bar-space, 44px); }

/* --- the strip: one line, always visible ----------------------------------- */
.radio-strip {
  position: relative; pointer-events: auto;
  display: flex; align-items: center; gap: 12px;
  height: var(--bar-h); padding: 0 10px 0 12px;
  background: rgba(4, 18, 25, 0.9);
  border-top: 1px solid rgba(114, 211, 214, 0.14);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  cursor: pointer; user-select: none;
}
.radio-strip:focus-visible { outline: 2px solid var(--brand-300); outline-offset: -2px; }
.radio-hairline { position: absolute; left: 0; right: 0; top: -1px; height: 2px; background: rgba(255, 255, 255, 0.06); }
.radio-hairline i {
  display: block; height: 100%; width: 0;
  background: linear-gradient(90deg, var(--brand-300), var(--accent-400));
  box-shadow: 0 0 8px rgba(114, 211, 214, 0.5);
  transition: width 0.5s linear;
}
.radio-bar.is-live .radio-hairline i { width: 100% !important; opacity: 0.35; }

.radio-art {
  flex: none; width: 28px; height: 28px; border-radius: 6px;
  background: conic-gradient(from 210deg, var(--brand-500), var(--accent-500), var(--brand-300), var(--brand-600), var(--brand-500));
  background-size: cover; background-position: center;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
  display: grid; place-items: center; color: rgba(255, 255, 255, 0.85); font-weight: 700; font-size: 0.8rem;
}
.radio-art.has-cover { color: transparent; }
.radio-dot { flex: none; width: 7px; height: 7px; border-radius: 2px; background: #4e6a70; transition: background 0.3s; }
.radio-bar.is-playing .radio-dot { background: #ff5a3a; box-shadow: 0 0 8px rgba(255, 90, 58, 0.7); animation: radio-breathe 2.4s ease-in-out infinite; }
@keyframes radio-breathe { 50% { opacity: 0.45; } }

.radio-line-text { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 10px; white-space: nowrap; overflow: hidden; }
.radio-title { font-weight: 650; color: #fff; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.radio-artist { color: #8fb0b7; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 0; }
.radio-artist::before { content: "·"; margin-right: 10px; color: #4e6a70; }
.radio-artist:empty { display: none; }
.radio-time { flex: none; color: #7fa0a7; font: 500 0.75rem/1 var(--mono); font-variant-numeric: tabular-nums; }

.radio-eq { flex: none; display: flex; align-items: flex-end; gap: 2px; height: 14px; width: 18px; }
.radio-eq i { width: 3px; height: 3px; border-radius: 1px; background: #5f7f86; }
.radio-bar.is-playing .radio-eq i { background: var(--brand-300); animation: radio-eq 0.9s ease-in-out infinite alternate; }
.radio-bar.is-playing .radio-eq i:nth-child(2) { animation-duration: 0.65s; }
.radio-bar.is-playing .radio-eq i:nth-child(3) { animation-duration: 1.1s; }
.radio-bar.is-playing .radio-eq i:nth-child(4) { animation-duration: 0.8s; }
@keyframes radio-eq { from { height: 3px; } to { height: 14px; } }

.radio-icon-btn {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(255, 255, 255, 0.04); color: #cfe3e7; cursor: pointer;
  transition: background 0.2s, transform 0.35s var(--ease);
}
.radio-icon-btn:hover { background: rgba(255, 255, 255, 0.1); }
.radio-icon-btn svg, .radio-mode svg, .radio-vol svg, .radio-restore svg {
  width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.radio-bar.is-open .radio-expand { transform: rotate(180deg); }

.radio-play {
  position: relative; flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px;
  border: 0; cursor: pointer; color: #062029; background: #eef8f9;
  transition: transform 0.2s var(--ease), background 0.2s;
}
.radio-play:hover { transform: scale(1.06); }
.radio-play:focus-visible { outline: 2px solid var(--brand-300); outline-offset: 2px; }
.radio-play svg { width: 15px; height: 15px; fill: currentColor; }
.radio-play .i-pause, .radio-bar.is-playing .radio-play .i-play { display: none; }
.radio-bar.is-playing .radio-play .i-pause { display: block; }
.radio-spinner {
  position: absolute; inset: -3px; border-radius: 10px; border: 2px solid transparent; border-top-color: var(--brand-300);
  opacity: 0; animation: radio-spin 0.9s linear infinite; pointer-events: none;
}
.radio-bar.is-loading .radio-spinner, .radio-bar.is-navigating .radio-spinner { opacity: 1; }
@keyframes radio-spin { to { transform: rotate(360deg); } }
.radio-bar.needs-tap .radio-play { animation: radio-tap 1.6s var(--ease) infinite; }
@keyframes radio-tap { 0%, 100% { box-shadow: 0 0 0 0 rgba(114, 211, 214, 0.6); } 60% { box-shadow: 0 0 0 9px rgba(114, 211, 214, 0); } }

/* --- the panel: opens upward from the strip ---------------------------------- */
.radio-panel {
  position: absolute; left: 0; right: 0; bottom: var(--bar-h);
  pointer-events: none; opacity: 0; transform: translateY(12px);
  transition: opacity 0.28s var(--ease), transform 0.32s var(--ease);
  background: linear-gradient(180deg, rgba(6, 24, 33, 0.94), rgba(4, 18, 25, 0.97));
  border-top: 1px solid rgba(114, 211, 214, 0.14);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  padding: 12px clamp(12px, 3vw, 28px) 14px;
  box-shadow: 0 -24px 50px -30px rgba(0, 0, 0, 0.8);
}
.radio-bar.is-open .radio-panel { pointer-events: auto; opacity: 1; transform: none; }
.radio-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.radio-onair { display: inline-flex; align-items: center; gap: 9px; font: 600 0.68rem/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: #6f9097; min-width: 0; }
.radio-onair i { width: 7px; height: 7px; border-radius: 2px; background: #4e6a70; flex: none; }
.radio-bar.is-playing .radio-onair i { background: #ff5a3a; }
.radio-station { color: #a9c6cc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radio-count { color: #6f9097; white-space: nowrap; }
.radio-modes { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.radio-mode { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; color: #4e6a70; }
.radio-mode.is-on { color: var(--brand-300); background: rgba(114, 211, 214, 0.1); }
.radio-manage { font-size: 0.75rem; color: var(--brand-300); text-decoration: none; padding: 5px 9px; border-radius: 7px; border: 1px solid rgba(114, 211, 214, 0.25); }
.radio-manage:hover { background: rgba(114, 211, 214, 0.1); color: #fff; }

.radio-panel-body { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px; align-items: center; }
.radio-art-lg { width: 64px; height: 64px; border-radius: 10px; font-size: 1.4rem; }
.radio-panel-meta { min-width: 0; display: grid; gap: 2px; }
.radio-title-lg { font-size: 1rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radio-sub-lg { color: #8fb0b7; font-size: 0.82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radio-scrub { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; margin-top: 6px; font: 500 0.72rem/1 var(--mono); color: #7fa0a7; font-variant-numeric: tabular-nums; }
.radio-progress-lg { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.radio-progress-lg i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand-300), var(--accent-400)); transition: width 0.5s linear; }
.radio-bar.is-live .radio-scrub { display: none; }
.radio-vol { display: inline-flex; align-items: center; gap: 8px; color: #8fb0b7; }
.radio-volume { width: 110px; accent-color: var(--brand-300); }

.radio-next { list-style: none; margin: 12px 0 0; padding: 10px 0 0; border-top: 1px solid rgba(255, 255, 255, 0.06); display: flex; gap: 18px; overflow: hidden; }
.radio-next:empty { display: none; }
.radio-next li { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 0 1 260px; font-size: 0.78rem; color: #8fb0b7; }
.radio-next li .radio-art { width: 24px; height: 24px; font-size: 0.7rem; }
.radio-next li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radio-next li b { color: #cfe3e7; font-weight: 600; }
.radio-next::before { content: "Up next"; flex: none; font: 600 0.62rem/2.2 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: #5d7d84; }

.radio-restore {
  position: fixed; z-index: 70; right: 14px; bottom: 14px; width: 40px; height: 40px; border-radius: 12px;
  display: grid; place-items: center; border: 1px solid rgba(114, 211, 214, 0.25); cursor: pointer;
  background: rgba(4, 18, 25, 0.9); color: var(--brand-300);
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.7);
}
.radio-restore[hidden] { display: none; }
.radio-restore.is-playing { color: #ff7a4d; animation: radio-breathe 2.4s ease-in-out infinite; }

/* --- light theme ------------------------------------------------------------ */
:root[data-theme="light"] .radio-strip,
:root[data-theme="light"] .radio-panel,
:root[data-theme="light"] .radio-restore {
  background: rgba(255, 255, 255, 0.92); border-color: rgba(15, 111, 128, 0.16); color: var(--ink);
}
:root[data-theme="light"] .radio-panel { box-shadow: 0 -24px 50px -34px rgba(5, 34, 48, 0.35); }
:root[data-theme="light"] .radio-title,
:root[data-theme="light"] .radio-title-lg { color: var(--ink); }
:root[data-theme="light"] .radio-artist,
:root[data-theme="light"] .radio-sub-lg,
:root[data-theme="light"] .radio-time,
:root[data-theme="light"] .radio-scrub,
:root[data-theme="light"] .radio-vol,
:root[data-theme="light"] .radio-next li,
:root[data-theme="light"] .radio-station { color: var(--ink-3); }
:root[data-theme="light"] .radio-next li b { color: var(--ink); }
:root[data-theme="light"] .radio-icon-btn { background: rgba(10, 22, 32, 0.04); border-color: rgba(10, 22, 32, 0.1); color: var(--ink-2); }
:root[data-theme="light"] .radio-play { background: var(--brand-800); color: #fff; }
:root[data-theme="light"] .radio-hairline,
:root[data-theme="light"] .radio-progress-lg { background: rgba(10, 22, 32, 0.08); }
:root[data-theme="light"] .radio-manage { color: var(--brand-700); border-color: var(--brand-200); }

/* --- phones ---------------------------------------------------------------- */
@media (max-width: 640px) {
  .radio-bar { --bar-h: 52px; }
  .radio-strip { gap: 10px; padding: 0 8px 0 10px; padding-bottom: env(safe-area-inset-bottom); height: calc(var(--bar-h) + env(safe-area-inset-bottom)); }
  .radio-art { width: 32px; height: 32px; }
  .radio-line-text { flex-direction: column; align-items: flex-start; gap: 1px; }
  .radio-artist { font-size: 0.75rem; }
  .radio-artist::before { display: none; }
  .radio-eq, .radio-dot { display: none; }
  .radio-play { width: 38px; height: 38px; border-radius: 10px; }
  .radio-panel-body { grid-template-columns: auto minmax(0, 1fr); }
  .radio-vol { grid-column: 1 / -1; }
  .radio-volume { flex: 1; width: auto; }
  .radio-next li:nth-child(n + 2) { display: none; }
  .radio-manage { display: none; }
  .radio-restore { bottom: calc(12px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .radio-bar *, .radio-restore { animation: none !important; transition: none !important; }
}

/* ==========================================================================
   Admin
   ========================================================================== */
.feature-table { width: 100%; margin-top: 16px; }
.feature-table td, .feature-table th { vertical-align: middle; }
.feature-table canvas { display: block; width: 150px; height: 30px; }
.feature-name { display: flex; align-items: center; gap: 9px; font-weight: 600; white-space: nowrap; }
.feature-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.feature-table .mono { font-variant-numeric: tabular-nums; }

.radio-power { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.radio-power .pill { font-size: 0.8rem; }
.radio-disc {
  width: 68px; height: 68px; border-radius: 50%;
  background: radial-gradient(circle, #0b2a36 0 18%, transparent 19%),
    conic-gradient(from 0deg, var(--brand-500), var(--accent-500), var(--brand-300), var(--brand-600), var(--brand-500));
  display: grid; place-items: center;
}
.radio-disc span { width: 8px; height: 8px; border-radius: 50%; background: #e8f6f8; }
.radio-now-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 18px; align-items: center; }
.radio-now-card h3 { margin: 2px 0; font-size: 1.15rem; }
.radio-now-progress { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; margin-top: 10px; }
.radio-now-progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-400), var(--accent-400)); width: 0; transition: width 0.9s linear; }
.radio-now-times { display: flex; justify-content: space-between; font: 500 0.75rem/1.4 var(--mono); color: var(--ink-3); margin-top: 4px; }
.playback-controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.playback-controls form { margin: 0; }
.chip-toggle {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); font: 600 0.82rem/1 var(--font);
}
.chip-toggle svg { width: 15px; height: 15px; }
.chip-toggle.is-on { background: color-mix(in srgb, var(--brand-400) 16%, var(--surface)); border-color: var(--brand-400); color: var(--ink); }
@media (max-width: 760px) {
  .radio-now-card { grid-template-columns: auto minmax(0, 1fr); }
  .playback-controls { grid-column: 1 / -1; justify-content: flex-start; }
}

.track-cover { border-radius: 8px; object-fit: cover; flex: none; display: block; }
.track-cover-blank {
  display: grid; place-items: center; color: #fff; font-weight: 700;
  background: conic-gradient(from 210deg, var(--brand-500), var(--accent-500), var(--brand-300), var(--brand-600), var(--brand-500));
}
.radio-now-card .track-cover { border-radius: 12px; }

.dropzone-target {
  display: grid; justify-items: center; gap: 6px; text-align: center; cursor: pointer;
  padding: 26px 18px; border-radius: var(--radius); border: 2px dashed var(--line-strong); background: var(--surface-2);
  transition: border-color 0.2s, background 0.2s;
}
.dropzone-target:hover, .dropzone-target.is-over { border-color: var(--brand-400); background: color-mix(in srgb, var(--brand-400) 8%, var(--surface-2)); }
.dropzone-target svg { width: 30px; height: 30px; color: var(--brand-400); }
.dropzone-target span { color: var(--ink-3); font-size: 0.85rem; }
.dropzone-target input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone-options { display: flex; gap: 8px 22px; flex-wrap: wrap; margin-top: 12px; }
.dropzone-options label { display: inline-flex; align-items: center; gap: 8px; font-weight: 550; border-radius: 8px; padding: 2px 4px; }
.dropzone-options label.needs-attention { outline: 2px solid var(--accent-500); }
.upload-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 8px; }
.upload-list:empty { display: none; }
.upload-list li { display: grid; grid-template-columns: minmax(0, 1fr) 160px auto; gap: 12px; align-items: center; font-size: 0.85rem; }
.upload-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-bar { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.upload-bar i { display: block; height: 100%; width: 0; background: var(--brand-400); transition: width 0.2s; }
.upload-list li.is-done .upload-bar i { background: var(--ok-fg); }
.upload-list li.is-failed .upload-bar i { background: var(--err-fg); }
.upload-state { color: var(--ink-3); font-size: 0.8rem; min-width: 80px; text-align: right; }
.upload-list li.is-failed .upload-state { color: var(--err-fg); }

.queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.queue-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center;
  padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
}
.queue-row.is-current { border-color: var(--brand-400); background: color-mix(in srgb, var(--brand-400) 8%, var(--surface)); }
.queue-row.is-off .queue-meta, .queue-row.is-off .track-cover { opacity: 0.5; }
.queue-meta { display: flex; gap: 6px; min-width: 0; margin: 0; }
.queue-meta input { min-width: 0; flex: 1 1 0; height: 34px; }
.queue-meta button { flex: none; }
.queue-len { color: var(--ink-3); display: inline-flex; align-items: center; gap: 7px; }
.live-dot { width: 7px; height: 7px; border-radius: 2px; background: #ff5a3a; animation: radio-breathe 2.4s ease-in-out infinite; }
.track-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }
.track-actions form { margin: 0; }
.queue-toggle {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 6px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink-3); font: 600 0.78rem/1 var(--font); white-space: nowrap;
}
.queue-toggle span { width: 30px; height: 18px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background 0.2s; }
.queue-toggle span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform 0.2s var(--ease); }
.queue-toggle.is-on { color: var(--ink); border-color: var(--brand-400); }
.queue-toggle.is-on span { background: var(--brand-400); }
.queue-toggle.is-on span::after { transform: translateX(12px); }
@media (max-width: 900px) {
  .queue-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .track-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .upload-list li { grid-template-columns: minmax(0, 1fr) 90px; }
  .upload-state { grid-column: 1 / -1; text-align: left; }
}

.mode-choice { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin: 10px 0 16px; }
.mode-choice label { display: block; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; background: var(--surface); }
.mode-choice label small { display: block; color: var(--ink-3); margin-top: 4px; font-weight: 400; }
.mode-choice input { margin-right: 8px; }
.mode-choice label:has(input:checked) { border-color: var(--brand-400); box-shadow: var(--ring); }
