:root {
  --bg: #050505;
  --panel: #0d0d0d;
  --panel-2: #111111;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f3f3f3;
  --muted: rgba(255, 255, 255, 0.6);
  --soft: rgba(255, 255, 255, 0.04);
  --accent: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 28%),
    var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", sans-serif;
}

body {
  padding: 24px;
}

button,
select,
audio {
  font: inherit;
}

.shell {
  width: min(980px, 100%);
  margin: 0 auto;
  position: relative;
}

.mode-strip {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.mode-strip-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 11px;
}

.hero {
  padding: 10px 0 22px;
}

.brand,
.meta-label,
.meta-note,
.footer {
  color: var(--muted);
}

.brand,
.list-head,
.dial-chip,
.pill,
.meta-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
}

.hero h1 {
  margin: 10px 0 12px;
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(32px, 6vw, 56px);
  line-height: 0.96;
  max-width: 780px;
}

.intro {
  margin: 0;
  max-width: 700px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.control-panel,
.radio-card,
.radio-details {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--line);
  border-radius: 18px;
}

.control-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1.15fr) minmax(220px, 1fr) minmax(220px, 320px) 44px 44px;
  gap: 12px;
  align-items: end;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.picker,
.search-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  align-self: end;
}

.zone-card strong,
.picker select,
.player-copy strong {
  font-size: 17px;
}

.picker select,
.search-field input,
.locate-button {
  min-height: 44px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--text);
}

.picker select {
  padding: 0 12px;
}

.search-field input {
  width: 100%;
  padding: 0 14px;
}

.search-field .meta-label {
  transform: translateY(-2px);
  margin-left: 2px;
}

.search-field input::placeholder {
  color: var(--muted);
}

.locate-button {
  padding: 0 14px;
  background: var(--accent);
  color: #050505;
  font-weight: 600;
  cursor: pointer;
}

.player-text {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.mode-toggle {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    transform 0.2s ease;
}

.mode-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
}

.mode-toggle:active {
  transform: scale(0.98);
}

.mode-toggle.is-quick {
  background: var(--accent);
  color: #050505;
  border-color: var(--accent);
}

.mode-toggle-text {
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.04em;
}

#audio-player {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.custom-player {
  display: grid;
  grid-template-columns: 40px 40px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 44px;
  min-width: 0;
  padding: 5px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.03);
  align-self: end;
}

.player-button {
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 0;
}

.player-button {
  inline-size: 32px;
  block-size: 32px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.player-button:hover {
  background: rgba(255, 255, 255, 0.1);
}

.player-button:active {
  transform: scale(0.98);
}

.player-play-icon {
  inline-size: 0;
  block-size: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 10px solid currentColor;
  margin-left: 2px;
}

.custom-player[data-state="playing"] .player-play-icon {
  inline-size: 10px;
  block-size: 12px;
  border: 0;
  margin-left: 0;
  background:
    linear-gradient(
      90deg,
      currentColor 0,
      currentColor 3px,
      transparent 3px,
      transparent 7px,
      currentColor 7px,
      currentColor 10px
    );
}

.player-mute-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.player-mute-speaker {
  fill: currentColor;
  stroke: none;
}

.player-mute-slash {
  display: none;
}

.custom-player.is-muted .player-mute-wave {
  display: none;
}

.custom-player.is-muted .player-mute-slash {
  display: block;
}

.player-timeline {
  min-width: 0;
  overflow: hidden;
}

.player-status-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-width: 0;
}

.player-status-text {
  display: block;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.locate-icon {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 13px;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: end;
}

.settings-icon {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 13px;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: end;
}

.locate-svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-modal[hidden] {
  display: none;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(6px);
}

.settings-panel {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 24px));
  max-height: min(82vh, 760px);
  margin: 48px auto;
  padding: 18px;
  overflow: auto;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #121212, #0c0c0c);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.settings-head strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.settings-close {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.settings-text {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.settings-list {
  display: grid;
  gap: 8px;
}

