:root {
  --bg: #0d0d0d;
  --fg: #ececec;
  --muted: #9a9a9a;
  --card: #171717;
  --line: #333;
  --accent: #ff66b2;
  --on-accent: #000;
  --ok: #8afe00;
  --err: #ff5c5c;
  --field: #101010;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f6f3; --fg: #161616; --muted: #666; --card: #fff; --line: #cfcfcf;
    --accent: #c2186f; --on-accent: #fff; --ok: #2f8a00; --err: #c62828; --field: #fafafa;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
/* `hidden` must win over the display rules below (.row, .seg label, #who...). */
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.45 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
header {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
h1 { font-size: 18px; margin: 0; font-weight: 600; }
h1 span { color: var(--accent); }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 16px; margin: 0; }
main, #login { max-width: 860px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 420px; margin-top: 40px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.hint { color: var(--muted); font-size: 13px; }
.err-text { color: var(--err); }
#who { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* --- buttons: filled = the main action, .ghost = secondary, .danger = destructive --- */
input, select, textarea, button {
  font: inherit; color: var(--fg); background: var(--field); border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 10px;
}
button {
  cursor: pointer; background: var(--accent); color: var(--on-accent); border-color: var(--accent);
  font-weight: 600; padding: 8px 16px; min-height: 38px;
}
button:hover { filter: brightness(1.1); }
button.ghost, button.small { background: transparent; color: var(--fg); border-color: var(--line); font-weight: normal; }
button.ghost:hover, button.small:hover { border-color: var(--accent); color: var(--accent); filter: none; }
button.small { padding: 4px 10px; min-height: 30px; font-size: 13px; }
button.danger { color: var(--err); }
button.danger:hover { border-color: var(--err); color: var(--err); }
button:disabled { opacity: .5; cursor: wait; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}
input[type=file] { width: 100%; padding: 6px; }
input[type=file]::file-selector-button {
  font: inherit; cursor: pointer; margin-right: 10px; padding: 6px 12px; border-radius: 6px;
  background: transparent; color: var(--fg); border: 1px solid var(--accent);
}

/* --- tabs --- */
nav { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { background: transparent; border: 1px solid var(--line); color: var(--fg); font-weight: normal; }
.tab:hover { border-color: var(--accent); filter: none; }
.tab.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }

/* --- forms --- */
label, .field-label { display: block; margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.field-label { margin-bottom: 4px; }
label > input, label > select, label > textarea { display: block; width: 100%; margin-top: 3px; }
textarea { resize: vertical; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > label { flex: 1 1 140px; }
.row > label.short { flex: 0 1 100px; }
.row > input, .row > select { flex: 1 1 160px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 8px 0 12px; padding: 10px 12px; }
legend { color: var(--muted); font-size: 13px; padding: 0 4px; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 12px; }
#login-form button { width: 100%; margin-top: 4px; }

/* --- choices as buttons: radios (.seg) and checkboxes (.seg.chips) --- */
.seg { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 12px; }
.seg label {
  position: relative; display: inline-flex; align-items: center; gap: 7px; margin: 0;
  padding: 7px 13px; min-height: 36px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--field); color: var(--fg); font-size: 14px; cursor: pointer; user-select: none;
}
.seg label:hover { border-color: var(--accent); }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; margin: 0; }
.seg label::before {  /* the radio dot / check box */
  content: ""; flex: none; width: 12px; height: 12px; border: 1px solid var(--muted); border-radius: 50%;
}
.seg.chips label::before { border-radius: 3px; }
.seg label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.seg label:has(input:checked)::before { background: var(--accent); border-color: var(--accent); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 1px; }
.row > .seg { margin: 0; }

/* --- on/off switch --- */
.switch {
  display: inline-flex; align-items: center; gap: 8px; background: transparent; border-color: transparent;
  color: var(--fg); font-weight: normal; padding: 4px 6px;
}
.switch:hover { filter: none; border-color: var(--line); }
.switch .track { position: relative; flex: none; width: 40px; height: 22px; border-radius: 11px; background: var(--line); transition: background .15s; }
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--fg); transition: left .15s;
}
.switch[aria-checked=true] .track { background: var(--ok); }
.switch[aria-checked=true] .track::after { left: 21px; background: #000; }

/* --- status --- */
.badge { border: 1px solid var(--accent); color: var(--accent); padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.pill {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border: 1px solid var(--muted); border-radius: 10px;
  color: var(--muted); font-size: 11px; font-weight: normal; vertical-align: middle;
}
.pill.on { border-color: var(--ok); color: var(--ok); }
#toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 10;
  max-width: min(640px, calc(100vw - 32px)); padding: 10px 14px; border-radius: 8px;
  background: var(--card); border: 1px solid var(--ok); white-space: pre-wrap; box-shadow: 0 4px 20px rgba(0, 0, 0, .4);
}
#toast.err { border-color: var(--err); }

/* --- show cards --- */
.show-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.show-head img, .show-head .no-img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; flex: none; }
.show-head .no-img { border: 1px dashed var(--line); }
.show-head .meta { flex: 1 1 220px; min-width: 0; }
.show-head .meta p { margin: 3px 0; }
.show-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.airings { list-style: none; padding: 0; margin: 12px 0 0; }
.airings li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-top: 1px dashed var(--line); }
.airings li .when { color: var(--accent); min-width: 17ch; }
.airings li .what { flex: 1; min-width: 10ch; }
.nothing { margin: 12px 0 0; padding-top: 8px; border-top: 1px dashed var(--line); }
.empty { text-align: center; padding: 28px 16px; }

