/* StreamMorgue — dark Craigslist-adjacent aesthetic */

:root {
  --bg:       #1a1a1a;
  --surface:  #242424;
  --border:   #333;
  --accent:   #5b8dd9;
  --accent2:  #e07b39;
  --text:     #ddd;
  --muted:    #888;
  --danger:   #c0392b;
  --success:  #27ae60;
  --player-h: 76px;
  --radius:   4px;
}

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

/* Remove 300ms tap delay and double-tap-zoom on interactive elements */
a, button, input[type=range], select { touch-action: manipulation; }

/* Remove iOS grey tap flash — our :active states handle feedback instead */
* { -webkit-tap-highlight-color: transparent; }

html { font-size: 15px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Courier New', Courier, monospace;
  line-height: 1.55;
  padding-bottom: calc(var(--player-h) + 16px + env(safe-area-inset-bottom, 0px));
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── PJAX loading bar ────────────────────────────────────── */
#pjax-bar {
  position: fixed;
  top: 0; left: 0;
  width: 0;
  height: 3px;
  background: var(--accent);
  z-index: 9999;
  transition: none;
  pointer-events: none;
}
#pjax-bar.pjax-bar--active {
  animation: pjax-bar-run 1.2s ease-in-out infinite;
  width: 100%;
}
@keyframes pjax-bar-run {
  0%   { opacity: 1; transform: scaleX(0);    transform-origin: left; }
  60%  { opacity: 1; transform: scaleX(0.85); transform-origin: left; }
  100% { opacity: 0; transform: scaleX(1);    transform-origin: left; }
}

/* ── Nav ─────────────────────────────────────────────────── */
nav {
  background: #111;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.6rem 1.5rem;
  flex-wrap: wrap;
}

nav .logo {
  font-size: 1.3rem;
  font-weight: bold;
  color: var(--accent2);
  letter-spacing: 0.05em;
}

/* nav-links: the flex container for all links after the logo */
nav .nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex: 1;
}

nav .spacer { flex: 1; }

/* Hamburger button — hidden on desktop */
.nav-hamburger { display: none; }

nav a, nav form button {
  color: var(--muted);
  font-size: 0.88rem;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

nav a:hover, nav form button:hover { color: var(--text); text-decoration: none; }

.nav-badge {
  display: inline-block;
  background: var(--accent2);
  color: #fff;
  border-radius: 9999px;
  font-size: 0.6rem;
  font-weight: bold;
  line-height: 1;
  padding: 0.15em 0.45em;
  vertical-align: middle;
  margin-left: 0.2em;
}

/* Admin panel — unread dot on unreplied bug reports */
.unread-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent2);
  margin-right: 0.35em;
  vertical-align: middle;
}

/* Bug reply sent (shown in admin table) */
.bug-reply-sent {
  margin-top: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  font-size: 0.85rem;
  white-space: pre-wrap;
}

/* User's past reports on bug report page */
.my-reports {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.2rem;
}

.my-reports h3 {
  font-size: 1rem;
  margin-bottom: 0.8rem;
  color: var(--muted);
}

.my-report-item {
  margin-bottom: 1.2rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border);
}

.my-report-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.my-report-meta { font-size: 0.78rem; margin-bottom: 0.25rem; }

.my-report-body { white-space: pre-wrap; font-size: 0.9rem; }

.my-report-reply {
  margin-top: 0.6rem;
  padding: 0.5rem 0.7rem;
  border-left: 3px solid var(--accent);
  background: var(--surface);
  font-size: 0.9rem;
  white-space: pre-wrap;
}

.my-report-reply-label {
  display: block;
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

/* ── Layout ──────────────────────────────────────────────── */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem 1rem;
}

.container--wide {
  max-width: 1400px;
}

h1, h2, h3 {
  font-weight: bold;
  margin-bottom: 0.75rem;
  color: var(--text);
}

h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; border-bottom: 1px solid var(--border); padding-bottom: 0.4rem; margin-bottom: 1rem; }
h3 { font-size: 1rem; color: var(--muted); }

