:root {
  color-scheme: light;
  --ink: #17202a;
  --muted: #667281;
  --line: #d9e0e7;
  --line-strong: #b9c4cf;
  --page: #f5f7f9;
  --panel: #fff;
  --soft: #f8fafc;
  --accent: #1859c9;
  --accent-dark: #11479f;
  --accent-soft: #e9f1ff;
  --silent: #edf0f3;
  --silent-line: #aeb8c2;
  --danger: #a9231a;
  --radius: 14px;
  --shadow: 0 12px 36px rgba(22, 34, 48, .08);
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  min-height: 100%;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.46 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body::before { display: block; position: fixed; inset: 0; z-index: 0; background-image: url("/mi-lab-pattern.png?v=3"); background-repeat: repeat; background-position: 0 0; content: ""; opacity: .72; filter: blur(.45px); pointer-events: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(1.65rem, 3vw, 2.3rem); line-height: 1.12; letter-spacing: -.025em; }
h2 { margin-bottom: 8px; font-size: 1.3rem; line-height: 1.2; letter-spacing: -.012em; }
p { margin-bottom: 12px; }

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-160%);
}
.skip-link:focus-visible { transform: none; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.hidden { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(217, 224, 231, .94);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(12px);
}
.topbar-inner {
  width: min(1280px, calc(100% - 32px));
  min-height: 52px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.topbar-session { flex: 1 1 220px; margin-left: auto; min-width: 0; text-align: right; }
.session-id { display: inline-block; min-height: 30px; max-width: 100%; overflow: hidden; padding: 5px 8px; border: 0; background: transparent; color: var(--muted); font-size: .72rem; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.session-id:hover, .session-id:focus-visible { background: var(--soft); color: var(--ink); }
.resume-panel { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.resume-panel h2 { margin: 0 0 4px; font-size: 1rem; }
.resume-panel p { margin: 0 0 10px; color: var(--muted); font-size: .86rem; }
.resume-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.resume-controls input { text-transform: uppercase; }
.brand { display: flex; flex: 0 0 auto; align-items: center; gap: 14px; white-space: nowrap; }
.brand-logo { display: block; flex: 0 0 96px; width: 96px; height: 21px; }
.brand-logo img { display: block; width: 96px; height: 21px; object-fit: contain; object-position: left center; filter: brightness(0); }
.brand strong { display: block; color: #2b3540; font-size: .84rem; line-height: 1; letter-spacing: -.012em; }
.study-progress { width: min(340px, 45vw); }
.progress-copy { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 5px; font-size: .78rem; }
.progress-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-copy span { color: var(--muted); white-space: nowrap; }
.progress-track { height: 3px; overflow: hidden; border-radius: 3px; background: #e8edf2; }
.progress-track span { display: block; width: 0; height: 100%; background: var(--accent); transition: width .2s ease; }

.page { position: relative; z-index: 1; width: min(1280px, calc(100% - 32px)); margin: 24px auto 52px; }
body:has(.study-shell.is-selecting:not(.hidden)) { overflow: hidden; }
body:has(.study-shell.is-selecting:not(.hidden)) .page { height: calc(100dvh - 74px); margin-top: 8px; margin-bottom: 8px; }
.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-dark);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.lead { color: #44515f; font-size: 1.05rem; }
.effort-note { margin: 17px 0 5px; padding: 12px 14px; border-left: 3px solid #d99052; border-radius: 0 8px 8px 0; background: #fff8ef; color: #675044; font-size: .9rem; }

.intro-card {
  width: min(720px, 100%);
  margin: 3vh auto 0;
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background-color: var(--panel);
  background: #fff;
  box-shadow: var(--shadow);
}
.intro-copy { padding: 34px 38px 16px; }
.intro-copy h1 { margin-bottom: 12px; }
.intro-copy .lead { max-width: 630px; margin-bottom: 0; line-height: 1.55; }
.intro-action { padding: 22px 34px 30px; }
.legend-swatch { display: inline-block; width: 22px; height: 13px; border-radius: 3px; }
.legend-swatch.no-haptic {
  border: 1px solid var(--silent-line);
  background: repeating-linear-gradient(135deg, #f7f8fa 0 4px, #dce2e7 4px 7px);
}
.legend-swatch.haptic { border: 1px solid #0d439d; background: var(--accent); }

.field-label, .choice-field legend, .reflection-field legend { display: block; margin-bottom: 7px; font-weight: 750; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}
input, select { min-height: 44px; }
textarea { min-height: 122px; resize: vertical; }
textarea.short-textarea { min-height: 76px; }
#access-code-wrap { margin-top: 14px; }
.background-questions { margin: 18px 0 0; padding: 0; border: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(145px, .7fr); align-items: center; gap: 8px 12px; }
.background-questions legend { margin-bottom: 9px; padding: 0; font-size: 1rem; font-weight: 800; }
.background-questions label { font-size: .8rem; font-weight: 700; }
.background-questions select, .background-questions input { min-height: 38px; padding: 6px 8px; font-size: .8rem; }
.consent-information { margin-top: 22px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.consent-information h2 { margin-bottom: 9px; font-size: 1rem; }
.consent-information p { margin-bottom: 7px; color: #44515f; font-size: .78rem; }
.consent-information p:last-child { margin-bottom: 0; }
.bot-field { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; opacity: 0 !important; pointer-events: none !important; }
.consent-row { display: flex; gap: 9px; align-items: flex-start; margin: 20px 0 16px; font-size: .9rem; }
.consent-row input { flex: 0 0 auto; width: 18px; min-height: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }

button {
  min-height: 42px;
  padding: 9px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font-weight: 680;
  transition: background .12s ease, border-color .12s ease, transform .08s ease;
}
button:hover { border-color: #8795a3; background: #f7f9fb; }
button:active { transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
button.primary { border-color: var(--accent); background: var(--accent); color: #fff; }
button.primary:hover { border-color: var(--accent-dark); background: var(--accent-dark); }
button.full { width: 100%; }
button.text-button { border-color: transparent; background: transparent; color: var(--muted); }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .timeline:focus-visible {
  outline: 3px solid rgba(24, 89, 201, .28);
  outline-offset: 2px;
}
kbd { margin-left: 7px; padding: 2px 5px; border: 1px solid rgba(255,255,255,.45); border-radius: 4px; background: rgba(0,0,0,.13); color: inherit; font: 700 .72rem ui-monospace, monospace; }
.mark-button.recording { border-color: #a13d16; background: #a13d16; }
.field-error { min-height: 20px; margin: 7px 0 0; color: var(--danger); font-size: .84rem; }

.study-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--panel);
  background: #fff;
  box-shadow: var(--shadow);
}
.study-shell.is-selecting { height: 100%; }
.clip-header {
  min-height: 76px;
  padding: 14px 18px;
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto minmax(130px, 1fr);
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}
.clip-header h1 { margin: 0; font-size: 1.55rem; }
.phase-steps { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.phase-steps li { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; color: var(--muted); font-size: .78rem; font-weight: 700; }
.phase-steps li span { display: grid; place-items: center; width: 19px; height: 19px; border: 1px solid var(--line-strong); border-radius: 50%; font-size: .68rem; }
.phase-steps li.active { background: var(--accent-soft); color: var(--accent-dark); }
.phase-steps li.active span { border-color: var(--accent); background: var(--accent); color: #fff; }
.phase-steps li.complete { color: #315d45; }
.phase-steps li.complete span { border-color: #6da884; background: #e6f4eb; }
.save-status { justify-self: end; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.header-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }
.header-actions .save-status { justify-self: auto; }
.header-actions button { min-height: 34px; padding: 5px 9px; font-size: .74rem; }
body.owner-preview #save-progress { display: none; }
body.participant-review #save-progress,
body.participant-review #show-tutorial,
body.participant-review .playback-row button,
body.participant-review .workspace-actions { display: none; }
body.participant-review .playback-row { justify-content: flex-end; }
body.participant-review .phase-steps { visibility: hidden; }
.is-practice .phase-steps { visibility: hidden; }

.study-grid { display: grid; grid-template-columns: minmax(0, 1fr) 370px; min-height: 650px; }
.media-workspace { min-width: 0; padding: 18px; border-right: 1px solid var(--line); }
.is-selecting .study-grid { grid-template-columns: 1fr; }
.is-selecting .study-grid { height: calc(100% - 76px); min-height: 0; }
.is-selecting .media-workspace { min-height: 0; display: grid; grid-template-rows: minmax(0, 1fr) auto auto; border-right: 0; }
.is-selecting .task-panel { display: none; }
.is-selecting .video-frame { height: 100%; min-height: 0; aspect-ratio: auto; }
.video-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 10px; background: #0b0e12; }
.video-frame video { display: block; width: 100%; height: 100%; object-fit: contain; background: #0b0e12; }
.playback-row { min-height: 56px; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; padding-top: 10px; }
.time-readout { margin-left: auto; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.mode-button.explicit-no-haptic { border-color: #b9433d; background: #fff0ef; color: #8f2622; }
.is-reviewing .playback-row button { visibility: hidden; pointer-events: none; }
.is-reviewing .playback-row { justify-content: flex-end; }

.timeline-section { padding-top: 12px; }
.timeline-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; margin-bottom: 7px; }
.timeline-heading > div:first-child { display: flex; align-items: baseline; gap: 9px; }
.timeline-heading strong { font-size: .88rem; }
.timeline-heading > div:first-child span { color: var(--muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.timeline-legend { display: flex; gap: 10px; color: var(--muted); font-size: .72rem; }
.timeline-legend span { display: inline-flex; align-items: center; gap: 5px; }
.timeline-legend .legend-swatch { width: 13px; height: 9px; }
.legend-swatch.haptic { border-radius: 2px; background: #1859c9; }
.legend-swatch.no-haptic { border: 1px solid rgba(198, 75, 66, .5); border-radius: 2px; background: rgba(122, 43, 40, .24); }
.legend-swatch.explicit-no-haptic { border-radius: 2px; background: repeating-linear-gradient(135deg, #a9231a 0 3px, #e56a61 3px 6px); }
.timeline {
  position: relative;
  height: 184px;
  overflow: hidden;
  border: 1px solid #697582;
  border-radius: 5px;
  background: #242a31;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}
.no-haptic-lane {
  position: absolute;
  inset: 26px 13px 10px;
  border: 1px solid rgba(198, 75, 66, .5);
  border-radius: 2px;
  background: rgba(122, 43, 40, .24);
  pointer-events: none;
}
.waveform { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.timeline-track { position: absolute; left: 13px; right: 13px; top: calc(50% + 12px); z-index: 2; height: 1px; background: rgba(255,255,255,.34); pointer-events: none; }
.timeline-hover { position: absolute; top: 26px; bottom: 10px; z-index: 5; width: 1px; background: rgba(255,255,255,.7); opacity: 0; pointer-events: none; }
.timeline-hover.visible { opacity: 1; }
.timeline-hover span { position: absolute; top: -25px; left: 5px; padding: 2px 4px; border-radius: 2px; background: #11161c; color: #fff; font: 10px/1.3 ui-monospace, monospace; white-space: nowrap; }
.playhead { position: absolute; top: 6px; bottom: 6px; z-index: 6; width: 2px; background: #111c27; box-shadow: 0 0 0 1px rgba(255,255,255,.75); pointer-events: none; }
.playhead::before { content: ""; position: absolute; top: 0; left: -4px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid #111c27; }
.marker { position: absolute; top: 26px; bottom: 10px; z-index: 3; min-width: 12px; border: 1px solid #7fb0ff; border-radius: 2px; background: rgba(24, 89, 201, .62); box-shadow: inset 0 1px rgba(255,255,255,.22); cursor: grab; }
.marker.active { z-index: 4; border-color: #071d42; background: rgba(10, 67, 164, .9); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.marker.explicit-no-haptic { border-color: #ffaaa3; background: repeating-linear-gradient(135deg, rgba(140, 31, 25, .78) 0 8px, rgba(205, 70, 61, .78) 8px 16px); }
.marker.explicit-no-haptic.active { border-color: #57100d; background: repeating-linear-gradient(135deg, rgba(120, 22, 17, .96) 0 8px, rgba(190, 48, 40, .96) 8px 16px); box-shadow: 0 0 0 2px #fff, 0 0 0 4px #b62c25; }
.marker.selection-preview { pointer-events: none; }
.marker.recording { background: repeating-linear-gradient(135deg, rgba(161,61,22,.82) 0 8px, rgba(204,92,44,.82) 8px 16px); }
.marker-rank { position: absolute; top: 7px; left: 50%; z-index: 3; display: grid; width: 25px; height: 25px; place-items: center; border: 2px solid #fff; border-radius: 50%; background: #102f67; color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.3); font-size: .75rem; font-weight: 800; line-height: 1; transform: translateX(-50%); pointer-events: none; }
.marker .handle { position: absolute; top: -2px; bottom: -2px; width: 12px; background: rgba(255,255,255,.94); cursor: ew-resize; }
.marker .handle.left { left: -2px; border-radius: 5px 0 0 5px; }
.marker .handle.right { right: -2px; border-radius: 0 5px 5px 0; }
.marker .handle::after { content: ""; position: absolute; top: 50%; left: 50%; width: 2px; height: 17px; border-left: 1px solid #687583; border-right: 1px solid #687583; transform: translate(-50%, -50%); }
.marker-delete { position: absolute; top: 4px; right: 15px; z-index: 2; width: 25px; min-height: 25px; padding: 0; border: 1px solid rgba(255,255,255,.75); border-radius: 3px; background: rgba(17,22,28,.88); color: #fff; font-size: 1rem; line-height: 1; }
.marker-convert { position: absolute; top: 4px; right: 44px; z-index: 2; width: 32px; min-height: 25px; padding: 0; border: 1px solid rgba(255,255,255,.8); border-radius: 3px; background: rgba(17,22,28,.88); color: #fff; font-size: .68rem; font-weight: 800; line-height: 1; }
.marker-convert:hover { border-color: #fff; background: #174d9f; }
.marker-delete:hover { border-color: #fff; background: #a9231a; }
.timeline-hint { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; margin: 8px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.35; }
.timeline-hint span { position: relative; min-width: 0; text-align: center; }
.timeline-hint span + span::before { position: absolute; top: 0; bottom: 0; left: -12px; width: 1px; background: var(--line); content: ""; }
.timeline-hint strong { display: block; margin-bottom: 1px; color: #43505d; font-size: .7rem; }
.workspace-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.workspace-actions .primary { min-width: 170px; }
.is-selecting .lock-note:empty { display: none; }

.task-panel { min-width: 0; min-height: 650px; height: 100%; overflow: hidden; background: var(--soft); }
.task-view { height: 100%; padding: 20px; display: flex; flex-direction: column; overflow-y: auto; }
.task-view > p { color: var(--muted); font-size: .87rem; }
.task-number { margin-bottom: 8px; color: var(--accent-dark); font-size: .7rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.decision-count { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 12px 0 9px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.decision-count strong { font-size: .94rem; }
.decision-count span { color: var(--muted); font-size: .72rem; text-align: right; }
.marker-list { display: grid; gap: 7px; overflow-y: auto; }
.marker-row { display: flex; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.marker-row.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.marker-seek { flex: 1; min-width: 0; min-height: 46px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 7px; border: 0; border-radius: 0; background: transparent; text-align: left; }
.marker-seek span { grid-column: 1 / -1; color: var(--muted); font-size: .68rem; line-height: 1; }
.marker-seek strong { overflow: hidden; font-size: .78rem; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.marker-seek small { color: var(--muted); font-size: .68rem; white-space: nowrap; }
.remove-button { min-height: auto; padding: 7px 9px; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: transparent; color: var(--danger); font-size: .72rem; }
.lock-note { min-height: 20px; margin: 8px 0; color: var(--danger); font-size: .8rem; }
.panel-actions { margin-top: auto; padding-top: 12px; display: flex; gap: 7px; }
.panel-actions.split { flex-wrap: wrap; }
.panel-actions.split .primary { margin-left: auto; }
.detail-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
.detail-actions button { width: 100%; min-width: 0; }

.task-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.task-title-row h2 { margin-bottom: 5px; }
.selection-time { display: inline-block; padding: 4px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-size: .72rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.context-button { min-height: 36px; padding: 6px 9px; color: var(--accent-dark); font-size: .75rem; white-space: nowrap; }
.field { margin-bottom: 16px; }
.choice-field { min-width: 0; margin: 0 0 16px; padding: 0; border: 0; }
.choice-field legend { padding: 0; font-size: .84rem; }
.choice-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.choice-list button { min-height: 42px; padding: 7px 9px; font-size: .76rem; text-align: left; }
.choice-list.inline { grid-template-columns: repeat(3, 1fr); }
.choice-list.inline button { text-align: center; }
.choice-list button.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); box-shadow: inset 0 0 0 1px var(--accent); }
.ranking-field { min-width: 0; margin: 0 0 16px; padding: 0; border: 0; }
.ranking-field legend { padding: 0; font-size: .84rem; }
.ranking-list { display: grid; gap: 5px; margin-top: 7px; }
.ranking-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 7px 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: #43515f; font-size: .73rem; cursor: grab; }
.ranking-row:active { cursor: grabbing; }
.ranking-row:hover, .ranking-row:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.ranking-row.dragging { opacity: .48; }
.ranking-row.drag-over { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.timeline.region-focus { box-shadow: 0 0 0 3px rgba(31, 101, 213, .2); }
.ranking-controls { display: flex; gap: 4px; }
.ranking-controls button { min-width: 32px; min-height: 30px; padding: 2px 7px; }
.reflection-field { min-width: 0; margin: 0 0 16px; padding: 0; border: 0; }
.reflection-field legend { padding: 0; font-size: .84rem; }
.reflection-list { display: grid; gap: 7px; }
.reflection-row { padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.reflection-row > strong { display: block; margin-bottom: 6px; font-size: .76rem; line-height: 1.25; }
.reflection-options { display: grid; grid-template-columns: .75fr .9fr 1.35fr; gap: 4px; }
.reflection-options button { min-height: 34px; padding: 4px 5px; font-size: .66rem; line-height: 1.15; }
.reflection-options button.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-dark); box-shadow: inset 0 0 0 1px var(--accent); }
.reflection-reason-label { display: block; margin-top: 8px; font-size: .73rem; font-weight: 700; }
#summary-screen textarea.reflection-reason { min-height: 62px; margin-top: 5px; padding: 7px 8px; font-size: .75rem; font-weight: 400; }
#summary-screen textarea { min-height: 96px; }
#summary-screen textarea.short-textarea { min-height: 68px; }

.center-card { width: min(620px, 100%); margin: 10vh auto 0; padding: 42px; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: var(--shadow); text-align: center; }
.completion-icon { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 17px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); font-size: 1.35rem; font-weight: 850; }
.response-code { display: inline-block; padding: 7px 11px; border-radius: 7px; background: var(--soft); color: #43515f; font-weight: 750; font-variant-numeric: tabular-nums; }
.completion-card { position: relative; width: min(720px, 100%); margin-top: 8vh; overflow: hidden; padding: 64px 54px 58px; border-color: #f0d9bd; background: radial-gradient(circle at 50% -15%, #fff7dc 0, rgba(255,247,220,0) 48%), linear-gradient(145deg, #fffdf9, #fff6ee); box-shadow: 0 24px 70px rgba(120, 70, 34, .14); }
.completion-card::before, .completion-card::after { position: absolute; width: 190px; height: 190px; border-radius: 50%; content: ""; filter: blur(1px); opacity: .2; pointer-events: none; }
.completion-card::before { top: -95px; left: -70px; background: #ffbd6c; }
.completion-card::after { right: -75px; bottom: -110px; background: #ed8d76; }
.completion-card > *:not(.confetti) { position: relative; z-index: 2; }
.completion-card h1 { max-width: 560px; margin-right: auto; margin-left: auto; color: #39271d; }
.completion-card .lead { max-width: 570px; margin: 15px auto 13px; color: #665146; }
.completion-heart { width: 64px; height: 64px; margin-bottom: 20px; background: linear-gradient(145deg, #ffe6d3, #ffd4c7); color: #c94e4e; font-size: 1.55rem; box-shadow: 0 10px 25px rgba(191, 83, 68, .16); }
.completion-saved { margin: 20px 0 16px; color: #7b685d; font-size: .92rem; }
.completion-gratitude { max-width: 550px; margin: 18px auto 0; color: #725140; font-weight: 650; }
.completion-card .response-code:empty { display: none; }
.completion-card .response-code { border: 1px solid rgba(188, 139, 92, .2); background: rgba(255,255,255,.72); }
.confetti { position: fixed; inset: 58px 0 0; z-index: 1; overflow: hidden; pointer-events: none; }
.confetti-piece { position: absolute; top: -12vh; width: var(--size); height: 6px; border-radius: 2px; background: var(--color); opacity: .94; animation: confetti-fall var(--duration) cubic-bezier(.22,.72,.35,1) var(--delay) forwards; }
.confetti-piece.round { height: var(--size); border-radius: 50%; }
@keyframes confetti-fall {
  0% { transform: translate3d(0, -10vh, 0) rotate(0deg); }
  45% { transform: translate3d(var(--drift), 48vh, 0) rotate(440deg); }
  100% { transform: translate3d(calc(var(--drift) * -.4), 112vh, 0) rotate(920deg); }
}

.owner-tools { position: fixed; right: 16px; bottom: 16px; z-index: 50; width: min(390px, calc(100% - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(255,255,255,.98); box-shadow: 0 16px 45px rgba(20,30,42,.2); }
.owner-tools > strong, .owner-tools > span { display: block; }
.owner-tools > span { margin: 3px 0 10px; color: var(--muted); font-size: .76rem; }
.owner-tools > div { display: flex; flex-wrap: wrap; gap: 6px; }
.owner-tools button { min-height: 36px; padding: 6px 9px; font-size: .75rem; }
.owner-response-browser { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; margin: 10px 0; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--soft); }
.owner-response-browser > strong,
.owner-response-browser > label,
.owner-response-browser > select,
.owner-response-browser > .owner-clip-browser { grid-column: 1 / -1; }
.owner-response-browser > label,
.owner-clip-browser > label { color: #43505d; font-size: .7rem; font-weight: 750; }
.owner-response-browser input,
.owner-response-browser select { min-width: 0; min-height: 36px; padding: 6px 8px; font-size: .73rem; }
.owner-response-browser > select { width: 100%; }
.owner-clip-browser { display: grid; gap: 7px; padding-top: 4px; border-top: 1px solid var(--line); }
.owner-clip-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.danger-button { color: var(--danger); }
body.owner-preview::after { position: fixed; right: 14px; bottom: 14px; z-index: 80; padding: 7px 10px; border-radius: 7px; background: #17222d; color: #fff; content: "Researcher preview · not saved"; font-size: .72rem; font-weight: 750; box-shadow: 0 8px 24px rgba(10,20,30,.2); pointer-events: none; }
body.participant-review::after { position: fixed; right: 14px; bottom: 14px; z-index: 80; padding: 7px 10px; border-radius: 7px; background: #17222d; color: #fff; content: "Participant response · read only"; font-size: .72rem; font-weight: 750; box-shadow: 0 8px 24px rgba(10,20,30,.2); pointer-events: none; }

.participant-review-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.participant-review-heading h2 { margin: 5px 0 0; }
.participant-review-heading-actions { display: grid; justify-items: end; gap: 6px; }
.participant-review-heading-actions button { min-height: 30px; padding: 4px 7px; font-size: .67rem; }
.read-only-badge, .response-state { display: inline-block; padding: 4px 7px; border-radius: 999px; font-size: .67rem; font-weight: 800; }
.read-only-badge { background: #e7edf4; color: #3f5061; text-transform: uppercase; letter-spacing: .06em; }
.response-state { background: var(--accent-soft); color: var(--accent-dark); white-space: nowrap; }
.participant-review-id { margin: 9px 0 12px; overflow-wrap: anywhere; font-family: ui-monospace, monospace; }
.participant-review-navigation { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 5px; margin-bottom: 10px; }
.participant-review-navigation button,
.participant-review-navigation select { min-width: 0; min-height: 36px; padding: 5px 7px; font-size: .7rem; }
.participant-review-content { display: grid; gap: 10px; }
.participant-review-section { padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.participant-review-section h3 { margin: 0 0 8px; font-size: .82rem; }
.participant-review-field + .participant-review-field { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); }
.participant-review-field strong { display: block; margin-bottom: 2px; color: #43505d; font-size: .69rem; text-transform: uppercase; letter-spacing: .035em; }
.participant-review-field p { margin: 0; color: #263443; font-size: .79rem; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; }
.participant-region-list { display: grid; gap: 6px; }
.participant-region-button { width: 100%; min-height: 44px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; padding: 7px 8px; text-align: left; }
.participant-region-button.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.participant-region-button strong { font-size: .75rem; }
.participant-region-button span { color: var(--muted); font-size: .69rem; }
.participant-region-button small { color: var(--muted); font-size: .65rem; }
.participant-review-empty { margin: 0; color: var(--muted); font-size: .8rem; }

.tour { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.tour-shade { position: fixed; z-index: 90; background: rgba(11, 18, 27, .58); backdrop-filter: blur(4px); pointer-events: auto; }
.tour-focus { position: fixed; z-index: 91; border: 3px solid #fff; border-radius: 10px; box-shadow: 0 0 0 2px var(--accent), 0 8px 30px rgba(11, 18, 27, .24); pointer-events: auto; }
.tour-card { position: fixed; z-index: 92; width: min(330px, calc(100vw - 20px)); padding: 18px; border-radius: 12px; background: #fff; box-shadow: 0 18px 55px rgba(11, 18, 27, .32); pointer-events: auto; }
.tour-card > span { color: var(--accent-dark); font-size: .72rem; font-weight: 800; }
.tour-card h2 { margin: 5px 0 7px; }
.tour-card p { margin: 0; color: var(--muted); font-size: .88rem; }
.tour-actions { display: flex; gap: 7px; margin-top: 16px; }
.tour-actions #tour-back { margin-left: auto; }
body.tour-open { overscroll-behavior: none; }

@media (max-width: 980px) {
  .study-grid { grid-template-columns: minmax(0, 1fr) 330px; }
  .task-panel { min-height: 620px; }
  .study-grid { min-height: 620px; }
  .choice-list { grid-template-columns: 1fr; }
  .choice-list.inline { grid-template-columns: repeat(3, 1fr); }
  .phase-steps li { padding: 6px; }
  .phase-steps li:not(.active) { font-size: 0; gap: 0; }
}

@media (max-width: 760px) {
  .topbar-inner, .page { width: min(100% - 20px, 1280px); }
  .brand-logo { flex-basis: 84px; width: 84px; height: 18px; }
  .brand-logo img { width: 84px; height: 18px; }
  .brand strong { font-size: .78rem; }
  .topbar-inner { gap: 9px; }
  .topbar-session { flex-basis: 110px; }
  .study-progress { width: min(240px, 62vw); }
  .page { margin-top: 10px; }
  body:has(.study-shell.is-selecting:not(.hidden)) .page { width: 100%; height: calc(100dvh - 58px); margin: 0; }
  .study-shell.is-selecting { border-right: 0; border-left: 0; border-radius: 0; }
  .intro-card { margin-top: 2vh; }
  .intro-copy { padding: 26px 22px 20px; }
  .intro-action { padding: 0 22px 22px; }
  .completion-card { margin-top: 4vh; padding: 48px 24px 42px; }
  .clip-header { min-height: 68px; grid-template-columns: 1fr auto; gap: 8px; padding: 11px 14px; }
  .phase-steps { grid-row: 2; grid-column: 1 / -1; justify-content: center; }
  .phase-steps li, .phase-steps li:not(.active) { padding: 4px 8px; font-size: .7rem; }
  .header-actions { grid-column: 2; grid-row: 1; }
  .header-actions .save-status { display: none; }
  .study-grid { grid-template-columns: 1fr; min-height: 0; }
  .media-workspace { padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .playback-row .mark-button { flex: 1 0 100%; }
  .timeline-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .timeline { height: 150px; }
  .is-selecting .study-grid { height: calc(100% - 98px); }
  .is-selecting .media-workspace { padding: 8px 10px; }
  .is-selecting .playback-row { min-height: 86px; padding-top: 6px; }
  .is-selecting .timeline-section { padding-top: 6px; }
  .is-selecting .timeline { height: 124px; }
  .is-selecting .timeline-hint { grid-template-columns: repeat(2, 1fr); gap: 8px 16px; margin-top: 4px; font-size: .68rem; }
  .is-selecting .timeline-hint span + span::before { left: -8px; }
  .is-selecting .timeline-hint span:nth-child(odd)::before { display: none; }
  .is-selecting .workspace-actions { margin-top: 5px; }
  .is-selecting .workspace-actions .primary { min-height: 38px; }
  .task-panel { height: auto; min-height: 430px; overflow: visible; }
  .task-view { min-height: 430px; padding: 18px; overflow: visible; }
  .marker-list { max-height: 240px; }
  .choice-list { grid-template-columns: 1fr; }
  .choice-list.inline { grid-template-columns: repeat(3, 1fr); }
  .panel-actions.split .primary { flex: 1 0 100%; order: -1; margin-left: 0; }
  .context-button { white-space: normal; }
}

@media (max-width: 420px) {
  .brand { gap: 7px; }
  .brand-logo { flex-basis: 76px; width: 76px; height: 16px; }
  .brand-logo img { width: 76px; height: 16px; }
  .brand strong { display: none; }
  .session-id { max-width: 100px; }
  .progress-copy strong { display: none; }
  .study-progress { width: 120px; }
  .phase-steps li { font-size: 0 !important; }
  .phase-steps li span { width: 22px; height: 22px; font-size: .7rem; }
  .timeline-legend { flex-wrap: wrap; }
  .task-title-row { align-items: stretch; flex-direction: column; }
  .choice-list.inline { grid-template-columns: 1fr; }
  .background-questions { grid-template-columns: 1fr; gap: 5px; }
  .background-questions select { margin-bottom: 6px; }
}

@media (max-height: 760px) {
  body:has(.study-shell.is-selecting:not(.hidden)) .page { height: calc(100dvh - 66px); margin-top: 4px; margin-bottom: 4px; }
  .is-selecting .clip-header { min-height: 58px; padding-top: 8px; padding-bottom: 8px; }
  .is-selecting .clip-header h1 { font-size: 1.25rem; }
  .is-selecting .study-grid { height: calc(100% - 58px); }
  .is-selecting .media-workspace { padding: 8px 12px; }
  .is-selecting .playback-row { min-height: 46px; padding-top: 5px; }
  .is-selecting .playback-row button { min-height: 36px; padding-top: 6px; padding-bottom: 6px; }
  .is-selecting .timeline-section { padding-top: 3px; }
  .is-selecting .timeline-heading { margin-bottom: 3px; }
  .is-selecting .timeline { height: 106px; }
  .is-selecting .timeline-hint { margin: 3px 0 0; font-size: .68rem; }
  .is-selecting .workspace-actions { margin-top: 3px; }
  .is-selecting .workspace-actions .primary { min-height: 36px; padding-top: 6px; padding-bottom: 6px; }
}

@media (max-width: 760px) and (max-height: 760px) {
  body:has(.study-shell.is-selecting:not(.hidden)) .page { height: calc(100dvh - 58px); margin: 0; }
  .is-selecting .clip-header { min-height: 88px; }
  .is-selecting .study-grid { height: calc(100% - 88px); }
  .is-selecting .playback-row { min-height: 76px; }
  .is-selecting .timeline { height: 92px; }
  .is-selecting .timeline-heading { flex-direction: row; align-items: center; }
  .is-selecting .timeline-legend { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
  .confetti-piece { display: none; }
}
