/* Permadata — play · dark, typographic, one accent. System fonts only. */

:root {
  --bg: #0b0c0f;
  --bg-elev: #111318;
  --bg-code: #0f1114;
  --fg: #e9eaee;
  --muted: #9aa1ac;
  --dim: #6b727d;
  --accent: #53dcf4;
  --accent-ink: #0b0c0f;
  --amber: #f0b429;
  --red: #f87171;
  --border: #23262d;
  --border-strong: #2e323b;
  --radius: 6px;
  --maxw: 780px;
  --stagew: 960px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must always win over author display rules
   (e.g. .overlay/.poster use display:flex). */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

.mono, code { font-family: var(--mono); }
code.inline {
  font-size: 13px;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--fg);
}

/* ── header ─────────────────────────────────────────────── */
.site-head { border-bottom: 1px solid var(--border); padding: 22px 0; }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; }
.wordmark {
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.14em;
  font-weight: 700;
  color: var(--fg);
}
.wordmark:hover { text-decoration: none; }
.wordmark .accent { color: var(--accent); }
.back-home { font-family: var(--mono); font-size: 13px; margin: 28px 0 0; }
.site-head .tag { color: var(--dim); font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; white-space: nowrap; }
.site-head .nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  align-items: center;
  margin-left: auto;
}
.site-head .nav a {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  padding: 10px 2px;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  white-space: nowrap;
}
.site-head .nav a:hover { color: var(--fg); text-decoration: none; }

/* ── stage (the video player) ───────────────────────────── */
.stage { max-width: var(--stagew); margin: 22px auto 0; padding: 0 24px; }

.frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  overflow: hidden;
}

/* poster / title card */
.poster {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  background:
    radial-gradient(120% 120% at 50% 0%, #171a20 0%, #0a0b0e 55%, #000 100%);
}
.poster-box { max-width: 620px; width: 100%; }
.poster .eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  color: var(--accent);
  text-transform: uppercase;
  margin: 0 0 18px;
}
.poster .title {
  font-size: clamp(26px, 4.4vw, 44px);
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 14px;
  font-weight: 800;
}
.poster .subtitle {
  font-size: clamp(15px, 2vw, 19px);
  color: var(--muted);
  margin: 0 0 6px;
  font-weight: 400;
}
.poster .film-meta {
  font-size: 12.5px;
  color: var(--dim);
  margin: 0;
  word-break: break-word;
}
.poster .hint {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--dim);
  margin: 22px 0 0;
}

/* the big play circle */
.big-play {
  margin: 30px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease;
}
.big-play .tri { display: block; margin-left: 6px; }
.big-play:hover { filter: brightness(1.08); transform: scale(1.05); }
.big-play:disabled { opacity: 0.45; cursor: default; transform: none; filter: none; }
.big-play.abs { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); margin: 0; }
.big-play.abs:hover { transform: translate(-50%, -50%) scale(1.05); }
.big-play.glass { background: rgba(11, 12, 15, 0.78); color: var(--accent); }

/* progress overlay inside the stage */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(6, 7, 9, 0.94);
}
.overlay-box { width: 100%; max-width: 560px; }
.pull-line {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--fg);
  margin: 0 0 22px;
  text-align: center;
}

/* video */
#video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

/* live download/lead line — small, unobtrusive, never covers the film */
.live-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 6px 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--fg);
  background: rgba(6, 7, 9, 0.72);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.live-progress.buffering { color: var(--amber); }

/* ── under-stage content ────────────────────────────────── */
section.block { padding: 44px 0 8px; }
h2 {
  font-size: clamp(22px, 3vw, 28px);
  letter-spacing: -0.01em;
  margin: 0 0 8px;
  font-weight: 750;
}
h2 .num { color: var(--accent); font-family: var(--mono); font-size: 0.72em; margin-right: 10px; }
.sub { color: var(--muted); margin: 0 0 22px; max-width: 46em; }

