:root { font-family: Inter, "Segoe UI", Arial, sans-serif; color: #eef0ec; background: #171b20; font-synthesis: none; --orange: #e89157; --line: #363f46; --mono: "Cascadia Code", Consolas, monospace; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: radial-gradient(ellipse at 60% -20%, #35404a 0, transparent 60%); min-height: 100svh; }
button, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: default; opacity: .35; }
button:focus-visible, a:focus-visible, select:focus-visible, svg:focus-visible { outline: 3px solid #df6b41; outline-offset: 4px; }
a { color: inherit; text-decoration: none; }
.app { max-width: 1190px; padding: 0 42px; margin: auto; }
.topbar { height: 70px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.quiet { border: 0; background: none; color: #b7c0c4; font-size: 12px; padding: 8px; border-radius: 6px; }
.quiet:hover:not(:disabled) { background: #29323a; color: #fff5e8; }
.top-actions .quiet { border: 1px solid var(--line); }
.intro { padding: 23px 0 27px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.material-tag { font: 9px var(--mono); letter-spacing: 1.1px; color: #b4c0c5; display: flex; align-items: center; gap: 9px; padding-bottom: 6px; }
.material-tag > span:last-child { letter-spacing: 0; color: #a2adb3; border-left: 1px solid #475259; padding-left: 9px; }
.material-swatch { width: 18px; height: 18px; border: 1px solid #91a0a4; border-radius: 3px; background: repeating-linear-gradient(0deg, #ffffff18 0 1px, transparent 1px 3px), linear-gradient(125deg, #a2b0b9, #eff4f5 45%, #8da2af); box-shadow: 1px 2px 0 #566873; }
h1 { font-family: Impact, 'Arial Narrow', sans-serif; text-transform: uppercase; font-size: 60px; letter-spacing: 1px; line-height: 1.05; margin: 0; font-weight: 400; }
h1 > span { color: var(--orange); }
.workbench { display: grid; grid-template-columns: minmax(0, 1fr) 294px; gap: 32px; }
.sheet-panel { min-width: 0; }
.sheet-toolbar { height: 36px; display: flex; align-items: flex-start; justify-content: space-between; }
.stock-label { font: 10px var(--mono); letter-spacing: 1.3px; display: flex; gap: 10px; align-items: center; padding-top: 5px; }
.stock-label > span { color: #adb6bb; letter-spacing: 0; border-left: 1px solid #424c53; padding-left: 10px; }
.mode-label select { font-size: 11px; border: 0; border-bottom: 1px solid #424c53; background: transparent; color: #bfc6c9; padding: 4px 19px 5px 5px; cursor: pointer; }
.machine { position: relative; padding: 30px 27px 31px; border: 1px solid #47535c; border-radius: 3px; background: linear-gradient(135deg, #354049, #232d35 70%, #1c252d); box-shadow: 0 3px 0 #0d1217, 0 14px 25px -22px #333; overflow: hidden; }
.board-wrap { box-shadow: 0 0 0 3px #253b44, 0 0 0 5px #b3bdbb, 0 0 0 6px #879995, 0 5px 10px #39433433; border-radius: 2px; overflow: hidden; background: #253641; }
.board-wrap svg { display: block; width: 100%; height: auto; touch-action: none; user-select: none; }
.machine-screw { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #56646e; border: 1px solid #74818a; box-shadow: 0 1px 1px #fff8; }
.machine-screw:after { content: ""; position: absolute; left: 2px; right: 2px; height: 1px; top: 2px; background: #1e2830; transform: rotate(-40deg); }
.top-left { top: 9px; left: 9px; } .top-right { top: 9px; right: 9px; }
.bottom-left { bottom: 9px; left: 9px; } .bottom-right { bottom: 9px; right: 9px; }
.ruler-top { position: absolute; top: 12px; left: 28px; right: 28px; height: 8px; background: repeating-linear-gradient(90deg, #7b8a92 0 1px, transparent 1px calc(100% / 26)); border-bottom: 1px solid #62717a; }
.ruler-left { position: absolute; top: 30px; bottom: 32px; left: 11px; width: 8px; background: repeating-linear-gradient(0deg, #7b8a92 0 1px, transparent 1px 5%); border-right: 1px solid #62717a; }
.machine-caption { position: absolute; bottom: 9px; right: 27px; font: 7px var(--mono); color: #b5c0c5; letter-spacing: 1.1px; }
.machine-caption i { display: inline-block; width: 4px; height: 4px; background: #63805b; border-radius: 50%; vertical-align: 1px; margin-left: 5px; }
.sheet-part { cursor: grab; }
.sheet-part.lifted { opacity: 0; }
.machine, .board-wrap, .board-wrap svg { overflow: visible; }
.sheet-part.invalid .part-fill { fill: #e78b80; fill-opacity: .85; stroke: #c43c30; stroke-width: 3; }
.sheet-part.invalid .part-label { fill: #732a24; opacity: 1; }
.sheet-part:active { cursor: grabbing; }
.part-fill { stroke: #1b2d38; stroke-width: 1; stroke-linejoin: round; paint-order: stroke; fill-rule: evenodd; }
.part-depth { fill: #243844; fill-rule: evenodd; transform: translate(.7px, 1.3px); pointer-events: none; }
.part-grain { fill-rule: evenodd; opacity: .65; pointer-events: none; }
.part-highlight { fill: none; stroke: #f2f9ff; stroke-opacity: .65; stroke-width: .45; pointer-events: none; transform: translate(-.25px, -.4px); }
.sheet-part.selected .part-fill { stroke: #ffd081; stroke-width: 2.1; }
.sheet-part.selected { filter: drop-shadow(0 0 2px #efab4466); }
.part-label { font: 500 4.4px var(--mono); letter-spacing: .25px; fill: #354d5c; opacity: .8; pointer-events: none; text-anchor: middle; }
.preview-path { fill: #e0c785; fill-opacity: .15; stroke: #f6d88a; stroke-width: 1.6; stroke-dasharray: 4 3; fill-rule: evenodd; }
.preview-path.invalid { fill: #f57152; stroke: #ff8f72; }
.under-sheet { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; min-height: 36px; }
.status { font-size: 11px; color: #a7b2b8; line-height: 1.6; }
.status.warning { color: #ffad96; }
.edit-tools { display: flex; flex-shrink: 0; margin-left: auto; }
.parts-panel { position: relative; z-index: 2; }
.tray-heading { display: flex; justify-content: space-between; align-items: center; height: 36px; padding-bottom: 12px; }
.tray-heading h2 { font-size: 13px; margin: 0; font-weight: 650; }
.tray-heading > span { font: 9px var(--mono); color: #9facb5; }
.tray { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-bottom: 23px; border-radius: 8px; }
.part-card { height: 76px; min-width: 0; border: 1px solid #46535c; border-radius: 3px; background: linear-gradient(145deg, #303c46, #242e37); padding: 6px; position: relative; color: #afbbc0; touch-action: none; user-select: none; cursor: grab; transition: background .15s, border-color .15s; }
.part-card:hover:not(:disabled) { background: #3b4b57; border-color: #e89157; }
.part-card.selected { background: #47372d; border-color: #e89157; box-shadow: 0 0 0 2px #caa96918; }
.part-card svg { height: 53px; width: 100%; overflow: visible; pointer-events: none; filter: drop-shadow(0 2px 1px #4654471c); }
.part-card .part-fill { stroke: #425561; stroke-width: 1.4; }
.part-card .part-code { position: absolute; bottom: 5px; left: 8px; font: 8px var(--mono); color: #aab7bf; }
.part-card.placed { background: transparent; border-style: dashed; border-color: #3a444c; opacity: .8; }
.part-card.placed svg { opacity: .28; filter: none; }
.part-card.invalid { border-color: #d07060; opacity: 1; }
.part-card.invalid svg { opacity: .55; }
.part-card.invalid .part-fill { fill: #e78b80; }
.part-card.invalid .checkmark { color: #bd3f30; }
.part-card .checkmark { position: absolute; top: 5px; right: 7px; color: #c2aa88; font-size: 12px; }
.tray-drop-label { display: none; position: absolute; left: 50%; top: 45px; transform: translateX(-50%); padding: 9px 13px; border-radius: 6px; color: #fff; background: #4b7151; font-size: 12px; white-space: nowrap; z-index: 3; pointer-events: none; }
.return-target .tray { outline: 2px dashed #719577; outline-offset: 7px; }
.return-target .tray-drop-label { display: block; }
.piece-tools { position: fixed; z-index: 30; display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: max-content; padding: 4px; background: #222c34; border: 1px solid #53616b; border-radius: 9px; box-shadow: 0 5px 20px #1c2d2730, 0 1px 3px #1c2d2718; }
.piece-name { grid-column: 1 / -1; padding: 5px 10px 2px; font-size: 10px; color: #b5c2c8; }
.piece-tools:has(#remove[hidden]) { grid-template-columns: 1fr; }
.piece-tools button { display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 90px; min-height: 44px; border: 0; border-radius: 6px; background: transparent; padding: 8px 11px; color: #edf0ed; font-size: 12px; }
.piece-tools button:hover { background: #3c4851; }
.piece-tools #remove:hover { background: #502f2b; color: #ffb4a3; }
.piece-tools svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.score-row { display: flex; justify-content: space-between; }
.score-row strong { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 31px; line-height: 1; font-weight: 600; letter-spacing: -1.3px; display: block; }
.score-row strong > span { font-size: 16px; font-weight: 400; color: #98a8b1; letter-spacing: -.5px; }
.stat-label { font: 8px var(--mono); letter-spacing: 1px; color: #a3b0b8; display: block; margin-top: 6px; }
.yield-stat { text-align: right; }
.yield-stat strong { font-size: 27px; padding-top: 4px; }
.yield-track { height: 3px; border-radius: 2px; background: #35414a; margin: 14px 0 16px; overflow: hidden; }
#yield-fill { background: #e89157; height: 100%; transition: width .3s; width: 0; }
.cut-button { display: flex; align-items: center; justify-content: center; gap: 11px; width: 100%; padding: 17px 16px; border: 0; border-radius: 3px; background: var(--orange); box-shadow: 0 3px 0 #a85830; color: #211c19; font-size: 19px; font-weight: 650; letter-spacing: -.5px; transition: background .15s, transform .15s; }
.cut-button:disabled { background: #3d4850; box-shadow: 0 3px 0 #253039; color: #9eacb4; opacity: 1; }
.cut-button:hover:not(:disabled) { background: #ffb278; transform: translateY(-1px); }
.cut-button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #a85830; }
.cut-icon { font-size: 25px; line-height: 1; }
.cut-arrow { margin-left: auto; font-weight: 400; }
.cutting .sheet-part { cursor: default; }
.cutting #sheet-grid { opacity: .35; }
.cut-finished .part-fill { stroke: #172d3b; stroke-width: 1.1; }
.cut-finished .part-highlight { stroke-opacity: .6; }
.cut-finished { animation: part-finish .5s ease-out; }
.cut-hole { visibility: hidden; }
.cut-hole.released { visibility: visible; }
.hole-cavity { fill: #182933; stroke: #293e47; stroke-width: .5; }
.hole-slug { fill: url(#steel); transform-box: fill-box; transform-origin: center; }
.released .hole-slug { animation: slug-drop .5s ease-in forwards; }
#sheet-base, #sheet-grain, #sheet-grid { transition: opacity .8s; }
.cut-complete #sheet-base { opacity: .2; }
.cut-complete #sheet-grain { opacity: .12; }
.cut-complete #sheet-grid { opacity: 0; }
.cut-complete .sheet-part { filter: drop-shadow(1px 3px 1px #071319b0); }
.cut-complete .part-fill { filter: brightness(1.12); }
.cooled-cut { stroke: #34434b; transition: stroke .6s; }
.cut-complete #cut-trails { opacity: 0; transition: opacity .7s; }
@keyframes slug-drop { to { transform: translateY(7px) scale(.91); opacity: 0; } }
.cutting .machine-caption i { background: #f16d3b; box-shadow: 0 0 6px #ee722d; }
#drag-ghost { position: fixed; z-index: 40; pointer-events: none; display: none; filter: drop-shadow(0 8px 10px #17271c55); }
#drag-ghost svg { width: 100%; height: 100%; overflow: visible; }
#drag-ghost.invalid .part-fill { fill: #e78b80; stroke: #c43c30; stroke-width: 3; }
.is-dragging, .is-dragging * { cursor: grabbing !important; user-select: none !important; }
.result { margin-top: 12px; padding: 18px 20px; background: #253139; border: 1px solid #4b5d66; border-radius: 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.result h2 { font-size: 23px; font-weight: 650; letter-spacing: -.7px; margin: 0 0 5px; }
.result p { font-size: 11px; line-height: 1.6; color: #b8c4ca; margin: 0; }
.result-actions { display: flex; align-items: center; gap: 4px; }
.secondary { border: 1px solid #788993; border-radius: 5px; padding: 9px 12px; background: transparent; color: #e2c2a5; font-size: 11px; white-space: nowrap; }
.secondary:hover { background: #34434e; }
footer { margin: 22px 0 18px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; justify-content: flex-start; font-size: 10px; color: #9faeb7; font-weight: 650; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
@keyframes part-finish { 0% { filter: brightness(1.7); } 100% { filter: brightness(1); } }
@media (min-width: 1050px) and (max-height: 790px) {
  .app { max-width: min(1040px, 120svh); }
  .topbar { height: 52px; }
  .intro { padding: 18px 0 22px; }
  h1 { font-size: 46px; }
  .workbench { grid-template-columns: minmax(0, 1fr) 246px; gap: 24px; }
  .part-card { height: 58px; }
  .part-card svg { height: 36px; }
  .cut-button { padding: 13px; }
  .yield-track { margin: 11px 0 13px; }
  .machine { padding: 27px 23px 29px; }
  .ruler-top { left: 24px; right: 24px; }
  .ruler-left { left: 8px; top: 27px; }
  footer { margin: 12px 0 8px; padding-top: 10px; }
}
@media (max-width: 950px) {
  .app { padding: 0 24px; }
  .workbench { grid-template-columns: minmax(0, 1fr) 246px; gap: 24px; }
  .part-card { height: 66px; }
  .part-card svg { height: 44px; }
  .machine { padding: 27px 23px 30px; }
  .ruler-top { left: 24px; right: 24px; }
  .ruler-left { left: 8px; top: 27px; }
  .sheet-toolbar { gap: 6px; }
  .result { flex-wrap: wrap; }
}
@media (max-width: 720px) {
  .app { padding: 0 18px; max-width: 560px; }
  .topbar { height: 52px; }
  .brand { font-size: 13px; }
  .intro { padding: 16px 0 18px; display: block; }
  .material-tag { margin-top: 11px; padding-bottom: 0; font-size: 8px; }
  .material-swatch { width: 13px; height: 13px; }
  h1 { font-size: 42px; }
  .workbench { display: flex; flex-direction: column; gap: 14px; }
  .sheet-toolbar { height: 32px; }
  .machine { padding: 23px 20px 28px; }
  .ruler-top { top: 10px; left: 21px; right: 21px; height: 6px; }
  .ruler-left { top: 23px; bottom: 29px; left: 7px; width: 6px; }
  .machine-screw { width: 6px; height: 6px; }
  .top-left { top: 7px; left: 7px; } .top-right { top: 7px; right: 7px; }
  .bottom-left { bottom: 8px; left: 7px; } .bottom-right { bottom: 8px; right: 7px; }
  .machine-caption { right: 20px; font-size: 6px; bottom: 10px; letter-spacing: .8px; }
  .under-sheet { margin-top: 6px; gap: 8px; }
  .status { font-size: 10px; }
  .tray { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; margin-bottom: 17px; }
  .part-card { height: 57px; padding: 4px; }
  .part-card svg { height: 37px; }
  .part-card .part-code { font-size: 7px; left: 5px; bottom: 3px; }
  .part-card .checkmark { top: 2px; right: 3px; font-size: 10px; }
  .tray-heading { height: 29px; padding-bottom: 10px; }
  .tray-heading h2 { font-size: 12px; }
  .score-row { float: left; width: 43%; padding-top: 4px; }
  .score-row strong, .score-row .yield-stat strong { font-size: 23px; }
  .score-row strong > span { font-size: 12px; }
  .stat-label { font-size: 6px; letter-spacing: .4px; margin-top: 4px; }
  .yield-track { display: none; }
  .cut-button { width: 53%; margin-left: auto; font-size: 16px; padding: 13px 10px; min-height: 52px; gap: 7px; }
  .cut-icon { font-size: 22px; } .cut-arrow { font-size: 16px; }
  .result { margin-top: 9px; padding: 15px; }
  .result h2 { font-size: 21px; }
  footer { font-size: 9px; margin: 18px 0 16px; padding-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *:before, *:after { animation: none !important; transition: none !important; }
  .released .hole-slug { opacity: 0; }
}

.playground-nav a { display: inline-block; padding: 5px 12px; border: 2px solid #70538f; border-radius: 12px 15px 11px 14px; background: #eee4fc; box-shadow: 2px 3px 0 #d5c4f0; font-family: Fredoka, 'Trebuchet MS', sans-serif; font-size: 18px; font-weight: 500; line-height: 1.2; letter-spacing: -.02em; color: #493666; transform: rotate(-3deg); text-decoration: none; }
.playground-nav a:hover { background: #e6d8f8; }
.maker { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; min-height: 36px; font-size: 13px; font-weight: 400; }
.maker img { width: 24px; height: 24px; object-fit: contain; margin-left: 2px; }
.maker-name { font-size: 15px; font-weight: 600; color: #e8ecee; }
.maker:hover .maker-name { text-decoration: underline; text-underline-offset: 3px; }
.mode-label select { color-scheme: dark; }
.machine::before { content: ''; position: absolute; width: 44px; height: 3px; background: #e89157; left: 27px; top: -2px; }
@media (max-width: 720px) { .playground-nav a { font-size: 16px; } h1 { font-size: 46px; } }
