:root {
  color-scheme: dark;
  --dark: #153936;
  --darker: #102d2b;
  --ink: #25423b;
  --paper: #f2e9d3;
  --paper-dark: #e5d9ba;
  --mint: #a2c3a9;
  --gold: #efb451;
  --orange: #dd7d48;
  --muted: #a4bcb0;
  --red: #b7533f;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 10% 0%, #254b43 0, transparent 55%), radial-gradient(ellipse at 95% 100%, #23443b 0, transparent 45%), var(--darker);
  color: var(--paper);
  font-family: 'Trebuchet MS', 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; }
button:focus-visible, canvas:focus-visible { outline: 3px solid var(--gold); outline-offset: 4px; }
.app { width: min(1280px, calc(100% - 48px)); margin: 0 auto; padding: 24px 0 18px; }
.masthead { display: flex; justify-content: space-between; align-items: center; gap: 22px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 17px; }
.crest { width: 69px; height: 76px; flex-shrink: 0; transform: rotate(-6deg); }
.crest svg { width: 100%; height: 100%; filter: drop-shadow(3px 4px 0 #0c28274d); }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: 1.85px; text-transform: uppercase; margin: 0 0 6px; }
.brand .eyebrow { color: var(--mint); }
h1 { font-family: Georgia, 'Times New Roman', serif; font-size: clamp(29px, 3.4vw, 43px); line-height: 1.08; font-weight: 700; letter-spacing: -1.6px; margin: 0; }
.title-dot { color: var(--gold); }
.tagline { color: #becfc0; font-size: 13px; margin: 7px 0 0; }
.header-right { display: flex; align-items: center; gap: 23px; }
.permit { text-align: right; font-size: 9px; color: var(--mint); letter-spacing: 1.2px; line-height: 1.8; }
.permit b { font: italic 15px Georgia, serif; color: var(--paper); letter-spacing: 0; }
.sound-button { background: #234b42; border: 1px solid #688e754d; border-radius: 8px; color: #d0ddcb; padding: 11px 12px; display: flex; align-items: center; gap: 8px; font-size: 11px; white-space: nowrap; }
.sound-button:hover { background: #315c4e; }
.sound-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.workbench { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 18px; align-items: start; }
.scene-panel { border: 1px solid #f3e8cf44; background: var(--paper); color: var(--ink); border-radius: 13px; overflow: hidden; box-shadow: 0 14px 40px #041d2540; }
.phase-strip { height: 46px; display: flex; align-items: center; justify-content: space-between; padding: 0 19px; background: var(--paper); border-bottom: 1px solid #25423b25; }
.steps { display: flex; gap: 10px; align-items: center; }
.step { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .9px; color: #8e9a87; display: flex; gap: 6px; align-items: center; }
.step i { display: inline-grid; place-items: center; width: 20px; height: 20px; font-size: 10px; border: 1px solid #a0aa94; border-radius: 50%; font-style: normal; }
.step.active { color: var(--ink); }
.step.active i { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.step-divider { color: #b8bfa8; font-size: 14px; }
.attempt-label { font-size: 9px; font-weight: 800; letter-spacing: 1.2px; color: #657d68; }
.canvas-wrap { position: relative; background: #d5dfc5; }
canvas { display: block; width: 100%; aspect-ratio: 1120 / 640; height: auto; cursor: crosshair; touch-action: manipulation; }
canvas.running { cursor: default; }
.foreman-note { display: flex; flex-direction: column; justify-content: center; gap: 5px; min-height: 67px; padding: 12px 19px 13px; border-top: 1px solid #d4cfb6; }
.note-label { display: flex; align-items: center; gap: 6px; font-size: 9px; font-weight: 800; letter-spacing: 1.5px; color: #6c806c; }
.status-dot { display: inline-block; width: 6px; height: 6px; background: #708f72; border-radius: 50%; }
.status-dot.testing { background: #d79242; animation: pulse 1s ease-in-out infinite; }
.status-dot.failure { background: var(--red); }
.status-dot.success { background: #5b9571; }
.foreman-note p { font-size: 12px; line-height: 1.45; margin: 0; min-height: 17px; }
.control-panel { background: var(--paper); color: var(--ink); padding: 17px; border: 1px solid #e4dac0; border-radius: 13px; box-shadow: 0 14px 40px #041d2530; }
.panel-head { margin-bottom: 12px; }
.panel-head .eyebrow { color: #7b8768; font-size: 9px; }
.panel-head h2 { font-family: Georgia, serif; margin: 0 0 6px; font-size: 24px; letter-spacing: -.5px; }
.panel-head > p:last-child { font-size: 11px; color: #657b67; line-height: 1.5; margin: 0; }
.budget-card { background: #e8dec4; border-radius: 8px; padding: 10px 11px 8px; margin-bottom: 14px; }
.budget-top { display: flex; align-items: center; gap: 9px; }
.bolt-icon { width: 32px; height: 32px; flex-shrink: 0; }
.bolt-icon svg { width: 100%; height: 100%; stroke: #6e7453; fill: #eab457; stroke-width: 2; }
.bolt-icon circle { fill: #e8dec4; }
.metric-label { font-size: 8px; font-weight: 800; letter-spacing: 1px; display: block; }
.budget-number { display: flex; align-items: baseline; gap: 5px; }
.budget-number strong, .payload strong { font-size: 27px; line-height: 1.1; font-weight: 800; }
.budget-number > span { font-size: 11px; color: #7d876b; }
.payload { margin-left: auto; border-left: 1px solid #b2b79b; padding-left: 11px; }
.payload strong { color: #a56338; }
.payload small { font-size: 14px; }
.budget-track { height: 4px; margin-top: 7px; background: #cdcbb0; border-radius: 8px; overflow: hidden; }
.budget-track > div { background: #73927a; height: 100%; width: 100%; border-radius: inherit; transition: width .25s ease; }
.budget-card.nudge { animation: nudge .25s ease-in-out 2; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 5px; margin-bottom: 8px; }
.section-heading h3 { font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; margin: 0; font-weight: 800; }
.section-heading > span { font-size: 7px; letter-spacing: .8px; color: #7a8a72; font-weight: 800; }
.tools { display: grid; gap: 5px; }
.tool { display: flex; align-items: center; gap: 8px; text-align: left; padding: 6px 9px; min-height: 49px; border: 1.5px solid #cdd0b7; background: #f5eedc; color: var(--ink); border-radius: 7px; position: relative; transition: border-color .15s, background .15s, transform .15s; }
.tool:not(:disabled):hover { background: #e9e8d0; border-color: #8da68b; transform: translateX(-2px); }
.tool.selected { border-color: #497458; background: #dfe7ce; box-shadow: inset 3px 0 #497458; }
.tool:disabled { opacity: .67; }
.tool-icon { width: 37px; height: 32px; flex-shrink: 0; }
.tool-icon svg { width: 100%; height: 100%; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.timber-icon svg { fill: #c99a63; }
.timber-icon path + path, .timber-icon ellipse { fill: none; stroke-width: 1.4; }
.iron-icon svg { fill: #a1b6a6; }
.iron-icon path + path { fill: none; }
.iron-icon circle { fill: #25423b; stroke: none; }
.brace-icon svg { fill: #e7b95e; }
.brace-icon path + path { fill: none; stroke-width: 1; }
.brace-icon circle { fill: #25423b; }
.erase-icon svg { fill: #c68973; }
.erase-icon path + path { fill: none; }
.tool-copy { display: flex; flex-direction: column; gap: 3px; }
.tool-copy b { font-size: 12px; }
.tool-copy small { font-size: 10px; color: #6f806a; }
kbd { font: 9px 'Trebuchet MS', sans-serif; color: #7c8d71; border: 1px solid #c4cbb2; border-radius: 3px; padding: 2px 4px; margin-left: auto; background: #f5efdd80; }
.inspect-section { margin-top: 14px; }
.span-buttons { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.span-buttons button { display: flex; flex-direction: column; gap: 3px; align-items: center; justify-content: center; height: 44px; background: #e9e2ce; border: 1px dashed #b4bba4; border-radius: 5px; color: #879680; padding: 3px; }
.span-buttons button span { font-size: 8px; letter-spacing: 1px; }
.span-buttons button b { font-size: 12px; }
.span-buttons button.weak { color: #a3653a; border-style: solid; border-color: #c79c69; background: #eedcbb; }
.span-buttons button.safe { color: #44694e; border-style: solid; border-color: #9db496; background: #dce5cc; }
.span-buttons button.hot { color: #a34837; background: #e8bba1; border-color: #b75b43; }
.span-buttons button.hovered:not(:disabled), .span-buttons button:not(:disabled):hover { outline: 2px solid #547a59; outline-offset: 1px; }
.span-buttons button:disabled { opacity: .8; }
.build-hint { margin: 10px 0 12px; padding: 0 0 0 9px; border-left: 2px solid #bac6a6; color: #728064; font-size: 10px; line-height: 1.6; min-height: 32px; }
.build-hint.ready { color: #476d4f; border-left-color: #6e9570; }
.build-hint.bad { color: #a35b3f; border-left-color: #c58866; }
.test-button { width: 100%; display: flex; align-items: center; justify-content: space-between; border: 1.5px solid #ad7c3e; border-radius: 7px; background: var(--gold); color: var(--ink); min-height: 47px; padding: 11px 15px; font-size: 12px; letter-spacing: 1px; font-weight: 900; box-shadow: 0 3px 0 #b67e3c; transition: background .15s, transform .15s, box-shadow .15s; }
.test-button:not(:disabled):hover { background: #f7c674; transform: translateY(-1px); box-shadow: 0 4px 0 #b67e3c; }
.test-button:not(:disabled):active { transform: translateY(3px); box-shadow: none; }
.test-button > span:last-child { font-size: 23px; line-height: 1; }
.test-button:disabled { background: #d1d8bf; color: #748570; border-color: #abb99b; box-shadow: 0 3px 0 #a5b196; font-size: 10px; }
.clear-button { display: block; width: 100%; background: none; border: 0; font-size: 10px; color: #78876c; text-decoration: underline; text-underline-offset: 3px; padding: 13px 0 0; min-height: 28px; }
.clear-button:not(:disabled):hover { color: #25423b; }
.clear-button:disabled { opacity: .4; }
.verdict { position: absolute; top: 6%; left: 54%; transform: translateX(-50%) rotate(-2deg); width: min(320px, 47%); padding: 19px 22px 17px; border: 2px solid #557459; border-radius: 3px; background: #f4ecd7; box-shadow: 5px 7px 0 #25423b20, 0 8px 25px #25423b20; text-align: center; animation: paper-in .35s cubic-bezier(.22,1.4,.6,1); pointer-events: none; }
.verdict::before, .verdict::after { content: ''; position: absolute; width: 40px; height: 13px; background: #e5bc7770; border-left: 1px solid #d4a46030; border-right: 1px solid #d4a46030; top: -7px; transform: rotate(-12deg); }
.verdict::before { left: 12px; }.verdict::after { right: 11px; transform: rotate(9deg); }
.verdict-kicker { font-size: 8px; text-transform: uppercase; letter-spacing: 2px; color: #768366; font-weight: 800; }
.verdict h2 { font: 900 31px Georgia, serif; color: #43674c; margin: 7px 0 9px; letter-spacing: -1px; }
.verdict p { font-size: 11px; line-height: 1.5; margin: 0; }
.verdict .verdict-quip { font: italic 12px/1.5 Georgia, serif; color: #738066; margin-top: 7px; }
.verdict-stamp { display: inline-block; font-size: 10px; font-weight: 900; letter-spacing: 1.5px; color: #587654; border: 2px solid currentColor; border-radius: 3px; padding: 4px 7px; margin-top: 11px; transform: rotate(5deg); text-transform: uppercase; }
.verdict.failure { border-color: #b77555; }
.verdict.failure h2 { color: #a5563c; }
.verdict.failure .verdict-stamp { color: #b56548; }
.footer { margin-top: 17px; display: flex; justify-content: space-between; gap: 15px; align-items: center; color: #a7bca9; font-size: 9px; }
.footer p { margin: 0; line-height: 1.6; }
.footer p b { color: #cfdbc6; font-weight: 700; font-size: 9px; }
.footer p span { color: #668b74; margin: 0 5px; }
.footer-joke { font: italic 11px Georgia, serif; color: #8da690; text-align: right; }
.noscript { padding: 15px; background: var(--gold); color: var(--ink); }
@keyframes nudge { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes pulse { 50% { opacity: .3; } }
@keyframes paper-in { from { opacity: 0; transform: translateX(-50%) translateY(-15px) rotate(3deg) scale(.93); } to { opacity: 1; transform: translateX(-50%) rotate(-2deg) scale(1); } }
@media (min-width: 1450px) { .app { padding-top: 34px; } .masthead { margin-bottom: 26px; } }
@media (max-width: 1120px) { .app { width: calc(100% - 32px); } .workbench { grid-template-columns: minmax(0, 1fr) 272px; gap: 14px; } .control-panel { padding: 17px; } .header-right .permit { display: none; } .footer-joke { display: none; } .verdict { padding: 13px 14px; } .verdict h2 { font-size: 26px; } }
@media (max-width: 850px) {
  .app { width: calc(100% - 28px); padding-top: 18px; }
  .masthead { margin-bottom: 17px; }
  .crest { width: 54px; height: 60px; }
  .brand { gap: 12px; }
  .brand .eyebrow { font-size: 8px; letter-spacing: 1px; }
  h1 { font-size: clamp(25px, 4.8vw, 37px); letter-spacing: -1px; }
  .tagline { margin-top: 5px; font-size: 11px; }
  .workbench { grid-template-columns: 1fr; }
  .control-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; padding: 17px; }
  .panel-head { margin: 0; align-self: center; }
  .panel-head h2 { font-size: 22px; }
  .budget-card { margin: 0; }
  .tool-section { grid-column: 1 / -1; }
  .tools { grid-template-columns: repeat(4, 1fr); gap: 7px; }
  .tool { flex-direction: column; align-items: flex-start; padding: 9px; gap: 3px; }
  .tool-icon { width: 33px; height: 28px; }
  .tool-copy { gap: 4px; }
  .tool-copy b { font-size: 11px; }
  .tool-copy small { font-size: 9px; }
  .tool kbd { position: absolute; top: 8px; right: 8px; }
  .inspect-section { margin: 0; grid-column: 1; }
  .build-hint { margin: 0; align-self: end; }
  .test-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 15px; }
  .test-button { flex: 1; min-height: 44px; }
  .clear-button { width: auto; flex-shrink: 0; padding: 10px; }
  .foreman-note { min-height: 60px; }
  .verdict { width: min(320px, 47%); }
}
@media (max-width: 480px) {
  .app { width: calc(100% - 20px); padding-top: 14px; }
  .crest { width: 42px; height: 48px; }
  .brand { gap: 8px; }
  .brand .eyebrow { font-size: 6px; letter-spacing: 1px; }
  h1 { font-size: 25px; letter-spacing: -1.2px; }
  .tagline { font-size: 10px; }
  .header-right { gap: 0; }
  .sound-button { padding: 8px; border-radius: 6px; }
  .sound-button span { display: none; }
  .phase-strip { height: 37px; padding: 0 11px; }
  .steps { gap: 7px; }
  .step { font-size: 9px; letter-spacing: .6px; gap: 4px; }
  .step i { width: 17px; height: 17px; font-size: 9px; }
  .attempt-label { font-size: 7px; letter-spacing: .8px; }
  .foreman-note { padding: 10px 12px; min-height: 63px; }
  .foreman-note p { font-size: 10px; }
  .control-panel { padding: 14px; gap: 13px 10px; }
  .panel-head .eyebrow { font-size: 7px; letter-spacing: 1.3px; }
  .panel-head h2 { font-size: 20px; }
  .panel-head > p:last-child { font-size: 9px; }
  .budget-card { padding: 10px 8px 8px; }
  .budget-top { gap: 5px; }
  .bolt-icon { width: 21px; height: 21px; }
  .budget-number strong, .payload strong { font-size: 24px; }
  .budget-number > span { font-size: 9px; }
  .metric-label { font-size: 6px; letter-spacing: .6px; }
  .payload { padding-left: 7px; }
  .tools { gap: 5px; }
  .tool { padding: 7px 6px; }
  .tool-icon { width: 29px; height: 26px; }
  .tool-copy b { font-size: 9px; }
  .tool-copy small { font-size: 8px; line-height: 1.3; }
  .tool kbd { display: none; }
  .section-heading h3 { font-size: 8px; letter-spacing: .8px; }
  .section-heading > span { font-size: 6px; letter-spacing: .4px; }
  .span-buttons { gap: 4px; }
  .span-buttons button { height: 43px; }
  .span-buttons button b { font-size: 10px; }
  .build-hint { font-size: 9px; line-height: 1.5; }
  .test-actions { gap: 5px; }
  .test-button { font-size: 10px; padding: 10px 12px; }
  .clear-button { font-size: 9px; padding: 8px; }
  .footer { margin-top: 12px; }
  .footer p, .footer p b { font-size: 8px; }
  .footer p span { margin: 0 2px; }
  .verdict { top: 5%; left: 58%; width: 51%; padding: 9px 10px; }
  .verdict-kicker { font-size: 6px; letter-spacing: 1px; }
  .verdict h2 { font-size: 21px; margin: 3px 0 5px; }
  .verdict p { font-size: 8px; line-height: 1.4; }
  .verdict .verdict-quip { font-size: 9px; margin-top: 4px; }
  .verdict-stamp { font-size: 7px; margin-top: 7px; padding: 3px 5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
