:root {
  color-scheme: dark;
  --bg: #2b2924;
  --panel: rgba(236, 228, 211, 0.09);
  --panel-strong: rgba(236, 228, 211, 0.16);
  --text: #f1eadc;
  --muted: #c4bbac;
  --accent: #c79b62;
  --accent-2: #d7c49a;
  --sepia-green: #8fa36d;
  --sepia-green-dark: #2f3a25;
  --danger: #ff6c7a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(210, 194, 158, 0.18), transparent 30rem),
    radial-gradient(circle at 82% 10%, rgba(116, 107, 93, 0.34), transparent 28rem),
    linear-gradient(135deg, #262520 0%, #3a352c 48%, #5b5345 100%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(520px, 1.18fr);
  gap: 28px;
  align-items: stretch;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 850px;
  margin-bottom: 16px;
  font-size: clamp(3rem, 9vw, 7.5rem);
  line-height: 0.88;
  letter-spacing: -0.08em;
}

.title-t {
  text-shadow: 1px 0 0 currentColor;
}

.jazz-figure {
  display: inline-block;
  width: clamp(42px, 5.6vw, 68px);
  height: clamp(38px, 5vw, 62px);
  margin-left: 0.08em;
  color: var(--text);
  transform: translateY(0.04em);
  transform-origin: 50% 90%;
  vertical-align: baseline;
}

.jazz-figure svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.music-note {
  opacity: 0.96;
}

.jazz-figure.playing {
  animation: note-sway 1.2s ease-in-out infinite alternate;
}

@keyframes note-sway {
  from {
    transform: rotate(-1.5deg) translateY(0.04em);
  }
  to {
    transform: rotate(2deg) translateY(0.01em);
  }
}

h2 {
  margin-bottom: 6px;
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.intro {
  max-width: 650px;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1.6;
}

.now-card,
.panel,
.tab-panel,
.station-card {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(20px);
}

.now-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 150px;
  grid-template-rows: minmax(96px, 1fr) auto;
  grid-column: 2;
  min-height: 150px;
  gap: 10px 22px;
  align-items: center;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  padding: 0;
}

.now-card::before {
  content: "";
  grid-column: 1 / -1;
  grid-row: 1;
  align-self: stretch;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
  background: rgba(0, 0, 0, 0.78);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(20px);
}

.top-actions {
  position: absolute;
  top: -12px;
  right: -12px;
  z-index: 10;
  display: grid;
  gap: 5px;
  padding: 4px;
}

.top-action {
  border-radius: 12px;
  background: linear-gradient(135deg, var(--sepia-green), #6f8251);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.44), 0 16px 42px rgba(0, 0, 0, 0.24);
  color: var(--sepia-green-dark);
  outline: 0;
  font-size: 0.76rem;
  line-height: 1;
  padding: 7px 10px;
}

.top-action.active {
  filter: brightness(1.12);
}

.station-meta,
.section-heading p,
.now-card small {
  color: var(--muted);
}

.now-copy {
  display: flex;
  flex-direction: column;
  grid-column: 1 / -1;
  grid-row: 2;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.78);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(20px);
  padding: 10px 18px 12px;
}

#nowPlaying {
  display: block;
  width: max-content;
  overflow: hidden;
  order: 2;
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  line-height: 1.15;
  white-space: nowrap;
}

#nowPlaying.running {
  padding-left: 100%;
}

#nowPlaying::after {
  content: none;
}

#nowPlaying.running {
  animation: title-ribbon 16.8s linear infinite;
}

#nowPlaying.running.paused {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .now-copy #nowPlaying {
    animation: none;
  }
}

@keyframes title-ribbon {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-100%);
  }
}

.now-copy small {
  display: block;
  order: 1;
  overflow: hidden;
  margin-bottom: 5px;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-controls {
  display: grid;
  grid-column: 1;
  grid-row: 1;
  z-index: 1;
  justify-items: center;
  gap: 12px;
  align-items: center;
  justify-content: center;
}

.transport-button,
.main-play-button,
.record-button {
  display: grid;
  place-items: center;
  border-radius: 999px;
  padding: 0;
}

.transport-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

.transport-button {
  width: 44px;
  height: 44px;
  background: transparent;
  color: #b3b3b3;
  font-size: 1.35rem;
}

.transport-button.muted {
  opacity: 0.72;
}

.main-play-button {
  width: 66px;
  height: 66px;
  background: var(--sepia-green);
  color: var(--sepia-green-dark);
  font-size: 1.6rem;
  line-height: 1;
}

.record-button {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
}

.record-button span {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #ff3b30;
  box-shadow: 0 0 14px rgba(255, 59, 48, 0.6);
}

.record-button.recording {
  background: rgba(255, 59, 48, 0.18);
}

.record-control {
  display: flex;
  grid-column: 1;
  grid-row: 1;
  z-index: 1;
  gap: 8px;
  align-items: center;
  align-self: end;
  justify-self: start;
  margin-bottom: 18px;
  margin-left: 18px;
}

.record-control > span {
  color: #b3b3b3;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1;
  transform: translateY(17px);
}

.live-row {
  display: grid;
  width: min(100%, 230px);
  grid-template-columns: auto minmax(130px, 1fr);
  gap: 14px;
  align-items: center;
  color: #1ed760;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.live-bar {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #4a4a4a;
}

.live-bar span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #1ed760;
  transition: width 90ms linear;
}

