:root {
  --bg: #fff;
  --fg: #1a1a1a;
  --muted: #666;
  --line: #e2e2e2;
  --soft: #f3f3f3;
  --accent: #b3261e;
  --link: #0b57d0;
  --danger: #b3261e;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121212;
    --fg: #e8e8e8;
    --muted: #a0a0a0;
    --line: #333;
    --soft: #1e1e1e;
    --accent: #f2726a;
    --link: #8ab4f8;
    --danger: #f2726a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0 auto;
  max-width: 720px;
  padding: 0 16px;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--link); }
h1 { font-size: 1.35rem; line-height: 1.3; margin: 16px 0 4px; }
h2 { font-size: 1.1rem; margin: 32px 0 8px; }
p { margin: 8px 0; }
.date, .help, .meta { color: var(--muted); font-size: 0.9rem; }
.empty { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header and footer */
header.site {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--line); margin: 0 -16px; padding: 0 16px;
}
header.site a { color: var(--fg); text-decoration: none; padding: 14px 0; min-height: 48px; }
header.site a.home { font-weight: 700; font-size: 1.1rem; }
header.site a[aria-current] { text-decoration: underline; text-underline-offset: 4px; }
footer.site {
  margin: 48px -16px 0; padding: 16px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.85rem;
}
main { padding-bottom: 8px; }

.flash { background: var(--soft); border-left: 3px solid var(--fg); padding: 10px 12px; margin: 16px 0; }
.error { color: var(--danger); font-weight: 600; }
.notices { margin: 16px 0 0; }
.notice { background: var(--soft); padding: 10px 12px; border-radius: 6px; }

/* lists of videos */
ul.videos, ul.history, ol.comments { list-style: none; margin: 0; padding: 0; }
a.row {
  display: block; color: inherit; text-decoration: none;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
a.row .title { display: block; font-weight: 600; }
a.row .date { display: block; }
a.row:hover .title, a.row:focus-visible .title { text-decoration: underline; }
.poster { display: block; position: relative; margin-bottom: 8px; }
.poster img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }
.poster progress { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 0 0 6px 6px; }
.tag {
  display: inline-block; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--bg); background: var(--accent);
  padding: 1px 6px; border-radius: 3px; margin-bottom: 2px;
}

/* the thin progress bar */
progress {
  -webkit-appearance: none; appearance: none; display: block;
  width: 100%; height: 4px; margin-top: 8px; border: 0;
  background: var(--line); color: var(--accent);
}
.poster progress { margin: 0; width: 100%; }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }

/* watch */
.player { margin: 16px -16px 0; }
video { display: block; width: 100%; max-height: 70vh; background: #000; }
.video-error { padding: 0 16px; color: var(--danger); }
.description { white-space: pre-wrap; overflow-wrap: anywhere; margin: 16px 0; }
form.like { margin: 12px 0; }
.comment { padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment:first-child { border-top: 1px solid var(--line); }
.comment .meta { margin: 0; }
.comment .name { color: var(--fg); font-weight: 600; }
.comment .host {
  color: var(--bg); background: var(--fg); font-weight: 600;
  padding: 1px 8px; border-radius: 999px;
}
.comment .text { white-space: pre-wrap; overflow-wrap: anywhere; margin: 4px 0 0; }
.actions { margin-top: 8px; }
.comment-form { margin-top: 24px; }

/* forms */
label { display: block; font-weight: 600; margin: 16px 0 4px; }
input, textarea {
  display: block; width: 100%; font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--muted); border-radius: 6px; padding: 10px 12px; min-height: 44px;
}
textarea { resize: vertical; }
input:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
button, a.button {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 600; min-height: 44px; padding: 8px 16px; margin: 8px 8px 0 0;
  color: var(--fg); background: var(--soft); border: 1px solid var(--line); border-radius: 6px;
  text-decoration: none; cursor: pointer;
}
button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); }
[hidden] { display: none !important; }
#code { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: 0.05em; }
button.danger { color: var(--bg); background: var(--danger); border-color: var(--danger); }
.comment .actions > a.button { min-height: 36px; padding: 4px 12px; font-size: 0.9rem; margin-top: 0; }
.confirm { background: var(--soft); border-radius: 6px; padding: 8px 12px 12px; margin-top: 8px; }
.confirm form { display: inline; }
.confirm p { margin: 4px 0; }
.as { margin: 16px 0 0; }

/* the code */
.code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 1.6rem; font-weight: 600; letter-spacing: 0.04em; line-height: 1.35;
  user-select: all; -webkit-user-select: all; margin: 8px 0;
}
.code span { display: inline-block; white-space: nowrap; }
.code.small { font-size: 1.15rem; }
@media (max-width: 360px) { .code { font-size: 1.35rem; } }

/* host numbers */
table.numbers { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.numbers th, .numbers td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.numbers td { text-align: right; font-variant-numeric: tabular-nums; width: 4.5em; }
.numbers thead th:not(:first-child) { text-align: right; }
.numbers tbody th { font-weight: 400; }
body { display: flex; flex-direction: column; min-height: 100vh; }
main { flex: 1; }
video { aspect-ratio: 16 / 9; }
