:root {
  --accent: #a04730;
  --header-tint: #f3ebe3;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #202527;
  background: #faf9f7;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #34708a; outline-offset: 3px; }
.site-header { background: var(--header-tint); border-bottom: 1px solid #e1d5c9; }
.header-inner {
  max-width: 740px; min-height: 72px; margin: auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.brand { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: -7px; }
.brand img { display: block; width: 30px; height: 30px; }
.station-picker { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 0 18px; }
.selected-station { font-size: 14px; color: #566165; }
.station-picker a { display: inline-flex; align-items: center; min-height: 44px; color: #215e76; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.station-picker a:hover { color: #17485b; }

.page { width: min(100% - 48px, 692px); margin: 0 auto; min-height: calc(100vh - 145px); }
h1, h2, h3, p { margin-top: 0; }
.welcome-view { padding: 44px 0 40px; }
.welcome-view h1 { margin-bottom: 10px; font-size: clamp(28px, 5vw, 34px); line-height: 1.2; font-weight: 650; }
.welcome-view > p { color: #566165; font-size: 17px; line-height: 1.5; margin-bottom: 28px; }
.station-list { position: relative; padding-left: 20px; border-top: 1px solid #dedfda; border-left: 1px solid #ddd2c6; }
.station-list::before { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 6px; background: repeating-linear-gradient(to bottom, transparent 0 11px, #e2d9cf 11px 12px); pointer-events: none; }
.station-item::before { content: ""; position: absolute; left: -20px; top: 38px; width: 11px; border-top: 1px solid #c9b5a6; pointer-events: none; }
.station-item { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 18px; border-bottom: 1px solid #dedfda; }
.station-item-main { min-width: 0; min-height: 76px; padding: 12px 0; display: flex; align-items: center; gap: 20px; }
.station-item-frequency { color: var(--accent); flex: 0 0 66px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 19px; text-align: right; font-variant-numeric: tabular-nums; }
.station-item-frequency small { display: block; margin-top: 3px; color: #647075; font: 11px -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.station-item-label { min-width: 0; }
.station-item-name { display: block; width: fit-content; font-size: 18px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #a4aaa8; }
.station-item-main:hover .station-item-name { text-decoration-color: currentColor; }
.station-item-place { display: block; margin-top: 4px; color: #647075; font-size: 14px; }
.station-item-links { display: flex; gap: 18px; font-size: 14px; white-space: nowrap; }
.station-item-links a, .station-links a { color: #215e76; text-decoration: underline; text-underline-offset: 3px; }
.station-item-links a { padding: 12px 0; }
.station-item-links a:hover, .station-links a:hover { color: #17485b; }
.station-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 14px 0 0; border-top: 1px solid #dedfda; color: #667175; }
.station-heading h2 { font-size: 14px; font-weight: 500; margin: 0; }
.station-heading p { font-size: 13px; margin: 0; }
.station-links { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-left: auto; font-size: 13px; }
.station-links a { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 0; }
.notice { margin-bottom: 20px; padding: 10px 0 10px 14px; border-left: 2px solid #a65b36; color: #654e23; font-size: 14px; line-height: 1.5; }
.now-card { padding: 36px 0 20px; }
.now-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.now-top > p { color: var(--accent); margin: 0; font-size: 16px; font-weight: 500; }
.connection-status { display: inline-flex; align-items: center; gap: 6px; color: #566165; font-size: 13px; }
.connection-status.live { color: #3d7054; }
.antenna { width: 30px; height: 28px; flex: 0 0 auto; }
.radio-wave { opacity: .2; }
.live .radio-wave { animation: broadcast 2.4s ease-in-out infinite; }
.live .wave-far { animation-delay: .35s; }
@keyframes broadcast { 0%, 100% { opacity: .2; } 45%, 65% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .live .radio-wave { animation: none; opacity: 1; }
}
.now-card .notice { margin-top: 16px; margin-bottom: 0; }
.connection-status.offline, .connection-status.error { color: #945032; }
.current-title { margin: 23px 0 7px; font-size: clamp(30px, 5vw, 40px); line-height: 1.15; font-weight: 650; overflow-wrap: anywhere; }
.current-artist { margin: 0 0 20px; font-size: clamp(20px, 3vw, 24px); color: #566165; overflow-wrap: anywhere; }
.current-artist:empty { display: none; }
.now-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 24px; }
.song-link, .favorite-button { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; }
.favorite-button { padding: 0; border: 0; background: none; color: #215e76; }
.favorite-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.favorite-button[aria-pressed="true"] { color: var(--accent); }
.favorite-icon { margin-right: 7px; font-size: 22px; line-height: 1; }
.update-row { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-top: 12px; color: #687276; font-size: 13px; }
.text-button { min-height: 44px; padding: 8px 0; border: 0; background: none; color: #215e76; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.text-button:disabled { color: #839196; cursor: default; }
.history-section { padding: 32px 0; }
.history-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 12px; }
.search-state { font-size: 14px; color: #667175; overflow-wrap: anywhere; }
.history-heading h2 { margin: 0; font-size: 21px; font-weight: 600; }
.history-count { margin-left: 4px; color: #687276; font-size: 15px; font-weight: 400; }
.filter-button { min-height: 44px; padding: 7px 0; border: 0; background: none; color: #215e76; font-size: 14px; white-space: nowrap; }
.filter-button:hover { text-decoration: underline; }
.filter-button[aria-pressed="true"] { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.history-list { border-top: 1px solid #dedfda; }
.history-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 44px; align-items: center; gap: 17px; min-height: 76px; padding: 12px 0; border-bottom: 1px solid #dedfda; }
.track-cell { min-width: 0; }
.track-name { font-size: 16px; font-weight: 600; overflow-wrap: anywhere; line-height: 1.45; }
.track-artist { margin: 4px 0 0; color: #667175; font-size: 14px; overflow-wrap: anywhere; line-height: 1.45; }
.track-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 16px; }
.song-link, .history-spotify { display: inline-flex; align-items: center; justify-content: center; width: 44px; min-height: 44px; flex: 0 0 44px; text-decoration: none; }
.spotify-icon { display: block; width: 24px; height: 24px; }
.song-link:hover .spotify-icon, .history-spotify:hover .spotify-icon { filter: brightness(.55); }
.time-cell { color: #687276; font-size: 13px; white-space: nowrap; }
.row-actions { display: flex; justify-content: flex-end; }
.icon-button { width: 44px; height: 44px; border: 0; background: none; color: #687276; font-size: 24px; line-height: 1; }
.icon-button:hover, .icon-button[aria-pressed="true"] { color: var(--accent); }
.history-empty { padding: 30px 0; border-top: 1px solid #dedfda; color: #687276; }
.history-empty h3 { margin-bottom: 5px; color: #202527; font-size: 17px; }
.history-empty p { margin: 0; font-size: 14px; line-height: 1.5; }
.history-footer { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 15px; color: #687276; font-size: 13px; }
.more-tools { margin-top: 12px; padding-top: 15px; border-top: 1px solid #dedfda; }
.more-tools summary { width: fit-content; min-height: 32px; color: #215e76; font-size: 14px; cursor: pointer; }
.more-tools-body { display: grid; gap: 9px; padding: 15px 0 3px; max-width: 330px; }
.more-tools-body label { font-size: 14px; }
.more-tools-body input { height: 44px; padding: 0 12px; border: 1px solid #bfc4c3; border-radius: 3px; background: transparent; color: #202527; }
.more-tools-body .text-button { width: fit-content; margin-top: 7px; }
.site-footer { width: min(100% - 48px, 692px); margin: 0 auto; padding: 20px 0 28px; border-top: 1px solid #dedfda; color: #667175; font-size: 13px; }
@media (max-width: 540px) {
  .header-inner { min-height: 68px; padding: 0 20px; }
  .station-picker { gap: 0 12px; }
  .selected-station { font-size: 13px; }
  .page, .site-footer { width: min(100% - 40px, 692px); }
  .welcome-view { padding-top: 32px; }
  .station-item { grid-template-columns: 1fr; gap: 0; padding: 4px 0; }
  .station-item::before { top: 35px; }
  .station-item-main { padding-bottom: 4px; min-height: 63px; gap: 16px; }
  .station-item-frequency { flex-basis: 60px; }
  .station-item-links { margin-left: 76px; gap: 20px; }
  .now-card { padding-top: 28px; }
  .station-links { flex-basis: 100%; margin-left: 0; }
  .history-section { padding-top: 26px; }
  .history-heading { gap: 9px; }
  .history-heading h2 { font-size: 20px; }
  .history-row { grid-template-columns: minmax(0, 1fr) 44px; gap: 8px; }
  .track-cell { grid-column: 1; grid-row: 1; }
  .track-meta { grid-column: 1; grid-row: 2; }
  .row-actions { grid-column: 2; grid-row: 1 / 3; }
}

.time-help { margin-top: 12px; line-height: 1.5; }
.time-help summary { cursor: pointer; width: fit-content; padding: 6px 0; }
.time-help p { margin: 8px 0 0; max-width: 560px; }