/* --- tables (admin) --- */
table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
td, th { text-align: left; padding: 6px; border-top: 1px solid var(--line); vertical-align: middle; word-break: break-word; }
th { color: var(--muted); font-weight: normal; }

/* --- dialogs --- */
dialog {
  width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto;
  background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 10px; padding: 18px;
}
dialog::backdrop { background: rgba(0, 0, 0, .6); }
.busy { font-size: 13px; margin: 2px 0 12px; color: var(--muted); }
.upload-status { font-size: 13px; color: var(--muted); margin-top: 6px; }
#track-list { padding-left: 22px; margin: 8px 0 0; }
#track-list li { margin-bottom: 8px; }
#track-list .row { align-items: center; }
#track-list .row input { flex: 1 1 120px; }
.progress { margin-top: 10px; color: var(--muted); font-size: 13px; white-space: pre-wrap; }

@media (max-width: 520px) {
  .show-head img, .show-head .no-img { width: 56px; height: 56px; }
  .show-actions { width: 100%; }
  .airings li .when { min-width: 100%; }
  .actions button { flex: 1; }
}
a.nd { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
a.nd:hover { filter: brightness(1.2); }
#cleanup-list { margin: 10px 0 12px; padding-left: 20px; font-size: 13px; }
#cleanup-list li { margin-bottom: 3px; word-break: break-word; }
.intro .intro-name { color: var(--fg); word-break: break-all; }
.intro button { margin-left: 4px; }

/* --- blog editor (editor.html, static/editor.js) --- */
main.wide { max-width: 1280px; }
.blog { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.blog aside .card:last-child { margin-bottom: 0; }
@media (max-width: 900px) { .blog { grid-template-columns: 1fr; } }
.wide-btn { width: 100%; }
.post-list { list-style: none; padding: 0; margin: 12px 0 0; max-height: 60vh; overflow-y: auto; }
.post-list li { padding: 8px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; word-break: break-word; }
.post-list li:hover { background: color-mix(in srgb, var(--fg) 5%, transparent); }
.post-list li.active { border-color: var(--accent); }
.post-list .pill { margin: 0 4px 0 0; }
.post-list small { display: block; color: var(--muted); font-size: 12px; }
.title-input { width: 100%; font-size: 22px; font-weight: 600; border: none; background: none; padding: 4px 0; }
.title-input:focus-visible { outline: none; border-bottom: 1px solid var(--accent); border-radius: 0; }
.slug { color: var(--muted); font-size: 12px; word-break: break-all; }
.cover-drop { position: relative; border: 1px dashed var(--line); border-radius: 8px; min-height: 110px; display: grid; place-items: center;
  color: var(--muted); font-size: 13px; text-align: center; padding: 8px; cursor: pointer; overflow: hidden; margin-top: 12px; }
.cover-drop:has(img) { padding: 0; }
.cover-drop img { width: 100%; max-height: 260px; object-fit: cover; display: block; }
.cover-drop .remove { position: absolute; top: 8px; right: 8px; background: var(--card); }
.cover-drop.over { border-color: var(--accent); color: var(--accent); }
.toolbar { display: flex; gap: 4px; flex-wrap: wrap; margin: 16px 0 8px; position: sticky; top: 0; background: var(--card); padding: 6px 0; z-index: 2; }
.toolbar button { background: none; color: var(--fg); border: 1px solid var(--line); font-weight: normal; padding: 4px 10px; min-height: 32px; font-size: 13px; }
.toolbar button:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.toolbar .sep { width: 1px; background: var(--line); margin: 0 4px; }
.md-help { margin: 0 0 10px; line-height: 1.8; }
.md-help code { background: var(--field); padding: 1px 4px; border-radius: 3px; }
.panes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 1100px) { .panes { grid-template-columns: 1fr; } .post-out { height: auto; max-height: 80vh; } }
.pane-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; }
#post-body { width: 100%; height: min(72vh, 900px); min-height: 360px; line-height: 1.6; }
#post-warnings { margin: 8px 0; padding-left: 20px; font-size: 13px; }
.post-bar { display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 8px; }
.post-bar .actions { margin: 0; flex-wrap: wrap; }
.episode-list { list-style: none; padding: 0; margin: 12px 0; max-height: 55vh; overflow-y: auto; }
.episode-list button { width: 100%; text-align: left; margin-bottom: 6px; }
.episode-list small { color: var(--muted); }
#episode-filter { width: 100%; }
/* The preview: the blog's own look (radio-braquage css/blog.css), on the main station's colours. */
.post-out { border: 1px solid var(--line); border-radius: 6px; padding: 4px 22px 18px; height: min(72vh, 900px); min-height: 360px; background: #000; color: #feffff;
  font: 17px/1.6 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; overflow: auto; overflow-wrap: break-word; }
