:root {
  color-scheme: dark;
  --bg: #050507;
  --shell: #09090c;
  --panel: #121217;
  --panel-2: #18181f;
  --panel-3: #22222b;
  --text: #f7f7fb;
  --muted: #9ca0ad;
  --soft: #636a7c;
  --accent: #6366f1;
  --accent-2: #8b5cf6;
  --green: #34d399;
  --rose: #fb7185;
  --blue: #60a5fa;
  --border: #272733;
  --danger: #fb7185;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--panel-2);
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0;
}

button:active {
  transform: scale(0.985);
}

button.primary,
.play-button {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.shell {
  position: relative;
  display: flex;
  width: 100%;
  min-height: 100vh;
  overflow: hidden;
  background: var(--shell);
}

.sidebar {
  display: none;
  width: 260px;
  flex: 0 0 260px;
  border-right: 1px solid var(--border);
  background: rgba(18, 18, 23, 0.96);
  padding: 24px 16px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 32px;
}

.brand-mark,
.cover {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 950;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  font-size: 13px;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1;
}

.brand p,
.side-nav p,
.eyebrow,
.section-title,
.label {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.brand p {
  margin-top: 4px;
}

.side-nav {
  display: grid;
  gap: 7px;
}

.side-nav p {
  margin: 18px 10px 4px;
}

.nav-button {
  width: 100%;
  justify-content: flex-start;
  min-height: 44px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  text-align: left;
  font-size: 14px;
}

.nav-button.active,
.mobile-nav-button.active {
  border-color: rgba(99, 102, 241, 0.24);
  background: rgba(99, 102, 241, 0.13);
  color: #bfc2ff;
}

.app {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  padding-bottom: 176px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid rgba(39, 39, 51, 0.72);
  background: rgba(5, 5, 7, 0.9);
  padding: 12px 16px;
}

.topbar h2 {
  margin: 3px 0 0;
  font-size: 23px;
  line-height: 1.1;
}

.connection-pill,
.pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(34, 34, 43, 0.72);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pill.playing {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.13);
  color: var(--green);
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.view {
  display: none;
  max-width: 1120px;
  margin: 0 auto;
}

.view.active {
  display: block;
}

.search-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 12px;
}

.search-panel input,
.assistant-controls input,
.filter-row select,
.settings-grid select,
.schedule select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(18, 18, 23, 0.92);
  color: var(--text);
  padding: 0 14px;
  outline: none;
}

.search-panel input:focus,
.assistant-controls input:focus,
.filter-row select:focus {
  border-color: rgba(99, 102, 241, 0.72);
}

.search-panel button {
  min-width: 96px;
  padding: 0 16px;
}

.assistant-card {
  display: grid;
  gap: 14px;
  border: 1px solid rgba(99, 102, 241, 0.28);
  border-radius: 26px;
  background: rgba(18, 18, 23, 0.9);
  padding: 16px;
  margin-bottom: 16px;
}

.assistant-results-card {
  border: 1px solid rgba(99, 102, 241, 0.24);
  border-radius: 24px;
  background: rgba(15, 15, 21, 0.86);
  padding: 14px;
  margin-bottom: 16px;
}

.assistant-result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: stretch;
  padding: 10px;
  margin-top: 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
  background: rgba(8, 8, 12, 0.76);
}

.assistant-result.live-match {
  border-color: rgba(52, 211, 153, 0.45);
  background: rgba(16, 185, 129, 0.08);
}

.assistant-result-main {
  min-height: 0;
  padding: 6px;
  border: 0;
  background: transparent;
  text-align: left;
}

