:root {
  color-scheme: dark;
  --ink: #f5f1df;
  --muted: #b3c8c7;
  --panel: #173941;
  --line: #52716f;
  --amber: #ffd17a;
  --mint: #bcebcf;
  --danger: #ffd1a5;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: #0b2027;
  color: var(--ink);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button {
  min-height: 44px;
  border: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:disabled { cursor: default; }
button:focus-visible { outline: 3px solid #ffe1a2; outline-offset: 3px; }
h1, h2, p { margin: 0; }
.primary, .ghost { border-radius: 12px; padding: 10px 14px; line-height: 1.3; }
.primary { background: var(--amber); color: #29342d; font-weight: 750; }
.primary:disabled { background: #536b68; color: #c0cfca; }
.ghost { border: 1px solid var(--line); background: #173b44; color: #eaf1e6; font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.op-art svg, .art { display: block; width: 100%; height: 100%; }
.notice { margin: 4px 0; padding: 8px 11px; border-radius: 9px; background: #4e3c2d; color: #ffe0b2; font-size: 12px; line-height: 1.5; }
.qa { padding: 4px 8px; background: #3c415e; color: #ebeaff; text-align: center; font-size: 11px; }

/* The level map shares the workshop's materials and palette. */
.wrap { width: min(100%, 560px); margin: auto; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.mast { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 17px 20px 8px; font-size: 11px; letter-spacing: .04em; color: var(--muted); }
.build { color: var(--amber); }
.intro { margin: 8px 14px 23px; padding: 17px 14px 14px; border: 1px solid #395e62; border-radius: 22px; background: #15353d; }
.intro h1 { font-size: clamp(30px, 8vw, 38px); font-weight: 800; line-height: 1.2; letter-spacing: -.04em; text-align: center; }
.hero-scene { margin: 14px 0; overflow: hidden; border-radius: 14px; background: #0e272e; }
.hero-scene img { display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; object-position: center 51%; }
.intro > .primary { display: block; width: min(100%, 360px); min-height: 48px; margin: auto; font-size: 16px; }
.intro .intro-guide { margin-top: 10px; color: #c7d8cf; font-size: 12px; line-height: 1.5; text-align: center; }
.home-progress { display: flex; align-items: center; gap: 10px; width: min(88%, 300px); margin: 13px auto 0; color: var(--amber); font-size: 11px; font-weight: 700; }
.home-progress progress { width: 100%; height: 6px; appearance: none; border: 0; border-radius: 5px; background: #3e5b5b; overflow: hidden; }
.home-progress progress::-webkit-progress-bar { background: #3e5b5b; border-radius: 5px; }
.home-progress progress::-webkit-progress-value { background: var(--amber); border-radius: 5px; }
.home-progress progress::-moz-progress-bar { background: var(--amber); border-radius: 5px; }
.home-progress span { flex: none; font-variant-numeric: tabular-nums; }
.chapter { padding: 0 16px 21px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 11px; }
.section-head h2 { font-size: 17px; letter-spacing: .02em; }
.section-head span { color: var(--muted); font-size: 11px; }
.levels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.level { display: flex; align-items: center; gap: 9px; min-width: 0; min-height: 76px; padding: 10px; border: 1px solid #466562; border-radius: 13px; background: #17373f; text-align: left; }
.level:disabled { background: #142c34; border-color: #2e4a4e; color: #a2b4b4; }
.level:disabled .level-emblem { opacity: .45; }
.level-emblem { display: grid; justify-items: center; gap: 2px; width: 35px; flex: 0 0 35px; }
.level-emblem .art { width: 35px; height: 30px; }
.number { color: var(--amber); font-family: ui-monospace, monospace; font-size: 10px; font-weight: 700; }
.level:disabled .number { color: #a3b8b5; }
.level-label { min-width: 0; }
.level-label strong { display: block; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.level-label small { display: block; margin-top: 4px; color: #bed5c9; font-size: 10px; line-height: 1.3; }
.home-foot { padding: 0 20px 12px; color: #a4bcb9; font-size: 11px; text-align: center; }

/* A single portrait stage, with the scene behind every game control. */
.game.immersive { position: relative; isolation: isolate; container-type: inline-size; display: flex; flex-direction: column; width: 100%; max-width: 520px; height: 100vh; height: 100dvh; margin: auto; overflow: hidden; background: #10272d; }
.immersive > .scene { position: absolute; inset: 0; z-index: -1; overflow: hidden; background: #10272d; }
.scene-host, .scene-fallback, .foundry3d-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene-transition { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.scene-fallback { display: block; object-fit: cover; object-position: center 45%; }
.scene-host.has-foundry3d .scene-fallback { visibility: hidden; }
.ladle-scene-fallback { display: none; }
.ladle-ready .scene-host:not(.has-foundry3d) .scene-side { visibility: hidden; }
.ladle-ready .scene-host:not(.has-foundry3d) .ladle-scene-fallback { display: block; }
.foundry3d-canvas:focus-visible { outline: 3px solid var(--amber); outline-offset: -4px; }
.scene-side { display: grid; place-items: center; background: radial-gradient(ellipse at 50% 60%, #486459, #142f30); }
.scene-side svg { width: min(65%, 360px); height: auto; }
.scene-hud { z-index: 2; flex: none; padding: max(5px, env(safe-area-inset-top)) max(9px, env(safe-area-inset-right)) 0 max(9px, env(safe-area-inset-left)); }
.scene-nav { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.scene-nav button { flex: none; min-width: 44px; padding: 6px 9px; border: 1px solid #547571; border-radius: 11px; background: #12313be8; font-size: 21px; white-space: nowrap; }
.scene-nav .mission { min-width: 0; flex: 1; text-align: center; font-size: 14px; line-height: 1.3; text-shadow: 0 2px 4px #10202b; }
.scene-nav .mission b { font-weight: 750; }
.scene-nav .mission small { display: block; margin-top: 2px; color: #d5d4a7; font-size: 9px; }
.scene-instruments { padding: 7px 7px 5px; border: 1px solid #5f7b7399; border-radius: 13px; background: #102f39eb; }
.resources { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 3px 7px; margin-top: 6px; padding-top: 5px; border-top: 1px solid #63807966; color: #bbd1c9; font-size: 10px; line-height: 1.3; }
.resources span { white-space: nowrap; }
.resources b { margin-left: 3px; color: #fff0c6; font-weight: 650; font-variant-numeric: tabular-nums; }
.batch-tabs { display: flex; gap: 6px; margin-top: 5px; }
.batch-tabs button { flex: 1; min-width: 0; border: 1px solid #577b75; border-radius: 11px; background: #15353de8; font-size: 12px; }
.batch-tabs .active { color: #25352e; background: #edce8b; border-color: #ffe5ab; font-weight: 750; }
.furnace-target { position: absolute; z-index: 1; left: var(--target-x, 50%); top: var(--target-y, 43%); transform: translate(-50%, -50%); display: grid; place-items: center; width: clamp(48px, calc(2 * var(--target-radius, 10cqi)), 102px); height: auto; aspect-ratio: 1; padding: 0; border-radius: 50%; background: transparent; touch-action: none; }
.target-ring { position: absolute; inset: 0; border: 2px dashed #ffe0a1; border-radius: 50%; box-shadow: 0 0 0 2px #0f3038a0, 0 0 20px #f8aa3338; pointer-events: none; }
.target-label { position: absolute; bottom: calc(100% + 6px); padding: 5px 9px; border: 1px solid #c6a878; border-radius: 8px; background: #112b31ed; color: #fff4d5; font-size: 11px; font-weight: 700; white-space: nowrap; pointer-events: none; }
.furnace-target.armed .target-ring, .furnace-target.drop-ready .target-ring { border: 3px solid #ffdb82; box-shadow: 0 0 0 3px #263c30, 0 0 22px #fcb947ab; }
.furnace-target.drop-over .target-ring { border-color: #d7ffa3; background: #b5ee6740; box-shadow: 0 0 25px #d1f19c; }
.scene-view { position: absolute; z-index: 1; right: 10px; top: 47%; display: grid; justify-items: end; gap: 5px; pointer-events: none; color: #e9edda; font-size: 9px; }
.scene-view > span { padding: 3px 6px; border-radius: 6px; background: #102e35c9; }
.scene-rotate { display: none; min-width: 44px; min-height: 44px; border: 1px solid #829c8b; border-radius: 12px; background: #14353ce0; color: #fff1ca; font-size: 23px; pointer-events: auto; }
.immersive:has(.has-foundry3d) .scene-rotate { display: block; }

/* Tools, feedback and the next action always stay together. */
.scene-panel { display: flex; flex-direction: column; flex: none; gap: 5px; z-index: 2; margin-top: auto; max-height: 36%; padding: 8px max(10px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); border-top: 1px solid #708e8166; border-radius: 18px 18px 0 0; background: linear-gradient(180deg, #12343cda, #0b2730f5); }
.scene-panel.is-complete { max-height: min(64%, 330px); background: linear-gradient(180deg, #12343c, #0b2730); }
.tray-heading { display: flex; align-items: center; justify-content: space-between; flex: none; gap: 8px; min-height: 16px; padding: 0 2px; font-size: 12px; line-height: 1.3; }
.tray-heading b { color: #ffdda0; font-weight: 650; }
.tray-heading > span, .phase-detail { color: #bcd1c8; font-size: 10px; text-align: right; }
.tool-tray:empty { display: none; }
.tool-tray { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px,1fr)); justify-content: center; flex: none; gap: 7px; }
.tool { position: relative; display: grid; grid-template-columns: 25px minmax(0,1fr); align-items: center; gap: 4px; min-width: 0; min-height: 53px; padding: 5px; border: 1px solid #7f9790; border-radius: 12px; background: #e8eedf; color: #263d36; text-align: center; touch-action: none; user-select: none; -webkit-user-select: none; }
.tool .op-art { width: 25px; height: 30px; pointer-events: none; }
.tool .op-art svg > rect { fill: transparent; }
.tool .op-art svg > circle { opacity: 0; }
.tool strong { font-size: 11px; line-height: 1.1; font-weight: 700; white-space: nowrap; pointer-events: none; }
.tool-copy { display: grid; gap: 3px; text-align: left; min-width: 0; pointer-events: none; }
.tool.selected { border-color: #ffd581; background: #ffe0a2; box-shadow: inset 0 0 0 2px #c7923d, 0 0 13px #ffcd6933; }
.tool[aria-disabled="true"], .tool:disabled { border-color: #526f6c; background: #29494d; color: #bed0c5; }
.tool[aria-disabled="true"] .op-art, .tool:disabled .op-art { opacity: .48; filter: saturate(.35); }
.tool[aria-disabled="true"]::after { content: "!"; position: absolute; top: 3px; right: 4px; display: grid; place-items: center; width: 12px; height: 12px; border: 1px solid #c4b486; border-radius: 50%; color: #f5d795; font-size: 9px; font-weight: 700; }
.tool.replacement { border-style: dashed; }
.tool.drag-source { opacity: .5; }
.tool-skip { touch-action: manipulation; }
.tool-ghost { position: fixed; z-index: 20; left: 0; top: 0; width: 58px; height: 58px; border: 2px solid #f6bf5e; border-radius: 14px; background: #f9df9f; box-shadow: 0 5px 20px #071a21aa; pointer-events: none; }
.tool-ghost svg { display: block; width: 100%; height: 100%; }
.feedback { flex: none; min-height: 15px; padding: 0 2px; color: #d3e5d7; font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.feedback.warn { color: #ffd29a; }
.scene-actions { display: flex; align-items: stretch; flex: none; gap: 7px; min-height: 44px; }
.scene-actions .ghost { width: 44px; min-width: 44px; flex: 0 0 44px; padding: 5px 2px; border-color: #537671; border-radius: 11px; font-size: 20px; }
.scene-actions .primary { flex: 1; min-width: 0; min-height: 44px; padding: 7px 10px; border-radius: 11px; font-size: 14px; }
.scene-actions .ghost:disabled { opacity: .42; }
.scene-actions .action-caption { display: flex; align-items: center; justify-content: center; flex: 1; min-width: 0; padding: 5px; color: #bdd0c5; font-size: 11px; line-height: 1.3; text-align: center; }
.result-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); flex: none; gap: 8px; }
.result-actions button { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; min-height: 44px; font-size: 14px; font-weight: 700; }
.result-actions button span { font-size: 19px; line-height: 1; }
.report { scrollbar-width: thin; scrollbar-color: #75958b transparent; flex: 0 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 7px 9px; border: 1px solid #66857a70; border-radius: 11px; background: #1b4048; color: #e6f0df; }
.report h2 { font-size: 13px; line-height: 1.3; color: #f8d696; }
.report p { margin-top: 4px; color: #c3d9cd; font-size: 12px; line-height: 1.5; }
.batch-ready { display: flex; align-items: center; gap: 10px; padding-block: 12px; }
.ready-icon { display: grid; place-items: center; flex: 0 0 35px; height: 35px; border: 1px solid #8fbc9c; border-radius: 50%; background: #335f53; color: #d1f5c8; font-size: 23px; }
.inspection { display: grid; grid-template-columns: 30px minmax(0, 1fr); align-items: center; gap: 3px 7px; }
.is-selecting .inspection h2 { display: none; }
.is-selecting .inspection .op-art { grid-row: 1; }
.inspection .op-art { grid-row: 1 / span 2; width: 30px; height: 30px; }
.diffs { display: flex; flex-wrap: wrap; gap: 3px 6px; font-size: 11px; line-height: 1.3; }
.diffs span { white-space: nowrap; }
.diffs s { color: #b5cbc3; text-decoration: none; }
.diffs b { color: #e6f6cf; font-weight: 750; }
.issues { grid-column: 1 / -1; margin: 3px 0 0; padding-left: 17px; color: #ffd39f; font-size: 11px; line-height: 1.4; }
.scene-success { display: grid; grid-template-columns: 64px minmax(0, 1fr); flex: 0 1 auto; align-items: center; gap: 4px 8px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 2px; }
.victory-art { grid-column: 1; grid-row: 1 / span 3; width: 64px; }
.victory-art svg { width: 100%; height: auto; }
.scene-success h2 { grid-column: 2; color: #ffda89; font-size: 21px; line-height: 1.2; }
.scene-success p { grid-column: 2; color: #e7eed9; font-size: 12px; line-height: 1.4; }
.scene-success .finish-feedback { color: #fff1c3; font-size: 14px; font-weight: 700; }
.scene-score { display: flex; flex-wrap: wrap; gap: 4px 10px; grid-column: 2; color: #c0dcc6; font-size: 11px; line-height: 1.4; }
.scene-score span:not(:first-child) { white-space: nowrap; }
.scene-score b { color: #eff4d2; font-variant-numeric: tabular-nums; }
.scene-score [data-work-hours-result], .scene-score [data-work-hours-goal] { font-size: 13px; }
.scene-score [data-work-hours-goal] { color: #ffdd92; }
.scene-score .score-badge { color: #ffdd92; }

/* Every sheet has a stable close control and readable, full-width choices. */
.sheet-bg { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; padding: 0 8px; background: #04131bc7; }
.sheet { width: min(100%, 504px); max-height: calc(100dvh - 28px); overflow-y: auto; overscroll-behavior: contain; padding: 12px 16px max(18px, env(safe-area-inset-bottom)); border: 1px solid #648077; border-bottom: 0; border-radius: 22px 22px 0 0; background: #173941; box-shadow: 0 -12px 50px #0514197a; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet h2 { flex: 1; color: #ffe0a3; font-size: 18px; line-height: 1.35; }
.sheet-close { flex: 0 0 44px; width: 44px; min-height: 44px; padding: 0; border: 1px solid #587970; border-radius: 12px; background: #21454b; color: #e7f0dc; font-size: 24px; line-height: 1; }
.sheet p { margin: 9px 0 17px; color: #d4e1d7; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.sheet .actions { display: flex; flex-direction: column; gap: 8px; }
.sheet .actions button { width: 100%; min-height: 46px; flex: none; padding: 11px 14px; font-size: 14px; text-align: center; }
.sheet .actions .ghost { border-color: #66877a; background: #23494f; }

@media (min-width: 700px) and (min-height: 600px) {
  .game.immersive { max-width: min(520px, 56.25dvh); box-shadow: 0 0 90px #010a10; }
  .wrap { padding-top: 10px; }
  .sheet-bg { align-items: center; }
  .sheet { border-bottom: 1px solid #648077; border-radius: 22px; }
}
@media (max-width: 340px) {
  .scene-hud { padding-inline: 7px; }
  .scene-nav .mission { font-size: 12px; }
  .scene-panel { padding-inline: 8px; gap: 4px; max-height: 38%; }
  .tool-tray { gap: 6px; }
  .metric { font-size: 10px; }
  .resources { gap: 3px 5px; font-size: 9px; }
  .chapter { padding-inline: 12px; }
  .level { gap: 6px; padding: 8px; }
  .level-label strong { font-size: 12px; }
  .sheet { padding-inline: 13px; }
}
@media (max-height: 690px) {
  .scene-panel { max-height: 40%; padding-top: 6px; gap: 4px; }
  .scene-instruments { padding-top: 5px; }
  .scene-nav { margin-bottom: 4px; }
  .report { padding-block: 5px; }
  .scene-success h2 { font-size: 19px; }
}
@media (max-height: 440px) and (orientation: landscape) {
  .scene-hud { width: 100%; }
  .scene-panel { max-height: 64%; width: min(52%, 360px); margin-left: auto; }
  .scene-nav .mission { font-size: 11px; }
  .scene-view { right: 54%; top: 58%; }
}
@media (prefers-reduced-motion: no-preference) {
  .primary, .ghost, .level { transition: background-color .15s, border-color .15s; }
  .victory-art { animation: workshop-arrive .3s ease-out both; }
  @keyframes workshop-arrive { from { opacity: .3; transform: scale(.8) rotate(-7deg); } to { opacity: 1; transform: scale(1) rotate(0); } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}

/* Illustrated manual: one scrollable booklet, with a visible close and exit. */
.home-manual { display: block; margin: 7px auto 0; padding: 7px 14px; min-height: 44px; border: 1px solid #57756f; border-radius: 11px; background: #20434a; color: #ffe0a3; font-size: 13px; }
.sheet-body { margin: 9px 0 17px; color: #d4e1d7; font-size: 14px; line-height: 1.7; }
.manual-sheet { display: flex; flex-direction: column; height: min(850px, 94dvh); max-height: 94dvh; padding: 10px 12px max(10px, env(safe-area-inset-bottom)); overflow: hidden; }
.manual-sheet .sheet-head, .manual-sheet .actions { flex: none; }
.manual-sheet .sheet-head { padding: 0 3px 8px; border-bottom: 1px solid #54746a; }
.manual-sheet .sheet-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 0 9px; scrollbar-width: thin; scrollbar-color: #8aa593 transparent; }
.manual-sheet .sheet-body p { margin: 7px 0 0; font-size: 13px; line-height: 1.65; }
.manual-content { padding: 12px 3px 6px; }
.manual-lead { padding: 8px 10px 17px; text-align: center; }
.manual-lead > span { display: block; color: #b9d9c7; font-size: 11px; letter-spacing: .08em; }
.manual-lead > strong { display: block; margin-top: 6px; color: #ffe0a3; font-size: 23px; line-height: 1.45; }
.manual-card { margin-bottom: 12px; padding: 13px 12px; border: 1px solid #53776f; border-radius: 15px; background: #12313a; }
.manual-content h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: #ffe0a3; font-size: 15px; line-height: 1.45; }
.manual-content h3 em { display: grid; place-items: center; flex: none; width: 25px; height: 25px; border-radius: 50%; background: #f6d493; color: #234139; font-size: 14px; font-style: normal; }
.manual-meters { display: flex; justify-content: center; align-items: center; gap: 18px; margin: 13px 0; }
.manual-meters > div { display: grid; grid-template-columns: auto auto; gap: 0 10px; align-items: baseline; min-width: 95px; padding: 8px 12px; border: 1px solid #ce9c65; border-radius: 12px; background: #31443e; }
.manual-meters b { color: #ffda8e; font-size: 23px; }.manual-meters small { grid-column: 1/-1; font-size: 11px; }
.manual-meters .met-good { border-color: #91cba6; background: #234b46; }.met-good b { color: #c1f5cb; }.manual-meters i { color: #eec67e; font-style: normal; }
.manual-drag { display: flex; justify-content: space-around; align-items: center; gap: 5px; padding: 5px 0 10px; }
.manual-tool { display: grid; justify-items: center; gap: 3px; font-size: 11px; text-align: center; line-height: 1.4; }
.manual-tool svg { width: 58px; height: 48px; }.manual-tool b { font-weight: 600; }
.manual-arrow { display: grid; justify-items: center; color: #ffcf7a; font-size: 40px; line-height: 1; }.manual-arrow small { margin-top: 8px; color: #d0e0d1; font-size: 10px; white-space: nowrap; }
.manual-furnace { width: 90px; display: grid; justify-items: center; font-size: 11px; }.manual-furnace svg { width: 90px; height: 90px; }
.manual-result { padding: 8px 10px; border-radius: 9px; background: #28504e; font-size: 11px; }.manual-result span { display: block; color: #ffda94; }.manual-result b { color: #d2f2d2; }
.manual-symbols { display: flex; justify-content: space-around; gap: 5px; margin: 12px 0 7px; }.manual-symbols .manual-tool svg { width: 46px; height: 40px; }
.manual-cta { display: grid; justify-items: center; gap: 8px; padding: 8px; color: #c6edc9; font-size: 12px; }.manual-cta span { padding: 8px 16px; border-radius: 9px; background: #ffd17a; color: #29342d; font-weight: 700; }
.manual-recovery { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }.manual-recovery span { padding: 5px 7px; border-radius: 8px; border: 1px solid #74917e; font-size: 11px; }
.manual-example { padding: 13px 12px; border: 1px dashed #d2b678; border-radius: 15px; background: #30483d; }.manual-example ol { margin: 0; padding-left: 22px; font-size: 13px; line-height: 1.8; }.manual-example li + li { margin-top: 6px; }
.manual-content .manual-footnote { padding: 6px 8px; color: #b3ccbf; font-size: 11px; }
@media(max-width:340px){.manual-card{padding:11px 9px}.manual-content h3{font-size:14px}.manual-meters{gap:10px}.manual-lead>strong{font-size:21px}.manual-symbols .manual-tool{font-size:10px}}

body:has(#modal .sheet-bg) { overflow: hidden; }
.manual-sheet .sheet-body:focus-visible { outline: 2px solid #d5bc80; outline-offset: -2px; }

.hero-scene { position: relative; }
.scene-caption { position: absolute; right: 8px; bottom: 8px; padding: 4px 8px; border-radius: 6px; background: #102e35ed; color: #fff1ca; font-size: 11px; }
.score-unit { display: flex; justify-content: space-between; gap: 6px; margin: 0 0 4px; padding: 0 2px; color: #ffe0a3; font-size: 10px; }
.score-unit span { color: #bed5c9; }
.furnace-target[hidden] { display: none; }
.furnace-target[data-station="ladle"] {
  width: var(--ladle-width);
  height: var(--ladle-height);
  min-height: 0;
  transform: none;
  border-radius: 0;
  clip-path: var(--ladle-outline);
}
.furnace-target[data-station="ladle"] > .target-ring,
.furnace-target[data-station="ladle"] > .target-label { display: none; }
.furnace-target[data-station="ladle"].armed,
.furnace-target[data-station="ladle"].drop-ready { background: #ffcc631f; }
.furnace-target[data-station="ladle"].drop-over,
.furnace-target[data-station="ladle"]:focus-visible { background: #c6f7aa57; }
.immersive:has(.furnace-target[data-station="ladle"]) .scene-view { top: 34%; }
.scene-replay { pointer-events: auto; min-height: 44px; padding: 6px 9px; border: 1px solid #829c8b; border-radius: 10px; background: #14353ce0; color: #fff1ca; font-size: 11px; }

.scene-replay { display: none; }
.immersive:has(.has-foundry3d) .scene-replay, .scene-replay[data-do="skim"] { display: block; }
.scene-view .scene-cutaway { display: none; color: #b6cdca; }
.immersive:has(.has-foundry3d) .scene-cutaway { display: block; }
.immersive:has(.is-complete) .scene-view { top: 41%; display: flex; }
.immersive:has(.is-complete) .scene-view > span { display: none; }
.immersive.is-animating .furnace-target { visibility: hidden; }
.immersive.is-animating .scene-panel .report { display: none; }
.immersive.is-animating .scene-replay { border-color: #ffda86; color: #ffda86; }

/* Navigation stays inside the workshop; the level map is an overlay. */
.scene-nav .scene-menu-icon { display: grid; place-items: center; padding: 9px; }
.scene-menu-icon svg { display: block; width: 23px; height: 23px; }
.level-sheet { display: flex; flex-direction: column; max-height: min(90dvh,760px); overflow: hidden; }
.level-sheet .sheet-head,.level-sheet .actions { flex: none; }
.level-sheet .sheet-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #8aa593 transparent; }
.level-progress { display: flex; align-items: center; gap: 12px; margin: 0 2px 14px; font-size: 12px; color: #ffda89; }
.level-progress span { flex: none; }
.level-progress progress { width: 100%; height: 6px; accent-color: #ffd17a; }
.level-sheet .chapter { padding: 0; margin: 0 0 17px; }
.level-sheet h3 { margin: 0 0 8px; color: #d3e4d5; font-size: 13px; }
.level-sheet .levels { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; }
.level-sheet .level { display: grid; justify-items: center; align-content: center; gap: 5px; min-height: 98px; padding: 7px 3px; text-align: center; }
.level-sheet .level-emblem { display: flex; align-items: center; justify-content: center; gap: 4px; width: auto; }
.level-sheet .level-emblem .art { width: 32px; height: 30px; }
.level-sheet .level-label { display: block; }
.level-sheet .level-label strong { font-size: 11px; line-height: 1.3; }
.level-sheet .level-label small { margin: 3px 0 0; font-size: 10px; }
.level-sheet .level[aria-current="step"] { border-color: #ffd17a; box-shadow: inset 0 0 0 1px #ffd17a; background: #314b43; }

/* The first furnace teaches on the working controls. */
.first-tools { background: linear-gradient(165deg,#26434bfa,#112932fa 68%); border-top-color: #8eaaa5; box-shadow: inset 0 2px #c0d4cf1a; }
.first-brief { display: flex; align-items: center; justify-content: flex-start; gap: 8px; padding: 2px 3px 3px; }
.first-brief > span { color: #f8cc83; font-size: 12px; border-right: 1px solid #849692; padding-right: 8px; }
.first-brief strong { color: #f2f3e7; font-size: 15px; text-wrap: balance; }
.first-tools .tool-tray { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.first-tools .tool { grid-template-columns: 36px minmax(0,1fr); gap: 7px; padding: 6px 8px; min-height: 60px; border-radius: 10px; color: #f4f0db; background: linear-gradient(155deg,#466066,#30454c 70%); border-color: #819591; box-shadow: inset 0 1px #bacbc333,0 2px 2px #07192166; }
.first-tools .tool .op-art { width: 36px; height: 37px; }
.first-tools .tool strong { font-size: 15px; }
.first-tools .tool.selected { border-color: #ffda82; box-shadow: inset 0 0 0 1px #ffda82; }
.first-tools .scene-actions .feedback { flex: 1; min-width: 0; align-self: center; padding-inline: 4px; font-size: 12px; }
.first-furnace .furnace-target:not(.armed) .target-label { color: #ffe3a9; }
.first-furnace .furnace-target:not(.armed):not(.drop-ready) .target-ring { inset: 21% 0; }
.sheet.manual-sheet { position: relative; }
.sheet.manual-sheet #next-click-button { position: absolute; top: 10px; right: 70px; }
@media (prefers-reduced-motion:no-preference) {
 .first-brief { animation: furnace-brief-in .28s ease-out both; }
 @keyframes furnace-brief-in { from { opacity: 0; transform: translateY(6px); } }
}
@media (max-height:620px) {
 .first-tools .tool { min-height: 54px; }
 .first-tools .tool .op-art { height: 35px; }
}

.scene-nav .voice-cue { font-size: 14px; min-height: 44px; }
.first-furnace .resources[hidden] { display: none; }
.level-goal { padding: 6px 10px; background: #153039ed; color: #fff2c7; font-size: 14px; }
.clock-face { position: relative; width: 13px; height: 13px; margin-right: 2px; border: 1px solid currentColor; border-radius: 50%; }
.clock-hand { position: absolute; left: calc(50% - .5px); bottom: 50%; width: 1px; height: 4px; background: currentColor; transform-origin: center bottom; }

.dose-playing .phase-detail, .dose-playing .tool-tray, .dose-playing .scene-actions .primary { visibility: hidden; }
.dose-playing .feedback { color: #f6e3bc; font-size: 13px; }
.dose-recap { grid-column: 1 / -1; color: #d9e8db; margin: 0; font-size: 12px; }

@media (max-height:440px) and (orientation:landscape) {
 .dose-scene .scene-view, .immersive:has(.furnace-target) .scene-view { top:42%; left:auto; right:10px; display:flex; align-items:center; }
 .dose-scene .scene-view > span, .immersive:has(.furnace-target) .scene-view > span { display:none; }
}

.tap-sequence .phase-detail, .awaiting-dose .scene-replay { display:none; }
.tap-level { display:flex; align-items:center; gap:8px; color:#e3ecdf; font-size:11px; }
.tap-level i { height:8px; width:102px; border-radius:3px; border:1px solid #90a5a5; background:repeating-linear-gradient(to right,transparent 0 calc(33.333% - 1px),#163740 calc(33.333% - 1px) 33.333%),linear-gradient(to right,#f6af51 var(--received,0%),#36565e var(--received,0%)); }
.awaiting-dose .tool[data-op="deox"] { border:2px solid #ffcb71; justify-self:start; min-width:116px; }
.awaiting-dose .furnace-target[data-station="ladle"] { background:#ffcf6429; }
.tap-sequence.awaiting-dose .scene-replay { display:none; }

.tap-level b { min-width:3ch; color:#ffdb9d; font-variant-numeric:tabular-nums; }
.fallback-flow { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
.dose-scene .scene-host:not(.has-foundry3d) .ladle-scene-fallback { display:block; }
.dose-scene .scene-host:not(.has-foundry3d) .scene-side { visibility:hidden; }

.slag-marker { position:absolute; z-index:1; transform:translate(calc(-100% - 30px),calc(-100% - 16px)); padding:3px 9px; border:1px solid #d9a477; border-radius:5px; background:#392d27f5; color:#fff0cb; font-size:14px; font-weight:700; line-height:1.2; pointer-events:none; white-space:nowrap; }
.slag-marker::after { content:""; position:absolute; width:35px; height:2px; left:100%; bottom:0; background:#ffe3a8; transform-origin:left; transform:rotate(28deg); }
.slag-marker::before { content:""; position:absolute; width:5px; height:5px; left:calc(100% + 28px); bottom:-18px; background:#ffe3a8; border:1px solid #4c352a; border-radius:50%; }
.tap-detail { position:absolute; z-index:1; transform:translate(-50%,-50%); border:1px solid #8baca6; border-radius:12px; background:#172d33; pointer-events:none; }
.immersive:has(.fallback-flow) .scene-replay { display:block; }
.immersive.tap-sequence.awaiting-dose .scene-replay { display:none; }

.port-marker { position:absolute; z-index:1; transform:translate(calc(-100% - 26px),1px); border-radius:4px; padding:2px 6px; color:#e2f2f0; background:#1c343bea; border:1px solid #8badad; font-size:11px; font-weight:650; line-height:1.2; pointer-events:none; }
.port-marker::after { content:""; position:absolute; top:1px; left:100%; width:26px; height:1px; background:#c9e9e5; transform:rotate(-6deg); transform-origin:left; }
.scene-host:not(.has-foundry3d) :is(.slag-marker,.port-marker) { display:none; }
.route-marker { position:absolute; z-index:1; transform:translate(-70%,7px); padding:4px 9px; border:1px solid #88c7be; border-radius:5px; background:#133a40f2; color:#e9ffef; font-size:13px; font-weight:700; line-height:1.25; white-space:nowrap; pointer-events:none; }
.route-marker::after { content:""; position:absolute; left:70%; bottom:100%; height:7px; border-left:1px solid #aee3ce; }
.scene-host:not(.has-foundry3d) .route-marker { display:none; }
.bay-marker { position:absolute; z-index:1; transform:translate(-50%,-50%); padding:5px 10px; border:1px solid #93ad98; border-radius:3px; background:#214844; color:#fff5d8; font-weight:750; font-size:14px; letter-spacing:.05em; white-space:nowrap; pointer-events:none; }
.scene-host:not(.has-foundry3d) .bay-marker, .immersive:has(.furnace-target[data-station="ladle"]):not(.is-animating) .tap-detail { display:none; }

/* Tool tray and the matching worksite cue */
.tool, .first-tools .tool { display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 4px; min-height: 59px; }
.tool .op-art, .first-tools .tool .op-art { width: 49px; height: 35px; }
.tool strong, .first-tools .tool strong { font-size: 13px; line-height: 1.15; }
.tool-time { font-size: 10px; line-height: 1.1; opacity: .78; white-space: nowrap; }
.target-tool:not(:empty) { width: 32px; height: 32px; border-radius: 50%; overflow: hidden; background: #ffe3ad; border: 2px solid #ffc767; pointer-events: none; }

.forecast-title { color: #ffdc90; font-size: 12px; }
.forecast-title:not([hidden]) + .current-title { display: none; }
.cost-preview:not(:empty) { margin-left: 2px; }
.scene-panel.is-selecting .inspection, .scene-panel.is-selecting .action-caption { display: none; }
@media (max-height: 440px) { .tool, .first-tools .tool { flex-direction: row; min-height: 44px; } .tool .op-art { width: 34px; } }

.current-title { display: flex; flex: 1; justify-content: space-between; }

.metrics { display:flex; justify-content:space-around; align-items:center; gap:2px; }
.metric { display:flex; align-items:center; justify-content:center; flex-wrap:nowrap; gap:6px; padding:2px; min-width:0; }
.gauge-column { position:relative; width:8.5px; height:58px; flex:none; margin-right:3px; }
.segments { height:100%; display:flex; flex-direction:column-reverse; gap:1px; padding:0; background:#10282e; }
.segments > i { position:relative; display:block; flex:1; min-height:0; }
.segments b { display:block; height:100%; border-radius:1px; background-color:#314b51; }
.segments .gauge-fade { position:absolute; inset:0; pointer-events:none; background:#10282e; }
.segments .filled { background-color:#7cdd94; }
.segments .excess { background:repeating-linear-gradient(125deg,transparent 0 3px,#983e3a 3px 4px),#ff766d; }
.segments .possible { opacity:.46; }
.segments .missing { box-shadow:inset 0 0 0 1px #f38076; background-color:#442e32; }
.goal-brace { position:absolute; left:calc(100% + 1px); width:4px; border:solid #b0eec0; border-width:1px 1px 1px 0; }
.gauge-caption { display:grid; gap:2px; justify-items:start; line-height:1.05; }
.metric-name { display:flex; align-items:center; gap:2px; white-space:nowrap; font-size:11px; }
.metric-name svg { width:14px; height:14px; }
.gauge-reading { display:grid; justify-items:start; min-width:2ch; color:#abecb8; font:700 19px/1 system-ui,sans-serif; font-variant-numeric:tabular-nums; white-space:nowrap; }
.gauge-reading > strong { grid-area:1/1; font:inherit; }
.metric[data-outside=true] .v, .gauge-reading > [data-outside=true] { color:#ffaaa0; }
.goal-value { font-size:10px; color:#c0d2c9; }
.metric.projected { background-color:#ffffff0b; }
.cost-preview:not(:empty) { color:#ffdc90; font-style:normal; }
@media (max-width:360px), (max-height:660px) {
 .gauge-column { height:46px; width:6.5px; }
 .metric { gap:4px; padding-inline:0; }
 .metric-name svg { width:11px; height:11px; }
 .gauge-reading { font-size:16px; }
}

.skim-demo { display:block; width:100%; height:auto; border-radius:10px; }
.skim-caption { min-height:2.8em; margin:.6em 0 0; }

.skim-scene {
 position:absolute; z-index:2; top:50%; left:50%;
 transform:translate(-50%,-50%); width:min(calc(100% - 28px),420px);
 background:#172e35; color:#f2eee1; border:1px solid #8baca6; border-radius:12px;
 pointer-events:none; overflow:hidden;
}
.skim-scene .skim-caption { padding:0 12px 8px; font-size:14px; }
.scene-host:has(.skim-scene) :is(.route-marker,.bay-marker) { visibility:hidden; }
.immersive:has(.skim-scene,.is-skimming) .scene-view > :not(.scene-replay) { display:none; }
.immersive:has(.skim-scene) .scene-panel>.feedback { visibility:hidden; }
@media (orientation:portrait) {
 .immersive:has(.skim-scene,.is-skimming) .scene-view { top:auto; bottom:16%; }
}
@media (orientation:landscape) and (max-height:500px) {
 .skim-scene { top:68%; left:25%; width:min(45%,330px); }
}

/* Puzzle work orders and their reference table. */
.puzzle-game .score-unit { align-items:center; }
.process-button { min-height:32px; padding:3px 8px; border:1px solid #638278; border-radius:8px; background:#1a3b40; color:#ffe6ae; font-size:12px; }
.order-targets { margin-top:5px; color:#ffe7ab; font-size:11px; text-align:center; }
.order-tabs button { min-height:35px; }
.order-tabs button:disabled { opacity:.55; }
.process-sheet { display:flex; flex-direction:column; max-height: min(720px,90dvh); }
.process-sheet .sheet-body { min-height:0; overflow-y:auto; }
.process-sheet .actions { flex:none; }
.process-list p { margin:0 0 8px; color:#ffe3a3; }
.process-list h3 { margin:8px 0 3px; color:#ffe3a3; font-size:13px; }
.process-list ul { margin:0; padding:0; list-style:none; }
.process-list li { display:grid; grid-template-columns:auto 1fr; gap:0 8px; padding:6px 0; border-bottom:1px solid #54746a; }
.process-list li span { justify-self:end; color:#ffe3a3; }
.process-list li small { grid-column:1/-1; color:#c9ddd2; }
.puzzle-game .tool-time { white-space:nowrap; }
@media (max-height:620px) and (orientation:portrait) {
 .puzzle-game .scene-panel { max-height:none; }
 .puzzle-game .tool-tray { gap:4px; }
 .puzzle-game .tool:not(.first-tools .tool) { min-height:44px; padding:3px; }
 .puzzle-game .level-goal { padding-block:3px; font-size:12px; }
 .puzzle-game .report.inspection { max-height:44px; }
}
@media (max-width:360px) and (max-height:540px) and (orientation:portrait) {
 .puzzle-game:not(.first-furnace) .tool-tray { grid-template-columns:repeat(auto-fit,minmax(66px,1fr)); }
 .puzzle-game:not(.first-furnace) .tool { grid-template-columns:18px minmax(0,1fr); gap:2px; }
 .puzzle-game:not(.first-furnace) .tool .op-art { width:18px; height:24px; }
 .puzzle-game:not(.first-furnace) .tool strong { font-size:10px; }
}

.work-budget { display:block; text-align:center; margin-top:4px; padding:4px 6px; border-radius:8px; background:#173942ed; color:#fff2c7; font-size:12px; line-height:1.3; }
.work-budget b,.dispatch-result strong { color:#ffe0a0; font-variant-numeric:tabular-nums; }
.work-budget .clock-face { display:inline-block; vertical-align:middle; }
@media (max-width:360px) and (max-height:540px) and (orientation:portrait) {
 .puzzle-game .gauge-column { height:34px; }
 .puzzle-game .process-button { min-height:24px; }
 .puzzle-game .scene-panel:has(.drag-source) .inspection { display:none; }
}

.puzzle-game .focus-indicator { outline: 2px solid #ffda89; outline-offset: -2px; border-radius: 6px; }
.puzzle-game .carbon-voice-cue {
 background: #60492e;
 box-shadow: 0 0 0 3px #ffda8970, 0 0 13px #ffb85888;
}
@media (prefers-reduced-motion: no-preference) {
 .puzzle-game .carbon-voice-cue { animation: carbon-voice-pulse 1s ease-in-out infinite; }
 @keyframes carbon-voice-pulse {
  0%, 100% { background: transparent; box-shadow: 0 0 0 0 #ffda8900; }
  50% { background: #60492e; box-shadow: 0 0 0 4px #ffda8980, 0 0 15px #ffb858aa; }
 }
}
.puzzle-game .resources .focus-indicator { padding: 1px 5px; background: #514530; color: #fff1c6; }
.puzzle-game .current-title { color: #ffe0a3; font-weight: 650; }

.dispatch-game { max-width:650px; margin:auto; padding:14px clamp(10px,3vw,22px) 32px; color:#f6eedc; }
.dispatch-game header,.dispatch-actions,.dispatch-score,.dispatch-load footer { display:flex; align-items:center; gap:7px; }
.dispatch-game header>div { flex:1; }
.dispatch-game h1 { font-size:clamp(19px,5vw,26px); }
.dispatch-game header small,.dispatch-game h2 small { color:#b2ccc3; font-size:11px; }
.dispatch-game button { border-radius:8px; background:#254c52; padding:6px 10px; }
.dispatch-game .primary,.dispatch-load footer button { background:#fad49a; color:#25332c; font-weight:700; }
.dispatch-game button:disabled { opacity:.45; }
.dispatch-brief { margin:9px 0; color:#ffe2ab; font-size:14px; }
.dispatch-plant { display:flex; gap:7px; }
.iron-source { flex:1; min-width:0; display:grid; justify-items:center; padding:6px 2px; border:1px solid #42646b; border-radius:10px; background:linear-gradient(#254753,#152d32); }
.iron-source img { width:auto; height:clamp(58px,10vh,90px); max-width:100%; object-fit:contain; }
.iron-source span,.iron-source small { font-size:11px; }
.iron-source span { color:#a4e6bc; }
.iron-source small { color:#efd8b8; }
.dispatch-board { margin:9px 0; padding:10px; background:#183a40; border-radius:10px; }
.dispatch-score { justify-content:space-between; font-size:13px; margin-bottom:7px; }
.dispatch-score b { color:#ffcd7c; }
.dispatch-score span { font-size:12px; }
.dispatch-lane { display:grid; grid-template-columns:56px 1fr; align-items:center; gap:5px; margin:4px 0; }
.dispatch-lane>b { font-size:13px; }
.dispatch-lane>b small { display:block; font-size:10px; color:#bbd5ca; }
.track { position:relative; min-height:30px; background:repeating-linear-gradient(to right,#10292e 0 9.5%,#254549 9.5% 10%); border-radius:5px; overflow:hidden; }
.slot { position:absolute; top:1px; bottom:1px; background:#679d92; color:#081f24; border-left:1px solid #1c4a45; text-align:center; font:700 11px/14px system-ui; }
.slot small { display:block; font-size:9px; }
.slot.late { background:#efaa87; }
.time-probe { display:flex; align-items:center; gap:4px; font-size:12px; }
.time-probe input { flex:1; min-width:40px; min-height:28px; accent-color:#f5c77e; }
.dispatch-game h2 { font-size:17px; margin:12px 0 6px; }
.dispatch-game h2 small { font-weight:400; }
.hold-note { font-size:12px; margin:4px 0; }
.dispatch-loads { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,205px),1fr)); gap:7px; }
.dispatch-load { padding:8px 10px; background:#20434a; border:1px solid #52716a; border-radius:9px; }
.dispatch-load>div { font-size:12px; }
.dispatch-load strong { font-size:16px; color:#ffe0a2; }
.dispatch-load span { float:right; color:#cde4d7; }
.dispatch-load>small { font-size:12px; display:block; margin-top:3px; }
.dispatch-load footer { margin-top:6px; }
.dispatch-load footer button { flex:1; }
.dispatch-load.booked { background:#142e32; }
.dispatch-load.late,.dispatch-result { color:#ffd89f; }
.dispatch-result { margin:9px 0; }
.dispatch-result strong { display:block; font-size:14px; }
.dispatch-completion { margin-top:12px; padding:11px; border:1px solid #52716a; border-radius:12px; background:#173941; scroll-margin-bottom:max(12px,env(safe-area-inset-bottom)); }
.dispatch-completion .dispatch-result { margin:0 0 10px; }
.dispatch-completion .finish-feedback { margin:4px 0; color:#fff1c3; font-size:16px; }
.dispatch-actions { flex-wrap:wrap; margin-top:10px; }

.dispatch-board { position:relative; }
.time-probe { padding-right:81px; min-height:44px; }
.dispatch-board .run-clock { position:absolute; right:8px; bottom:10px; min-height:40px; padding:4px 8px; font-size:12px; }
.track::after { content:''; position:absolute; left:clamp(0px,var(--probe,0%),calc(100% - 2px)); inset-block:0; width:2px; background:#ffe3ad; }

.shift-choices { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin:8px 0 4px; }
.shift-choices label { display:inline-flex; align-items:center; gap:4px; font-size:12px; }
.shift-choices select { max-width:170px; min-height:36px; border:1px solid #7c9990; border-radius:6px; background:#17383b; color:#fff2d1; font:inherit; }
.dispatch-load output { display:block; font-size:11px; line-height:1.6; color:#d8e8db; }
.shift-rules { margin:8px 0; padding:8px; border:1px solid #476967; border-radius:8px; font-size:12px; }
.shift-rules p,.shift-stock { margin:5px 0; font-size:12px; }
.shift-stock { color:#ffe2a4; }
.track .outage { position:absolute; inset-block:0; background:repeating-linear-gradient(45deg,#695547 0 4px,#523e33 4px 9px); text-align:center; font-size:10px; color:#ffdfa8; }

.heat-tabs { display:flex; gap:4px; margin:7px 0; }
.heat-tabs button { flex:1; min-width:0; padding:4px 1px; font-weight:700; }
.heat-tabs small { display:block; font:10px system-ui; }
.heat-tabs [aria-pressed="true"] { background:#fbdb99; color:#253c3c; }
.dispatch-game:has(.heat-tabs) .dispatch-loads { display:block; }
.dispatch-load .shift-choices { padding:4px 0; }

/* The later shifts use the same full-screen workshop and cast-metal controls. */
.yard-stage { position: relative; z-index: 1; flex: 1 1 0; min-height: 116px; }
.yard-game > .scene { background: #202b34; }
.yard-game .scene-panel { max-height: none; }
.yard-game .scene-panel.is-complete { max-height: min(55%, 290px); }
.yard-instruments .score-unit { margin-bottom: 0; }
.yard-clock { display: flex; align-items: stretch; gap: 5px; margin-top: 4px; }
.yard-clock .work-clock { flex: 1; min-width: 0; margin-top: 0; }
.yard-clock > button, .yard-scrub button, .yard-branches button {
 border: 1px solid #52716f; border-radius: 9px; padding: 3px 8px;
 background: #173b44; color: #eff0df; font-size: 11px;
}
.yard-clock > button { min-height: 36px; margin-left: auto; }
.yard-branches { display: flex; gap: 5px; margin-top: 4px; }
.yard-branches button { flex: 1; min-height: 34px; }
.yard-branches button[aria-pressed="true"] { background: #edce8b; border-color: #ffe5ab; color: #25352e; font-weight: 700; }
.yard-branches small { margin-left: 4px; font-size: 10px; }
.yard-scrub {
 display: flex; align-items: center; gap: 7px; margin-top: 4px; padding: 3px 7px;
 border: 1px solid #52716f; border-radius: 10px; background: #12313beb; font-size: 11px;
}
.yard-scrub[hidden], .yard-rotate[hidden], .yard-point[hidden], .yard-cart[hidden] { display: none; }
.yard-scrub button { min-height: 30px; flex: none; }
.yard-scrub label { display: flex; gap: 4px; align-items: center; flex: 1; min-width: 0; }
.yard-scrub input { flex: 1; min-width: 40px; min-height: 28px; accent-color: var(--amber); }
.yard-stage .yard-still { display: block; position: absolute; left: 50%; top: 50%; width: 100%; height: 100%; object-fit: fill; transform: translate(-50%, -50%); pointer-events: none; }
.yard-game:has(.has-foundry3d) .yard-still { display: none; }
.yard-canvas { width: 100%; height: 100%; }
.yard-point, .yard-cart { position: absolute; transform: translate(-50%,-50%); pointer-events: none; }
.yard-point {
 padding: 4px 7px; border: 1px solid #a1b1aa80; border-radius: 8px; text-align: center;
 background: #142c35e8; color: #f1f1dc; font-size: 12px; line-height: 1.12; white-space: nowrap;
 box-shadow: 0 2px 5px #1018217a;
}
.yard-stage .yard-source { left: 50%; top: 22%; }
.yard-point small { display: block; margin-top: 3px; color: #c6d8cd; font-size: 9px; }
.yard-point[data-yard-status="moving"] { border-color: #f1bb68; }
.yard-gate { color: #ffdaab; border-color: #ca866b; }
.yard-cart {
 z-index: 2; display: grid; place-items: center; width: 20px; height: 20px; transform: translate(-50%,-72%);
 border: 1px solid #e5b575; border-radius: 5px; background: #372b24eb; color: #ffde9d;
 font-size: 10px; font-weight: 700;
}
.yard-cart[data-leg="empty"] { color: #d8e8e6; border-color: #a4b9bd; background: #1c333de8; }
.yard-stage .yard-target { top: 64%; width: clamp(44px, 13cqi, 67px); cursor: pointer; }
.yard-target[data-yard-lane="0"] { left: 34%; }
.yard-target[data-yard-lane="1"] { left: 66%; }
.yard-stage[data-lanes="1"] .yard-target { left: 50%; }
.yard-target .target-ring { opacity: .72; }
.yard-target:not(.armed) .target-ring, .yard-target:disabled .target-ring { opacity: 0; }
.yard-target .target-label { bottom: auto; top: 74%; color: #fff1ca; }
.yard-lane-state {
 position: absolute; top: calc(74% + 27px); left: 50%; transform: translateX(-50%); padding: 2px 5px;
 border-radius: 5px; background: #102e35ed; color: #d7e6d8; font-size: 9px; white-space: nowrap;
 pointer-events: none;
}
.yard-target[data-yard-status="working"] .yard-lane-state { color: #ffe0a0; }
.yard-target[data-yard-status="maintenance"] .yard-lane-state { color: #ffb791; }
.yard-rotate { position: absolute; right: 8px; bottom: 7px; }
.yard-game.puzzle-game:not(.first-furnace) .yard-loads { grid-template-columns: repeat(var(--loads), minmax(0,1fr)); }
.yard-game.puzzle-game:not(.first-furnace) .yard-loads .tool { grid-template-columns: 1fr; place-items: center; gap: 1px; padding: 3px 1px; min-height: 44px; }
.yard-loads .tool .op-art { height: 23px; }
.yard-loads .tool[data-booked="true"] { background: #24484c; color: #d8e8db; border-color: #64857a; }
.yard-loads .tool[data-rejected="true"] { color: #ffb991; }
.yard-loads .tool.selected { border-color: #ffd581; }
.yard-sheet-info .yard-fields { display: grid; gap: 8px; margin-top: 10px; }
.yard-fields label { display: grid; grid-template-columns: 4.5em minmax(0,1fr); align-items: center; gap: 5px; font-size: 13px; }
.yard-fields select {
 width: 100%; min-height: 44px; padding: 4px 7px; border: 1px solid #7c9990; border-radius: 8px;
 background: #15353d; color: #fff2d1; font: inherit;
}
.yard-projection { padding: 7px 0; border-top: 1px solid #52716f; font-size: 12px; line-height: 1.55; }
.yard-projection small { display: block; color: #c5dbce; font-size: 11px; }
.yard-projection .warn { color: #ffd0a0; }
@media (max-height: 555px) {
 .yard-stage { min-height: 88px; }
 .yard-game .scene-rotate { min-width: 36px; min-height: 36px; font-size: 18px; }
 .yard-source { padding-inline: 4px; font-size: 10px; }
 .yard-source small { font-size: 8px; }
}
@media (max-height: 440px) and (orientation: landscape) {
 .game.immersive.yard-game {
  display: grid; grid-template-columns: minmax(0,1fr) minmax(264px,37%);
  grid-template-rows: auto minmax(0,1fr); max-width: min(800px,100%);
 }
 .yard-game .scene-hud { grid-column: 1 / -1; }
 .yard-game [data-yard-hud] { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); column-gap: 7px; }
 .yard-game [data-yard-hud] .notice { grid-column: 1 / -1; }
 .yard-game .yard-clock { grid-column: 2; margin-top: 0; }
 .yard-game .yard-branches { grid-column: 1; }
 .yard-game .yard-scrub { grid-column: 2; }
 .yard-game .yard-stage { grid-column: 1; grid-row: 2; min-height: 0; }
 .yard-game .scene-panel { grid-column: 2; grid-row: 2; align-self: end; width: 100%; max-height: 100%; overflow-y: auto; }
 .yard-game .scene-panel.is-complete { max-height: 100%; }
}

.yard-tabs { grid-column: 1 / -1; }
.yard-stage [hidden] { display: none; }
.yard-visit {
 position: absolute; left: 8px; bottom: 7px; min-height: 44px;
 border-color: #829c8b; background: #14353ce0; color: #fff1ca;
}
.yard-visit:focus-visible { outline-offset: 2px; }
@media (max-height: 555px) {
 .yard-tabs button, .yard-visit { min-height: 36px; }
 .yard-stage { min-height: 58px; }
 .yard-visit { padding-block: 5px; }
}

/* Shared finishes for the converter, dispatch workshop and their controls. */
:root {
 --steel-night: #141d24;
 --steel-console: #21303a;
 --steel-face: #364951;
 --steel-edge: #677c82;
 --steel-cold: #b9e5e8;
 --steel-warm: #ffca80;
}
body {
 background: radial-gradient(ellipse at 50% 42%,#25323a,#111b22 64%,#0e151c);
 font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
.game.immersive, .immersive > .scene, .yard-game > .scene { background: var(--steel-night); }
.immersive > .scene::after {
 content: ""; position: absolute; inset: 0; pointer-events: none;
 background:
  linear-gradient(180deg,#1018217f,transparent 30%,transparent 77%,#141e2792),
  radial-gradient(ellipse at 49% 48%,transparent 48%,#10182065 100%);
}
.immersive :is(img.scene-fallback,.yard-still) {
 filter: contrast(1.04) saturate(.88);
}
.immersive .scene-nav .mission { text-align: left; color: #f6f4e7; }
.immersive .scene-nav .mission small { color: #c3d0d1; letter-spacing: .04em; }
.immersive .scene-nav button, .immersive :is(.scene-rotate,.scene-replay,.yard-visit),
.immersive .scene-actions .ghost {
 color: #f3f4e9; border-color: #687e846e;
 background: linear-gradient(155deg,#31434df5,var(--steel-console));
 box-shadow: inset 0 1px #dcece91c,0 2px 5px #090f1559;
}
.immersive :is(.scene-instruments,.yard-scrub,.level-goal) {
 border-color: #77929b59; background: linear-gradient(145deg,#283944f2,#192631f2 68%);
 box-shadow: inset 0 1px #c8e6ec14,0 3px 9px #090f154a;
}
.immersive .work-budget { background: #263842ed; color: #e1e7dc; }
.immersive .work-budget b { color: #ffe0a5; }
.immersive .metric-name, .immersive .phase-detail, .immersive .resources { color: #d9e5e0; }
.immersive .segments, .immersive .segments .gauge-fade { background: #18262e; }
.immersive .segments b:not(.filled,.excess,.missing) { background: #43565e; }
.immersive .scene-panel {
 border-color: #738387a3; border-radius: 13px 13px 0 0;
 background:
  repeating-linear-gradient(4deg,#dbe5df02 0 1px,transparent 1px 4px),
  linear-gradient(115deg,#35454dea 0%,#25373eea 48%,#1a2832f5 100%);
 box-shadow: inset 0 1px #d4e8eb23,0 -3px 13px #050e1660;
}
.immersive .scene-panel.is-complete { background: linear-gradient(130deg,#2d4049fa,#1a2934fa 72%); }
.immersive .first-brief strong { color: #f7f4e7; }
.immersive .tool {
 color: #f3f5ed; border-color: #77898b90; border-radius: 9px;
 background: linear-gradient(153deg,#4a5e65,#2b3d47 68%);
 box-shadow: inset 0 1px #e8eeea24,0 2px 3px #0b131a48;
}
.immersive .tool-time { color: #e1e9e0; opacity: .84; }
.immersive .tool .op-art { filter: drop-shadow(0 1px 1px #142026ab); }
.immersive .tool:is([aria-disabled="true"],:disabled) {
 color: #bccbd0; border-color: #536770; background: #263641;
}
.immersive .tool:is([aria-disabled="true"],:disabled) .op-art { filter: saturate(.37); }
.immersive .tool.selected {
 color: #fff1ce; border-color: var(--steel-warm); background: linear-gradient(152deg,#695b45,#3d392f 78%);
 box-shadow: inset 0 1px #fff0c64d,0 0 0 1px #eab96257;
}
.immersive .yard-loads .tool[data-booked="true"] { background: var(--steel-face); color: var(--steel-cold); }
.immersive .yard-loads .tool[data-rejected="true"] { color: #ffb999; border-color: #ad7668; }
.immersive .scene-actions .primary:not(:disabled), .immersive .result-actions .primary:not(:disabled), .sheet .primary:not(:disabled) {
 color: #29241b; background: linear-gradient(165deg,#ffdda4 4%,#f5bb69 100%);
 box-shadow: inset 0 1px #fff0ca98,0 2px 4px #10141769;
}
.immersive :is(.batch-tabs button,.yard-clock > button,.yard-branches button,.yard-scrub button,.process-button) {
 background: linear-gradient(150deg,#324651,#263741); border-color: var(--steel-edge); color: #eef3ec;
}
.immersive :is(.batch-tabs button.active,.yard-branches [aria-pressed="true"]) {
 background: #a9c9cd; border-color: #cfe9e6; color: #172c33;
}
.immersive .yard-point, .immersive .yard-lane-state, .immersive .scene-view > span {
 color: #eef1e7; background: #222f38e8; border-color: #7c959b91;
}
.immersive .yard-point small, .immersive .scene-cutaway { color: #c1dedf; }
.immersive .yard-target[data-yard-status="working"] .yard-lane-state { color: #ffcf84; }
.immersive .yard-target[data-yard-status="maintenance"] .yard-lane-state { color: #ffb791; }
.immersive .target-ring { box-shadow: 0 0 0 2px #253d47ad,0 0 18px #f9b25542; }
.immersive .furnace-target.armed .target-ring, .immersive .furnace-target.drop-ready .target-ring {
 border-color: #ffce7b; box-shadow: 0 0 0 2px #342f25,0 0 20px #efaa487d;
}
.immersive .furnace-target.drop-over .target-ring {
 border-color: #d3ffaf; box-shadow: 0 0 24px #c2ec8b;
}
.sheet {
 color: #eef1e8; border-color: #718a916e;
 background: linear-gradient(144deg,#303f48,#202e38 65%);
 box-shadow: 0 14px 40px #080f18af;
}
.sheet .level:not(:disabled) { background: #344953; border-color: #6c848b; }
.sheet .level:disabled { background: #273943; border-color: #485f69; }
.sheet .level[aria-current="step"] { background: #495247; }
.sheet :is(.ghost,.yard-fields select,.sheet-close) { background: #30454f; border-color: #70858a; }
.sheet :is(.yard-projection,.process-list li) { border-color: #61757e; }
@media (orientation: portrait) {
 .first-tools .tool-tray { grid-template-columns: repeat(auto-fit,minmax(78px,1fr)); }
}
@media (max-height: 440px) and (orientation: landscape) {
 .game.immersive:not(.yard-game) { max-width: min(100%,900px); }
 .immersive:not(.yard-game) .scene-hud { pointer-events: none; }
 .immersive:not(.yard-game) .scene-hud button { pointer-events: auto; }
 .immersive:not(.yard-game) .scene-hud > :is(.scene-instruments,.work-budget,.batch-tabs,.level-goal) {
  width: min(52%,360px); margin-left: auto;
 }
 .immersive:not(.yard-game) .scene-panel { border-radius: 13px 0 0 0; }
}
