:root {
  --bg: #0f1115; --panel: #171a21; --line: #262a33; --fg: #f2f3f5; --muted: #9aa1ad;
  --accent: #e8b84a; --accent-fg: #1a1400; --radius: 14px; --pad: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.app { min-height: 100dvh; display: flex; flex-direction: column; padding-bottom: env(safe-area-inset-bottom); }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px var(--pad); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand span { display: flex; flex-direction: column; min-width: 0; }
.brand strong { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logo { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: var(--panel); }
.onair { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: .08em; color: var(--muted); }
.onair i { width: 8px; height: 8px; border-radius: 50%; background: #e5484d; box-shadow: 0 0 0 0 rgba(229,72,77,.6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(229,72,77,0); } 100% { box-shadow: 0 0 0 0 rgba(229,72,77,0); } }

/* player */
.player { flex: 1; display: flex; flex-direction: column; gap: 14px; padding: 4px var(--pad) 24px; max-width: 560px; width: 100%; margin: 0 auto; }
.cover { margin: 0; position: relative; aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--panel); box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.cover img { width: 100%; height: 100%; object-fit: cover; transition: opacity .4s; }
.cover img.swap { opacity: 0; }
.badge { position: absolute; left: 12px; top: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(15,17,21,.75); backdrop-filter: blur(6px); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.now { text-align: center; min-height: 64px; }
.now h1 { margin: 0; font-size: 22px; line-height: 1.2; font-weight: 700; }
.now p { margin: 4px 0 0; }
.muted { color: var(--muted); font-size: 14px; }

.controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; }
.play { width: 72px; height: 72px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; box-shadow: 0 10px 30px rgba(232,184,74,.35); transition: transform .1s; }
.play:active { transform: scale(.95); }
.play svg { width: 34px; height: 34px; fill: currentColor; display: none; }
.app[data-state="paused"] .ic-play, .app[data-state="loading"] .ic-play, .app[data-state="error"] .ic-play { display: block; }
.app[data-state="playing"] .ic-pause { display: block; }
.app[data-state="buffering"] .ic-wait { display: block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.side { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px; border-radius: 12px; background: var(--panel); text-align: left; }
.side:disabled { opacity: .45; cursor: default; }
.side img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--line); flex: none; }
.side span { display: flex; flex-direction: column; min-width: 0; }
.side small { color: var(--muted); font-size: 11px; }
.side b { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#nextBtn { flex-direction: row-reverse; text-align: right; }

/* tabs + panels */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-top: 6px; }
.tab { padding: 10px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 14px; }
.tab.is-active { color: var(--fg); border-color: var(--accent); }
.panel { display: none; }
.panel.is-active { display: block; }

.lyrics-head { display: flex; justify-content: flex-end; margin: 8px 0; }
.lang { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.lang select { font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; max-width: 200px; }
.lyrics { margin: 0; white-space: pre-wrap; font: inherit; font-size: 16px; line-height: 1.6; color: #d9dce2; min-height: 80px; }
.lyrics:empty::before { content: attr(data-empty); color: var(--muted); }
details { margin-top: 14px; color: var(--muted); font-size: 14px; }
details summary { cursor: pointer; color: var(--fg); }
details p { white-space: pre-wrap; }

.list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.list li { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; background: var(--panel); }
.list img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--line); flex: none; }
.list .t { min-width: 0; flex: 1; }
.list .t b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .t small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list time { color: var(--muted); font-size: 12px; flex: none; }
.list li.clickable { cursor: pointer; }

.weather { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.weather .w { flex: 1 1 140px; padding: 10px 12px; border-radius: 12px; background: var(--panel); }
.weather .w b { font-size: 22px; }
.weather .w small { display: block; color: var(--muted); }

.foot { padding: 12px var(--pad) 18px; text-align: center; color: var(--muted); font-size: 12px; }

@media (min-width: 720px) {
  .player { max-width: 640px; }
  .now h1 { font-size: 26px; }
}

/* reactions */
.react { display: flex; justify-content: center; gap: 14px; margin-top: 10px; }
.react button { width: 40px; height: 40px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; color: var(--muted); }
.react button svg { width: 20px; height: 20px; fill: currentColor; }
.react button.is-on { color: var(--accent); background: rgba(232,184,74,.15); }

/* forms */
.form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.form input, .form textarea { font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.form input:focus, .form textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.form .invalid { border-color: #e5484d; }
.form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form .check { flex-direction: row; align-items: flex-start; gap: 10px; color: var(--fg); }
.form .check input { width: 20px; height: 20px; margin-top: 1px; }
.picks { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px 12px; margin: 0; }
.picks legend { font-size: 13px; color: var(--muted); padding: 0 4px; }
.picklist { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: auto; }
.picklist label { flex-direction: row; align-items: center; gap: 10px; color: var(--fg); font-size: 14px; }
.picklist input { width: 18px; height: 18px; }
.btn { align-self: flex-start; padding: 12px 22px; border-radius: 999px; background: var(--accent); color: var(--accent-fg); font-weight: 700; }
.btn:disabled { opacity: .5; }
.formMsg { margin: 0; font-size: 14px; min-height: 1.2em; }
.formMsg.ok { color: #46c27a; }
.formMsg.err { color: #e5484d; }

/* pages */
.page { line-height: 1.6; color: #d9dce2; }
.page h1 { font-size: 22px; }
.page h2 { font-size: 18px; margin-top: 24px; }
.page a { color: var(--accent); text-decoration: underline; }
.footlinks { display: block; margin-top: 6px; }
.footlinks a { color: var(--muted); text-decoration: underline; }
