/* WAYO archive site. No framework: tokens, layout, then components. */
:root {
  --bg: #f3f5f6;
  --surface: #ffffff;
  --surface-2: #f6f8f9;
  --text: #15181a;
  --muted: #5d676d;
  --border: #d8dee1;
  --accent: #1d6ad0;
  --accent-ink: #ffffff;
  --accent-soft: #e6effb;
  --ok: #12703f;
  --ok-bg: #e2f3e9;
  --wait: #8a5800;
  --wait-bg: #fcf0d4;
  --busy: #5a3fb0;
  --busy-bg: #ece7fb;
  --err: #b3261e;
  --err-bg: #fce6e3;
  --flash: #fff6c7;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 2px 8px rgba(0, 0, 0, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111416;
    --surface: #1a1e21;
    --surface-2: #22272b;
    --text: #e8ecee;
    --muted: #9aa5ab;
    --border: #333b40;
    --accent: #5b9cf0;
    --accent-ink: #0b1220;
    --accent-soft: #1d2b3e;
    --ok: #6fd39b;
    --ok-bg: #173323;
    --wait: #f0c060;
    --wait-bg: #3a2e12;
    --busy: #b9a6ff;
    --busy-bg: #2a2342;
    --err: #ff8a80;
    --err-bg: #3d1a17;
    --flash: #3b3713;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
code { font: .85em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
h1 { font-size: 1.4rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 1rem; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.text-end { text-align: right; }

/* ---- page frame */
.site-header {
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.site-header .inner {
  max-width: 1040px; margin: 0 auto; padding: .6rem 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.5rem;
}
.brand img { display: block; height: 30px; width: auto; }
@media (prefers-color-scheme: dark) {
  /* The logo is drawn for a light background */
  .brand img, .login-logo { background: #fff; border-radius: 6px; padding: 3px 6px; }
}
.site-nav { display: flex; flex-wrap: wrap; gap: .25rem; flex: 1; }
.site-nav a {
  padding: .4rem .75rem; border-radius: 7px; text-decoration: none; color: var(--text); font-weight: 500;
}
.site-nav a:hover { background: var(--surface-2); }
.site-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
/* The website link (config WAYO_SITE_SSO) sits apart, at the end */
.site-nav .nav-website { margin-left: auto; color: var(--accent); }
.user { color: var(--muted); font-size: .9rem; white-space: nowrap; }
@media (max-width: 640px) {
  /* Logo and user on top, the nav as a row beneath */
  .user { margin-left: auto; }
  .site-nav { order: 3; flex-basis: 100%; margin: 0 -.75rem; }
}
main { max-width: 1040px; margin: 0 auto; padding: 1.25rem 16px; }
main.narrow { max-width: 860px; }
footer { color: var(--muted); font-size: .875rem; text-align: center; padding: .5rem 16px 2rem; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem; margin-bottom: 1.25rem;
}
.notice { padding: .75rem 1rem; border-radius: var(--radius); background: var(--accent-soft); margin-bottom: 1.25rem; }

/* ---- forms: label column beside the controls, stacked on phones */
.field {
  display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: .25rem 1rem;
  align-items: start; margin: 0 0 1rem; padding: 0; border: 0; min-width: 0;
}
.field > label, .field > legend { padding-top: .45rem; font-weight: 600; float: left; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
@media (max-width: 600px) {
  .field { grid-template-columns: minmax(0, 1fr); }
  .field > label, .field > legend { padding-top: 0; }
}
.opt { font-weight: 400; color: var(--muted); font-size: .85em; }
.hint { margin: .3rem 0 0; color: var(--muted); font-size: .85rem; }
.hint.warn { color: var(--err); }

input:not([type=checkbox]):not([type=radio]):not([type=file]), textarea, select {
  width: 100%; padding: .45rem .6rem; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 7px;
}
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible,
summary:focus-visible, .chip-toggle:focus-within, .dest:focus-within, .segmented label:focus-within {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
textarea { resize: vertical; }
input[type=file] {
  width: 100%; padding: 1rem; font: inherit; color: var(--muted);
  background: var(--surface-2); border: 2px dashed var(--border); border-radius: var(--radius); cursor: pointer;
}
input[type=file]:hover, input[type=file].dragging { border-color: var(--accent); background: var(--accent-soft); }

.btn {
  font: inherit; font-weight: 600; padding: .5rem 1.2rem; border-radius: 7px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  text-decoration: none; display: inline-block;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { padding: .2rem .7rem; font-size: .85rem; }
.btn.danger { color: var(--err); }
.btn.primary.danger { background: var(--err); border-color: var(--err); color: var(--surface); }
/* A submit button with data-busy-label while its form's file is uploading */
.btn.busy, .btn.primary.busy { background: var(--err-bg); border-color: var(--err); color: var(--err); cursor: progress; }
.btn:disabled { opacity: .55; cursor: progress; }
button.link { font: inherit; border: 0; background: none; color: var(--accent); padding: 0; cursor: pointer; text-decoration: underline; }
.submit-row { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; }

/* ---- uploads in progress */
.upload-progress { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-top: .5rem; }
.upload-progress progress { flex: 1 1 10rem; height: .7rem; accent-color: var(--accent); }
.progress-text { font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.uploader.done .progress-text { color: var(--ok); font-weight: 600; }
.uploader.failed .progress-text { color: var(--err); }
/* picture cropping: the frame is the square that's sent */
.cropper { max-width: 320px; margin-top: .6rem; }
.crop-frame {
  position: relative; aspect-ratio: 1; overflow: hidden; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); cursor: grab; touch-action: none; user-select: none;
}
.crop-frame:active { cursor: grabbing; }
.crop-frame:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.crop-frame img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; }
.crop-zoom { display: flex; align-items: center; gap: .6rem; margin-top: .4rem; font-size: .85rem; color: var(--muted); }
.crop-zoom input { flex: 1; accent-color: var(--accent); }
.crop-note { margin-top: .2rem; }

.result { margin: .25rem 0 0; padding: .65rem .85rem; border-radius: 7px; }
.result.ok { background: var(--ok-bg); color: var(--ok); }
.result.info { background: var(--accent-soft); }
.result.error { background: var(--err-bg); color: var(--err); }
.result.error a { color: inherit; }

/* ---- chips: genre toggles, tags, suggestions */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip-toggle { position: relative; cursor: pointer; border-radius: 999px; }
.chip-toggle input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.chip-toggle span, .chip, .chip-add {
  display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .7rem;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
  font: inherit; font-size: .875rem; color: var(--text); line-height: 1.4;
}
.chip-toggle input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip { background: var(--surface-2); }
.chip button { border: 0; background: none; color: var(--muted); font-size: 1.05rem; line-height: 1; padding: 0 0 0 .1rem; cursor: pointer; }
.chip button:hover { color: var(--err); }
.chip-add { cursor: pointer; }
.chip-add:hover { border-color: var(--accent); }
.chip-add.added { opacity: .45; }
.tag-box {
  display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; padding: .3rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 7px;
}
.tag-box:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.tag-list { display: contents; }
.tag-box input.tag-input { flex: 1 1 10rem; width: auto; border: 0; padding: .2rem .3rem; outline: none; }
.suggested { margin-top: .5rem; font-size: .9rem; }
.suggested > summary { cursor: pointer; color: var(--accent); }
.suggested details { margin: .4rem 0 0 .25rem; }
.suggested details > summary { cursor: pointer; font-weight: 600; }
.suggested .chips { margin: .4rem 0 .2rem; }

/* ---- radio cards */
.destinations { display: grid; gap: .5rem; }
.dest {
  display: flex; gap: .6rem; align-items: flex-start; padding: .6rem .75rem; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius);
}
.dest input { margin-top: .3rem; accent-color: var(--accent); }
.dest span { display: flex; flex-direction: column; }
.dest small { color: var(--muted); font-size: .85rem; }
.dest:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.subfields { border-left: 3px solid var(--accent); padding-left: .75rem; margin: 0 0 1rem; }

/* ---- track listing preview */
.preview-label { margin: .75rem 0 0; font-size: .85rem; font-weight: 600; }
.tracks { margin: .5rem 0 0; font-size: .85rem; border-collapse: collapse; width: 100%; }
.tracks td { padding: .15rem .5rem .15rem 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.tracks td.time { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.tracks tr.bad td { color: var(--err); }

/* ---- upload lists */
.filter { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: .9rem; }
.filter input[type=search] { flex: 1 1 12rem; width: auto; }
.segmented { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.segmented label { position: relative; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; padding: .35rem .75rem; font-size: .875rem; }
.segmented label + label span { border-left: 1px solid var(--border); }
.segmented input:checked + span { background: var(--accent); color: var(--accent-ink); }

.summary { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .6rem; }
.checked { margin-left: auto; color: var(--muted); font-size: .8rem; }
.badge {
  display: inline-flex; align-items: center; gap: .35rem; white-space: nowrap;
  padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: var(--surface-2); color: var(--muted);
}
.badge.pending, .badge.queued, .badge.scheduled, .badge.waiting, .badge.overridden { background: var(--wait-bg); color: var(--wait); }
.badge.importing, .badge.uploading, .badge.processing, .badge.working { background: var(--busy-bg); color: var(--busy); }
.badge.imported, .badge.published, .badge.done, .badge.live { background: var(--ok-bg); color: var(--ok); }
.badge.failed { background: var(--err-bg); color: var(--err); }
.badge .dot { width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .badge .dot { animation: none; } }

.uploads { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.uploads > li { border-bottom: 1px solid var(--border); transition: background-color 1.5s; }
.uploads > li.changed { background: var(--flash); transition: none; }
.uploads summary {
  display: flex; gap: .75rem; align-items: center; justify-content: space-between;
  padding: .6rem .25rem; cursor: pointer; list-style: none;
}
.uploads summary::-webkit-details-marker { display: none; }
.uploads summary:hover { background: var(--surface-2); }
.what { display: flex; flex-direction: column; min-width: 0; }
.name { font-weight: 600; overflow-wrap: anywhere; }
.sub { color: var(--muted); font-size: .825rem; overflow-wrap: anywhere; }
/* What an upload is, ahead of its name in the list of everyone's (/uploads) */
.kind {
  display: inline-block; margin-right: .45rem; padding: 0 .4rem; vertical-align: .1em;
  border: 1px solid var(--border); border-radius: 4px; color: var(--muted);
  font-size: .7rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
}
.state { display: flex; flex-direction: column; align-items: flex-end; gap: .15rem; flex: none; }
.when { color: var(--muted); font-size: .8rem; white-space: nowrap; }
@media (max-width: 520px) {
  .uploads summary { flex-direction: column; align-items: flex-start; gap: .3rem; }
  .state { flex-direction: row; align-items: center; gap: .5rem; }
}
.uploads dl {
  display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .3rem 1rem;
  margin: 0; padding: .1rem .25rem .6rem; font-size: .9rem;
}
.uploads dt { color: var(--muted); }
.uploads dd { margin: 0; overflow-wrap: anywhere; }
.uploads dd.problem { color: var(--err); }
.uploads dd.pre { white-space: pre-line; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; padding: 0 .25rem .9rem; }
.empty { color: var(--muted); padding: 1.25rem 0; text-align: center; margin: 0; }

.pager { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem; margin-top: 1rem; font-size: .9rem; }
.pager .range { color: var(--muted); margin-right: auto; }
.pager button, .pager .current, .pager .gap {
  font: inherit; padding: .25rem .6rem; border-radius: 6px; border: 0; background: none; color: var(--accent); cursor: pointer;
}
.pager button:hover { background: var(--surface-2); }
.pager .current { background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: default; }
.pager .gap { color: var(--muted); cursor: default; }
/* Dim a list while a filter or page change loads (not while polling) */
.card:has(.filter.htmx-request, .upload-list .htmx-request) .upload-list { opacity: .6; transition: opacity .2s .15s; }

/* ---- archives: calendar beside the day's hours */
.archives { display: grid; grid-template-columns: 19rem minmax(0, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 760px) { .archives { grid-template-columns: minmax(0, 1fr); } }
.calendar { padding: 1rem; }
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.cal-head b { font-size: 1rem; line-height: 2rem; }
.cal-head button {
  font: inherit; font-size: 1.1rem; width: 2rem; height: 2rem; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.cal-head button:disabled { visibility: hidden; }
.cal-head .cal-title { width: auto; padding: 0 .6rem; border-color: transparent; background: none; font-size: 1rem; font-weight: 600; }
.cal-head .cal-title:hover { background: var(--surface-2); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-grid .dow { font-size: .75rem; color: var(--muted); padding: .2rem 0; }
.cal-grid button {
  position: relative; font: inherit; font-size: .9rem; aspect-ratio: 1; border: 0; border-radius: 7px;
  background: none; color: var(--muted); cursor: pointer; font-variant-numeric: tabular-nums;
}
.cal-grid button.has { color: var(--text); font-weight: 600; }
.cal-grid button.has::after {
  content: ""; position: absolute; left: 50%; bottom: 14%; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: var(--accent);
}
.cal-grid button.other { opacity: .45; }
.cal-grid button.today { box-shadow: inset 0 0 0 1px var(--accent); }
.cal-grid button:hover:not(:disabled) { background: var(--surface-2); }
.cal-grid button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.cal-grid button[aria-pressed="true"]::after { background: var(--accent-ink); }
.cal-grid button:disabled { opacity: .3; cursor: default; }
/* the month and year pickers */
.cal-grid.cal-pick { grid-template-columns: repeat(3, 1fr); gap: 4px; }
.cal-pick button { aspect-ratio: auto; padding: .95rem 0; color: var(--text); }
.cal-foot { display: flex; justify-content: space-between; margin-top: .6rem; font-size: .8rem; color: var(--muted); }

.hours details { border-bottom: 1px solid var(--border); }
.hours summary { display: flex; justify-content: space-between; gap: 1rem; padding: .7rem .25rem; cursor: pointer; font-weight: 600; }
.hours summary:hover { background: var(--surface-2); }
.hours .body {
  margin: .1rem 0 .75rem; padding: .75rem .9rem .9rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
}
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; margin-top: .6rem; }
.data-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; border-bottom: 1px solid var(--border); padding: .3rem .5rem .3rem 0; }
.data-table td { padding: .3rem .5rem .3rem 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table td.time, .data-table th.time { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* A spacer column so copied rows paste as "Artist - Title" */
.data-table .sep { color: transparent; width: 0; padding: 0; user-select: text; }

/* ---- login */
.login { max-width: 26rem; margin: 3rem auto; text-align: center; }
.login-logo { display: block; margin: 0 auto 1rem; max-width: 100%; height: auto; }
.login form { text-align: left; }
.login .field { grid-template-columns: minmax(0, 1fr); }
.login .error { color: var(--err); font-weight: 600; min-height: 1.5em; margin: .5rem 0 0; text-align: center; }
.htmx-request .when-idle, .when-busy { display: none; }
.htmx-request .when-busy { display: inline; }

/* ---- listener stats (icestats.js builds these) */
.form-check-inline { display: inline-flex; align-items: center; gap: .2rem; }
.form-check-input { accent-color: var(--accent); margin: 0; }
.ms-1 { margin-left: .25rem; }
.me-1 { margin-right: .25rem; }

/* ---- repeat editor (repeat.js draws the canvases) */
.hour-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.btn.with-icon { display: inline-flex; align-items: center; gap: .4rem; }
.hour-actions .download { margin-left: auto; }
.hour-actions form, .pick-hours form, .notice form { margin: 0; }
.pick-hours { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.notice.opening { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.editor-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.editor-head h1 { margin: 0; }
.editor .intro { margin: .5rem 0 1rem; }
.sources { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .75rem; }
.sources ol { display: contents; }
.source {
  display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; list-style: none;
  padding: .3rem .6rem; border: 1px solid var(--border); border-radius: 8px; font-size: .9rem;
}
.source .hour { font-weight: 600; }
.source .msg { color: var(--muted); font-size: .8rem; }
.sources .result { flex-basis: 100%; }
.wave { margin: 0 0 .5rem; }
.wave canvas { display: block; width: 100%; border-radius: 7px; touch-action: none; }
.wave canvas.overview { height: 36px; margin-bottom: .4rem; cursor: pointer; }
.wave canvas.detail { height: 180px; cursor: crosshair; }
.wave-note { min-height: 1.4em; margin: .3rem 0 0; font-size: .85rem; color: var(--muted); }
.transport { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .75rem; }
.transport .btn { padding: .45rem .7rem; min-width: 2.75rem; font-variant-numeric: tabular-nums; }
.transport .play { min-width: 5.5rem; }
.transport .now { font-variant-numeric: tabular-nums; font-weight: 600; margin: 0 .25rem; }
.transport .set { display: inline-flex; gap: .4rem; margin-left: .5rem; }
.set-in::before, .set-out::before {
  content: ''; display: inline-block; width: .55rem; height: .55rem; margin-right: .4rem;
  border-radius: 50%; background: var(--ok); vertical-align: .05em;
}
.set-out::before { background: var(--err); }
.transport [data-act=undo]:disabled { cursor: default; }
.transport .zoom { margin-left: auto; display: inline-flex; gap: .4rem; }
.view-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.jump { display: flex; flex: 1 1 16rem; align-items: center; gap: .5rem; font-size: .9rem; }
.jump select { flex: 1; width: auto; min-width: 0; }
.view-btns { display: inline-flex; gap: .4rem; margin-left: auto; }
.cuts { display: grid; gap: .6rem; margin-bottom: 1rem; }
.cut {
  display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; padding: .55rem .75rem;
  border: 1px solid var(--border); border-left: 4px solid var(--ok); border-radius: var(--radius);
}
.cut[data-cut="out"] { border-left-color: var(--err); }
.cut b { min-width: 2.75rem; }
.cut .when { font-variant-numeric: tabular-nums; min-width: 8.5rem; text-align: left; }
.nudge { display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.nudge button {
  font: inherit; font-size: .85rem; padding: .35rem .55rem; border: 0; cursor: pointer;
  background: var(--surface); color: var(--text); font-variant-numeric: tabular-nums;
}
.nudge button + button { border-left: 1px solid var(--border); }
.nudge button:hover { background: var(--surface-2); }
.submit-row .first { order: -1; }
.length { color: var(--muted); }
.modal {
  width: min(24rem, calc(100% - 32px)); padding: 1.25rem; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}
.modal::backdrop { background: rgba(0, 0, 0, .45); }
.modal h2 { margin: 0 0 .5rem; }
.modal p { margin: 0 0 1.25rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin: 0; }
.length output { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) {
  .wave canvas.detail { height: 150px; }
  /* Finger-sized controls; the time and zoom on a row above the transport */
  .transport .btn, .nudge button, .cut .btn { min-height: 44px; }
  .transport .now { order: -2; font-size: 1.1rem; flex: 1 0 calc(100% - 7.5rem); }
  .transport .zoom { order: -1; }
  .transport .play { flex: 1; min-width: 0; }
  .transport .btn { min-width: 2.5rem; padding: .45rem .5rem; }
  .transport .set { flex-basis: 100%; margin-left: 0; }
  .transport .set .btn { flex: 1; }
  .view-btns { flex-basis: 100%; }
  .view-btns .btn { flex: 1; min-height: 44px; }
  .cut .when { min-width: 0; white-space: nowrap; flex: 1; }
  .cut .nudge { flex-basis: 100%; }
  .nudge button { flex: 1; }
  .site-nav a { padding: .4rem .55rem; }
}

/* ---- station feedback: topic tabs, then each topic's background,
   comment bubbles and comment box */
.tabs { display: flex; flex-wrap: wrap; gap: .25rem; border-bottom: 1px solid var(--border); margin: 0 0 1.25rem; }
.tabs [role=tab] {
  font: inherit; font-size: 1.15rem; font-weight: 600; color: var(--muted); background: none; border: 0;
  border-bottom: 3px solid transparent; margin-bottom: -1px; padding: .7rem 1.25rem; cursor: pointer;
}
.tabs [role=tab]:hover { color: var(--text); }
.tabs [role=tab][aria-selected=true] { color: var(--accent); border-bottom-color: var(--accent); cursor: default; }
.topic-intro h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.topic-intro p { margin: 0 0 .75rem; }
.topic-intro ul { margin: 0; padding-left: 1.25rem; }
.placeholder-note { color: var(--wait); background: var(--wait-bg); border-radius: 7px; padding: .35rem .7rem; font-size: .85rem; }
/* The topic's text, with its "At a glance" box to the right */
/* The second column only exists when there's a box to put in it */
.topic-body { display: grid; grid-template-columns: minmax(0, 1fr); grid-auto-columns: 16rem; gap: 1rem 1.5rem; align-items: start; }
.topic-text { grid-column: 1; grid-row: 1; }
.topic-text > :first-child { margin-top: 0; }
.topic-info {
  grid-column: 2; grid-row: 1; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .85rem 1rem;
}
.topic-intro .topic-info h3 { margin-top: 0; }
.topic-info figure { margin: 0 0 .85rem; }
.topic-info > :last-child { margin-bottom: 0; }
.topic-info figcaption { margin-top: .35rem; font-size: .8rem; color: var(--muted); }
.enlarge { display: block; cursor: zoom-in; }
.enlarge img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 6px; }
.enlarge:hover img { border-color: var(--accent); }
@media (max-width: 700px) {
  /* The box first, the width of the card */
  .topic-body { display: block; }
  .topic-info { margin-bottom: 1rem; }
}

.comments { list-style: none; margin: 0 0 1.25rem; padding: 0; display: flex; flex-direction: column; gap: 1rem; }
.bubble {
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px 14px 4px 14px;
  padding: .6rem .85rem; overflow-wrap: anywhere;
}
.comment.mine .bubble { background: var(--accent-soft); border-color: transparent; }
.comment.deleted .bubble { background: none; border: 1px dashed var(--border); color: var(--muted); font-style: italic; }
/* A formatted comment (markdownish.py), in a bubble or the formatting help */
.formatted p, .formatted ul, .formatted ol, .formatted blockquote { margin: 0 0 .6rem; }
.formatted > :last-child, .formatted blockquote > :last-child { margin-bottom: 0; }
.formatted ul, .formatted ol { padding-left: 1.4rem; }
/* Not the circles of a list in a list (the comments are one) */
.formatted ul { list-style: disc; }
.formatted blockquote { border-left: 3px solid var(--border); padding-left: .75rem; color: var(--muted); }
.comment .meta { margin: .25rem .25rem 0; text-align: right; font-size: .8rem; color: var(--muted); }
.comment .meta button.link { font-size: inherit; color: var(--err); }

.comment-form { border-top: 1px solid var(--border); padding-top: 1rem; }
.comment-form > label { display: block; font-weight: 600; margin-bottom: .35rem; }
.comment-form textarea { display: block; margin: 0; }
/* The hint tight under the box, wrapping beside the button at its right edge */
.comment-actions { display: flex; align-items: flex-start; gap: 1rem; }
.comment-actions .hint { flex: 1; min-width: 0; }
.comment-actions .btn { flex: none; margin: .75rem 0 0 auto; }
.comment-limit { margin: 0; }
.format-help { margin-top: .9rem; font-size: .9rem; }
.format-help > summary { cursor: pointer; color: var(--accent); width: fit-content; }
.format-help table { display: block; overflow-x: auto; border-collapse: collapse; margin-top: .4rem; line-height: 1.35; }
.format-help th, .format-help td { text-align: left; vertical-align: top; padding: .2rem .9rem .2rem 0; border-bottom: 1px solid var(--border); }
.format-help .formatted > :not(:last-child) { margin-bottom: .2rem; }
.format-help thead th { font-size: .8rem; color: var(--muted); }
.format-help tbody th { font-weight: 600; white-space: nowrap; }
.format-help td code { white-space: pre; }
@media (max-width: 600px) {
  /* Both on one line from 360px wide */
  .tabs { gap: 0; }
  .tabs [role=tab] { font-size: 1rem; padding: .6rem .35rem; }
  /* Room for what's typed beside what it makes */
  .format-help tbody th, .format-help thead th:first-child { display: none; }
  .format-help td code { white-space: pre-wrap; }
}

/* ---- a picture opened full size over the page (site.js): fitted to the
   window, or at its own size to scroll around when it's bigger */
.lightbox {
  width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0;
  border: 0; background: rgba(0, 0, 0, .88);
}
.lightbox-view { display: flex; width: 100%; height: 100%; overflow: auto; overscroll-behavior: contain; }
/* Auto margins centre it, and still let all of a bigger picture scroll into view */
.lightbox-view img { margin: auto; max-width: calc(100% - 2rem); max-height: calc(100% - 2rem); background: #fff; }
.lightbox.actual .lightbox-view img { max-width: none; max-height: none; }
.lightbox img.zoomable { cursor: zoom-in; }
.lightbox.actual img.zoomable { cursor: zoom-out; }
.lightbox-close {
  position: fixed; top: .75rem; right: .75rem; width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .6); color: #fff; font-size: 1.75rem; line-height: 1; cursor: pointer;
}
.lightbox-close:hover { background: rgba(0, 0, 0, .85); }
html:has(.lightbox[open]) { overflow: hidden; }

/* ---- Settings: stream messages, and what's on air */
.on-air {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .3rem 1rem;
  margin: 0; padding: .75rem 1rem; font-size: .9rem;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.on-air dt { color: var(--muted); }
.on-air dd { margin: 0; overflow-wrap: anywhere; }
.on-air .problem { color: var(--err); }
.messages { list-style: none; margin: .75rem 0 0; padding: 0; border-top: 1px solid var(--border); }
.messages > li {
  display: flex; gap: .75rem; align-items: flex-start; justify-content: space-between;
  padding: .65rem .25rem; border-bottom: 1px solid var(--border);
}
.messages .name { display: flex; gap: .4rem; }
.messages .name + .name { margin-top: .15rem; }
.messages .target {
  flex: none; width: 4.5rem; padding-top: .2rem;
  color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
}
#stream-form > .hint { margin-bottom: 1rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: .3rem .75rem; font-size: .85rem; }
.stream-preview {
  margin: .3rem 0 0; padding: .45rem .65rem; font-weight: 600; overflow-wrap: anywhere;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px;
}
@media (max-width: 520px) {
  .messages > li { flex-direction: column; gap: .3rem; }
  .messages .state { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .3rem .75rem; }
}
