:root {
  color-scheme: light;
  --ink: #211c38;
  --muted: #655e79;
  --purple: #6841cf;
  --pale: #eee8ff;
  --line: #dfdbea;
  --panel: #fff;
  --soft: #f5f3fa;
  --cue: #b7b1c6;
  font:
    15px/1.5 "DM Sans",
    "Noto Sans CJK SC",
    "Microsoft YaHei",
    sans-serif;
  color: var(--ink);
  background: var(--soft);
}
[data-pattern="jack"]             { --cue: #d4baff; }
[data-pattern="long_interaction"] { --cue: #94bff5; }
[data-pattern="axis_interaction"] { --cue: #b0d879; }
[data-pattern="daichuu"]          { --cue: #ea95b4; }
[data-pattern="swing"]            { --cue: #eac35d; }
[data-pattern="sweep"]            { --cue: #77cede; }
[data-pattern="rotation"]         { --cue: #9adecd; }
[data-pattern="offset"]           { --cue: #d49bcf; }
[data-pattern="tap_slide"]        { --cue: #fcbb88; }
[data-pattern="cross_slide"]      { --cue: #92a3ca; }
[data-pattern="one_stroke"]       { --cue: #e88e7c; }
.pattern-key::before {
  content: ""; display: inline-block; width: .7em; height: .7em; margin-right: .4em;
  background: var(--cue); border: 1px solid #39314670; border-radius: 2px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
select,
input,
textarea,
a {
  font: inherit;
}
button,
select,
a {
  touch-action: manipulation;
}
button,
a.outline,
select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}
button,
a.outline,
select {
  cursor: pointer;
  min-height: 42px;
}
button {
  padding: 6px 12px;
}
button:hover:not(:disabled),
a.outline:hover {
  border-color: #a28cd8;
  background: #f6f3ff;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid #8769dc;
  outline-offset: 2px;
}
button[aria-pressed="true"] {
  color: #5230ad;
  background: #eee8fc;
  border-color: #beabe9;
}
[hidden] {
  display: none !important;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h2 {
  font-size: 17px;
  letter-spacing: 0.015em;
}
h3,
legend,
.note-label {
  font-weight: 650;
  font-size: 14px;
}
small {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}
select {
  padding: 7px 25px 7px 9px;
  max-width: 100%;
}
input,
textarea {
  padding: 10px;
  width: 100%;
}
a.outline {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
}
.mast {
  background: white;
  min-height: 68px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px clamp(18px, 3vw, 48px);
}
.brand,
.mast-actions,
.song-meta,
.section-title,
.transport,
.clip-nav,
.pager,
.dialog-actions,
.workspace-line,
.song-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand strong {
  font:
    800 26px/1 "DM Sans",
    Arial,
    sans-serif;
  letter-spacing: -1.6px;
}
.brand span {
  font-weight: 600;
  border-left: 1px solid var(--line);
  padding-left: 14px;
  margin-left: 3px;
}
.mark {
  width: 32px;
  height: 32px;
  border: 6px solid #7146d0;
  border-radius: 50%;
  outline: 2px dashed #7146d0;
  outline-offset: -2px;
  position: relative;
  transform: rotate(-25deg);
}
.mark:after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  background: #bc90ff;
  border-radius: 100%;
  top: 1px;
  right: 0;
}
.mast-actions select,
.mast-actions a {
  font-size: 13px;
}
.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 68px);
  max-width: 1800px;
  margin: auto;
}
.queue {
  background: #fbfaff;
  border-right: 1px solid var(--line);
  padding: 25px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.section-title,
.workspace-line,
.song-heading,
.clip-nav,
.pager {
  justify-content: space-between;
}
.count {
  background: #eae5f4;
  border-radius: 5px;
  padding: 2px 7px;
  font: 600 12px/1.6 monospace;
  color: #554770;
}
.queue .section-title {
  margin-bottom: 8px;
}
.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.queue select,
.queue input {
  font-size: 13px;
  min-height: 39px;
}
.chart-list {
  margin-top: 5px;
  display: grid;
  align-content: start;
}
.chart {
  display: grid;
  gap: 3px;
  min-height: 62px;
  text-align: left;
  padding: 9px 12px;
  border-radius: 7px;
  border: 1px solid transparent;
  border-bottom-color: #eae6f0;
  background: transparent;
}
.chart strong,
.clip-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chart strong {
  font-size: 14px;
}
.chart small {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chart.chosen {
  border-color: #cec1ee;
  background: #ece6fa;
  box-shadow: inset 3px 0 #7850d7;
}
.pager {
  font-size: 12px;
  color: var(--muted);
}
.pager button {
  width: 40px;
  font-size: 20px;
}
.workspace-line {
  color: var(--muted);
  font-size: 12px;
}
.workspace-line span:first-child {
  font-weight: 650;
  color: #534275;
}
.live-dot {
  display: inline-block;
  background: #7962b1;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-right: 7px;
}
progress {
  width: 100%;
  height: 3px;
  display: block;
  margin: 8px 0 21px;
  border: 0;
  appearance: none;
  background: #e1daec;
}
progress::-webkit-progress-bar {
  background: #e1daec;
}
progress::-webkit-progress-value {
  background: var(--purple);
}
main {
  padding: 25px clamp(16px, 2.35vw, 40px) 36px;
  min-width: 0;
}
.song-heading {
  margin-bottom: 19px;
}
.song-meta {
  color: var(--muted);
  font-size: 12px;
}
.diff,
.state {
  border-radius: 5px;
  font-size: 11px;
  font-weight: 650;
  padding: 3px 7px;
  background: var(--pale);
  color: #553594;
}
.song-heading h1 {
  font:
    750 clamp(28px, 3vw, 46px) / 1.18 "DM Sans",
    "Noto Sans CJK SC",
    sans-serif;
  letter-spacing: -0.035em;
  margin: 8px 0 3px;
  overflow-wrap: anywhere;
}
.song-heading p {
  color: var(--muted);
  font-size: 14px;
}
.desk {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(247px, 29%);
  gap: 18px;
  align-items: start;
}
.viewer {
  min-width: 0;
}
.stage {
  background: #221e42;
  color: #fff;
  position: relative;
  isolation: isolate;
  aspect-ratio: 16/9;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}
.stage canvas,
.stage video {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
}
.stage video {
  background: #100e19;
  object-fit: contain;
  z-index: 2;
}
#poster {
  position: absolute;
  left: 6%;
  top: 16%;
  bottom: 15%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  pointer-events: none;
}
.stage-label {
  font-size: 12px;
  font-weight: 600;
  color: #d0c1f1;
}
.stage strong {
  font:
    600 clamp(22px, 3vw, 46px) / 1.2 "IBM Plex Mono",
    monospace;
  margin: 8px 0 2px;
  letter-spacing: -0.075em;
}
#stageBeats {
  font-size: 12px;
  color: #d8d1ed;
}
#loadVideo {
  background: #f4eeff;
  color: #392468;
  border: 0;
  margin-top: 18px;
  font-weight: 650;
  pointer-events: auto;
  font-size: 13px;
}
.transport {
  border: 1px solid var(--line);
  background: white;
  border-radius: 0 0 12px 12px;
  padding: 8px 12px;
  gap: 6px;
}
.transport span {
  color: var(--muted);
  font-size: 12px;
  margin-right: auto;
}
.transport button {
  font-size: 12px;
  padding: 4px 9px;
  min-height: 36px;
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}
.timeline,
.clips-panel,
.evidence {
  margin-top: 16px;
}
.timeline .section-title {
  justify-content: space-between;
}
.timeline #playTime,
.timeline .time-caption span,
.timeline small,
.timeline p {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.time-caption,
.evidence-row {
  margin-top: 12px;
  font-size: 12px;
}
.time-caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 8px;
}
.time-track {
  position: relative;
  height: 18px;
  margin-top: 4px;
  border-radius: 4px;
  background: #eeecf4;
}
.time-track .interval {
  position: absolute;
  top: 0;
  height: 100%;
  min-height: 0;
  min-width: 3px;
  padding: 0;
  border: 1px solid #ffffff80;
  border-radius: 3px;
  background: #b7a7d5;
}
.overview .interval[aria-current="true"],
.window-track .interval {
  background: var(--purple);
}
.window-track {
  background: repeating-linear-gradient(135deg, #f4f0fc 0 4px, #dcd3ef 4px 7px);
}
.evidence-row small {
  margin-left: 10px;
}
.time-track.evidence-track .interval {
  background: var(--cue);
  border-color: #39314670;
}
.time-track .interval:is([aria-pressed="true"], .at-playhead, :hover, :focus-visible) {
  box-shadow: inset 0 0 0 2px var(--ink);
  z-index: 1;
}
#windowDetail.in-window .time-track::after {
  content: "";
  position: absolute;
  left: var(--position);
  top: -1px;
  bottom: -1px;
  border-left: 2px solid #252039;
  box-shadow: -1px 0 white;
  pointer-events: none;
  z-index: 2;
}
#rangeDetail {
  margin: 9px 0 0;
}
.clip-list {
  margin-top: 10px;
}
.clip-row {
  width: 100%;
  border: 1px solid transparent;
  border-bottom-color: #efecf4;
  border-radius: 6px;
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 8px;
  text-align: left;
  min-height: 44px;
}
.clip-row.on {
  background: #f2edff;
  border-color: #d6c9f3;
}
.clip-row .play {
  color: var(--purple);
  font-size: 13px;
}
.clip-row strong {
  font:
    600 14px/1.5 "IBM Plex Mono",
    monospace;
}
.clip-row small {
  font-size: 12px;
}
.decision .section-title {
  margin-bottom: 16px;
}
.recommended {
  background: #f3effa;
  border-radius: 8px;
  padding: 10px 13px;
}
.recommended > span {
  font-size: 12px;
  color: var(--muted);
}
.recommended > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.recommended b {
  font-size: 18px;
}
.recommended code {
  color: #674e9f;
  font-size: 13px;
}
fieldset {
  padding: 0;
  border: 0;
  margin: 17px 0;
}
.labels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}
.labels button {
  font-size: 13px;
  min-height: 35px;
  text-align: left;
  padding: 5px 8px;
}
.labels button[data-pattern] {
  display: flex;
  align-items: center;
  gap: 5px;
}
.labels button[data-pattern]::before {
  content: "";
  display: inline-grid;
  place-items: center;
  box-sizing: border-box;
  flex: 0 0 16px;
  height: 16px;
  line-height: 1;
  font-size: 14px;
  font-weight: 700;
  color: #222;
  background: white;
  border-radius: 3px;
  border: 1px solid #747474;
}
.labels button[data-pattern][aria-pressed="true"], #guideDefinitions button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--cue) 35%, white);
  border-color: color-mix(in srgb, var(--cue) 55%, var(--ink));
  color: var(--ink);
  font-weight: 650;
}
.labels button[data-pattern][aria-pressed="true"]::before {
  content: "✓" / "";
  border-color: currentColor;
}
.note-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
}
textarea {
  resize: vertical;
  min-height: 70px;
  font-size: 13px;
}
button.primary {
  background: var(--purple);
  color: white;
  border-color: var(--purple);
  font-weight: 650;
}
button.primary:hover:not(:disabled) {
  background: #5632b8;
  color: white;
}
.decision > .primary {
  margin-top: 10px;
  width: 100%;
}
.secondary-actions {
  display: flex;
  gap: 7px;
  margin: 7px 0 14px;
}
.secondary-actions button {
  flex: 1;
  font-size: 13px;
}
.clip-nav {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.clip-nav button {
  background: transparent;
  border: 0;
  font-size: 12px;
  padding: 4px;
}
.state {
  background: #f0edef;
  color: #60596f;
}
.evidence summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 650;
}
.evidence h3 {
  margin: 13px 0 5px;
}
.evidence details {
  border-bottom: 1px solid var(--line);
  padding: 7px 0;
}
.evidence details summary {
  font-size: 13px;
  font-weight: 500;
}
pre,
dialog code {
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--soft);
  padding: 10px;
  border-radius: 7px;
  font: 12px/1.6 monospace;
  max-height: 210px;
  overflow: auto;
}
#initial {
  color: var(--muted);
}
dialog {
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: min(450px, 92vw);
  padding: 24px;
}
dialog p {
  margin: 12px 0;
  color: var(--muted);
}
dialog::backdrop {
  background: #19132988;
}
.dialog-actions {
  justify-content: flex-end;
  margin-top: 20px;
}
#toast {
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: #332a50;
  color: white;
  border-radius: 9px;
  padding: 11px 18px;
  box-shadow: 0 4px 20px #20133326;
  z-index: 5;
}
.queue-toggle, #reviewViews, #decisionClip, .phone-picker { display: none; }
@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .desk {
    grid-template-columns: minmax(0, 1fr) 246px;
    gap: 12px;
  }
  .panel {
    padding: 14px;
  }
}
@media (max-width: 980px) {
  .desk {
    grid-template-columns: minmax(0, 1fr);
  }
  .labels {
    grid-template-columns: repeat(4, 1fr);
  }
  .decision {
    grid-row: 2;
  }
  .shell {
    grid-template-columns: 210px minmax(0, 1fr);
  }
}
.auth-panel {
  min-height: calc(100vh - 68px);
  display: grid;
  justify-items: center;
  align-content: start;
  padding-top: clamp(48px, 11vh, 140px);
  background: radial-gradient(ellipse at top, #eae3fa, var(--soft) 65%);
}
.auth-form {
  width: min(100%, 375px);
  padding: 30px;
  display: grid;
  gap: 8px;
}
.auth-form h1 { font-size: 27px; margin-bottom: 15px; }
.auth-form label { font-weight: 600; }
.auth-form label:not(:first-of-type) { margin-top: 9px; }
#authMessage { font-size: 13px; color: var(--muted); }
#modeNav {
  display: flex;
  gap: 3px;
  background: var(--soft);
  border-radius: 9px;
  padding: 3px;
}
#modeNav button { font-size: 14px; min-height: 36px; border-color: transparent; background: transparent; }
#modeNav button[aria-pressed="true"] { background: white; box-shadow: 0 1px 4px #26194425; font-weight: 650; }
#accountMenu { position: relative; font-size: 13px; }
#accountMenu summary { cursor: pointer; padding: 10px 4px; max-width: 12em; overflow-wrap: anywhere; }
.account-actions {
  position: absolute; right: 0; top: 100%; z-index: 4;
  display: grid; min-width: 175px; border: 1px solid var(--line);
  background: white; border-radius: 8px; padding: 5px; box-shadow: 0 6px 18px #211c381c;
}
.account-actions a, .account-actions button { color: var(--ink); text-decoration: none; font-size: 13px; padding: 10px; text-align: left; }
.account-actions a:hover { background: var(--soft); }
.account-actions button { border: 0; border-top: 1px solid var(--line); border-radius: 0; }
#freeQueue { display: grid; gap: 10px; }
#coverage p, #batchHint { color: var(--muted); font-size: 14px; }
#coverage p { font-size: 12px; margin-bottom: 10px; }
.coverage-row { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 8px 1px; font-size: 13px; }
.coverage-row b { font-variant-numeric: tabular-nums; }
.batch-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.batch-heading h1 { font-size: clamp(26px, 3vw, 38px); }
#batchHint { margin: 8px 0 22px; }
#taskCards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 14px; }
.task-card {
  display: grid; grid-template-rows: auto auto 1fr auto auto; gap: 6px;
  padding: 20px; border-radius: 12px; text-align: left; overflow-wrap: anywhere;
}
.task-card strong { font-size: 21px; line-height: 1.3; }
.task-card span, .task-card b { font-size: 13px; }
.task-card > span { color: var(--muted); }
.task-card b { color: var(--purple); margin-top: 18px; }
.task-card .card-action { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; color: var(--ink); }
#taskHome { min-height: 32px; margin-left: auto; font-size: 12px; }
#clipHistory { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; font-size: 13px; }
#clipHistory summary { cursor: pointer; }
#revisions { list-style: none; padding: 0; }
#revisions li { display: grid; gap: 3px; overflow-wrap: anywhere; padding: 6px 0; }


