:root {
  --accent: #22c55e;
  --accent-dim: rgba(34, 197, 94, 0.14);
  --accent-glow: rgba(34, 197, 94, 0.45);
  --font: 'Space Mono', 'Courier New', monospace;
}

:root[data-theme="dark"] {
  --bg: #060807;
  --bg-panel: #0b0e0c;
  --bg-panel-2: #0f1310;
  --bg-input: #101511;
  --border: #1c231e;
  --border-strong: #2a352d;
  --text: #d8e2da;
  --text-dim: #6d7a70;
  --text-faint: #3c463f;
  --dot: rgba(216, 226, 218, 0.06);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  --scan: rgba(255, 255, 255, 0.015);
}

:root[data-theme="light"] {
  --bg: #eef1ee;
  --bg-panel: #f7f9f7;
  --bg-panel-2: #eef2ee;
  --bg-input: #e7ece8;
  --border: #d3dad4;
  --border-strong: #b7c2b9;
  --text: #17201a;
  --text-dim: #5c6a5f;
  --text-faint: #9aa89d;
  --dot: rgba(23, 32, 26, 0.08);
  --shadow: 0 30px 80px rgba(23, 32, 26, 0.12);
  --scan: rgba(0, 0, 0, 0.012);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  color-scheme: dark;
}

:root[data-theme="light"] html,
:root[data-theme="light"] {
  color-scheme: light;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px 12px 48px;
  transition: background 0.35s ease, color 0.35s ease;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, var(--scan) 0 1px, transparent 1px 3px);
  z-index: 1;
}

