/* Factory game prototype — iDSLab site tokens */
/* Self-hosted fonts (SIL OFL, see fonts/LICENSE-fonts.txt): no request leaves the site's own origin. */
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; src: url(fonts/archivo-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C4,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; src: url(fonts/archivo-latin.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400 600; font-display: swap; src: url(fonts/ibm-plex-sans-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C4,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400 600; font-display: swap; src: url(fonts/ibm-plex-sans-latin.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
:root {
  --navy: #0a1630; --navy-800: #0d1f49; --red: #c8102e; --mist: #f5f7fa; --line: #e4e8ef;
  --ink: #0a1a3f; --slate: #5a6478; --white: #ffffff;
  --deep: #06080f; --panel: #0a1630; --rule: #22262f; --steel: #a7afbf; --paper: #eef2f9;
  --signal: #ff4d63; --amber: #f5b83d; --go: #3fd58a; --idle: #59606e;
  /* Products: A blue (white letter), B white (navy letter + slate outline so it shows on white), C grey (navy letter).
     Status lights keep green / amber / red. Raw material is sand, so it is never mistaken for C. */
  --pA: #2563eb; --pB: #f4f6fa; --pC: #8a93a6; --pRaw: #b08d57;
  --pAink: #ffffff; --pBink: #0a1630; --pCink: #0a1630; --pBline: #5a6478;
  --pInk: #06080f;
  --display: 'Archivo', 'Arial Narrow', Arial, sans-serif;
  --body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 14px; --radius-sm: 8px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--body); font-size: 16px; line-height: 1.5; color: var(--ink);
  background-color: var(--mist);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 24px 24px;
  overflow-x: hidden;
}
.page { max-width: 1248px; margin: 0 auto; padding: 24px 16px 48px; display: grid; gap: 20px; }
[hidden] { display: none !important; }
/* The dashboard stays laid out off-screen while hidden, so opening it never costs a long first layout. */
#dash[hidden] { display: grid !important; position: absolute; left: -10000px; top: 0; width: calc(min(100vw, 1248px) - 32px); visibility: hidden; pointer-events: none; }
h1, h2, h3 { font-family: var(--display); font-weight: 800; letter-spacing: -0.01em; line-height: 1.1; margin: 0; }
h1 { font-size: clamp(30px, 5vw, 48px); }
h2 { font-size: clamp(22px, 3vw, 30px); }
h3 { font-size: 16px; font-weight: 700; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- light sheets ---------- */
.sheet {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; box-shadow: 0 1px 2px rgba(10, 22, 48, .04), 0 8px 24px rgba(10, 22, 48, .05);
  display: grid; gap: 18px; min-width: 0;
}
.eyebrow { font-family: var(--display); font-weight: 700; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--red); }
.lead { font-size: 18px; color: var(--slate); max-width: 68ch; }
.muted { color: var(--slate); }
.small { font-size: 14px; }

.chain { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.chain li { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--mist); min-width: 0; }
.chain b { display: block; font-family: var(--display); font-size: 20px; color: var(--red); }
.chain span { font-size: 14px; color: var(--ink); }

/* buttons: equal size inside a group */
.btn-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 12px; justify-content: start; max-width: 560px; }
.btn-row.single { grid-auto-columns: minmax(220px, 280px); }
.btn {
  font: 600 16px/1 var(--body); min-height: 48px; padding: 0 20px; border-radius: 10px; cursor: pointer;
  border: 1.5px solid var(--navy); background: var(--white); color: var(--navy); width: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
}
.btn.primary { background: var(--red); border-color: var(--red); color: var(--white); }
.btn.primary:hover { background: #a70d26; border-color: #a70d26; }
.btn:hover { background: var(--mist); }
.btn:focus-visible, .seg button:focus-visible, .dial-knob:focus-visible, .dial-step:focus-visible, .order input:focus-visible, .mode button:focus-visible {
  outline: 3px solid var(--amber); outline-offset: 2px;
}

/* mode switch on the light sheet */
.mode { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border: 1.5px solid var(--navy); border-radius: 10px; overflow: hidden; max-width: 560px; }
.mode button { font: 600 15px/1.2 var(--body); min-height: 48px; border: 0; background: var(--white); color: var(--navy); cursor: pointer; padding: 6px 10px; }
.mode button + button { border-left: 1.5px solid var(--navy); }
.mode button[aria-checked="true"] { background: var(--navy); color: var(--white); }
.mode-note { font-size: 15px; color: var(--slate); }
.mode-note b { color: var(--ink); }

.order-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 20px; align-items: start; }
table.order { width: 100%; border-collapse: collapse; font-size: 15px; }
table.order caption { text-align: left; font-family: var(--display); font-weight: 700; font-size: 15px; padding-bottom: 8px; }
table.order th, table.order td { border-bottom: 1px solid var(--line); padding: 7px 6px; text-align: left; vertical-align: middle; }
table.order thead th { font-size: 13px; color: var(--slate); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
table.order td:last-child, table.order th:last-child { text-align: right; }
table.order input { width: 84px; font: 500 15px var(--body); padding: 6px 8px; border: 1px solid #c9d0dc; border-radius: 6px; text-align: right; color: var(--ink); background: var(--white); }
table.order input:disabled { background: var(--mist); color: var(--ink); border-color: var(--line); -webkit-text-fill-color: var(--ink); opacity: 1; }
.pdot { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; border: 1px solid rgba(10, 22, 48, .25); }
.pdot.A { background: var(--pA); } .pdot.B { background: var(--pB); box-shadow: inset 0 0 0 1.5px var(--pBline); } .pdot.C { background: var(--pC); }
.lock { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--slate); }

/* ---------- dark instrument panel ---------- */
.panel {
  background: var(--deep); color: var(--paper); border-radius: var(--radius); padding: 20px;
  border: 1px solid #141924; display: grid; gap: 16px; min-width: 0;
}
.panel h2, .panel h3 { color: var(--paper); }
.dash-top { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 16px; align-items: start; }
.speed-col { display: grid; gap: 6px; }
.pause-hint { font-size: 12.5px; color: var(--steel); max-width: 380px; }
.btn-dark { background: transparent; color: var(--paper); border: 1px solid #2c3240; min-height: 44px; font-size: 15px; width: auto; padding: 0 16px; }
.btn-dark:hover { background: #161c2c; }
.btn-dark:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.coach { margin: 0; padding: 8px 12px; border-radius: 8px; background: rgba(245, 184, 61, .14); border: 1px solid rgba(245, 184, 61, .6); color: #ffe2a6; font-size: 14px; font-weight: 600; }
/* how to play */
.howto { display: grid; gap: 10px; border-top: 1px solid var(--line); padding-top: 16px; }
.how-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-width: 80ch; }
.how-steps li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; align-items: baseline; font-size: 16px; }
.how-steps b { font-family: var(--display); font-weight: 800; font-size: 18px; color: var(--red); }
.how-score { font-size: 15px; }
dialog#howDialog { border: 0; border-radius: var(--radius); padding: 24px; width: min(600px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; color: var(--ink); background: var(--white); }
dialog#howDialog::backdrop { background: rgba(6, 8, 15, .65); }
dialog#howDialog > * + * { margin-top: 12px; }
.clock { display: grid; gap: 8px; min-width: 0; position: relative; }
.clock-line { display: grid !important; grid-template-columns: auto minmax(0, 1fr); align-items: baseline; justify-items: start; }
.clock-line .clock-hint { grid-column: 1 / -1; }
.clock-line .clock-hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-top { position: relative; }
/* toggles + meeting bar (fixed height: never shifts the layout) */
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tg { display: grid; gap: 3px; }
.tg-label { font-size: 11.5px; color: var(--steel); text-transform: uppercase; letter-spacing: .05em; }
.tg .seg button { min-height: 32px; font-size: 13px; }
.meet-bar { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 12px; align-items: center; height: 60px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--rule); background: #0b1226; }
.meet-bar .btn-row.single { grid-auto-columns: 1fr; max-width: none; }
.meet-bar.on { border-color: rgba(245, 184, 61, .7); background: #1d1a10; }
.meet-text { margin: 0; font-size: 13.5px; line-height: 1.35; color: var(--steel); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.meet-bar.on .meet-text { color: #ffe2a6; font-weight: 600; }
.board-money { margin: 0; font-size: 12.5px; color: var(--steel); }
.money-story { margin: 0; font-size: 15px; line-height: 1.45; padding: 10px 12px; border-radius: 8px; background: var(--white); border: 1px solid var(--line); }
.money-story.bad { border-left: 4px solid var(--red); } .money-story.good { border-left: 4px solid #1f9d5c; }
table.pnl td:first-child { text-align: left; }
table.pnl tr.good td:last-child { color: #1f7d4c; } table.pnl tr.bad td:last-child { color: var(--red); }
table.pnl tr.of td { font-size: 13.5px; color: var(--slate); }
table.pnl tr.ideal td { color: var(--navy-800); font-weight: 600; }
.coach { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 6; pointer-events: none; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); background: #2a2210 !important; }
.clock-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; }
.clock-day { font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: .01em; }
.clock-hint { font-size: 14px; color: var(--steel); }
.bar { height: 8px; background: var(--rule); border-radius: 4px; overflow: hidden; position: relative; }
.bar > i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--signal), #ff7a8a); border-radius: 4px; }
.bar .due { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--paper); opacity: .55; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid #2c3240; border-radius: 9px; overflow: hidden; background: #0d1220; }
.seg.cols-3 { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); }
.seg button {
  font: 600 13.5px/1.15 var(--body); color: var(--steel); background: transparent; border: 0; min-height: 40px;
  padding: 4px 4px; cursor: pointer; min-width: 0; overflow-wrap: normal; hyphens: none;
}
.seg button + button { border-left: 1px solid #2c3240; }
.seg.cols-3 button { border-left: 1px solid #2c3240; border-top: 1px solid #2c3240; margin: -1px 0 0 -1px; }
.seg button[aria-checked="true"] { background: var(--paper); color: var(--deep); }
.seg button:hover:not([aria-checked="true"]) { background: #161c2c; color: var(--paper); }
.speed { width: 660px; }   /* five equal buttons; "Planning meeting" fits on one line at desktop width */
.speed button { min-height: 48px; font-size: 14px; line-height: 1.15; white-space: nowrap; padding: 4px 4px; }

.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.kpi { display: grid; grid-template-rows: 16px 30px 18px; }
.kpi > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .k { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--steel); line-height: 16px; }
.kpi .v { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 30px; font-variant-numeric: tabular-nums; }
.kpi .s { line-height: 18px; }
.kpi .s { font-size: 13px; color: var(--steel); font-variant-numeric: tabular-nums; }

/* flow of stations */
.flow { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: auto 30px auto; column-gap: 10px; row-gap: 0; }
.flow > .st-1, .flow > .bf-1 { grid-column: 1; } .flow > .st-2, .flow > .bf-2 { grid-column: 2; }
.flow > .st-3, .flow > .bf-3 { grid-column: 3; } .flow > .st-4, .flow > .bf-4 { grid-column: 4; }
.flow > .st-5, .flow > .bf-5 { grid-column: 5; } .flow > .st-6, .flow > .bf-6 { grid-column: 6; }
.flow > .station { grid-row: 1; } .flow > .buf { grid-row: 3; }
.flow canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
/* Rail segments are placed by game.js (drawRails) along the free lanes of the layout actually shown. */
.rails { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.rail { position: absolute; display: block; border-radius: 5px; border: 1px solid var(--rule);
  background: repeating-linear-gradient(90deg, #1a2030 0 10px, #232a3b 10px 20px); }
.rail.v { background: repeating-linear-gradient(180deg, #1a2030 0 10px, #232a3b 10px 20px); }
.station {
  position: relative; z-index: 1; background: var(--panel); border: 1px solid var(--rule); border-radius: 10px;
  padding: 12px; display: grid; gap: 6px; align-content: start; min-width: 0;
  grid-template-rows: 20px 64px 18px 30px 30px 98px;   /* head · art · status · big · pile · 5 rows: same in every card */
}
.station > * { min-width: 0; overflow: hidden; }
.st-head { height: 20px; align-items: center !important; }
.st-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px !important; }
.st-status { height: 18px; line-height: 18px !important; min-height: 0 !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-big { height: 30px; line-height: 30px !important; white-space: nowrap; }
.st-big .seq { font-size: 16px; }
.station .pile { height: 30px; min-height: 0; flex-wrap: wrap; align-content: flex-start; }
.st-lines { display: grid !important; grid-template-rows: repeat(5, 18px); gap: 2px !important; }
.st-lines .row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; height: 18px; font-size: 12.5px; line-height: 18px; white-space: nowrap; }
.st-lines .row.bar { grid-template-columns: 18px minmax(0, 1fr) 78px; }
.st-lines .rl { overflow: hidden; text-overflow: ellipsis; color: var(--steel); }
.st-lines .rv { color: var(--paper); font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.st-lines .track { height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.st-lines .track i { display: block; height: 100%; }
.st-lines .short { color: var(--signal); margin-left: 4px; display: inline-block; min-width: 3ch; text-align: right; }
.tag { width: 18px; height: 16px; min-width: 18px; padding: 0 !important; display: inline-block; vertical-align: -2px; }
.station::after { /* drop onto the rail */
  content: ""; position: absolute; left: 50%; bottom: -11px; width: 2px; height: 10px; background: var(--rule);
}
/* stock / WIP band */
.buf { position: relative; z-index: 1; border: 1px solid var(--rule); border-radius: 10px; background: #0b1226; padding: 10px 12px;
  display: grid; gap: 5px; align-content: start; min-width: 0; grid-template-rows: 16px 28px 10px 26px 16px; }
.buf > * { min-width: 0; overflow: hidden; }
.buf-name, .buf-sub { white-space: nowrap; text-overflow: ellipsis; line-height: 16px !important; }
.buf-num { white-space: nowrap; line-height: 28px; }
.buf { height: 138px; }   /* every band cell the same fixed size */
/* customer-order tile */
.buf-sum { grid-template-rows: 16px 21px 21px 21px 16px; background: #0b1226; border-style: solid; }
.ord-row { display: grid; grid-template-columns: 18px minmax(0, 1fr) 52px 44px; gap: 5px; align-items: center; font-size: 12px; color: var(--paper); }
.ord-bar { position: relative; height: 8px; border-radius: 4px; background: var(--rule); overflow: visible; }
.ord-fill { position: absolute; inset: 0; border-radius: 4px; transform-origin: left center; transform: scaleX(0); transition: transform .4s ease; }
.ord-tick { position: absolute; top: -3px; width: 2px; height: 14px; margin-left: -1px; background: var(--paper); border-radius: 1px; }
.ord-val { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ord-due { display: inline-flex; align-items: center; gap: 4px; justify-content: flex-end; font-variant-numeric: tabular-nums; color: var(--steel); white-space: nowrap; }
.ord-dot { position: relative; width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; background: var(--go); }
.ord-dot::after { content: '✓'; position: absolute; inset: 0; display: grid; place-items: center; font: 700 8px/1 var(--body); color: var(--pInk); }
.ord-row.risk .ord-dot::after, .risk-dot::after { content: '!'; }
.ord-row.short .ord-dot::after, .short-dot::after { content: '⚠'; font-size: 7px; }
.ord-row.done .ord-dot::after { content: ''; }
.ord-row.risk .ord-dot, .risk-dot { background: var(--amber); }
.ord-row.short .ord-dot, .short-dot { background: var(--signal); }
.ord-row.short .ord-dot { animation: flash .5s steps(2, jump-none) infinite; }
.ord-row.short .ord-due, .ord-row.short .ord-val { color: var(--signal); font-weight: 700; }
.ord-row.done .ord-dot { background: transparent; border: 2px solid var(--go); }
.ok-dot { background: var(--go); }
.legend .ord-dot { vertical-align: -1px; }
.dash-sq { display: inline-block; width: 14px; height: 10px; border: 1.5px dashed var(--amber); border-radius: 3px; }
.buf::before { content: ""; position: absolute; left: 50%; top: -11px; width: 2px; height: 10px; background: var(--rule); }
.buf-name { font-size: 12px; font-weight: 600; color: var(--steel); line-height: 1.25; }
.buf-num { font-size: 13px; color: var(--steel); }
.buf-num b { font-family: var(--display); font-weight: 800; font-size: 22px; color: var(--paper); }
.buf-bar { display: flex; height: 10px; border-radius: 3px; background: var(--rule); overflow: hidden; }
/* vertical product columns (rows 3-5 of a band cell) */
.cols { grid-row: 3 / 6; display: grid; grid-template-columns: repeat(3, minmax(14px, 1fr)); gap: 8px; align-items: end; padding: 0 4px; }
.cols.raw1 { grid-template-columns: minmax(14px, 44px); justify-content: center; }
.col { display: grid; grid-template-rows: 12px 34px 12px; gap: 2px; justify-items: center; min-width: 0; }
.cv { font-size: 11px; line-height: 12px; color: var(--paper); font-weight: 600; font-variant-numeric: tabular-nums; }
.ct { position: relative; width: 100%; max-width: 30px; height: 34px; border-radius: 3px 3px 0 0; background: #141b2c; overflow: visible; }
.cf { position: absolute; inset: 0; border-radius: 3px 3px 0 0; transform-origin: bottom center; transform: scaleY(0); transition: transform .45s ease; }
.cf.A { background: var(--pA); } .cf.B { background: var(--pB); box-shadow: inset 0 0 0 1.5px var(--pBline); } .cf.C { background: var(--pC); } .cf.raw { background: var(--pRaw); }
.pk { position: absolute; left: -2px; right: -2px; bottom: 0; height: 2px; background: var(--amber); }
.cl2 { font-size: 11px; line-height: 12px; font-weight: 700; color: var(--steel); }
.col.zero .ct { background: transparent; border: 1.5px dashed #3a4256; }
.col.zero .cv { color: var(--steel); }
.buf-bar i { display: block; height: 100%; transition: width .4s ease; }
.buf-bar i.A { background: var(--pA); } .buf-bar i.B { background: var(--pB); } .buf-bar i.C { background: var(--pC); } .buf-bar i.raw { background: var(--pRaw); }
.buf-trace { width: 100%; height: 26px; display: block; }
.buf-trace polyline { fill: none; stroke: var(--steel); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.buf-sub { font-size: 11.5px; color: var(--steel); font-variant-numeric: tabular-nums; line-height: 1.35; }
.buf-sum { background: transparent; border-style: dashed; }
.buf.empty { border-color: var(--amber); border-style: dashed; background: rgba(245, 184, 61, .12); animation: emptyflash 1s steps(2, jump-none) infinite; }
.buf.empty .buf-num, .buf.empty .buf-num b { color: var(--amber); }
@keyframes emptyflash { 50% { background: rgba(245, 184, 61, .02); border-color: rgba(245, 184, 61, .35); } }
.st-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: start; }
.st-no { font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1; color: var(--signal); }
.st-name { font-weight: 600; font-size: 14px; line-height: 1.2; color: var(--paper); }
.light { /* site dot system: a circle, fully coloured when on; idle = empty grey ring */
  width: 14px; height: 14px; border-radius: 50%; margin-top: 3px; flex: none;
  border: 2px solid var(--idle); background: transparent; display: inline-block;
}
.light { position: relative; width: 16px !important; height: 16px !important; }
.light::after { position: absolute; inset: 0; display: grid; place-items: center; font: 700 9px/1 var(--body); color: var(--pInk); }
.light.go::after { content: '▶'; font-size: 8px; padding-left: 1px; }
.light.amber::after { content: '⟳'; font-size: 11px; }
.light.down::after { content: '⚠'; font-size: 9px; }
.light.go { background: var(--go); border-color: var(--go); box-shadow: 0 0 10px rgba(63, 213, 138, .5); }
.light.amber { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 10px rgba(245, 184, 61, .45); }
.light.down { background: var(--signal); border-color: var(--signal); box-shadow: 0 0 12px rgba(255, 77, 99, .7); animation: flash .5s steps(2, jump-none) infinite; }
.light.still { animation: none; }
@keyframes flash { 50% { opacity: .2; } }
.st-status { font-size: 13px; color: var(--steel); min-height: 2.4em; line-height: 1.2; }
.st-status.down { color: var(--signal); } .st-status.amber { color: var(--amber); } .st-status.go { color: var(--go); }
.st-big { font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.st-big small { font-family: var(--body); font-weight: 500; font-size: 12px; color: var(--steel); margin-left: 4px; }
.st-lines { font-size: 12.5px; color: var(--steel); display: grid; gap: 2px; font-variant-numeric: tabular-nums; }
.st-lines b { color: var(--paper); font-weight: 600; }
.pile { display: flex; flex-wrap: wrap-reverse; gap: 2px; min-height: 30px; align-content: flex-start; }
.pile i { width: 8px; height: 8px; border-radius: 2px; background: var(--pRaw); transition: opacity .3s; }
.pile i.A { background: var(--pA); } .pile i.B { background: var(--pB); box-shadow: inset 0 0 0 1px var(--pBline); } .pile i.C { background: var(--pC); }
.pile .pg { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-right: 6px; }
.pile .pg .tag { width: 14px; height: 13px; min-width: 14px; font-size: 9.5px; line-height: 13px; vertical-align: 0; }
.pile .pg b { font-size: 11px; line-height: 13px; color: var(--paper); margin: 0 2px 0 1px; font-variant-numeric: tabular-nums; }
.pile .pg { height: 13px; line-height: 13px; }
.station .pile { row-gap: 3px; }
.buf-bar i.B, .st-lines .track i.B, .ord-row[data-p="B"] .ord-fill { box-shadow: inset 0 0 0 1px var(--pBline); }
.pile .more { font-size: 11px; color: var(--steel); line-height: 8px; }
.prod-bars { display: grid; gap: 4px; }
.prod-bar { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 6px; align-items: center; font-size: 12px; color: var(--steel); font-variant-numeric: tabular-nums; }
.prod-bar .track { height: 6px; background: var(--rule); border-radius: 3px; overflow: hidden; }
.prod-bar .track i { display: block; height: 100%; width: 0; }
.tag { display: inline-block; min-width: 18px; padding: 0 4px; border-radius: 4px; font-size: 11px; font-weight: 700; color: var(--deep); text-align: center; line-height: 16px; }
.tag.A { background: var(--pA); color: var(--pAink); } .tag.B { background: var(--pB); color: var(--pBink); box-shadow: inset 0 0 0 1.5px var(--pBline); } .tag.C { background: var(--pC); color: var(--pCink); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--steel); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .light { width: 11px; height: 11px; margin: 0; animation: none; }
.legend .sq { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

.ticker { list-style: none; margin: 0; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; background: #0b0f19;
  font-size: 13.5px; color: var(--steel); display: grid; gap: 3px; min-height: 92px; font-variant-numeric: tabular-nums; }
.ticker li b { color: var(--paper); font-weight: 600; }
.ticker { height: 122px; overflow: hidden; grid-auto-rows: 19px; }
.ticker li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 19px; }
.ticker li.bad b { color: var(--signal); } .ticker li.warn b { color: var(--amber); } .ticker li.knob b { color: var(--pA); }

/* knobs */
.knobs-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.knobs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.kgroup { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 12px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.kgroup h3 { display: flex; gap: 8px; align-items: baseline; font-size: 15px; }
.kgroup h3 b { color: var(--signal); font-family: var(--display); font-weight: 800; }
.kitem { display: grid; gap: 6px; min-width: 0; }
.klabel { font-size: 13px; font-weight: 600; color: var(--paper); display: flex; justify-content: space-between; gap: 8px; }
.klabel .kval { color: var(--amber); font-variant-numeric: tabular-nums; white-space: nowrap; }
.khelp { font-size: 12px; color: var(--steel); line-height: 1.35; }
.dial { display: grid; grid-template-columns: 40px 76px 40px; gap: 10px; align-items: center; justify-content: start; }
.dial-step {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid #2c3240; background: #0d1220; color: var(--paper);
  font: 700 20px/1 var(--body); cursor: pointer; display: grid; place-items: center; padding: 0;
}
.dial-step:hover { background: #161c2c; }
.dial-knob { width: 76px; height: 76px; border-radius: 50%; cursor: grab; touch-action: none; display: block; }
.dial-knob:active { cursor: grabbing; }
.dial-knob svg { width: 100%; height: 100%; display: block; overflow: visible; }
.applies { font-size: 12px; color: var(--amber); min-height: 1.2em; }

/* ---------- results + ranking ---------- */
.result-top { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
table.data tfoot tr.of td { font-weight: 500; font-size: 14px; color: var(--slate); border-bottom: 1px solid var(--line); }
table.data tfoot tr.of td:last-child { color: var(--ink); font-weight: 600; }
.big { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--mist); min-width: 0; }
.big .k { font-size: 13px; color: var(--slate); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.big .v { font-family: var(--display); font-weight: 800; font-size: clamp(28px, 4vw, 40px); line-height: 1.1; color: var(--navy); font-variant-numeric: tabular-nums; }
.big .s { font-size: 14px; color: var(--slate); }
.result-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 20px; align-items: start; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
table.data caption { text-align: left; font-family: var(--display); font-weight: 700; font-size: 15px; padding-bottom: 8px; }
table.data th, table.data td { border-bottom: 1px solid var(--line); padding: 7px 6px; text-align: right; }
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data thead th { font-size: 12.5px; color: var(--slate); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
table.data tfoot td { font-weight: 700; border-bottom: 0; }
.costbar { display: block; height: 6px; background: var(--line); border-radius: 3px; margin-top: 4px; overflow: hidden; }
.costbar i { display: block; height: 100%; background: var(--navy-800); }
.costbar i.pen { background: var(--red); }
.closing { border-left: 4px solid var(--red); padding: 4px 0 4px 16px; font-size: 18px; max-width: 72ch; }
.closing b { font-family: var(--display); }
details.json summary { cursor: pointer; font-weight: 600; color: var(--slate); font-size: 14px; }
details.json pre { background: var(--deep); color: var(--paper); padding: 12px; border-radius: 8px; font-size: 12px; overflow: auto; max-height: 280px; white-space: pre-wrap; word-break: break-all; }
table.rank tr.mine td { background: #fff4f6; font-weight: 600; }
table.rank td.player { text-align: left; }
.sample { color: var(--slate); font-style: italic; }

/* order sheet extras */
.stack { display: grid; gap: 12px; align-content: start; min-width: 0; }
.rule-note { font-size: 14px; color: var(--ink); background: #fff4f6; border: 1px solid #f3c9d1; border-radius: 8px; padding: 10px 12px; }
table.order tr.total td { font-weight: 700; border-bottom: 0; }
table.order th[rowspan] { vertical-align: top; padding-top: 12px; }
.mode-chip { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--deep); background: var(--amber); border-radius: 4px; padding: 1px 6px; }
.kseq { display: grid; gap: 6px; }
/* product wheel: three slot cards (fixed size whatever the cycle) */
.wheel { display: grid; grid-template-rows: auto 18px 32px; gap: 6px; }
.slot-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.slot-card { display: grid; gap: 3px; min-width: 0; }
.slot-label { font-size: 11.5px; color: var(--steel); text-transform: uppercase; letter-spacing: .05em; }
.slotseg { grid-auto-flow: row !important; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.slotseg button { min-height: 30px; font: 800 14px var(--display); border-left: 1px solid #2c3240; border-top: 1px solid #2c3240; margin: -1px 0 0 -1px; }
.slotseg button[data-v="A"][aria-checked="true"] { background: var(--pA); color: var(--pAink); }
.slotseg button[data-v="B"][aria-checked="true"] { background: var(--pB); color: var(--pBink); box-shadow: inset 0 0 0 1.5px var(--pBline); }
.slotseg button[data-v="C"][aria-checked="true"] { background: var(--pC); color: var(--pCink); }
.slotseg button[data-v="-"][aria-checked="true"] { background: #2a3040; color: var(--paper); }
.cycle-text { margin: 0; font-size: 13px; font-weight: 600; color: var(--paper); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wheel.dim .slot-row { opacity: .55; }
.seq-note { margin: 0; font-size: 12px; line-height: 1.35; color: var(--steel); overflow: hidden; }
.seq-note.warn { color: var(--amber); font-weight: 600; }

.ksub { font-size: 12px; color: var(--steel); }
.seg.dim button { opacity: .55; }

/* planning board + knobs */
.control-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
/* Below the fold on open: let the browser skip its layout/paint until it scrolls near (keeps opening under 50 ms). */
.control-grid > .board, .control-grid > .knob-area { content-visibility: auto; contain-intrinsic-size: auto 900px; }
/* Result screen: the long parts below the fold render when they scroll near, so showing the result never blocks. */
#explain, #resultSheet .result-grid, #closingBand, details.json { content-visibility: auto; contain-intrinsic-size: auto 700px; }
.board, .knob-area { display: grid; gap: 12px; min-width: 0; align-content: start; }
.board { background: var(--panel); border: 1px solid var(--rule); border-radius: 10px; padding: 14px;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: 20px; }
.board > .board-head, .board > .stop-warn { grid-column: 1 / -1; }
.board-top > .stop-warn { grid-column: auto; }
.board-head { display: grid; gap: 4px; }
.board-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kpending { font-size: 12px; font-weight: 600; color: var(--amber); }
.btile { border: 1px solid var(--rule); border-radius: 8px; padding: 8px 10px; background: #0b1226; min-width: 0; }
.btile.wide { grid-column: 1 / -1; }
.btile .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--steel); }
.btile .v { font-family: var(--display); font-weight: 800; font-size: 22px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.btile .v.small-v { font-size: 18px; }
.btile .v small { font-family: var(--body); font-weight: 500; font-size: 12px; color: var(--steel); }
.btile .s { font-size: 12px; color: var(--steel); font-variant-numeric: tabular-nums; }
.delta { font-size: 12.5px; font-weight: 600; min-height: 1.2em; font-variant-numeric: tabular-nums; }
.delta.good { color: var(--go); } .delta.bad { color: var(--signal); }
/* planning-meeting hint: space always reserved; shown only while the clock stands still */
.meeting-hint { grid-column: 1 / -1; margin: 0; min-height: 2.7em; font-size: 13px; line-height: 1.35; color: #ffe2a6; visibility: hidden; }
.board.meeting .meeting-hint { visibility: visible; }
.board-top { grid-column: 1; display: grid; gap: 8px; border-radius: 10px; outline: 2px solid transparent; outline-offset: 4px; transition: outline-color .3s, box-shadow .3s; }
.board.meeting .board-top { outline-color: rgba(245, 184, 61, .85); box-shadow: 0 0 18px rgba(245, 184, 61, .25); }
.stop-warn.ok { background: rgba(63, 213, 138, .08); border-color: rgba(63, 213, 138, .35); color: #b9f0d3; }
.stop-warn { min-height: 2.6em; margin: 0; padding: 8px 10px; border-radius: 8px; background: rgba(255, 77, 99, .14); border: 1px solid rgba(255, 77, 99, .5); color: #ffd0d6; font-size: 13.5px; font-weight: 600; }
.table-wrap { overflow-x: auto; max-width: 100%; }
.board-table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--paper); }
.board-table th, .board-table td { border-bottom: 1px solid var(--rule); padding: 6px 4px; text-align: right; white-space: nowrap; }
.board-table th:first-child, .board-table td:first-child, .board-table tfoot th { text-align: left; }
.board-table thead th { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--steel); white-space: normal; }
.board-table tfoot th, .board-table tfoot td { border-bottom: 0; font-weight: 700; }
.board-table .muted { color: var(--steel); }
.board-table td.st.ok { color: var(--go); } .board-table td.st.warn { color: var(--amber); } .board-table td.st.bad { color: var(--signal); font-weight: 700; }
.knobs { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* result extras */
.stop-note { font-size: 16px; color: var(--red); font-weight: 600; max-width: 72ch; }
.name-box { display: grid; gap: 6px; max-width: 520px; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; background: var(--mist); }
.name-box label[for] { font-weight: 600; }
.name-box input[type=text] { font: 500 16px var(--body); min-height: 44px; padding: 8px 12px; border: 1px solid #c9d0dc; border-radius: 8px; color: var(--ink); background: var(--white); width: 100%; }
.name-box input[type=text]:focus-visible, .check input:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.check { display: flex; gap: 8px; align-items: center; color: var(--slate); }
/* invitation and signed-in note share one grid cell: swapping them never shifts the page */
.invite-slot { display: grid; }
/* closing band (dark instrument style); visitor / client variants share one grid cell */
.closing-band { gap: 12px; padding: 28px; }
.closing-band h2 { font-size: clamp(22px, 3vw, 32px); }
.close-body { max-width: 72ch; font-size: 17px; line-height: 1.5; color: var(--paper); margin: 0; }
.close-slot { display: grid; }
/* watch Bottleneck Buster */
.watch-bar, .watch-end { display: grid; grid-template-columns: auto minmax(0, 1fr) 220px; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--signal); background: #1d0f16; }
.watch-end { grid-template-columns: minmax(0, 1fr) 600px; }
.watch-end p { margin: 0; color: var(--paper); font-weight: 600; }
.watch-title { font-family: var(--display); font-weight: 800; color: var(--paper); }
.watch-bar .btn-row { max-width: none; }
.watch-bar .btn, .watch-end .btn { min-height: 40px; width: 100%; font-size: 14px; }
.meet-bar.watch { border-color: var(--signal); background: #1d0f16; }
.meet-bar.watch .meet-text { color: var(--paper); font-weight: 600; }
.locked { opacity: .6; }
.bb-cursor { position: absolute; left: 0; top: 0; z-index: 1000; pointer-events: none; transform: translate(-200px, -200px); transition-property: transform; transition-timing-function: cubic-bezier(.4, 0, .2, 1); }
.bb-cursor svg { display: block; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5)); }
.bb-label { position: absolute; left: 22px; top: 20px; white-space: nowrap; background: var(--red); color: #fff; font: 700 11px/1 var(--body); padding: 4px 6px; border-radius: 4px; }
.bb-ripple { position: absolute; left: -12px; top: -12px; width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--amber); opacity: 0; }
.bb-cursor.click .bb-ripple { animation: bbclick .45s ease-out; }
@keyframes bbclick { from { opacity: 1; transform: scale(.3); } to { opacity: 0; transform: scale(1.6); } }
table.rank tr.ref td { background: #eef3ff; font-weight: 600; }
table.rank td.star { font-size: 16px; color: var(--amber); }
.badge.refb { background: var(--red); }
.close-slot > * { grid-area: 1 / 1; display: grid; gap: 8px; }
.close-q { margin: 0; font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--amber); }
.closing-band .btn-row { max-width: 560px; }
.closing-band .btn-dark { width: 100%; min-height: 48px; font-size: 16px; }
.close-client { visibility: hidden; }
.close-slot.client .close-visitor { visibility: hidden; }
.close-slot.client .close-client { visibility: visible; }
.close-note { margin: 0; font-size: 12.5px; color: var(--steel); }
.invite-slot > * { grid-area: 1 / 1; }
.invite { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; }
.invite h4 { margin: 0; font-family: var(--display); font-size: 16px; }
.invite p { margin: 0; font-size: 14px; }
.invite .btn-row { max-width: none; }
.signed { margin: 0; align-self: start; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 4px; font-weight: 600; color: #1f7d4c; visibility: hidden; }
.invite-slot.client .invite { visibility: hidden; }
.invite-slot.client .signed { visibility: visible; }
.badge { display: inline-block; margin-left: 8px; padding: 0 6px; border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--white); background: var(--navy-800); vertical-align: 1px; font-style: normal; }
table.data tr.sub td { font-weight: 700; border-top: 2px solid var(--line); }
table.data th.player { text-align: left; }

/* station illustrations: transform + opacity animations only; speed follows --spd on #flow */
.flow { --spd: 1; }
.st-art { height: 64px; margin: -2px 0 0; }
.st-art svg { display: block; width: 100%; height: 100%; overflow: visible; }
.st-art .ln { stroke: var(--rule); stroke-width: 2; }
.st-art .bd { fill: #0d1f49; stroke: var(--steel); stroke-width: 1.2; }
.st-art .door { fill: var(--deep); stroke: var(--steel); stroke-width: 1; }
.st-art .cargo { fill: #16203a; stroke: var(--steel); stroke-width: 1.2; }
.st-art .cab { fill: #1b2a52; stroke: var(--steel); stroke-width: 1.2; }
.st-art .win { fill: var(--steel); opacity: .55; }
.st-art .wh { fill: var(--deep); stroke: var(--steel); stroke-width: 1.5; }
.st-art .crate { fill: var(--pRaw); stroke: var(--deep); stroke-width: 1; }
.st-art .pA { fill: var(--pA); } .st-art .pB { fill: var(--pB); } .st-art .pC { fill: var(--pC); }
.st-art .teeth { fill: none; stroke: var(--steel); stroke-width: 6; stroke-dasharray: 4 3.4; }
.st-art .hub { fill: #1b2a52; stroke: var(--steel); stroke-width: 1.5; }
.st-art .axle { fill: var(--paper); }
.st-art .frame { fill: #1b2a52; stroke: var(--steel); stroke-width: 1.2; }
.st-art .rod { fill: #2a3a63; stroke: var(--steel); stroke-width: 1.2; }
.st-art .die { fill: var(--steel); }
.st-art .part { fill: var(--part, var(--pRaw)); stroke: var(--deep); stroke-width: 1; }
.st-art .lamp { fill: transparent; stroke: var(--idle); stroke-width: 2; }
.st-art.s-run .lamp { fill: var(--go); stroke: var(--go); }
.st-art.s-change .lamp { fill: var(--amber); stroke: var(--amber); }
.st-art.s-change .frame { fill: rgba(245, 184, 61, .3); }
.st-art.s-down .lamp { fill: var(--signal); stroke: var(--signal); animation: flash .5s steps(2, jump-none) infinite; }
.st-art .spark { stroke: var(--amber); stroke-width: 1.6; stroke-linecap: round; }
.st-art .sparks { opacity: 0; }
.st-art .head { fill: #c9d0dc; } .st-art .body { fill: #2a3a63; stroke: var(--steel); stroke-width: 1.2; }
.st-art .arm-l { stroke: #c9d0dc; stroke-width: 3; stroke-linecap: round; }
.st-art .glass { fill: rgba(167, 175, 191, .18); stroke: var(--paper); stroke-width: 2.2; }
.st-art .loadbg { fill: var(--deep); }
.st-art .load { fill: var(--steel); transform-box: fill-box; transform-origin: left center; transform: scaleX(0); }
.st-art .gear, .st-art .ram, .st-art .lens, .st-art .a-truck-in, .st-art .a-truck-out, .st-art .a-unload { transform-box: fill-box; transform-origin: center; }
.st-art .arm { transform-box: view-box; transform-origin: 41px 48px; }
.art-1 .a-truck-in, .art-1 .a-unload { opacity: 0; }
.art-1.on .a-truck-in { animation: truckIn calc(1.2s / var(--spd)) linear infinite; }
.art-1.on .a-unload { animation: unload calc(1.2s / var(--spd)) linear infinite; }
.art-2.on .g1 { animation: spin calc(2.4s / (var(--spd) * var(--act, 1))) linear infinite; }
.art-2.on .g2 { animation: spin calc(1.6s / (var(--spd) * var(--act, 1))) linear infinite reverse; }
.art-3.on .ram { animation: ram calc(.6s / var(--spd)) ease-in-out infinite alternate; }
.art-4.on .arm { animation: weld calc(.9s / var(--spd)) ease-in-out infinite alternate; }
.art-4.on .sparks { animation: spark calc(.3s / var(--spd)) steps(2, jump-none) infinite; }
.art-5.on .lens { animation: scan calc(1.6s / var(--spd)) ease-in-out infinite alternate; }
.art-6.on .a-truck-out { animation: truckOut calc(1.2s / var(--spd)) linear infinite; }
@keyframes truckIn { 0% { transform: translateX(-100px); opacity: 0; } 10% { opacity: 1; } 40%, 90% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(0); opacity: 0; } }
@keyframes unload { 0%, 42% { transform: translateX(-6px); opacity: 0; } 50% { opacity: 1; } 85% { transform: translateX(16px); opacity: 1; } 100% { transform: translateX(16px); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ram { from { transform: translateY(0); } to { transform: translateY(8px); } }
@keyframes weld { from { transform: rotate(-7deg); } to { transform: rotate(6deg); } }
@keyframes spark { 50% { opacity: 1; } }
@keyframes scan { from { transform: translateX(0); } to { transform: translateX(26px); } }
@keyframes truckOut { 0%, 55% { transform: translateX(0); opacity: 1; } 100% { transform: translateX(90px); opacity: 0; } }

/* story, scenario prep, ideal search */
.story { display: grid; gap: 10px; max-width: 72ch; }
.story p { margin: 0; }
.scen-no { font-family: var(--body); font-size: 15px; font-weight: 600; color: var(--slate); margin-left: 8px; }
.scen-prep { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border: 1px dashed var(--line); border-radius: 10px; color: var(--slate); font-weight: 600; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--red); animation: spin .8s linear infinite; flex: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.ideal-prog { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 12.5px; color: var(--steel); margin: 2px 0 0; }
.ideal-prog-bar { display: block; height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.ideal-prog-bar i { display: block; height: 100%; width: 100%; background: var(--amber); transform-origin: left center; transform: scaleX(0); transition: transform .25s linear; }
.ideal-wait { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 10px; align-items: center; font-size: 14px; color: var(--slate); }
.ideal-wait .ideal-prog-bar { background: var(--line); }
.ideal { display: grid; gap: 10px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.ideal h4 { font-size: 17px; }
.ideal-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ideal-tiles > div { display: grid; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--mist); min-width: 0; }
.ideal-tiles .k { font-size: 12px; color: var(--slate); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.ideal-tiles b { font-family: var(--display); font-size: 22px; color: var(--navy); }
.ideal-tiles .s { font-size: 13px; color: var(--slate); }
.ideal-gap { font-size: 15px; }
table.cmp th, table.cmp td { text-align: left; vertical-align: top; font-size: 14px; }
table.cmp td.yi { white-space: nowrap; }
table.cmp td.yi span:first-child { color: var(--slate); text-decoration: line-through; text-decoration-color: rgba(200, 16, 46, .5); }
table.cmp .eff { display: block; font-size: 12.5px; color: var(--slate); margin-top: 2px; white-space: normal; }
table.cmp .eff.good { color: #1f7d4c; font-weight: 600; } table.cmp .eff.bad { color: var(--red); font-weight: 600; }
.score-line { font-size: 15px; background: var(--mist); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
table.rank td.sc { font-weight: 700; font-family: var(--display); }
.rank-note { font-size: 15px; font-weight: 600; color: var(--ink); background: #fff4f6; border: 1px solid #f3c9d1; border-radius: 8px; padding: 8px 12px; }

/* Bottleneck Buster */
.ideal h5 { margin: 6px 0 0; font-family: var(--display); font-size: 15px; font-weight: 700; }
.bb-intro { font-size: 15px; font-style: italic; color: var(--navy-800); }
table.bb-day0 tr.same td, table.bb-day0 tr.same th { color: var(--slate); }
table.bb-day0 tr.diff td.yours { color: var(--red); font-weight: 600; }
table.bb-day0 td.hers { font-weight: 600; white-space: nowrap; }
table.bb-day0 td.why { font-size: 13px; color: var(--slate); }
.tagd { display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 4px; background: var(--red); color: var(--white); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; vertical-align: 1px; }
.bb-meetings { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.bb-meetings li { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--white); display: grid; gap: 4px; font-size: 14px; }
.bb-meetings li.bb-quiet { background: var(--mist); color: var(--slate); }
.bb-meetings li.decisive { border-color: var(--red); box-shadow: inset 4px 0 0 var(--red); }
.bb-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.bb-move { font-weight: 600; color: var(--navy-800); }
.bb-why { margin: 0; font-size: 13.5px; color: var(--ink); }
.bb-you { margin: 0; font-size: 13px; color: var(--slate); }
.bb-quiet .bb-you { display: block; }
li.diff .bb-you { color: var(--red); }
.bb-end { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bb-end > div { display: grid; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: var(--mist); min-width: 0; }
.bb-end .k { font-size: 12px; color: var(--slate); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.bb-end b { font-family: var(--display); font-size: 22px; color: var(--navy); }
.bb-end .s { font-size: 13px; color: var(--slate); }

/* result explanation */
.explain { display: grid; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 16px; background: var(--mist); }
.explain h3 { font-size: 20px; }
.explain h4 { margin: 0 0 6px; font-family: var(--display); font-size: 15px; font-weight: 700; }
.x-headline { font-size: 17px; font-weight: 600; padding: 8px 12px; border-radius: 8px; background: var(--white); border-left: 4px solid var(--navy-800); }
.x-meetings { margin: 0; font-size: 14.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.bb-compare { margin: 0; font-size: 14px; color: var(--slate); }
.feasible-note { margin: 0; font-size: 14px; font-weight: 600; color: #1f7d4c; }
.x-headline.bad { border-left-color: var(--red); color: var(--red); }
.x-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.x-col { display: grid; gap: 8px; align-content: start; min-width: 0; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; max-height: 460px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--white); }
.timeline li { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.4; border-left: 3px solid transparent; }
.timeline li:last-child { border-bottom: 0; }
.tl-day { font-weight: 600; color: var(--slate); white-space: nowrap; }
.timeline li.bad { border-left-color: var(--red); } .timeline li.bad .tl-text { color: #8f0b21; }
.timeline li.warn { border-left-color: var(--amber); }
.timeline li.good { border-left-color: #1f9d5c; }
.timeline li.knob { border-left-color: var(--navy-800); background: #f7f9fd; }
.causes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cause { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; display: grid; gap: 4px; }
.cause-head { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; align-items: baseline; font-size: 15px; }
.cause-rank { font-family: var(--display); font-weight: 800; color: var(--red); }
.cause-num { font-size: 14px; color: var(--ink); white-space: nowrap; }
.cause .costbar i { background: var(--red); }
.hints { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 15px; }
table.rank th.cl, table.rank td.cl { width: 72px; text-align: left; padding-left: 4px; padding-right: 4px; }
table.rank td.cl .badge { margin-left: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- phone ---------- */
@media (max-width: 1100px) {
  .board { grid-template-columns: minmax(0, 1fr); }
  .dash-top { grid-template-columns: minmax(0, 1fr) auto; }
  .dash-top .speed-col { grid-column: 1 / -1; grid-row: 2; }
  .speed { width: 100%; }
}
/* 3 + 3: each row keeps its own rail lane (station · rail · band, as on desktop); a 30 px lane between the rows and
   22 px side gutters carry the turn from 03 to 04, so the flow never runs over a card. */
@media (max-width: 1100px) {
  .flow { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto 30px auto 30px auto 30px auto; row-gap: 0; padding: 0 22px; }
  .flow > .st-1, .flow > .st-2, .flow > .st-3 { grid-row: 1; } .flow > .bf-1, .flow > .bf-2, .flow > .bf-3 { grid-row: 3; }
  .flow > .st-4, .flow > .st-5, .flow > .st-6 { grid-row: 5; } .flow > .bf-4, .flow > .bf-5, .flow > .bf-6 { grid-row: 7; }
  .flow > .st-1, .flow > .bf-1, .flow > .st-4, .flow > .bf-4 { grid-column: 1; }
  .flow > .st-2, .flow > .bf-2, .flow > .st-5, .flow > .bf-5 { grid-column: 2; }
  .flow > .st-3, .flow > .bf-3, .flow > .st-6, .flow > .bf-6 { grid-column: 3; }
}
@media (max-width: 760px) {
  .flow { grid-template-rows: none; row-gap: 10px; padding: 0 0 0 26px; }
  .flow > .station, .flow > .buf { grid-row: auto; grid-column: auto; }
  .flow > .st-1 { order: 1; } .flow > .bf-1 { order: 2; } .flow > .st-2 { order: 3; } .flow > .bf-2 { order: 4; }
  .flow > .st-3 { order: 5; } .flow > .bf-3 { order: 6; } .flow > .st-4 { order: 7; } .flow > .bf-4 { order: 8; }
  .flow > .st-5 { order: 9; } .flow > .bf-5 { order: 10; } .flow > .st-6 { order: 11; } .flow > .bf-6 { order: 12; }
  .flow > .buf { margin-top: -4px; }
  .buf::before { display: none; }
  .station::after { display: block; left: -17px; bottom: auto; top: 22px; width: 16px; height: 2px; }
  .page { padding: 16px 16px 40px; gap: 16px; }
  .sheet { padding: 20px 16px; }
  .panel { padding: 16px 12px; }
  .chain { grid-template-columns: repeat(2, 1fr); }
  .btn-row, .btn-row.single { grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: 1fr; max-width: none; }
  .order-grid, .result-grid { grid-template-columns: minmax(0, 1fr); }
  .dash-top { grid-template-columns: minmax(0, 1fr); }
  .btn-dark { width: 100%; }
  .watch-bar, .watch-end { grid-template-columns: minmax(0, 1fr); }
  .closing-band { padding: 20px 16px; }
  .meet-bar { grid-template-columns: minmax(0, 1fr); height: 132px; padding: 10px 12px; align-content: center; }
  .meet-text { -webkit-line-clamp: 3; }
  dialog#howDialog { padding: 18px 16px; }
  .how-steps li { font-size: 15px; }
  .speed { width: 100%; }
  .speed button { font-size: 12.5px; padding: 2px 3px; white-space: normal; }
  .clock-line { grid-template-columns: auto minmax(0, 1fr); }
  .clock-line .clock-hint { grid-column: 1 / -1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis .kpi:first-child { grid-column: 1 / -1; }
  .flow { grid-template-columns: minmax(0, 1fr); }
  .result-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .x-grid { grid-template-columns: minmax(0, 1fr); }
  .ideal-tiles, .bb-end { grid-template-columns: minmax(0, 1fr); }
  table.bb-day0 td.why { display: none; }
  table.bb-day0 th:nth-child(4) { display: none; }
  table.cmp td.yi { white-space: normal; }
  .ideal-prog, .ideal-wait { grid-template-columns: 80px minmax(0, 1fr); }
  .timeline li { grid-template-columns: 54px minmax(0, 1fr); font-size: 13.5px; padding: 6px 8px; }
  table.rank th.cl, table.rank td.cl { width: 58px; }
  table.order input { width: 72px; }
  table.data { font-size: 13.5px; }
  table.data th, table.data td { padding: 6px 3px; }
  table.data thead th { font-size: 11px; letter-spacing: 0; white-space: normal; vertical-align: bottom; }
  table.data td .costbar { max-width: 100%; }
  .board-table th:nth-child(2), .board-table td:nth-child(2), .board-table th:nth-child(6), .board-table td:nth-child(6) { display: none; }
  .board-table tfoot th { white-space: normal; }
  .board-table td.st { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  .light.down { animation: none; }
  .pile i { transition: none; }
  .buf.empty { animation: none; }
  .ord-row.short .ord-dot { animation: none; }
  .ord-fill { transition: none; }
  .cf { transition: none; }
  .st-art *, .st-art.on * { animation: none !important; }
  .art-1.on .a-truck-in { opacity: 1; transform: none; }
  .buf-bar i { transition: none; }
  .spinner { animation: none; border-top-color: var(--line); }
  .bb-cursor { transition: none !important; }
  .bb-cursor.click .bb-ripple { animation: none; opacity: 1; }
  .board-top { transition: none; }
  html { scroll-behavior: auto; }
}
