/* Beer Game companion — warehouse-board theme.
   Mirrors the physical board: flat warehouse illustration, per-role zone colors
   (Retail=blue, Wholesale=green, Distribution=orange, Factory=purple), wood &
   cardboard tones, cream label pills, inset "slot" rectangles.
   Fraunces (display) · Hanken Grotesk (body) · IBM Plex Mono (figures). */

:root {
  /* shared warehouse neutrals */
  --paper: #ece3d2;        /* warm cream (wood/paper) */
  --paper-2: #f4ecdb;      /* lighter cream for pills/cards */
  --ink: #2c2620;
  --ink-soft: #5f5446;
  --wood: #7a5230;
  --wood-dark: #573a20;
  --cardboard: #e3a85f;
  --cardboard-edge: #c98a3e;
  --line: rgba(60, 45, 30, 0.18);
  --good: #5e8638;
  --warn: #c06b2f;

  /* neutral defaults (join / role-pick screens) */
  --zone: var(--paper);
  --zone-deep: #e0d5bf;
  --accent: #7a5230;
  --slot: rgba(255, 255, 255, 0.55);
  --slot-line: rgba(122, 82, 48, 0.22);
  --label-ink: var(--wood-dark);

  --radius: 18px;
  --shadow: 0 1px 2px rgba(60, 45, 30, 0.05), 0 12px 30px -14px rgba(60, 45, 30, 0.32);
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ---- per-role station themes (match the board) ---- */
/* --label-ink darkened per theme so small uppercase labels / .wkof text clear
   WCAG AA (>=4.5:1) against each station's --zone-deep panel. */
/* --accent values carry white text (buttons, pills, glyph fills), so each clears
   WCAG AA 4.5:1 against #fff: retail 7.3:1, wholesale 5.4:1, distribution 5.4:1,
   factory 6.7:1. The lighter --zone pastels remain for the page background. */
.theme-retailer    { --zone:#9cb0dd; --zone-deep:#8194c9; --accent:#3a539b; --slot:rgba(255,255,255,0.30); --slot-line:rgba(255,255,255,0.55); --label-ink:#1b2547; }
.theme-wholesaler  { --zone:#aac487; --zone-deep:#95b36b; --accent:#4d7320; --slot:rgba(255,255,255,0.34); --slot-line:rgba(255,255,255,0.6);  --label-ink:#243413; }
.theme-distributor { --zone:#d89b78; --zone-deep:#c9835c; --accent:#a64f27; --slot:rgba(255,255,255,0.32); --slot-line:rgba(255,255,255,0.58); --label-ink:#421d0c; }
.theme-factory     { --zone:#b7a7d6; --zone-deep:#a18fc6; --accent:#664f9e; --slot:rgba(255,255,255,0.32); --slot-line:rgba(255,255,255,0.58); --label-ink:#2c1d49; }

/* fixed role swatches (used on the role-pick chain regardless of theme) —
   matched to the AA-passing accents above */
.role-retailer    { --rc:#3a539b; }
.role-wholesaler  { --rc:#4d7320; }
.role-distributor { --rc:#a64f27; }
.role-factory     { --rc:#664f9e; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* Buttons don't inherit text color by default — and iOS Safari's UA stylesheet
   colors <button> text system-blue, so any button without an explicit color
   (e.g. .team-card / .tname) rendered blue on iOS but dark on desktop. Inherit
   the page ink so button text is consistent everywhere; buttons that set their
   own color (.btn, .tab, .btn-ghost, *.on) still override this. */
button { color: inherit; }

/* Visually hidden but exposed to assistive tech (screen-reader live region). */
.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;
}

body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--zone);
  transition: background 0.5s ease;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

/* ---- layout ---- */
.shell {
  max-width: 480px;
  margin: 0 auto;
  padding: calc(22px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-left))
           calc(40px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-right));
  min-height: 100vh;
}
.board-shell { max-width: 1180px; }

.brandmark {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--serif); font-weight: 600; font-size: 14px;
  color: var(--ink-soft); margin-bottom: 18px;
}
.brandmark .dot {
  width: 12px; height: 12px; border-radius: 3px;
  background: var(--cardboard);
  box-shadow: inset 0 0 0 1.5px var(--cardboard-edge);
}

h1.display {
  font-family: var(--serif); font-weight: 560;
  font-size: clamp(28px, 7.5vw, 38px); line-height: 1.05;
  letter-spacing: -0.015em; margin: 0 0 8px;
}
.lede { color: var(--ink-soft); font-size: 15.5px; line-height: 1.5; margin: 0 0 24px; }

.screen { display: none; animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.screen.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---- pills / labels (match board tags) ---- */
.zone-label {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff;
  font-family: var(--serif); font-weight: 560; font-size: 12.5px; letter-spacing: 0.01em;
  padding: 5px 13px; border-radius: 999px;
}
.tag {
  display: inline-block; background: var(--paper-2); color: var(--label-ink);
  border: 1.5px solid var(--cardboard-edge);
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700;
  padding: 4px 10px; border-radius: 8px;
}
.team-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: var(--label-ink);
}
.team-chip .sw { width: 13px; height: 13px; border-radius: 4px; box-shadow: inset 0 0 0 1.5px rgba(0,0,0,0.12); }

/* ---- team color cards (join) ---- */
.team-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.team-card {
  position: relative; border: none; background: var(--paper-2);
  border-radius: var(--radius); padding: 14px 14px 13px; cursor: pointer; text-align: left;
  box-shadow: var(--shadow); transition: transform 0.16s ease, box-shadow 0.16s ease;
  opacity: 0; animation: rise 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}
.team-card::after { /* wood shelf line under the swatch */
  content: ''; position: absolute; left: 14px; right: 14px; top: 64px; height: 3px;
  background: var(--wood); opacity: 0.25; border-radius: 2px;
}
.team-card:active { transform: scale(0.97); }
.team-card:hover { transform: translateY(-2px); box-shadow: 0 16px 36px -16px rgba(60,45,30,0.4); }
.team-card .swatch { width: 100%; height: 56px; border-radius: 11px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08), inset 0 -6px 12px rgba(0,0,0,0.10); }
.team-card .tname { font-family: var(--serif); font-weight: 560; font-size: 20px; margin-top: 14px; }
.team-card .tmeta { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }
.team-card.full { opacity: 0.5; pointer-events: none; }
.team-card.full::before {
  content: 'FULL'; position: absolute; top: 11px; right: 11px; z-index: 1;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.12em;
  color: #fff; background: rgba(40,30,20,0.55); padding: 2px 6px; border-radius: 5px;
}

/* ---- supply-chain strip ---- */
.chain { display: flex; align-items: flex-start; gap: 0; margin: 16px 0 6px; }
.chain.compact { margin: 6px 0 16px; }
.node { flex: 1; text-align: center; position: relative; padding: 8px 2px; min-width: 0; }
/* Interactive role-pick stations are <button>s; strip the UA chrome so they
   match the display-only div nodes, then re-expose a clear focus ring below. */
button.node { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
button.node[disabled] { cursor: default; }
.node .glyph {
  width: 50px; height: 50px; margin: 0 auto 7px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center; font-size: 23px;
  background: var(--paper-2); border: 2px solid var(--line);
  box-shadow: 0 4px 0 rgba(60,45,30,0.12);
  transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.compact .node .glyph { width: 42px; height: 42px; font-size: 19px; box-shadow: 0 3px 0 rgba(60,45,30,0.12); }
/* Use the per-theme dark ink (not --ink-soft) so non-active station labels clear
   WCAG AA (>=4.5:1) on the themed pastel page background; .node.me stays bolded. */
.node .nlabel { font-size: 10.5px; color: var(--label-ink); line-height: 1.2; }
/* role-pick: each station shows its own board color */
.node.role-retailer .glyph, .node.role-wholesaler .glyph,
.node.role-distributor .glyph, .node.role-factory .glyph { border-color: var(--rc); }
.node.open .glyph { cursor: pointer; }
.node.open:hover .glyph { transform: translateY(-3px); }
.node.sel .glyph { background: var(--rc); border-color: var(--rc); color: #fff; box-shadow: 0 5px 0 rgba(0,0,0,0.18); }
.node.sel .nlabel { color: var(--ink); font-weight: 700; }
.node.taken .glyph { opacity: 0.4; filter: grayscale(0.4); }
/* play / wait */
.node.me .glyph { border-color: var(--accent); box-shadow: 0 5px 0 rgba(0,0,0,0.14), 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.node.me .nlabel { color: var(--label-ink); font-weight: 700; }
.node.submitted .glyph { background: var(--accent); border-color: var(--accent); color: #fff; }
.node.waiting .glyph { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 5px 0 rgba(0,0,0,0.14), 0 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent); }
  50% { box-shadow: 0 5px 0 rgba(0,0,0,0.14), 0 0 0 8px color-mix(in srgb, var(--accent) 0%, transparent); }
}
.node + .node::before { content: ''; position: absolute; left: -50%; right: 50%; top: 33px; height: 3px; background: var(--line); border-radius: 2px; }
.compact .node + .node::before { top: 29px; }
.node.flow + .node.flow::before { background: var(--accent); }

/* ---- weekly entry "station" ---- */
.station {
  background: var(--zone-deep); border-radius: 22px; padding: 16px 14px 18px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35), var(--shadow); margin-top: 4px;
}
.weekbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.weekbar .wk { display: inline; font-family: var(--serif); font-weight: 560; font-size: 24px; letter-spacing: -0.01em; margin: 0; }
.weekbar .wk:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
/* No opacity: --label-ink alone on --zone-deep clears AA; 0.8 dragged it under. */
.weekbar .wkof { font-family: var(--mono); font-size: 12px; color: var(--label-ink); }
.role-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 650;
}

.slot {
  background: var(--slot); border: 1.5px solid var(--slot-line);
  border-radius: 14px; padding: 13px 14px;
  box-shadow: inset 0 2px 7px rgba(40,30,20,0.10);
}
.incoming { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin: 4px 0; }
.slot .k { font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--label-ink); font-weight: 700; }
.slot .v { font-family: var(--mono); font-weight: 600; font-size: 30px; font-variant-numeric: tabular-nums; margin-top: 3px; color: var(--ink); }
.slot .u { font-size: 11px; color: var(--label-ink); opacity: 0.85; }

.field { margin: 12px 0; }
.field > label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; color: var(--label-ink); letter-spacing: 0.02em; }
.field .hint { font-weight: 500; opacity: 0.8; text-transform: none; letter-spacing: 0; }
.field input {
  width: 100%; font-family: var(--mono); font-size: 26px; font-variant-numeric: tabular-nums;
  padding: 13px 15px; border: 2px solid var(--slot-line); border-radius: 13px;
  background: rgba(255,255,255,0.78); color: var(--ink); -webkit-appearance: none;
  box-shadow: inset 0 2px 6px rgba(40,30,20,0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.field.planned input { background: #fff; border-color: color-mix(in srgb, var(--accent) 50%, var(--slot-line)); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin: 18px 0; }
/* Keep both inputs on a shared bottom edge even when one label wraps to a 2nd
   line ("Current Inventory (optional)" wraps on narrow phones while "Backlog
   (optional)" doesn't). Grid already stretches the cells to equal height; making
   each field a flex column with the label flexing to fill pushes the inputs to
   the bottom so they align. No effect when both labels fit on one line. */
.two-col .field { margin: 0; display: flex; flex-direction: column; }
.two-col .field > label { flex: 1 0 auto; }

input[type=text].name-input {
  width: 100%; font-family: var(--sans); font-size: 17px; padding: 13px 15px;
  border: 2px solid var(--line); border-radius: 13px; background: var(--paper-2); color: var(--ink);
}
input.name-input:focus { outline: none; border-color: var(--wood); }

button.btn {
  width: 100%; font-family: var(--sans); font-weight: 700; font-size: 17px;
  padding: 16px; border: none; border-radius: 14px; cursor: pointer;
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 0 rgba(0,0,0,0.18);
  transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.2s ease;
  margin-top: 14px; min-height: 52px;
}
button.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,0.18); }
button.btn:disabled { opacity: 0.45; cursor: not-allowed; }
button.btn.wood { background: var(--wood); }
.btn-ghost { background: none; border: none; color: var(--ink-soft); font-family: var(--sans); font-size: 14px; cursor: pointer; padding: 10px; text-decoration: underline; min-height: 44px; }

/* ---- waiting + feedback ---- */
.waitmsg { text-align: center; margin: 20px 0 6px; }
.waitmsg .check {
  width: 62px; height: 62px; margin: 0 auto 14px; border-radius: 16px;
  background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 30px; box-shadow: 0 5px 0 rgba(0,0,0,0.18); animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.waitmsg h2 { font-family: var(--serif); font-weight: 560; font-size: 24px; margin: 0 0 4px; }
.waitmsg p { color: var(--label-ink); margin: 0; }
.waiting-list { font-weight: 700; }

.mismatch {
  background: rgba(255,255,255,0.55); border: 1.5px solid var(--warn);
  border-radius: 13px; padding: 12px 14px; margin: 12px 0; font-size: 13.5px; color: var(--ink);
}
/* Darker than --warn (which stays on the border) so the bold heading text clears
   WCAG AA 4.5:1 on the translucent panel at 13.5px. */
.mismatch .mh { font-weight: 700; color: #7a3c12; }
.mismatch .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Recount prompt shown at lock-in when the entered count doesn't match the
   ledger. Sits just above the submit button. */
.recount[hidden] { display: none; }
.recount {
  background: rgba(255,255,255,0.6); border: 1.5px solid var(--warn);
  border-radius: 13px; padding: 12px 14px; margin: 14px 0 0;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.recount .recount-msg { margin: 0; flex: 1; min-width: 180px; font-size: 13.5px; color: #7a3c12; font-weight: 600; }
.recount #recount-anyway { flex: 0 0 auto; padding: 8px 4px; text-decoration: underline; }

/* Facilitator board: recount warning badge under a station that locked in over
   a mismatched count. */
.miscount-badge {
  font-family: var(--sans); font-size: 9px; font-weight: 700; line-height: 1;
  color: #7a3c12; background: rgba(192,107,47,0.16);
  border: 1px solid var(--warn); border-radius: 6px; padding: 2px 4px; margin-top: 1px;
}

.toast {
  position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all 0.3s ease; z-index: 50;
  max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.notice { color: var(--ink-soft); font-size: 14.5px; text-align: center; padding: 36px 8px; line-height: 1.5; }

/* =========================================================
   FACILITATOR (desktop)
   ========================================================= */
.fac-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.fac-head h1 { margin: 0; }
.tabs { display: flex; gap: 8px; margin: 6px 0 22px; }
.tab { font-family: var(--sans); font-size: 14px; font-weight: 650; padding: 9px 17px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--paper-2); cursor: pointer; color: var(--ink-soft); }
.tab.active { background: var(--wood); color: #fff; border-color: var(--wood); }

.qr-wrap { display: flex; gap: 26px; flex-wrap: wrap; align-items: center; background: var(--paper-2); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.qr-wrap #qr { background: #fff; padding: 12px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); line-height: 0; }
.joinlink { font-family: var(--mono); font-size: 15px; word-break: break-all; background: #fff; padding: 11px 13px; border-radius: 10px; border: 1.5px solid var(--line); }
.sub { color: var(--ink-soft); font-size: 13.5px; }

.config-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 14px 0; }
.config-grid .field { margin: 0; }
.config-grid input { font-size: 18px; padding: 11px 13px; font-family: var(--mono); }
.config-grid .field > label { color: var(--ink-soft); }

table.board { width: 100%; border-collapse: collapse; background: var(--paper-2); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.board th, table.board td { padding: 13px 15px; text-align: left; font-size: 14px; border-bottom: 1.5px solid var(--line); }
table.board th { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
table.board tr:last-child td { border-bottom: none; }
table.board td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.team-tag { display: inline-flex; align-items: center; gap: 9px; font-family: var(--serif); font-weight: 560; font-size: 16px; }
.team-tag .chip { width: 15px; height: 15px; border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12); }
.dotcell { display: flex; gap: 10px; align-items: flex-start; }
.subdot-cell { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; }
.subdot-key { font-family: var(--mono); font-size: 9px; font-weight: 600; color: var(--ink-soft); letter-spacing: 0.04em; }
.subdot { width: 15px; height: 15px; border-radius: 5px; border: 2px solid var(--line); background: #fff; }
.subdot.in { background: var(--good); border-color: var(--good); }
.subdot.none { opacity: 0.35; }
.mini-btn { font-family: var(--sans); font-size: 12.5px; font-weight: 650; padding: 7px 13px; border-radius: 9px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; }
.mini-btn:hover { background: var(--wood); color: #fff; border-color: var(--wood); }
.mini-btn.danger { color: #7a3c12; border-color: var(--warn); }
.mini-btn.danger:hover { background: var(--warn); color: #fff; border-color: var(--warn); }
.board-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.board-head .lede { margin: 0; flex: 1; min-width: 200px; }
.board-head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.charts { display: grid; gap: 22px; }
.chart-card { background: var(--paper-2); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.chart-card h3 { font-family: var(--serif); font-weight: 560; font-size: 20px; margin: 0 0 4px; }
.chart-card .sub { margin: 0 0 14px; }
.chart-card canvas { max-height: 340px; }
.team-select { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.team-select button { font-family: var(--mono); font-size: 12.5px; padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; }
.team-select button.on { color: #fff; border-color: transparent; }

.lead-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1.5px solid var(--line); }
.lead-row:last-child { border-bottom: none; }
.lead-rank { font-family: var(--serif); font-size: 22px; width: 30px; color: var(--ink-soft); }
.lead-bar { flex: 1; height: 28px; border-radius: 8px; background: #fff; overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.lead-bar > span { display: block; height: 100%; border-radius: 8px; }
.lead-cost { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 600; min-width: 86px; text-align: right; }

/* ---- shared keyboard focus indication ---- */
.team-card:focus-visible,
button.btn:focus-visible,
.btn-ghost:focus-visible,
.tab:focus-visible,
.mini-btn:focus-visible,
.team-select button:focus-visible,
button.node:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 65%, #000);
  outline-offset: 2px;
}
/* The role-pick station's focus ring reads better on the glyph tile itself. */
button.node:focus-visible { outline: none; }
button.node:focus-visible .glyph {
  outline: 3px solid color-mix(in srgb, var(--rc, var(--accent)) 70%, #000);
  outline-offset: 3px;
}

/* =========================================================
   PROJECTOR / PRESENTATION VIEW (read-only room screen)
   Full-screen, sized with clamp() for legibility across a room. Reuses the
   warehouse tokens; steps are station-agnostic so they use the wood/cardboard
   accents rather than a per-role color.
   ========================================================= */
.present-body { background: var(--paper); overflow: hidden; }
.present {
  display: flex; flex-direction: column;
  height: 100vh; width: 100%;
  padding: clamp(18px, 2.4vw, 40px);
  gap: clamp(14px, 2vh, 28px);
}
.present[hidden] { display: none; }

.present-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: 0 0 auto; }
.present-top .brandmark { margin: 0; font-size: clamp(13px, 1.3vw, 19px); flex: 1 1 0; min-width: 0; }
.present-title {
  font-family: var(--serif); font-weight: 560; letter-spacing: -0.01em; text-align: center;
  font-size: clamp(20px, 2.2vw, 34px); flex: 2 1 auto;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.present-status {
  flex: 1 1 0; display: flex; align-items: center; justify-content: flex-end;
  font-family: var(--sans); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  font-size: clamp(11px, 1vw, 15px);
}
.present-status > .pill {
  padding: 6px 15px; border-radius: 999px;
  background: var(--paper-2); border: 1.5px solid var(--line); color: var(--ink-soft);
}
.present-status.live > .pill { background: var(--good); border-color: var(--good); color: #fff; }
.present-status.complete > .pill { background: var(--wood); border-color: var(--wood); color: #fff; }

/* stage = stepper rail + big current-step card, vertically centered */
.present-stage { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: clamp(16px, 2.6vh, 36px); }

.stepper { display: flex; align-items: flex-start; gap: 0; list-style: none; margin: 0; padding: 0; }
.stepper li { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; min-width: 0; }
.stepper li:not(:first-child)::before {
  content: ''; position: absolute; z-index: 0;
  top: calc(clamp(34px, 3.4vw, 50px) / 2 - 2px);
  left: -50%; right: 50%; height: 4px; background: var(--line); border-radius: 2px;
}
.stepper li.done:not(:first-child)::before,
.stepper li.current:not(:first-child)::before { background: var(--cardboard-edge); }
.step-pip {
  position: relative; z-index: 1;
  width: clamp(34px, 3.4vw, 50px); height: clamp(34px, 3.4vw, 50px);
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 600; font-size: clamp(15px, 1.5vw, 22px);
  background: var(--paper-2); border: 2.5px solid var(--line); color: var(--ink-soft);
  box-shadow: 0 4px 0 rgba(60,45,30,0.12);
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease, transform 0.3s cubic-bezier(0.2,0.8,0.2,1);
}
.stepper li.done .step-pip { background: var(--cardboard); border-color: var(--cardboard-edge); color: var(--wood-dark); }
.stepper li.current .step-pip { background: var(--wood); border-color: var(--wood-dark); color: #fff; transform: translateY(-2px) scale(1.06); box-shadow: 0 6px 0 rgba(0,0,0,0.18); }
.step-pip-label { font-size: clamp(10px, 0.95vw, 14px); line-height: 1.2; color: var(--ink-soft); max-width: 15ch; }
.stepper li.current .step-pip-label { color: var(--ink); font-weight: 700; }

/* compact step header: number badge + kicker/title, with the description set
   off to the right. Slim so the station demo below is the visual anchor. */
.step-detail {
  display: flex; align-items: center; gap: clamp(14px, 1.8vw, 28px);
  background: var(--paper-2); border: 1.5px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: clamp(13px, 1.5vw, 24px) clamp(18px, 2vw, 32px);
  animation: rise 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.step-detail-num {
  flex: 0 0 auto;
  width: clamp(50px, 4.8vw, 82px); height: clamp(50px, 4.8vw, 82px);
  border-radius: clamp(13px, 1.3vw, 20px);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 560; font-size: clamp(27px, 3vw, 50px);
  background: var(--wood); color: #fff; box-shadow: 0 5px 0 rgba(0,0,0,0.18);
}
.step-detail-body { flex: 0 1 auto; min-width: 0; }
.step-detail-kicker { font-family: var(--mono); font-size: clamp(10px, 1vw, 15px); letter-spacing: 0.08em; text-transform: uppercase; color: var(--wood); font-weight: 600; }
.step-detail-title { font-family: var(--serif); font-weight: 560; letter-spacing: -0.015em; line-height: 1.05; font-size: clamp(23px, 2.9vw, 46px); margin: 2px 0 0; }
.step-detail-desc {
  flex: 1 1 0; min-width: 0; align-self: stretch;
  display: flex; align-items: center;
  font-family: var(--sans); line-height: 1.4; color: var(--ink-soft);
  font-size: clamp(14px, 1.5vw, 23px); margin: 0;
  padding-left: clamp(14px, 1.6vw, 26px); border-left: 1.5px solid var(--line);
}
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  .step-detail { flex-wrap: wrap; }
  .step-detail-desc { flex-basis: 100%; padding-left: 0; border-left: none; margin-top: 10px; padding-top: 10px; border-top: 1.5px solid var(--line); }
}

/* ---- station demo: a faithful single station mirroring the board ----
   Full-width. Two rails — orders flow right (to your supplier), goods flow left
   (to your customer). Each has a 2-slot in-transit pipeline (shipDelay /
   infoDelay = 2). Boxes = goods; numbered slips = orders. Fixed equilibrium
   numbers. data-step brightens the active rail + animates what moves. */
.station-demo {
  --sd-unit: clamp(11px, 0.95vw, 16px);
  --sd-ugap: clamp(2px, 0.25vw, 4px);
  --sd-slot-h: clamp(52px, 5vw, 76px);
  --sd-mini-pitch: clamp(52px, 5.2vw, 80px);
  --sd-rail-pt: clamp(10px, 1.1vw, 16px);
  --sd-conn: clamp(40px, 5vw, 100px);
  --sd-box-w: clamp(78px, 7.4vw, 116px);
  display: flex; align-items: stretch; gap: clamp(10px, 1.2vw, 20px);
  background: var(--paper-2); border: 1.5px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: clamp(14px, 1.6vw, 26px) clamp(14px, 1.6vw, 26px);
}
.sd-edge {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center; text-align: center;
  font-family: var(--mono); font-size: clamp(9px, 0.85vw, 12px); letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--ink-soft); font-weight: 600;
}
.sd-edge span { display: block; line-height: 1.3; }
.sd-edge-cust { border-right: 2px dashed var(--line); padding-right: clamp(10px, 1.1vw, 18px); }
.sd-edge-supp { border-left: 2px dashed var(--line); padding-left: clamp(10px, 1.1vw, 18px); }

.sd-core { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: clamp(16px, 1.8vw, 30px); }

/* rail = one flow lane. Arrows are flex:1 spacers, so the pipelines sit flush
   to the supplier edge and the downstream boxes flush to the customer edge —
   both rails line up automatically with even spacing between. */
.sd-rail {
  position: relative; display: flex; align-items: center; justify-content: center;
  padding: var(--sd-rail-pt) clamp(14px, 1.6vw, 26px) clamp(26px, 2.4vw, 38px);
  border-radius: 16px; transition: opacity 0.4s ease;
}
.sd-rail-orders { background: rgba(122, 82, 48, 0.07); }
.sd-rail-goods  { background: rgba(94, 134, 56, 0.09); }
.sd-rail-tag {
  position: absolute; top: 7px; left: 16px; z-index: 2;
  font-family: var(--mono); font-size: clamp(9px, 0.85vw, 12px); letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--ink-soft); opacity: 0.8; font-weight: 600;
}
/* continuous flow line + arrowhead through the station, masked behind the opaque
   slots so it shows only in the gaps — reads as a conveyor running between your
   customer and your supplier. */
.sd-rail::before {
  content: ''; position: absolute; z-index: 0;
  left: clamp(14px, 1.6vw, 26px); right: clamp(14px, 1.6vw, 26px);
  top: calc(var(--sd-rail-pt) + var(--sd-slot-h) / 2); height: 3px; transform: translateY(-50%);
  background: color-mix(in srgb, var(--wood) 24%, transparent); border-radius: 2px;
}
.sd-rail::after {
  content: ''; position: absolute; z-index: 0; width: 0; height: 0;
  top: calc(var(--sd-rail-pt) + var(--sd-slot-h) / 2); transform: translateY(-50%);
  border-top: 7px solid transparent; border-bottom: 7px solid transparent;
}
.sd-rail-orders::after { right: clamp(7px, 0.9vw, 15px); border-left: 12px solid color-mix(in srgb, var(--wood) 40%, transparent); }
.sd-rail-goods::after  { left: clamp(7px, 0.9vw, 15px); border-right: 12px solid color-mix(in srgb, var(--wood) 40%, transparent); }

.sd-node { flex: 0 0 auto; position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
/* fixed-width spacers keep the gaps even and the two rails the same total width
   (so their slots/pipelines line up); the flow line lives on the rail itself. */
.sd-arrow { flex: 0 0 auto; width: var(--sd-conn); }
.sd-spacer { flex: 0 0 auto; width: clamp(24px, 2.4vw, 44px); }

/* a slot mirrors a board region; captions sit absolutely beneath so the slot
   centers (and the flow line) align across both rails. */
.sd-slot {
  position: relative; display: flex; align-items: center; justify-content: center; gap: var(--sd-ugap);
  min-width: clamp(58px, 5.8vw, 90px); height: var(--sd-slot-h);
  padding: clamp(6px, 0.7vw, 11px) clamp(8px, 0.9vw, 13px);
  background: var(--paper-2); border: 2px solid var(--slot-line); border-radius: 12px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
.sd-cap {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  font-size: clamp(8.5px, 0.82vw, 11.5px); letter-spacing: 0.04em; text-transform: uppercase;
  font-weight: 700; color: var(--label-ink, var(--ink-soft)); text-align: center; line-height: 1.15;
  white-space: nowrap;
}

/* two-slot pipeline */
.sd-pipe-slots { display: flex; gap: clamp(4px, 0.5vw, 8px); }
.sd-pslot { min-width: clamp(46px, 4.6vw, 70px); padding-bottom: clamp(13px, 1.2vw, 18px); }
.sd-wk {
  position: absolute; bottom: clamp(3px, 0.4vw, 5px); left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: clamp(7.5px, 0.7vw, 10px); color: var(--ink-soft); opacity: 0.85;
  letter-spacing: 0.02em; white-space: nowrap;
}

/* tokens */
.sd-unit { width: var(--sd-unit); height: var(--sd-unit); border-radius: 3px;
  background: var(--cardboard); box-shadow: inset 0 0 0 1.5px var(--cardboard-edge); }
.sd-units { display: grid; grid-template-columns: repeat(2, var(--sd-unit)); gap: var(--sd-ugap); }
/* primary slots share one width so both rails are identical in total and their
   slots/pipelines align exactly. */
.sd-incoming > .sd-slot, .sd-placed > .sd-slot, .sd-slot-inv { min-width: var(--sd-box-w); }
.sd-slot-inv { gap: clamp(6px, 0.7vw, 11px); }
.sd-count { font-family: var(--mono); font-weight: 600; font-size: clamp(20px, 2vw, 34px); color: var(--ink); font-variant-numeric: tabular-nums; }
.sd-card {
  min-width: clamp(26px, 2.5vw, 38px); height: clamp(34px, 3.2vw, 50px);
  display: flex; align-items: center; justify-content: center; border-radius: 4px;
  background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--wood);
  font-family: var(--mono); font-weight: 600; font-size: clamp(14px, 1.4vw, 21px); color: var(--wood);
}
/* hidden animation tokens (shown only during their step) */
.sd-shipment { position: absolute; left: clamp(4px, 0.5vw, 8px); top: 50%; transform: translateY(-50%);
  display: flex; gap: var(--sd-ugap); opacity: 0; pointer-events: none; }
/* the replenishing shipment that slides into the far slot from the supplier (step 1) */
.sd-g-arrive { position: absolute; top: calc(50% - clamp(3px, 0.4vw, 6px)); left: 50%;
  transform: translate(-50%, -50%); opacity: 0; pointer-events: none; }

/* active-rail emphasis: the rail in play stays bright, the other dims */
.station-demo[data-step="1"] .sd-rail-orders,
.station-demo[data-step="3"] .sd-rail-orders,
.station-demo[data-step="2"] .sd-rail-goods,
.station-demo[data-step="4"] .sd-rail-goods,
.station-demo[data-step="5"] .sd-rail-goods { opacity: 0.3; }

/* highlight the slot(s) the step acts on */
.station-demo[data-step="1"] .sd-inventory .sd-slot,
.station-demo[data-step="3"] .sd-inventory .sd-slot,
.station-demo[data-step="2"] .sd-incoming .sd-slot,
.station-demo[data-step="5"] .sd-pipe-orders .sd-o-far,
.station-demo[data-step="1"] .sd-pipe-goods .sd-pslot,
.station-demo[data-step="4"] .sd-pipe-orders .sd-pslot {
  border-color: var(--wood); box-shadow: 0 0 0 3px color-mix(in srgb, var(--wood) 22%, transparent);
}

/* per-step motion (loops while the step is shown) */
@keyframes sdNearOutL { 0%, 15% { transform: translateX(0); opacity: 1; } 70% { transform: translateX(-130%); opacity: 1; } 90%, 100% { transform: translateX(-155%); opacity: 0; } }
@keyframes sdFarToNearL { 0%, 15% { transform: translateX(0); } 70%, 100% { transform: translateX(calc(-1 * var(--sd-mini-pitch))); } }
@keyframes sdNearOutR { 0%, 15% { transform: translateX(0); opacity: 1; } 70% { transform: translateX(130%); opacity: 1; } 90%, 100% { transform: translateX(155%); opacity: 0; } }
@keyframes sdFarToNearR { 0%, 15% { transform: translateX(0); } 70%, 100% { transform: translateX(var(--sd-mini-pitch)); } }
@keyframes sdPop { 0%, 100% { transform: scale(0.6); opacity: 0.4; } 35% { transform: scale(1.12); opacity: 1; } 65% { transform: scale(1); opacity: 1; } }
@keyframes sdShipLeft { 0% { transform: translate(0, -50%); opacity: 0; } 18% { opacity: 1; } 100% { transform: translate(-175%, -50%); opacity: 0; } }
/* place: a fresh order slip drops into the (now-empty) order spot */
@keyframes sdPlaceIn { 0%, 12% { transform: translateY(-60%) scale(0.7); opacity: 0; } 45% { transform: translateY(0) scale(1.1); opacity: 1; } 70%, 100% { transform: translateY(0) scale(1); opacity: 1; } }
/* receive: a replenishing shipment slides into the far slot from the supplier (right) */
@keyframes sdArriveR { 0%, 28% { transform: translate(calc(-50% + 150%), -50%); opacity: 0; } 50% { opacity: 1; } 68%, 100% { transform: translate(-50%, -50%); opacity: 1; } }
/* receive: the inventory count gives a soft green tick as the shipment lands */
@keyframes sdReceivePulse { 0%, 60% { transform: scale(1); color: var(--ink); } 73% { transform: scale(1.09); color: var(--good); } 88%, 100% { transform: scale(1); color: var(--ink); } }

.station-demo[data-step="1"] .sd-g-near .sd-units:not(.sd-g-arrive) { animation: sdNearOutL 2.6s ease-in-out infinite; }
.station-demo[data-step="1"] .sd-g-far .sd-units:not(.sd-g-arrive)  { animation: sdFarToNearL 2.6s ease-in-out infinite; }
.station-demo[data-step="1"] .sd-g-arrive { animation: sdArriveR 2.6s ease-in-out infinite; }
.station-demo[data-step="1"] .sd-inventory .sd-count { animation: sdReceivePulse 2.6s ease-in-out infinite; transform-origin: center; }
.station-demo[data-step="2"] .sd-incoming .sd-card { animation: sdPop 1.9s ease-in-out infinite; transform-origin: center; }
.station-demo[data-step="3"] .sd-shipment { animation: sdShipLeft 2.3s ease-in infinite; }
.station-demo[data-step="4"] .sd-o-near .sd-card { animation: sdNearOutR 2.6s ease-in-out infinite; }
.station-demo[data-step="4"] .sd-o-far .sd-card  { animation: sdFarToNearR 2.6s ease-in-out infinite; }
.station-demo[data-step="5"] .sd-o-far .sd-card { animation: sdPlaceIn 2.1s ease-in-out infinite; transform-origin: center; }

@media (prefers-reduced-motion: reduce) {
  .station-demo .sd-units, .station-demo .sd-card, .station-demo .sd-shipment,
  .station-demo .sd-count { animation: none !important; }
}

/* per-team progress strip — same dot vocabulary as the facilitator board */
.present-progress {
  flex: 0 0 auto;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(clamp(150px, 14vw, 230px), 1fr));
  gap: clamp(10px, 1.2vw, 18px);
}
.pteam {
  background: var(--paper-2); border: 1.5px solid var(--line); border-radius: 14px;
  padding: clamp(11px, 1.1vw, 18px); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: clamp(7px, 0.8vh, 11px);
}
.pteam-head { display: flex; align-items: center; gap: 9px; min-width: 0; }
.pteam-head .chip { flex: 0 0 auto; width: clamp(14px, 1.2vw, 18px); height: clamp(14px, 1.2vw, 18px); border-radius: 4px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12); }
.pteam-name { font-family: var(--serif); font-weight: 560; font-size: clamp(16px, 1.5vw, 24px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pteam-week { font-family: var(--mono); font-size: clamp(12px, 1.1vw, 17px); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.pteam .dotcell { gap: clamp(9px, 0.9vw, 14px); }
.pteam .subdot { width: clamp(15px, 1.3vw, 20px); height: clamp(15px, 1.3vw, 20px); }
.pteam .subdot-key { font-size: clamp(9px, 0.8vw, 12px); }
/* Joined-but-waiting dots gently pulse so the room can see who's still deciding. */
.pteam .subdot.waiting { animation: dotpulse 1.7s ease-in-out infinite; }
@keyframes dotpulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* floating step controls — auto-hide, dark pill so they read over any content */
.present-controls {
  position: fixed; left: 50%; bottom: clamp(14px, 2.4vh, 28px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px; z-index: 60;
  background: rgba(44, 38, 32, 0.84); padding: 8px 12px; border-radius: 999px;
  box-shadow: 0 12px 34px -12px rgba(0,0,0,0.55);
  opacity: 0; pointer-events: none; transition: opacity 0.35s ease;
}
.present-controls.show { opacity: 1; pointer-events: auto; }
.present-ctl {
  font-family: var(--sans); font-weight: 700; font-size: 15px; min-height: 40px;
  background: rgba(255,255,255,0.14); color: #fff; border: none; border-radius: 999px;
  padding: 9px 16px; cursor: pointer; transition: background 0.15s ease;
}
.present-ctl:hover { background: rgba(255,255,255,0.26); }
.present-ctl:disabled { opacity: 0.4; cursor: default; }
.present-ctl:focus-visible { outline: 3px solid rgba(255,255,255,0.7); outline-offset: 2px; }
.present-ctl-hint { font-family: var(--mono); font-size: 13px; color: rgba(255,255,255,0.82); padding: 0 4px; font-variant-numeric: tabular-nums; }

/* no-session / error message overlay */
.present-msg {
  position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center;
  background: var(--paper); padding: 40px; text-align: center;
}
.present-msg[hidden] { display: none; }
.present-msg .pm-card { max-width: 540px; }
.present-msg h1 { font-family: var(--serif); font-weight: 560; font-size: clamp(26px, 3vw, 40px); margin: 0 0 12px; }
.present-msg p { color: var(--ink-soft); font-size: 17px; line-height: 1.5; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  .step-detail { animation: none; }
  .pteam .subdot.waiting { animation: none; }
}