.assistant-result-top {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.assistant-result-top strong {
  color: var(--text);
  font-size: 16px;
}

.assistant-result-top span {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 5px 8px;
  color: #c7c8ff;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.assistant-now {
  margin: 8px 0 5px;
  color: #f3f4f8;
  font-size: 13px;
  font-weight: 850;
}

.assistant-reason {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.assistant-controls {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 9px;
}

.assistant-controls button {
  min-width: 78px;
  border-radius: 999px;
  padding: 0 13px;
  font-size: 12px;
}

.filter-row,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 14px;
}

.section-title {
  color: #fff;
  font-size: 19px;
  text-transform: none;
}

.muted,
.tags {
  color: var(--muted);
}

.compact {
  margin: 5px 0 0;
  font-size: 13px;
}

.mini-button {
  width: auto;
  min-width: 86px;
  min-height: 36px;
  border-radius: 12px;
  padding: 0 12px;
  font-size: 12px;
}

.mini-button.active,
.eq-presets button.active {
  border-color: rgba(99, 102, 241, 0.65);
  background: rgba(99, 102, 241, 0.18);
  color: #c7c8ff;
}

.station-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.station-list {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.station-row {
  position: relative;
  width: 100%;
  min-height: 0;
  overflow: hidden;
  border-radius: 24px;
  background: rgba(18, 18, 23, 0.86);
}

.station-row > button.station-row {
  display: block;
  min-height: 92px;
  padding: 16px;
  border-radius: 24px;
  text-align: left;
  font-size: 16px;
}

.station-grid > .station-row > button.station-row {
  min-height: 154px;
  padding-top: 62px;
}

.station-grid > .station-row:before {
  content: "EV";
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: rgba(99, 102, 241, 0.18);
  color: #c7c8ff;
  font-size: 12px;
  font-weight: 950;
  z-index: 1;
}

.station-row:after {
  content: none;
}

.station-row span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.station-row.disabled {
  opacity: 0.55;
}

.station-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 0 10px 10px;
}

.station-actions button {
  min-height: 34px;
  border-radius: 12px;
  font-size: 11px;
}

.category-card,
.status-card,
.equalizer,
.settings-card,
.schedule,
.stats-panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: rgba(18, 18, 23, 0.82);
  padding: 16px;
  margin-bottom: 16px;
}

.category-card.blue {
  border-color: rgba(96, 165, 250, 0.2);
}

.category-card.violet {
  border-color: rgba(139, 92, 246, 0.22);
}

.category-card.green {
  border-color: rgba(52, 211, 153, 0.18);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.mode-grid button {
  min-height: 92px;
  border-radius: 22px;
  background: rgba(24, 24, 31, 0.92);
}

.mode-grid button.active {
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.15);
  color: #c7c8ff;
}

.hidden-mode-root {
  display: none;
}

.status-line,
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

#stationName {
  margin: 7px 0;
  font-size: 24px;
  line-height: 1.15;
}

.tags {
  margin: 10px 0;
  line-height: 1.35;
}

.stats {
  border-top: 1px solid var(--border);
  margin-top: 13px;
  padding-top: 13px;
  font-size: 14px;
}

.eq-presets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.eq-presets button {
  min-height: 38px;
  border-radius: 12px;
  font-size: 12px;
}

.eq-grid {
  display: grid;
  grid-template-columns: 46px repeat(10, minmax(22px, 1fr));
  gap: 5px;
  align-items: end;
  min-height: 245px;
  padding: 14px 8px 10px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(to bottom, transparent 0 19%, rgba(255, 255, 255, 0.1) 20%, transparent 21% 49%, rgba(255, 255, 255, 0.16) 50%, transparent 51% 79%, rgba(255, 255, 255, 0.1) 80%, transparent 81%),
    rgba(7, 7, 10, 0.54);
}

