:root {
  color-scheme: dark;
  --bg: #0c111d;
  --panel: #111a2a;
  --cell: #151f31;
  --line: #2c3a52;
  --ink: #f2f6ff;
  --muted: #b2bed3;
  --blue: #9cc4ff;
  --amber: #ffd181;
  --green: #8ce8c0;
  --mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
  font-family: Inter, "Microsoft YaHei", "Noto Sans CJK SC", "PingFang SC", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 70% -25%, #27365a 0, transparent 52%),
    linear-gradient(180deg, #11192a, var(--bg) 66%);
  min-height: 100vh;
}

.shell { width: min(1280px, 100% - 72px); margin: 0 auto; }
.projection .shell { width: min(1500px, 100% - 64px); }
.masthead, .hero, .board-head, .stage-metric, .board-foot, .identity, .mode {
  display: flex;
  align-items: center;
}
.masthead {
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.identity { gap: 11px; font-weight: 650; font-size: 14px; }
.identity [lang="ru"], .mode [lang="ru"] { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.mark {
  display: grid;
  grid-template-columns: repeat(2, 6px);
  gap: 3px;
  padding: 8px;
  border: 1px solid #5276b3;
  border-radius: 8px;
  background: #24385c;
}
.mark i { height: 6px; border-radius: 1px; background: var(--blue); }
.mark i:nth-child(3) { opacity: .35; }
.mode { gap: 9px; font-size: 13px; text-align: right; }
.mode-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); flex: none; box-shadow: 0 0 11px #8ebfff80; }
.finished .mode-dot { background: var(--green); box-shadow: none; }

.hero { justify-content: space-between; gap: 30px; padding: 22px 0 20px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(39px, 5vw, 68px); line-height: 1.05; letter-spacing: -.045em; }
.hero-ru { color: var(--blue); font-size: clamp(18px, 2.2vw, 27px); font-weight: 620; margin-top: 5px; }
.question { font-size: 16px; line-height: 1.45; margin-top: 12px; }
.question [lang="ru"] { color: var(--muted); display: block; font-size: 14px; }
.baseline {
  min-width: 255px;
  padding: 12px 18px;
  border: 1px solid #405984;
  border-left: 3px solid var(--blue);
  border-radius: 10px;
  background: linear-gradient(120deg, #1d304d, #172236);
}
.baseline strong { display: block; font: 700 clamp(35px, 4.5vw, 52px)/1.04 var(--mono); color: var(--blue); }
.baseline strong span { color: #cbdaf1; font-size: .58em; }
.baseline div { font-size: 14px; margin-top: 5px; }
.baseline div span { display: block; font-size: 12px; color: #d1dbee; margin-top: 3px; }

.timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  padding: 0;
  margin: 0 0 15px;
  list-style: none;
}
.timeline li {
  --progress: 0%;
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  min-height: 58px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #121c2e;
  border-radius: 9px;
  font-size: 14px;
  line-height: 1.28;
}
.timeline li [lang="ru"] { display: block; font-size: 11px; margin-top: 3px; color: var(--muted); }
.step-heading { display: flex; align-items: center; gap: inherit; }
.projection .timeline li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; cursor: pointer; }
.projection .step-heading { gap: 8px; }
.scene-select {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.scene-select:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.teacher-button {
  min-height: 34px;
  padding: 3px 6px;
  border: 1px solid #6082b5;
  border-radius: 5px;
  background: #253b5d;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.1;
  text-align: center;
  cursor: pointer;
}
.teacher-button [lang="ru"] { display: block; }
.teacher-button:hover:not(:disabled) { background: #324d74; }
.teacher-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.scene-control { display: grid; place-items: center; width: 42px; height: 42px; padding: 0; }
.playback-icon { width: 0; height: 0; margin-left: 2px; border-block: 7px solid transparent; border-left: 11px solid currentColor; }
.scene-control[data-action="pause"] { background: #433021; border-color: #a57946; color: var(--amber); }
.scene-control[data-action="pause"]:hover { background: #58402a; }
.scene-control[data-action="pause"] .playback-icon {
  width: 12px;
  height: 14px;
  margin: 0;
  border: 0;
  border-inline: 4px solid currentColor;
}
#compare-button { margin-right: 6px; }
.step-number { font: 600 15px var(--mono); color: var(--muted); }
.timeline li[data-state="current"] { border-color: #6b9de6; background: #203251; }
.timeline li[data-state="current"] .step-number { color: var(--blue); }
.timeline li[data-completed] .step-number { color: var(--green); }
.step-progress { position: absolute; bottom: 0; left: 0; height: 3px; width: 0; background: var(--blue); }
[data-state="current"] .step-progress { width: var(--progress); }

.board {
  border: 1px solid #364865;
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 14px 45px #03071158;
}
.board-head {
  min-height: 95px;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
.round-label {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 620;
  margin-bottom: 5px;
}
.round-label [lang="ru"] { color: var(--muted); }
.board-head h2 { font-size: clamp(22px, 2.9vw, 36px); line-height: 1.13; }
.board-head h2 [lang="ru"] { display: block; color: #c2d2e9; font-size: .55em; line-height: 1.2; margin-top: 4px; }
.clock { flex: none; text-align: right; }
.timer { font: 650 clamp(26px, 3.2vw, 40px)/1 var(--mono); color: var(--blue); letter-spacing: -.06em; }
.timer small { font-size: .45em; margin-left: .24em; }
#clock-label { font-size: 11px; margin-top: 4px; }
#clock-label [lang="ru"] { display: block; color: var(--muted); margin-top: 2px; }
[data-phase="ended"] .timer { color: var(--amber); }
[data-phase="paused"] .timer { color: var(--amber); }
.aligned .timer { color: var(--green); }

.handoff-lane {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 18px;
  margin: 8px 18px 0;
}
.handoff-lane > div {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #1a2a43;
}
.handoff-lane .handoff-work { position: relative; border-color: #8c683b; background: #2d2625; }
.handoff-work::before, .handoff-work::after {
  content: "→";
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--amber);
}
.handoff-work::before { right: calc(100% + 3px); }
.handoff-work::after { left: calc(100% + 3px); }
.handoff-lane h3 { font-size: 13px; line-height: 1.17; }
.handoff-lane p { margin-top: 4px; font-size: 13px; font-weight: 650; line-height: 1.16; color: var(--blue); }
.handoff-lane .handoff-work p { color: var(--amber); }
.handoff-lane [lang="ru"] { display: block; color: var(--muted); font-size: 10px; margin-top: 2px; }

.flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 21px;
  padding: 14px 18px;
}
.stage {
  position: relative;
  min-width: 0;
  padding: 12px 11px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--cell);
}
.stage:not(:last-child)::after {
  content: "→";
  position: absolute;
  top: 49%;
  left: calc(100% + 3px);
  font-size: 15px;
  color: #9ab5da;
}
.stage.limited { border-color: #ac8248; background: #241f24; }
.stage-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px; }
.stage-head { display: flex; align-items: flex-start; gap: 7px; min-width: 0; }
.stage-number {
  padding: 4px 5px;
  color: var(--blue);
  background: #263857;
  border-radius: 4px;
  font: 650 11px/1 var(--mono);
}
.stage h3 { min-width: 0; font-size: 15px; line-height: 1.18; font-weight: 680; }
.stage h3 [lang="ru"] { display: block; color: var(--muted); font-size: 11px; font-weight: 500; line-height: 1.18; margin-top: 4px; }
.stage-metric { flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; }
.stage-metric strong { color: var(--blue); font: 700 clamp(23px, 2.55vw, 34px)/1 var(--mono); white-space: nowrap; }
.stage-metric strong span { font-size: .53em; color: var(--muted); }
.stage-metric div { font-size: 10px; line-height: 1.12; }
.stage-metric div [lang="ru"] { display: block; color: var(--muted); font-size: 9px; margin-top: 2px; }
.stage:last-child .stage-metric strong { color: var(--green); }

.stage-scene {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 7px 0;
}
.stage-visual {
  aspect-ratio: 2;
  border-radius: 5px;
  outline: 1px solid #a6c3ee45;
  outline-offset: -1px;
  background: #203251 url("./factory-stages.png") no-repeat;
  background-size: 200% 200%;
}
.stage-visual[data-scene="handoff"] { background-position: right top; }
.stage-visual[data-scene="review"] { background-position: left bottom; }
.stage-visual[data-scene="hold"] { background-position: right bottom; }
.board[data-manual-handoff] .stage:nth-child(2) .stage-visual { display: none; }
.board[data-manual-handoff] .stage:nth-child(2) .stage-scene {
  grid-template-columns: 1fr;
  min-height: 60px;
}
.stage-caption { color: #e4ecfa; font-size: 12px; line-height: 1.24; }
.stage-caption [lang="ru"] { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }

.slots {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: clamp(24px, 2.5vw, 35px);
  gap: 4px;
}
.slot { border: 1px dashed #3b4d6a; border-radius: 4px; min-width: 0; }
.defect-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: calc(100% + 2px);
  width: calc(100% + 2px);
  margin: -1px;
  border: 1px solid #6895d2;
  border-radius: 4px;
  background: #233d65;
  color: #e1edff;
  font: 650 clamp(9px, 1vw, 13px)/1 var(--mono);
}
.defect-card i {
  width: 9px;
  height: 9px;
  flex: none;
  border: 1px solid currentColor;
  opacity: .8;
  background: linear-gradient(135deg, transparent 30%, currentColor 36%, currentColor 47%, transparent 55%);
}
.defect-card[data-pattern="1"] i { background: radial-gradient(circle at 66% 34%, currentColor 0 21%, transparent 30%); }
.defect-card[data-pattern="2"] i { background: linear-gradient(30deg, transparent 30%, currentColor 36%, currentColor 48%, transparent 55%); }
.defect-card[data-status="waiting"] { background: #604525; border-color: #c08d46; color: #fff0d1; }
.defect-card[data-status="done"] { background: #1f4a43; border-color: #63c4a3; color: #d1ffed; }
.defect-card[data-status="done"] i { background: none; border-width: 0 0 1px 1px; transform: rotate(-45deg); height: 5px; }
.stage-state {
  min-height: 32px;
  padding-top: 5px;
  line-height: 1.15;
  color: var(--amber);
  font-size: 12px;
  font-weight: 650;
}
.stage-state[hidden] { display: block !important; visibility: hidden; }
.overview .stage-state[hidden] { display: none !important; }
.overview .slots, .overview .stage-metric { display: none; }
[data-phase="ready"] .stage-metric { visibility: hidden; }
.stage-state [lang="ru"] { display: block; font-size: 10px; margin-top: 3px; }
.board-foot {
  min-height: 57px;
  gap: 10px;
  padding: 9px 18px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  line-height: 1.3;
}
.board-foot [lang="ru"] { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; }
#round-detail { flex: 1; }
#quiz-jump { flex: none; }
#quiz-jump [lang="ru"] { font-size: 11px; }

.round-quiz { margin-top: 14px; }
.round-quiz .board-head { align-items: flex-start; }
.round-quiz h2 { font-size: clamp(18px, 2.1vw, 28px); }
.quiz-type { margin-bottom: 5px; color: var(--blue); font-size: 12px; }
.quiz-type [lang="ru"] { margin-left: 8px; color: var(--muted); font-size: 11px; }
#quiz-reveal { flex: none; }
#quiz-reveal [lang="ru"] { margin-top: 3px; color: var(--muted); font-size: 11px; }
#quiz-reveal:disabled { opacity: .6; cursor: default; }
.quiz-body { padding: 12px 18px 16px; }
.quiz-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.option-card { min-width: 0; border: 1px solid var(--line); border-radius: 7px; background: #17253a; }
.option-button {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  width: 100%;
  min-height: 63px;
  padding: 8px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: 14px;
}
.option-button:hover:not(:disabled), .option-button[aria-pressed="true"]:not(:disabled) { background: #263d60; }
.option-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.option-button:disabled { cursor: default; }
.option-letter {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid #6f89ad;
  border-radius: 4px;
  color: var(--blue);
  font-weight: 700;
}
.option-button[aria-pressed="true"]:not(:disabled) .option-letter { background: var(--blue); color: #17253a; }
.option-label [lang="ru"], .option-feedback [lang="ru"], .option-example [lang="ru"], .quiz-answer [lang="ru"] {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.quiz-answer { margin-bottom: 10px; color: var(--green); font-size: 15px; }
.option-feedback { padding: 0 9px 8px 39px; color: var(--muted); font-size: 13px; }
.option-detail { margin: 0 9px 8px 39px; border-top: 1px solid var(--line); }
.option-detail summary { min-height: 34px; padding-block: 7px; color: var(--blue); cursor: pointer; font-size: 13px; }
.option-detail summary [lang="ru"] { margin-left: 8px; color: var(--muted); font-size: 11px; }
.option-detail summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.option-detail .option-feedback { padding: 0 0 5px; }
.option-example { padding-bottom: 4px; font-size: 13px; line-height: 1.45; }
[data-revealed] .quiz-option[data-plausible="true"] .option-card { border-color: #5f9a85; background: #173331; }
[data-revealed] .quiz-option[data-plausible="true"] .option-letter { border-color: var(--green); background: var(--green); color: #12322b; }
[data-revealed] .quiz-option[data-plausible="true"] .option-feedback { color: var(--green); }
.option-connection { display: none; }
.quiz-condition {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  margin-top: 12px;
}
.condition-paths { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.condition-path {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 6px;
  padding-right: 5px;
}
.condition-path p, .option-connection { color: var(--green); font-size: 13px; line-height: 1.3; }
.condition-path [lang="ru"], .option-connection [lang="ru"] { display: block; color: var(--muted); font-size: 11px; }
.condition-path::after, .option-connection::after {
  content: "";
  display: block;
  height: 10px;
  background: var(--green);
  clip-path: polygon(0 40%, calc(100% - 7px) 40%, calc(100% - 7px) 0, 100% 50%, calc(100% - 7px) 100%, calc(100% - 7px) 60%, 0 60%);
}
.condition-target {
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 10px;
  border: 1px solid #5f9a85;
  border-radius: 7px;
  background: #173331;
  text-align: center;
}
.condition-target p { color: var(--green); font-size: 12px; }
.condition-target h3 { font-size: clamp(15px, 1.7vw, 22px); line-height: 1.3; }
.condition-target [lang="ru"] { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

@media (min-width: 741px) {
  @supports (grid-template-rows: subgrid) {
    [data-revealed] .quiz-layout {
      display: grid;
      grid-template-columns: minmax(0, 1fr) clamp(155px, 19vw, 222px);
      grid-template-rows: repeat(5, auto);
      row-gap: 8px;
    }
    [data-revealed] .quiz-options { grid-column: 1; grid-row: 1 / -1; grid-template-rows: subgrid; }
    [data-revealed] .quiz-option {
      display: grid;
      grid-template-columns: minmax(0, 1fr) clamp(116px, 14vw, 168px);
    }
    [data-revealed] .option-connection {
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 3px;
      padding: 0 6px;
      text-align: center;
    }
    .option-connection::after { margin-top: 2px; }
    .quiz-condition { grid-column: 2; grid-row: 1 / span 3; display: grid; grid-template-columns: 1fr; margin-top: 0; }
    .condition-paths { display: none; }
  }
}
.quiz-extension {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.quiz-extension h3 { font-size: clamp(18px, 2vw, 24px); }
.quiz-extension h3 [lang="ru"], .extension-examples h4 [lang="ru"] {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .78em;
}
.extension-question { margin: 8px 0; font-size: 14px; line-height: 1.45; }
.extension-question:last-child { margin-bottom: 0; }
.extension-examples {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.extension-examples article { padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: #17253a; }
.extension-examples h4 { margin: 0 0 7px; font-size: 15px; }
.extension-examples p { font-size: 13px; line-height: 1.42; }
.extension-examples strong { color: var(--amber); }
.extension-examples p [lang="ru"], .extension-question [lang="ru"] {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.comparison .board-head { min-height: 73px; }
.overview .comparison { margin-top: 14px; }
.results { width: calc(100% - 36px); margin: 0 18px; border-collapse: collapse; table-layout: fixed; }
.results caption { padding-block: 7px; color: var(--muted); font-size: 12px; text-align: left; }
.results th, .results td { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--line); }
.results th:first-child { text-align: left; width: 34%; }
.results th:last-child { width: 26%; }
.results thead th { color: #cdd9eb; font-size: 13px; }
.results [lang="ru"] { display: block; color: var(--muted); font-size: 11px; margin-top: 2px; }
.results tbody th { font-size: 14px; }
.results tbody th div { display: inline-block; vertical-align: middle; }
.result-index { font: 650 12px var(--mono); color: var(--blue); margin-right: 8px; }
.results td { font: 650 clamp(14px, 1.75vw, 22px) var(--mono); }
.results td.low, .outcome { color: var(--amber); }
.outcome.complete { color: var(--green); }
.outcome div { display: flex; justify-content: center; align-items: center; gap: 9px; }
.outcome-note { display: block; margin-top: 4px; font: 500 11px/1.25 system-ui, sans-serif; overflow-wrap: anywhere; }
.segments { display: grid; width: min(125px, 58%); grid-template-columns: repeat(10, 1fr); gap: 2px; }
.segments i { height: 8px; border-radius: 2px; background: #303c53; }
.segments .filled { background: currentColor; }
.conditions { padding: 11px 18px 14px; }
.conditions h3 { font-size: 14px; }
.conditions h3 [lang="ru"] { margin-left: 8px; color: var(--muted); font-size: 12px; font-weight: 500; }
.conditions ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none; margin: 8px 0 0; padding: 0; gap: 8px; }
.conditions li {
  border-radius: 6px;
  border: 1px solid #3d5a71;
  background: #18283a;
  padding: 8px 10px;
  font-size: 14px;
}
.conditions li [lang="ru"] { display: block; font-size: 11px; color: #d0dcee; margin-top: 3px; }
.disclaimer { padding: 10px 2px 15px; color: #bdc9de; font-size: 12px; line-height: 1.42; }
.disclaimer [lang="ru"] { display: block; margin-top: 2px; }
.noscript { padding: 14px; }
.noscript [lang="ru"] { display: block; color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (min-width: 1000px) {
  .projection .handoff-lane h3 [lang="ru"] { display: inline; margin-left: 6px; }
  .projection .identity, .projection .mode { font-size: 16px; }
  .projection .identity [lang="ru"], .projection .mode [lang="ru"] { font-size: 12px; }
  .projection .question { font-size: 18px; }
  .projection .question [lang="ru"], .projection .baseline div { font-size: 15px; }
  .projection .baseline div span { font-size: 13px; }
  .projection .timeline li { font-size: 16px; }
  .projection .timeline li [lang="ru"] { font-size: 13px; }
  .projection .round-label, .projection #clock-label { font-size: 14px; }
  .projection .stage h3 { font-size: 18px; }
  .projection .stage h3 [lang="ru"] { font-size: 12px; }
  .projection .stage-caption { font-size: 13px; }
  .projection .stage-caption [lang="ru"] { font-size: 11px; }
  .projection .stage-state { font-size: 14px; }
  .projection .stage-state [lang="ru"] { font-size: 12px; }
  .projection .board-foot { font-size: 16px; }
  .projection .board-foot [lang="ru"] { font-size: 14px; }
  .projection .results th { font-size: 16px; }
  .projection .results [lang="ru"], .projection .conditions li [lang="ru"] { font-size: 13px; }
  .projection .conditions li { font-size: 16px; }
  .projection .disclaimer { font-size: 13px; }
}

@media (min-width: 1000px) and (min-height: 820px) {
  .projection .hero { padding-block: 34px; }
  .projection .timeline { margin-bottom: 20px; }
  .projection .board-head { padding: 18px 24px; }
  .projection .flow { padding: 20px 24px; }
  .projection #round:not([data-phase="ready"]) .flow { padding-block: 13px; }
  .projection .stage { padding: 17px 14px 10px; }
  .projection .stage-caption { font-size: 15px; }
  .projection .stage-caption [lang="ru"] { font-size: 13px; }
  .projection .slots { grid-auto-rows: 40px; }
  .projection .board-foot { min-height: 66px; padding-inline: 24px; }
  .projection .results th, .projection .results td { padding-block: 12px; }
  .projection .conditions { padding-block: 16px; }
}

@media (min-width: 801px) and (max-height: 819px) {
  .projection .masthead { padding-block: 6px; }
  .projection .hero { padding-block: 6px; }
  .projection .hero > div:first-child {
    flex: 1;
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    column-gap: 20px;
  }
  .projection h1 { font-size: clamp(36px, 4.1vw, 49px); }
  .projection .hero-ru { grid-area: 2 / 1; font-size: 21px; margin-top: 3px; }
  .projection .question { grid-area: 1 / 2 / 3; margin-top: 0; font-size: 15px; }
  .projection .question [lang="ru"] { font-size: 12px; }
  .projection .baseline { display: flex; align-items: center; gap: 12px; padding-block: 7px; }
  .projection .baseline strong { font-size: 38px; }
  .projection .baseline div { margin-top: 0; }
  .projection .timeline { margin-bottom: 9px; }
  .projection .timeline li { min-height: 45px; padding-block: 6px; }
  .projection .board-head { min-height: 74px; padding-block: 6px; }
  .projection #round:not([data-phase="ready"]) .board-head { min-height: 66px; padding-block: 3px; }
  .projection #round .board-head > div:first-child { display: flex; align-items: center; gap: 14px; }
  .projection .round-label { display: block; margin: 0; }
  .projection .round-label [lang="ru"] { display: block; }
  .projection .board-head h2 { font-size: clamp(23px, 2.5vw, 30px); }
  .projection .timer { font-size: 31px; }
  .projection #clock-label { font-size: 12px; line-height: 1.2; }
  .projection .flow { padding-block: 7px; }
  .projection #round:not([data-phase="ready"]) .flow { padding-block: 5px; }
  .projection .handoff-lane { margin-top: 6px; }
  .projection .handoff-lane > div { padding-block: 3px; }
  .projection .stage { padding-block: 8px 5px; }
  .projection .slots { grid-auto-rows: 27px; }
  .projection .board-foot { min-height: 46px; padding-block: 5px; }
  .projection .comparison .board-head { min-height: 64px; }
  .projection .results th, .projection .results td { padding-block: 4px; }
  .projection.finished .hero { padding-block: 6px; }
  .projection.finished h1 { font-size: 34px; }
  .projection.finished .hero-ru { font-size: 17px; }
  .projection .conditions { padding-block: 7px; }
  .projection .disclaimer { padding-block: 7px; }
}

@media (max-width: 800px) {
  .shell, .projection .shell { width: calc(100% - 28px); }
  .hero { gap: 14px; }
  .flow { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; }
  .stage:nth-child(2)::after { content: none; }
  .stage::after { left: calc(100% + 2px) !important; font-size: 12px !important; }
  .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 540px) {
  .masthead { padding-block: 9px; }
  .hero { flex-wrap: wrap; padding: 14px 0 12px; gap: 10px; }
  .hero-ru { margin-top: 2px; }
  .question { margin-top: 7px; font-size: 14px; }
  .question [lang="ru"] { font-size: 12px; }
  .baseline { width: 100%; display: flex; align-items: center; gap: 11px; padding: 6px 9px; }
  .baseline strong { font-size: 28px; }
  .baseline div { margin-top: 0; font-size: 12px; }
  .baseline div span { font-size: 10px; }
  .timeline { margin-bottom: 8px; gap: 5px; }
  .timeline li { min-height: 41px; padding: 5px 6px; font-size: 12px; gap: 5px; }
  .timeline li [lang="ru"] { font-size: 9px; }
  .projection .mode-dot, .projection .mode > div { display: none; }
  .projection #compare-button { margin-right: 0; }
  .projection .teacher-button { min-height: 38px; }
  .projection .timeline li { column-gap: 4px; }
  .projection .step-heading { gap: 4px; }
  .scene-control { width: 34px; height: 38px; }
  .step-number { font-size: 12px; }
  .board-head { padding: 8px 9px; min-height: 63px; }
  .round-label { font-size: 10px; margin-bottom: 3px; }
  .board-head h2 { font-size: 21px; }
  .handoff-lane { grid-template-columns: 1fr; gap: 8px; margin: 6px 9px 0; }
  .handoff-work::before, .handoff-work::after { content: none; }
  .handoff-lane h3, .handoff-lane p { font-size: 11px; }
  .handoff-lane [lang="ru"] { font-size: 9px; }
  .flow { padding: 7px 9px; gap: 6px 12px; }
  .stage { padding: 6px 5px 3px; }
  .stage-top { flex-direction: column; gap: 4px; }
  .stage-head { gap: 4px; }
  .stage-number { font-size: 9px; padding: 3px; }
  .stage h3 { font-size: 12px; }
  .stage h3 [lang="ru"] { font-size: 9px; margin-top: 2px; }
  .stage-metric { flex-direction: row; align-items: center; gap: 4px; text-align: left; }
  .stage-metric div { font-size: 9px; }
  .stage-metric div [lang="ru"] { font-size: 8px; }
  .stage-scene { grid-template-columns: 1fr; gap: 4px; margin: 5px 0; }
  .stage-caption { font-size: 10px; }
  .stage-caption [lang="ru"] { font-size: 9px; margin-top: 2px; }
  .slots { grid-auto-rows: 19px; gap: 2px; }
  .defect-card { gap: 2px; }
  .defect-card i { width: 6px; height: 6px; }
  .stage-state { min-height: 24px; padding-top: 3px; font-size: 9px; }
  .stage-state [lang="ru"] { font-size: 8px; margin-top: 1px; }
  .board-foot { min-height: 51px; padding: 6px 9px; font-size: 11px; gap: 6px; }
  .board-foot [lang="ru"], .disclaimer { font-size: 10px; }
  .round-quiz .board-head { flex-wrap: wrap; }
  .quiz-body { padding: 8px 9px 10px; }
  .condition-target { padding-inline: 7px; }
  .extension-examples { grid-template-columns: 1fr; }
  .option-button { font-size: 13px; }
  .disclaimer { padding: 7px 1px 10px; }
  .comparison .board-head { min-height: 53px; }
  .results { width: calc(100% - 16px); margin-inline: 8px; }
  .results th, .results td { padding: 7px 2px; }
  .results th:first-child { width: 30%; }
  .results th:nth-child(4) { width: 17%; }
  .results th:last-child { width: 23%; }
  .results thead th { font-size: 9px; }
  .results caption, .outcome-note { font-size: 10px; }
  .results [lang="ru"] { font-size: 9px; }
  .results tbody th { font-size: 11px; }
  .result-index { display: none; }
  .outcome div { flex-direction: column; gap: 4px; }
  .segments { width: 90%; gap: 1px; }
  .segments i { height: 4px; }
  .conditions { padding: 8px; }
  .conditions ul { grid-template-columns: 1fr; gap: 4px; margin-top: 5px; }
  .conditions li { padding: 4px 6px; font-size: 11px; }
  .conditions li [lang="ru"] { font-size: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .mode-dot { box-shadow: none; }
}