.toolkit-line {
  color: var(--muted);
  font-size: 15px;
  margin: 36px 0 0;
}

/* ── buttons ────────────────────────────────────────────── */
.dl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.02em;
  padding: 13px 22px;
  border-radius: var(--radius);
  border: 0;
  cursor: pointer;
  text-decoration: none;
}
.dl-btn:hover { text-decoration: none; filter: brightness(1.06); }
.dl-btn:disabled { opacity: 0.55; cursor: default; filter: none; }
.ghost-btn {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 14px;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.ghost-btn:hover { color: var(--fg); border-color: var(--accent); }

/* ── control row (advanced) ─────────────────────────────── */
.control-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin: 8px 0 4px;
}
.control-row input {
  flex: 1;
  min-width: 0;
  background: var(--bg-code);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 13px 14px;
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--fg);
}
.control-row input:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; }
.control-row .dl-btn { flex-shrink: 0; white-space: nowrap; }

/* ── warnings ───────────────────────────────────────────── */
.warn {
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--amber);
  background: var(--bg-elev);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 14px;
  margin: 18px 0 0;
}
.warn strong { color: var(--fg); }
.warn-amber { border-left-color: var(--amber); }

/* ── advanced ───────────────────────────────────────────── */
.advanced {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 22px 0 0;
}
.advanced summary {
  cursor: pointer;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--muted);
  user-select: none;
  list-style-position: inside;
}
.advanced summary:hover { color: var(--fg); }
.advanced[open] summary { border-bottom: 1px solid var(--border); }
.advanced-body { padding: 4px 16px 16px; }
.advanced-body .sub { margin: 10px 0 0; }

/* ── progress ───────────────────────────────────────────── */
.bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 0 16px;
}
.bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 200ms ease;
}
.progress-line {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--fg);
  margin: 0 0 4px;
  text-align: center;
}
.rate-line { font-family: var(--mono); font-size: 12.5px; color: var(--dim); margin: 0 0 18px; text-align: center; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 0; justify-content: center; }

/* ── verify badge ───────────────────────────────────────── */
.verify-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 4px 0 8px;
}
.badge {
  display: inline-block;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  color: var(--muted);
}
.badge.ok { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.badge.bad { color: #fff; background: var(--red); border-color: var(--red); }
.badge.busy { color: var(--amber); border-color: var(--amber); }

/* ── copy rows / code ───────────────────────────────────── */
.copy-row {
  display: flex;
  align-items: stretch;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 8px 0;
}
.copy-row code {
  flex: 1;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.55;
  padding: 14px 16px;
  color: var(--fg);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
.hash-value { font-size: 14px; }
.label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); display: block; margin: 18px 0 4px; }

/* ── error ──────────────────────────────────────────────── */
.error-card {
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--red);
  background: var(--bg-elev);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 22px 24px;
}
.error-card h2 { margin: 0 0 8px; color: var(--red); }
.error-card p { color: var(--muted); margin: 0 0 18px; word-break: break-word; }

/* ── footer ─────────────────────────────────────────────── */
footer { border-top: 1px solid var(--border); margin-top: 64px; padding: 40px 0 64px; color: var(--dim); }
footer .mono { font-family: var(--mono); font-size: 13px; }
footer .row { margin: 8px 0; }

/* ── responsive ─────────────────────────────────────────── */
@media (max-width: 720px) {
  .site-head .nav { order: 3; width: 100%; margin-left: 0; gap: 4px 14px; }
  .site-head .nav a { padding: 8px 2px; min-height: 44px; }
  .site-head .tag { display: none; }
}
@media (max-width: 620px) {
  .stage { padding: 0 12px; margin-top: 14px; }
  .poster { padding: 20px 16px; }
  .poster .title { font-size: clamp(21px, 6.4vw, 28px); }
  .big-play { width: 64px; height: 64px; font-size: 26px; margin-top: 22px; }
  .control-row { flex-direction: column; }
  .control-row .dl-btn { width: 100%; }
  .overlay { padding: 16px; }
}
