/* ==========
   == BASE ==
   ========== */
:root { color-scheme: dark; font-family: system-ui, -apple-system, Segoe UI, sans-serif; }

/* ===========================================
   == TARJETA PRINCIPAL Y PANTALLA COMPLETA ==
   =========================================== */
body { margin: 0; min-height: 100vh; min-height: 100dvh; box-sizing: border-box; padding: 16px 0; display: grid; place-items: center; background: #11151b; color: #edf2f7; }
main { width: min(520px, calc(100% - 32px)); box-sizing: border-box; padding: 26px; border: 1px solid #303a47; border-radius: 18px; background: #1a2029; box-shadow: 0 18px 55px #0005; }
/* Si la tarjeta es más alta que la pantalla (registro abierto, móvil): sin borde ni curvas y pegada arriba */
body.tall { place-items: start center; padding: 0; background: #1a2029; }
body.tall main { width: min(520px, 100%); padding: 22px 20px 28px; border: 0; border-radius: 0; box-shadow: none; }

/* ==========================================
   == CABECERA, ESTADO DE CONEXIÓN Y RELOJ ==
   ========================================== */
header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 6px; }
h1 { font-size: 1.35rem; margin: 0; }
p { color: #aeb9c8; line-height: 1.45; }
.status { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 5px 11px; border-radius: 999px; background: #11161d; color: #cbd5e1; font-size: .78rem; }
.status #status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: #778394; flex: 0 0 auto; }
.dot.on { background: #48d597; box-shadow: 0 0 12px #48d59766; }
.dot.err { background: #ff7070; }
.subrow { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.subrow p { margin: 0.6em 0; }
#clock { cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent; flex: 0 0 auto; color: #cbd5e1; font-size: .95rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .02em; padding: 0px 11px; }

/* =========================
   == BOTONES Y VOLÚMENES ==
   ========================= */
.buttons { display: flex; gap: 10px; }
button { border: 0; border-radius: 10px; padding: 11px 17px; font: inherit; font-weight: 650; cursor: pointer;  flex: 1; }
#toggle { color: #07150f; background: #58dfa3; }
#stop { color: #e8edf5; background: #394454; }
button:disabled { opacity: .45; cursor: default; }
.volume { display: flex; align-items: center; gap: 12px; margin-top: 22px; }
.volume + .volume { margin-top: 10px; }
.volume label { flex: 0 0 4.6em; }
.volume span { flex: 0 0 3ch; text-align: right; font-variant-numeric: tabular-nums; }
input { width: 100%; accent-color: #58dfa3; }
.small { font-size: .83rem; }

/* ===================================
   == EMISORA ACTUAL Y VISUALIZADOR ==
   =================================== */
.now { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-top: 22px; padding: 16px 18px; min-height: 76px; box-sizing: border-box; border-radius: 12px; background: #11161d; }
.viz { margin-top: 10px; padding: 16px 18px; height: 76px; box-sizing: border-box; border-radius: 12px; background: #11161d; }
.viz canvas { display: block; width: 100%; height: 100%; }
.now .ps { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 2.1rem; font-weight: 700; letter-spacing: .06em; color: #edf2f7; }
.now .freq { flex: 0 0 auto; font-size: 1.05rem; font-weight: 600; color: #aeb9c8; font-variant-numeric: tabular-nums; }
.now .freq small { font-size: .75rem; font-weight: 500; color: #8c98a8; margin-left: 3px; }

/* =======================================
   == PANELES: OYENTES Y MODO BOLETINES ==
   ======================================= */
/* Paneles (oyentes y modo boletines): misma estética, sin brillo */
.panel { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 10px 14px; border-radius: 12px; background: #11161d; border: 1px solid #252e3a; }
.panel .badge { display: grid; place-items: center; flex: 0 0 auto; min-width: 38px; height: 38px; box-sizing: border-box; padding: 0 6px; border-radius: 10px; background: #1a2029; font-size: 1.2rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.panel .info { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.panel .info b { font-size: .88rem; font-weight: 650; color: #e2e8f0; }
.panel .info span { font-size: .78rem; color: #9fabb9; }
.panel .switch, .panel .lock { margin-left: auto; }
.panel.news.unavailable { opacity: .45; filter: grayscale(1); }
.panel.news .badge { transition: background .4s; }
.panel.news.live .badge { background: rgba(88, 223, 163, .22); }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + .track { background: #2a3039; }
.access { --c: #778394; margin-top: 14px; }
.access[data-state="free"] { --c: #58dfa3; }
.access[data-state="busy"] { --c: #f2b84b; }
.access .count { color: var(--c); }
.access .lock { flex: 0 0 auto; font-size: 1.15rem; color: var(--c); }
.switch { position: relative; flex: 0 0 auto; width: 46px; height: 26px; cursor: pointer; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: #394454; transition: background .2s; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #e8edf5; transition: transform .2s; }
.switch input:checked + .track { background: #58dfa3; }
.switch input:checked + .track::after { transform: translateX(20px); background: #07150f; }
.switch input:focus-visible + .track { outline: 2px solid #58dfa3; outline-offset: 2px; }

/* ==================
   == PRESINTONÍAS ==
   ================== */
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 12px; }
.preset { display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 4px; padding: 10px 8px; color: #e8edf5; background: #2a3441; border: 1px solid transparent; }
.preset .pn { display: flex; align-items: center; flex: 1; text-align: center; font-size: .95rem; font-weight: 700; line-height: 1.15; letter-spacing: .01em; overflow-wrap: anywhere; color: #f1f5f9; }
.preset .pf { font-size: .74rem; font-weight: 500; font-variant-numeric: tabular-nums; color: #9fabb9; }
.preset.active { border-color: #58dfa3; background: #22362f; }
.preset:disabled { opacity: .4; }
details.presetbox { margin-top: 14px; }
details.presetbox .presets { margin-top: 10px; }

/* ==================================
   == REGISTRO Y BLOQUES PLEGABLES ==
   ================================== */
#log { margin-top: 10px; padding: 12px; min-height: 44px; max-height: 130px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: #11161d; border-radius: 10px; color: #9fabb9; font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
details.logbox { position: relative; margin-top: 18px; }
details.fold summary { list-style: none; cursor: pointer; width: fit-content; margin: 0 auto; text-align: center; font-size: .8rem; color: #8c98a8; user-select: none; }
details.fold summary::-webkit-details-marker { display: none; }
details.logbox .copy { position: absolute; top: -4px; right: 0; flex: none; padding: 3px 10px; border-radius: 7px; font-size: .72rem; font-weight: 600; color: #cbd5e1; background: #2a3441; }
details.logbox .copy:hover { background: #344052; }
details.fold summary:hover { color: #cbd5e1; }
audio { display: none; }
/* ========================
   == VENTANA DE AJUSTES ==
   ======================== */
dialog.settings { width: min(560px, 94vw); max-height: 92vh; padding: 0; border: 1px solid #303a47; border-radius: 16px; background: #1a2029; color: #edf2f7; box-shadow: 0 18px 55px #000a; }
dialog.settings::backdrop { background: rgba(0, 0, 0, .65); }
.dlg { display: flex; flex-direction: column; gap: 12px; padding: 18px; max-height: 92vh; overflow: auto; box-sizing: border-box; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; font-size: 1.05rem; }
.dlg .x { flex: none; padding: 4px 10px; background: #2a3441; color: #cbd5e1; border-radius: 8px; }
.clockrow { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: .88rem; color: #cbd5e1; }
.clockrow input { width: 72px; padding: 6px 8px; box-sizing: border-box; text-align: center; border-radius: 8px; border: 1px solid #303a47; background: #11161d; color: #edf2f7; font: inherit; }
.cfglabel { font-size: .82rem; color: #9fabb9; }
#cfgText { width: 100%; height: 240px; box-sizing: border-box; resize: vertical; padding: 10px; border-radius: 10px; border: 1px solid #303a47; background: #11161d; color: #cbd5e1; font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; }
.cfgmsg { min-height: 1.2em; white-space: pre-wrap; font-size: .8rem; }
.cfgmsg.ok { color: #58dfa3; }
.cfgmsg.err { color: #ff8a8a; }
.dlg-actions { display: flex; gap: 10px; }
.dlg-actions .primary { color: #07150f; background: #58dfa3; }
.dlg-actions button:not(.primary) { color: #e8edf5; background: #394454; }
.dlg-links { display: flex; justify-content: space-between; gap: 10px; }
.dlg-links .link { flex: none; padding: 2px 0; background: none; color: #8c98a8; font-size: .78rem; font-weight: 500; text-decoration: underline; }