/* LeanFlow Sequence. Tokens come from /public/css/light.css. */

/* Chart colors for the Gantt charts (builder, result, Kaizen team) and their legends.
   Canvas code can read them with getComputedStyle(document.getElementById('app')). */
.seq {
  --g-manual: #5B7BD5;      /* operator works (hands-on) */
  --g-walk: #A9B9EA;        /* operator walks */
  --g-owait: #EEF0F5;       /* operator waits (fill) */
  --g-owait-line: #B9C0D3;  /* operator waits (outline) */
  --g-grind: #0C1744;       /* grinder grinds */
  --g-gwait: #FACC15;       /* grinder waits */
  --g-skip: #B91C1C;        /* a skipped card */
  --grid-major: rgba(37, 78, 160, 0.13);
  --grid-minor: rgba(37, 78, 160, 0.06);
}

.seq-page { background: var(--paper); }
.seq-page [hidden] { display: none !important; }
.seq-page .band.slim .page-header { padding: 10px 24px; max-width: none; }
.seq-page .page-header .logo-link img { height: 24px; }
.header-links { display: flex; align-items: center; gap: 24px; }

.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; }

.seq { padding: 10px 16px 16px; max-width: 1600px; margin: 0 auto; }

/* ----- HUD ----- */
.hud { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-bottom: 10px; }
.stepper { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; counter-reset: step; }
.stepper li {
  counter-increment: step;
  font-size: 13px; font-weight: 600; color: var(--faint); line-height: 1.2;
  padding: 5px 11px 5px 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
}
.stepper li::before {
  content: counter(step);
  display: inline-flex; align-items: center; justify-content: center;
  width: 19px; height: 19px; margin-right: 6px; border-radius: 50%;
  background: var(--paper); color: var(--faint); font-size: 11px;
}
.stepper li.done { color: var(--muted); }
.stepper li.done::before { background: var(--navy); color: #FFFFFF; }
.stepper li.on { color: var(--navy); border-color: var(--accent-border); background: var(--accent-soft); }
.stepper li.on::before { background: var(--accent); color: #FFFFFF; }
.hud-right { display: flex; align-items: center; gap: 12px; }
.note { font-size: 12.5px; color: var(--muted); }

/* ----- Buttons ----- */
.btn {
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1.2;
  color: var(--navy); background: var(--card); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 10px 16px; cursor: pointer;
}
.btn:hover { background: var(--card); color: var(--navy); border-color: var(--navy); }
.btn.ghost:hover { background: transparent; }
.btn.primary { background: var(--accent-btn); border-color: var(--accent-btn); color: #FFFFFF; }
.btn.primary:hover { background: var(--accent-btn-hover); border-color: var(--accent-btn-hover); }
.btn.small { font-size: 13px; padding: 6px 12px; border-radius: 999px; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.seq-page button:focus-visible, .seq-page a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ----- Layout: scene and bars on the left, panel on the right ----- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.stagecol { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.scene-card {
  position: relative; background: #FFFFFF; border-radius: 16px; overflow: hidden;
  aspect-ratio: 4 / 3;
  box-shadow: 0 1px 2px rgba(12, 23, 68, 0.06), 0 10px 32px rgba(12, 23, 68, 0.10);
}
.scene-card canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.chips { position: absolute; left: 10px; top: 10px; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 90px); pointer-events: none; }
.chip {
  font-size: 13px; font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, 0.94); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px;
  box-shadow: 0 1px 3px rgba(12, 23, 68, 0.08);
}
.chip.method { background: var(--navy); color: #FFFFFF; border-color: var(--navy); }
.chip.big { font-size: 15px; }
/* Skip (and, on the facilitator link, Pause) over the top right corner of the scene */
.scene-ctrls { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; }
.scene-ctrls .btn { background: rgba(255, 255, 255, 0.94); }
.scene-card:has(#pause:not([hidden])) .chips { max-width: calc(100% - 160px); }

.strip-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; flex: none; }
.strip-cv { height: 70px; position: relative; }
.strip-cv canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.strip-key { padding: 0 10px 5px; }
.strip-key .sb-legend { margin: 0; }

.bar {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
  min-height: 62px; flex: none;
}
.caption { margin: 0; font-size: 15px; line-height: 1.45; color: var(--navy); }
.caption.flash { animation: capflash 1s ease; }
@keyframes capflash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }

.ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.chart-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 8px; flex: none; }
.chart-head { margin: 0 0 2px; font-size: 12.5px; font-weight: 600; color: var(--muted); line-height: 1.3; }
.chart-wrap canvas { display: block; width: 100%; height: 128px; }
.chart-wrap.tall canvas { height: 250px; }
.chart-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; margin-top: 4px; }
.coach { margin: 0; font-size: 14.5px; color: var(--navy); font-weight: 500; line-height: 1.4; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.k-op { background: #5B7BD5; }
.k-gr { background: #0C1744; }
.k-gw { background: #FACC15; }
.k-both { background: #16A34A; }

/* ----- Panel ----- */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; min-width: 0; }
.pane h1, .pane h2 { font-family: var(--font-serif); font-weight: 400; color: var(--navy); margin: 0 0 10px; line-height: 1.15; }
.pane h1 { font-size: 30px; }
.pane h2 { font-size: 26px; }
.pane p { margin: 0 0 10px; font-size: 15px; line-height: 1.5; }
.eyebrow { font-size: 12px !important; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--accent-strong); margin-bottom: 4px !important; }
.lead { font-size: 16px !important; color: var(--navy); font-weight: 500; }
.fine { font-size: 13px !important; color: var(--muted); }
.gemba { font-size: 16px !important; font-weight: 600; color: var(--navy); background: var(--accent-soft); border-left: 3px solid var(--accent); padding: 8px 12px; border-radius: 0 8px 8px 0; }
.mcard { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-bottom: 10px; }
.mcard.on { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
.mcard p { margin: 0; }
.m-name { font-weight: 700; color: var(--navy); font-size: 15px !important; }
.m-sub { font-size: 13.5px !important; color: var(--muted); }
.m-res { margin-top: 6px !important; font-size: 14px !important; color: var(--muted); font-variant-numeric: tabular-nums; }
.m-res b { font-size: 24px; color: var(--navy); font-weight: 700; margin-right: 4px; }

.list-head { font-size: 12.5px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; }
.wseq { list-style: none; margin: 0 0 8px; padding: 0; counter-reset: row; }
.wseq li {
  counter-increment: row; position: relative;
  padding: 7px 10px 7px 38px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 6px;
  font-size: 14px; line-height: 1.35; color: var(--navy-ink);
}
.wseq li::before {
  content: counter(row); position: absolute; left: 9px; top: 8px;
  width: 20px; height: 20px; border-radius: 50%; background: var(--navy); color: #FFFFFF;
  font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.wseq .w-act { display: block; font-weight: 700; color: var(--navy); }
.wseq .w-when { display: block; font-size: 13px; color: var(--muted); }
.wseq .change { float: right; margin-left: 8px !important; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent-strong); background: none; border: 0; padding: 0; margin-left: 2px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.wseq .change:hover { color: var(--navy); }
.wseq.compact li { padding: 5px 10px 5px 36px; margin-bottom: 5px; font-size: 13.5px; }
.wseq.compact li::before { top: 6px; }
.wseq.compact .w-when { font-size: 12.5px; }
.wseq li.flash { animation: rowflash 1.1s ease; }
@keyframes rowflash { 0%, 60% { background: var(--accent-soft); border-color: var(--accent); } 100% { background: transparent; } }
.empty { font-size: 14px !important; color: var(--faint); }
.hint { font-size: 14.5px !important; font-weight: 600; color: var(--navy); background: #FEF9C3; border: 1px solid #FDE68A; border-radius: 10px; padding: 8px 12px; }

.big { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.big-n { font-family: var(--font-serif); font-size: 54px; line-height: 1; color: var(--navy); }
.big-l { font-size: 17px; font-weight: 600; color: var(--navy); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 10px; }
.facts div { background: var(--paper); border-radius: 10px; padding: 6px 10px; }
.facts dt { font-size: 12px; color: var(--muted); line-height: 1.25; }
.facts dd { margin: 2px 0 0; font-size: 15px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.bars { display: grid; gap: 5px; }
.brow { display: grid; grid-template-columns: 158px 1fr 30px; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.brow .b-track { height: 12px; background: var(--paper); border-radius: 6px; overflow: hidden; }
.brow .b-fill { display: block; height: 100%; background: var(--line-strong); border-radius: 6px; }
.brow.you { color: var(--navy); font-weight: 700; }
.brow.you .b-fill { background: var(--accent); }
.brow .b-n { font-weight: 700; color: var(--navy); text-align: right; font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pane .r-note { font-size: 13px; color: var(--muted); margin: 0 0 8px; line-height: 1.4; }
.pane .r-warn { font-size: 13.5px; font-weight: 600; color: #713F12; background: #FEF9C3; border: 1px solid #FDE68A; border-radius: 10px; padding: 6px 10px; margin: 0 0 8px; line-height: 1.4; }
.pane .r-rot { font-size: 14px; font-weight: 600; color: var(--green); }
.copied { font-size: 13px !important; color: var(--green); min-height: 1em; margin: 6px 0 0 !important; }

.wrapup { margin-top: 10px; }
.pane.done .r-intro { display: none; }
.pane.done .wseq.compact li { padding-top: 4px; padding-bottom: 4px; margin-bottom: 4px; }
.pane.done .wseq.compact li::before { top: 5px; }
.close-1 { font-family: var(--font-serif); font-size: 19px !important; line-height: 1.3 !important; color: var(--navy); margin-bottom: 6px !important; }
.close-2 { font-weight: 700; color: var(--navy); }
.close-sub { font-weight: 500; color: var(--navy-ink); }
.question { background: var(--navy); color: #FFFFFF; border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.question p { margin: 0; }
.q-label { font-size: 12px !important; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--accent) !important; }
.q-text { font-size: 16px !important; color: #FFFFFF; font-weight: 600; }

/* ----- Mission: graph-paper board, lines type in (JS), readable without JS ----- */
.mission-board {
  position: relative; margin: 0 0 12px; padding: 12px 16px 6px;
  border: 1px solid #CFDAEA; border-radius: 12px;
  background-color: #F5F8FC;
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 80px 80px, 80px 80px, 16px 16px, 16px 16px;
  background-position: -1px -1px;
}
.mb-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.pane .mb-head h1 { font-size: 28px; margin: 0; }
.mb-skip {
  flex: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted);
  background: none; border: 0; padding: 4px 2px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.mb-skip:hover { color: var(--navy); }
.mission-media { margin-bottom: 8px; }
.pane .m-line { position: relative; margin: 0 0 8px; padding-left: 18px; font-size: 15px; line-height: 1.5; color: var(--navy-ink); }
.m-line::before { content: ""; position: absolute; left: 1px; top: 0.72em; width: 9px; height: 2px; background: var(--accent); }
.pane .m-line.m-goal { font-size: 17px; font-weight: 700; color: var(--navy); }
/* Typing hooks for game.js: add .play to #missionBoard to start; the line being typed has .typing,
   finished lines have .typed. Lines not reached yet keep their space but are not shown.
   Remove .play (Skip intro, or the end of the intro) to show everything. */
.mission-board.play .m-line:not(.typing):not(.typed) { visibility: hidden; }
/* game.js types into a hidden span: the typed part, a caret (no width, so nothing re-wraps) and the
   rest of the line, there but invisible */
.m-line .m-caret { display: none; }
.m-line.typing .m-caret {
  display: inline-block; width: 2px; height: 1.05em; margin-right: -2px; vertical-align: -0.15em;
  background: var(--accent); animation: caret 0.9s steps(1) infinite;
}
.m-line .m-rest { visibility: hidden; }
@keyframes caret { 50% { opacity: 0; } }
.pane .mb-foot { margin: 2px 0 6px; text-align: right; font-size: 11px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--faint); }
.mission-after { transition: opacity 0.4s ease; }
.mission-board.play ~ .mission-after { visibility: hidden; opacity: 0; }

/* The one-part path: operator lane on the left, grinder lane on the right */
.path { margin: 0 0 8px; }
.pane .path-head { font-family: var(--font-sans); font-size: 12.5px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; line-height: 1.3; }
.path-lanes { display: flex; justify-content: space-between; padding: 0 8px 3px; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--faint); }
.path-steps {
  list-style: none; margin: 0; padding: 6px; display: flex; flex-direction: column; gap: 6px;
  border-radius: 10px; background: linear-gradient(90deg, var(--paper) 50%, #ECEEF4 50%);
}
.ps {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: 9px; font-size: 14px; line-height: 1.3;
}
.ps.op { align-self: flex-start; width: 70%; background: #FFFFFF; border: 1px solid var(--accent-border); border-left: 3px solid var(--accent); }
.ps.gr { align-self: flex-end; width: 58%; background: var(--navy); color: #FFFFFF; border: 1px solid var(--navy); }
.ps-n { width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }
.ps.op .ps-n { background: var(--accent-soft); color: var(--accent-strong); }
.ps.gr .ps-n { background: rgba(255, 255, 255, 0.16); color: #FFFFFF; }
.ps-name { font-weight: 600; color: var(--navy); }
.ps.gr .ps-name { color: #FFFFFF; }
.ps-who { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ps-time { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--accent-strong); }
.ps.gr .ps-time { color: #FDBA8C; }
.pane .path-note { margin: 8px 0 4px; font-size: 14.5px; font-weight: 600; color: var(--navy); }
.pane .path-total { margin: 0 0 6px; font-size: 13.5px; color: var(--muted); }
.path-total b { color: var(--navy); font-variant-numeric: tabular-nums; }

/* ----- Your turn: the builder (builder.js / builder.css) mounts in #builder ----- */
.pane .turn-intro { font-size: 14.5px; color: var(--navy-ink); }
.builder-mount { min-height: 120px; margin-bottom: 6px; }
/* Your turn: the box grid (grid.js, grid.css); read-only grids in Watch, Result and Kaizen team */
.grid-mount { margin: 8px 0 6px; }
/* Watch: each method's boxes beside its words */
.mcard:has(.m-grid) { display: grid; grid-template-columns: minmax(0, 1fr) 170px; column-gap: 14px; align-items: start; }
.mcard:has(.m-grid) > :not(.m-grid) { grid-column: 1; }
.mcard .m-grid { grid-column: 2; grid-row: 1 / span 3; }
@media (max-width: 380px) { .mcard:has(.m-grid) { grid-template-columns: minmax(0, 1fr); } .mcard .m-grid { grid-column: 1; grid-row: auto; margin-top: 8px; max-width: 220px; } }
.r-grid { margin: 0 0 10px; max-width: 340px; }
.pane .builder-msg { min-height: 1.5em; margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--muted); }
.pane .builder-msg.ok { color: var(--green); }
.pane .builder-msg.warn { color: var(--accent-strong); }

/* ----- Gantt charts (result and Kaizen team) -----
   One card holds them: under the scene on a laptop, in the pane on a phone (game.js placeGantt).
   Result: your chart. Kaizen team: your chart over the team's, on the same time scale
   (.solo: no result yet, only the team's). */
.gchart-host { display: contents; }
.gchart-card { display: flex; flex-direction: column; gap: 6px; background: #FFFFFF; border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; margin: 0 0 8px; }
.gantt { display: block; width: 100%; height: 170px; }
.seq[data-stage="result"] .gchart.g-mine, .seq[data-stage="result"] .gchart.g-team { display: none; }
.seq:not([data-stage="result"]) .gchart.g-result { display: none; }
.gchart-card.solo .gchart.g-mine { display: none; }
.gchart-card:not(.solo) .gchart.g-team { border-top: 1px solid var(--line); padding-top: 6px; }
/* while the Kaizen team's hour plays, only their chart shows (the lane strip runs above it) */
.gchart-card.replay .gchart.g-mine { display: none; }
.gchart-card.replay .gchart.g-team { border-top: 0; padding-top: 0; }
.gchart-card .sb-legend { margin-top: 0; }
/* Kaizen team: the parts chart (one row per part). It shows during the replay in place of the
   team's chart; afterwards the switch (.gview) picks the operator charts or the parts (.parts-view).
   The card's operator legend (.glegend, replaced by .sb-legendwrap in game.js) hides with its charts. */
.gchart.g-parts, .gview { display: none; }
.seq[data-stage="reveal"] .gchart-card.replay .gchart.g-parts { display: block; }
.seq[data-stage="reveal"] .gchart-card.replay .gchart.g-team,
.seq[data-stage="reveal"] .gchart-card.replay > .sb-legendwrap { display: none; }
.seq[data-stage="reveal"] .gchart-card:not(.replay) .gview { display: flex; }
.seq[data-stage="reveal"] .gchart-card.parts-view:not(.replay) .gchart.g-parts { display: block; }
.seq[data-stage="reveal"] .gchart-card.parts-view:not(.replay) .gchart.g-mine,
.seq[data-stage="reveal"] .gchart-card.parts-view:not(.replay) .gchart.g-team,
.seq[data-stage="reveal"] .gchart-card.parts-view:not(.replay) > .sb-legendwrap { display: none; }
.gview { gap: 4px; padding: 2px; align-self: flex-start; background: var(--bg, #F4F2EC); border: 1px solid var(--line); border-radius: 999px; }
.gview button { font: 600 12.5px/1 var(--font-sans, Inter, system-ui, sans-serif); color: var(--muted); background: none; border: 0; border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.gview button[aria-pressed="true"] { background: var(--navy); color: #FFFFFF; }
.gview button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pane .parts-head, .parts-head { font-size: 13px; line-height: 1.4; color: var(--navy-ink); margin: 0 0 4px; }
.parts-head strong { color: var(--navy); }
/* after the replay the parts chart drives the scene: tap or drag to move through time */
.parts-hint { display: none; color: var(--muted); }
.seq[data-stage="reveal"] .gchart-card.parts-view:not(.replay) .parts-hint { display: inline; }
.seq[data-stage="reveal"] .gchart-card.parts-view:not(.replay) #partsChart { cursor: ew-resize; touch-action: pan-y; }
.plegend { display: flex; flex-wrap: wrap; gap: 2px 14px; list-style: none; margin: 4px 0 0; padding: 0; font-size: 11.5px; color: var(--muted); }
.plegend i { display: inline-block; width: 14px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: 0; box-sizing: border-box; }
.p-grind { background: #4263C9; }
.p-gauge { background: #E3E8F7; border: 1.5px solid #4263C9; }
.p-mat { background: #FFFFFF; border: 1.5px dashed #4263C9; }
.p-hand { height: 3px !important; vertical-align: 3px !important; background: #4263C9; border-radius: 1px !important; }
.glegend { display: flex; flex-wrap: wrap; gap: 2px 12px; list-style: none; margin: 4px 0 0; padding: 0; font-size: 11.5px; color: var(--muted); }
.glegend i { display: inline-block; width: 12px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: 0; }
.g-manual { background: var(--g-manual); }
.g-walk { background: var(--g-walk); }
.g-owait { background: var(--g-owait); box-shadow: inset 0 0 0 1px var(--g-owait-line); }
.g-grind { background: var(--g-grind); }
.g-gwait { background: var(--g-gwait); }
.cardlist li { font-weight: 600; color: var(--navy); }
/* the card the operator is on, while the Kaizen team's hour plays */
.cardlist li.now { background: var(--accent-soft); border-color: var(--accent-border); }
.cardlist li { transition: background-color 0.15s ease, border-color 0.15s ease; }
/* the step the operator is on, while your hour runs */
.seq .sb .sb-slot.is-now { box-shadow: 0 0 0 2px var(--accent); }
.seq .sb .sb-slot.is-now .sb-card { background: var(--accent-soft); }
/* Your turn on a laptop: the builder's chart under the scene */
.turn-chart { flex: none; }
.turn-chart .sb .sb-chart { margin-top: 0; border-radius: 12px; padding: 8px 12px 10px; }
.sb-legendwrap { container-type: normal; }

/* ----- Trial offer at the end ----- */
.trial { background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }
.trial-h { font-family: var(--font-serif); font-weight: 400; font-size: 20px; line-height: 1.2; color: var(--navy); margin: 0 0 4px; }
.pane .trial-p { font-size: 14px; color: var(--navy-ink); margin: 0 0 10px; }
.trial-link { display: inline-block; text-decoration: none; }
.trial-link:hover { color: #FFFFFF; }

/* ----- Laptop and wider: everything fits one screen, no page scroll ----- */
@media (min-width: 900px) and (min-height: 600px) {
  html, body.seq-page { height: 100%; overflow: hidden; }
  body.seq-page { display: flex; flex-direction: column; }
  .seq-page .band { flex: none; }
  .seq { flex: 1; min-height: 0; width: 100%; display: flex; flex-direction: column; padding-bottom: 14px; }
  .hud { flex: none; }
  .layout { flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr) 380px; }
  .stagecol { min-height: 0; }
  .scene-card { aspect-ratio: auto; flex: 1 1 auto; min-height: 180px; }
  .panel { overflow-y: auto; min-height: 0; }
  /* the action buttons stay in view at the bottom of the panel, even when the panel scrolls */
  .pane-foot { position: sticky; bottom: -16px; z-index: 2; background: var(--card); margin: 0 -18px -16px; padding: 2px 18px 12px; box-shadow: 0 -10px 10px -8px rgba(12, 23, 68, 0.10); }
  .seq.running [data-pane="turn"] .pane-foot { display: none; }
  /* Mission and Your turn need a wider panel (the board, the card builder and its chart).
     While the hour runs, game.js adds .running to #app and the scene gets the room back. */
  .seq[data-stage="mission"] .layout { grid-template-columns: minmax(0, 1fr) minmax(380px, 40%); }
  .seq[data-stage="turn"]:not(.running) .layout { grid-template-columns: minmax(0, 1fr) minmax(420px, 46%); }
  /* Result and Kaizen team: a shorter scene (game.js frames the station tightly) and the chart card
     under it; the panel holds only words and numbers and fits without scrolling */
  .seq[data-stage="result"] .scene-card, .seq[data-stage="reveal"] .scene-card { min-height: 200px; }
  .gchart-card { flex: none; margin: 0; border-radius: 12px; padding: 8px 12px 8px; }
  /* the drawing gains nothing above about 225 px (the lanes stop at 52 px), so the scene keeps the rest */
  .gchart-card .gantt { height: clamp(190px, 27vh, 226px); }
  .seq[data-stage="reveal"] .gchart-card:not(.solo) .gantt,
  .seq[data-stage="reveal"] .gchart-card.replay .gantt { height: clamp(140px, 19vh, 210px); }
  /* the parts chart: four rows of parts (about 30 px each) */
  .seq[data-stage="reveal"] .gchart-card .g-parts .gantt { height: clamp(150px, 21vh, 196px); }
  .seq[data-stage="reveal"] .gchart-card.parts-view:not(.replay) .g-parts .gantt { height: clamp(170px, 26vh, 220px); }
  /* the end of the Kaizen team screen: a shorter close */
  .pane.done .close-1 { font-size: 17px !important; }
  .pane.done .q-text { font-size: 15px !important; line-height: 1.4 !important; }
  .pane.done .trial { padding: 9px 12px; }
  .pane.done .trial-h { font-size: 17.5px; }
  .pane.done .trial-p { margin-bottom: 7px; }
  .pane.done .trial-link { padding: 8px 14px; }
}
/* the end of the Kaizen team screen on a laptop up to 880 px tall: their cards in two columns (1-3, 4-6),
   so the closing, the question, the trial and the buttons fit without scrolling the panel */
@media (min-width: 900px) and (min-height: 600px) and (max-height: 880px) {
  .pane.done .wseq.compact { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(3, auto); grid-auto-flow: column; column-gap: 6px; }
  .pane.done .wseq.compact li { margin-bottom: 4px; padding-left: 32px; font-size: 13px; line-height: 1.3; }
  .pane.done .wseq.compact li::before { left: 7px; width: 18px; height: 18px; font-size: 10.5px; }
  .pane.done .r-rot { margin-bottom: 2px; line-height: 1.35; }
}
@media (min-width: 1400px) and (min-height: 600px) {
  .layout { grid-template-columns: minmax(0, 1fr) 420px; }
}
@media (max-height: 740px) and (min-width: 900px) {
  .pane h1 { font-size: 26px; }
  .pane h2 { font-size: 23px; }
  .big-n { font-size: 44px; }
  .facts { margin-bottom: 6px; }
  .facts div { padding: 4px 8px; }
  .facts dd { font-size: 14px; }
  .bars { gap: 2px; }
  .list-head { margin: 8px 0 4px; }
  .wseq.compact li { padding-top: 4px; padding-bottom: 4px; margin-bottom: 4px; }
  .actions { margin-top: 6px; }
  .actions .btn { padding: 8px 13px; }
  .mcard { padding: 8px 12px; }
  .chart-wrap.tall canvas { height: 220px; }
}

/* ----- Laptop windows up to 800 px tall (a 1366x768 screen with the browser bars, or 150% scaling) ----- */
@media (max-height: 800px) and (min-width: 900px) {
  .seq { padding-top: 6px; padding-bottom: 8px; }
  .hud { margin-bottom: 6px; }
  .stepper li { padding: 3px 10px 3px 5px; }
  .panel { padding: 12px 16px; }
  .pane-foot { bottom: -12px; margin: 0 -16px -12px; padding: 2px 16px 10px; }
  .pane h1 { font-size: 24px; margin-bottom: 6px; }
  .pane h2 { font-size: 21px; margin-bottom: 6px; }
  .pane p { margin-bottom: 7px; font-size: 14px; }
  .lead { font-size: 15px !important; }
  .gemba { font-size: 15px !important; padding: 6px 10px; }
  .big { margin-bottom: 4px; }
  .big-n { font-size: 38px; }
  .big-l { font-size: 15px; }
  .facts { gap: 6px; margin-bottom: 6px; }
  .facts div { padding: 3px 8px; }
  .facts dt { font-size: 11px; }
  .facts dd { font-size: 13.5px; margin-top: 0; }
  .bars { gap: 1px; }
  .brow { font-size: 12px; }
  .brow .b-track { height: 9px; }
  .list-head { margin: 6px 0 3px; font-size: 11.5px; }
  .wseq li { padding: 4px 8px 4px 34px; margin-bottom: 4px; font-size: 13px; line-height: 1.3; }
  .wseq li::before { top: 5px; left: 8px; width: 18px; height: 18px; font-size: 10.5px; }
  .wseq .w-when { font-size: 11.5px; }
  .wseq.compact li { padding: 3px 8px 3px 32px; margin-bottom: 3px; font-size: 13px; }
  .wseq.compact li::before { top: 4px; }
  .wseq.compact .w-when { font-size: 11.5px; }
  .hint { padding: 5px 10px; font-size: 13.5px !important; }
  .actions { margin-top: 4px; gap: 6px; }
  .actions .btn { padding: 7px 11px; font-size: 13px; }
  .copied { margin-top: 3px !important; font-size: 12px !important; }
  .mcard { padding: 7px 12px; margin-bottom: 7px; }
  .m-res b { font-size: 21px; }
  .close-1 { font-size: 16.5px !important; margin-bottom: 4px !important; }
  .question { padding: 7px 12px; margin: 6px 0; }
  .q-text { font-size: 14px !important; line-height: 1.4 !important; }
  .strip-cv { height: 62px; }
  .strip-key { padding-bottom: 3px; }
  .mission-board { padding: 10px 14px 4px; margin-bottom: 6px; }
  .pane .mb-head h1 { font-size: 24px; }
  .pane .m-line { font-size: 14px; margin-bottom: 4px; line-height: 1.45; }
  .pane .m-line.m-goal { font-size: 15.5px; }
  .ps { padding: 4px 9px; font-size: 13px; }
  .path-steps { gap: 3px; padding: 4px; }
  .pane .path-note { font-size: 13.5px; margin-top: 4px; margin-bottom: 2px; }
  .pane .path-total { font-size: 12.5px; margin-bottom: 2px; }
  .trial { padding: 9px 12px; margin: 6px 0; }
  .trial-h { font-size: 17px; }
  .bar { padding: 7px 12px; min-height: 52px; }
  .caption { font-size: 14px; }
  .chart-wrap { padding: 6px 10px; }
  .chart-wrap canvas { height: 112px; }
  .chart-wrap.tall canvas { height: 196px; }
  .coach { font-size: 13.5px; }
  .pane.done .close-1 { font-size: 16px !important; }
  .pane.done .q-text { font-size: 14px !important; }
  .pane.done .trial-h { font-size: 16.5px; }
}
@media (max-height: 620px) and (min-width: 900px) {
  .big-n { font-size: 32px; }
  .facts dt { font-size: 10.5px; }
  .wseq .w-when, .wseq.compact .w-when { font-size: 11px; line-height: 1.2; }
  .chart-wrap canvas { height: 100px; }
  .chart-wrap.tall canvas { height: 168px; }
  .legend { font-size: 11px; }
  .pane[data-pane="reveal"] .eyebrow { display: none; }
  .close-1 { font-size: 15.5px !important; }
  .q-text { font-size: 13.5px !important; }
}

/* ----- Phones and narrow windows: the page scrolls; on the result the number comes before the chart ----- */
@media (max-width: 899px), (max-height: 599px) {
  .seq[data-stage="result"] .stagecol { display: contents; }
  .seq[data-stage="result"] .panel { order: 1; }
  .seq[data-stage="result"] .chart-wrap { order: 2; }
  /* the mission comes before the station on phones */
  .seq[data-stage="mission"] .panel { order: -1; }
  /* building the cards comes first on phones; while the hour runs the station is on top again */
  .seq[data-stage="turn"]:not(.running) .panel { order: -1; }
}

/* ----- Phones ----- */
@media (max-width: 600px) {
  .seq-page .band.slim .page-header { padding: 10px 16px; }
  .seq { padding: 8px 12px 24px; }
  .note { display: none; }
  .stepper li { font-size: 12px; padding: 4px 8px 4px 5px; }
  .stepper li::before { width: 17px; height: 17px; margin-right: 4px; }
  .scene-card { aspect-ratio: 1 / 1; border-radius: 12px; }
  .facts { grid-template-columns: 1fr 1fr 1fr; }
  .facts dt { font-size: 11px; }
  .brow { grid-template-columns: 140px 1fr 26px; font-size: 12px; }
  .panel { padding: 14px 14px; }
  .chart-wrap canvas { height: 170px; }
  .chart-wrap.tall canvas { height: 300px; }
  .chips .chip { font-size: 12px; padding: 3px 9px; }
  .mission-board { padding: 10px 12px 4px; }
  .pane .mb-head h1 { font-size: 24px; }
  .ps.op { width: 80%; }
  .ps.gr { width: 66%; }
  .ps { font-size: 13.5px; padding: 6px 8px; gap: 6px; }
  .gantt { height: 176px; }
}

/* ----- Reduced motion: no typing, no flashes; everything is shown at once ----- */
@media (prefers-reduced-motion: reduce) {
  .mission-board.play .m-line:not(.typing):not(.typed) { visibility: visible; }
  .mission-board.play ~ .mission-after { visibility: visible; opacity: 1; }
  .m-line.typing .m-caret { display: none; }
  .mission-after { transition: none; }
  .caption.flash, .wseq li.flash { animation: none; }
}

/* phones: a little room between the bars and the chart card in the pane */
@media (max-width: 899px), (max-height: 599px) {
  .gchart-slot .gchart-card { margin-top: 10px; }
}