.station {
  position: relative;
  width: 100%;
  max-width: 720px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 14px 14px;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.station.on {
  opacity: 1;
  transform: translateY(0);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.wordmark {
  display: block;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chip {
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.14em;
  padding: 7px 14px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

a.chip {
  color: var(--text-dim);
}

.chip:hover {
  color: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 12px var(--accent-dim);
}

a.chip.chip-link {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

a.chip.chip-link:hover {
  box-shadow: 0 0 14px var(--accent-glow);
}

.chip-sm {
  padding: 5px 10px;
}

.theme-toggle {
  display: flex;
  border: 1px solid var(--border-strong);
}

.theme-toggle button {
  font-family: var(--font);
  font-size: 10px;
  letter-spacing: 0.14em;
  padding: 7px 13px;
  background: transparent;
  color: var(--text-dim);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-toggle button.active {
  background: var(--text);
  color: var(--bg);
}

.hero {
  padding: 44px 22px 30px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  transition: max-height 0.45s ease, padding 0.45s ease, opacity 0.35s ease;
  max-height: 420px;
}

.hero.hidden-hero {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  border-bottom-width: 0;
}

.clock-canvas {
  width: min(420px, 86%);
  display: block;
  margin: 0 auto;
}

.hero-day {
  margin-top: 22px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.28em;
}

.hero-date {
  margin-top: 8px;
  font-size: 10px;
  letter-spacing: 0.34em;
  color: var(--text-dim);
}

.onair {
  margin-top: 18px;
  font-size: 10px;
  letter-spacing: 0.3em;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.onair-dot,
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.8); }
}

.player {
  padding: 16px 22px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel-2);
}

.player-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.player-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.eq {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 22px;
  flex-shrink: 0;
}

.eq span {
  width: 4px;
  background: var(--accent);
  height: 4px;
  transition: height 0.15s ease;
}

.eq.playing span {
  animation: eqbar 0.9s ease-in-out infinite;
}

.eq.playing span:nth-child(1) { animation-delay: 0s; }
.eq.playing span:nth-child(2) { animation-delay: 0.18s; }
.eq.playing span:nth-child(3) { animation-delay: 0.36s; }
.eq.playing span:nth-child(4) { animation-delay: 0.1s; }
.eq.playing span:nth-child(5) { animation-delay: 0.28s; }

@keyframes eqbar {
  0%, 100% { height: 5px; }
  35% { height: 20px; }
  65% { height: 10px; }
}

.player-track {
  min-width: 0;
  max-width: 100%;
}

.player-title {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(300px, 62vw);
}

.player-status {
  margin-top: 3px;
  font-size: 9px;
  letter-spacing: 0.26em;
  color: var(--accent);
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.pbtn {
  font-family: var(--font);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pbtn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 12px var(--accent-dim);
}

.pbtn:active {
  transform: scale(0.92);
}

.pbtn-main {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.pbtn-main:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #04140a;
}

.pbtn-like.liked {
  color: var(--accent);
  border-color: var(--accent);
}

.vol {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
}

.vol-label {
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 84px;
  height: 2px;
  background: var(--border-strong);
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.player-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.ptime {
  font-size: 10px;
  color: var(--text-dim);
  min-width: 34px;
}

.ptime:last-child {
  text-align: right;
}

.pbar {
  flex: 1;
  height: 3px;
  background: var(--border);
  cursor: pointer;
  position: relative;
}

.pbar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
  transition: width 0.25s linear;
}

.queue {
  border-bottom: 1px solid var(--border);
}

.queue-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 22px;
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}

.queue-list {
  list-style: none;
  max-height: 230px;
  overflow-y: auto;
}

.queue-empty {
  padding: 18px 22px;
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-faint);
  overflow-wrap: anywhere;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 22px;
  font-size: 11px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
  animation: rowin 0.35s ease both;
  min-width: 0;
}

@keyframes rowin {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

.queue-item:hover {
  background: var(--accent-dim);
}

.queue-item .qi-num {
  width: 16px;
  color: var(--text-faint);
  flex-shrink: 0;
}

.queue-item .qi-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 34%);
  align-items: baseline;
  gap: 14px;
  min-width: 0;
  width: 100%;
}

.queue-item .qi-name {
  min-width: 0;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.queue-item .qi-artist {
  min-width: 0;
  color: var(--text-dim);
  font-size: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.queue-item.current {
  background: var(--accent-dim);
  border-left-color: var(--accent);
}

.queue-item.current .qi-num {
  color: var(--accent);
}

.queue-item.current .qi-name {
  color: var(--accent);
}

.live-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel-2);
}

.live-id {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.live-tag {
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--accent);
}

.chat {
  min-height: 220px;
  max-height: 380px;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.msg {
  max-width: 88%;
  min-width: 0;
  animation: msgin 0.35s ease both;
}

@keyframes msgin {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg-meta {
  font-size: 8px;
  letter-spacing: 0.26em;
  color: var(--text-faint);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.msg-dj {
  align-self: flex-start;
}

.msg-dj .msg-body {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.msg-avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.msg-bubble {
  padding: 10px 13px;
  font-size: 11.5px;
  line-height: 1.65;
  border: 1px solid var(--border);
  background: var(--bg-input);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.msg-user {
  align-self: flex-end;
  text-align: right;
}

.msg-user .msg-meta {
  justify-content: flex-end;
}

.msg-user .msg-bubble {
  background: var(--accent-dim);
  border-color: var(--border-strong);
  text-align: left;
}

.msg-tracks {
  margin-top: 10px;
  margin-left: 38px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: calc(100% - 38px);
  min-width: 0;
}

.track-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  cursor: pointer;
  width: min(320px, 100%);
  max-width: 100%;
  min-width: 0;
  transition: all 0.18s ease;
  animation: msgin 0.4s ease both;
}

.track-card:hover {
  border-color: var(--accent);
  transform: translateX(3px);
}

.track-card .tc-icon {
  color: var(--text-dim);
  font-size: 10px;
  width: 12px;
  flex-shrink: 0;
}

.track-card .tc-name {
  display: block;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.track-card .tc-artist {
  display: block;
  font-size: 9px;
  color: var(--text-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.track-card .tc-copy {
  min-width: 0;
  flex: 1;
}

.track-card.active {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 14px var(--accent-dim);
}

.track-card.active .tc-icon {
  color: var(--accent);
}

.track-card.active .tc-name {
  color: var(--accent);
}

.thinking {
  padding: 10px 22px;
  font-size: 9px;
  letter-spacing: 0.26em;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 9px;
  border-top: 1px solid var(--border);
}

.dots i {
  font-style: normal;
  animation: blink 1.2s infinite;
}

.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }

@keyframes blink {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

.chat-input {
  display: flex;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--bg-panel-2);
}

.chat-input input[type="text"] {
  flex: 1;
  font-family: var(--font);
  font-size: 12px;
  padding: 11px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-strong);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.chat-input input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 14px var(--accent-dim);
}

.chat-input input::placeholder {
  color: var(--text-faint);
}

.ibtn {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-family: var(--font);
  background: var(--bg-input);
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.18s ease;
}

.ibtn:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.ibtn.rec {
  color: #ef4444;
  border-color: #ef4444;
  animation: pulse 1s infinite;
}

.ibtn-send {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.ibtn-send:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #04140a;
}

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 22px;
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--text-faint);
}

.statusbar-mid {
  color: var(--text-faint);
  overflow: hidden;
  white-space: nowrap;
  max-width: 50%;
}

.conn {
  transition: color 0.3s ease;
}

.conn-on {
  color: var(--accent);
}

.conn-off {
  color: #ef4444;
}

.boot {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 14px 14px;
  transition: opacity 0.6s ease;
}

.boot.off {
  opacity: 0;
  pointer-events: none;
}

.boot-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
}

.boot-btn {
  font-family: var(--font);
  font-size: 12px;
  letter-spacing: 0.3em;
  padding: 15px 34px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  transition: all 0.25s ease;
}

.boot-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 30px var(--accent-dim);
}

.boot-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  animation: pulse 1.4s infinite;
}

.boot-sub {
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--text-faint);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.profile-card {
  position: relative;
  width: 100%;
  max-width: 430px;
  background: var(--bg-panel);
  border: 1px solid var(--border-strong);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 14px 14px;
  padding: 34px 30px 26px;
  box-shadow: var(--shadow);
  animation: cardin 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

@keyframes cardin {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  font-family: var(--font);
  font-size: 18px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
}

.modal-close:hover {
  color: var(--accent);
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 18px;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 24px var(--accent-dim);
}

.profile-tagline {
  margin-top: 6px;
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--accent);
}

.profile-bio {
  margin-top: 22px;
  font-size: 11px;
  line-height: 2;
  color: var(--text-dim);
}

.profile-sep {
  margin: 22px 0;
  border-top: 1px dashed var(--border-strong);
}

.profile-stats {
  display: flex;
  gap: 40px;
}

.pstat-label {
  font-size: 8px;
  letter-spacing: 0.3em;
  color: var(--text-faint);
}

.pstat-value {
  margin-top: 7px;
  font-size: 17px;
  font-weight: 700;
}

.profile-genres {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.genre-pill {
  font-size: 9px;
  letter-spacing: 0.14em;
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  border-radius: 999px;
  transition: all 0.2s ease;
}

.genre-pill:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.profile-wave {
  width: 100%;
  margin-top: 18px;
  display: block;
}

.profile-foot {
  margin-top: 14px;
  text-align: center;
  font-size: 8px;
  letter-spacing: 0.3em;
  color: var(--text-faint);
}

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  padding: 11px 20px;
  font-size: 10px;
  letter-spacing: 0.2em;
  background: var(--bg-panel);
  border: 1px solid var(--accent);
  color: var(--accent);
  box-shadow: 0 0 24px var(--accent-dim);
  animation: msgin 0.3s ease both;
}

::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

@media (max-width: 560px) {
  body {
    padding: 0;
  }
  .station {
    border-left: none;
    border-right: none;
  }
  .topbar {
    padding: 16px;
    gap: 14px;
    flex-wrap: wrap;
  }
  .topbar-right {
    width: 100%;
    justify-content: space-between;
  }
  .player-top {
    flex-direction: column;
    align-items: flex-start;
  }
  .player-controls {
    width: 100%;
  }
  .queue-item .qi-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
  }
  .queue-item .qi-artist {
    text-align: left;
  }
  .msg {
    max-width: 96%;
  }
  .msg-tracks {
    margin-left: 0;
    max-width: 100%;
  }
  .vol input[type="range"] {
    width: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
}