.post-out h1 { font: 600 30px/1.15 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif; margin: 18px 0; }
.post-out .cover { width: calc(100% + 44px); margin: -4px -22px 0; max-height: 260px; object-fit: cover; display: block; }
.post-out a { color: inherit; }
.post-out code { font: 0.85em monospace; background: #222; padding: 1px 4px; }
.post-out h2 { font: bold 13px/1.4 monospace; letter-spacing: 2px; text-transform: uppercase; margin: 28px 0 10px; }
.post-out h3 { font: bold 12px/1.4 monospace; letter-spacing: 1px; margin: 22px 0 8px; }
.post-out blockquote { margin: 24px 0; font: italic 22px/1.35 'Iowan Old Style', Palatino, Georgia, serif; text-align: center; border-top: 1px solid; border-bottom: 1px solid; padding: 12px 0; }
.post-out hr { border: none; text-align: center; margin: 24px 0; }
.post-out hr::after { content: '* * *'; letter-spacing: 8px; opacity: .5; }
.post-out figure { margin: 20px 0; }
.post-out figure img { width: 100%; display: block; }
.post-out figcaption { font: 11px monospace; opacity: .6; margin-top: 6px; }
.post-out .episode-embed { display: flex; gap: 12px; align-items: center; background: #1d1d1d; padding: 10px 12px; text-decoration: none; font: 13px monospace; margin: 18px 0; pointer-events: none; }