/* ── Flash messages ──────────────────────────────────────── */
.flashes { list-style: none; margin-bottom: 1rem; }

.flash {
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius);
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
  animation: flash-fade 4s ease forwards;
}
@keyframes flash-fade {
  0%   { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; pointer-events: none; }
}

.flash.success { background: #1a3a28; border: 1px solid var(--success); color: #5dbb82; }
.flash.error   { background: #3a1a1a; border: 1px solid var(--danger);  color: #e07070; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 0.9rem; }
.form-group label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.3rem; }

input[type=text],
input[type=email],
input[type=password],
input[type=url],
select,
textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.92rem;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.88rem;
  text-align: center;
}

.btn-primary  { background: var(--accent);  color: #fff; }
.btn-danger   { background: var(--danger);  color: #fff; }
.btn-muted    { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.btn-play     { background: var(--accent2); color: #fff; padding: 0.25rem 0.65rem; font-size: 0.8rem; }
.btn-add      { background: var(--success); color: #fff; padding: 0.25rem 0.65rem; font-size: 0.8rem; }
.btn-sm       { padding: 0.2rem 0.55rem; font-size: 0.78rem; }

.btn:hover  { opacity: 0.88; }
.btn:active { opacity: 0.72; }

/* ── Search bar ──────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.search-bar input {
  flex: 1;
  font-size: 1rem;
  padding: 0.55rem 0.85rem;
}

.search-bar button { white-space: nowrap; }

.source-filters {
  display: flex;
  gap: 1.2rem;
  font-size: 0.85rem;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
}

.source-filters label { display: flex; align-items: center; gap: 0.3rem; cursor: pointer; }

/* ── Source filter collapsible wrapper ───────────────────── */
/* On desktop: always show the filters; summary is invisible  */
/* On mobile:  behaves as a native <details> toggle           */
.source-filter-wrap { margin-bottom: 0.6rem; }

.source-filter-wrap summary {
  display: none; /* hidden on desktop — filters always visible */
}


@media (max-width: 540px) {
  .source-filter-wrap summary {
    display: list-item;
    list-style: none;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--muted);
    padding: 0.3rem 0;
    user-select: none;
  }
  .source-filter-wrap summary::-webkit-details-marker { display: none; }
  .source-filter-wrap summary::after { content: ' ▾'; }
  .source-filter-wrap[open] summary::after { content: ' ▴'; }

  /* When open, give the filters a bit of top breathing room */
  .source-filter-wrap[open] .source-filters { margin-top: 0.4rem; margin-bottom: 0; }
}

.quality-filters {
  display: flex;
  gap: 1.2rem;
  font-size: 0.85rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
  align-items: center;
  color: var(--muted);
}

.quality-filters label { display: flex; align-items: center; gap: 0.3rem; cursor: pointer; color: var(--text); }
.quality-filters select {
  font-size: 0.82rem;
  padding: 0.1rem 0.35rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.quality-filters .filter-sep { color: var(--border); }

/* ── Hero ────────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 1rem 1rem 2rem;
}

.hero h1 {
  font-size: 3rem;
  margin-bottom: 0.5rem;
}

.hero .tagline {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.hero .tagline:last-of-type {
  margin-bottom: 1.5rem;
}

/* ── Featured grid ───────────────────────────────────────── */
.featured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 0.9rem;
  margin-top: 1.5rem;
}

.stream-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stream-card .card-name {
  font-weight: bold;
  font-size: 0.92rem;
  color: var(--text);
}

.stream-card .card-genre {
  font-size: 0.78rem;
  color: var(--muted);
}

.stream-card .card-actions {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

/* ── Updates / Bug report two-column layout ─────────────── */
.updates-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: start;
}
.updates-log h2,
.updates-form h2 { font-size: 1rem; margin-bottom: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.updates-list {
  list-style: decimal;
  padding-left: 1.5rem;
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.8;
}
.updates-list li { color: var(--text); }
@media (max-width: 700px) {
  .updates-layout { grid-template-columns: 1fr; }
}

/* ── Dashboard masonry columns ───────────────────────────── */
.dash-grid {
  columns: 4;
  column-gap: 0.9rem;
}

@media (max-width: 1200px) {
  .dash-grid { columns: 3; }
}

@media (max-width: 860px) {
  .dash-grid { columns: 2; }
}

@media (max-width: 540px) {
  .dash-grid { columns: 1; }
}

/* ── Dashboard categories ────────────────────────────────── */
.category-section {
  break-inside: avoid;
  margin-bottom: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.category-header {
  background: #1e1e1e;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  font-size: 0.92rem;
  user-select: none;
}

.category-header:hover { background: #262626; }

.category-body { padding: 0.5rem 0; }

.stream-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  font-size: 0.88rem;
  border-bottom: 1px solid #2a2a2a;
}

.stream-row:last-child { border-bottom: none; }

.stream-row .sname { flex: 1; min-width: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0 0.1rem;
  opacity: 0.35;
  user-select: none;
  -webkit-user-select: none;
  flex-shrink: 0;
}
.drag-handle:hover { opacity: 0.9; }
.stream-row.dragging { opacity: 0.35; }
.stream-row.drag-over-top    { border-top: 2px solid var(--accent); }
.stream-row.drag-over-bottom { border-bottom: 2px solid var(--accent); }

/* Action buttons — hidden until ▾ is clicked */
.stream-actions {
  flex: 0 0 100%;
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  padding-top: 0.25rem;
}
.stream-row.expanded .stream-actions { display: flex; }

/* Rename / move / edit-url forms wrap to their own line inside actions */
.stream-actions .rename-form,
.stream-actions .edit-url-form,
.stream-actions .move-form {
  flex: 0 0 100%;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.rename-input {
  font-size: 0.78rem;
  padding: 0.15rem 0.4rem;
  flex: 1;
  min-width: 8rem;
}

.move-select {
  font-size: 0.78rem;
  padding: 0.15rem 0.4rem;
  width: auto;
  height: auto;
}

/* ── Stream info panel ───────────────────────────────────── */
.stream-info-panel {
  flex: 0 0 100%;
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: 0.2rem 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
  background: #1a1a1a;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.5rem 0.7rem;
  margin-top: 0.2rem;
  word-break: break-all;
}

.sinfo-label {
  color: var(--muted);
  opacity: 0.6;
  white-space: nowrap;
}

.sinfo-url {
  color: var(--accent);
  word-break: break-all;
}

/* ── Search results ──────────────────────────────────────── */
.results-list { list-style: none; }

.result-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.result-item .rname { font-weight: bold; font-size: 0.92rem; flex: 1; min-width: 140px; }
.result-item .rmeta { font-size: 0.78rem; color: var(--muted); }

.badge {
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  font-weight: bold;
  text-transform: uppercase;
}

.badge-fmstream     { background: #2a3a5a; color: #8ab4f8; }
.badge-radiogarden  { background: #2a4a2a; color: #80cc80; }
.badge-radiobrowser { background: #4a3a1a; color: #e0b060; }
.badge-manual       { background: #333;    color: var(--muted); }
.badge-youradio     { background: #3a2a4a; color: #c084fc; }
.badge-tunein       { background: #1a3a4a; color: #67c8e8; }
.badge-iheart       { background: #4a1a2a; color: #f472b6; }

.stereo-chip {
  font-size: 0.68rem;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.stereo-chip.stereo { background: #1a3a2a; color: #6ee7b7; }
.stereo-chip.mono   { background: #3a2a1a; color: #fbbf24; }
.stereo-chip.probing { color: #555; font-style: italic; font-weight: normal; }

@keyframes probe-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}
#probe-status {
  margin-left: 1ch;
  font-style: italic;
  animation: probe-blink 1.1s ease-in-out infinite;
}

/* ── Admin table ─────────────────────────────────────────── */
.admin-container {
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.admin-container h1 { margin-bottom: 0.3rem; font-size: 1.2rem; }
.admin-container .mb1 { margin-bottom: 0.5rem; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th, .admin-table td {
  text-align: left;
  padding: 0.25rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.admin-table th { color: var(--muted); font-weight: normal; font-size: 0.78rem; }

.admin-table tr:hover td { background: #1e1e1e; }

.status-yes { color: var(--success); }
.status-no  { color: var(--danger); }

.members-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.members-table th, .members-table td {
  text-align: left;
  padding: 0.25rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.members-table th { color: var(--muted); font-weight: normal; font-size: 0.78rem; }

.members-table tr:hover td { background: #1e1e1e; }

/* ── Auth pages ──────────────────────────────────────────── */
.auth-card {
  max-width: 380px;
  margin: 3rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
}

.auth-card h1 { margin-bottom: 1.5rem; }

/* ── Register payment instructions ──────────────────────── */
.payment-instructions {
  background: #1e2a1e;
  border: 1px solid #2d4a2d;
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin-bottom: 1.5rem;
  font-size: 0.88rem;
  color: var(--text);
}

.payment-instructions p { margin-bottom: 0.6rem; }

.payment-instructions ol {
  padding-left: 1.2rem;
  margin-bottom: 0.9rem;
  line-height: 1.8;
}

.payment-buttons {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-pay-venmo {
  background: #008CFF;
  color: #fff;
  flex: 1;
  text-align: center;
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
  border-radius: var(--radius);
}

.btn-pay-paypal {
  background: #003087;
  color: #fff;
  flex: 1;
  text-align: center;
  padding: 0.4rem 0.7rem;
  font-size: 0.82rem;
  border-radius: var(--radius);
}

.btn-pay-venmo:hover, .btn-pay-paypal:hover { opacity: 0.88; text-decoration: none; }

.setup-choice {
  text-align: center;
  margin-top: 3rem;
}

.setup-choice h2 { margin-bottom: 0.4rem; }

.setup-options {
  display: flex;
  gap: 1.5rem;
  margin-top: 2rem;
  justify-content: center;
  flex-wrap: wrap;
}

.setup-option {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.8rem 2rem;
  max-width: 280px;
  flex: 1;
}

.setup-option h3 { margin-bottom: 0.6rem; }
.setup-option p  { font-size: 0.88rem; color: var(--muted); margin-bottom: 1.2rem; }

.demo-banner {
  background: #1a2a3a;
  border: 1px solid #2a4a6a;
  border-radius: var(--radius);
  padding: 0.65rem 1rem;
  font-size: 0.85rem;
  color: #90c8f0;
  margin-bottom: 1.2rem;
}

.demo-banner a { color: #60b0e8; }

.disclaimer {
  margin-top: 1.5rem;
  font-size: 0.78rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  line-height: 1.5;
}

/* ── Modal ───────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 900;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 340px;
  max-width: 95vw;
}

.modal h3 { margin-bottom: 1rem; }
.modal .form-group { margin-bottom: 0.75rem; }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }

/* ── Sticky player ───────────────────────────────────────── */
#player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: var(--player-h);
  background: #111;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1rem env(safe-area-inset-bottom, 0px);
  gap: 1rem;
  z-index: 800;
}

#player-bar .player-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  gap: 2px;
}

#player-bar .player-name {
  font-size: 0.85rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#player-bar .player-track {
  font-size: 0.72rem;
  color: var(--accent2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#player-bar .player-url {
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Courier New', monospace;
}

#player-bar .player-meta {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  flex-shrink: 0;
}

#player-bar .meta-chip {
  font-size: 0.68rem;
  padding: 0.1rem 0.4rem;
  border-radius: 2px;
  background: #2a2a2a;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}

#player-bar .meta-chip.loading {
  color: #555;
  font-style: italic;
}

#player-bar .player-name span { color: var(--muted); }

#player-bar audio { display: none; }

/* Buffering pulse — shown on the play button while stream is loading */
@keyframes sm-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.25; }
}
.ctrl-btn.buffering { animation: sm-pulse 1.2s ease-in-out infinite; }

/* More button: desktop hidden; mobile shows it */
#player-more-btn { display: none; }

/* Tray: groups secondary controls. Inline flex on desktop; popup on mobile. */
#player-tray {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-shrink: 0;
}

#player-bar .ctrl-btn {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
}

#player-bar .ctrl-btn:hover  { color: var(--accent2); }
#player-bar .ctrl-btn:active { color: var(--accent2); opacity: 0.65; }

#open-in-tab-btn { color: var(--accent2); font-size: 0.8rem; text-decoration: none; }
#mixed-content-msg { font-size: 0.72rem; color: var(--accent2); margin-top: 0.1rem; }

#volume-slider {
  width: 90px;
  accent-color: var(--accent);
  cursor: pointer;
}
#volume-slider.vol-low {
  accent-color: var(--accent2);
  animation: vol-low-pulse 1.8s ease-in-out infinite;
}
@keyframes vol-low-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── Now Listening tiles ─────────────────────────────────── */
.nl-wrap {
  margin-bottom: 1.2rem;
}

.nl-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  display: block;
  margin-bottom: 0.5rem;
}

.nl-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.nl-tile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.3rem 0.6rem;
  font-size: 0.82rem;
}

.nl-user {
  color: var(--accent);
  font-weight: bold;
  white-space: nowrap;
}

.nl-station {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.nl-play {
  font-size: 0.75rem;
  padding: 0.15rem 0.4rem;
}

/* ── Dashboard station filter ───────────────────────────── */
.dash-filter {
  margin-bottom: 1rem;
}

.dash-filter input {
  width: 100%;
  max-width: 320px;
  font-size: 0.88rem;
  padding: 0.4rem 0.7rem;
}

/* ── btn-link — unstyled button that looks like a link ───── */
.btn-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn-link:hover { text-decoration: underline; }

/* ── Import preview ──────────────────────────────────────── */
.import-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.import-selectors {
  margin-left: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.import-selectors a { color: var(--accent); }

.import-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem 0;
}

.import-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.6rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}
.import-row:last-child { border-bottom: none; }
.import-row:hover { background: #1e1e1e; }

.probe-dot {
  width: 1.2rem;
  text-align: center;
  flex-shrink: 0;
  color: var(--muted);
  font-size: 1rem;
}
.probe-ok   { color: var(--success); }
.probe-fail { color: var(--danger); }

#probe-progress { color: var(--muted); font-size: 0.8rem; }

/* ── Add-stream inline form ──────────────────────────────── */
.add-stream-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.add-stream-form h3 { color: var(--muted); margin-bottom: 0.75rem; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }

.inline-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  align-items: end;
}

@media (max-width: 600px) {
  .inline-form { grid-template-columns: 1fr; }
}

/* ── Track change toast ──────────────────────────────────── */
#track-toast {
  position: fixed;
  bottom: calc(var(--player-h) + 12px + env(safe-area-inset-bottom, 0px));
  right: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent2);
  border-radius: var(--radius);
  padding: 0.5rem 0.85rem;
  font-size: 0.82rem;
  max-width: 280px;
  z-index: 850;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}

#track-toast.show {
  opacity: 1;
  transform: translateY(0);
}

#track-toast .toast-label {
  font-size: 0.68rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#track-toast .toast-title {
  color: var(--accent2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Recently played ─────────────────────────────────────── */
.recently-played { margin-bottom: 1.5rem; }

.rp-header {
  cursor: pointer;
  user-select: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0;
}

.rp-header:hover { color: var(--accent); }
.rp-toggle { color: var(--muted); font-size: 0.9rem; }

.history-list { list-style: none; }

.history-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.history-item:last-child { border-bottom: none; }

.history-item .hname {
  flex: 1;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Sleep timer ─────────────────────────────────────────── */
.sleep-wrap {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

#sleep-select {
  width: auto;
  font-size: 0.75rem;
  padding: 0.15rem 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 3px;
  cursor: pointer;
}

#sleep-countdown {
  font-size: 0.75rem;
  color: var(--accent2);
  cursor: pointer;
  white-space: nowrap;
  border: 1px solid var(--border);
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  background: var(--surface);
}

#sleep-countdown:hover { color: var(--danger); }

/* Utility */
.mt1 { margin-top: 0.5rem; }
.mt2 { margin-top: 1rem; }
.mb1 { margin-bottom: 0.5rem; }
.text-muted { color: var(--muted); font-size: 0.85rem; }
.flex-gap { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ── Compact player — toggled by JS when info column is squeezed ── */
#player-bar.compact              { gap: 0.5rem; padding: 0 0.65rem; }
#player-bar.compact .ctrl-btn {
  font-size: 1.4rem;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#player-bar.compact #player-more-btn { display: flex; }
#player-bar.compact #player-tray {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: #111;
  border-top: 1px solid var(--border);
  padding: 0.5rem 0.65rem;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}
#player-bar.compact.expanded #player-tray { display: flex; }
#player-bar.compact #player-tray #stream-meta { flex: 0 0 100%; }
#player-bar.compact #player-tray .ctrl-btn { font-size: 1rem; min-height: 36px; }
#player-bar.compact #player-tray #volume-slider { display: block; flex: 1; min-width: 60px; width: auto; }
#player-bar.compact .player-track { font-size: 0.88rem; font-weight: bold; order: -1; }
#player-bar.compact .player-name  { font-size: 0.72rem; }
#player-bar.compact .player-url   { display: block; }

/* ── Mobile / phone ──────────────────────────────────────── */
@media (max-width: 540px) {
  html { font-size: 14px; }

  nav {
    gap: 0.6rem;
    padding: 0.5rem 0.75rem;
  }

  .container {
    padding: 1rem 0.75rem;
  }

  /* Hero */
  .hero h1 { font-size: 2rem; }

  /* Search results: source badges are decoration on mobile */
  .result-item .badge { display: none; }

  /* Dashboard filter: full width on mobile */
  .dash-filter input { max-width: none; }

  /* Category headers — minimum 44 px tap target */
  .category-header { min-height: 44px; }

  .stream-row {
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.45rem 0.65rem;
  }
  /* Rename input already uses flex:1; ensure it doesn't overflow on small screens */
  .rename-input { max-width: 100%; }

  /* Admin / members tables — allow horizontal scroll */
  .admin-table,
  .members-table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  /* Auth card — lose the large outer margin on small screens */
  .auth-card {
    margin: 1.5rem 0.75rem;
  }

  /* Slightly larger tap targets on play / add buttons */
  .btn-play,
  .btn-add { padding: 0.45rem 0.8rem; }

  /* Nav username — redundant on mobile; saves wrap space */
  nav .nav-username { display: none; }

  /* Hamburger: show on mobile, hide nav-links until open */
  nav {
    position: relative;
    flex-wrap: nowrap;
  }

  .nav-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    min-width: 44px;
    min-height: 44px;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.3rem;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
  }

  nav .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #111;
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 0.25rem 0;
    z-index: 801;
  }

  nav.nav-open .nav-links { display: flex; }

  /* Links inside the open dropdown */
  nav .nav-links > a,
  nav .nav-links > form > button {
    display: block;
    width: 100%;
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
    color: var(--text);
    box-sizing: border-box;
  }

  nav .nav-links > form { display: block; width: 100%; }

  /* Spacer is meaningless in a column — hide it */
  nav .nav-links .spacer { display: none; }

  /* Track toast — span full width instead of right-anchored 280 px */
  #track-toast {
    left: 1rem;
    right: 1rem;
    max-width: none;
  }

  /* iOS Safari zooms into any input/select with font-size < 16px.
     Force 16px so the viewport stays put when the user taps a field. */
  input[type=text],
  input[type=email],
  input[type=password],
  input[type=url],
  input[type=file],
  select,
  textarea { font-size: 16px; }
}
