:root {
  --accent: #47e0ee;
  --accent-hover: #8aedf5;
  --accent-ink: #08252a;
  --retro-emerald: #32d49b;
  --retro-pink: #ff72b9;
  --retro-purple: #ad82f5;
  --retro-spectrum: var(--retro-pink), var(--retro-purple) 34%, var(--accent) 72%, var(--retro-emerald);
  --seek-gradient: linear-gradient(90deg, var(--retro-spectrum));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  background: #111;
  color: #eee;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  background: #070809;
  border-bottom: 1px solid #40464a;
  padding: 10px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.top-row {
  justify-content: flex-start;
  gap: 6px;
}

.bottom-row {
  min-height: 44px;
  gap: 9px;
  padding: 8px 14px;
  background:
    repeating-linear-gradient(180deg, transparent 0 3px, rgba(0, 0, 0, 0.28) 3px 4px),
    #101114;
  border-top: 1px solid #302740;
  border-bottom: 1px solid #302740;
  box-shadow: inset 0 2px 4px #08090b;
}

.bottom-row::before {
  content: "";
  flex: 0 0 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--retro-emerald);
  box-shadow: 0 0 6px #219c78;
}

.channel-playback {
  flex: 0 0 min(32%, 112px);
  min-height: 24px;
  display: grid;
  place-items: center end;
}

.channel-waveform {
  width: 53px;
  height: 24px;
  display: none;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
}

.app-header.is-playing + .bottom-row .channel-waveform {
  display: flex;
}

.channel-waveform span {
  width: 4px;
  height: 100%;
  border-radius: 2px;
  background: var(--bar-color);
  transform: scaleY(0.35);
}

.channel-waveform span:nth-child(-n + 2) { --bar-color: var(--retro-pink); }
.channel-waveform span:nth-child(n + 3) { --bar-color: var(--retro-purple); }
.channel-waveform span:nth-child(n + 5) { --bar-color: var(--accent); }
.channel-waveform span:nth-child(n + 7) { --bar-color: var(--retro-emerald); }

.channel-waveform span:nth-child(1) { --wave-step: 0; }
.channel-waveform span:nth-child(2) { --wave-step: 1; }
.channel-waveform span:nth-child(3) { --wave-step: 2; }
.channel-waveform span:nth-child(4) { --wave-step: 3; }
.channel-waveform span:nth-child(5) { --wave-step: 4; }
.channel-waveform span:nth-child(6) { --wave-step: 5; }
.channel-waveform span:nth-child(7) { --wave-step: 6; }
.channel-waveform span:nth-child(8) { --wave-step: 7; }

.bottom-row .channel {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--accent);
  font: 700 14px/1.35 Consolas, "Courier New", monospace;
}

.brand-display {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 10px;
  background: #070809;
  border-left: 2px solid var(--accent);
}

.brand-wordmark {
  color: var(--accent);
  font: italic 900 28px/1 Arial, Helvetica, sans-serif;
  white-space: nowrap;
}

.brand-wordmark span {
  color: #f0f5f6;
}

.brand-meter {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 22px;
  color: var(--accent);
}

.brand-meter i {
  width: 3px;
  height: 8px;
  background: currentColor;
}

.brand-meter i:nth-child(2n) { height: 14px; }
.brand-meter i:nth-child(3) { height: 22px; }

@media (prefers-reduced-motion: no-preference) {
  .app-header.is-playing .brand-meter i {
    animation: header-meter 700ms ease-in-out infinite alternate;
  }

  .app-header.is-playing .brand-meter i:nth-child(2n) {
    animation-delay: -400ms;
  }
}

@keyframes header-meter {
  from { transform: scaleY(0.45); }
  to { transform: scaleY(1); }
}

.header-icon-button,
.home-icon-button {
  width: 40px;
  height: 40px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #181818;
  color: var(--accent);
  display: grid;
  place-items: center;
  padding: 0;
}

.header-icon-button:hover,
.home-icon-button:hover {
  background: #242424;
}

.channel {
  font-size: 14px;
  color: #eee;
  font-weight: bold;
}

#search,
#playlist-url,
#home-playlist-url {
  min-height: 42px;
  border-radius: 6px;
  border: 1px solid #555;
  background: #f7f7f7;
  color: #111;
  padding: 0 12px;
}

#search {
  width: min(48vw, 420px);
}

