:root {
  color-scheme: dark;
  --bg: #0b0b0e;
  --surface: #14141a;
  --line: #26262f;
  --line-hi: #3c3c48;
  --text: #ececed;
  --dim: #8b8b96;
  --faint: #5a5a66;
  --live: #ff4438;
  --ok: #4ade80;
}

* { box-sizing: border-box }
html, body { margin: 0 }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 6rem;
}
main { max-width: 46rem; margin: 0 auto; padding: 1.5rem 1.25rem }

/* ---------------------------------------------------------------- header */

header {
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
}
header > div {
  max-width: 46rem; margin: 0 auto; padding: .85rem 1.25rem;
  display: flex; align-items: baseline; gap: 1rem;
}
.brand { font-weight: 700; letter-spacing: -.02em; text-decoration: none; color: var(--text) }
.brand span { color: var(--live) }
header nav { margin-left: auto; display: flex; gap: 1.1rem; font-size: .875rem }

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

/* ---------------------------------------------------------------- text */

h1 { font-size: 1.5rem; letter-spacing: -.02em; margin: .2rem 0 }
h2 { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin: 2.25rem 0 .6rem }
p { margin: .35rem 0 }
.sub { color: var(--dim); font-size: .9rem }
.faint { color: var(--faint) }
.empty { color: var(--faint); font-size: .9rem; padding: .9rem 0 }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem }
.error { color: var(--live); font-size: .875rem; min-height: 1.4em; margin: .6rem 0 }
.note { color: var(--dim); font-size: .875rem; min-height: 1.4em; margin: .6rem 0 }

/* ---------------------------------------------------------------- rows */

ul.rows { list-style: none; padding: 0; margin: 0 }
ul.rows li {
  display: flex; align-items: center; gap: .7rem;
  padding: .7rem .85rem; border: 1px solid var(--line); border-radius: 9px; margin-bottom: .4rem;
  background: var(--surface);
}
ul.rows li.click { cursor: pointer }
ul.rows li.click:hover { border-color: var(--line-hi) }
ul.rows li.on { border-color: var(--live) }
.row-main { min-width: 0 }
.row-main b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.row-main small { color: var(--faint); font-size: .8rem }
.row-end { margin-left: auto; display: flex; align-items: center; gap: .5rem; font-size: .8rem; color: var(--faint); flex: none }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none }
.dot.live { background: var(--live); box-shadow: 0 0 0 0 var(--live); animation: pulse 2s infinite }
@keyframes pulse {
  70% { box-shadow: 0 0 0 7px transparent }
  100% { box-shadow: 0 0 0 0 transparent }
}
@media (prefers-reduced-motion: reduce) { .dot.live { animation: none } }

.badge {
  font-size: .65rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
  padding: .18rem .4rem; border-radius: 4px; background: var(--live); color: #fff;
}
.badge.off { background: var(--line); color: var(--dim) }

/* ---------------------------------------------------------------- forms */

label { display: block; margin: 1rem 0 .3rem; font-size: .78rem; color: var(--dim) }
input, select, textarea, button {
  font: inherit; color: inherit; width: 100%;
  padding: .6rem .7rem; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line);
}
textarea { min-height: 4.5rem; resize: vertical }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--line-hi); outline-offset: -1px }
button { cursor: pointer; border-color: var(--line-hi); font-weight: 600 }
button:hover:not(:disabled) { background: #1c1c24 }
button:disabled { opacity: .5; cursor: default }
button.primary { background: #ececf0; color: #0b0b0e; border-color: #ececf0 }
button.primary:hover:not(:disabled) { background: #fff }
button.live { background: var(--live); border-color: var(--live); color: #fff }
button.live:hover:not(:disabled) { background: #ff5a4f }
button.stop { background: transparent; color: var(--live); border-color: var(--live) }
button.mini { width: auto; padding: .3rem .55rem; font-size: .78rem; font-weight: 500; border-radius: 6px }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem }
.actions { display: flex; gap: .6rem; margin-top: 1.4rem }
.tabs { display: flex; gap: .5rem; margin-bottom: .5rem }
.tabs button { width: auto; padding: .35rem .8rem; font-size: .85rem; border-radius: 999px; background: transparent }
.tabs button[aria-selected="true"] { background: var(--surface); border-color: var(--line-hi) }
fieldset { border: 0; padding: 0; margin: 0 }
.check { display: flex; align-items: center; gap: .55rem; margin-top: 1.1rem; font-size: .9rem; color: var(--text) }
.check input { width: auto; margin: 0 }

/* ---------------------------------------------------------------- meter */

.meter { height: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; margin-top: 1rem }
.meter i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .06s linear }
.meter i.hot { background: var(--live) }

/* ---------------------------------------------------------------- player */

#player {
  position: fixed; inset: auto 0 0 0; z-index: 10;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(14px);
  padding: .6rem 1.25rem .8rem;
}
#player[hidden] { display: none }
#player > div { max-width: 46rem; margin: 0 auto; display: flex; align-items: center; gap: .75rem }
#player audio { width: 100%; height: 34px; margin-top: .4rem; max-width: 46rem }
#player audio:not([controls]) { display: none }
#p-live { display: flex; align-items: center; gap: .5rem; margin-top: .5rem }
#p-live[hidden] { display: none }
#player .row-main b { font-size: .9rem }
#nowplaying { max-width: 46rem; margin: 0 auto }

/* ---------------------------------------------------------------- narrow screens */

@media (max-width: 34rem) {
  .grid2 { grid-template-columns: 1fr }           /* squeezed selects are unreadable on a phone */
  main { padding: 1.25rem 1rem }
  #player { padding: .5rem 1rem .6rem }
  #player > div { flex-wrap: wrap; gap: .5rem }
  .row-end { font-size: .75rem; gap: .35rem }
  h1 { font-size: 1.3rem }
  /* iOS zooms the page when a focused control is under 16px */
  input, select, textarea { font-size: 16px }
}