.eq-fader {
  min-width: 0;
  height: 214px;
  display: grid;
  grid-template-rows: 26px 150px 24px;
  justify-items: center;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.eq-preamp {
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  padding-right: 8px;
}

.eq-fader-track {
  position: relative;
  width: 18px;
  height: 150px;
  border-radius: 999px;
  background: linear-gradient(to bottom, #17181d, #0e0f13);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.eq-fader-track::before {
  content: "";
  position: absolute;
  left: -6px;
  right: -6px;
  top: 50%;
  height: 2px;
  background: rgba(255, 255, 255, 0.35);
}

.eq-slider {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 146px;
  height: 24px;
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center;
  accent-color: #ff3158;
}

.eq-slider::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
}

.eq-gain {
  color: #f2f3f7;
  text-align: center;
  font-size: 10px;
  line-height: 1.1;
  min-height: 22px;
}

.eq-label {
  color: #d9d9df;
  font-size: 12px;
  white-space: nowrap;
}

.library-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.library-tabs button {
  min-height: 42px;
  border-radius: 14px;
  font-size: 13px;
}

.library-tabs button.active {
  border-color: rgba(99, 102, 241, 0.55);
  background: rgba(99, 102, 241, 0.15);
  color: #c7c8ff;
}

.settings-card > button {
  width: 100%;
  margin-bottom: 9px;
}

.settings-card > button.active {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(52, 211, 153, 0.12);
  color: var(--green);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.stat-tile {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(5, 5, 7, 0.36);
  padding: 12px;
}

.stat-tile span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.stat-tile strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.message {
  position: fixed;
  right: 18px;
  bottom: 106px;
  z-index: 50;
  max-width: 420px;
  min-height: 22px;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(18, 18, 23, 0.92);
  color: var(--muted);
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.35;
}

.message.error {
  color: var(--danger);
}

.player {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 36;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(280px, 1.2fr) minmax(130px, 0.5fr);
  gap: 16px;
  align-items: center;
  min-height: 92px;
  border-top: 1px solid var(--border);
  background: rgba(18, 18, 23, 0.96);
  padding: 14px 18px;
}

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

.cover {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 17px;
}

.live-dot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 3px;
  color: var(--green);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.live-dot span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.player h3,
.player p {
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player h3 {
  font-size: 16px;
}

.player p {
  color: var(--muted);
  font-size: 12px;
}

.player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.icon-button {
  width: auto;
  min-width: 54px;
  border-radius: 999px;
  padding: 0 12px;
  font-size: 12px;
}

.play-button {
  width: 66px;
  height: 66px;
  min-height: 66px;
  border-radius: 50%;
  padding: 0;
}

.similar-button {
  min-height: 44px;
  border-radius: 999px;
  font-size: 12px;
}

.mobile-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 42;
  display: none;
  height: 74px;
  align-items: center;
  justify-content: space-around;
  border-top: 1px solid var(--border);
  background: rgba(5, 5, 7, 0.96);
  padding: 6px 6px max(6px, env(safe-area-inset-bottom));
}

.mobile-nav-button {
  width: auto;
  min-width: 72px;
  min-height: 48px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 16px;
  font-size: 11px;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(5, 5, 7, 0.94);
}

.login-overlay.visible {
  display: flex;
}

.login-box {
  width: 100%;
  max-width: 390px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--panel);
  padding: 20px;
}

.login-box h2 {
  margin: 0 0 18px;
  font-size: 26px;
}

.login-box label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-weight: 800;
}

.login-box input {
  width: 100%;
  min-height: 52px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #09090c;
  color: var(--text);
  padding: 0 12px;
}

.google-button-mount {
  min-height: 42px;
  margin: 10px 0;
}

@media (min-width: 860px) {
  .sidebar {
    display: block;
  }

  .app {
    padding-bottom: 98px;
  }

  .player {
    left: 260px;
  }
}

@media (max-width: 859px) {
  .shell {
    min-height: 100vh;
  }

  .app {
    padding-bottom: 170px;
  }

  .topbar {
    min-height: 62px;
  }

  .content {
    padding: 14px 12px;
  }

  .station-grid {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    margin-right: -12px;
    margin-left: -12px;
    padding: 0 12px 10px;
  }

  .station-grid > .station-row {
    width: 270px;
    flex: 0 0 270px;
    scroll-snap-align: center;
  }

  .filter-row,
  .assistant-controls,
  .assistant-result,
  .settings-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }

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

  .eq-presets {
    grid-template-columns: repeat(3, 1fr);
  }

  .player {
    right: 12px;
    bottom: 84px;
    left: 12px;
    grid-template-columns: 1fr auto;
    min-height: 68px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 22px;
    padding: 8px;
  }

  .player-controls {
    gap: 5px;
  }

  .player-controls .icon-button,
  .similar-button {
    display: none;
  }

  .play-button {
    width: 48px;
    height: 48px;
    min-height: 48px;
    font-size: 11px;
  }

  .cover {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    border-radius: 14px;
    font-size: 12px;
  }

  .mobile-nav {
    display: flex;
  }

  .message {
    right: 12px;
    bottom: 160px;
    left: 12px;
    max-width: none;
  }
}

@media (max-width: 380px) {
  .mobile-nav-button {
    min-width: 64px;
    font-size: 10px;
  }

  .station-grid > .station-row {
    width: 252px;
    flex-basis: 252px;
  }

  #stationName {
    font-size: 21px;
  }
}
