/* Onda — radio del mundo
   Paleta del portfolio de JLF: gris casi negro, amarillo mostaza y beige.
   Syncopate (ancha, de dial) para el nombre y los títulos, Familjen Grotesk
   para el texto, Martian Mono para los datos. Todo recto. */
:root {
    --bg: #17181a;
    --panel: #1c1d20;
    --panel-2: #24252a;
    --text: #e9d8a6;
    --muted: rgba(233, 216, 166, 0.58);
    --signal: #ee9b00;
    --signal-dim: rgba(238, 155, 0, 0.14);
    --warm: #ee9b00;
    --line: rgba(233, 216, 166, 0.12);
    --display: 'Syncopate', sans-serif;
    --mono: 'Martian Mono', ui-monospace, monospace;
    --sans: 'Familjen Grotesk', system-ui, sans-serif;
    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
    --panel-w: 410px;
    --player-h: 76px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; line-height: 1.5; overflow: hidden; -webkit-font-smoothing: antialiased; }
button, input { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* Pantalla de carga: ondas que suben y bajan */
.preloader { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--bg); transition: opacity 0.8s var(--ease), visibility 0.8s var(--ease); }
.preloader.is-done { opacity: 0; visibility: hidden; }
.pre-word { font-family: var(--display); font-weight: 800; font-size: 3rem; letter-spacing: 0.2em; }
.pre-wave { display: flex; gap: 5px; height: 28px; align-items: flex-end; }
.pre-wave i { width: 4px; height: 100%; background: var(--signal); transform-origin: bottom; animation: bar 0.9s ease-in-out infinite alternate; }
.pre-wave i:nth-child(2) { animation-delay: -0.2s; } .pre-wave i:nth-child(3) { animation-delay: -0.5s; } .pre-wave i:nth-child(4) { animation-delay: -0.1s; } .pre-wave i:nth-child(5) { animation-delay: -0.7s; }
@keyframes bar { from { transform: scaleY(0.2); } to { transform: scaleY(1); } }

