:root {
  --bg: #070a12;
  --bg-soft: #0b101d;
  --ink: #eef3ff;
  --ink-dim: #93a1bd;
  --ink-faint: #63708a;
  --line: #1d2638;
  --line-soft: #161e2c;
  --accent: #6fe3c4;
  --accent-deep: #27b393;
  --warm: #f0a66a;
  --panel: #080c15;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: #1f7f6c; color: #fff; }

.app {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 372px;
}

/* ---------- stage ---------- */

.stage {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 26px 32px 18px;
  background:
    radial-gradient(900px 520px at 18% 8%, #132039 0%, transparent 62%),
    radial-gradient(700px 520px at 88% 100%, #0f1a2c 0%, transparent 60%),
    var(--bg);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 13px; min-width: 0; }

.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.brand-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid #2f4a63;
}
.brand-ring::before, .brand-ring::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 1px solid #21384e;
}
.brand-ring::after { inset: 10px; border-color: #3f6f7c; }
.brand-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px 2px #6fe3c455;
}

.brand-text h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.brand-text p {
  margin: 2px 0 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
}
.brand-text .sep { margin: 0 7px; color: #33415a; }

.search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(420px, 100%);
  padding: 0 6px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0a1120;
  transition: border-color 160ms ease;
}
.search:focus-within { border-color: #35526b; }
.search svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--ink-faint);
  stroke-width: 1.7;
  stroke-linecap: round;
}
.search input {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: 0;
  background: none;
  outline: none;
  font-size: 13px;
}
.search input::placeholder { color: #4d5a72; }
.search button {
  height: 28px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: #1a2a3d;
  color: #cfe4f5;
  font-size: 12px;
}

/* ---------- map ---------- */

.map-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 18px 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#map {
  width: 100%;
  height: 100%;
  max-height: 100%;
  display: block;
  overflow: visible;
  touch-action: manipulation;
}

.land {
  fill: #101a2a;
  stroke: #1c2c42;
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
}
.grid-line {
  stroke: #14203180;
  stroke-width: 0.6;
  fill: none;
}

.dot {
  cursor: pointer;
  transition: fill 140ms ease;
  fill: #3f8f8f;
}
.dot-hit {
  fill: transparent;
  cursor: pointer;
}
.dot-group:hover .dot, .dot-group:focus-visible .dot { fill: var(--accent); }
.dot-group.is-active .dot { fill: var(--accent); }
.dot-group.is-active .halo { opacity: 0.6; }
.halo {
  fill: none;
  stroke: #6fe3c4;
  stroke-width: 1;
  opacity: 0;
  transition: opacity 180ms ease;
}
.dot-group:hover .halo { opacity: 0.45; }
.dot-label {
  fill: #8fa3c0;
  font-size: 7.5px;
  letter-spacing: 0.03em;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
}
.dot-group:hover .dot-label, .dot-group.is-active .dot-label { opacity: 1; }
.dot-group:focus { outline: none; }

.map-vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, #070a12 100%);
  opacity: 0.85;
}

.map-hint {
  position: absolute;
  left: 50%;
  bottom: 2px;
  transform: translateX(-50%);
  margin: 0;
  font-size: 11px;
  color: var(--ink-faint);
  white-space: nowrap;
  pointer-events: none;
}
.map-hint.is-hidden { opacity: 0; transition: opacity 300ms ease; }

.map-legend {
  position: absolute;
  right: 2px;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 10.5px;
  color: var(--ink-faint);
  letter-spacing: 0.04em;
  pointer-events: none;
}
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px #6fe3c466;
}

.tooltip {
  position: absolute;
  z-index: 5;
  padding: 7px 11px;
  border: 1px solid #26374d;
  border-radius: 8px;
  background: #0c1524f2;
  color: #dbe7f6;
  font-size: 12px;
  line-height: 1.35;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -130%);
  transition: opacity 120ms ease;
  white-space: nowrap;
  box-shadow: 0 10px 26px #00000059;
}
.tooltip.is-on { opacity: 1; }
.tooltip b { font-weight: 600; }
.tooltip em { font-style: normal; color: var(--accent); }

/* ---------- chips ---------- */

.chips {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding-top: 8px;
}
.chips-label {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: #4f5d76;
  margin-right: 4px;
  text-transform: uppercase;
}
.chip {
  height: 28px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0a1120;
  color: #9fb0c9;
  font-size: 12px;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}
.chip:hover { border-color: #2b3e56; color: #d8e7f6; }
.chip[aria-pressed="true"] {
  border-color: #2f6a63;
  background: #0d2624;
  color: var(--accent);
}

/* ---------- panel ---------- */

.panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #0a0f1a, #070b13 40%);
}

.now { padding: 22px 22px 16px; border-bottom: 1px solid var(--line-soft); }
.now-head { display: flex; align-items: center; justify-content: space-between; }

