:root {
  color-scheme: dark;
  --base: #171817;
  --surface: #1f211f;
  --raised: #292c29;
  --border: #3d403b;
  --text: #f0f1eb;
  --dim: #aeb3a9;
  --accent: #cbef77;
  --accent-dark: #1a2710;
  --danger: #f5b4a9;
  font: 15px/1.45 system-ui, sans-serif;
  color: var(--text);
  background: var(--base);
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.sprites { position: absolute; width: 0; height: 0; overflow: hidden; }
svg { flex: none; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.shell { width: min(100% - 48px, 1032px); margin-inline: auto; }
.topbar { border-bottom: 1px solid var(--border); }
.topbar-inner { min-height: 53px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: inline-flex; gap: 9px; align-items: center; font-weight: 700; }
.brand svg { width: 22px; height: 22px; color: var(--accent); }
.remaining, .muted { color: var(--dim); font-size: 13px; }
.remaining { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.remaining::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
main { padding-block: 20px 28px; }
h1, h2, p { margin: 0; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 650; }
h2 { font-size: 17px; font-weight: 650; }
.message { max-width: 440px; margin: 14vh auto 0; }
.message h1 { font-size: 32px; }
.message p { color: var(--dim); margin-block: 14px 22px; }
.task-heading { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.prompt { margin: 0 0 14px; overflow-wrap: anywhere; }
#review.solo { max-width: 570px; margin-inline: auto; }

button, textarea, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button, textarea { border-radius: 6px; }
button:disabled { cursor: default; }
button:focus-visible, textarea:focus-visible, input:focus-visible, .choice:has(input:focus-visible) {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
kbd { flex: none; display: inline-grid; place-items: center; min-width: 19px; min-height: 19px; padding: 0 4px; border: 1px solid #ffffff27; border-radius: 4px; color: var(--dim); font: 11px/1 system-ui, sans-serif; }
.primary, .secondary, .control, .icon-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 5px 10px; background: var(--raised); border: 1px solid var(--border); font-size: 13px; font-weight: 600;
}
.primary { min-height: 40px; padding-inline: 14px; background: var(--accent); color: var(--accent-dark); border-color: var(--accent); }
.primary kbd { border-color: #26361354; color: inherit; }
.primary:disabled { color: var(--dim); background: var(--raised); border-color: var(--border); }
.primary:disabled kbd { border-color: #ffffff27; }
.icon-button { width: 36px; padding: 4px; }
@media (hover: hover) {
  .secondary:hover:not(:disabled), .control:hover:not(:disabled), .icon-button:hover:not(:disabled) { background: #343833; }
  .primary:hover:not(:disabled) { background: #ddfa9d; }
}

.media { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.media:empty { display: none; }
.media.one { grid-template-columns: minmax(0, 1fr); }
.player { min-width: 0; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; }
.player.active { border-color: #80924e; }
.player-heading { min-height: 39px; padding: 5px 10px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.player-heading h2 { display: flex; align-items: center; gap: 8px; }
.side { display: inline-grid; place-items: center; min-width: 26px; height: 25px; padding: 0 6px; border-radius: 4px; background: var(--raised); color: var(--text); font-size: 13px; }
.active .side { background: var(--accent); color: var(--accent-dark); }
.watched { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; }
.watched.met { color: var(--accent); }
.stage { display: grid; place-items: center; position: relative; width: 100%; height: clamp(240px, 40vh, 390px); border-radius: 0; background: #0d0f0e; padding: 0; border: 0; overflow: hidden; }
.media-element { display: block; width: 100%; height: 100%; overflow: hidden; }
.media-element:has(audio) { display: none; }
.stage video { display: block; width: 100%; height: 100%; object-fit: contain; }
.stage-play { position: absolute; display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid #ffffff61; border-radius: 50%; background: #141615dc; color: #fff; }
.stage-play svg { width: 24px; height: 24px; }
.stage.playing .stage-play, .stage.started .stage-play, .stage:has(.media-error:not([hidden])) .stage-play { display: none; }
.stage:has(.meter:not([hidden])) { height: 126px; }
.stage:has(.meter:not([hidden])) .stage-play { bottom: 8px; width: 32px; height: 32px; }
.stage:has(.meter:not([hidden])) .stage-play svg { width: 19px; height: 19px; }
.meter { display: flex; align-items: center; gap: 4px; height: 64px; margin-bottom: 22px; }
.meter span { display: block; width: 4px; height: var(--level, 4px); max-height: 100%; border-radius: 4px; background: var(--accent); opacity: .8; }
.media-error { position: absolute; padding: 6px 10px; background: var(--base); color: var(--danger); font-size: 13px; }

.timeline-frame { position: relative; margin: 9px 11px 0; padding-top: 8px; }
.timeline { display: block; width: 100%; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.marks { position: absolute; top: 0; left: 8px; right: 8px; height: 12px; }
.mark { position: absolute; inset-block: 0; width: 12px; padding: 0; transform: translateX(-50%); border: 0; background: transparent; }
.mark::before { display: block; content: ''; margin: auto; width: 6px; height: 8px; border-radius: 1px; background: var(--accent); }
.player-tools, .player-bottom { display: flex; align-items: center; gap: 6px; padding: 6px 10px; }
.transport { display: flex; gap: 4px; }
.control { min-height: 32px; padding-inline: 5px; gap: 4px; }
.control svg { width: 16px; height: 16px; }
.control.pin { padding-inline: 6px; }
.timestamp { margin-right: auto; color: var(--dim); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.player-bottom { padding-block: 2px 8px; }
.seen { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; color: var(--dim); font-size: 12px; }
.seen input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.pins { display: grid; gap: 4px; margin: 0; list-style: none; padding: 4px 10px 10px; }
.pins button { width: 100%; justify-content: start; text-align: left; overflow-wrap: anywhere; }
.pin-time { align-self: start; color: var(--accent); font-variant-numeric: tabular-nums; }

#answer { display: grid; gap: 13px; margin-top: 17px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend, .response-area > label { display: block; padding: 0; margin-bottom: 6px; font-size: 14px; font-weight: 650; overflow-wrap: anywhere; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; }
.choice { position: relative; display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 5px 10px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); overflow-wrap: anywhere; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice input:focus-visible { outline: none; }
.choice:has(input:checked) { border-color: var(--accent); background: #2a3420; color: var(--accent); }
@media (hover: hover) { .choice:hover { border-color: var(--dim); } }
.optional { color: var(--dim); font-size: 12px; font-weight: 400; margin-left: 8px; }
textarea { display: block; width: 100%; padding: 8px 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); resize: vertical; }
textarea::placeholder { color: #92998c; }
.voice-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.response-area > .voice-row { margin-top: 6px; }
.record { touch-action: none; user-select: none; -webkit-touch-callout: none; }
.record[aria-pressed=true] { border-color: var(--danger); color: var(--danger); }
.voice-row audio { width: min(226px, 65vw); height: 36px; }
.action-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--border); padding-top: 12px; }
.action-row > div { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
#feedback { color: var(--dim); font-size: 13px; }
#feedback.error { color: var(--danger); }

dialog { position: fixed; inset: 0; width: min(440px, 100% - 34px); max-height: calc(100% - 26px); margin: auto; padding: 17px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
dialog::backdrop { background: #070907b5; }
.dialog-heading, .dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.dialog-heading { margin-bottom: 8px; }
.dialog-actions { margin-top: 10px; }
.dialog-actions .primary { margin-left: auto; }
dialog label { display: block; margin-bottom: 6px; color: var(--dim); }

@media (max-width: 700px) {
  .shell { width: calc(100% - 26px); }
  .media { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .stage { height: clamp(220px, 45vh, 390px); }
  main { padding-top: 15px; }
  .choice, .secondary, .control, .icon-button { min-height: 40px; }
  textarea { font-size: 16px; }
}
@media (max-width: 400px) {
  .pin span { display: none; }
  .player-tools { padding-inline: 8px; }
}
@media (max-width: 350px) {
  .transport { gap: 3px; }
  .control { padding-inline: 4px; }
  .control kbd { min-width: 16px; padding-inline: 2px; }
}

@media (pointer: coarse) { kbd { display: none; } }