.menu-row {
  flex: 0 1 430px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) 44px;
  gap: 1px;
  align-items: center;
  padding: 3px;
  border: 1px solid #383d41;
  border-radius: 6px;
  background: #0e1012;
}

.menu-row button,
.playlist-loader button,
.admin-create-button,
.admin-playlist-form button,
.sort-controls-row button,
.seek-buttons button,
.video-actions button,
.channel-button {
  min-height: 40px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #242424;
  color: #eee;
  padding: 0 8px;
  text-align: center;
}

.menu-row button {
  min-height: 42px;
  width: 100%;
  padding: 0 4px;
  border: 0;
  border-radius: 3px;
  background: #212529;
  font-size: 13px;
  font-weight: 700;
}

.menu-row button[aria-current="page"],
.top-row button[aria-current="page"] {
  color: var(--accent);
  background: #172e32;
  box-shadow: inset 0 -2px var(--accent);
}

.app-header button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.icon-nav-button {
  display: grid;
  place-items: center;
}

.menu-row button:hover,
.playlist-loader button:hover,
.admin-create-button:hover,
.admin-playlist-form button:hover,
.sort-controls-row button:hover,
.seek-buttons button:hover,
.video-actions button:hover,
.channel-button:hover {
  background: #343434;
}

.hidden {
  display: none;
}

#home-page,
#menu-page,
#admin-page,
#load-page {
  display: none;
  padding: 16px;
}

#search-page {
  display: none;
  padding: 16px;
}

.player-shell {
  display: grid;
  grid-template-columns: minmax(300px, 36vw) 1fr;
  min-height: calc(100vh - 118px);
}

.player-view-toggle {
  display: none;
  margin: 10px 0;
}

.sort-controls-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 8px;
  padding: 8px 10px;
  background: #111;
  border-bottom: 1px solid #303030;
}

.sort-controls-row button {
  min-height: 34px;
  padding: 0 4px;
  font-size: 13px;
  white-space: nowrap;
}

.sort-controls-row button[aria-pressed="true"]:where(:not(#edit-playlist)) {
  color: var(--retro-pink);
  background: #321e2a;
  box-shadow: inset 0 -2px var(--retro-pink);
}

#edit-playlist.active-edit {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.load-panel,
.admin-panel {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 18px;
}

.search-panel {
  max-width: 720px;
  margin: 0 auto;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 18px;
}

.load-copy h2 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: 0;
}

.load-copy p,
.admin-copy p,
.search-copy p {
  margin: 0 0 14px;
  color: #bfd9e9;
}

.admin-copy h2,
.search-copy h2 {
  margin: 0 0 6px;
  font-size: 24px;
  letter-spacing: 0;
}

.admin-create-button {
  width: 100%;
  min-height: 46px;
  margin-bottom: 10px;
}

.admin-create-button + .admin-create-button {
  margin-top: 0;
}

.admin-playlist-form {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.admin-playlist-form.hidden {
  display: none;
}

.admin-playlist-form label {
  display: grid;
  gap: 5px;
  color: #def5ff;
  font-size: 13px;
  min-width: 0;
}

.admin-playlist-form input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border-radius: 6px;
  border: 1px solid #555;
  background: #f7f7f7;
  color: #111;
  padding: 0 12px;
}

.admin-confirmed-playlist {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 1px solid #35636a;
  border-radius: 6px;
  background: #14282c;
  padding: 10px;
}

