* { box-sizing: border-box; }

body {
  --radio-bg: #f4f4f4;
  --radio-surface: #ffffff;
  --radio-surface-muted: #f8fafc;
  --radio-border: #dbe3ea;
  --radio-text: #222222;
  --radio-muted: #64748b;
  --radio-accent: #0077b5;
  --radio-panel: #ffffff;
  --radio-summary: #e8f0f5;
  --radio-hover: #e8f4fb;
  --radio-logo: #eef2f5;
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--radio-text);
  background: var(--radio-bg);
  font-family: system-ui, -apple-system, sans-serif;
  transition: background .2s ease, color .2s ease;
}

body.dark-mode {
  --radio-bg: #121212;
  --radio-surface: #181818;
  --radio-surface-muted: #242424;
  --radio-border: #333333;
  --radio-text: #ffffff;
  --radio-muted: #a1a1aa;
  --radio-accent: #38a9df;
  --radio-panel: #222222;
  --radio-summary: #2a2a2a;
  --radio-hover: #333333;
  --radio-logo: #1a1a1a;
}

body.dark-mode > header,
body.dark-mode > footer { border-color: var(--radio-border); background: var(--radio-surface); }
.radio-app { display: flex; flex: 1 1 auto; min-height: 520px; }
body.site-chrome-hidden > header,
body.site-chrome-hidden > footer { display: none; }
body.site-chrome-hidden .radio-app { min-height: 100vh; }
.radio-app { padding: 0; }
.radio-app + footer { margin-top: 0; }
#sidebar { width: 350px; border-right: 1px solid var(--radio-border); display: flex; flex-direction: column; background: var(--radio-surface); }
.sidebar-header { padding: 15px; border-bottom: 1px solid var(--radio-border); }
.header-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.header-title h2 { margin: 0; font-size: 1.2rem; }
.theme-button { color: var(--radio-muted); font-size: 1.1rem; background: transparent; border: 0; cursor: pointer; padding: 2px 4px; }
.theme-button:hover { color: var(--radio-accent); }
#searchInput { width: 100%; padding: 10px 12px; border: 1px solid var(--radio-border); border-radius: 6px; background: var(--radio-surface-muted); color: var(--radio-text); font-size: .95rem; outline: none; }
#searchInput:focus { border-color: var(--radio-accent); }
.status { color: var(--radio-muted); font-size: .85rem; margin-top: 7px; }
#station-container { flex: 1; overflow-y: auto; padding: 10px; }

#main { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; }
#main h1, #main h2 { color: var(--radio-text); text-align: center; }
#main h1 { margin-bottom: 20px; }
#main h2 { margin: 18px 0 5px; font-size: 1.15rem; }
.player-stage { position: relative; width: 100%; max-width: 900px; aspect-ratio: 16 / 9; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 30px; background: linear-gradient(145deg, #073b4c, #0077b5); border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,.35); overflow: hidden; }
.radio-art { color: rgba(255,255,255,.9); font-size: clamp(4rem, 10vw, 8rem); }
audio { width: min(90%, 620px); }
.fullscreen-button { position: absolute; top: 12px; right: 12px; z-index: 2; color: #fff; background: rgba(0,0,0,.65); border: 1px solid rgba(255,255,255,.35); border-radius: 6px; cursor: pointer; padding: 8px 10px; opacity: 0; transition: opacity .2s ease, background .2s ease; }
.player-stage:hover .fullscreen-button, .player-stage:focus-within .fullscreen-button { opacity: 1; }
.fullscreen-button:hover { background: var(--radio-accent); }
.station-details { margin: 0; color: var(--radio-muted); text-align: center; }

details { margin-bottom: 8px; background: var(--radio-panel); border-radius: 4px; overflow: hidden; }
summary { padding: 10px 12px; font-weight: 600; cursor: pointer; background: var(--radio-summary); user-select: none; display: flex; align-items: center; gap: 8px; }
summary:hover { background: var(--radio-hover); }
.country-code { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 18px; border-radius: 3px; color: var(--radio-accent); border: 1px solid currentColor; font-size: .62rem; font-weight: 700; }
.station-item { width: 100%; padding: 8px 12px; border: 0; border-bottom: 1px solid var(--radio-border); color: var(--radio-text); background: transparent; cursor: pointer; display: flex; align-items: center; gap: 10px; text-align: left; font: inherit; font-size: .9em; }
.station-item:hover, .station-item:focus-visible { background: var(--radio-hover); color: var(--radio-accent); outline: none; }
.logo-container { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; border-radius: 4px; background: var(--radio-logo); color: var(--radio-muted); }
.station-logo { width: 100%; height: 100%; object-fit: contain; }
.station-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { padding: 15px; color: var(--radio-muted); text-align: center; }

@media (hover: none) { .fullscreen-button { opacity: .9; } }
@media (max-width: 700px) {
  .radio-app { height: auto; min-height: 100vh; flex-direction: column; }
  #sidebar { display: contents; }
  .sidebar-header { display: contents; }
  .header-title { order: 1; width: 100%; padding: 15px; margin: 0; background: var(--radio-surface); border-bottom: 1px solid var(--radio-border); }
  #main { order: 2; min-height: 0; padding: 8px 12px 10px; }
  #main h1 { margin: 0 0 8px; font-size: 1.5rem; }
  #main h2 { font-size: 1rem; }
  #searchInput { order: 3; width: calc(100% - 24px); margin: 8px 12px 0; }
  .status { order: 4; margin: 6px 16px 0; }
  #station-container { order: 5; width: 100%; min-height: 260px; max-height: 42vh; background: var(--radio-surface); border-bottom: 1px solid var(--radio-border); }
  .player-stage { max-width: 100%; gap: 14px; }
  .radio-art { font-size: clamp(3rem, 12vw, 5rem); }
  .station-item { min-height: 44px; }
  .country-code { font-size: .72rem; }
  .fullscreen-button { padding: 10px 12px; }
}