:root {
  color-scheme: dark;
  --ink: #172535;
  --ink-soft: #536170;
  --canvas: #e9ecee;
  --paper: #f7f4ec;
  --paper-strong: #fffdf8;
  --line: rgba(30, 48, 64, .17);
  --line-strong: rgba(24, 41, 58, .34);
  --blue: #2567c5;
  --blue-dark: #174f9f;
  --coral: #dc6248;
  --green: #208469;
  --shadow: 0 18px 50px rgba(10, 23, 36, .20), 0 2px 6px rgba(10, 23, 36, .10);
  --ease: cubic-bezier(.2, .8, .2, 1);
  font-family: "Avenir Next", "Segoe UI Variable", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
button { font: inherit; }
button:focus-visible, [tabindex]:focus-visible { outline: 3px solid #73b5ff; outline-offset: 2px; }
body { margin: 0; min-height: 100vh; background: #111a24; color: var(--ink); }

.lab-bar {
  min-height: 68px;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  color: #f6f8fa;
  border-bottom: 1px solid rgba(255,255,255,.1);
  background: #111a24;
}
.lab-bar > div:first-child { margin-right: auto; display: grid; gap: 2px; }
.lab-bar strong { font-size: 17px; }
.lab-kicker { color: #83a4c5; font-size: 10px; font-weight: 800; letter-spacing: .15em; }
.lab-control { display: flex; padding: 4px; gap: 3px; background: rgba(255,255,255,.07); border-radius: 11px; }
.lab-control button { min-height: 36px; padding: 0 13px; color: #bdc9d6; border: 0; border-radius: 8px; background: transparent; cursor: pointer; }
.lab-control button:hover { color: white; background: rgba(255,255,255,.06); }
.lab-control button.is-active { color: #102033; background: #f4f7fa; font-weight: 800; }
.lab-size-readout { min-width: 82px; color: #8fa3b6; font-size: 12px; }
.lab-stage { min-height: calc(100vh - 68px); padding: 28px; display: grid; place-items: center; overflow: auto; }
.device { width: min(1440px, 100%); aspect-ratio: 16 / 10; max-height: calc(100vh - 124px); border: 8px solid #25313e; border-radius: 26px; overflow: hidden; box-shadow: 0 36px 80px rgba(0,0,0,.44); background: var(--paper); transition: width .35s var(--ease), aspect-ratio .35s var(--ease); }
.device--phone { width: min(844px, 100%); aspect-ratio: 844 / 390; border-radius: 28px; }
.device--tablet { width: min(1024px, 100%); aspect-ratio: 4 / 3; border-radius: 24px; }
.device--desktop { width: min(1440px, 100%); aspect-ratio: 16 / 10; }
.device--fluid { width: 100%; aspect-ratio: auto; height: calc(100vh - 132px); }

.game { width: 100%; height: 100%; position: relative; overflow: hidden; display: grid; grid-template-rows: 76px minmax(0, 1fr) 64px; color: var(--ink); background: var(--paper); }
.gamebar { z-index: 5; padding: 10px 18px; display: grid; grid-template-columns: minmax(250px, 1fr) auto minmax(220px, 1fr); align-items: center; gap: 18px; background: rgba(255,253,248,.96); border-bottom: 1px solid var(--line-strong); box-shadow: 0 4px 18px rgba(19,36,52,.06); }
.gamebar__identity, .gamebar__actions, .scoreboard, .tool, .instruction, .zoom-control, .mission-heading { display: flex; align-items: center; }
.gamebar__identity { gap: 12px; min-width: 0; }
.gamebar__title { min-width: 0; display: grid; gap: 2px; }
.gamebar__title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 18px; letter-spacing: -.02em; }
.eyebrow { color: var(--blue); font-size: 10px; font-weight: 850; letter-spacing: .13em; }
.icon-button { width: 48px; height: 48px; flex: 0 0 48px; border: 1px solid var(--line-strong); border-radius: 14px; color: var(--ink); background: var(--paper-strong); font-weight: 800; font-size: 20px; cursor: pointer; box-shadow: 0 2px 0 rgba(25,42,58,.10); transition: transform .16s var(--ease), background .16s; }
.icon-button:hover { background: #eef3f7; }
.icon-button:active, .tool:active, .rail-button:active { transform: translateY(2px); box-shadow: none; }
.scoreboard { justify-self: center; gap: 6px; }
.metric { min-width: 86px; height: 50px; padding: 6px 12px; display: grid; align-content: center; border-left: 1px solid var(--line); }
.metric:first-child { border-left: 0; }
.metric span { color: var(--ink-soft); font-size: 10px; font-weight: 750; letter-spacing: .08em; }
.metric strong { margin-top: -1px; font-variant-numeric: tabular-nums; font-size: 20px; line-height: 1.1; }
.metric strong b { color: var(--blue); }
.metric strong i { color: #77838d; font-size: 13px; font-style: normal; font-weight: 700; }
.metric--miss strong { color: var(--coral); }
.gamebar__actions { justify-content: flex-end; gap: 8px; }
.tool { min-height: 50px; padding: 5px 12px 5px 6px; gap: 9px; border: 1px solid var(--line-strong); border-radius: 15px; color: var(--ink); background: var(--paper-strong); cursor: pointer; box-shadow: 0 2px 0 rgba(25,42,58,.12); transition: transform .16s var(--ease), filter .16s; }
.tool:hover { filter: brightness(.97); }
.tool__icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; background: #e9eef4; font-size: 14px; font-weight: 900; }
.tool__copy { display: grid; text-align: left; }
.tool__copy b { font-size: 14px; }
.tool__copy small { color: var(--ink-soft); font-size: 10px; }
.tool--rescue .tool__icon { color: var(--coral); background: #fff0eb; }
.tool--primary { color: white; border-color: var(--blue-dark); background: var(--blue); }
.tool--primary .tool__icon { color: var(--blue-dark); background: white; }
.tool--primary .tool__copy small { color: #dceaff; }

.difference-board { min-height: 0; padding: 14px 18px 10px; display: grid; grid-template-columns: minmax(0,1fr) 16px minmax(0,1fr); align-items: center; background: #dfe4e7; }
.scene-pane { width: 100%; position: relative; max-height: 100%; aspect-ratio: 3 / 2; overflow: hidden; border-radius: 16px; background: #b9c7d1; box-shadow: 0 0 0 1px rgba(15,31,46,.2), 0 8px 24px rgba(18,34,49,.14); cursor: crosshair; }
.scene-pane--a { justify-self: end; }
.scene-pane--b { justify-self: start; }
.scene-placeholder { width: 100%; height: 100%; position: relative; overflow: hidden; background: linear-gradient(150deg, #8eb8c1 0 27%, #d6caa9 27% 48%, #7d9f84 48% 68%, #667f92 68%); }
.scene-placeholder::before, .scene-placeholder::after { content: ""; position: absolute; border-radius: 45% 55% 30% 70%; background: rgba(255,255,255,.22); transform: rotate(-12deg); }
.scene-placeholder::before { width: 52%; height: 50%; left: -8%; top: 8%; }
.scene-placeholder::after { width: 40%; height: 58%; right: -8%; bottom: -17%; background: rgba(23,50,67,.17); }
.scene-placeholder--b { filter: saturate(.92) hue-rotate(5deg); }
.scene-grid { position: absolute; inset: 0; opacity: .22; background-image: linear-gradient(rgba(255,255,255,.55) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.55) 1px, transparent 1px); background-size: 12.5% 16.66%; }
.scene-copy { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: rgba(20,42,55,.64); text-shadow: 0 1px rgba(255,255,255,.4); }
.scene-copy b { font-size: clamp(14px, 1.5vw, 22px); letter-spacing: .14em; }
.scene-copy small { margin-top: 4px; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.pane-label { position: absolute; top: 10px; left: 10px; width: 42px; height: 34px; display: grid; place-items: center; color: white; border: 1px solid rgba(255,255,255,.35); border-radius: 11px; background: rgba(18,37,53,.84); backdrop-filter: blur(10px); font-size: 17px; font-weight: 900; }
.difference-marker { position: absolute; width: 35px; height: 35px; display: grid; place-items: center; color: white; border: 3px solid white; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 2px rgba(20,39,55,.72), 0 3px 12px rgba(13,43,35,.35); font-size: 13px; font-weight: 900; }
.marker-one { left: 64%; top: 56%; }
.comparison-seam { align-self: center; height: 56%; display: grid; place-items: center; }
.comparison-seam::before { content: ""; width: 1px; height: 100%; background: rgba(34,54,70,.2); }
.comparison-seam span { position: absolute; padding: 9px 3px; color: #657583; background: #dfe4e7; writing-mode: vertical-rl; font-size: 8px; font-weight: 900; letter-spacing: .13em; }
.difference-dock { min-height: 64px; padding: 8px 18px 10px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--line); background: var(--paper-strong); }
.instruction { gap: 11px; min-width: 0; }
.instruction__mark { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; color: white; border-radius: 12px; background: var(--blue); font-size: 13px; font-weight: 900; }
.instruction__copy { min-width: 0; display: grid; }
.instruction b { font-size: 14px; }
.instruction small { color: var(--ink-soft); font-size: 12px; }
.instruction > span.progress-dots { display: flex; gap: 5px; margin-left: 8px; }
.progress-dots i { width: 7px; height: 7px; border: 1px solid #9ca7ae; border-radius: 50%; background: transparent; }
.progress-dots i.is-found { border-color: var(--blue); background: var(--blue); }
.zoom-control { height: 48px; padding: 1px; border: 1px solid var(--line-strong); border-radius: 13px; background: #eef1f2; }
.zoom-control button { min-width: 44px; height: 44px; border: 0; border-radius: 10px; color: var(--ink); background: transparent; font-size: 17px; font-weight: 800; cursor: pointer; }
.zoom-control button:hover { background: white; }
.zoom-control .zoom-value { min-width: 62px; font-size: 13px; }

.hidden-board { min-height: 0; grid-row: 2 / 4; padding: 14px 18px 18px; display: grid; grid-template-columns: minmax(0, 16fr) minmax(250px, 4fr); gap: 14px; background: #dfe4e7; }
.hidden-board[hidden] { display: none; }
.hidden-scene { width: 100%; position: relative; align-self: center; max-height: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 18px; box-shadow: 0 0 0 1px rgba(15,31,46,.2), 0 12px 32px rgba(18,34,49,.16); cursor: crosshair; }
.scene-placeholder--hidden { background: linear-gradient(155deg, #82b0bd 0 29%, #d8bd8d 29% 44%, #82996f 44% 68%, #596f82 68%); }
.safe-zone { position: absolute; top: 6%; bottom: 6%; left: 4%; right: 4%; display: grid; place-items: end center; padding-bottom: 12px; color: rgba(255,255,255,.74); border: 1px dashed rgba(255,255,255,.62); border-radius: 12px; font-size: 9px; font-weight: 850; letter-spacing: .12em; }
.scene-overlay { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: center; pointer-events: none; }
.scene-mode, .scene-progress { padding: 8px 11px; color: white; border: 1px solid rgba(255,255,255,.22); border-radius: 11px; background: rgba(14,31,45,.78); backdrop-filter: blur(10px); font-size: 11px; font-weight: 850; letter-spacing: .08em; }
.scene-progress { letter-spacing: 0; }
.scene-progress b { color: #bde8dc; font-size: 15px; }
.mission-rail { min-height: 0; padding: 16px; display: grid; grid-template-rows: auto 5px minmax(0, 1fr) auto; gap: 12px; border: 1px solid var(--line-strong); border-radius: 18px; background: var(--paper-strong); box-shadow: 0 8px 24px rgba(18,34,49,.10); }
.mobile-rail-status { display: none; }
.mission-heading { justify-content: space-between; gap: 10px; }
.mission-heading h2 { margin: 2px 0 0; font-size: 19px; letter-spacing: -.025em; }
.mission-count { width: 48px; height: 48px; display: grid; place-content: center; color: white; text-align: center; border-radius: 14px; background: var(--blue); }
.mission-count b { font-size: 18px; line-height: 16px; }
.mission-count small { font-size: 9px; text-transform: uppercase; }
.progress-track { overflow: hidden; border-radius: 5px; background: #dfe5e7; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--green); transition: width .25s var(--ease); }
.target-list { min-height: 0; margin: 0; padding: 0 3px 0 0; display: grid; grid-auto-rows: minmax(44px, auto); gap: 5px; list-style: none; overflow: auto; }
.target-list button { width: 100%; min-height: 44px; position: relative; padding: 6px 9px; display: grid; grid-template-columns: 28px 1fr 24px; align-items: center; gap: 6px; text-align: left; color: var(--ink); border: 1px solid transparent; border-radius: 10px; background: #f0eee7; cursor: pointer; transition: background .16s, transform .16s; }
.target-list button:hover { border-color: var(--line); background: #e7edf1; }
.target-list button:active { transform: scale(.985); }
.target-index { color: #78838c; font-size: 10px; font-weight: 850; }
.target-list button > span:nth-child(2) { font-size: 13px; font-weight: 750; }
.target-list i { width: 22px; height: 22px; display: grid; place-items: center; color: white; border-radius: 7px; background: transparent; font-size: 11px; font-style: normal; }
.target-list .is-found button { color: #71807e; background: #e5f0eb; }
.target-list .is-found button > span:nth-child(2) { text-decoration: line-through; text-decoration-thickness: 2px; }
.target-list .is-found i { background: var(--green); }
.mission-tools { display: grid; grid-template-columns: 1fr; gap: 7px; }
.rail-button { min-height: 52px; padding: 6px 8px; display: grid; grid-template-columns: 34px 1fr; grid-template-rows: 1fr 1fr; column-gap: 7px; align-items: center; text-align: left; color: white; border: 1px solid var(--blue-dark); border-radius: 13px; background: var(--blue); box-shadow: 0 2px 0 rgba(16,51,91,.35); cursor: pointer; }
.rail-button > span { grid-row: 1 / 3; width: 34px; height: 34px; display: grid; place-items: center; color: var(--blue-dark); border-radius: 10px; background: white; font-size: 11px; font-weight: 900; }
.rail-button b { align-self: end; font-size: 12px; }
.rail-button small { align-self: start; color: #dceaff; font-size: 9px; }
.rail-button--quiet { color: var(--ink); border-color: var(--line-strong); background: #f4eee5; box-shadow: 0 2px 0 rgba(25,42,58,.12); }
.rail-button--quiet > span { color: var(--coral); background: #fff0eb; }
.rail-button--quiet small { color: var(--ink-soft); }
.hint-pulse { position: absolute; left: 61%; top: 49%; width: 50px; height: 50px; opacity: 0; border: 3px solid white; border-radius: 50%; box-shadow: 0 0 0 5px rgba(37,103,197,.75); pointer-events: none; }
.hint-pulse.is-visible { animation: hint 1.1s var(--ease) 2; }

.toast { z-index: 10; position: absolute; left: 50%; bottom: 78px; padding: 11px 17px; opacity: 0; transform: translate(-50%, 12px); color: white; border-radius: 13px; background: rgba(21,45,58,.94); box-shadow: var(--shadow); font-size: 13px; font-weight: 800; pointer-events: none; transition: opacity .2s, transform .2s var(--ease); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.pause-layer { z-index: 20; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(11,23,34,.55); backdrop-filter: blur(8px); }
.pause-layer[hidden] { display: none; }
.pause-card { width: min(360px, calc(100% - 36px)); padding: 28px; text-align: center; border: 1px solid rgba(255,255,255,.55); border-radius: 22px; background: var(--paper-strong); box-shadow: var(--shadow); }
.pause-card h2 { margin: 8px 0 5px; font-size: 28px; }
.pause-card p { margin: 0 0 20px; color: var(--ink-soft); }
.pause-card button { min-width: 180px; min-height: 48px; color: white; border: 0; border-radius: 13px; background: var(--blue); font-weight: 850; cursor: pointer; }
.pause-card .pause-secondary { display: block; margin: 10px auto 0; color: var(--ink); border: 1px solid var(--line-strong); background: #f1eee6; font-size: 12px; }

.game[data-mode="hidden"] { grid-template-rows: 76px minmax(0, 1fr); }
.game[data-mode="hidden"] .difference-board,
.game[data-mode="hidden"] .difference-dock { display: none; }
.game[data-mode="hidden"] .gamebar__title .eyebrow::after { content: ""; }

/* State oracle: every non-live state is a real, inspectable composition. */
.state-screen { z-index: 30; position: absolute; inset: 0; display: none; place-items: center; padding: 24px; color: var(--ink); background: rgba(247,244,236,.97); }
.game[data-state="loading"] [data-state-screen="loading"],
.game[data-state="error-retryable"] [data-state-screen="error-retryable"],
.game[data-state="error-fatal"] [data-state-screen="error-fatal"],
.game[data-state="rotate"] [data-state-screen="rotate"],
.game[data-state="success"] [data-state-screen="results"],
.game[data-state="time-up"] [data-state-screen="results"],
.game[data-state="rescued"] [data-state-screen="results"],
.game[data-state="review"] [data-state-screen="review"],
.game[data-state="pause"] [data-state-screen="pause"],
.game[data-state="rescue"] [data-state-screen="rescue"] { display: grid; }
.state-screen--modal { background: rgba(11,23,34,.58); backdrop-filter: blur(8px); }
.state-screen--loading, .state-screen--rotate, .state-screen--error, .state-screen--review { background: var(--paper); }
.state-card { width: min(460px, calc(100% - 20px)); padding: 30px; display: grid; justify-items: center; gap: 9px; text-align: center; border: 1px solid var(--line-strong); border-radius: 22px; background: var(--paper-strong); box-shadow: var(--shadow); }
.state-card--loading { width: min(420px, calc(100% - 20px)); }
.state-card h1, .review-card h1 { margin: 0; font-size: clamp(22px, 2.8vw, 32px); letter-spacing: -.035em; }
.state-card p, .review-card p { max-width: 38ch; margin: 0; color: var(--ink-soft); line-height: 1.45; }
.brand-mark, .state-icon, .rotate-glyph, .result-badge { width: 54px; height: 54px; display: grid; place-items: center; color: white; border-radius: 16px; background: var(--blue); font-size: 22px; font-weight: 900; }
.state-icon--coral { background: var(--coral); font-size: 15px; }
.rotate-glyph { color: var(--blue-dark); background: #dce9f8; font-size: 30px; }
.result-badge { color: white; background: var(--green); }
.clock-glyph { width: 43px; height: 43px; position: relative; display: block; border: 4px solid currentColor; border-radius: 50%; color: white; }
.clock-glyph::before, .clock-glyph::after { content: ""; position: absolute; left: 50%; bottom: 50%; width: 3px; border-radius: 99px; background: currentColor; transform-origin: 50% 100%; }
.clock-glyph::before { height: 13px; transform: translateX(-50%) rotate(0deg); }
.clock-glyph::after { height: 16px; transform: translateX(-50%) rotate(120deg); }
.clock-hand { display: none; }
.game:not([data-state="time-up"]) .clock-glyph { display: none; }
.game[data-state="time-up"] .result-badge-symbol { display: none; }
/* Result glyphs use the same badge container, but each glyph has a deliberate
   optical scale: a clock is prominent, while SOS remains a compact label. */
.game[data-state="time-up"] .result-badge { font-size: 38px; line-height: 1; padding-bottom: 2px; }
.game[data-state="rescued"] .result-badge { font-size: 14px; letter-spacing: .08em; }
.state-screen[data-state-screen="error-retryable"] .state-icon--coral,
.state-screen[data-state-screen="error-fatal"] .state-icon--coral { font-size: 36px; line-height: 1; }
.loading-track { width: min(300px, 100%); height: 8px; overflow: hidden; border-radius: 99px; background: #e0e6e8; }
.loading-track span { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.state-card small { color: var(--ink-soft); font-size: 11px; }
.state-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.state-actions button, .state-card > button, .review-card > button { min-height: 48px; padding: 0 18px; color: white; border: 1px solid var(--blue-dark); border-radius: 13px; background: var(--blue); font-weight: 850; cursor: pointer; box-shadow: 0 2px 0 rgba(16,51,91,.22); }
.state-actions .button-secondary { color: var(--ink); border-color: var(--line-strong); background: #f1eee6; box-shadow: 0 2px 0 rgba(25,42,58,.12); }
.result-summary { width: 100%; margin: 10px 0 4px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.result-summary div { min-height: 56px; padding: 9px 6px; display: grid; align-content: center; gap: 4px; border-left: 1px solid var(--line); }
.result-summary div:nth-child(4n + 1) { border-left: 0; }
.result-summary div:nth-child(n + 5) { border-top: 1px solid var(--line); }
.result-summary span { color: var(--ink-soft); font-size: 9px; font-weight: 850; letter-spacing: .08em; }
.result-summary strong { font-size: 15px; }
.review-card { width: min(820px, calc(100% - 20px)); padding: 24px; display: grid; gap: 14px; border: 1px solid var(--line-strong); border-radius: 22px; background: var(--paper-strong); box-shadow: var(--shadow); }
.review-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.review-heading .icon-button { flex: 0 0 48px; }
.review-panes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.review-pane { position: relative; aspect-ratio: 3 / 2; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 14px; }
.review-pane > span:not(.review-marker) { position: absolute; z-index: 1; top: 9px; left: 9px; width: 34px; height: 30px; display: grid; place-items: center; color: white; border-radius: 9px; background: rgba(18,37,53,.84); font-weight: 900; }
.review-pane .scene-placeholder { position: absolute; inset: 0; }
.review-marker { z-index: 2; width: 34px; height: 34px; }
.review-marker-one { left: 31%; top: 42%; }
.review-marker-two { left: 66%; top: 63%; }
.review-marker-three { left: 20%; top: 25%; }
.review-marker-four { left: 79%; top: 30%; }
.review-marker-five { left: 48%; top: 72%; }
.review-marker-six { left: 12%; top: 72%; }
.review-marker-seven { left: 78%; top: 78%; }
.review-zoom-control { justify-self: end; }
.review-card > button { justify-self: start; }

/* T-03 semantic geometry: tablet check and label are independent centred columns. */
.device--tablet .target-list button { grid-template-columns: 24px minmax(0, 1fr) 24px; grid-template-rows: 1fr; align-items: center; }
.device--tablet .target-list button .target-index { grid-column: 3; grid-row: 1; align-self: center; text-align: right; }
.device--tablet .target-list button > span:nth-child(2) { grid-column: 2; grid-row: 1; align-self: center; line-height: 1.2; }
.device--tablet .target-list button i { grid-column: 1; grid-row: 1; align-self: center; }
.device--tablet .target-list .is-found button { background: #e5f0eb; }

@keyframes hint { 0% { opacity: 0; transform: scale(.6); } 30%,65% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35); } }

/* Tablet: retain large type and recompose groups instead of shrinking them. */
.device--tablet .game { grid-template-rows: 72px minmax(0,1fr) 62px; }
.device--tablet .gamebar { padding-inline: 12px; grid-template-columns: minmax(220px,1fr) auto minmax(250px,1fr); gap: 8px; }
.device--tablet .gamebar__title strong { font-size: 16px; }
.device--tablet .metric { min-width: 66px; padding-inline: 8px; }
.device--tablet .metric strong { font-size: 18px; }
.device--tablet .tool { padding-right: 8px; }
.device--tablet .tool__copy small { display: none; }
.device--tablet .difference-board { padding: 18px 12px; }
.device--tablet .hidden-board { padding: 10px 16px 12px; grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) 136px; gap: 10px; }
.device--tablet .hidden-scene { width: auto; height: 100%; max-width: 100%; justify-self: center; }
.device--tablet .mission-rail { padding: 10px 12px; grid-template-columns: 154px minmax(0, 1fr) 148px; grid-template-rows: 1fr 5px; gap: 7px 12px; }
.device--tablet .mission-heading { grid-column: 1; grid-row: 1; }
.device--tablet .mission-heading h2 { font-size: 16px; }
.device--tablet .mission-count { width: 42px; height: 42px; border-radius: 11px; }
.device--tablet .progress-track { grid-column: 1; grid-row: 2; }
.device--tablet .target-list { grid-column: 2; grid-row: 1 / 3; display: grid; grid-auto-flow: column; grid-auto-columns: 156px; grid-template-rows: repeat(2, 44px); align-content: center; gap: 4px; overflow-x: auto; overflow-y: hidden; }
.device--tablet .target-list li { min-width: 0; }
.device--tablet .target-list button { height: 44px; padding: 6px 4px; grid-template-columns: 22px minmax(0, 1fr) 16px; gap: 4px; }
.device--tablet .target-list button > span:nth-child(2) { min-width: 0; padding-left: 4px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device--tablet .mission-tools { grid-column: 3; grid-row: 1 / 3; grid-template-columns: 1fr; }
.device--tablet .rail-button--quiet { display: none; }
.device--tablet .game[data-mode="hidden"] { grid-template-rows: 64px minmax(0,1fr); }
/* Tablet Hidden Object feedback belongs to the scene's lower safe area. It
   must never sit on top of the mission tray or its controls. */
.device--tablet .game[data-mode="hidden"] .toast { bottom: 150px; }

/* Phone landscape: 44px controls, readable 13px labels, no desktop chrome squeezed in. */
.device--phone .game { grid-template-rows: 58px minmax(0,1fr) 50px; }
.device--phone .gamebar { padding: max(5px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 5px max(8px, env(safe-area-inset-left)); grid-template-columns: auto 1fr auto; gap: 7px; }
.device--phone .icon-button { width: 44px; height: 44px; flex-basis: 44px; border-radius: 12px; }
.device--phone .gamebar__title { display: none; }
.device--phone .scoreboard { justify-self: start; gap: 0; }
.device--phone .metric { min-width: 66px; height: 44px; padding: 3px 9px; }
.device--phone .metric span { font-size: 8px; }
.device--phone .metric strong { font-size: 17px; }
.device--phone .metric strong i { font-size: 10px; }
.device--phone .gamebar__actions { gap: 5px; }
.device--phone .tool { width: 44px; min-height: 44px; padding: 4px; border-radius: 12px; }
.device--phone .tool__icon { width: 34px; height: 34px; }
.device--phone .tool__copy { display: none; }
.device--phone .tool--rescue { display: none; }
.device--phone .difference-board { padding: 3px 8px 2px; grid-template-columns: minmax(0,1fr) 8px minmax(0,1fr); }
.device--phone .scene-pane { border-radius: 10px; }
.device--phone .pane-label { top: 6px; left: 6px; width: 34px; height: 28px; border-radius: 8px; font-size: 14px; }
.device--phone .difference-marker { width: 28px; height: 28px; border-width: 2px; }
.device--phone .comparison-seam span { display: none; }
.device--phone .difference-dock { min-height: 52px; padding: 2px max(8px, env(safe-area-inset-right)) max(2px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
.device--phone .instruction__mark { width: 36px; height: 36px; flex-basis: 36px; border-radius: 10px; }
.device--phone .instruction b { font-size: 13px; }
.device--phone .instruction small { display: none; }
.device--phone .instruction > span.progress-dots { display: none; }
.device--phone .zoom-control { height: 48px; }
.device--phone .zoom-control button { height: 44px; min-width: 44px; }
.device--phone .zoom-control .zoom-value { min-width: 54px; }
.device--phone .scene-copy b { font-size: 13px; }
.device--phone .scene-copy small { font-size: 8px; }
.device--phone .toast { bottom: 58px; }

.device--phone .game[data-mode="hidden"] { grid-template-rows: minmax(0,1fr); }
.device--phone .game[data-mode="hidden"] .gamebar { display: none; }
.device--phone .hidden-board { grid-row: 1; padding: max(4px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); grid-template-columns: minmax(0,1fr) clamp(168px, 19vw, 180px); gap: 6px; }
.device--phone .hidden-scene { width: 100%; height: auto; max-height: 100%; border-radius: 10px; }
.device--phone .scene-overlay { top: 6px; left: 6px; right: 6px; }
.device--phone .game[data-mode="hidden"] .scene-overlay { display: none; }
.device--phone .mission-rail { padding: 6px; grid-template-rows: 64px auto 3px minmax(0,1fr) 44px; gap: 4px; border-radius: 10px; }
.device--phone .mobile-rail-status { display: grid; grid-template-columns: 44px minmax(0,1fr) 44px; grid-template-rows: 44px 18px; gap: 2px 4px; }
.device--phone .mobile-status-button { width: 44px; height: 44px; padding: 0; color: var(--ink); border: 1px solid var(--line-strong); border-radius: 9px; background: #f1f3f3; box-shadow: 0 1px 0 rgba(25,42,58,.1); font-size: 16px; font-weight: 900; cursor: pointer; }
.device--phone .mobile-time { min-width: 0; display: grid; place-content: center; text-align: center; border-radius: 8px; background: #e8edf0; }
.device--phone .mobile-time span { color: var(--ink-soft); font-size: 7px; font-weight: 850; letter-spacing: .1em; }
.device--phone .mobile-time strong { margin-top: -2px; font-size: 15px; font-variant-numeric: tabular-nums; }
.device--phone .mobile-mini-metrics { grid-column: 1 / 4; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.device--phone .mobile-mini-metrics span { padding: 1px 4px; display: flex; align-items: center; justify-content: space-between; color: var(--ink-soft); border-radius: 4px; background: #eef0ed; font-size: 7px; font-weight: 850; letter-spacing: .03em; }
.device--phone .mobile-mini-metrics b { color: var(--ink); font-size: 10px; letter-spacing: 0; }
.device--phone .mission-heading .eyebrow { display: none; }
.device--phone .mission-heading h2 { margin: 0; font-size: 12px; line-height: 1.05; }
.device--phone .mission-count { width: 32px; height: 32px; border-radius: 8px; }
.device--phone .mission-count b { font-size: 13px; line-height: 12px; }
.device--phone .mission-count small { font-size: 7px; }
.device--phone .target-list { grid-auto-rows: 44px; gap: 2px; }
.device--phone .target-list button { min-height: 44px; padding: 3px 4px; grid-template-columns: 18px 1fr 17px; gap: 2px; border-radius: 6px; }
.device--phone .target-index { font-size: 8px; }
.device--phone .target-list button > span:nth-child(2) { position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; padding: 0 23px; text-align: center; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; pointer-events: none; }
.device--phone .target-list i { width: 17px; height: 17px; border-radius: 5px; font-size: 9px; }
.device--phone .mission-tools { grid-template-columns: 1fr; }
.device--phone .rail-button { min-height: 44px; position: relative; display: block; padding: 5px 6px; }
.device--phone .rail-button > span { width: 30px; height: 30px; }
.device--phone .rail-button b { position: absolute; inset: 0; align-self: stretch; justify-self: stretch; height: auto; display: grid; place-items: center; padding: 0 4px; text-align: center; font-size: 12px; }
.device--phone .rail-button small, .device--phone .rail-button--quiet { display: none; }
.device--phone .safe-zone { padding-bottom: 5px; font-size: 6px; letter-spacing: .08em; }
.device--phone .state-screen { padding: 10px; }
.device--phone .state-card { width: min(390px, calc(100% - 8px)); padding: 15px 13px; gap: 5px; border-radius: 16px; }
.device--phone .state-card h1 { font-size: 20px; }
.device--phone .state-card p { font-size: 11px; }
.device--phone .state-actions { margin-top: 4px; }
.device--phone .state-actions button, .device--phone .state-card > button { min-height: 44px; padding-inline: 12px; font-size: 12px; }
.device--phone .state-card--results { padding: 8px 10px; gap: 3px; }
.device--phone .state-card--results .result-badge { width: 54px; height: 54px; border-radius: 16px; font-size: 16px; }
.device--phone .game[data-state="time-up"] .state-card--results .result-badge { font-size: 26px; }
.device--phone .game[data-state="rescued"] .state-card--results .result-badge { font-size: 11px; }
.device--phone .state-card--results h1 { font-size: 18px; }
.device--phone .state-card--results p { font-size: 10px; }
.device--phone .review-card { width: calc(100% - 8px); padding: 12px; gap: 7px; border-radius: 16px; }
.device--phone .review-heading { gap: 8px; }
.device--phone .review-heading h1 { font-size: 18px; }
.device--phone .review-heading .icon-button { width: 44px; height: 44px; flex-basis: 44px; }
.device--phone .review-panes { grid-template-columns: repeat(2, minmax(0, 240px)); justify-content: center; }
.device--phone .review-card p { font-size: 10px; }
.device--phone .review-card > button { min-height: 44px; font-size: 12px; }
.device--phone .result-summary { grid-template-columns: repeat(4, 1fr); }
.device--phone .result-summary div { min-height: 34px; padding: 3px 3px; }
.device--phone .result-summary span { font-size: 7px; }
.device--phone .result-summary strong { font-size: 11px; }

.device--portrait { width: min(390px, 100%); aspect-ratio: 390 / 844; border-radius: 24px; }
.device--portrait .game { min-height: 100%; }
.device--portrait .state-screen--rotate { padding: 18px; }
.device--portrait .state-card { padding: 24px 18px; }
.device--portrait .state-card h1 { font-size: 24px; }

body.is-embedded .lab-bar { display: none; }
body.is-embedded .lab-stage { min-height: 100vh; height: 100vh; padding: 0; overflow: hidden; }
body.is-embedded .device { width: 100vw; height: 100vh; max-height: none; aspect-ratio: auto; border: 0; border-radius: 0; box-shadow: none; }

@media (max-width: 880px) {
  .lab-bar { flex-wrap: wrap; }
  .lab-bar > div:first-child { width: 100%; }
  .lab-sizes { order: 3; }
  .lab-stage { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