/* Disposición: globo a la izquierda, panel a la derecha, reproductor abajo */
.app { display: grid; grid-template-columns: 1fr var(--panel-w); height: calc(100% - var(--player-h) * var(--has-player, 0)); transition: height 0.4s var(--ease); }
body.playing { --has-player: 1; }
.globe-wrap { position: relative; min-width: 0; overflow: hidden; cursor: crosshair; }
#globe { position: absolute; inset: 0; }
.hint { position: absolute; left: 28px; top: 26px; display: flex; align-items: center; gap: 10px; padding: 9px 14px; border: 1px solid var(--line); background: rgba(6, 8, 11, 0.6); font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); pointer-events: none; transition: opacity 0.5s; }
.hint.is-hidden { opacity: 0; }
.blink { width: 7px; height: 7px; background: var(--signal); animation: blink 1.4s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.coords { position: absolute; left: 28px; bottom: 24px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; color: var(--signal); pointer-events: none; }

/* Panel */
.panel { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--panel); }
.brand { padding: 26px 26px 18px; border-bottom: 1px solid var(--line); }
.brand h1 { font-family: var(--display); font-weight: 800; font-size: 3.2rem; line-height: 0.9; letter-spacing: 0.14em; }
.brand p { margin-top: 8px; font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; color: var(--muted); }
.brand #total { color: var(--signal); }
.search { display: flex; margin: 18px 26px 0; border: 1px solid var(--line); background: var(--bg); transition: border-color 0.25s; }
.search:focus-within { border-color: var(--signal); }
.search input { flex: 1; min-width: 0; padding: 13px 14px; border: 0; background: transparent; outline: none; }
.search input::placeholder { color: #5f6b78; }
.search button { width: 48px; border: 0; border-left: 1px solid var(--line); background: transparent; font-size: 18px; cursor: pointer; transition: background-color 0.2s, color 0.2s; }
.search button:hover, .search button:focus-visible { background: var(--signal); color: var(--bg); outline: none; }
.genres { display: flex; flex-wrap: wrap; gap: 6px; padding: 14px 26px 18px; border-bottom: 1px solid var(--line); }
.genres button { padding: 7px 11px; border: 1px solid var(--line); background: transparent; font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); cursor: pointer; transition: all 0.2s; }
.genres button:hover { color: var(--text); border-color: rgba(232, 237, 242, 0.35); }
.genres button.is-on { background: var(--signal); border-color: var(--signal); color: var(--bg); }
.genres button:focus-visible { outline: 1px solid var(--signal); outline-offset: 2px; }
.results-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 16px 26px 10px; }
#results-title { font-family: var(--display); font-weight: 600; font-size: 1.5rem; letter-spacing: 0.04em; line-height: 1.1; }
#results-count { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; }
.results { list-style: none; flex: 1; min-height: 0; overflow-y: auto; padding: 0 14px 18px; scrollbar-width: thin; scrollbar-color: #26303b transparent; }
.results li { animation: rise 0.4s var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.station { position: relative; width: 100%; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; transition: background-color 0.2s; }
.station:hover, .station:focus-visible { background: var(--panel-2); outline: none; }
.station.is-playing { background: var(--signal-dim); box-shadow: inset 2px 0 0 var(--signal); }
.st-logo { width: 40px; height: 40px; display: grid; place-items: center; overflow: hidden; background: var(--panel-2); font-family: var(--display); font-weight: 800; font-size: 1.1rem; color: var(--signal); }
.st-logo img { width: 100%; height: 100%; object-fit: cover; }
.st-name { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }
.st-meta { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.st-flag { font-size: 1.3rem; line-height: 1; }
.empty, .loading { padding: 18px 12px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.loading::after { content: ''; display: inline-block; width: 6px; height: 12px; margin-left: 6px; background: var(--signal); animation: blink 0.8s steps(2) infinite; vertical-align: -1px; }

/* Reproductor */
.player[hidden] { display: none; }
.player { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; height: var(--player-h); display: flex; align-items: center; gap: 18px; padding: 0 24px; border-top: 1px solid var(--line); background: var(--panel); animation: up 0.4s var(--ease); }
@keyframes up { from { transform: translateY(100%); } }
.play { flex: none; width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid var(--signal); background: var(--signal); cursor: pointer; transition: background-color 0.2s; }
.play:hover, .play:focus-visible { background: transparent; outline: none; }
.play .ico { width: 14px; height: 16px; background: var(--bg); clip-path: polygon(0 0, 35% 0, 35% 100%, 0 100%, 0 0, 65% 0, 100% 0, 100% 100%, 65% 100%, 65% 0); }
.play:hover .ico, .play:focus-visible .ico { background: var(--signal); }
.play.is-paused .ico { clip-path: polygon(0 0, 100% 50%, 0 100%); }
.now { min-width: 0; flex: 1; }
.now-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; font-size: 1.05rem; }
.now-meta { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.eq { display: flex; gap: 3px; align-items: flex-end; height: 22px; }
.eq i { width: 3px; height: 100%; background: var(--signal); transform-origin: bottom; animation: bar 0.7s ease-in-out infinite alternate; }
.eq i:nth-child(2) { animation-delay: -0.3s; } .eq i:nth-child(3) { animation-delay: -0.6s; } .eq i:nth-child(4) { animation-delay: -0.15s; } .eq i:nth-child(5) { animation-delay: -0.45s; }
body:not(.is-sounding) .eq i { animation-play-state: paused; transform: scaleY(0.15); }
.vol input { width: 120px; accent-color: var(--signal); }

/* Aviso */
.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(var(--player-h) + 18px); max-width: calc(100% - 32px); padding: 11px 16px; border: 1px solid var(--warm); background: var(--panel); font-family: var(--mono); font-size: 13px; color: var(--warm); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.3s var(--ease); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.credit { position: fixed; z-index: 5; left: 28px; bottom: calc(var(--player-h) * var(--has-player, 0) + 54px); font-family: var(--mono); font-size: 11px; color: #56616d; }
.credit a { color: var(--muted); }

/* Celular: globo arriba, panel abajo */
@media (max-width: 860px) {
    body { overflow: auto; }
    .app { grid-template-columns: 1fr; grid-template-rows: 52vh auto; height: auto; min-height: 100%; }
    .globe-wrap { height: 52vh; }
    .panel { border-left: 0; border-top: 1px solid var(--line); padding-bottom: calc(var(--player-h) * var(--has-player, 0)); }
    .results { overflow: visible; }
    .hint { left: 14px; top: 14px; }
    .coords { left: 14px; bottom: 12px; }
    .credit { position: static; padding: 14px 26px 22px; background: var(--panel); }
    .vol { display: none; }
    .player { padding: 0 14px; gap: 12px; }
    .brand h1 { font-size: 2.6rem; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .preloader { display: none; }
}
/* los nombres largos se recortan sin ensanchar la página */
.station > span:nth-child(2) { min-width: 0; }
.panel, .results, .results li { min-width: 0; }
@media (max-width: 860px) { body { overflow-x: hidden; } }

/* Ajustes de la letra nueva: Syncopate es ancha, va más chica y espaciada */
.pre-word { font-weight: 700; font-size: 2.2rem; letter-spacing: 0.3em; }
.brand h1 { font-weight: 700; font-size: 2.3rem; letter-spacing: 0.24em; line-height: 1; }
#results-title { font-weight: 700; font-size: 0.95rem; letter-spacing: 0.08em; text-transform: uppercase; line-height: 1.35; }
.st-logo { font-weight: 700; font-size: 0.85rem; color: var(--bg); background: var(--signal); }
.st-name { font-weight: 600; font-size: 15.5px; }
.now-name { font-weight: 600; }
.genres button, .hint, .brand p, .coords, .st-meta, .now-meta, .credit, .toast, #results-count, .search input::placeholder { font-weight: 300; }
.genres button { font-size: 10.5px; }
.station.is-playing { box-shadow: inset 3px 0 0 var(--signal); }
.play .ico { background: var(--bg); }
.search input { font-family: var(--sans); font-size: 15px; }
@media (max-width: 860px) { .brand h1 { font-size: 1.9rem; } }
