:root {
  --bg: #f6f3ec;
  --panel: #fffdf8;
  --ink: #1f2430;
  --muted: #5d6472;
  --line: #d9d3c5;
  --accent: #b4491f;
  --accent-ink: #ffffff;
  --chip: #efeadd;
  --chip-on: #1f2430;
  --chip-on-ink: #fffdf8;
  --focus: #1c5fd6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171c;
    --panel: #1d2027;
    --ink: #ece8de;
    --muted: #9aa0ad;
    --line: #353a45;
    --accent: #e0703f;
    --accent-ink: #15171c;
    --chip: #2a2e38;
    --chip-on: #ece8de;
    --chip-on-ink: #15171c;
    --focus: #7aa7ff;
  }
}
:root[data-theme="dark"] {
  --bg: #15171c;
  --panel: #1d2027;
  --ink: #ece8de;
  --muted: #9aa0ad;
  --line: #353a45;
  --accent: #e0703f;
  --accent-ink: #15171c;
  --chip: #2a2e38;
  --chip-on: #ece8de;
  --chip-on-ink: #15171c;
  --focus: #7aa7ff;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}
h1 { font-size: 1.7rem; line-height: 1.2; margin: 8px 0 12px; }
h2 { font-size: 1.25rem; line-height: 1.25; margin: 0 0 6px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 0.9rem; }

.progress { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; color: var(--muted); font-size: 0.9rem; }
.bar { flex: 1; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); transition: width 0.25s; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}
.setup { font-size: 1.02rem; }

.video-wrap { margin: 12px 0 8px; background: #000; border-radius: 8px; overflow: hidden; }
video { display: block; width: 100%; height: auto; max-height: 70vh; background: #000; }
.video-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }

.q { margin: 22px 0 0; padding: 0; border: 0; min-width: 0; }
.q legend { font-weight: 600; padding: 0; margin-bottom: 8px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit;
  color: var(--ink);
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  min-height: 44px;
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--chip-on); color: var(--chip-on-ink); border-color: var(--chip-on); }
.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.scale .chip { border-radius: 10px; padding: 8px 0; text-align: center; font-weight: 600; }
.scale-labels { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-size: 0.85rem; color: var(--muted); }
.scale-labels span:last-child { text-align: right; }

.btn {
  font: inherit;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  padding: 12px 22px;
  min-height: 48px;
  cursor: pointer;
}
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn.ghost { color: var(--ink); background: var(--chip); border: 1px solid var(--line); font-weight: 500; }
.actions { margin-top: 24px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hint { color: var(--muted); font-size: 0.9rem; }
.error { color: #b3261e; font-weight: 600; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .error { color: #ff8a80; } }

button:focus-visible, video:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

@media (max-width: 480px) {
  body { font-size: 16px; }
  .card { padding: 16px; }
  h1 { font-size: 1.45rem; }
}