.volume-control {
  align-items: center;
  display: grid;
  grid-column: 2;
  grid-row: 1;
  z-index: 1;
  gap: 8px;
  align-self: end;
  justify-self: end;
  margin-right: 18px;
  margin-bottom: 18px;
  width: 150px;
  color: #b3b3b3;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

.volume-control span {
  font-size: 0.68rem;
  text-transform: none;
}

.volume-control input {
  height: 6px;
  border: 0;
  border-radius: 999px;
  accent-color: var(--sepia-green);
  background: transparent;
  padding: 0;
}

audio {
  display: none;
}

.controls {
  display: grid;
  grid-template-columns: 220px 220px 92px 104px;
  gap: 14px;
  align-items: end;
  margin: 0 0 14px;
}

.controls > label,
.controls > button {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  padding: 12px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(8, 11, 20, 0.72);
  color: var(--text);
  outline: none;
  padding: 14px 16px;
}

.controls select {
  width: 100%;
}

input:focus,
select:focus {
  border-color: var(--accent-2);
}

button {
  align-self: end;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--sepia-green), #6f8251);
  color: var(--sepia-green-dark);
  cursor: pointer;
  font-weight: 900;
  padding: 15px 20px;
}

.controls > button {
  align-self: stretch;
  background: linear-gradient(135deg, var(--sepia-green), #6f8251);
  color: var(--sepia-green-dark);
  display: grid;
  place-items: center;
}

button:hover {
  filter: brightness(1.06);
}

.panel {
  margin-top: 28px;
  border-radius: 28px;
  padding: 14px;
}

.quiet-button {
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  outline: 0;
  padding: 10px 16px;
}

.quiet-button {
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.tab-panel {
  border-radius: 22px;
  padding: 18px;
}

#historyPanel,
#favoritesPanel,
#playlistsPanel {
  margin-top: 10px;
}

.status {
  margin: 0 0 14px;
  color: var(--muted);
}

.recording-save-link {
  display: inline-block;
  margin-left: 6px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--sepia-green), #6f8251);
  color: var(--sepia-green-dark);
  font-weight: 900;
  padding: 7px 11px;
  text-decoration: none;
}

.hidden {
  display: none;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.history-header .status {
  margin: 0;
}

.history-header .quiet-button {
  align-self: center;
  padding: 8px 14px;
}

.playlist-form {
  display: grid;
  grid-template-columns: minmax(180px, 320px) auto;
  gap: 10px;
  margin-bottom: 16px;
}

.playlist-list {
  display: grid;
  gap: 14px;
}

.playlist-card {
  display: grid;
  gap: 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.04);
  padding: 14px;
}

.playlist-card.dragging {
  opacity: 0.58;
}

.playlist-card.drag-over {
  outline: 2px solid rgba(215, 196, 154, 0.72);
  outline-offset: 3px;
}

.playlist-card h3 {
  margin: 0;
}

.playlist-drag-handle {
  border-color: rgba(241, 234, 220, 0.24);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  cursor: grab;
}

.playlist-drag-handle:active {
  cursor: grabbing;
}

.playlist-name-input {
  max-width: 260px;
  padding: 10px 12px;
}

.playlist-header-actions {
  display: flex;
  gap: 8px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading p {
  margin-bottom: 4px;
}

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

.station-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-radius: 18px;
  padding: 14px;
}

.station-card:hover,
.station-card:focus-within {
  z-index: 30;
}

.station-card h3 {
  grid-column: 1;
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.25;
}

.station-meta {
  grid-column: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 0.86rem;
}

.played-at {
  flex-basis: 100%;
  font-size: 0.78rem;
}

.pill {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  padding: 5px 9px;
}

.station-actions {
  align-self: center;
  justify-self: end;
  grid-column: 2;
  grid-row: 1 / 3;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.play-button,
.favorite-button {
  align-self: center;
  background: rgba(105, 227, 210, 0.14);
  color: var(--accent-2);
  outline: 1px solid rgba(105, 227, 210, 0.28);
  padding: 11px 14px;
}

.favorite-button {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.playlist-menu {
  position: relative;
  z-index: 31;
}

.playlist-options {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 20;
  display: none;
  min-width: 180px;
  padding: 14px 8px 8px;
  border-radius: 14px;
  background: rgba(16, 24, 34, 0.96);
  outline: 1px solid rgba(105, 227, 210, 0.22);
  box-shadow: var(--shadow);
}

.playlist-menu:hover .playlist-options,
.playlist-menu:focus-within .playlist-options {
  display: grid;
  gap: 6px;
}

.playlist-options button {
  width: 100%;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 9px 10px;
  text-align: left;
}

.empty,
.error {
  grid-column: 1 / -1;
  border-radius: 20px;
  background: var(--panel);
  color: var(--muted);
  padding: 20px;
}

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

@media (max-width: 820px) {
  .shell {
    width: min(100% - 24px, 1180px);
    padding: 28px 0;
  }

  .hero,
  .controls {
    grid-template-columns: 1fr;
  }

  .top-actions {
    position: static;
    grid-column: 1;
    justify-self: end;
    margin-top: -12px;
  }

  .now-card {
    grid-column: 1;
    grid-template-columns: 1fr;
  }

  .player-controls,
  .record-control,
  .volume-control {
    grid-column: 1 / -1;
    width: 100%;
  }

  .player-controls {
    grid-row: 1;
  }

  .volume-control {
    grid-row: 3;
    justify-self: stretch;
    margin-right: 0;
    margin-bottom: 0;
  }

  .record-control {
    grid-row: 2;
    margin-left: 0;
  }

  .now-copy {
    grid-row: 4;
  }

  .station-card {
    grid-template-columns: 1fr;
  }

  .station-actions {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }

  .playlist-form {
    grid-template-columns: 1fr;
  }

  .now-card {
    min-height: 0;
  }

  .section-heading {
    display: block;
  }
}
