:root {
  --bg: #0d0d0d;
  --fg: #ececec;
  --muted: #9a9a9a;
  --card: #171717;
  --line: #2c2c2c;
  --accent: #ff66b2;
  --ok: #8afe00;
  --err: #ff4d4d;
  --field: #101010;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f6f3; --fg: #161616; --muted: #666; --card: #fff; --line: #ddd;
    --accent: #c2186f; --ok: #2f7d00; --err: #c62828; --field: #fafafa;
    color-scheme: light;
  }
}
* { box-sizing: border-box; }
/* `hidden` must win over the display rules below (.row, label.inline, #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: 15px; margin: 0; }
main, #login { max-width: 860px; margin: 0 auto; padding: 16px; }
.narrow { max-width: 420px; margin-top: 40px; }
nav { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { background: none; border: 1px solid var(--line); color: var(--muted); }
.tab.active { color: var(--fg); border-color: var(--accent); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 16px; margin-bottom: 16px; }
label { display: block; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
label.inline { display: inline-flex; gap: 6px; align-items: center; margin-right: 14px; color: var(--fg); }
input, select, textarea, button {
  font: inherit; color: var(--fg); background: var(--field); border: 1px solid var(--line);
  border-radius: 4px; padding: 7px 9px;
}
label > input:not([type=checkbox]):not([type=radio]), label > select, label > textarea { display: block; width: 100%; margin-top: 3px; }
textarea { resize: vertical; }
button { cursor: pointer; background: var(--accent); color: #000; border-color: var(--accent); font-weight: 600; }
button.link, button.small { background: none; color: var(--accent); border-color: transparent; font-weight: normal; padding: 4px 6px; }
button.danger { color: var(--err); }
button:disabled { opacity: .5; cursor: wait; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > label { flex: 1 1 140px; }
.row > label.short { flex: 0 1 100px; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 8px 0 12px; padding: 10px 12px; }
legend { color: var(--muted); font-size: 13px; padding: 0 4px; }
.weeks { margin-top: 4px; }
.weeks > span:first-child { color: var(--muted); font-size: 13px; margin-right: 8px; }
.hint { color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.badge { border: 1px solid var(--accent); color: var(--accent); padding: 2px 8px; border-radius: 10px; font-size: 12px; margin-right: 8px; }
#who { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.show-head { display: flex; gap: 12px; align-items: flex-start; }
.show-head img { width: 72px; height: 72px; object-fit: cover; border-radius: 4px; flex: none; }
.show-head .meta { flex: 1; min-width: 0; }
.show-head .meta p { margin: 3px 0; }
.airings { list-style: none; padding: 0; margin: 12px 0 0; }
.airings li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 0; border-top: 1px dashed var(--line); }
.airings li .when { color: var(--accent); min-width: 15ch; }
.airings li .what { flex: 1; min-width: 10ch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
td, th { text-align: left; padding: 5px 6px; border-top: 1px solid var(--line); vertical-align: top; word-break: break-word; }
th { color: var(--muted); font-weight: normal; }
#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: 6px;
  background: var(--card); border: 1px solid var(--ok); white-space: pre-wrap;
}
#toast.err { border-color: var(--err); }
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: 8px; padding: 18px;
}
dialog::backdrop { background: rgba(0, 0, 0, .6); }
.busy { font-size: 13px; margin: 2px 0 12px; color: var(--muted); }
.busy .clash { color: var(--err); }
.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 input { flex: 1 1 120px; }
.progress { margin-top: 10px; color: var(--muted); font-size: 13px; white-space: pre-wrap; }
.err-text { color: var(--err); }

/* show cards */
.show-head { flex-wrap: wrap; }
.show-head .meta { flex: 1 1 220px; }
.show-head .no-img { width: 72px; height: 72px; border-radius: 4px; flex: none; border: 1px dashed var(--line); }
.show-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.airings li .when { min-width: 17ch; }
.nothing { margin: 12px 0 0; padding-top: 8px; border-top: 1px dashed var(--line); }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 520px) {
  .show-head img, .show-head .no-img { width: 56px; height: 56px; }
  .airings li .when { min-width: 100%; }
}