.admin-confirmed-playlist strong {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.admin-confirmed-link {
  color: #77c2c9;
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.admin-confirmed-playlist span,
.admin-status {
  color: #a8dce0;
  font-size: 13px;
}

.admin-confirmed-playlist .admin-confirmed-link {
  color: #77c2c9;
  font-size: 11px;
}

.admin-status {
  margin-top: 12px;
  min-height: 22px;
}

.admin-add-status {
  margin: 8px 0 12px;
}

#admin-add-button:disabled,
#save-admin-playlist:disabled {
  opacity: 0.65;
  cursor: wait;
}

.admin-playlist-manager {
  display: grid;
  gap: 10px;
  margin: 10px 0 12px;
}

.admin-playlist-manager.hidden {
  display: none;
}

.admin-manager-heading {
  display: grid;
  gap: 3px;
  color: #def5ff;
}

.admin-manager-heading span {
  color: #a8dce0;
  font-size: 13px;
}

.admin-managed-playlist {
  display: grid;
  gap: 8px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #202020;
  padding: 10px;
}

.admin-managed-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.admin-managed-copy strong {
  overflow-wrap: anywhere;
}

.admin-managed-copy span {
  color: #a8dce0;
  font-size: 12px;
  line-height: 1.25;
}

.search-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.search-controls button {
  min-height: 42px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #242424;
  color: #eee;
  padding: 0 12px;
}

.search-controls button:hover {
  background: #343434;
}

.playlist-panel {
  border-right: 1px solid #303030;
  background: #171717;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.playlist-loader {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.load-status {
  margin-top: 12px;
  min-height: 22px;
  color: #a8dce0;
  font-size: 14px;
}

.search-status {
  margin-top: 12px;
  min-height: 22px;
  color: #a8dce0;
  font-size: 14px;
}

.playlist-count {
  color: #a8dce0;
  font-size: 13px;
  padding: 10px 12px 10px;
}

#video-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 10px 12px;
  overflow-y: auto;
  max-height: calc(100vh - 136px);
}

@supports selector(::-webkit-scrollbar-thumb) {
  #video-grid::-webkit-scrollbar {
    width: 11px;
  }

  #video-grid::-webkit-scrollbar-track {
    background: #171719;
  }

  #video-grid::-webkit-scrollbar-thumb {
    border: 2px solid #171719;
    border-radius: 6px;
    background: linear-gradient(180deg, var(--retro-spectrum));
  }
}

@supports not selector(::-webkit-scrollbar-thumb) {
  #video-grid {
    scrollbar-color: var(--retro-emerald) #171719;
  }
}

.video-card {
  background: linear-gradient(135deg, #262626 15%, #1b1b1b 15%, #161616 92%, #292929 92%);
  border: 1px solid #303030;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 8px;
  align-items: center;
  padding: 7px;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.video-card:hover {
  transform: translateY(-1px);
  border-color: #557d83;
}

.video-card.dragging {
  opacity: 0.45;
}

.video-card img {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 6px;
  background: #222;
}

.video-meta {
  min-width: 0;
}

.video-card h3 {
  font-size: 13px;
  line-height: 1.25;
  margin: 2px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

#player-page.is-editing .video-card h3 {
  margin-bottom: 6px;
}

.video-channel {
  font-size: 12px;
  color: #aaa;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.video-actions {
  display: none;
  grid-template-columns: 86px minmax(48px, 1fr) minmax(62px, 1fr) 34px 34px;
  gap: 6px;
  align-items: stretch;
}

#player-page.is-editing .video-actions {
  display: grid;
}

.video-actions button,
.order-control input {
  min-height: 28px;
  padding: 0 6px;
  font-size: 12px;
  box-sizing: border-box;
}

.order-control {
  display: grid;
  grid-template-columns: 40px 44px;
  align-items: center;
  align-self: center;
  gap: 4px;
  min-width: 0;
  color: #def5ff;
  font-size: 11px;
}

.video-actions [data-place="top"] {
  grid-column: 2;
}

.video-actions [data-place="bottom"] {
  grid-column: 3;
}

.video-actions [data-move="up"] {
  grid-column: 4;
}

.video-actions [data-move="down"] {
  grid-column: 5;
}

.order-control input {
  width: 100%;
  min-width: 0;
  height: 28px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #101010;
  color: #fff;
  text-align: center;
  line-height: 28px;
}

.current-video {
  background: linear-gradient(135deg, #207d61 15%, #174638 15%, #142f29 92%, #207d61 92%);
}

.played-video {
  background: linear-gradient(135deg, #21606a 15%, #173f48 15%, #16333b 92%, #21606a 92%);
}

.loop-video {
  background: linear-gradient(135deg, #963768 15%, #592643 15%, #3f1a32 92%, #963768 92%);
}

.error-video {
  background: linear-gradient(135deg, #6c1680 15%, #351044 15%, #27134d 92%, #6c1680 92%);
}

.now-playing-panel {
  --time-width: 46px;
  --time-gap: 10px;
  --track-inset: calc(var(--time-width) + var(--time-gap));
  --progress-width: min(100%, calc(680px + 2 * var(--track-inset)));
  min-width: 0;
  padding: 20px;
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  align-content: start;
  align-items: center;
  justify-items: center;
  gap: 18px;
  border-bottom: 50px solid #080808;
  background: linear-gradient(180deg, #222426, #121314 75%);
}

.art-stage {
  width: var(--progress-width);
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
}

.player-thumbnail {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #222;
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.42);
}

.player-thumbnail img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.track-copy {
  text-align: center;
  overflow-wrap: anywhere;
  width: min(100%, 760px);
}

#channel-name {
  font-size: 15px;
  color: #d3e3e7;
  margin-bottom: 6px;
}

#player-title {
  margin: 0;
  color: #fff;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

.playback-state {
  color: var(--accent);
  font: 700 12px/1.25 Consolas, "Courier New", monospace;
  overflow-wrap: anywhere;
  text-align: right;
}

#progress-line {
  display: grid;
  grid-template-columns: var(--time-width) minmax(0, 1fr) var(--time-width);
  align-items: center;
  width: var(--progress-width);
  gap: var(--time-gap);
}

#time-start,
#time-end {
  font-size: 14px;
  color: #ccc;
}

#time-end {
  text-align: right;
}

#progress-container {
  height: 14px;
  background: #444;
  position: relative;
  border-radius: 6px;
  cursor: pointer;
  touch-action: none;
}

#progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: var(--seek-gradient);
}

#progress-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  background: #fff;
  border-radius: 5px;
  pointer-events: auto;
  touch-action: none;
}

.controls-buttons {
  width: var(--progress-width);
  display: grid;
  gap: 10px;
}

.play-control-row,
.transport-control-row {
  display: grid;
  gap: 10px;
}

.play-control-row {
  grid-template-columns: minmax(0, 1fr);
}

.transport-control-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.round-button {
  border: none;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #eee;
  transition: background-color 0.15s ease;
}

.play-button {
  background: var(--accent);
  color: var(--accent-ink);
  width: 100%;
  height: 72px;
}

.play-button:hover {
  background: var(--accent-hover);
}

.play-button.is-playing {
  background: var(--seek-gradient);
  background-size: 145% 100%;
  animation: play-button-spectrum 4s ease-in-out infinite alternate;
}

.app-header.is-playing + .bottom-row .channel-waveform span {
  --wave-low: 0.28;
  --wave-high: 1;
  animation: channel-wave 1.05s ease-in-out infinite;
  animation-delay: calc(var(--wave-step) * -110ms);
}

@media (prefers-reduced-motion: reduce) {
  .play-button.is-playing {
    background-size: 118% 100%;
    animation-duration: 7s;
  }

  .app-header.is-playing + .bottom-row .channel-waveform span {
    --wave-low: 0.45;
    --wave-high: 0.8;
    animation-duration: 1.8s;
    animation-delay: calc(var(--wave-step) * -180ms);
  }
}

@keyframes channel-wave {
  0%, 100% { transform: scaleY(var(--wave-low)); }
  50% { transform: scaleY(var(--wave-high)); }
}

@keyframes play-button-spectrum {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}

.secondary-button,
.loop-button,
.shuffle-button {
  background: #4a4a4a;
  width: 100%;
  height: 58px;
}

.secondary-button:is(:hover, :focus-visible, :active) {
  color: var(--retro-emerald);
  background: #19392f;
  box-shadow: inset 0 -2px var(--retro-emerald);
}

.shuffle-button:hover {
  background: #666;
}

.loop-button:hover,
.loop-button.active-loop {
  background: var(--retro-pink);
  color: #291121;
}

.shuffle-button.active-shuffle {
  background: var(--retro-emerald);
  color: var(--accent-ink);
}

.seek-buttons {
  width: var(--progress-width);
  display: grid;
  gap: 8px;
}

.seek-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.seek-buttons button {
  min-width: 0;
}

.seek-buttons button:is(:hover, :focus-visible, :active) {
  color: var(--retro-purple);
  background: #2c223d;
  box-shadow: inset 0 -2px var(--retro-purple);
}

.menu-section {
  background: #1a1a1a;
  border: 1px solid #333;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 12px;
}

#station-count {
  margin: 0;
  padding: 0 0 10px;
}

.placeholder-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: grid;
  gap: 7px;
}

.placeholder-list li {
  padding: 0;
  border-bottom: none;
}

.placeholder-list li:last-child {
  border-bottom: none;
}