.now-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.now-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #41506a;
  transition: background 160ms ease, box-shadow 160ms ease;
}
.now-status.is-live i {
  background: var(--accent);
  box-shadow: 0 0 0 0 #6fe3c466;
  animation: pulse 2s ease-out infinite;
}
.now-status.is-loading i { background: var(--warm); animation: pulse 1.2s ease-out infinite; }
.now-status.is-error i { background: #d9695f; }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 #6fe3c459; }
  70% { box-shadow: 0 0 0 7px #6fe3c400; }
  100% { box-shadow: 0 0 0 0 #6fe3c400; }
}
@media (prefers-reduced-motion: reduce) {
  .now-status.is-live i, .now-status.is-loading i { animation: none; }
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8fa0ba;
  transition: color 140ms ease, background 140ms ease;
}
.icon-btn:hover { color: #e6f1fb; background: #131d2c; }
.icon-btn svg, .play-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn .fill, .play-btn .i-play path { fill: currentColor; stroke: none; }
.fav-btn svg { width: 18px; height: 18px; }
.fav-btn[aria-pressed="true"] { color: var(--accent); }
.fav-btn[aria-pressed="true"] svg path { fill: currentColor; stroke: currentColor; }

.now-country {
  margin: 18px 0 0;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--accent-deep);
  text-transform: uppercase;
  min-height: 16px;
}
.now-name {
  margin: 6px 0 0;
  font-size: 24px;
  line-height: 1.24;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.now-meta {
  margin: 7px 0 0;
  font-size: 12px;
  color: var(--ink-dim);
  min-height: 18px;
}

.transport {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 18px;
}
.play-btn {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 6px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #051513;
  transition: transform 120ms ease, background 160ms ease;
}
.play-btn:hover { background: #86f0d3; }
.play-btn:active { transform: scale(0.96); }
.play-btn .i-play path { fill: #051513; }
.play-btn .i-pause path { stroke: #051513; stroke-width: 2.2; }
.play-btn .i-pause { display: none; }
.play-btn.is-playing .i-play { display: none; }
.play-btn.is-playing .i-pause { display: block; }
.play-btn.is-loading { background: #1a3d38; color: var(--accent); }
.play-btn svg { width: 22px; height: 22px; }

.shuffle-btn { margin-left: auto; }

.volume { display: flex; align-items: center; gap: 2px; margin-left: 6px; }
.volume input {
  width: 74px;
  height: 22px;
  accent-color: var(--accent-deep);
  background: transparent;
}
.volume .i-muted { display: none; }
.volume.is-muted .i-muted { display: block; }
.volume.is-muted > .icon-btn > svg:not(.i-muted) { display: none; }

.notice {
  margin: 10px 0 0;
  min-height: 16px;
  font-size: 11.5px;
  color: #d59b6d;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 18px 0;
  border-bottom: 1px solid var(--line-soft);
}
.tabs button {
  position: relative;
  height: 32px;
  padding: 0 10px;
  border: 0;
  background: none;
  color: #6d7c94;
  font-size: 12.5px;
}
.tabs button[aria-selected="true"] { color: #e9f3fd; }
.tabs button[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 1px;
  background: var(--accent);
}

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 22px 8px;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}
.list-head span:first-child { color: #b7c7dc; font-size: 12px; letter-spacing: 0; }

.station-list {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0 12px 12px;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #24344a transparent;
}
.station-list::-webkit-scrollbar { width: 8px; }
.station-list::-webkit-scrollbar-thumb { background: #1c2939; border-radius: 8px; }

.station-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  text-align: left;
  transition: background 120ms ease;
}
.station-item:hover { background: #0f1826; }
.station-item.is-current { background: #0f2321; }
.station-item.is-current .station-name { color: var(--accent); }

.station-index {
  font-size: 10.5px;
  color: #43516a;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.station-item.is-current .station-index { color: var(--accent-deep); }

.station-main { min-width: 0; }
.station-name {
  display: block;
  font-size: 13px;
  color: #dfeaf7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.station-sub {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: #63718a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.station-tag {
  font-size: 10px;
  letter-spacing: 0.04em;
  color: #5b6a83;
  white-space: nowrap;
}

.list-empty {
  margin: 18px 12px;
  padding: 18px;
  border: 1px dashed #1d2a3b;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.7;
  color: #6b7a93;
}

.panel-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 22px 14px;
  border-top: 1px solid var(--line-soft);
  font-size: 10px;
  color: #44516a;
}

.skeleton {
  height: 40px;
  margin: 4px 10px;
  border-radius: 8px;
  background: linear-gradient(90deg, #0e1624 25%, #14202f 50%, #0e1624 75%);
  background-size: 220% 100%;
  animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

/* ---------- narrow ---------- */

@media (max-width: 940px) {
  body { overflow: auto; }
  .app { display: block; height: auto; min-height: 100%; }
  .stage { padding: 20px 18px 10px; min-height: 0; display: block; }
  .map-wrap { display: block; margin: 10px 0 12px; min-height: 0; }
  .map-hint { display: none; }
  .map-legend { position: static; justify-content: space-between; width: 100%; margin-top: 6px; flex-wrap: wrap; gap: 4px 14px; }
  #map { width: 100%; height: auto; aspect-ratio: 1000 / 500; min-height: 0; }
  .panel {
    border-left: 0;
    border-top: 1px solid var(--line-soft);
    max-height: none;
  }
  .station-list { max-height: 44svh; }
  .search { width: 100%; margin-left: 0; order: 3; }
  .topbar { gap: 14px; }
}

@media (max-width: 520px) {
  .stage { padding: 16px 12px 8px; }
  .brand-text h1 { font-size: 17px; }
  .brand-text p { font-size: 10px; }
  .chips { gap: 6px; }
  .chip { height: 26px; padding: 0 10px; font-size: 11.5px; }
  .chips-label { width: 100%; margin: 0 0 2px; }
  .now-name { font-size: 21px; }
  .volume input { width: 56px; }
  .panel-foot span:last-child { display: none; }
  .tooltip { font-size: 11px; }
  .dot-label { display: none; }
}
