/* tour.css — Ocurus Gaze Tour. Dark, high-contrast, large dwell targets.
   Colour tokens and type follow web-viewer/styles.css (not imported wholesale). */

:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  --ink: #f7fafc;
  --muted: #a9b6c0;
  --subtle: #7f909d;
  --page: #071018;
  --panel: rgba(10, 18, 25, 0.94);
  --panel-solid: #0d1821;
  --control: #182733;
  --control-hover: #213441;
  --line: rgba(226, 232, 240, 0.18);
  --line-strong: rgba(226, 232, 240, 0.34);
  --accent: #55c6b6;
  --accent-ink: #07211d;
  --warm: #f3bd4f;
  --warm-ink: #201704;
  --danger: #ef7b6f;
  --info: #7cb8ff;
  --target: 56px;
  --radius: 8px;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.48);
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--page);
  color: var(--ink);
}

[hidden] { display: none !important; }

button, input { font: inherit; letter-spacing: 0; }

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  color: var(--ink);
  background: var(--control);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 15px;
}

button:hover:not(:disabled) { background: var(--control-hover); border-color: var(--line-strong); }
button:disabled { cursor: default; opacity: 0.42; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--warm); outline-offset: 2px; }

button.primary {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}
button.primary:hover:not(:disabled) { background: #78d7ca; border-color: #78d7ca; }

button.link-button {
  min-height: 36px;
  padding: 0 6px;
  color: var(--accent);
  background: transparent;
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 3px;
}
button.link-button:hover:not(:disabled) { background: transparent; color: #8fe0d4; }

.square-action { width: 44px; min-width: 44px; padding: 0; }

input[type="text"] {
  min-height: 44px;
  padding: 0 12px;
  color: var(--ink);
  background: #0a141c;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 { margin: 0; color: #fff; font-size: 28px; line-height: 1.2; }
h3 { margin: 18px 0 8px; color: #fff; font-size: 16px; }
p { margin: 0 0 12px; line-height: 1.55; color: #bdc9d0; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link:focus { position: fixed; z-index: 100; top: 8px; left: 8px; width: auto; height: auto; padding: 8px 12px; margin: 0; clip: auto; background: var(--warm); color: var(--warm-ink); }

.noscript { padding: 24px; }

/* Every dwell target lights up while gazed. */
[data-gazed="true"] {
  outline: 3px solid var(--warm) !important;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(243, 189, 79, 0.22);
}

.tour-app, .screen { position: fixed; inset: 0; }
.screen { overflow: auto; }
.screen[inert] { filter: saturate(0.6) brightness(0.55); }

/* ------------------------------------------------------------------ gaze cursor */
.gaze-cursor {
  position: fixed;
  z-index: 60;
  top: -28px;
  left: -28px;
  width: 56px;
  height: 56px;
  pointer-events: none;
  will-change: transform;
}
.gaze-cursor svg { width: 56px; height: 56px; transform: rotate(-90deg); filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.8)); }
.gaze-cursor .track { fill: rgba(85, 198, 182, 0.14); stroke: rgba(247, 250, 252, 0.9); stroke-width: 3; }
.gaze-cursor .ring { fill: none; stroke: var(--warm); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 138.23; stroke-dashoffset: 138.23; }
.gaze-cursor .core { fill: var(--accent); }
.gaze-cursor[data-confidence="mid"] .track { stroke: rgba(247, 250, 252, 0.4); }
.gaze-cursor[data-confidence="low"] .track { stroke: rgba(247, 250, 252, 0.22); stroke-dasharray: 4 4; }
.gaze-cursor.is-dwelling .core { fill: var(--warm); }

/* ------------------------------------------------------------------ guide */
.screen-guide {
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--page);
}
.screen-guide.is-overlay { z-index: 50; background: rgba(2, 7, 11, 0.8); backdrop-filter: blur(5px); }

.guide-dialog {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(1240px, 100%);
  height: min(860px, 100%);
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.guide-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 8px 10px 8px 22px;
  border-bottom: 1px solid var(--line);
}
.guide-topline-text { display: flex; align-items: baseline; gap: 12px; }
.guide-topline-text .eyebrow { margin: 0; }
.guide-topline strong { color: #fff; font-size: 17px; }
.guide-page-label { color: var(--muted); font-size: 13px; }

.guide-body {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr);
  gap: 22px;
  min-height: 0;
  padding: 22px;
}
.guide-figures {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}
.guide-figures:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius); }
.guide-figure { margin: 0; }
.guide-shot-frame {
  position: relative;
  aspect-ratio: 1440 / 900;
  background: #05090d;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.guide-figcaption { margin-top: 6px; color: var(--muted); font-size: 13px; }
.guide-shot { display: block; width: 100%; height: 100%; object-fit: contain; }
.guide-shot.is-missing { visibility: hidden; }
.guide-shot-missing {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--subtle);
  background: repeating-linear-gradient(45deg, #0a141c 0 12px, #0d1821 12px 24px);
}
.guide-badges { position: absolute; inset: 0; }
.guide-badge {
  position: absolute;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%);
  color: var(--warm-ink);
  background: var(--warm);
  border: 2px solid #fff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
.guide-badge-inline { position: static; transform: none; width: 26px; height: 26px; flex: 0 0 auto; margin-right: 10px; font-size: 13px; }

.guide-text { min-height: 0; overflow: auto; padding-right: 6px; }
/* The text column is focusable so the keyboard can scroll it (tour-guide.js show()). The generic
   [tabindex]:focus-visible ring drew an amber box around the whole page of text, which read as a warning
   frame; a 3 px accent bar on the inner edge marks the focus without boxing the reading area. */
.guide-text:focus-visible { outline: none; box-shadow: inset 3px 0 0 var(--accent); }
.guide-lead { font-size: 15px; }
.guide-extra ul { margin: 0 0 12px; padding-left: 20px; color: #bdc9d0; line-height: 1.55; }
.guide-tip { padding: 10px 12px; color: var(--warm); background: rgba(243, 189, 79, 0.1); border: 1px solid rgba(243, 189, 79, 0.28); border-radius: var(--radius); }
.guide-legend-title { margin-top: 20px; }
.guide-legend-caption { margin: 16px 0 2px; color: var(--accent); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.guide-legend { margin: 0; padding: 0; list-style: none; }
.guide-legend li { display: flex; align-items: flex-start; padding: 8px 0; border-top: 1px solid var(--line); color: #dce6ee; font-size: 14px; line-height: 1.5; }
.guide-scroll-hint { margin-top: 14px; color: var(--warm); font-size: 13px; }
.guide-keys { width: 100%; border-collapse: collapse; font-size: 13px; }
.guide-keys th, .guide-keys td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.guide-keys thead th { color: var(--accent); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.guide-keys tbody th { color: #fff; font-weight: 600; }

.guide-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 80px;
  padding: 14px 22px;
  background: #0a141c;
  border-top: 1px solid var(--line);
}
.guide-dots { display: flex; gap: 8px; }
.guide-dot {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  background: #12202b;
}
.guide-dot::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #344550; }
.guide-dot.is-viewed::after { background: var(--accent); }
.guide-dot.is-active::after { width: 14px; height: 14px; background: #fff; }
.guide-actions { display: flex; align-items: center; gap: 10px; }
.guide-actions button { min-height: var(--target); min-width: 120px; }
.guide-finish-hint { color: var(--warm); font-size: 13px; }

/* ------------------------------------------------------------------ calibration */
.screen-calibrate { display: grid; place-items: center; padding: 16px; }
.cal-card {
  width: min(640px, 100%);
  padding: 30px 34px;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.cal-lead { margin-top: 12px; font-size: 15px; }
.cal-source-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; }
.cal-source-label { color: var(--muted); font-size: 13px; }
.cal-source-row .primary { min-height: var(--target); min-width: 220px; }
.cal-error { margin-top: 14px; padding: 12px 14px; display: grid; gap: 4px; color: #ffd9d3; background: rgba(239, 123, 111, 0.12); border: 1px solid rgba(239, 123, 111, 0.4); border-radius: var(--radius); }
.cal-error small { color: var(--muted); }
.cal-checks { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.cal-checks li { padding: 8px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: rgba(239, 123, 111, 0.14); color: #ffd9d3; border: 1px solid rgba(239, 123, 111, 0.4); }
.cal-checks li[data-ok="true"] { background: rgba(85, 198, 182, 0.14); color: #b9efe6; border-color: rgba(85, 198, 182, 0.45); }
.cal-hint { min-height: 24px; color: var(--warm); }
#calBegin { min-height: var(--target); min-width: 220px; }
.cal-guide-button { position: fixed; top: 16px; right: 16px; z-index: 2; }
.cal-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; margin-top: 6px; }
.cal-error .cal-no-camera { justify-self: start; margin-top: 8px; min-height: var(--target); }

/* Control choice (roadmap Phase 1): two equal options, no default, each a dwell target and a keyboard button. */
.cal-choice-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 20px; }
.cal-choice-option {
  display: grid;
  gap: 6px;
  min-height: 96px;
  padding: 16px 18px;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.cal-choice-option strong { font-size: 16px; }
.cal-choice-option small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.cal-choice-option:hover:not(:disabled), .cal-choice-option[data-gazed="true"] { border-color: var(--accent); background: rgba(85, 198, 182, 0.1); }
.cal-result-note { margin: 10px 0 0; padding: 10px 12px; color: var(--warm); background: rgba(243, 189, 79, 0.1); border: 1px solid rgba(243, 189, 79, 0.28); border-radius: var(--radius); font-size: 14px; }

/* Control-mode radio (intro card): three dwell-activatable labels. */
.cal-modes { display: grid; gap: 8px; margin: 18px 0 0; padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.cal-modes legend { padding: 0 6px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.cal-mode-option {
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: start;
  gap: 12px;
  min-height: var(--target);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0a141c;
  cursor: pointer;
}
.cal-mode-option:hover { border-color: var(--line-strong); }
.cal-mode-option.is-selected { border-color: var(--accent); background: rgba(85, 198, 182, 0.1); }
.cal-mode-option input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
.cal-mode-text { display: grid; gap: 2px; }
.cal-mode-text strong { color: #fff; font-size: 15px; }
.cal-mode-text small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.cal-modes:disabled .cal-mode-option { opacity: 0.6; cursor: default; }

/* Diagnostics panel: fixed; during the dot stages tour-calibrate.js places it (with the control card and
   the tracking view) into an anchor slot ≥ 140 px from the dot (cal-layout.js) by inline left/top, so
   the three panels share one 200 ms move transition. */
.cal-bar, .cal-diag, .cal-head-view { transition: left 200ms ease, top 200ms ease; }
.cal-diag {
  position: fixed;
  z-index: 3;
  top: 15%;
  right: 15%;
  width: 300px;
  max-height: 34vh;
  overflow: auto;
  padding: 10px 12px 12px;
  color: #dce6ee;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.cal-diag-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.cal-diag-head strong { color: #fff; font-size: 13px; }
.cal-diag-head .square-action { width: 36px; min-width: 36px; min-height: 36px; }
.cal-diag-list { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0; }
.cal-diag-list dt { color: var(--muted); }
.cal-diag-list dd { margin: 0; color: #fff; text-align: right; }
.cal-diag h4 { margin: 10px 0 4px; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.cal-diag-residuals { margin: 0; padding-left: 16px; line-height: 1.5; }
.screen-calibrate:not([data-stage="capture"]):not([data-stage="headRange"]) .cal-diag { top: 76px; right: 16px; max-height: calc(100vh - 92px); }

.cal-capture { position: fixed; inset: 0; background: #05090d; }
.cal-target {
  position: absolute;
  width: 80px;
  height: 80px;
  min-height: 0;
  padding: 0;
  transform: translate(-50%, -50%);
  background: transparent;
  border: none;
  border-radius: 50%;
}
.cal-target svg { position: absolute; inset: 0; width: 80px; height: 80px; transform: rotate(-90deg); }
.cal-ring-track { fill: none; stroke: rgba(247, 250, 252, 0.18); stroke-width: 5; }
.cal-ring { fill: none; stroke: var(--accent); stroke-width: 5; stroke-linecap: round; }
.cal-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.18);
  animation: cal-pulse 1.2s ease-in-out infinite;
}
.cal-target.is-capturing .cal-dot { background: var(--accent); }
/* Position anchor (spec B): the capture is paused while the user has moved — the ring turns warm and dashed, the pulse stops. */
.cal-target.is-paused .cal-ring { stroke: var(--warm); stroke-dasharray: 6 6 !important; stroke-dashoffset: 0 !important; opacity: 0.85; }
.cal-target.is-paused .cal-ring-track { stroke: rgba(243, 189, 79, 0.25); }
.cal-target.is-paused .cal-dot { animation-play-state: paused; background: var(--warm); }
@keyframes cal-pulse { 0%, 100% { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.18); } 50% { box-shadow: 0 0 0 14px rgba(255, 255, 255, 0.06); } }
.cal-target { z-index: 2; }
/* The control card: its CSS position is only the fallback before the first placement — on the dot
   stages tour-calibrate.js sets left/top to the dot-safe slot (home: the left edge midpoint). */
.cal-bar {
  position: fixed;
  z-index: 1;
  left: 16px;
  top: 16px;
  display: grid;
  gap: 12px;
  width: min(30vw, 380px);
  min-width: 250px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.cal-bar-text { display: grid; gap: 2px; }
.cal-phase { color: var(--accent); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.cal-progress { color: #fff; font-weight: 700; }
.cal-capture-hint { margin: 0; color: var(--warm); font-size: 13px; }
.cal-bar-actions { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.cal-bar-actions button { grid-column: span 2; min-height: var(--target); padding: 6px; font-size: 13px; white-space: normal; }
.cal-bar-actions #calHeadOnly, .cal-bar-actions #calCaptureNoCamera { grid-column: span 3; }
.cal-bar-actions:has(#calHeadOnly[hidden]) #calCaptureNoCamera { grid-column: 1 / -1; }
/* The camera-free exit of the control card: a text link, full width, kept at the dwell-target height. */
.cal-bar-actions .cal-no-camera.link-button { font-size: 13px; }
#calHeadOnly { border-color: var(--accent); color: #b9efe6; }

/* Live tracking view on the calibration screen: 240 x 180 at left 2 % / bottom 12 % with its toggle above
   (the face check and the result); during the dot stages it is placed dot-safe like the other panels. */
.cal-head-view {
  position: fixed;
  z-index: 3;
  left: 2%;
  bottom: calc(12% + 10px);
  display: grid;
  gap: 6px;
  width: 240px;
}
.cal-head-view #calHeadView { width: 100%; min-height: 48px; padding: 0 10px; font-size: 13px; }
/* The frames only place the view; the card itself (size, border, canvas) is styled by the head-view section. */
.cal-head-view-frame { position: relative; }

.cal-score { display: grid; gap: 6px; margin: 18px 0; padding: 14px 16px; background: #0a141c; border: 1px solid var(--line); border-radius: var(--radius); }
.cal-score-row { display: flex; justify-content: space-between; gap: 12px; color: #dce6ee; }
.cal-grade { font-size: 22px; color: var(--accent); }
.cal-grade[data-grade="Fair"] { color: var(--warm); }
.cal-grade[data-grade="Poor"] { color: var(--danger); }
.cal-advice[data-tone="warn"] { color: var(--warm); }
.cal-remember { display: flex; align-items: center; gap: 10px; margin: 6px 0 18px; color: #dce6ee; cursor: pointer; }
.cal-remember input { width: 20px; height: 20px; accent-color: var(--accent); }
.cal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.cal-actions button { min-height: var(--target); }
.cal-actions-secondary { justify-content: flex-start; margin-bottom: 12px; }
.cal-card-result { width: min(720px, 100%); }
.cal-card-result h3 { margin-top: 4px; }
.cal-result-modes { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.cal-result-mode {
  display: grid;
  gap: 4px;
  min-height: 96px;
  padding: 10px 12px;
  text-align: left;
  align-content: start;
  background: #0a141c;
}
.cal-result-mode.is-selected { border-color: var(--accent); background: rgba(85, 198, 182, 0.12); }
.cal-result-mode-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; color: #fff; font-size: 14px; }
.cal-result-mode-tag { color: var(--accent); font-size: 11px; font-style: normal; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.cal-result-mode-grade { font-size: 18px; font-weight: 700; color: var(--accent); }
.cal-result-mode-grade[data-grade="Fair"] { color: var(--warm); }
.cal-result-mode-grade[data-grade="Poor"] { color: var(--danger); }
.cal-result-mode-grade[data-grade="na"], .cal-grade[data-grade="na"] { color: var(--muted); }
.cal-result-mode-stats { color: var(--muted); font-size: 12px; line-height: 1.4; }
.cal-mode-selected { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

/* ------------------------------------------------------------------ tour selection */
.screen-select { padding: 28px clamp(16px, 4vw, 48px); }
.select-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 20px; }
.select-lead { margin: 8px 0 0; }
.select-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } /* wraps on a phone: four controls do not fit 343 px (seen 16 October, Feedback cut off) */
.select-actions button { min-height: var(--target); min-width: 120px; }
.select-gaze-status { margin-right: 8px; color: var(--muted); font-size: 13px; }
.select-status { color: var(--warm); min-height: 20px; }

/* The themed catalog (roadmap Phase 1): tabs, search, the planned preview, the grid of scene entries and its
   states. Restrained on purpose — the same panel, line and accent tokens as the rest of the page, 2:1
   thumbnails only where the catalog records a cleared image, a neutral icon everywhere else. */
.catalog-last-viewed { margin: -8px 0 14px; color: var(--accent); font-size: 14px; }
.catalog-filters { display: grid; gap: 12px; margin-bottom: 14px; }
.catalog-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.catalog-tab { min-height: 44px; padding: 0 14px; font-size: 14px; border-radius: 999px; }
.catalog-tab.is-selected, .catalog-tab[aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 700; }
.catalog-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.catalog-search { display: flex; flex: 1 1 280px; gap: 8px; max-width: 420px; }
.catalog-search input { flex: 1; min-height: 44px; padding: 0 12px; color: var(--ink); background: #0a141c; border: 1px solid var(--line-strong); border-radius: var(--radius); }
.catalog-search .square-action { min-height: 44px; }
#catalogPlanned { min-height: 44px; font-size: 14px; }
#catalogPlanned[aria-pressed="true"] { border-color: var(--warm); color: var(--warm); }
.catalog-notice { display: grid; gap: 6px; margin: 0 0 14px; padding: 10px 14px; color: var(--warm); background: rgba(243, 189, 79, 0.1); border: 1px solid rgba(243, 189, 79, 0.28); border-radius: var(--radius); font-size: 13px; }
.catalog-notice p { margin: 0; color: inherit; }
.catalog-error { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 0 0 16px; padding: 14px 16px; color: #ffd9d3; background: rgba(239, 123, 111, 0.12); border: 1px solid rgba(239, 123, 111, 0.4); border-radius: var(--radius); }
.catalog-error-text { flex: 1 1 280px; margin: 0; color: inherit; }
.catalog-error .primary { min-height: var(--target); min-width: 120px; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.catalog-item { display: grid; grid-template-rows: auto 1fr; background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.catalog-item.is-last-viewed { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.catalog-item[data-playable="false"] { border-style: dashed; }
.catalog-thumb { display: grid; place-items: center; aspect-ratio: 2 / 1; background: #05090d; }
.catalog-thumb-image { display: block; width: 100%; height: 100%; object-fit: cover; }
.catalog-thumb-icon { display: grid; place-items: center; gap: 6px; color: var(--subtle); }
.catalog-thumb-icon[data-icon="planned"] { color: var(--warm); opacity: 0.7; }
.catalog-thumb-caption { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.catalog-body { display: grid; gap: 4px; padding: 14px 16px 16px; }
.catalog-title { margin: 0; font-size: 17px; }
.catalog-kind, .catalog-availability, .catalog-credit { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.catalog-availability[data-status="not-cleared"], .catalog-availability[data-status="permission-unknown"] { color: var(--warm); }
.catalog-availability[data-status="planned"], .catalog-availability[data-status="unavailable"], .catalog-availability[data-status="unsupported"], .catalog-availability[data-status="unresolved"] { color: var(--subtle); }
.catalog-credit { color: #c6d1d8; }
.catalog-source, .catalog-licence { color: var(--accent); text-underline-offset: 3px; }
.catalog-open { min-height: var(--target); width: 100%; margin-top: 8px; }
.catalog-unplayable { display: grid; place-items: center; min-height: var(--target); margin-top: 8px; color: var(--subtle); border: 1px dashed var(--line); border-radius: var(--radius); font-size: 14px; }
.catalog-empty { padding: 28px 20px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.catalog-empty-text { margin: 0 0 6px; color: var(--ink); font-size: 16px; }
.catalog-empty-hint { margin: 0; color: var(--muted); font-size: 13px; }

/* Whole tours: one compact row per index.json tour (the former card list without its images). */
.select-tours { margin-top: 28px; max-width: 720px; }
.select-tours h3 { margin-top: 0; }
.select-tours-help { font-size: 13px; }
.tour-cards { display: grid; gap: 10px; }
.tour-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 14px; background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.tour-card.is-preselected { border-color: var(--accent); }
.tour-card-body { display: grid; gap: 2px; min-width: 0; }
.tour-card-name { font-size: 15px; color: #fff; }
.tour-card-meta { color: var(--muted); font-size: 13px; }
.tour-open { min-height: var(--target); min-width: 110px; }
.select-byid { margin-top: 28px; padding: 18px 20px; max-width: 720px; background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius); }
.select-byid h3 { margin-top: 0; }
.select-byid-help { font-size: 13px; }
.select-byid-row { display: flex; gap: 10px; }
.select-byid-row input { flex: 1; }
.select-byid-row button { min-height: var(--target); min-width: 110px; }
.select-byid-message { margin: 10px 0 0; min-height: 20px; color: var(--warm); font-size: 13px; }

/* ------------------------------------------------------------------ tour viewer */
.screen-tour { overflow: hidden; background: #05090d; }
.tour-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; outline: none; }
.tour-canvas:active { cursor: grabbing; }

.hotspot-layer { position: absolute; inset: 0; pointer-events: none; }
.hotspot {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--target);
  height: var(--target);
  min-height: 0;
  padding: 0;
  margin: -28px 0 0 -28px;
  background: transparent;
  border: none;
  pointer-events: auto;
  will-change: transform;
}
.hotspot[data-kind="lens"] { width: 64px; height: 64px; margin: -32px 0 0 -32px; }
.hotspot-icon {
  display: grid;
  place-items: center;
  width: var(--target);
  height: var(--target);
  color: #fff;
  background: rgba(7, 16, 24, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  transition: transform 120ms ease, background 120ms ease;
}
.hotspot-icon img { width: 40px; height: 40px; object-fit: contain; }
.hotspot[data-kind="lens"] .hotspot-icon { width: 64px; height: 64px; padding: 0; overflow: hidden; }
.hotspot[data-kind="lens"] .hotspot-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.hotspot[data-kind="navigate"] .hotspot-icon, .hotspot[data-kind="lens"] .hotspot-icon { border-color: var(--accent); }
.hotspot[data-kind="arrow"] .hotspot-icon { color: #fff; background: rgba(85, 198, 182, 0.55); border-color: #fff; transform: perspective(200px) rotateX(42deg); }
.hotspot[data-kind="info"] .hotspot-icon { border-color: var(--info); }
.hotspot:hover .hotspot-icon, .hotspot[data-gazed="true"] .hotspot-icon { transform: scale(1.1); background: rgba(7, 16, 24, 0.9); }
.hotspot[data-kind="arrow"]:hover .hotspot-icon, .hotspot[data-kind="arrow"][data-gazed="true"] .hotspot-icon { transform: perspective(200px) rotateX(48deg) scale(1.1); }
.hotspot[data-gazed="true"] { outline: none !important; box-shadow: none; }
.hotspot[data-gazed="true"] .hotspot-icon { outline: 3px solid var(--warm); outline-offset: 3px; }
.hotspot-label {
  position: absolute;
  top: 100%;
  left: 50%;
  max-width: 220px;
  margin-top: 6px;
  padding: 4px 10px;
  transform: translateX(-50%);
  color: #fff;
  background: rgba(7, 16, 24, 0.82);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pan-zones { position: absolute; inset: 0; pointer-events: none; }
.pan-zone {
  position: absolute;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  color: #fff;
  background: rgba(7, 16, 24, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  opacity: 0.35;
  transition: opacity 150ms ease, background 150ms ease;
}
.pan-zone[data-side="left"] { left: 18px; top: 50%; transform: translateY(-50%) rotate(-90deg); }
.pan-zone[data-side="right"] { right: 18px; top: 50%; transform: translateY(-50%) rotate(90deg); }
.pan-zone[data-side="up"] { top: 78px; left: 50%; transform: translateX(-50%); }
.pan-zone[data-side="down"] { bottom: 18px; left: 50%; transform: translateX(-50%) rotate(180deg); }
.pan-zone[data-state="pending"] { opacity: 0.75; }
.pan-zone[data-state="active"] { opacity: 1; color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.tour-topbar {
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 8px 14px;
  background: linear-gradient(rgba(7, 16, 24, 0.9), rgba(7, 16, 24, 0.55) 80%, transparent);
}
.hud-title { display: flex; flex-direction: column; min-width: 0; }
.hud-title strong { color: #fff; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-title span { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.hud-button {
  width: var(--target);
  height: var(--target);
  min-height: var(--target);
  padding: 0;
  color: #fff;
  background: rgba(10, 18, 25, 0.9);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}
.hud-button.has-text { width: auto; padding: 0 16px 0 12px; }
.hud-button[aria-pressed="false"] { color: var(--warm); border-color: var(--warm); }
.hud-button[aria-expanded="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.hud {
  position: absolute;
  z-index: 5;
  right: 14px;
  bottom: 14px;
  display: flex;
  gap: 8px;
  padding: 8px;
  background: rgba(7, 16, 24, 0.55);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(10px);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  color: #fff;
  background: rgba(10, 18, 25, 0.9);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.status-chip-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--subtle); }
.status-chip[data-tone="on"] .status-chip-dot { background: var(--accent); box-shadow: 0 0 0 4px rgba(85, 198, 182, 0.18); }
.status-chip[data-tone="mouse"] .status-chip-dot { background: var(--info); box-shadow: 0 0 0 4px rgba(124, 184, 255, 0.18); }
.status-chip[data-tone="warn"] { border-color: var(--warm); color: var(--warm); }
.status-chip[data-tone="warn"] .status-chip-dot { background: var(--warm); }
.status-chip[data-tone="error"] { border-color: var(--danger); color: #ffd9d3; }
.status-chip[data-tone="error"] .status-chip-dot { background: var(--danger); }
/* The chip and its retry affordance side by side: the button ("Restart camera" after a stall) is the chip's sibling, outside the live region. */
.status-group { display: inline-flex; align-items: center; gap: 8px; }
/* The retry pill, in the warn tone of the chip it follows; pointer / keyboard only — a dead camera has no gaze to dwell with. */
.status-chip-action { min-height: 40px; padding: 0 14px; color: var(--warm); background: rgba(10, 18, 25, 0.9); border: 1px solid var(--warm); border-radius: 999px; font-size: 13px; font-weight: 700; white-space: nowrap; }
.status-chip-action:hover { background: rgba(255, 255, 255, 0.12); }

.overlay-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); }
.overlay-head h3 { margin: 0; font-size: 16px; }

.scene-drawer {
  position: absolute;
  z-index: 6;
  top: 72px;
  left: 14px;
  bottom: 90px;
  width: min(340px, calc(100% - 28px));
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.scene-list { margin: 0; padding: 10px; list-style: none; overflow: auto; }
.scene-list li + li { margin-top: 8px; }
.scene-item {
  display: grid;
  grid-template-columns: 96px 1fr;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 6px;
  text-align: left;
}
.scene-item img, .scene-thumb-empty { width: 96px; height: 52px; object-fit: cover; border-radius: 6px; background: #05090d; }
.scene-item[aria-current="true"] { border-color: var(--accent); background: rgba(85, 198, 182, 0.12); }
.scene-item-name { font-size: 14px; font-weight: 600; color: #fff; }

.minimap {
  position: absolute;
  z-index: 6;
  top: 72px;
  right: 14px;
  width: min(560px, calc(100% - 28px));
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.minimap-frame { position: relative; margin: 12px; background: #05090d; border-radius: 6px; overflow: hidden; }
.minimap-image { display: block; width: 100%; height: auto; }
.minimap-dots { position: absolute; inset: 0; }
.minimap-dot {
  position: absolute;
  width: 34px;
  height: 34px;
  min-height: 0;
  padding: 0;
  transform: translate(-50%, -50%);
  background: var(--accent);
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
}
.minimap-dot[aria-current="true"] { background: var(--warm); }
.minimap-dot-label {
  position: absolute;
  top: 100%;
  left: 50%;
  margin-top: 4px;
  padding: 2px 8px;
  transform: translateX(-50%);
  color: #fff;
  background: rgba(7, 16, 24, 0.85);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}
.minimap-dot:hover .minimap-dot-label, .minimap-dot[data-gazed="true"] .minimap-dot-label, .minimap-dot:focus-visible .minimap-dot-label { opacity: 1; }
.minimap-missing { margin: 12px; color: var(--muted); }

/* Gaze menu: a small popover anchored above the HUD's ⋯ button. */
.gaze-menu {
  position: absolute;
  z-index: 6;
  right: 14px;
  bottom: 90px;
  width: min(380px, calc(100% - 28px));
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.gaze-menu { max-height: calc(100% - 110px); overflow: auto; }
.gaze-menu { bottom: var(--overlay-bottom, 90px); max-height: calc(100% - var(--overlay-bottom, 90px) - var(--overlay-top, 72px)); background: var(--panel-solid); }
.gaze-menu > .overlay-head { position: sticky; top: 0; z-index: 1; background: var(--panel-solid); }
.scene-drawer, .minimap { bottom: var(--overlay-bottom, 90px); }
.gaze-menu-group { display: grid; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--line); }
.gaze-menu-group:nth-of-type(2) { border-top: none; }
.gaze-menu-label { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 0; text-transform: uppercase; }
.gaze-menu-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gaze-menu-option { min-height: var(--target); padding: 0 8px; font-size: 13px; }
.gaze-menu-option.is-selected { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 700; }
.gaze-menu-note { margin: -4px 14px 8px; color: var(--muted); font-size: 12px; }

.info-modal { position: absolute; z-index: 8; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(2, 7, 11, 0.7); backdrop-filter: blur(4px); }
.info-modal-card {
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(720px, 100%);
  max-height: 100%;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.info-modal-body { padding: 18px 22px 24px; overflow: auto; color: #dce6ee; line-height: 1.55; }
.info-modal-body img { max-width: 100%; height: auto; border-radius: 6px; }
.info-modal-body h1, .info-modal-body h2, .info-modal-body h3 { color: #fff; }
.info-modal-body table { width: 100%; border-collapse: collapse; }
.info-modal-body td, .info-modal-body th { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.info-modal-body a { color: var(--accent); }

.scene-loading {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 96px;
  padding: 8px 14px;
  transform: translateX(-50%);
  color: #fff;
  background: rgba(10, 18, 25, 0.85);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
}
/* Live tracking view picture-in-picture: bottom left, under the scene drawer (z 6) and the HUD (z 5);
   the card's size (Small 200 × 150 / Large 360 × 270) comes from the head-view section. */
.head-pip { position: absolute; z-index: 4; left: 14px; bottom: 14px; }

/* Gesture toast: a short confirmation (Nod / Shake / Tilt) below the top bar. */
.gesture-toast {
  position: absolute;
  z-index: 9;
  top: 84px;
  left: 50%;
  padding: 8px 16px;
  transform: translateX(-50%);
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}
.gesture-toast[data-gesture="shake"] { color: var(--warm-ink); background: var(--warm); }

.scene-fade { position: absolute; inset: 0; background: #05090d; opacity: 0; pointer-events: none; transition: opacity 320ms ease; }
.scene-fade.is-on { opacity: 1; }
.viewer-toast {
  position: absolute;
  z-index: 9;
  top: 80px;
  left: 50%;
  padding: 10px 16px;
  transform: translateX(-50%);
  color: #ffd9d3;
  background: rgba(239, 123, 111, 0.16);
  border: 1px solid rgba(239, 123, 111, 0.5);
  border-radius: var(--radius);
}

@media (max-width: 900px) {
  .guide-body { grid-template-columns: 1fr; overflow: auto; }
  .guide-text { overflow: visible; }
  .guide-dialog { height: 100%; }
  .guide-figures { max-height: 44vh; }
  .hud { flex-wrap: wrap; justify-content: flex-end; max-width: calc(100% - 28px); }
  .cal-result-modes, .gaze-menu-options { grid-template-columns: 1fr; }
  .cal-diag { right: 16px; width: min(300px, calc(100% - 32px)); }
  .hud-title strong { font-size: 14px; }
  .scene-drawer { bottom: 150px; }
  .cal-head-view { bottom: 14%; }
}

@media (prefers-reduced-motion: reduce) {
  .cal-dot { animation: none; }
  .scene-fade, .hotspot-icon, .pan-zone, .cal-bar, .cal-diag, .cal-head-view { transition: none; }
}

/* head-view */
/* Live head-tracking view (tour/src/head-view.js): a bordered card holding one canvas that fills it.
   Sizes: data-size="small" 200 × 150, "large" 360 × 270 (the calibration screen passes its own 240 × 180
   through createHeadView({ sizes })). Placement helpers: .head-view-cal (calibration: left 2 % / bottom 12 %,
   clear of the 8 % / 50 % / 92 % dots) and .head-view-pip (tour picture-in-picture above the HUD). */
.head-view {
  position: relative;
  width: 200px;
  height: 150px;
  overflow: hidden;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  pointer-events: none;
  user-select: none;
  contain: strict;
}
.head-view[data-size="large"] { width: 360px; height: 270px; }
.head-view canvas { display: block; width: 100%; height: 100%; }
.head-view-cal { position: fixed; left: 2%; bottom: 12%; z-index: 4; }
.head-view-pip { position: absolute; left: 14px; bottom: 96px; z-index: 6; }
@media (max-width: 900px) {
  .head-view-pip { bottom: 160px; }
  .head-view[data-size="large"] { width: 280px; height: 210px; }
}

/* guide read-checker */
/* Calibration-UX spec §C (tour/src/tour-guide.js): the reading-progress bar + pill above the text column,
   the "Mark page as read" row under it, numbered page pills with a ✓, the "Pages read: n of 5" line and the
   "Not yet read: page 2 — open page 2" notice of the locked last page. Overrides the older .guide-dot look. */
.guide-text-column { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 10px; min-height: 0; }
.guide-read { display: flex; align-items: center; gap: 12px; min-height: 32px; }
.guide-read-bar { flex: 1 1 auto; height: 6px; background: #1c2b37; border-radius: 999px; overflow: hidden; }
.guide-read-fill { width: 0; height: 100%; background: var(--warm); border-radius: 999px; transition: width 120ms linear; }
.guide-read[data-state="read"] .guide-read-bar { visibility: hidden; }
.guide-read-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 12px 0 8px;
  color: var(--warm);
  background: rgba(243, 189, 79, 0.1);
  border: 1px solid rgba(243, 189, 79, 0.35);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.guide-read-ring {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: conic-gradient(var(--warm) calc(var(--p, 0) * 360deg), rgba(243, 189, 79, 0.18) 0);
  -webkit-mask: radial-gradient(circle, transparent 5px, #000 5.5px);
  mask: radial-gradient(circle, transparent 5px, #000 5.5px);
}
.guide-read[data-state="read"] .guide-read-pill { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.guide-read[data-state="read"] .guide-read-ring { display: none; }
.guide-mark-row { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.guide-mark-read { min-height: 40px; padding: 0 14px; font-size: 14px; }
.guide-mark-hint { color: var(--subtle); font-size: 13px; }
.guide-pages { display: grid; gap: 6px; }
.guide-read-status { color: var(--muted); font-size: 13px; font-weight: 600; }
.guide-dot { position: relative; color: var(--muted); font-size: 16px; font-weight: 700; }
.guide-dot::after { content: none; }
.guide-dot.is-viewed { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.guide-dot.is-viewed:hover:not(:disabled) { background: #78d7ca; border-color: #78d7ca; }
.guide-dot.is-active, .guide-dot.is-active:hover:not(:disabled) { color: #071018; background: #fff; border-color: #fff; }
.guide-dot.is-active.is-viewed { box-shadow: 0 0 0 3px var(--accent); }
.guide-dot-check { position: absolute; top: -6px; right: -6px; display: none; place-items: center; width: 18px; height: 18px; color: var(--accent-ink); background: var(--accent); border: 2px solid var(--panel-solid); border-radius: 50%; font-size: 11px; line-height: 1; }
.guide-dot.is-viewed .guide-dot-check { display: grid; }
.guide-unread { color: var(--warm); font-size: 13px; text-align: right; line-height: 1.5; }
.guide-actions .guide-unread .link-button { min-width: 0; min-height: 28px; padding: 0 2px; font-size: 13px; font-weight: 700; }
.guide-actions #guideFinish:not(.is-ready) { color: var(--muted); background: var(--control); border-color: var(--line); font-weight: 600; }
@media (max-width: 900px) {
  .guide-text-column { grid-template-rows: auto auto auto; }
  .guide-footer { flex-wrap: wrap; }
  .guide-unread { text-align: left; }
}
/* guide step success (feedback spec F3, tour/src/tour-guide.js): the "Page 2 of 5 read ✓" toast at the top of
   the guide, the pop of the ✓ Page read pill and of the page pill's ✓, the last-page checklist
   ("1 Welcome ✓ · 3 Choosing a tour ○", unread steps are links) beside the unread notice, and the
   "Guide complete ✓" banner. prefers-reduced-motion: no pop, no slide — the states change instantly. */
.guide-dialog { position: relative; }
.guide-toast {
  position: absolute;
  z-index: 9;
  top: 66px;
  left: 50%;
  padding: 8px 18px;
  transform: translateX(-50%);
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
  animation: guide-toast-in 200ms ease-out;
}
@keyframes guide-toast-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes guide-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.guide-read-pill.is-pop { animation: guide-pop 300ms ease-out; }
.guide-dot.is-pop .guide-dot-check { animation: guide-pop 300ms ease-out; }
.guide-last-status { display: grid; flex: 1 1 auto; justify-items: end; gap: 4px; min-width: 0; }
.guide-actions > button { flex: 0 0 auto; white-space: nowrap; }
.guide-checklist { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 4px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.guide-checklist-step { display: inline-flex; align-items: center; }
.guide-checklist-step:not(:last-child)::after { content: "·"; margin: 0 4px 0 6px; color: var(--muted); }
.guide-checklist-item { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 600; }
.guide-checklist-n { color: var(--subtle); }
.guide-checklist-step[data-read="1"] .guide-checklist-item, .guide-checklist-step[data-read="1"] .guide-checklist-n { color: var(--accent); }
.guide-checklist-step[data-read="1"] .guide-checklist-mark { color: var(--accent); font-weight: 800; }
.guide-checklist-step[data-read="0"] .guide-checklist-mark { color: var(--warm); }
.guide-actions .guide-checklist-link { min-width: 0; min-height: 28px; padding: 0 2px; color: var(--warm); font-size: 13px; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.guide-actions .guide-checklist-link:hover { color: #fff; }
.guide-complete {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 14px;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  animation: guide-pop 300ms ease-out;
}
@media (max-width: 900px) {
  .guide-last-status { justify-items: start; }
  .guide-checklist { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .guide-toast, .guide-read-pill.is-pop, .guide-dot.is-pop .guide-dot-check, .guide-complete { animation: none; }
}
.guide-dialog.is-reduced-motion .guide-toast, .guide-dialog.is-reduced-motion .guide-complete { animation: none; }
/* end guide step success */
/* end guide read-checker */

/* feedback */
/* Visible success feedback (FEEDBACK_SPEC §F1–F2, tour/src/tour-calibrate.js): the face-frame stage, the
   per-dot burst + ✓ badge, the graded hint, the dot map panel and the result's weak-dot offer. */
/* Face frame: the intro card widens to hold the large centred view (min(60vw, 560px), 4:3). */
.screen-calibrate[data-stage="frame"] .cal-card { width: min(720px, 100%); padding: 20px 24px; }
.screen-calibrate[data-stage="frame"] .cal-lead, .screen-calibrate[data-stage="frame"] .cal-modes { display: none; }
.cal-face-frame { display: grid; gap: 10px; margin: 6px 0 14px; }
.cal-frame-lead { margin: 0; color: var(--muted); font-size: 14px; }
.cal-face-frame-stage { position: relative; display: grid; place-items: center; }
.cal-face-frame-view { position: relative; display: grid; place-items: center; }
/* An older head-view without the 'check' size: the CSS sizes the card (the inline 240 × 180 is overridden). */
.cal-face-frame-view .head-view { width: min(60vw, 560px, 45svh) !important; height: auto !important; aspect-ratio: 4 / 3; max-width: 100%; }
.cal-frame-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; }
.cal-frame-actions #calUsePosition { min-height: 44px; }
@media (max-height: 800px) {
  .cal-face-frame-view .head-view { width: min(60vw, 560px, 38svh) !important; }
}
@media (max-width: 600px) {
  .screen-calibrate[data-stage="frame"] .eyebrow { display: none; }
  .screen-calibrate[data-stage="frame"] .cal-card h2 { font-size: 24px; margin-bottom: 8px; }
  .screen-calibrate[data-stage="frame"] .cal-source-row { margin-top: 6px; }
  .screen-calibrate[data-stage="frame"] .cal-check-block h3 { margin: 10px 0; }
  .screen-calibrate[data-stage="frame"] .cal-hint { margin: 8px 0; }
  .cal-frame-actions { flex-wrap: nowrap; gap: 8px; }
  .cal-frame-actions #calBegin, .cal-frame-actions #calUsePosition { flex: 1; min-width: 0; padding: 8px; font-size: 13px; }
}

.comfort-setting { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 14px; font-size: 13px; }
.comfort-setting output { font-variant-numeric: tabular-nums; }
.comfort-range { grid-column: 1 / -1; display: grid; grid-template-columns: 40px minmax(0, 1fr) 40px; align-items: center; gap: 10px; }
.comfort-range .hud-button { width: 40px; height: 40px; min-width: 40px; }
.comfort-range input { width: 100%; min-width: 0; accent-color: var(--accent, #168267); }
.scene-retry { position: absolute; top: 110px; left: 50%; transform: translateX(-50%); z-index: 16; padding: 12px 18px; border: 1px solid #fff8; border-radius: 6px; color: white; background: #213a2c; cursor: pointer; }
.scene-retry:focus-visible { outline: 3px solid white; outline-offset: 3px; }
.cal-face-frame-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cal-face-frame-target { fill: none; stroke: rgba(247, 250, 252, 0.7); stroke-width: 2.5; stroke-dasharray: 7 6; }
.cal-face-frame-ring-track { fill: none; stroke: rgba(247, 250, 252, 0.16); stroke-width: 4; }
.cal-face-frame-ring { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 200px 144px; }
.cal-face-frame-check { fill: var(--accent); font-size: 64px; font-weight: 800; opacity: 0; }
.cal-face-frame[data-state="centred"] .cal-face-frame-target { stroke: var(--accent); stroke-dasharray: none; stroke-width: 3.5; }
.cal-face-frame[data-state="centred"] .cal-face-frame-check { opacity: 1; animation: cal-pop-inline 300ms ease-out; }
.cal-face-frame[data-state="outside"] .cal-face-frame-target { stroke: var(--warm); }
.cal-frame-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-height: 32px; }
.cal-frame-hint { margin: 0; color: var(--warm); font-size: 16px; font-weight: 700; }
.cal-face-frame[data-state="holding"] .cal-frame-hint { color: var(--info); }
.cal-face-frame[data-state="centred"] .cal-frame-hint { color: var(--accent); }
.cal-face-frame[data-state="centred"] .cal-frame-hint { animation: cal-pop-inline 300ms ease-out; }
.cal-checks li[hidden] { display: none; }

/* Per-dot success: the dot bursts (scale + green ring) and a ✓ badge with its number sits on it. */
.cal-target.is-captured .cal-dot { background: var(--accent); animation: cal-burst 600ms ease-out; box-shadow: 0 0 0 10px rgba(85, 198, 182, 0.28); }
.cal-target.is-captured .cal-ring { stroke: var(--accent); }
.cal-dot-badge {
  position: absolute;
  z-index: 3;
  transform: translate(-50%, -50%);
  min-width: 48px;
  padding: 6px 12px;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  animation: cal-badge-pop 300ms ease-out;
}
.cal-dot-badge[data-grade="Good"] { background: var(--info); color: #061424; }
.cal-dot-badge[data-grade="Fair"] { background: var(--warm); color: var(--warm-ink); }
.cal-dot-badge[data-grade="Poor"] { background: var(--danger); color: #2a0a06; }
/* The graded hint: "✓ Point 3 captured — Excellent" coloured by grade. */
.cal-capture-hint[data-grade="Excellent"] { color: var(--accent); font-weight: 700; }
.cal-capture-hint[data-grade="Good"] { color: var(--info); font-weight: 700; }
.cal-capture-hint[data-grade="Fair"] { color: var(--warm); font-weight: 700; }
.cal-capture-hint[data-grade="Poor"] { color: var(--danger); font-weight: 700; }
@keyframes cal-burst { 0% { transform: translate(-50%, -50%) scale(1); } 40% { transform: translate(-50%, -50%) scale(1.7); } 100% { transform: translate(-50%, -50%) scale(1); } }
@keyframes cal-badge-pop { 0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0; } 100% { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
@keyframes cal-pop-inline { 0% { transform: scale(0.7); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* Dot map: a small fixed panel (home top-left; placed dot-safe with the other panels on the dot stages). */
.cal-dot-map {
  position: fixed;
  z-index: 3;
  left: 16px;
  top: 16px;
  display: grid;
  gap: 6px;
  width: 196px;
  padding: 10px 12px 10px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  transition: left 200ms ease, top 200ms ease;
}
.cal-dot-map-title { color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.cal-dot-map-svg { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; background: #05090d; border: 1px solid var(--line); border-radius: 6px; }
.cal-dot-map-item circle, .cal-dot-map-item polygon { fill: transparent; stroke: rgba(247, 250, 252, 0.55); stroke-width: 1.2; }
.cal-dot-map-item[data-state="current"] circle, .cal-dot-map-item[data-state="current"] polygon { stroke: #fff; stroke-width: 1.8; animation: cal-map-pulse 1.2s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.cal-dot-map-item[data-state="skipped"] circle, .cal-dot-map-item[data-state="skipped"] polygon { fill: rgba(127, 144, 157, 0.5); stroke: var(--subtle); }
.cal-dot-map-item[data-state="captured"] circle, .cal-dot-map-item[data-state="captured"] polygon,
.cal-dot-map-item[data-state="checked"] circle, .cal-dot-map-item[data-state="checked"] polygon { fill: rgba(247, 250, 252, 0.8); stroke: rgba(247, 250, 252, 0.9); }
.cal-dot-map-item[data-grade="Excellent"] circle, .cal-dot-map-item[data-grade="Excellent"] polygon { fill: var(--accent); stroke: var(--accent); }
.cal-dot-map-item[data-grade="Good"] circle, .cal-dot-map-item[data-grade="Good"] polygon { fill: var(--info); stroke: var(--info); }
.cal-dot-map-item[data-grade="Fair"] circle, .cal-dot-map-item[data-grade="Fair"] polygon { fill: var(--warm); stroke: var(--warm); }
.cal-dot-map-item[data-grade="Poor"] circle, .cal-dot-map-item[data-grade="Poor"] polygon { fill: var(--danger); stroke: var(--danger); }
.cal-dot-map-item[data-state="checked"] circle { stroke: #fff; stroke-width: 1.6; }
@keyframes cal-map-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.35); } }
.cal-dot-map-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; margin: 0; padding: 0; list-style: none; font-size: 11px; color: var(--muted); }
.cal-dot-map-legend li { display: flex; align-items: center; gap: 6px; }
.cal-dot-map-legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.cal-dot-map-legend li[data-grade="Good"] i { background: var(--info); }
.cal-dot-map-legend li[data-grade="Fair"] i { background: var(--warm); }
.cal-dot-map-legend li[data-grade="Poor"] i { background: var(--danger); }
/* Result: the counts line under the score and the weak-dot offer. */
.cal-dot-counts { margin: -8px 0 14px; color: #dce6ee; font-size: 14px; font-weight: 600; }
#calRecaptureWeak { border-color: var(--warm); color: #ffe6b0; }
@media (prefers-reduced-motion: reduce) {
  .cal-target.is-captured .cal-dot, .cal-dot-badge, .cal-face-frame[data-state="centred"] .cal-frame-hint, .cal-face-frame-check, .cal-dot-map-item[data-state="current"] circle, .cal-dot-map-item[data-state="current"] polygon { animation: none; }
  .cal-dot-map { transition: none; }
}
/* end feedback */

/* ------------------------------------------------------------------ feedback form (study) */
.screen-study { padding: 28px clamp(16px, 4vw, 48px) 80px; }
.study-form { max-width: 920px; margin: 0 auto; display: grid; gap: 18px; }
.study-header h2 { margin: 6px 0 8px; }
.study-lead { margin: 0; color: var(--muted); max-width: 70ch; }
.study-link { color: var(--accent); }
.study-fieldset { margin: 0; padding: 16px 18px 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-solid); }
.study-fieldset legend { padding: 0 6px; font-weight: 700; color: #fff; }
.study-fieldset-lead { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.study-item { display: grid; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.study-item:first-of-type { border-top: 0; }
.study-item-text { margin: 0; line-height: 1.45; }
.study-item-text.is-optional::before { content: "Optional \00b7 "; color: var(--subtle); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.study-options { display: flex; flex-wrap: wrap; gap: 8px; }
.study-option { min-height: var(--target); min-width: 56px; padding: 8px 14px; text-align: left; line-height: 1.3; }
.study-option[aria-checked="true"] { border-color: var(--accent); background: rgba(85, 198, 182, 0.16); color: #fff; }
.study-sus-row { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: 10px 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.study-sus-row:first-of-type { border-top: 0; }
.study-sus-scale { display: flex; gap: 6px; }
.study-sus-scale .study-option { min-width: 56px; justify-content: center; text-align: center; }
.study-sus-anchors { display: flex; justify-content: space-between; color: var(--subtle); font-size: 12px; margin: 0 0 8px; }
.study-contact { display: grid; gap: 10px; padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.study-contact label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
.study-contact input, .study-textarea, .study-withdraw input { width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--control); color: var(--ink); font: inherit; }
.study-textarea { min-height: 120px; resize: vertical; }
.study-counter { margin: 4px 0 0; text-align: right; color: var(--subtle); font-size: 12px; }
.study-warning { margin: 6px 0 0; color: var(--warm); font-size: 14px; }
.study-footer { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.study-footer .primary { min-width: 200px; }
.study-reason { margin: 0; flex: 1 1 320px; color: var(--warm); font-size: 14px; }
.study-result { padding: 18px; border: 1px solid var(--accent); border-radius: var(--radius); background: rgba(85, 198, 182, 0.08); display: grid; gap: 10px; }
.study-result.is-failure { border-color: var(--danger); background: rgba(239, 123, 111, 0.08); }
.study-result h3 { margin: 0; }
.study-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 26px; letter-spacing: 0.08em; color: #fff; user-select: all; }
.study-withdraw { display: grid; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.study-withdraw-row { display: flex; gap: 10px; flex-wrap: wrap; }
.study-withdraw-row input { flex: 1 1 240px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; text-transform: uppercase; }
.study-withdraw-status { margin: 0; color: var(--muted); font-size: 14px; }
.study-form.is-submitted .study-fieldset { opacity: 0.55; pointer-events: none; }
@media (max-width: 640px) { .study-sus-row { grid-template-columns: 1fr; } }