.channel-button {
  width: 100%;
  text-align: left;
  display: grid;
  gap: 5px;
  line-height: 1.15;
  position: relative;
  overflow: hidden;
  border-color: #39595f;
  background:
    linear-gradient(135deg, #102426 0 18%, transparent 18%),
    linear-gradient(180deg, #252525, #1c1c1c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 8px 14px;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.channel-button::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}

.channel-button:hover {
  border-color: var(--accent);
  background:
    linear-gradient(135deg, #142b2e 0 18%, transparent 18%),
    linear-gradient(180deg, #2a2a2a, #202020);
  transform: translateY(-1px);
}

.playlist-title-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.playlist-number {
  flex: 0 0 auto;
  color: var(--retro-pink);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0;
}

.playlist-title {
  min-width: 0;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-genres {
  color: var(--accent);
  font-size: 10px;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist-admin-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.playlist-admin-actions button {
  min-height: 34px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #242424;
  color: #eee;
}

.playlist-admin-actions button:hover {
  background: #343434;
}

.playlist-admin-actions .danger-action {
  border-color: #6b3333;
  color: #ffd6d6;
}

#home-page {
  padding: 0;
}

.home-hero {
  display: grid;
  align-items: end;
  min-height: 340px;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(5, 7, 9, 0.72), transparent 75%),
    url("home-cassette-deck.jpg") center / cover no-repeat #08090b;
}

.home-hero::after {
  content: "";
  grid-area: 1 / 1;
  align-self: end;
  height: 3px;
  background: var(--seek-gradient);
}

.home-hero-copy,
.home-content,
.home-stations-inner {
  width: min(100% - 48px, 960px);
  margin-inline: auto;
}

.home-hero-copy {
  grid-area: 1 / 1;
  padding-block: 40px;
}

.home-hero-copy h1 {
  margin: 0 0 6px;
  color: var(--accent);
  font: italic 900 48px/1 Arial, Helvetica, sans-serif;
}

.home-hero-copy h1 span {
  color: #fff;
}

.home-hero-copy p {
  margin: 0;
  color: #eef4f5;
  font-size: 17px;
  line-height: 1.45;
}

.home-content {
  padding-block: 22px 34px;
}

.home-content h2 {
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 1.2;
}

@media (max-width: 680px) {
  .home-hero {
    min-height: 228px;
    background:
      linear-gradient(0deg, #08090b 0%, rgba(8, 9, 11, 0.7) 24%, transparent 70%),
      url("home-cassette-deck.jpg") 92% center / cover no-repeat #08090b;
  }

  .home-hero-copy,
  .home-content,
  .home-stations-inner {
    width: calc(100% - 32px);
  }

  .home-hero-copy {
    padding-block: 18px;
  }

  .home-hero-copy h1 {
    font-size: 32px;
  }

  .home-hero-copy p {
    font-size: 14px;
  }
}

#home-playlist-url {
  min-width: 0;
}

#home-playlist-loader button {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  padding-inline: 14px;
}

#home-playlist-loader button:hover {
  background: var(--accent-hover);
}

#home-playlist-loader button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.home-load-status:empty {
  display: none;
}

.home-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0 0;
}

.home-features div {
  padding: 10px 12px;
  border-left: 2px solid var(--accent);
  background: #18191c;
}

.home-features div:nth-child(2) {
  border-color: var(--retro-emerald);
}

.home-features div:nth-child(3) {
  border-color: var(--retro-purple);
}

.home-features dt {
  font-weight: 700;
}

.home-features dd {
  margin: 4px 0 0;
  color: #c6ced0;
  font-size: 14px;
  line-height: 1.45;
}

@media (max-width: 680px) {
  .home-features {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.home-stations {
  position: relative;
  padding: 30px 0 36px;
  background: #0b0e11;
  border-block: 1px solid #30363a;
}

.home-stations::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 12px;
  background: var(--seek-gradient);
  mask-image: repeating-linear-gradient(90deg, #000 0 2px, transparent 2px 9px);
  opacity: 0.8;
}

.home-stations-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
}

.home-stations h2 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.2;
}

.home-stations p {
  margin: 0;
  color: #c6ced0;
  line-height: 1.45;
}

#home-browse-playlists {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid #66354e;
  border-radius: 6px;
  background: #321e2a;
  color: var(--retro-pink);
  box-shadow: inset 0 -2px var(--retro-pink);
  font-weight: 700;
}

