:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #13171a;
  --card: #1a1e22;
  --ink: #f4f4f2;
  --muted: #a1a8ae;
  --accent: #c7f36b;
  --accent-ink: #161d0c;
  --line: #ffffff12;
  --gutter: clamp(16px, 4vw, 40px);
  font-family: system-ui, 'Malgun Gothic', sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { border: 0; background: transparent; cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(26px, 5vw, 34px); letter-spacing: -.04em; }
h2 { font-size: 20px; letter-spacing: -.035em; }
p, small { color: var(--muted); }
.shell { width: min(100%, 1000px); margin: auto; min-height: 100dvh; }
.legal { max-width: 720px; padding: 26px var(--gutter) 44px; }
.legal h1 { margin: 12px 0 26px; }
.legal p { line-height: 1.65; }
.country-controls { display: grid; gap: 12px; margin: 14px 0 24px; }
.country-controls h2, .dialog-stack h3 { margin: 0 0 8px; font-size: 1rem; }
.country-region { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.country-region select { max-width: min(65vw, 320px); color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 9px; padding: 7px; font: inherit; }
.station-facts { display: grid; gap: 6px; margin: 0; }
.station-facts div { display: grid; grid-template-columns: 60px minmax(0, 1fr); gap: 6px; }
.station-facts dt { color: var(--muted); }
.station-facts dd { margin: 0; overflow-wrap: anywhere; }
.station-map { width: 100%; height: clamp(290px, 47svh, 520px); border-radius: 16px; overflow: hidden; background: var(--panel); }
#map-status { margin: 10px 0; font-size: .88rem; }
#map-selected { margin: 14px 0; }
.topbar {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  padding: env(safe-area-inset-top) var(--gutter) 0;
  background: var(--bg);
}
.brand { width: clamp(76px, 22vw, 112px); flex: none; line-height: 0; }
.brand img { width: 100%; height: 36px; object-fit: contain; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button, .chip {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 30px;
  background: var(--panel);
  color: var(--muted);
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}
.chips button[aria-pressed="true"], .chip[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.topbar .chips { flex-wrap: nowrap; }
.icon-button { width: 44px; height: 44px; padding: 0; display: inline-grid; place-items: center; flex: none; border-radius: 50%; color: var(--muted); }
.topbar .settings { min-width: 44px; min-height: 44px; aspect-ratio: 1; }
.topbar .settings svg { display: block; width: 24px; height: 24px; aspect-ratio: 1; }
.icon-button:hover, .quiet:hover { color: var(--ink); background: var(--card); }
.icon-button[aria-pressed="true"] { color: var(--accent); }
.icon-button[aria-pressed="true"] svg { fill: currentColor; }
.install-shortcuts { padding: 4px var(--gutter) 10px; }
.install-shortcuts button { display: block; width: 100%; min-height: 44px; padding: 11px 16px; border: 1px solid var(--line); border-radius: 12px; background: #c7f167; color: #000; font-size: 13px; font-weight: 650; text-align: center; }
.install-shortcuts button:hover { filter: brightness(.94); }
main { padding: 6px var(--gutter) calc(160px + env(safe-area-inset-bottom)); }
.page > section, .page > div > section { margin: 20px 0 32px; }
.section-heading { display: flex; gap: 8px; justify-content: space-between; align-items: end; margin-bottom: 10px; }
.eyebrow { display: block; margin-bottom: 6px; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: .13em; }
.quiet { min-height: 40px; padding: 6px 9px; border-radius: 8px; color: var(--muted); font-size: 13px; flex: none; }
.primary { min-height: 44px; padding: 8px 17px; border-radius: 28px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.row { display: flex; min-width: 0; gap: 2px; align-items: center; }
.row-main { display: flex; min-width: 0; gap: 13px; align-items: center; flex: 1; text-align: left; min-height: 72px; padding: 5px 4px 5px 0; border-radius: 8px; }
.row-main:hover { background: var(--panel); }
.row-text { min-width: 0; display: grid; gap: 5px; }
.row-text strong, .row-text small, .mini-open strong, .mini-open small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-text small { font-size: 13px; }
.program-description { color: var(--muted); font-size: 13px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
[data-translated="true"]::after { content: " · 자동 번역"; color: var(--accent); font-size: .9em; }
[data-original-description] summary { cursor: pointer; color: var(--accent); }
.row.active .row-text strong { color: var(--accent); }
.art { position: relative; isolation: isolate; overflow: hidden; display: grid; place-items: center; flex: none; width: 53px; aspect-ratio: 1; border-radius: 9px; color: white; background: linear-gradient(145deg, var(--tone-a), var(--tone-b)); }
.art::before { content: ""; position: absolute; z-index: -1; width: 95%; aspect-ratio: 1; border: 1px solid #ffffff44; border-radius: 50%; top: -30%; right: -25%; box-shadow: 0 0 0 8px #ffffff0d, 0 0 0 17px #ffffff10; }
.art img { width: 100%; height: 100%; position: absolute; object-fit: contain; background: var(--panel); }
.tone-0 { --tone-a: #ed7c68; --tone-b: #49234c; }
.tone-1 { --tone-a: #efbd59; --tone-b: #b75735; }
.tone-2 { --tone-a: #37c19e; --tone-b: #125667; }
.tone-3 { --tone-a: #6182dc; --tone-b: #523185; }
.status-box { padding: 22px 14px; border-radius: 10px; background: var(--panel); color: var(--muted); }
.status-box button { margin-top: 6px; }
.country-grid, .mix-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.country-tile { display: flex; text-align: left; align-items: center; gap: 10px; min-height: 63px; padding: 8px 12px; border-radius: 12px; background: var(--panel); font-weight: 650; }
.country-tile svg { width: 15px; margin-left: auto; color: var(--muted); }
.flag { font-size: 23px; flex: none; }
.mix-tile { display: grid; align-content: end; gap: 5px; text-align: left; position: relative; isolation: isolate; overflow: hidden; min-height: 124px; padding: 14px; border-radius: 12px; color: white; background: linear-gradient(145deg, var(--tone-a), var(--tone-b) 85%); }
.mix-tile::before { content: ""; position: absolute; z-index: -1; inset: -60% -20% 30% 55%; border-radius: 50%; background: #ffffff22; }
.mix-tile small { color: #fff; }
.mix-tile b { font-size: 21px; }
.search-box { display: flex; align-items: center; gap: 8px; border-radius: 10px; background: var(--panel); padding: 4px 8px 4px 12px; }
.search-box label { display: flex; color: var(--accent); }
.search-box input { min-width: 0; flex: 1; border: 0; background: none; min-height: 44px; }
input:not([type="range"]), select { padding: 8px; }
.filter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.filter-grid label { display: grid; gap: 6px; min-width: 0; color: var(--muted); font-size: 13px; }
.filter-grid input, .filter-grid select, .field { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); min-width: 0; min-height: 40px; }
.field { display: block; width: 100%; margin-top: 8px; }
.dock { position: fixed; z-index: 3; inset: auto 0 0; max-width: 1000px; margin: auto; background: var(--bg); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav { display: flex; min-height: 62px; background: var(--panel); }
.bottom-nav a { flex: 1; display: grid; justify-items: center; align-content: center; gap: 5px; font-size: 12px; color: var(--muted); }
.bottom-nav a[aria-current="page"] { color: var(--accent); font-weight: 750; }
.mini-player { display: flex; align-items: center; gap: 2px; padding: 5px var(--gutter); border-bottom: 1px solid var(--line); }
.mini-open { flex: 1; min-width: 0; display: flex; text-align: left; align-items: center; gap: 11px; padding: 0; }
.mini-open > span + span { min-width: 0; display: grid; gap: 3px; }
.mini-open .art { width: 40px; }
[data-action="toggle"] { background: var(--accent); color: var(--accent-ink); }
[data-action="toggle"]:hover { background: var(--accent); color: var(--accent-ink); filter: brightness(.9); }
dialog { width: min(calc(100% - 28px), 560px); max-height: calc(100dvh - 28px); padding: 18px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); background: var(--panel); }
dialog::backdrop { background: #000b; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.dialog-header .eyebrow { margin: 0; text-align: center; }
.country-picker[open] { display: flex; flex-direction: column; height: min(760px, calc(100dvh - 32px)); padding: 24px 18px 18px; }
.panel-brand { display: none; }
.country-picker .dialog-header { position: relative; flex: none; flex-direction: column; justify-content: center; gap: 10px; min-height: 88px; padding: 12px 26px; margin-bottom: 16px; }
.country-picker .panel-brand { display: block; width: 136px; height: 40px; object-fit: contain; }
.country-picker #dialog-title { color: #fff; text-align: center; font-size: 15px; font-weight: 500; letter-spacing: -.02em; line-height: 1.5; word-break: keep-all; }
.country-picker .dialog-header > button { position: absolute; right: -8px; top: -16px; width: 44px; height: 44px; }
.country-picker #dialog-content { display: flex; flex: 1; min-height: 0; }
.country-picker #preferences-form { flex: 1; min-width: 0; min-height: 0; grid-template-rows: auto minmax(0, 1fr) auto; gap: 16px; }
.country-picker #preferences-form:has(.chips) { grid-template-rows: auto auto minmax(0, 1fr) auto; }
.country-picker #preference-query { margin: 0; min-height: 44px; }
.country-picker #preference-countries { max-height: none; min-height: 0; align-content: start; overscroll-behavior: contain; padding-right: 4px; }
.country-picker #preference-countries label { min-height: 44px; padding: 6px 8px; border-radius: 8px; font-size: 15px; }
.country-picker #preference-countries label:has(input:checked) { background: #c7f16712; color: #c7f167; }
.country-picker #preferences-form > .primary { width: 100%; background: #c7f167; color: #000; }
.dialog-stack { display: grid; gap: 14px; }
.dialog-stack .chips button { background: var(--card); }
.dialog-stack .chips button[aria-pressed="true"] { background: var(--accent); }
.check-list { display: grid; gap: 3px; max-height: 224px; overflow: auto; }
.check-list label, .setting { display: flex; gap: 9px; align-items: center; min-height: 40px; }
.setting { justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.setting select { background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
input[type="checkbox"], input[type="range"] { accent-color: var(--accent); }
.detail-link { color: var(--accent); text-decoration: underline; width: fit-content; }
#player { width: min(calc(100% - 16px), 480px); background: var(--bg); }
#player-art .art { width: min(100%, 338px, 44dvh); margin: 4px auto 20px; font-size: 64px; border-radius: 18px; }
.player-track { display: flex; gap: 10px; align-items: start; justify-content: space-between; }
.player-track h2 { overflow-wrap: anywhere; }
.player-track p { margin-top: 4px; font-size: 13px; }
.player-controls { display: flex; align-items: center; justify-content: center; gap: 24px; padding: 10px 0 4px; }
.player-controls [data-action="toggle"] { width: 58px; height: 58px; }
.output-control { display: block; margin: 4px auto 0; }
.output-options { display: grid; gap: 4px; }
.signal { display: flex; align-items: center; gap: 4px; height: 36px; padding: 0 4px; color: var(--accent); }
.signal i { flex: 1; max-width: 5px; height: var(--height); border-radius: 6px; background: currentColor; opacity: .35; }
#player[data-playing="true"] .signal i { animation: signal 1.4s ease-in-out infinite alternate; animation-delay: var(--delay); }
#episode-position { width: 100%; margin: 14px 0 0; }
@keyframes signal { to { transform: scaleY(.45); opacity: .9; } }
.toast:not(:empty) { position: fixed; z-index: 4; bottom: calc(120px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); width: max-content; max-width: 90%; border-radius: 20px; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); }
@media (max-width: 365px) {
  .topbar { gap: 5px; }
  .topbar .chips button { padding-inline: 8px; }
  .row .icon-button { width: 39px; }
}
@media (max-width: 480px) {
  :lang(ja) .topbar { gap: 6px; }
  :lang(ja) .topbar .brand { width: 76px; }
  :lang(ja) .topbar .chips { gap: 4px; }
  :lang(ja) .topbar .chips button { padding-inline: 8px; font-size: 12px; }
}
@media (max-width: 365px) {
  :lang(ja) .topbar { gap: 4px; }
  :lang(ja) .topbar .brand { width: 64px; }
  :lang(ja) .topbar .chips button { padding-inline: 6px; font-size: 11px; }
}
@media (min-width: 700px) {
  .country-grid, .mix-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .filter-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  #player[data-playing="true"] .signal i { animation: none; }
}
