:root {
  color-scheme: dark;
  --bg: #0c1117;
  --panel: #151d26;
  --panel-2: #1b2631;
  --line: #2b3946;
  --text: #e8f0f4;
  --muted: #82929e;
  --cyan: #52d5d0;
  --amber: #f6b94d;
  --red: #ef6a65;
  --green: #77d49b;
  --sorter: #7fa3f5;
/* @full-only:start */  --lefter: #71d9b5;/* @full-only:end */
  --counter: #9fd468;
  --marker: #f08fb0;
  --router: #ef8a5e;
  --fire_pit: #ff7b42;
/* @full-only:start */  --improver:/* @full-only:end */ #9b6ac5;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 940px; min-height: 650px; height: 100%; overflow: hidden; }
body { display: flex; flex-direction: column; background: var(--bg); color: var(--text); font: 14px/1.4 Inter, ui-sans-serif, system-ui, sans-serif; }
button, select { font: inherit; }
button { color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; box-shadow: inset 0 1px 0 #ffffff1a, 0 2px 0 #0006; cursor: pointer; }
button:hover { border-color: #597080; background: #23313d; }
button:active:not(:disabled) { box-shadow: inset 0 1px 2px #0008, 0 1px 0 #0006; }
button:disabled { cursor: default; opacity: .42; }
button:disabled:hover { border-color: var(--line); background: var(--panel-2); }
button:focus-visible, select:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.topbar { min-height: 70px; padding: 8px 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; border-bottom: 1px solid var(--line); background: #10171e; }
.topbar-start { display: flex; align-items: center; gap: 18px; }
.topbar-start #menuButton { height: 36px; padding: 0 13px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border: 2px solid var(--cyan); border-radius: 8px; color: var(--cyan); font-weight: 900; font-size: 21px; transform: rotate(-3deg); }
h1, h2, p { margin: 0; }
h1 { font-size: 17px; letter-spacing: .24em; }
.brand p { color: var(--muted); font-size: 11px; letter-spacing: .05em; }
.sim-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
#levelIntroButton { padding: 7px 10px; border-color: #426774; color: #cdebf6; font-size: 11px; font-weight: 800; white-space: nowrap; }
.level-badge { min-width: 76px; color: var(--cyan); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-align: center; }
.objective-badge { padding: 7px 10px; border: 1px solid #3d7665; border-radius: 6px; color: #baf4d4; background: #17342e; font: 800 11px ui-monospace, monospace; white-space: nowrap; }
.objective-badge.won { border-color: #9af0b7; background: #24533a; }
.sim-controls button, .sim-controls select { height: 36px; padding: 0 13px; }
.sim-controls button[hidden] { display: none; }
.sim-controls #cargoVisibilityButton.is-active { border-color: #e4b55a; color: #ffe6a9; background: #443520; animation: cargo-visibility-pulse 1.5s ease-in-out infinite; }
@keyframes cargo-visibility-pulse { 50% { border-color: #ffe09a; box-shadow: 0 0 0 3px #f6b94d55, 0 0 15px #f6b94d66; } }
@media (prefers-reduced-motion: reduce) { .sim-controls #cargoVisibilityButton.is-active { animation: none; } }
.advanced-controls { position: relative; }
.advanced-menu { position: absolute; top: calc(100% + 7px); right: 0; z-index: 12; display: grid; gap: 5px; width: 205px; padding: 8px; border: 1px solid #6a7783; border-radius: 7px; background: #1a2730; box-shadow: 0 10px 26px #000a; }
.advanced-menu[hidden] { display: none; }
.advanced-menu button { width: 100%; height: auto; min-height: 34px; text-align: left; }
.advanced-menu #salvageRestartButton { border-color: #b8785a; color: #ffe0cd; }
.advanced-tooltip { position: absolute; top: calc(100% + 5px); right: 0; width: 270px; padding: 9px 11px; border: 1px solid #b8785a; border-radius: 6px; background: #34261f; box-shadow: 0 8px 20px #000a; color: #fff0e4; font-size: 12px; line-height: 1.4; opacity: 0; pointer-events: none; visibility: hidden; }
.advanced-menu #salvageRestartButton:is(:hover, :focus-visible) + .advanced-tooltip { opacity: 1; visibility: visible; }
.sim-controls label { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.sim-controls select { color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; }
.sim-controls .danger { color: #ffaaa6; }

main { display: grid; grid-template-columns: minmax(680px, 1fr) 290px; flex: 1; min-height: 0; }
.workspace { min-width: 0; display: flex; flex-direction: column; }
.toolbar { padding: 5px 14px; display: flex; gap: 7px; border-bottom: 1px solid var(--line); background: #121a22; }
.tool { position: relative; display: flex; flex: 1 1 0; min-width: 0; align-items: center; justify-content: center; gap: 5px; padding: 8px 6px; text-align: center; }
.tool[hidden] { display: none; }
.tool span { flex: none; color: var(--cyan); font-size: 17px; }
.tool kbd { flex: none; margin-left: 0; }
.tool.active { border-color: var(--cyan); background: #173039; box-shadow: inset 0 -2px var(--cyan); }
.tool.tutorial-tool-target:not(.active) { border-color: #ff9f35; box-shadow: 0 0 0 2px #ff9f3580, 0 0 14px #ff9f3566; animation: tutorial-tool-pulse 1.5s ease-in-out infinite; }
@keyframes tutorial-tool-pulse { 50% { box-shadow: 0 0 0 5px #ff9f354d, 0 0 24px #ff9f35bb; } }
.tool.tutorial-tool-target:not(.active)[data-tool="rotate"] { border-color: #ffe070; box-shadow: 0 0 0 2px #ffe07080, 0 0 14px #ffe07066; animation-name: tutorial-rotate-pulse; }
@keyframes tutorial-rotate-pulse { 50% { box-shadow: 0 0 0 5px #ffe0704d, 0 0 24px #ffe070bb; } }
kbd { margin-left: 5px; padding: 1px 5px; color: var(--muted); background: #0d141b; border: 1px solid #33424f; border-radius: 3px; font-size: 10px; }
.board-shell { position: relative; flex: 1; min-height: 0; padding: 14px; display: grid; place-items: center; background: radial-gradient(circle at center, #17222b 0, #0b1117 74%); }
#gameCanvas { max-width: 100%; max-height: 100%; border: 1px solid #334450; border-radius: 5px; box-shadow: 0 18px 50px #0008; background: #101820; cursor: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgdmlld0JveD0iMCAwIDQwIDQwIj48cmVjdCB4PSIxMCIgeT0iMTMiIHdpZHRoPSIyNyIgaGVpZ2h0PSIyMCIgcng9IjQiIGZpbGw9IiMxMDIwMjciIHN0cm9rZT0iI2FlZTZlMSIgc3Ryb2tlLXdpZHRoPSIyIi8+PGNpcmNsZSBjeD0iMjIiIGN5PSIyMiIgcj0iNC41IiBmaWxsPSJub25lIiBzdHJva2U9IiNhZWU2ZTEiIHN0cm9rZS13aWR0aD0iMiIvPjxwYXRoIGQ9Im0yNS41IDI1LjUgNSA1IiBmaWxsPSJub25lIiBzdHJva2U9IiNhZWU2ZTEiIHN0cm9rZS13aWR0aD0iMi41IiBzdHJva2UtbGluZWNhcD0icm91bmQiLz48cGF0aCBkPSJNMSAxdjE5bDQuNS00LjUgNCA3LjUgMy41LTItNC04aDdaIiBmaWxsPSIjZmZkYTRmIiBzdHJva2U9IiMxNDIxMmEiIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIvPjwvc3ZnPg==") 1 1, crosshair; }
#gameCanvas.dragging { cursor: grabbing; }

/* @full-only:start */#gameCanvas.wiring { cursor: alias; }/* @full-only:end */
.tutorial-highlight { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.tutorial-highlight[hidden] { display: none; }
.tutorial-mark { position: absolute; box-sizing: border-box; display: grid; place-items: center; border: 2px solid #ffe28a; border-radius: 5px; box-shadow: 0 0 0 3px #f6b94d30; background: #f6b94d20; animation: tutorial-pulse 1.8s ease-in-out infinite; }
.tutorial-mark.satisfied { border-color: #93e8b5; background: transparent; box-shadow: none; opacity: .55; animation: none; }
.tutorial-mark.cargo-mark { display: block; border: 0; border-radius: 0; background: transparent; box-shadow: none; animation: none; }
.tutorial-cargo-outline { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 4px #f6b94d88); animation: tutorial-cargo-pulse 1.8s ease-in-out infinite; }
.tutorial-mark.satisfied .tutorial-cargo-outline { filter: none; animation: none; }
.tutorial-mark.satisfied .tutorial-cargo-outline polygon { stroke: #93e8b5; }
.tutorial-mark.cargo-mark::after { content: ""; position: absolute; top: 50%; left: 100%; width: 18px; border-top: 2px solid #ffe28a; }
.tutorial-mark.cargo-mark.edge::after { right: 100%; left: auto; }
.tutorial-mark.cargo-mark .tutorial-marker-label { left: calc(100% + 18px); }
.tutorial-mark.cargo-mark.edge .tutorial-marker-label { right: calc(100% + 18px); left: auto; }
.tutorial-mark.satisfied.cargo-mark::after { border-color: #93e8b5; }
@keyframes tutorial-cargo-pulse { 50% { filter: drop-shadow(0 0 8px #f6b94d88); } }
.tutorial-marker-label { position: absolute; top: 50%; left: calc(100% + 7px); transform: translateY(-50%); padding: 6px 8px; border: 1px solid #ffe28a; border-radius: 4px; background: #342c19; box-shadow: 0 3px 12px #0009; color: #ffe6a1; font-size: 11px; font-weight: 800; white-space: nowrap; }
.tutorial-mark.edge .tutorial-marker-label { right: calc(100% + 7px); left: auto; }
.tutorial-mark.pit-mark .tutorial-marker-label { top: auto; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%); }
.tutorial-pit-cue { position: absolute; left: 50%; bottom: calc(100% + 5px); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; color: #ffe28a; text-shadow: 0 2px 5px #071014, 0 0 12px #071014; pointer-events: none; }
.tutorial-pit-cue strong { padding: 3px 10px; border: 2px solid currentColor; border-radius: 5px; background: #342c19ed; font-size: 20px; letter-spacing: .14em; }
.tutorial-pit-cue-arrow { font-family: system-ui, sans-serif; font-size: 76px; font-weight: 900; line-height: .82; filter: drop-shadow(0 2px 4px #071014); }
@keyframes tutorial-pulse { 50% { box-shadow: 0 0 0 6px #f6b94d22; } }
@media (prefers-reduced-motion: reduce) { .tutorial-mark, .tool.tutorial-tool-target:not(.active), .tutorial-action-target { animation: none; } }
.setup-tooltip { position: absolute; z-index: 4; max-width: 300px; padding: 9px 11px; border: 1px solid var(--red); border-radius: 6px; background: #211b20f2; box-shadow: 0 8px 24px #0009; color: #f6e5e3; font-size: 12px; line-height: 1.4; pointer-events: none; }
.setup-tooltip[hidden] { display: none; }
.setup-tooltip strong { display: block; margin-bottom: 4px; color: #ffaaa6; }
.setup-tooltip ul { margin: 0; padding-left: 16px; }
.setup-tooltip li + li { margin-top: 3px; }
.toast { position: absolute; bottom: 26px; left: 50%; transform: translate(-50%, 12px); padding: 8px 13px; border: 1px solid #47606e; border-radius: 5px; background: #111b22e8; opacity: 0; pointer-events: none; transition: .18s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.error-stack { position: fixed; z-index: 20; top: 76px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: max-content; max-width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.error-message { max-height: 100px; overflow: hidden; padding: 9px 14px; border: 1px solid #ef6a65; border-radius: 6px; background: #421d23f2; box-shadow: 0 8px 24px #0009; color: #ffe9e7; font-size: 12px; font-weight: 700; text-align: center; animation: error-life 4s linear forwards; transition: max-height .22s ease, padding .22s ease, border-width .22s ease, margin .22s ease, opacity .22s ease; }
.error-message.retiring { animation: none; opacity: 0; max-height: 0; padding-top: 0; padding-bottom: 0; border-top-width: 0; border-bottom-width: 0; margin-bottom: -8px; }
@keyframes error-life { 0% { opacity: 1; transform: translateY(-6px); } 10% { transform: translateY(0); } 100% { opacity: 0; transform: translateY(0); } }
.victory-overlay { position: absolute; inset: 14px; z-index: 6; display: grid; place-items: center; background: #07120fc9; }
.victory-overlay[hidden] { display: none; }
.victory-card { width: min(360px, 90%); padding: 28px; border: 2px solid #9af0b7; border-radius: 12px; background: #16352c; box-shadow: 0 20px 60px #000b; text-align: center; }
.victory-card strong { display: block; margin-bottom: 10px; color: #d5ffe5; font-size: 24px; }
.victory-card p { color: #badbcb; }
.victory-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin-top: 20px; }
.victory-actions button { padding: 8px 14px; }
.victory-actions .primary { border-color: #9af0b7; background: #24533a; color: #e0ffeb; font-weight: 800; }
.victory-actions .primary:hover { background: #316a4b; }
.escape-menu { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: #071016dc; }
.escape-menu[hidden] { display: none; }
.escape-menu-card { width: min(380px, calc(100% - 40px)); padding: 28px; border: 2px solid #5d8791; border-radius: 12px; background: #17252e; box-shadow: 0 20px 60px #000b; text-align: center; }
.escape-menu-card strong { display: block; margin-bottom: 10px; color: #e8f0f4; font-size: 24px; }
.escape-menu-card p { color: #aebfc7; }
.escape-menu-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 20px; }
.escape-menu-actions button { padding: 8px 14px; }
.escape-menu-actions .danger { border-color: #a84e4c; color: #ffaaa6; }
.menu-board-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 20px; padding-top: 15px; border-top: 1px solid var(--line); }
.menu-board-actions span { grid-column: 1 / -1; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-align: left; text-transform: uppercase; }
.menu-board-actions button { padding: 8px; }
.menu-board-actions button[hidden] { display: none; }
.menu-board-actions .danger { grid-column: 1 / -1; border-color: #a84e4c; color: #ffaaa6; }
.main-menu { background: radial-gradient(circle at 50% 25%, #183038, #0b1219 72%); }
.main-menu-card { width: min(780px, calc(100% - 48px)); max-height: calc(100vh - 48px); overflow-y: auto; padding: 28px; border: 1px solid #41616a; border-radius: 14px; background: #14222b; box-shadow: 0 25px 75px #0009; }
.main-menu-header { display: flex; align-items: center; gap: 18px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.main-menu-header .brand-mark { width: 52px; height: 52px; font-size: 30px; }
.menu-eyebrow { display: block; color: var(--cyan); font-size: 11px; font-weight: 800; letter-spacing: .24em; }
.main-menu-header strong { display: block; color: var(--text); font-size: 28px; }
.main-menu-header p { color: #aebfc7; }
.main-menu-section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 20px; }
.main-menu-section-heading span { color: var(--muted); font-size: 12px; }
.flow-card { width: min(650px, calc(100% - 40px)); max-height: calc(100vh - 60px); overflow-y: auto; padding: 24px; border: 2px solid #5d8791; border-radius: 12px; background: #17252e; box-shadow: 0 20px 60px #000b; }
.flow-card > strong { display: block; margin-bottom: 10px; font-size: 24px; }
.flow-card > p, .flow-card li { color: #b8c9d1; line-height: 1.5; }
.flow-card > button { margin-top: 18px; padding: 8px 14px; }
.flow-card > label { display: block; margin: 15px 0; }
.flow-card select { margin-left: 10px; padding: 5px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }
.level-intro-card { width: min(780px, calc(100% - 36px)); max-height: calc(100vh - 40px); overflow-y: auto; padding: 20px; border: 2px solid #5d8791; border-radius: 12px; background: #17252e; box-shadow: 0 20px 60px #000b; }
.level-intro-card > strong { display: block; margin: 6px 0 8px; font-size: 25px; }
.level-intro-card > p { margin: 5px 0; color: #c6dbe3; font-size: 14px; line-height: 1.45; }
.level-intro-demos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 15px auto; }
.level-intro-lane { min-width: 0; padding: 6px; border: 1px solid #36515f; border-radius: 8px; background: #13222b; text-align: center; }
.level-intro-lane strong, .level-intro-lane span { display: block; }
.intro-lane-heading { font-size: 15px; }
.intro-lane-subtitle { min-height: 19px; color: #a9bec7; font-size: 12px; }
.level-intro-lane canvas { display: block; width: 100%; height: auto; background: #0c1720; }
.intro-lane-result { min-height: 32px; color: #e8f0f4; font-size: 12px; font-weight: 700; }
.level-intro-card .level-intro-controls { margin: 2px 0 14px; padding: 8px 10px; border-left: 3px solid var(--cyan); background: #102b33; color: #d3e9ed; font-size: 13px; }
#levelIntroNextButton { display: block; min-width: 100px; margin-left: auto; padding: 9px 17px; border-color: #4c9594; background: #1d4b4f; font-weight: 800; }
.scenario-list { display: grid; gap: 8px; margin-top: 12px; }
.scenario-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: #101b23; }
.scenario-row strong { color: var(--cyan); }
.scenario-current { margin-left: 9px; padding: 2px 5px; border: 1px solid #397f7b; border-radius: 4px; color: #a5eee7; font-size: 10px; font-weight: 700; vertical-align: middle; }
.scenario-row p { margin-top: 3px; color: #aebfc7; font-size: 12px; }
.scenario-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; min-width: 170px; }
.scenario-actions button { padding: 6px 9px; font-size: 12px; }
.debug-console { position: absolute; left: 28px; right: 28px; bottom: 24px; z-index: 5; border: 1px solid #7b9cac; border-radius: 5px; background: #080d12f2; box-shadow: 0 12px 35px #000b; font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.debug-console[hidden] { display: none; }
.debug-console-title { display: flex; justify-content: space-between; padding: 7px 10px; color: #bfe8ef; border-bottom: 1px solid #31444f; font-weight: 800; letter-spacing: .08em; }
.debug-console-title span { color: #708994; font-weight: 400; letter-spacing: 0; }
.debug-console-output { min-height: 31px; padding: 7px 10px; color: #83d99d; }
.debug-console form { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border-top: 1px solid #263944; color: #52d5d0; }
.debug-console input { min-width: 0; flex: 1; padding: 3px 0; color: #edf7fa; border: 0; outline: 0; background: transparent; font: inherit; }

.sidebar { overflow-y: auto; border-left: 1px solid var(--line); background: var(--panel); }
.sidebar section { padding: 17px; border-bottom: 1px solid var(--line); }
.sidebar section[hidden] { display: none; }
.sidebar .tutorial-panel { background: #173039; border-bottom: 2px solid #398f8c; }
.tutorial-progress { color: var(--cyan); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.tutorial-panel h2 { margin: 8px 0 10px; color: #e8f7f5; font-size: 17px; letter-spacing: 0; text-transform: none; }
.tutorial-panel p { color: #c5dddc; font-size: 13px; line-height: 1.5; }
.tutorial-steps-label { display: block; color: #e8f7f5; font-size: 12px; font-weight: 800; }
.tutorial-instructions { display: grid; gap: 0; padding-left: 12px; }
.tutorial-panel .tutorial-status { margin-top: 10px; color: #aee6e1; font-size: 11px; }
.tutorial-checklist { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; color: #c5dddc; font-size: 13px; line-height: 1.4; }
.tutorial-checklist[hidden] { display: none; }
.tutorial-checklist li { display: flex; align-items: flex-start; gap: 7px; }
.tutorial-check-icon { flex: 0 0 20px; width: 20px; height: 20px; }
.tutorial-checklist .info { margin-bottom: 6px; color: #e8f7f5; font-size: 15px; font-weight: 600; line-height: 1.5; }
.tutorial-term { color: #fff; font-weight: 900; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.tutorial-or { margin: 20px 0 8px; padding: 8px 0; border-top: 1px solid #688588; border-bottom: 1px solid #688588; color: #ffe070; font-size: 14px; font-weight: 900; letter-spacing: .22em; text-align: center; }
.tutorial-actions { display: grid; gap: 7px; margin-top: 14px; }
.tutorial-actions button { padding: 8px 10px; }
.tutorial-actions button[hidden] { display: none; }
#tutorialNextButton { border-color: #398f8c; background: #1c4b4d; font-weight: 700; }
#tutorialNextButton.tutorial-action-target { border-color: #ffe070; box-shadow: 0 0 0 2px #ffe07080, 0 0 14px #ffe07066; animation: tutorial-rotate-pulse 1.5s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { #tutorialNextButton.tutorial-action-target { animation: none; } }
#tutorialRestartButton { border-color: #46616c; font-size: 12px; }
#tutorialSkipButton { color: #a6b9c1; background: transparent; }
.objective-panel { background: #142820; }
.objective-panel p { color: #b6d4c4; font-size: 12px; line-height: 1.5; }
.objective-panel p + p { margin-top: 9px; }
.objective-count { color: #adf1c7; font: 800 16px ui-monospace, monospace; }
.objective-checklist { display: grid; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; color: #c5ddcb; font-size: 12px; }
.objective-checklist li { display: flex; align-items: center; gap: 9px; }
.objective-check-icon { position: relative; flex: 0 0 16px; width: 16px; height: 16px; border: 2px solid #ffd400; border-radius: 50%; }
.objective-checklist li.done .objective-check-icon { border-color: transparent; }
.objective-checklist li.done .objective-check-icon::after { content: ''; position: absolute; left: 4px; top: 0; width: 5px; height: 10px; border: solid #38e879; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.objective-blocked { color: #ffaaa6 !important; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
h2 { color: #c7d5dc; font-size: 12px; letter-spacing: .15em; text-transform: uppercase; }
.badge { padding: 2px 7px; border-radius: 10px; color: var(--muted); background: #0d141a; font-size: 11px; }
.empty-state, .hint { color: var(--muted); font-size: 12px; }
.selection-card { display: grid; gap: 9px; }
.selection-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.selection-summary { flex: 1; min-width: 0; }
.selection-preview { flex: none; display: grid; place-items: center; padding: 2px; border: 1px solid #344b55; border-radius: 7px; background: #101820; }
.selection-preview canvas { display: block; width: 64px; height: 64px; }
.selection-title { display: flex; align-items: center; justify-content: space-between; font-size: 16px; font-weight: 700; }
.reliability-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 7px; min-height: 32px; font-size: 13px; font-weight: 700; }
.reliability-row button { padding: 5px 9px; font-size: 12px; }
.component-notes { display: grid; gap: 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.component-notes textarea { box-sizing: border-box; width: 100%; height: 46px; padding: 5px 7px; resize: none; border: 1px solid #46616c; border-radius: 5px; background: #101820; color: var(--text); font: 12px/1.35 system-ui, sans-serif; }
.component-notes textarea:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }
.quality { color: var(--green); }
.quality.bad { color: var(--amber); }
.unknown { color: var(--muted); }
.identify-unavailable { color: var(--muted); font-size: 11px; font-weight: 400; }
.details { color: var(--muted); font-size: 12px; }
.route-outputs { display: grid; gap: 5px; margin: 3px 0; }
.route-output { padding: 5px 7px; border: 1px solid #3a4d5a; border-radius: 5px; background: #17232c; font-weight: 700; letter-spacing: .02em; }
.route-output.blue { color: #53a8ff; border-color: #168cff; }
.route-output.red { color: #ff7181; border-color: #ff4051; }
.route-output.match { color: #a6e4bb; border-color: #426d58; }
.route-output.other { color: #c7d5dc; }
.route-output.active { box-shadow: inset 3px 0 currentColor; background: #253746; }
.behavior-rules { padding: 10px; border: 1px solid #344b55; border-radius: 6px; background: #17232b; color: #c5d6dc; font-size: 12px; line-height: 1.45; }
.behavior-rules h3 { margin: 0 0 7px; color: #d9e9ed; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.behavior-rules p { margin: 0; }
.behavior-rules p + p { margin-top: 6px; color: #aebfc7; }
.behavior-rules strong { color: #dce7e9; }
.machine-state { display: grid; gap: 4px; margin-top: 9px; padding-top: 9px; border-top: 1px solid #344b55; color: #c7d5dc; }
.tick-counts { display: flex; gap: 7px; flex-wrap: wrap; }
.tick-count { display: inline-flex; align-items: center; gap: 7px; padding: 5px 8px; border: 1px solid currentColor; border-radius: 5px; font-size: 12px; }
.tick-count.green { color: #8df0a9; background: #19332a; }
.tick-count.orange { color: #f6a04d; background: #38291c; }
.tick-count strong { font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-wrap: wrap; gap: 7px; }
.actions button { padding: 7px 9px; font-size: 12px; }
.actions .primary { border-color: #398f8c; background: #173a3a; }
.actions button.danger { border-color: #d65c60; color: #ffe0df; background: #6b252a; }
.actions button.danger:hover { border-color: #ff888b; background: #873035; }
.sidebar .machine-settings { padding: 11px; border: 1px solid #3e5865; border-radius: 7px; background: #1a2933; }
.machine-settings h3 { margin: 0 0 10px; color: #d9e9ed; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.machine-settings .actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.machine-settings .actions button { min-height: 36px; padding: 7px 8px; border: 1px solid #72909d; border-radius: 4px; background: linear-gradient(#3b5361, #263b48); box-shadow: inset 0 1px 0 #ffffff40, inset 0 -1px 0 #101d27, 0 3px 0 #0b171e, 0 5px 8px #0008; color: #f2f8fa; font-size: 12px; font-weight: 750; line-height: 1.2; text-shadow: 0 1px 1px #0009; }
.machine-settings .actions button:hover { border-color: #a5c6d2; background: linear-gradient(#4b6b7a, #304d5b); }
.machine-settings .actions button:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 0 2px 4px #08131bb3, 0 1px 0 #0b171e; }
.machine-settings .actions button.danger { border-color: #df777a; background: linear-gradient(#a7484e, #702b32); color: #fff1ef; }
.machine-settings .actions button.danger:hover { border-color: #ff9b9b; background: linear-gradient(#b9575b, #83343a); }
.machine-settings .actions .full-row { grid-column: 1 / -1; }
.machine-settings .actions button.tick-color { white-space: nowrap; }
.machine-settings .actions button.tick-color.green { color: #8df0a9; }
.machine-settings .actions button.tick-color.orange { color: #f6a04d; }
.hint { margin-bottom: 10px; }
.component-panel h2 { margin-bottom: 11px; }
.key { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 6px; color: #c7d5dc; font-size: 12px; }
.key-entry { display: inline-flex; align-items: center; gap: 8px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 5px; background: #17232b; white-space: nowrap; }
.dot { width: 10px; height: 10px; flex: none; border-radius: 50%; background: var(--muted); }
/* @full-only:start */.dot.comparer { background: var(--amber); }/* @full-only:end */
/* @full-only:start */.dot.gate { background: var(--cyan); }/* @full-only:end */
.dot.sorter { background: var(--sorter); }
/* @full-only:start */.dot.lefter { background: var(--lefter); }/* @full-only:end */
.dot.counter { background: var(--counter); }
.dot.marker { background: var(--marker); }
.dot.router { background: var(--router); }
.dot.fire_pit { background: var(--fire_pit); }
/* @full-only:start */.dot.improver { background: var(--improver); }/* @full-only:end */
.dot.signal { background: var(--green); box-shadow: 0 0 8px var(--green); }

@media (max-width: 1300px) { .tool kbd { display: none; } }
@media (max-width: 1050px) {
  main { grid-template-columns: minmax(650px, 1fr) 250px; }
  .tool { font-size: 12px; }
}

#gameCanvas.deleting {
  cursor: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgdmlld0JveD0iMCAwIDQwIDQwIj48cmVjdCB4PSIxMCIgeT0iMTMiIHdpZHRoPSIyNyIgaGVpZ2h0PSIyMCIgc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0xOSAxOCA0IDUtNCA1bTYtMTAgNCA1LTQgNSIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjN2ZkNGM5IiBzdHJva2Utd2lkdGg9IjIuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+CjxwYXRoIGQ9Ik0xIDF2MTlsNC41LTQuNSA0IDcuNSAzLjUtMi00LThoN1oiIGZpbGw9IiNmZmRhNGYiIHN0cm9rZT0iIzE0MjEyYSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+Cjwvc3ZnPg==") 1 1, crosshair;
}

.main-menu-actions { display: grid; gap: 10px; width: min(300px, 100%); margin: 25px auto 5px; }
.main-menu-actions button { padding: 12px 18px; font-size: 16px; text-align: center; }
.main-menu-actions[hidden], .main-menu-actions button[hidden], #scenarioPicker[hidden] { display: none; }
#newGameButton, #homeBackButton { border-color: #398f8c; background: #173a3a; }
#homeOptionsButton { margin-top: 8px; padding: 8px; color: var(--muted); font-size: 13px; }
.picker-description { margin: 10px 0; color: #aebfc7; font-size: 13px; }
.picker-back { margin-top: 18px; padding: 8px 20px; }

.menu-status { margin-top: 14px; color: #aee6e1; text-align: center; font-size: 13px; }