#home-browse-playlists:hover {
  background: #492b3c;
}

#home-browse-playlists:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

#youtube-player-hidden {
  position: fixed;
  width: 1px;
  height: 1px;
  left: -9999px;
  bottom: 0;
  overflow: hidden;
}

@media (max-width: 680px) {
  .app-header {
    padding: 8px 10px;
  }

  .top-row,
  .menu-row {
    flex-basis: 100%;
  }

  .brand-display {
    flex: 1;
  }
}

@media (max-width: 400px) {
  .brand-wordmark {
    font-size: 24px;
  }
}

@media (max-width: 360px) {
  .brand-display {
    gap: 6px;
  }

  .brand-wordmark {
    font-size: 19px;
  }
}

@media (max-width: 820px) {
  .player-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
    min-height: 0;
  }

  .player-view-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 7px 10px;
    background: #111;
    border-bottom: 1px solid #303030;
  }

  .player-view-toggle button {
    min-height: 42px;
    border: 1px solid #3c3c3c;
    border-radius: 6px;
    background: #242424;
    color: #eee;
    font-weight: 700;
  }

  .player-view-toggle button.active-view {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
  }

  .sort-controls-row {
    padding: 0 10px 10px;
  }

  #player-page[data-view="now"] .sort-controls-row {
    display: none;
  }

  .playlist-panel {
    border-right: none;
    border-bottom: none;
    min-height: 0;
    max-height: none;
  }

  #video-grid {
    max-height: calc(100svh - 222px);
    padding-bottom: 16px;
  }

  .now-playing-panel {
    --time-width: 34px;
    --time-gap: 6px;
    min-height: auto;
    height: auto;
    max-height: none;
    padding: 16px 14px 16px;
    grid-template-rows: auto auto auto auto auto;
    align-content: start;
    gap: 10px;
  }

  #player-page[data-view="now"] .playlist-panel {
    display: none;
  }

  #player-page[data-view="playlist"] .now-playing-panel {
    display: none;
  }

  .player-thumbnail {
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.38);
  }

  .track-copy {
    width: 100%;
  }

  #channel-name {
    font-size: 11px;
    margin-bottom: 4px;
  }

  #player-title {
    font-size: 18px;
    line-height: 1.2;
  }


  #progress-line {
    margin-top: 16px;
    margin-bottom: 16px;
  }

  #time-start,
  #time-end {
    font-size: 11px;
    width: auto;
  }

  #progress-container {
    height: 12px;
  }

  #progress-thumb {
    width: 30px;
    height: 30px;
  }

  .controls-buttons {
    gap: 20px;
  }

  .transport-control-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .round-button {
    border-radius: 8px;
    min-width: 0;
    width: 100%;
    height: 48px;
  }

  .play-button {
    width: 100%;
    height: 100px;
  }

  .play-button svg {
    width: 44px;
    height: 44px;
  }

  .secondary-button,
  .loop-button,
  .shuffle-button {
    width: 100%;
    height: 60px;
  }

  .secondary-button svg,
  .loop-button svg,
  .shuffle-button svg {
    width: 24px;
    height: 24px;
  }

  .seek-buttons {
    margin-top: 2px;
  }

  .seek-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
  }

  .seek-buttons button {
    min-width: 0;
    min-height: 40px;
    padding: 0 4px;
    font-size: 11px;
  }

  #search {
    width: min(52vw, 260px);
  }
}

@media (max-width: 520px) {
  #admin-page,
  #load-page,
  #search-page,
  #menu-page {
    padding: 12px;
  }

  .admin-panel,
  .load-panel,
  .search-panel {
    padding: 16px;
  }

  .header-row {
    align-items: stretch;
  }

  .playlist-loader {
    grid-template-columns: 1fr;
  }

  .load-panel {
    padding: 14px;
  }

  .search-panel {
    padding: 14px;
  }

  .search-controls {
    grid-template-columns: 1fr;
  }

  .video-card {
    grid-template-columns: 48px 1fr;
  }

  .video-card img {
    width: 48px;
    height: 48px;
  }

}

@media (orientation: landscape) and (max-height: 560px) {
  .art-stage {
    max-height: 37vh;
  }

  #video-grid {
    max-height: calc(100svh + 116px);
  }
}
