:root {
  color-scheme: dark;
  --bg: #111;
  --panel: #1a1a1a;
  --line: #383838;
  --text: #f2f2f2;
  --muted: #aaa;
  --red: #e32b2b;
  font-family: Arial, Helvetica, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.45;
}

a { color: inherit; }
button, audio { font: inherit; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header,
main,
footer {
  width: min(960px, calc(100% - 36px));
  margin: 0 auto;
}

.site-header {
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.site-name {
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  text-decoration: none;
}

.site-header span { color: var(--muted); }

.archive-search {
  margin-left: auto;
  display: flex;
  min-width: 280px;
}

.archive-search input,
.archive-search button {
  min-height: 40px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
}

.archive-search input {
  min-width: 0;
  width: 100%;
  padding: 9px 11px;
  border-right: 0;
  border-radius: 3px 0 0 3px;
}

.archive-search input::placeholder { color: var(--muted); }
.archive-search input:focus { outline: 2px solid var(--red); outline-offset: -2px; }

.archive-search button {
  padding: 9px 13px;
  border-radius: 0 3px 3px 0;
  cursor: pointer;
}

.archive-search button:hover,
.archive-search button:focus-visible { border-color: var(--red); }

.automation {
  margin: 42px 0 28px;
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.label {
  display: block;
  margin: 0 0 5px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 6vw, 50px); line-height: 1; }
h2 { margin-bottom: 0; font-size: 28px; }
.stream-title { margin: 0; color: var(--muted); }

.stream-button,
.play-recording,
.download {
  border: 1px solid var(--line);
  border-radius: 3px;
  color: #fff;
  background: #252525;
  cursor: pointer;
  text-decoration: none;
}

.stream-button {
  min-width: 160px;
  padding: 13px 18px;
  background: var(--red);
  border-color: var(--red);
  font-weight: 700;
}

.stream-button:hover,
.stream-button:focus-visible { background: #bf2020; }

.player {
  margin-bottom: 36px;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  align-items: center;
  gap: 20px;
  border: 1px solid var(--line);
}

.player[hidden] { display: none; }
.player strong { display: block; overflow-wrap: anywhere; }
.player audio { width: 100%; }
.player-controls { min-width: 0; }
.external-player {
  display: inline-block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}
.external-player:hover,
.external-player:focus-visible { color: #fff; }

.archive { padding: 18px 0 60px; }
.archive-header, .recordings-heading, footer {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
}

.rss-link { color: var(--muted); }

.years {
  margin: 22px 0 44px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.years a {
  padding: 8px 11px;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  text-decoration: none;
}

.years a:hover,
.years a:focus-visible,
.years a.active { border-color: var(--red); color: #fff; }

.recordings-heading {
  padding-bottom: 12px;
  border-bottom: 2px solid var(--text);
}

.recordings-heading span { color: var(--muted); }

.recording {
  padding: 18px 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.recording h3 { margin-bottom: 5px; font-size: 18px; }
.recording p { margin: 0; color: var(--muted); font-size: 14px; }
.recording-actions { display: flex; gap: 8px; }
.play-recording, .download { padding: 8px 12px; }
.play-recording:hover, .download:hover { border-color: #777; }

footer {
  min-height: 90px;
  padding: 22px 0;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

footer nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 16px; }

.alt-rss-footer {
  width: min(960px, calc(100% - 36px));
  margin: 0 auto;
  padding: 0 0 28px;
  text-align: right;
}

.alt-rss-footer a { color: var(--red); font-weight: 700; }

.unsorted-files-footer {
  width: min(960px, calc(100% - 36px));
  margin: 0 auto;
  padding: 0 0 22px;
}

.unsorted-files-footer a { color: var(--red); font-weight: 700; }

.unsorted-page { padding: 42px 0 72px; }
.unsorted-page > p { max-width: 680px; color: var(--muted); }
.unsorted-back { display: inline-block; margin-bottom: 24px; color: var(--muted); }
.file-browser { margin-top: 30px; border-top: 2px solid var(--text); }
.file-browser-status { padding: 22px 0; color: var(--muted); }
.file-breadcrumbs { display: flex; flex-wrap: wrap; gap: 7px; margin: 22px 0 10px; color: var(--muted); }
.file-breadcrumbs a { color: var(--text); }
.file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.file-name { min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
.file-meta { color: var(--muted); font-size: 14px; white-space: nowrap; }

.backup-dialog {
  width: min(500px, calc(100% - 36px));
  padding: 0;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
}

.backup-dialog::backdrop { background: rgba(0, 0, 0, .78); }
.backup-dialog form { padding: 26px; }
.backup-dialog h2 { margin-bottom: 12px; }
.backup-dialog p:not(.label) { color: var(--muted); }
.dialog-actions { margin-top: 24px; display: flex; justify-content: flex-end; gap: 10px; }
.dialog-actions button, .dialog-actions a {
  padding: 10px 14px;
  color: #fff;
  background: #252525;
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
}
.dialog-actions a { background: var(--red); border-color: var(--red); }

@media (max-width: 640px) {
  .site-header { padding: 14px 0; align-items: flex-start; justify-content: center; flex-direction: column; gap: 0; }
  .site-header span { font-size: 13px; }
  .archive-search { width: 100%; min-width: 0; margin: 12px 0 0; }
  .automation { margin-top: 24px; padding: 22px; align-items: stretch; flex-direction: column; }
  .stream-button { width: 100%; }
  .player { grid-template-columns: 1fr; }
  .recording { grid-template-columns: 1fr; gap: 12px; }
  .recording-actions a, .recording-actions button { text-align: center; flex: 1; }
  footer { align-items: flex-start; flex-direction: column; }
  footer nav { justify-content: flex-start; }
  .alt-rss-footer { text-align: left; }
  .file-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; }
  .file-row .file-date { grid-column: 1 / -1; }
  .dialog-actions { align-items: stretch; flex-direction: column; }
  .dialog-actions button, .dialog-actions a { text-align: center; }
}