.history-page { width: min(1080px, 100%); margin: 0 auto; padding-top: clamp(25px, 4vw, 54px); }
.history-page h1 { font-size: clamp(27px, 3vw, 38px); margin-bottom: 18px; }
#historyFilters { display: grid; grid-template-columns: minmax(160px, 1fr) auto auto; gap: 8px; }
#historyStatus { margin: 18px 0 9px; color: var(--muted); font-size: 13px; }
#historyRows { background: var(--panel); border-radius: 10px; }
.history-row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) auto; gap: 8px 16px; padding: 16px 20px; border: 1px solid var(--line); }
.history-row + .history-row { border-top: 0; }
.history-row:first-child { border-radius: 10px 10px 0 0; }
.history-row:last-child { border-radius: 0 0 10px 10px; }
.history-row h2 { overflow-wrap: anywhere; }
.history-song, .history-decision, .history-action { display: grid; align-content: start; gap: 4px; justify-items: start; }
.history-action { justify-items: end; }
.history-action button, #historyHome { font-size: 13px; min-height: 34px; }
.history-decision span, .history-detail { font-size: 13px; }
.state[data-state="deferred"] { background: #fff1cd; color: #755014; }
.state[data-state="confirmed"] { background: #dff2ec; color: #215c4d; }
.history-detail { grid-column: 1 / -1; }
.history-detail summary { cursor: pointer; color: var(--muted); }
.revision-list { list-style: none; padding: 0; }
.revision-list li { border-left: 2px solid var(--line); display: grid; padding: 6px 10px; gap: 3px; overflow-wrap: anywhere; white-space: pre-line; }
#historyPager { justify-content: center; margin: 16px 0; }


.guide-page {
  display: grid; grid-template-columns: minmax(165px, 205px) minmax(0, 930px);
  align-items: start; justify-content: center; gap: clamp(24px, 5vw, 76px);
  padding: clamp(24px, 4vw, 64px) clamp(16px, 4vw, 64px) 64px;
}
.guide-rail { position: sticky; top: 24px; }
.guide-rail h1 { font-size: 25px; }
.guide-rail p, #guideProgress { color: var(--muted); }
.guide-rail p { font-size: 14px; line-height: 1.8; margin: 10px 0 24px; }
#guideChapters { display: grid; counter-reset: guide-step; gap: 4px; }
#guideChapters button {
  counter-increment: guide-step; text-align: left; border: 0; border-radius: 6px;
  background: transparent; padding: 10px 12px; font-size: 14px;
}
#guideChapters button::before { content: counter(guide-step) "."; margin-right: .8em; font-variant-numeric: tabular-nums; }
#guideChapters [aria-current="step"] { color: #5636a6; background: #e8e2f5; font-weight: 700; }
.guide-paper { min-width: 0; background: white; border: 1px solid var(--line); border-radius: 14px; padding: clamp(20px, 4vw, 46px); }
.guide-chapter > h2 { font-size: clamp(23px, 3.15vw, 37px); line-height: 1.35; letter-spacing: -.02em; }
.guide-chapter > h2:focus { outline: none; }
.guide-chapter > h2:focus-visible { box-shadow: -3px 0 #b69bdd; padding-left: 10px; }
.guide-lead, .guide-chapter > p, .guide-outcomes dd, .definition-body p { line-height: 1.9; }
.guide-lead { margin: 15px 0 24px; }
.guide-case { background: #342752; color: #fff; border-radius: 11px; padding: clamp(16px, 3vw, 27px); }
.guide-case-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.guide-case-heading button { flex-shrink: 0; }
.guide-case h3 { font-size: clamp(21px, 3vw, 30px); margin-top: 4px; }
.guide-case small { color: #e2dbea; }
.guide-case button { color: var(--ink); }
.guide-subtitle, #guideDefinitions h3 { font-size: 18px; margin: 22px 0 8px; }
.guide-evidence { display: grid; }
.guide-evidence button { display: grid; grid-template-columns: minmax(110px, auto) 1fr; text-align: left; gap: 2px 14px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 13px 4px; }
.guide-evidence small { font-variant-numeric: tabular-nums; grid-row: span 2; align-self: start; border-left: 4px solid var(--cue); padding-left: 8px; }
.guide-evidence span { font-size: 14px; color: var(--muted); line-height: 1.7; }
.guide-takeaway { margin-top: 20px; padding: 12px 16px; background: #f3effa; border-radius: 6px; }
.guide-takeaway strong { display: block; }
#guideDefinitions { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 18px; }
#guideDefinitions > div { display: flex; gap: 4px; flex-wrap: wrap; }
#guideDefinitions button { font-size: 14px; padding: 6px 10px; min-height: 38px; }
#guideDefinitionPanel, #definitionText { display: grid; grid-template-columns: minmax(0, .83fr) minmax(0, 1.17fr); align-items: start; gap: 20px; }
.definition-body p, .definition-media p { margin: 9px 0; line-height: 1.8; }
.definition-media h4 { font-size: 15px; margin: 0 0 8px; overflow-wrap: anywhere; }
.definition-media > p { font-size: 14px; }
#definitionDialog { width: min(850px, 95vw); }
#definitionDialog .guide-case-heading { margin-bottom: 18px; }
#guideInvitation p { margin: 12px 0 20px; line-height: 1.8; }
.guide-player { margin: 0; min-width: 0; }
#casePlayer { margin-top: 14px; }
.guide-player video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #17151c; border-radius: 7px 7px 0 0; object-fit: contain; }
#casePlayer video { max-height: min(44vh, 390px); }
.guide-timeline {
  padding: 12px 14px 8px; border: 1px solid var(--line); border-top: 0;
  border-radius: 0 0 7px 7px; background: #fbfafd; color: var(--ink);
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.guide-track-caption, .guide-playback {
  display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 3px 8px;
}
.guide-track-caption > span, #exampleLegend, #exampleAction { color: var(--muted); }
#exampleOverview {
  position: relative; height: 8px; margin: 6px 0 13px; border-radius: 3px; background: #e5e1ed;
}
#exampleWindow { position: absolute; height: 100%; min-width: 2px; background: var(--purple); border-radius: 2px; }
#exampleTracks { position: relative; margin: 6px 0; }
#exampleTracks .time-track {
  height: 24px; background: repeating-linear-gradient(to right, #dcd9e6 0 1px, #eeecf4 1px 12.5%);
}
#exampleOverview::after, #exampleTracks::after {
  content: ""; position: absolute; z-index: 2; left: clamp(0px, var(--position), calc(100% - 2px));
  top: -2px; bottom: -2px; width: 2px; background: var(--ink); box-shadow: 0 0 0 1px white; pointer-events: none;
}
#exampleLegend { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12px; }
.guide-playback { margin-top: 9px; padding-top: 5px; border-top: 1px solid var(--line); align-items: center; }
.guide-playback > div { display: flex; flex: 1; flex-wrap: wrap; gap: 1px 8px; }
.guide-playback > div > span:first-child, #exampleReplay { white-space: nowrap; }
#exampleReplay { min-height: 34px; padding: 4px 10px; font-size: 13px; }
#exampleStatus { font-size: 13px; }
#exampleStatus:empty { display: none; }
@media (max-width: 880px) {
  #guideDefinitionPanel, #definitionText { grid-template-columns: 1fr; gap: 8px; }
}
.guide-outcomes { margin: 22px 0; }
.guide-outcomes dt { font-weight: 700; font-size: 17px; color: #553e86; }
.guide-outcomes dd { margin: 4px 0 18px; }
.guide-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-top: 18px; border-top: 1px solid var(--line); margin-top: 28px; }
#guideProgress, #guideError { font-size: 13px; }
#guideError:not(:empty) { margin-top: 12px; color: #922b40; }
.label-hint { font-size: 12px; color: var(--muted); margin: 5px 0; }
.label-choice { display: grid; grid-template-columns: minmax(0, 1fr) 26px; }
.label-choice > button:first-child { border-radius: 6px 0 0 6px; padding-inline: 4px; }
.labels .label-help { border-radius: 0 6px 6px 0; border-left: 0; padding: 0; text-align: center; color: var(--muted); }

@media (max-width: 900px) {
  .mast {
    display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center;
    min-height: 52px; gap: 4px 8px; padding: 4px 12px 8px;
  }
  .brand { gap: 7px; }
  .brand strong { font-size: 21px; }
  .brand .mark { width: 25px; height: 25px; border-width: 5px; }
  .brand span { display: none; }
  .mast-actions { min-width: 0; justify-content: flex-end; gap: 6px; }
  #source { min-width: 0; max-width: 15em; text-overflow: ellipsis; }
  #accountMenu { min-width: 0; flex: 0 1 auto; }
  #accountMenu summary { max-width: 6em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #modeNav { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #modeNav button { padding-inline: 2px; }
  .shell { display: block; }
  .shell > main, .history-page, .guide-page {
    padding: 12px max(12px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    max-width: 720px; margin-inline: auto;
  }
  button, select, input, textarea, .queue select, .queue input { font-size: 16px; }
  button, select, .queue input, #modeNav button, #accountMenu summary, .transport button,
  #historyHome, #taskHome, .history-action button, #exampleReplay, .labels button {
    min-height: 44px;
  }
  .queue {
    border: 0; border-bottom: 1px solid var(--line); padding: 2px max(12px, calc((100vw - 696px) / 2)) 5px;
    gap: 5px;
  }
  .queue .section-title { margin: 0; justify-content: start; }
  .queue h2 { font-size: 15px; }
  .queue-toggle { display: inline-block; order: 1; margin-left: auto; background: transparent; border: 0; color: var(--purple); font-size: 14px; }
  .queue.folded :is(#freeQueue, #coverage) { display: none; }
  #freeQueue { padding: 0 0 8px; gap: 6px; }
  #freeQueue .chart-list { max-height: 35vh; overflow-y: auto; }
  .queue select { width: 100%; }
  .chart { min-height: 48px; }
  .chart strong { white-space: normal; overflow-wrap: anywhere; }
  #coverage { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
  #coverage p { grid-column: 1 / -1; margin: 0; }
  .workspace-line { flex-wrap: wrap; gap: 3px 8px; }
  progress { margin-bottom: 12px; }
  #taskCards { grid-template-columns: 1fr; gap: 8px; }
  #batchHint { margin: 4px 0 14px; }
  .task-card {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto auto; align-items: center;
    gap: 4px 8px; padding: 12px 14px;
  }
  .task-card strong { grid-column: 1 / -1; grid-row: 2; font-size: 19px; }
  .task-card b { grid-column: 2; grid-row: 1; justify-self: end; margin: 0; color: var(--ink); }
  .task-card > span { font-size: 13px; }
  .task-card .card-action { border: 0; padding: 0; margin: 0; color: var(--purple); }

  .song-heading { margin-bottom: 12px; }
  .song-heading h1 { font-size: clamp(22px, 5.5vw, 30px); margin: 4px 0; }
  .song-heading p, .history-row small { overflow-wrap: anywhere; }
  .desk { display: flex; flex-direction: column; align-items: stretch; gap: 0; }
  .viewer { display: contents; }
  .stage {
    width: 100%; aspect-ratio: 1;
    max-height: 48vh; max-height: min(48svh, 450px);
  }
  .stage strong { font-size: 30px; }
  #loadVideo { margin-top: 8px; }
  .transport { flex-wrap: wrap; padding: 3px 8px; gap: 2px 6px; }
  .transport button { font-size: 14px; padding-inline: 6px; }
  .transport span { font-size: 13px; font-variant-numeric: tabular-nums; }
  #reviewViews {
    position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 8px 0 0; background: var(--panel); border-bottom: 1px solid var(--line);
  }
  #reviewViews button {
    min-height: 46px; padding: 4px; border: 0; border-radius: 0;
    border-bottom: 3px solid transparent; background: none; font-size: 15px;
  }
  #reviewViews button[aria-pressed="true"] { color: #5230ad; border-bottom-color: var(--purple); font-weight: 700; }
  #workspace:not([data-view="timing"]) :is(#reviewTiming, #evidence),
  #workspace:not([data-view="decision"]) #reviewDecision,
  #workspace:not([data-view="clips"]) #reviewClips { display: none; }
  #reviewTiming, #reviewClips, #reviewDecision { margin-top: 0; scroll-margin-top: 48px; border-top: 0; border-radius: 0 0 10px 10px; }
  .time-track, #exampleTracks .time-track { height: 24px; }
  .phone-picker { display: block; width: 100%; min-width: 0; margin-top: 10px; }
  .clip-row { padding-inline: 4px; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 4px; }
  .clip-row strong { font-size: 13px; }
  .decision .section-title { margin-bottom: 8px; }
  #decisionClip {
    display: block; margin: -4px 0 10px; color: var(--muted); font-size: 13px;
    font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
  }
  .recommended { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 9px; }
  .recommended > div { flex: 1; gap: 8px; }
  .labels { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .label-choice { grid-template-columns: minmax(0, 1fr) 44px; }
  .labels button { font-size: 14px; }
  #clipHistory summary, .evidence > summary, .history-detail summary { padding-block: 12px; }
  #toast { width: max-content; max-width: calc(100% - 24px); bottom: max(12px, env(safe-area-inset-bottom)); }

  .guide-page { display: block; }
  .guide-rail { position: static; }
  .guide-rail h1 { font-size: 22px; }
  .guide-rail p { margin: 4px 0 8px; }
  #guideChapters { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 12px; }
  #guideChapters button { text-align: center; font-size: 14px; padding-inline: 2px; }
  #guideChapters button::before { margin-right: .25em; }
  .guide-paper { padding: 16px 12px; }
  .guide-lead { margin: 8px 0 14px; }
  .guide-case { padding: 12px; }
  .guide-evidence button { grid-template-columns: 1fr; gap: 3px; }
  .guide-evidence small { grid-row: auto; }
  #guideDefinitions { display: none; }
  #guidePatternPicker { margin-bottom: 12px; }
  #guideDefinitionPanel, #definitionText { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .guide-player video, #casePlayer video { aspect-ratio: 1; max-height: 45vh; max-height: min(45svh, 420px); }
  .guide-footer { gap: 6px; }
  dialog { padding: 16px; max-height: 90vh; max-height: 90dvh; overflow-y: auto; }
  #definitionDialog .guide-case-heading { position: sticky; top: -16px; padding-block: 4px; margin-bottom: 8px; background: white; z-index: 3; }
  #historyFilters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #historySearch, .history-song { grid-column: 1 / -1; }
  .history-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; padding: 12px; }
  .history-action { text-align: right; }
}
