: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-fallback { display: block; object-fit: cover; object-position: center 45%; }
.scene-host.has-foundry3d .scene-fallback { visibility: hidden; }
.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; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
.first-lesson .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric { display: flex; justify-content: center; align-items: baseline; flex-wrap: wrap; min-width: 0; gap: 2px 3px; font-size: 11px; line-height: 1.2; }
.metric .v { color: #fff6dd; font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.metric .ok, .metric .bad { width: 100%; font-size: 10px; text-align: center; white-space: nowrap; }
.metric .ok { color: var(--mint); }
.metric .bad { color: #ffcf82; }
.metric .track { display: none; }
.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); }
.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, 56px); justify-content: center; flex: none; gap: 7px; }
.tool { position: relative; display: grid; grid-template-rows: 34px auto; justify-items: center; align-content: center; gap: 3px; min-width: 0; height: 60px; padding: 4px 1px; 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: 36px; height: 34px; 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 small { display: 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 .replacement-label, .tool .tool-tag { position: absolute; top: -5px; right: -3px; padding: 2px 3px; border: 1px solid #c5ac74; border-radius: 4px; background: #283e3a; color: #ffe0a2; font-size: 8px; }
.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; }
.is-complete .scene-actions .ghost { width: auto; flex-basis: auto; padding: 7px 13px; font-size: 13px; }
.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-score { display: flex; flex-wrap: wrap; gap: 4px 10px; grid-column: 2; color: #c0dcc6; font-size: 11px; line-height: 1.4; }
.scene-score span { white-space: nowrap; }
.scene-score b { color: #eff4d2; font-variant-numeric: tabular-nums; }
.scene-score .score-badge { color: #ffdd92; }
.scene-success .ghost { grid-column: 1 / -1; margin-top: 3px; min-height: 44px; padding: 7px 12px; }

/* 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; }
  .metric .v { font-size: 16px; }
  .metric .ok, .metric .bad { font-size: 9px; }
  .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; }
  .scene-success .ghost { min-height: 44px; }
}
@media (max-height: 440px) and (orientation: landscape) {
  .scene-hud { width: min(52%, 360px); }
  .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) {
  .tool, .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[data-station="ladle"] { width: 56px; }
.furnace-target .ladle-icon { display: none; width: 42px; height: 42px; pointer-events: none; }
.furnace-target[data-station="ladle"][data-fallback="true"] { background: #12313bee; }
.furnace-target[data-station="ladle"][data-fallback="true"] .ladle-icon { display: block; }
.temperature-change { grid-column: 2; height: 6px; border-radius: 4px; overflow: hidden; background: #45615a; }
.temperature-change i { display: block; height: 100%; width: var(--to); border-radius: inherit; background: #ffd17a; }
@media(prefers-reduced-motion:no-preference) {
  .temperature-change i { animation: cool-bar .65s ease-out both; }
  @keyframes cool-bar { from { width: var(--from); } to { width: var(--to); } }
}
.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 { display: block; }
.scene-view .scene-cutaway { display: none; color: #b6cdca; }
.immersive:has(.has-foundry3d) .scene-cutaway { display: block; }
.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-furnace .metrics { grid-template-columns: minmax(140px,2.4fr) repeat(2,minmax(40px,1fr)); align-items: center; }
.first-furnace .carbon-gauge { padding: 2px 8px 3px 3px; border-right: 1px solid #71878166; }
.carbon-gauge > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; margin-bottom: 4px; }
.carbon-gauge strong { color: #f7f2db; font-size: 13px; }
.carbon-gauge strong b { font-size: 20px; line-height: 1; }
.carbon-gauge span { color: #abebc3; font-size: 12px; font-weight: 650; }
.carbon-scale { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 1px; }
.carbon-scale i { border-radius: 2px; background: #2b4650; color: #bfd0cd; text-align: center; font: 600 11px/19px system-ui,sans-serif; }
.carbon-scale .in-band { background: #285c51; color: #b9f0c6; box-shadow: inset 0 -2px #91dbad; }
.carbon-scale .reading { background: #ffd285; color: #292c29; outline: 1px solid #ffe3ad; }
.carbon-scale .in-band.reading { background: #b6edc7; outline-color: #d3fadc; }
.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; }
.first-tools .tool-tray { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.first-tools .tool { grid-template-columns: minmax(36px,33%) 1fr; grid-template-rows: auto auto; align-items: center; align-content: center; justify-items: start; column-gap: 7px; row-gap: 2px; padding: 5px 9px; height: 62px; 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 { grid-row: span 2; justify-self: center; width: 100%; max-width: 48px; height: 42px; }
.first-tools .tool strong { font-size: 15px; }
.first-tools .tool-effect { font-size: 13px; font-weight: 650; color: #c0dfda; }
.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; }
body:has(.first-furnace) .manual-sheet { position: relative; }
body:has(.first-furnace) .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 { height: 51px; }
 .first-tools .tool .op-art { height: 35px; }
}