.settings-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.settings-item {
  grid-template-columns: auto minmax(0, 1fr);
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.settings-item:active {
  cursor: grabbing;
}

.settings-item.is-dragging {
  opacity: 0.72;
  border-color: rgba(123, 178, 255, 0.45);
  background: rgba(123, 178, 255, 0.1);
}

.settings-item.is-target {
  border-color: rgba(123, 178, 255, 0.5);
  background: rgba(123, 178, 255, 0.08);
  transform: translateY(-1px);
}

.settings-handle {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  align-items: center;
  justify-content: center;
  width: 18px;
}

.settings-handle span {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
}

.settings-item strong {
  display: block;
  font-size: 15px;
}

.settings-item span {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.settings-moves {
  display: inline-flex;
  gap: 8px;
}

.settings-move {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.settings-move:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.settings-primary,
.settings-secondary {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font: inherit;
  cursor: pointer;
}

.settings-primary {
  background: var(--accent);
  color: #050505;
  font-weight: 600;
}

.settings-secondary {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.list-head {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 16px;
  padding: 0 10px 10px;
  color: var(--muted);
}

.current-zone-head {
  justify-self: end;
}

.radio-list {
  display: grid;
  gap: 10px;
}

.radio-card {
  overflow: hidden;
}

.radio-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.dial-chip {
  display: inline-flex;
  align-items: center;
  min-height: 50px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.radio-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.radio-name {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.radio-name strong {
  font-size: 18px;
}

.radio-zone {
  color: var(--muted);
  font-size: 13px;
}

.radio-sub {
  color: var(--muted);
  font-size: 13px;
}

.pill {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}

.radio-details {
  display: none;
  margin: 0 12px 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
}

.radio-card.open .radio-details {
  display: block;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.freq-box {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.freq-box.is-active {
  border-color: rgba(123, 178, 255, 0.5);
  background: rgba(123, 178, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(123, 178, 255, 0.1);
}

.freq-box.is-active .freq-city,
.freq-box.is-active .freq-value {
  color: var(--text);
}

.freq-box span {
  display: block;
}

.freq-city {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.freq-value {
  font-size: 15px;
  font-weight: 600;
}

.details-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.play-button,
.source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid var(--line);
}

.play-button {
  background: var(--accent);
  color: #050505;
  font-weight: 600;
  cursor: pointer;
}

.play-button[disabled] {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  cursor: not-allowed;
}

.source-link {
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}

.footer {
  padding: 18px 6px 8px;
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 820px) {
  body {
    padding: 14px;
  }

  .control-panel,
  .radio-toggle,
  .list-head {
    grid-template-columns: 1fr;
  }

  .control-panel {
    gap: 10px;
    padding: 12px;
  }

  .locate-button {
    width: 100%;
    min-width: 52px;
  }

  .custom-player {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 12px;
    padding: 10px 12px;
  }

  .mode-strip {
    justify-content: space-between;
    margin-bottom: 6px;
  }

  .search-field {
    order: 3;
  }

  .locate-icon {
    order: 4;
    width: 100%;
    min-width: 0;
    justify-self: stretch;
    margin-bottom: 0;
  }

  .settings-icon {
    order: 5;
    width: 100%;
    min-width: 0;
    justify-self: stretch;
  }

  .details-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  body {
    padding: 12px;
    padding-bottom: 12px;
  }

  .hero {
    padding: 8px 0 18px;
  }

  .hero h1 {
    margin: 8px 0 8px;
    font-size: clamp(28px, 12vw, 42px);
  }

  .intro {
    font-size: 14px;
  }

  .mode-strip {
    position: absolute;
    top: 6px;
    right: 4px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0;
    padding: 0;
    z-index: 3;
  }

  .mode-strip-label {
    display: none;
  }

  .mode-toggle {
    width: 36px;
    height: 36px;
  }

  .control-panel {
    grid-template-columns: minmax(0, 1fr) 44px 44px;
    gap: 10px;
    padding: 10px;
    border-radius: 18px;
    margin-bottom: 12px;
  }

  .player-copy strong {
    font-size: 16px;
  }

  .search-field input,
  .locate-button {
    min-height: 44px;
  }

  .custom-player {
    grid-column: 1 / -1;
    min-height: 44px;
    padding: 5px 8px;
    display: none;
  }

  .player-status-row {
    font-size: 9px;
  }

  .control-panel.has-active-player .custom-player {
    display: grid;
  }

  .player-copy {
    display: none;
  }

  .locate-icon {
    order: 2;
    width: 44px;
    min-width: 44px;
    height: 44px;
    justify-self: stretch;
  }

  .settings-icon {
    order: 3;
    width: 44px;
    min-width: 44px;
    height: 44px;
    justify-self: stretch;
  }

  .search-field {
    order: 1;
    grid-column: 1;
  }

  .search-field .meta-label {
    display: none;
  }

  .search-field input {
    min-height: 40px;
    padding: 0 12px;
    font-size: 14px;
  }

  .settings-panel {
    width: min(100vw - 16px, 560px);
    margin: 16px auto;
    padding: 14px;
    border-radius: 18px;
  }

  .settings-item {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .list-head {
    display: none;
  }

  .player-text,
  .radio-zone {
    font-size: 13px;
  }

  .details-grid {
    grid-template-columns: 1fr;
  }
}
