@charset "UTF-8";

:root {
  color-scheme: light;
  --paper: #f4f7fa;
  --white: #ffffff;
  --mint: #dceee5;
  --mint-deep: #bbdacc;
  --ink: #233e52;
  --muted: #72848b;
  --line: #e0e8e9;
  --cyan: #28a9c0;
  --pink: #ee6785;
  --yellow: #f4bc4b;
  --font: "Hiragino Sans GB", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; }
button { color: inherit; cursor: pointer; }
button { border: 0; }
button:disabled { cursor: not-allowed; opacity: .34; }
button, a, summary, [tabindex] { outline-offset: 4px; }
:focus-visible { outline: 3px solid #1888a8; }
button { transition: background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease; }
button:active:not(:disabled) { transform: translateY(1px); }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { display: inline-block; width: 20px; height: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.app { height: 100dvh; min-height: 690px; display: flex; flex-direction: column; overflow: hidden; }

/* A quiet rim around the little magnetic-tile world. */
.app-header { height: 88px; flex: 0 0 88px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 0 29px; background: #fbfcfd; border-bottom: 1px solid #e4ebeb; }
.brand { display: flex; align-items: center; gap: 13px; flex-shrink: 0; }
.brand-mark { position: relative; display: block; width: 42px; height: 47px; }
.brand-mark i { display: block; position: absolute; border-radius: 3px; border: 3px solid; }
.brand-mark i:nth-child(1) { width: 24px; height: 28px; border-color: #32b7c9; background: #94dce180; top: 15px; left: 0; transform: rotate(-10deg); }
.brand-mark i:nth-child(2) { width: 25px; height: 29px; border-color: #ed8299; background: #f6adc285; top: 13px; left: 17px; transform: rotate(9deg); }
.brand-mark i:nth-child(3) { width: 25px; height: 25px; border-color: #eeb94f; background: #f9dd8999; top: 0; left: 10px; transform: rotate(45deg) scale(.73); }
.brand-copy { display: flex; flex-direction: column; gap: 4px; }
.brand-copy strong { font-size: 19px; font-weight: 800; letter-spacing: .015em; }
.brand-copy > span { font-size: 11px; color: #809096; letter-spacing: .13em; }
.mode-switch { display: flex; gap: 4px; padding: 5px; border: 1px solid #e5ecee; border-radius: 15px; background: #edf2f4; }
.mode-button { display: flex; justify-content: center; align-items: center; gap: 7px; border-radius: 10px; background: transparent; padding: 11px 19px; font-size: 13px; color: #73818c; font-weight: 650; white-space: nowrap; }
.mode-button .icon { width: 17px; height: 17px; flex-basis: 17px; }
.mode-button.is-active, .mode-button[aria-pressed="true"] { color: #25566a; background: white; box-shadow: 0 2px 5px #243e520a, 0 0 0 1px #203c5106; }
.mode-button:hover { color: var(--ink); }
.header-actions { display: flex; align-items: center; gap: 20px; }
.save-indicator { display: flex; gap: 7px; align-items: center; font-size: 10px; color: #8a999d; }
.save-dot { width: 6px; height: 6px; border-radius: 100%; background: #8ebfa3; flex-shrink: 0; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 8px; border-radius: 9px; background: transparent; color: #658087; }
.icon-button:hover:not(:disabled) { background: #e9f1ef; color: var(--ink); }
.help-button { width: 35px; height: 35px; border: 1px solid #e3e9eb; border-radius: 50%; color: #84969e; }

.workshop { flex: 1; min-height: 0; display: grid; grid-template-columns: 176px minmax(340px, 1fr) 250px; grid-template-rows: minmax(0, 1fr) auto; gap: 15px; padding: 19px 22px 0; }
.blueprints-panel { grid-column: 1; grid-row: 1 / -1; min-width: 0; display: flex; flex-direction: column; padding: 9px 2px 0 0; }
.panel-heading { list-style: none; display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 750; cursor: pointer; }
.panel-heading::-webkit-details-marker { display: none; }
.panel-heading > span { display: flex; align-items: center; gap: 8px; }
.panel-heading .icon { width: 17px; height: 17px; flex-basis: 17px; color: #87a3a5; }
.panel-heading .disclosure-icon { display: none; width: 14px; }
.rail-description { font-size: 11px; color: #8b9aa0; margin: 8px 0 19px 25px; }
.blueprint-list { display: flex; flex-direction: column; gap: 10px; }
.blueprint-card { position: relative; display: block; width: 100%; text-align: left; padding: 10px 10px 12px; border-radius: 13px; border: 1.5px solid #e7edef; background: #fbfcfd; color: var(--ink); overflow: hidden; }
.blueprint-card:hover { border-color: #a8cfd0; background: white; }
.blueprint-card.is-active, .blueprint-card[aria-pressed="true"], .blueprint-card.active { border-color: #5eb7bd; background: white; box-shadow: 0 3px 8px #234b5205; }
.blueprint-card.is-active::after, .blueprint-card[aria-pressed="true"]::after, .blueprint-card.active::after { position: absolute; top: 8px; right: 8px; content: "✓"; display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: #53b2b7; color: white; font-size: 10px; }
.blueprint-card strong, .blueprint-card h3 { display: block; font-size: 13px; font-weight: 750; margin: 7px 0 5px; }
.blueprint-card p, .blueprint-card small, .blueprint-card .meta { color: #8c9a9f; font-size: 10px; line-height: 1.55; margin: 0; }
.blueprint-card img, .blueprint-card canvas, .blueprint-card > svg { display: block; width: 100%; height: 73px; object-fit: contain; border-radius: 7px; }
.blueprint-card .blueprint-thumb, .blueprint-card .thumb { width: 100%; height: 75px; display: flex; justify-content: center; align-items: center; background: #eef5f1; border-radius: 7px; }
.blueprint-card .blueprint-thumb svg, .blueprint-card .thumb svg { width: 110px; height: 72px; }
.blueprint-card .blueprint-meta { display: flex; align-items: center; justify-content: space-between; color: #91a0a4; font-size: 10px; margin-top: 4px; }
.blueprint-card-name { display: block; font-size: 13px; font-weight: 750; margin: 8px 0 4px; }
.blueprint-card-meta { display: block; font-size: 10px; line-height: 1.6; color: #7c929a; }
.blueprint-art { --art-unit: 1px; position: relative; display: block; width: 100%; height: 79px; border-radius: 7px; background: #eef5f1; isolation: isolate; }
.blueprint-art i { position: absolute; display: block; border: 3px solid; box-shadow: inset 1px 1px 0 #ffffff80; border-radius: 2px; }
.blueprint-art i:nth-child(4) { width: calc(88 * var(--art-unit)); height: calc(20 * var(--art-unit)); bottom: calc(5 * var(--art-unit)); left: calc(50% - 44 * var(--art-unit)); border: none; border-radius: 50%; background: #d5e8dc; box-shadow: none; z-index: -1; }
.blueprint-art--shelter i:nth-child(1) { width: calc(34 * var(--art-unit)); height: calc(33 * var(--art-unit)); left: calc(50% - 30 * var(--art-unit)); bottom: calc(16 * var(--art-unit)); border-color: #4db5cc; background: #80d1de55; transform: skewY(15deg); }
.blueprint-art--shelter i:nth-child(2) { width: calc(30 * var(--art-unit)); height: calc(33 * var(--art-unit)); left: calc(50% + 1 * var(--art-unit)); bottom: calc(16 * var(--art-unit)); border-color: #e580a5; background: #edb0c65c; transform: skewY(-17deg); }
.blueprint-art--shelter i:nth-child(3) { width: calc(45 * var(--art-unit)); height: calc(30 * var(--art-unit)); left: calc(50% - 22 * var(--art-unit)); bottom: calc(44 * var(--art-unit)); border-color: #edbc52; background: #f9da835e; transform: rotate(-17deg) skewX(28deg); }
.blueprint-art--pyramid i:nth-child(1), .blueprint-art--pyramid i:nth-child(2), .blueprint-art--pyramid i:nth-child(3) { width: calc(55 * var(--art-unit)); height: calc(56 * var(--art-unit)); bottom: calc(13 * var(--art-unit)); border: none; border-radius: 0; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.blueprint-art--pyramid i:nth-child(1) { left: calc(50% - 33 * var(--art-unit)); background: #70c6d7; transform: skewY(10deg); }
.blueprint-art--pyramid i:nth-child(2) { left: calc(50% - 6 * var(--art-unit)); width: calc(40 * var(--art-unit)); background: #eeb754; transform: skewY(-14deg); }
.blueprint-art--pyramid i:nth-child(3) { width: calc(32 * var(--art-unit)); height: calc(48 * var(--art-unit)); left: calc(50% - 15 * var(--art-unit)); bottom: calc(11 * var(--art-unit)); background: #e784ad9e; transform: skewY(6deg); }
.blueprint-art--pyramid i:nth-child(-n+3)::after { content: ""; position: absolute; inset: 5px 5px 4px; clip-path: polygon(50% 0, 100% 100%, 0 100%); background: #ffffff45; }
.blueprint-art--castle i:nth-child(1) { width: calc(25 * var(--art-unit)); height: calc(42 * var(--art-unit)); left: calc(50% - 36 * var(--art-unit)); bottom: calc(16 * var(--art-unit)); border-color: #4ab9cd; background: #a0dce654; transform: skewY(7deg); }
.blueprint-art--castle i:nth-child(2) { width: calc(25 * var(--art-unit)); height: calc(45 * var(--art-unit)); left: calc(50% + 11 * var(--art-unit)); bottom: calc(16 * var(--art-unit)); border-color: #a18ace; background: #bda9e25e; transform: skewY(-8deg); }
.blueprint-art--castle i:nth-child(3) { width: calc(31 * var(--art-unit)); height: calc(26 * var(--art-unit)); left: calc(50% - 16 * var(--art-unit)); bottom: calc(15 * var(--art-unit)); border-color: #edba5b; background: #f8d98d66; }
.blueprint-art--castle i:nth-child(-n+2)::before { content: ""; position: absolute; left: -3px; right: -3px; top: calc(-15 * var(--art-unit)); height: calc(16 * var(--art-unit)); clip-path: polygon(50% 0, 100% 100%, 0 100%); background: #ea8daea6; }
.together-note { text-align: center; margin: auto 0 13px; padding: 18px 0 10px; color: #8e9b9f; }
.together-note strong { display: block; font-size: 11px; letter-spacing: .06em; color: #84969b; margin: 9px 0 5px; font-weight: 600; }
.together-note p { font-size: 10px; line-height: 1.8; margin: 0; }
.together-drawing { position: relative; width: 50px; height: 24px; display: block; margin: auto; }
.together-drawing i { width: 17px; height: 17px; display: block; position: absolute; bottom: 0; border-radius: 3px; border: 2px solid #b3cbcc; transform: rotate(-10deg); }
.together-drawing i:nth-child(2) { left: 20px; transform: rotate(9deg); border-color: #dcbdc1; }
.together-drawing i:nth-child(3) { left: 12px; bottom: 14px; width: 15px; height: 15px; transform: rotate(45deg) scale(.75); border-color: #decf9f; }
.print-button { display: flex; justify-content: center; align-items: center; gap: 7px; width: 100%; background: transparent; border: 1px dashed #cbd9d9; border-radius: 9px; font-size: 11px; color: #7c929a; padding: 12px 5px; }
.print-button .icon { width: 16px; height: 16px; flex-basis: 16px; }
.print-button:hover { background: #e9f1f0; border-color: #9eb9bb; color: var(--ink); }

/* The canvas occupies the whole mint stage; controls sit on its edges. */
.build-stage { position: relative; grid-column: 2; grid-row: 1; min-width: 0; min-height: 0; border-radius: 21px; overflow: hidden; background: #dceee5; border: 1px solid #d0e6dc; isolation: isolate; }
.world { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.world canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
.world:focus-visible { outline: 3px solid #17899f; outline-offset: -4px; }
.stage-heading { position: absolute; z-index: 2; top: 23px; left: 25px; right: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; pointer-events: none; }
.stage-label { display: flex; align-items: center; gap: 6px; color: #79968b; font-size: 10px; letter-spacing: .035em; }
.stage-label > span { width: 5px; height: 5px; border-radius: 50%; background: #83ac96; }
.stage-heading h1 { font-size: clamp(22px, 2.1vw, 29px); letter-spacing: .015em; font-weight: 800; line-height: 1.25; margin: 8px 0 6px; color: #2a4d50; }
.stage-heading p { font-size: 11px; color: #7c958c; margin: 0; line-height: 1.6; max-width: 24em; }
.ghost-button { pointer-events: auto; display: flex; align-items: center; gap: 6px; background: #ffffff83; color: #5f8c7b; border: 1px solid #ffffffac; border-radius: 9px; padding: 9px 10px; font-size: 10px; white-space: nowrap; }
.ghost-button .icon { width: 15px; height: 15px; flex-basis: 15px; }
.ghost-button:hover { background: #ffffffe0; }
.ghost-button[aria-pressed="false"] { background: #e7eeebaa; color: #8d9d97; }
.view-controls { position: absolute; left: 20px; bottom: 61px; z-index: 2; display: flex; align-items: center; gap: 2px; padding: 4px; border: 1px solid #ffffffb3; background: #f8fcfae8; border-radius: 11px; box-shadow: 0 3px 9px #31564b07; }
.view-button { display: flex; justify-content: center; align-items: center; gap: 5px; padding: 8px 9px; border-radius: 7px; font-size: 10px; background: transparent; color: #869c94; }
.view-button .icon { width: 16px; height: 16px; flex-basis: 16px; }
.view-button.is-active, .view-button[aria-pressed="true"], .view-button.active { color: #4d8376; background: #e0eee7; }
.view-button:hover { background: #e9f2ec; }
.edit-controls { position: absolute; right: 19px; bottom: 62px; z-index: 2; display: flex; align-items: center; gap: 1px; padding: 4px; border: 1px solid #ffffffb3; border-radius: 11px; background: #f8fcfae8; }
.edit-controls .icon-button { width: 31px; height: 31px; border-radius: 6px; padding: 7px; }
.edit-controls .icon { width: 17px; height: 17px; flex-basis: 17px; }
.delete-button:hover:not(:disabled) { color: #c36d7e; background: #fbe9ee; }
.tool-separator { height: 16px; width: 1px; margin: 0 4px; background: #dce6e0; }
.stage-bottom { position: absolute; z-index: 2; left: 25px; right: 24px; bottom: 24px; display: flex; justify-content: space-between; align-items: center; gap: 10px; pointer-events: none; }
.world-hint { display: flex; align-items: center; gap: 6px; font-size: 10px; color: #849e93; }
.world-hint .icon { width: 14px; height: 14px; flex-basis: 14px; opacity: .8; }
.piece-counter { display: flex; align-items: center; gap: 4px; font-size: 10px; color: #769188; white-space: nowrap; }
.piece-counter strong { color: #4a7468; font-size: 13px; font-weight: 700; padding: 0 2px; }
.counter-cube { display: block; width: 9px; height: 9px; border: 1.5px solid #80a99b; border-radius: 1.5px; margin-right: 3px; transform: rotate(-9deg); }
.loading { position: absolute; left: 50%; top: 50%; z-index: 3; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 12px; background: #f7fcf8e8; padding: 17px 23px; border: 1px solid #ffffffbd; border-radius: 14px; font-size: 12px; color: #688a7a; white-space: nowrap; }
.loading-tile { display: block; width: 18px; height: 18px; border: 3px solid #59b9c6; border-radius: 3px; background: #75d0d933; transform: rotate(-12deg); animation: tile-turn 1.5s ease-in-out infinite; }
.toast { position: absolute; left: 50%; bottom: 115px; z-index: 5; transform: translateX(-50%); max-width: calc(100% - 40px); width: max-content; border-radius: 12px; background: #284b46ee; box-shadow: 0 5px 18px #2c504b13; color: #fff; padding: 12px 18px; font-size: 12px; line-height: 1.6; text-align: center; pointer-events: none; }
.magnet-feedback { position: absolute; left: 50%; bottom: 118px; z-index: 4; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; gap: 8px; width: max-content; max-width: calc(100% - 36px); padding: 10px 15px; border: 1px solid #ffffffd9; border-radius: 30px; background: #fafffbed; color: #4b7569; box-shadow: 0 3px 13px #284b4612; font-size: 12px; font-weight: 600; line-height: 1.5; text-align: center; pointer-events: none; user-select: none; transition: background-color .14s ease, color .14s ease, border-color .14s ease; }
.magnet-feedback::before { content: ""; display: block; flex: 0 0 10px; width: 10px; height: 11px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 7px 7px; transform: rotate(-20deg); opacity: .75; }
.magnet-feedback[data-state="snapped"] { color: #176649; background: #e7f9ef; border-color: #86caa9; box-shadow: 0 3px 15px #2077521c; animation: magnet-catch .19s ease-out; }
.magnet-feedback[data-state="snapped"]::before { content: "✓"; width: 13px; height: auto; flex-basis: 13px; border: 0; border-radius: 0; transform: none; font-size: 15px; font-weight: 800; line-height: 1; opacity: 1; }
.magnet-feedback[data-state="invalid"] { color: #926348; background: #fff6e8; border-color: #e9cfa9; }
.magnet-feedback[data-state="invalid"]::before { content: "!"; width: 14px; height: 14px; flex-basis: 14px; border: 1.5px solid currentColor; border-radius: 50%; transform: none; font-size: 10px; line-height: 12px; text-align: center; }
@keyframes magnet-catch { from { transform: translateX(-50%) scale(.95); } 65% { transform: translateX(-50%) scale(1.025); } to { transform: translateX(-50%) scale(1); } }
@keyframes tile-turn { 0%, 100% { transform: rotate(-12deg); } 50% { transform: rotate(78deg); } }

.step-panel { grid-column: 3; grid-row: 1 / -1; align-self: stretch; min-width: 0; display: flex; flex-direction: column; padding: 20px 19px 14px; border: 1px solid #e4eaec; border-radius: 17px; background: #fdfefe; }
.step-panel-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.step-kicker { font-size: 10px; color: #9aa7aa; }
.step-number-wrap { font-size: 10px; padding: 5px 8px; border-radius: 6px; color: #90a09e; background: #f0f5f2; }
.step-number-wrap strong { font-size: 12px; color: #5d8e7b; font-weight: 750; margin: 0 2px; }
.step-copy h2 { font-size: 19px; font-weight: 800; letter-spacing: -.025em; line-height: 1.45; margin: 21px 0 11px; }
.step-copy p { font-size: 12px; color: #7d9197; line-height: 1.9; margin: 0; }
.step-progress-wrap { margin: 23px 0 18px; }
.step-progress-wrap progress { appearance: none; display: block; width: 100%; height: 5px; overflow: hidden; border: none; border-radius: 5px; background: #edf2f1; color: #6cb5a5; }
.step-progress-wrap progress::-webkit-progress-bar { border-radius: 5px; background: #edf2f1; }
.step-progress-wrap progress::-webkit-progress-value { border-radius: 5px; background: #6cb5a5; transition: width .25s ease; }
.step-progress-wrap progress::-moz-progress-bar { border-radius: 5px; background: #6cb5a5; }
.step-dots { display: flex; justify-content: flex-start; flex-wrap: wrap; gap: 6px; margin-top: 9px; min-height: 5px; }
.step-dots > * { display: block; width: 5px; height: 5px; border-radius: 50%; background: #e4edeb; }
.step-dots .step-dot { width: 22px; height: 22px; padding: 0; display: grid; place-items: center; border-radius: 50%; font-size: 9px; line-height: 1; color: #8aa198; background: #edf3ef; }
.step-dots .step-dot:hover { background: #dcece4; color: #397c69; }
.step-dots .step-dot.is-current { color: white; background: #45a58f; box-shadow: 0 0 0 3px #e7f3ed; }
.step-dots .step-dot.is-done { color: #558f7d; background: #dceee5; }
.step-dots .done, .step-dots .complete, .step-dots .is-complete { background: #81b9a7; }
.step-dots .active, .step-dots .current, .step-dots .is-active { background: #39a797; box-shadow: 0 0 0 2px #e3f2ed; }
.start-button { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 14px 10px; border-radius: 11px; background: #2ca7aa; color: white; box-shadow: 0 4px 0 #238e952b; font-size: 13px; font-weight: 750; white-space: nowrap; }
.start-button .icon { width: 17px; height: 17px; flex-basis: 17px; }
.start-button .arrow { width: 13px; height: 13px; flex-basis: 13px; margin-left: 2px; }
.start-button:hover { background: #20979b; box-shadow: 0 4px 0 #1d7d8533; }
.materials-section { border-top: 1px solid #edf0f1; margin-top: 23px; padding-top: 20px; }
.materials-section h3 { font-size: 11px; font-weight: 600; color: #809398; margin: 0 0 12px; }
.material-counts { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; font-size: 10px; line-height: 1.65; color: #7e949b; }
.material-chip, .material-counts > span, .material-counts > div { display: flex; align-items: center; gap: 6px; border: 1px solid #e9eeef; background: #f8fafb; border-radius: 7px; padding: 7px 8px; }
.material-counts strong { color: #486976; }
.tiny-square { width: 11px; height: 11px; border: 2px solid #6ebdca; background: #b9e0e75e; border-radius: 1px; display: inline-block; }
.tiny-triangle { width: 12px; height: 11px; display: inline-block; clip-path: polygon(50% 0, 100% 100%, 0 100%); background: #eebc63; }
.conversation-card { position: relative; margin: 23px 0 15px; border-radius: 4px 15px 15px 15px; background: #fff8e9; padding: 18px 15px 14px; }
.conversation-icon { position: absolute; right: 12px; top: 3px; font-family: Georgia, serif; font-size: 45px; line-height: 1; color: #e9d7ab; }
.conversation-card h3 { position: relative; font-size: 10px; font-weight: 600; color: #aa9569; margin: 0 0 12px; }
.conversation-card p { font-size: 13px; font-weight: 650; line-height: 1.9; color: #8b7958; margin: 0; }
.parent-hint { display: block; border-top: 1px solid #ead9b854; padding-top: 10px; margin-top: 13px; font-size: 9px; color: #b3a588; line-height: 1.75; }
.real-world-note { margin: 1px 0 20px; }
.real-world-note summary { display: flex; align-items: center; gap: 5px; font-size: 10px; color: #84958f; cursor: pointer; list-style: none; }
.real-world-note summary::-webkit-details-marker { display: none; }
.real-world-note summary .icon { margin-left: auto; width: 12px; height: 12px; flex-basis: 12px; }
.real-world-note[open] summary .icon { transform: rotate(90deg); }
.real-world-dot { width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; background: #9eba9a; }
.real-world-note p { font-size: 10px; color: #91a19b; line-height: 1.8; margin: 10px 0 0; }
.project-actions { margin-top: auto; display: flex; justify-content: space-between; gap: 4px; padding-top: 13px; border-top: 1px solid #edf0f1; }
.text-button { display: inline-flex; gap: 6px; align-items: center; justify-content: center; padding: 7px 2px; color: #8a9ca3; background: transparent; font-size: 10px; }
.text-button .icon { width: 14px; height: 14px; flex-basis: 14px; }
.text-button:hover { color: #438b89; }

/* The material tray echoes a real box of translucent magnetic tiles. */
.parts-tray { grid-column: 2; grid-row: 2; display: flex; gap: clamp(13px, 1.5vw, 25px); align-items: center; min-width: 0; background: #fdfefe; border: 1px solid #e4eaec; border-radius: 16px; padding: 14px 18px; min-height: 108px; }
.tray-pieces { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.tray-label { display: flex; flex-direction: column; gap: 6px; }
.tray-label strong { font-size: 12px; font-weight: 750; }
.tray-label > span { font-size: 9px; color: #a1aeb2; white-space: nowrap; }
.piece-tools { display: flex; align-items: center; gap: 7px; }
.piece-tool { width: 61px; height: 75px; padding: 7px 5px 5px; border: 1.5px solid transparent; border-radius: 10px; background: #f4f7f8; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; font-size: 9px; color: #91a1a7; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.piece-tool:active { cursor: grabbing; }
.piece-tool.is-active, .piece-tool[aria-pressed="true"], .piece-tool.active { border-color: #94cbd1; background: #ecf7f6; color: #589297; }
.piece-tool:hover { border-color: #a7ccd0; }
.tile-square { display: block; width: 31px; height: 32px; margin-bottom: 1px; border: 4px solid #5cbbca; border-radius: 3px; background: #70c7d435; box-shadow: inset 1px 1px 0 #ffffff70, 2px 3px 0 #2d8aab12; transform: rotate(-9deg); }
.tile-triangle { display: block; width: 43px; height: 38px; overflow: visible; }
.tile-triangle path { stroke: #e9b757; stroke-width: 6; stroke-linejoin: round; fill: #f4cf6f45; }
.tray-colors { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }
.small-label { font-size: 10px; color: #70868f; white-space: nowrap; }
.color-swatches { display: grid; grid-template-columns: repeat(3, 18px); gap: 7px; }
.color-swatch { position: relative; width: 18px; height: 18px; border-radius: 50%; border: 2px solid transparent; background: var(--swatch); box-shadow: inset 0 0 0 1px #243e5205; padding: 0; }
.color-swatch::after { position: absolute; inset: -5px; border: 1.5px solid transparent; border-radius: 50%; content: ""; }
.color-swatch.is-active::after, .color-swatch[aria-pressed="true"]::after, .color-swatch.active::after { border-color: var(--swatch); }
.color-swatch:hover { transform: scale(1.08); }
.tray-placement { min-width: 134px; padding-left: 17px; border-left: 1px solid #edf0f1; }
.placement-heading { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 12px; }
#orientation-label { font-size: 9px; color: #b2bdc0; white-space: nowrap; }
.pose-controls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; background: #f1f5f6; border-radius: 6px; padding: 3px; }
.pose-controls button { padding: 7px 6px; font-size: 9px; border-radius: 4px; background: transparent; color: #70868f; white-space: nowrap; }
.pose-controls button.is-active, .pose-controls button[aria-pressed="true"], .pose-controls button.active { color: #5b8e92; background: white; box-shadow: 0 1px 3px #26435307; }
.pose-controls button:hover { color: #57898d; background: #ffffff80; }
.tray-height { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-left: auto; }
.height-control { display: flex; gap: 1px; align-items: center; }
.height-control button { display: grid; place-items: center; width: 24px; height: 28px; border-radius: 5px; color: #8ea2aa; background: #f1f5f6; }
.height-control button:hover { color: #558b8b; background: #e5efeb; }
.height-control .icon { width: 13px; height: 13px; }
#level-label { display: block; min-width: 30px; text-align: center; font-size: 10px; color: #748b94; white-space: nowrap; }
.app-footer { flex: 0 0 37px; display: flex; align-items: center; gap: 20px; padding: 0 25px; font-size: 9px; color: #a1aeb4; }
#status-message { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.active-tool { margin-left: auto; white-space: nowrap; }
.active-tool strong { font-weight: 500; color: #8d9fa6; }
.footer-note { font-size: 9px; white-space: nowrap; opacity: .75; }
.drag-chip { pointer-events: none; position: fixed; z-index: 50; width: 58px; height: 58px; transform: translate(-50%, -50%) rotate(-8deg); opacity: .85; filter: drop-shadow(0 5px 8px #19495a26); }
.drag-tile { display: block; width: 100%; height: 100%; border: 6px solid var(--drag-color, #34b9cf); border-radius: 5px; background: color-mix(in srgb, var(--drag-color, #34b9cf), transparent 75%); }
.drag-chip.triangle .drag-tile, .drag-chip[data-type="triangle"] .drag-tile { clip-path: polygon(50% 0, 100% 100%, 0 100%); background: var(--drag-color, #fac45b); border: 0; border-radius: 0; }

dialog { border: 1px solid #dce9e6; color: var(--ink); background: #fbfdfc; border-radius: 22px; box-shadow: 0 24px 90px #274b4833; padding: 28px; width: min(490px, calc(100% - 32px)); max-height: calc(100dvh - 40px); }
dialog::backdrop { background: #1f403850; backdrop-filter: blur(5px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; margin-top: -6px; }
.dialog-tag { font-size: 11px; color: #6f9c88; }
dialog h2 { font-size: 25px; font-weight: 800; margin: 10px 0; }
.dialog-intro { font-size: 12px; color: #82958e; margin: 0 0 24px; }
.help-steps { display: flex; flex-direction: column; gap: 20px; list-style: none; padding: 0; margin: 0; }
.help-steps li { display: flex; gap: 13px; }
.help-step-number { display: grid; flex: 0 0 25px; width: 25px; height: 25px; place-items: center; border-radius: 8px; background: #e3f2eb; color: #70a18c; font-size: 12px; }
.help-steps h3 { font-size: 13px; margin: 4px 0 6px; font-weight: 750; }
.help-steps p { margin: 0; font-size: 12px; color: #7d918e; line-height: 1.85; }
.help-footnote { display: flex; gap: 10px; align-items: flex-start; background: #f1f6f3; border-radius: 10px; padding: 12px; margin: 24px 0 18px; color: #819990; }
.help-footnote .icon { width: 17px; height: 17px; flex-basis: 17px; margin-top: 2px; }
.help-footnote p { font-size: 11px; line-height: 1.8; margin: 0; }
.primary-button, .secondary-button { display: inline-flex; align-items: center; justify-content: center; padding: 13px 18px; border-radius: 10px; font-size: 13px; font-weight: 650; }
.primary-button { background: #2ca7aa; color: white; }
.primary-button:hover { background: #22989c; }
.help-dialog > .primary-button { width: 100%; }
.secondary-button { color: #7c9890; background: #eef4f0; }
.secondary-button:hover { background: #e3eee8; }
.confirm-dialog { width: min(380px, calc(100% - 32px)); padding: 29px; }
.confirm-dialog h2 { font-size: 21px; margin-top: 15px; }
#confirm-text { font-size: 12px; line-height: 1.8; color: #8a9b94; margin-bottom: 24px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 9px; }
.print-content { display: none; }

@media (min-width: 1550px) {
  .workshop { grid-template-columns: 195px minmax(340px, 1fr) 278px; gap: 19px; padding-left: 29px; padding-right: 29px; }
  .step-panel { padding: 24px 23px 18px; }
  .blueprint-card img, .blueprint-card canvas, .blueprint-card > svg, .blueprint-card .blueprint-thumb, .blueprint-card .thumb { height: 96px; }
  .parts-tray { gap: 30px; padding-left: 25px; padding-right: 25px; }
  .color-swatches { grid-template-columns: repeat(6, 21px); gap: 8px; }
  .color-swatch { width: 21px; height: 21px; }
  .tray-colors { gap: 16px; }
  .tray-placement { padding-left: 26px; min-width: 180px; }
  .piece-tool { width: 70px; }
}

@media (max-width: 1220px) {
  .app-header { padding: 0 22px; gap: 16px; }
  .workshop { grid-template-columns: 145px minmax(310px, 1fr) 226px; gap: 12px; padding: 15px 17px 0; }
  .brand-copy strong { font-size: 17px; }
  .brand-copy > span { font-size: 10px; }
  .mode-button { padding: 10px 13px; font-size: 12px; }
  .save-indicator { max-width: 104px; font-size: 9px; }
  .step-panel { padding: 17px 15px 12px; }
  .step-copy h2 { font-size: 17px; }
  .step-copy p { font-size: 11px; }
  .conversation-card { padding: 16px 12px 12px; }
  .conversation-card p { font-size: 12px; }
  .parts-tray { gap: 13px; padding: 12px 13px; }
  .tray-pieces { gap: 9px; }
  .tray-label { display: none; }
  .piece-tool { width: 53px; }
  .tray-placement { padding-left: 12px; min-width: 125px; }
  .pose-controls button { padding: 7px 4px; }
  .tray-height .small-label { font-size: 9px; }
  .height-control button { width: 20px; }
  #level-label { min-width: 25px; font-size: 9px; }
  .blueprint-card { padding: 8px 8px 10px; }
  .rail-description { font-size: 10px; margin-left: 0; }
  .blueprint-card img, .blueprint-card canvas, .blueprint-card > svg, .blueprint-card .blueprint-thumb, .blueprint-card .thumb { height: 67px; }
  .blueprint-card strong, .blueprint-card h3 { font-size: 12px; }
  .stage-heading { top: 21px; left: 22px; right: 18px; }
  .stage-heading p { max-width: 19em; font-size: 10px; }
  .ghost-button { padding: 8px; }
  .ghost-button span { display: none; }
  .view-button { padding: 8px 7px; }
  .view-button .icon { display: none; }
  .view-controls { left: 17px; }
  .edit-controls { right: 17px; }
  .edit-controls .icon-button { width: 28px; }
  .stage-bottom { left: 19px; right: 19px; }
  .world-hint { font-size: 9px; }
  .footer-note { display: none; }
}

@media (max-width: 1030px) {
  .workshop { grid-template-columns: 125px minmax(300px, 1fr) 205px; gap: 10px; padding: 12px 12px 0; }
  .app-header { gap: 12px; padding: 0 18px; height: 78px; flex-basis: 78px; }
  .brand-mark { transform: scale(.85); margin-right: -4px; }
  .brand { gap: 9px; }
  .brand-copy strong { font-size: 15px; }
  .brand-copy > span { font-size: 9px; letter-spacing: .07em; }
  .save-indicator { display: none; }
  .header-actions { gap: 0; }
  .mode-button { padding: 9px 12px; font-size: 11px; }
  .panel-heading { font-size: 11px; }
  .panel-heading > span { gap: 5px; }
  .blueprint-card { border-radius: 10px; }
  .blueprint-card img, .blueprint-card canvas, .blueprint-card > svg, .blueprint-card .blueprint-thumb, .blueprint-card .thumb { height: 59px; }
  .step-panel { padding: 15px 12px 10px; border-radius: 14px; }
  .step-copy h2 { font-size: 16px; margin-top: 19px; }
  .step-copy p { font-size: 10px; }
  .step-number-wrap { font-size: 9px; padding: 4px 6px; }
  .step-kicker { font-size: 9px; }
  .materials-section { margin-top: 19px; padding-top: 17px; }
  .conversation-card { margin-top: 20px; }
  .real-world-note summary { font-size: 9px; }
  .parts-tray { gap: 12px; flex-wrap: wrap; justify-content: flex-start; min-height: 107px; }
  .tray-height { margin-left: 0; }
  .tray-colors { gap: 9px; }
  .tray-placement { min-width: 0; flex: 1; padding-left: 10px; }
  #orientation-label { display: none; }
  .tray-height { flex-direction: row; justify-content: space-between; width: 100%; gap: 6px; border-top: 1px solid #edf0f1; padding-top: 7px; }
  .height-control button { height: 21px; }
  .tray-height .small-label { font-size: 9px; }
  .tray-height #level-label { min-width: 32px; }
  .piece-tool { height: 68px; width: 49px; }
  .tile-square { width: 29px; height: 29px; }
  .tile-triangle { width: 36px; height: 34px; }
  .world-hint > span { max-width: 138px; white-space: nowrap; overflow: hidden; text-overflow: clip; }
}

@media (max-width: 850px) {
  .app { min-height: 780px; }
  .workshop { grid-template-columns: minmax(330px, 1fr) 210px; grid-template-rows: auto minmax(0, 1fr) auto; gap: 12px; padding: 12px 15px 0; }
  .blueprints-panel { grid-column: 1 / -1; grid-row: 1; padding: 0; position: relative; }
  .blueprint-drawer { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 12px; }
  .panel-heading { font-size: 11px; padding: 7px 0; }
  .rail-description { display: none; }
  .blueprint-list { flex-direction: row; gap: 8px; }
  .blueprint-card { display: flex; flex: 1; align-items: center; justify-content: flex-start; gap: 8px; padding: 6px 9px; min-height: 58px; width: auto; }
  .blueprint-card.is-active::after, .blueprint-card[aria-pressed="true"]::after, .blueprint-card.active::after { width: 13px; height: 13px; top: 5px; right: 5px; font-size: 8px; }
  .blueprint-card img, .blueprint-card canvas, .blueprint-card > svg, .blueprint-card .blueprint-thumb, .blueprint-card .thumb { flex: 0 0 53px; width: 53px; height: 41px; }
  .blueprint-card strong, .blueprint-card h3 { font-size: 10px; margin: 0 0 3px; }
  .blueprint-card p, .blueprint-card small, .blueprint-card .meta, .blueprint-card .blueprint-meta { font-size: 8px; }
  .blueprint-card .blueprint-thumb svg, .blueprint-card .thumb svg { width: 50px; height: 36px; }
  .blueprint-card { display: grid; grid-template-columns: 53px minmax(0, 1fr); grid-template-rows: 1fr 1fr; column-gap: 8px; row-gap: 0; }
  .blueprint-art { --art-unit: .6px; grid-row: 1 / 3; grid-column: 1; width: 53px; height: 41px; }
  .blueprint-card-name { grid-column: 2; grid-row: 1; align-self: end; font-size: 10px; margin: 0 0 3px; }
  .blueprint-card-meta { grid-column: 2; grid-row: 2; align-self: start; font-size: 8px; }
  .together-note { display: none; }
  .blueprints-panel > .print-button { display: flex; align-self: flex-end; width: auto; padding: 8px 12px; margin-top: 8px; }
  .build-stage { grid-column: 1; grid-row: 2; }
  .step-panel { grid-column: 2; grid-row: 2 / -1; }
  .parts-tray { grid-column: 1; grid-row: 3; }
  .stage-heading p { max-width: 20em; }
  .stage-heading h1 { font-size: 24px; }
  .stage-label { font-size: 9px; }
  .view-controls { bottom: 55px; left: 14px; }
  .view-button { padding: 7px 6px; font-size: 9px; }
  .edit-controls { bottom: 55px; right: 14px; }
  .edit-controls .icon-button { width: 25px; height: 28px; padding: 5px; }
  .tool-separator { margin: 0 2px; }
  .stage-bottom { bottom: 20px; left: 18px; right: 18px; }
  .step-progress-wrap { margin: 18px 0 14px; }
}

@media (max-width: 640px) {
  .app { height: auto; min-height: 100dvh; overflow: visible; }
  .app-header { height: 106px; flex-basis: 106px; padding: 12px 16px 10px; gap: 8px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: 41px 37px; }
  .brand { grid-column: 1; grid-row: 1; gap: 9px; }
  .brand-mark { width: 35px; height: 38px; transform: scale(.77); transform-origin: left center; margin-right: -5px; }
  .brand-copy strong { font-size: 16px; }
  .brand-copy > span { font-size: 9px; letter-spacing: .09em; }
  .header-actions { grid-column: 2; grid-row: 1; }
  .help-button { width: 30px; height: 30px; padding: 5px; }
  .mode-switch { grid-column: 1 / -1; grid-row: 2; justify-self: center; padding: 3px; gap: 3px; border-radius: 10px; width: 100%; max-width: 370px; }
  .mode-button { flex: 1; gap: 6px; padding: 7px 10px; font-size: 11px; border-radius: 7px; }
  .mode-button .icon { width: 15px; height: 15px; flex-basis: 15px; }
  .workshop { display: flex; flex-direction: column; flex: none; padding: 12px 12px 0; gap: 12px; }
  .blueprints-panel { order: 1; }
  .blueprint-drawer { display: block; }
  .panel-heading { padding: 0 3px 9px; font-size: 11px; }
  .panel-heading > span { gap: 7px; }
  .panel-heading .icon { width: 14px; height: 14px; flex-basis: 14px; }
  .panel-heading .disclosure-icon { display: block; color: #9fb0ad; }
  .blueprint-drawer[open] .disclosure-icon { transform: rotate(90deg); }
  .blueprint-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .blueprint-card { display: flex; flex-direction: column; justify-content: center; gap: 3px; padding: 7px 4px; min-width: 0; text-align: center; border-radius: 10px; }
  .blueprint-art { --art-unit: .65px; width: 100%; height: 45px; background: transparent; }
  .blueprint-card-name { align-self: center; font-size: 10px; margin: 0; }
  .blueprint-card-meta { align-self: center; font-size: 8px; }
  .blueprint-card img, .blueprint-card canvas, .blueprint-card > svg, .blueprint-card .blueprint-thumb, .blueprint-card .thumb { width: 100%; height: 36px; flex-basis: auto; background: transparent; }
  .blueprint-card .blueprint-thumb svg, .blueprint-card .thumb svg { width: 69px; height: 36px; }
  .blueprint-card strong, .blueprint-card h3 { font-size: 10px; margin: 0; }
  .blueprint-card p, .blueprint-card small, .blueprint-card .meta { font-size: 8px; }
  .blueprint-card .blueprint-meta { justify-content: center; }
  .build-stage { order: 2; flex: 0 0 auto; height: 57dvh; min-height: 380px; max-height: 550px; width: 100%; border-radius: 17px; }
  .stage-heading { top: 17px; left: 18px; right: 16px; }
  .stage-label { font-size: 9px; }
  .stage-heading h1 { font-size: 23px; margin-top: 6px; margin-bottom: 5px; }
  .stage-heading p { font-size: 9px; max-width: 23em; }
  .ghost-button { padding: 7px; border-radius: 8px; }
  .stage-bottom { bottom: 18px; left: 17px; right: 17px; }
  .world-hint { font-size: 8px; gap: 4px; }
  .world-hint > span { max-width: none; }
  .world-hint .icon { width: 12px; height: 12px; flex-basis: 12px; }
  .piece-counter { font-size: 9px; }
  .piece-counter strong { font-size: 12px; }
  .view-controls { left: 13px; bottom: 51px; padding: 3px; border-radius: 9px; gap: 1px; }
  .view-button { padding: 8px; font-size: 10px; border-radius: 6px; min-height: 36px; }
  .edit-controls { right: 13px; bottom: 51px; padding: 3px; border-radius: 9px; }
  .edit-controls .icon-button { width: 29px; height: 36px; }
  .edit-controls .icon { width: 16px; height: 16px; flex-basis: 16px; }
  .magnet-feedback { bottom: 109px; padding: 9px 13px; max-width: calc(100% - 28px); font-size: 11px; gap: 7px; }
  .parts-tray { order: 3; flex-wrap: wrap; gap: 13px; min-height: 0; padding: 12px; border-radius: 13px; align-items: stretch; }
  .tray-pieces { gap: 10px; }
  .piece-tools { gap: 6px; }
  .piece-tool { width: 55px; height: 67px; font-size: 9px; }
  .tile-square { width: 28px; height: 29px; border-width: 3px; }
  .tile-triangle { width: 35px; height: 32px; }
  .tray-colors { justify-content: center; gap: 11px; }
  .color-swatches { grid-template-columns: repeat(3, 21px); gap: 7px; }
  .color-swatch { width: 21px; height: 21px; }
  .small-label { font-size: 9px; }
  .tray-placement { padding-left: 10px; align-self: center; flex: 1; }
  .placement-heading { margin-bottom: 9px; }
  .pose-controls { grid-template-columns: repeat(2, 1fr); gap: 2px; }
  .pose-controls button { font-size: 9px; padding: 5px 6px; }
  .tray-height { padding-top: 8px; margin-top: -3px; flex-direction: row; align-items: center; }
  .height-control { gap: 5px; }
  .height-control button { height: 34px; width: 34px; }
  .height-control #level-label { min-width: 44px; font-size: 10px; }
  .step-panel { order: 4; width: 100%; padding: 17px; display: grid; grid-template-columns: 1fr auto; gap: 0 18px; border-radius: 15px; }
  .step-panel-top { grid-column: 1 / -1; }
  .step-copy { grid-column: 1 / -1; }
  .step-copy h2 { font-size: 19px; margin: 15px 0 7px; }
  .step-copy p { font-size: 12px; line-height: 1.85; }
  .step-progress-wrap { grid-column: 1 / -1; margin: 15px 0; }
  .start-button { grid-column: 1 / -1; padding: 13px 15px; width: 100%; font-size: 13px; }
  .materials-section { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding-top: 15px; margin-top: 20px; }
  .materials-section h3 { font-size: 10px; margin: 0; }
  .material-counts { font-size: 10px; gap: 6px; }
  .material-chip, .material-counts > span, .material-counts > div { padding: 5px 7px; }
  .conversation-card { grid-column: 1 / -1; margin: 18px 0 15px; padding: 15px; }
  .conversation-card h3 { margin-bottom: 8px; font-size: 10px; }
  .conversation-card p { font-size: 13px; }
  .parent-hint { margin-top: 10px; padding-top: 8px; font-size: 10px; }
  .real-world-note { grid-column: 1 / -1; margin-bottom: 15px; }
  .real-world-note summary { font-size: 11px; }
  .real-world-note p { font-size: 11px; }
  .project-actions { grid-column: 1 / -1; padding-top: 10px; }
  .text-button { font-size: 11px; padding: 8px 1px; }
  .app-footer { min-height: 49px; flex-basis: auto; font-size: 9px; padding: 10px 16px 15px; line-height: 1.8; gap: 7px; }
  #status-message { white-space: normal; }
  .active-tool { display: none; }
  dialog { padding: 23px; border-radius: 19px; }
  dialog h2 { font-size: 23px; }
  .help-steps { gap: 17px; }
  .help-steps p { font-size: 11px; }
  .dialog-intro { font-size: 11px; }
}

@media (max-width: 360px) {
  .workshop { padding-left: 9px; padding-right: 9px; gap: 10px; }
  .view-button { padding: 8px 6px; font-size: 9px; }
  .edit-controls .icon-button { width: 25px; }
  .world-hint { font-size: 7px; }
  .parts-tray { gap: 9px; padding: 10px; }
  .piece-tool { width: 48px; }
  .tray-placement { padding-left: 8px; }
  .color-swatches { grid-template-columns: repeat(3, 18px); gap: 6px; }
  .color-swatch { width: 18px; height: 18px; }
  .tray-colors .small-label { font-size: 8px; }
  .materials-section { flex-wrap: wrap; gap: 8px; }
}

@media (max-height: 750px) and (min-width: 851px) {
  .app { min-height: 650px; }
  .app-header { height: 75px; flex-basis: 75px; }
  .workshop { padding-top: 13px; }
  .step-panel { padding-top: 15px; }
  .step-copy h2 { margin-top: 16px; }
  .step-progress-wrap { margin: 15px 0 12px; }
  .materials-section { margin-top: 17px; padding-top: 15px; }
  .conversation-card { margin-top: 17px; padding-top: 14px; padding-bottom: 12px; }
  .real-world-note { margin-bottom: 13px; }
  .together-note { padding-top: 15px; padding-bottom: 0; }
  .together-note p { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  @page { size: A4; margin: 13mm; }
  html, body { background: white !important; color: #233e52; height: auto; overflow: visible; }
  body > *:not(.print-content) { display: none !important; }
  .print-content { display: block !important; font-family: var(--font); font-size: 10pt; line-height: 1.65; }
  .print-content h1 { font-size: 24pt; line-height: 1.3; margin: 0 0 5mm; }
  .print-content h2 { font-size: 14pt; margin: 6mm 0 3mm; }
  .print-content h3 { font-size: 11pt; margin: 4mm 0 2mm; }
  .print-content p { margin: 2mm 0; }
  .print-content img, .print-content canvas, .print-content svg { max-width: 100%; break-inside: avoid; }
  .print-content .print-views { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4mm; }
  .print-content .print-view, .print-content figure { margin: 0; break-inside: avoid; }
  .print-content .print-view img, .print-content figure img { width: 100%; border: 1px solid #e2e9e5; border-radius: 3mm; }
  .print-content figcaption { text-align: center; font-size: 9pt; color: #688378; margin-top: 2mm; }
  .print-content table { width: 100%; border-collapse: collapse; font-size: 9pt; }
  .print-content td, .print-content th { padding: 2mm 3mm; text-align: left; border-bottom: 1px solid #dce6df; }
  .print-content ul, .print-content ol { padding-left: 6mm; }
  .print-content li { margin: 1mm 0; break-inside: avoid; }
  .print-content .print-note { font-size: 8pt; color: #72877c; border-top: 1px solid #dce6df; margin-top: 5mm; padding-top: 3mm; }
  .print-content * { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}

/* Two-square magnetic vehicle: visible connectors and a small driving station. */
.tile-car { width: 46px; height: 38px; overflow: visible; }
.car-controls { grid-column: 1 / -1; margin-top: 17px; padding: 13px; border: 1px solid #f0d6de; border-radius: 12px; background: #fff6f8; }
.car-control-heading { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.car-control-heading strong { font-size: 13px; }
.car-control-heading span { font-size: 9px; color: #987b88; }
#car-cargo-count { color: #806b78; font-size: 10px; margin: 9px 0; }
.car-drive-buttons { display: grid; grid-template-columns: repeat(3,1fr); gap: 5px; }
.car-drive-buttons button { min-height: 42px; padding: 6px 3px; border-radius: 8px; background: white; border: 1px solid #ead7df; font-size: 11px; font-weight: 650; }
.car-drive-buttons [data-action="drive-forward"] { background: #df7591; color: white; border-color: #df7591; }
.car-control-tip { font-size: 10px; color: #917b86; line-height: 1.7; margin: 10px 0 0; }
.step-panel { overflow-y: auto; }
.blueprint-art--car i:nth-child(1), .blueprint-art--car i:nth-child(2) { width: calc(34 * var(--art-unit)); height: calc(30 * var(--art-unit)); bottom: calc(22 * var(--art-unit)); border-color: #df769a; background: #efadc65e; }
.blueprint-art--car i:nth-child(1) { left: calc(50% - 34 * var(--art-unit)); }
.blueprint-art--car i:nth-child(2) { left: 50%; border-color: #40a8bd; background: #a1d8e25e; }
.blueprint-art--car i:nth-child(3) { width: calc(77 * var(--art-unit)); height: calc(8 * var(--art-unit)); left: calc(50% - 38 * var(--art-unit)); bottom: calc(15 * var(--art-unit)); background: #e47999; border-color: #e47999; }
.blueprint-art--car i:nth-child(3)::before, .blueprint-art--car i:nth-child(3)::after { content: ''; position: absolute; width: calc(14 * var(--art-unit)); height: calc(14 * var(--art-unit)); border-radius: 50%; background: #3d5561; border: calc(3 * var(--art-unit)) solid #8e9fa5; top: calc(-1 * var(--art-unit)); }
.blueprint-art--car i:nth-child(3)::before { left: calc(6 * var(--art-unit)); }
.blueprint-art--car i:nth-child(3)::after { right: calc(6 * var(--art-unit)); }
.drag-chip[data-type="car"] .drag-tile { width: 60px; height: 30px; border-color: #df7591; background: #f3b4c7; }
@media(min-width:851px) { .blueprints-panel { overflow-y: auto; } .together-note { display: none; } .print-button { margin-top: 14px; } }
@media(max-width:850px) and (min-width:641px) { .blueprint-drawer { min-width: 0; } .blueprint-card { min-width: 0; grid-template-columns: 38px minmax(0,1fr); padding: 6px; column-gap: 5px; } .blueprint-art { width: 38px; flex-basis: 38px; --art-unit: .48px; } .blueprint-card-name { font-size: 9px; } .blueprint-card-meta { font-size: 8px; } }
@media(max-width:640px) { .blueprint-list { grid-template-columns: repeat(4,minmax(0,1fr)); } .blueprint-card-name { font-size: 9px; } .blueprint-art { --art-unit: .53px; } .car-controls { margin-top: 16px; } .step-panel { overflow: visible; } .tile-car { width: 40px; } .tray-placement { flex-basis: 120px; } }

.surface-controls { display: flex; border-radius: 7px; background: #edf3f3; padding: 2px; gap: 2px; }
.surface-controls button { background: transparent; font-size: 10px; padding: 5px 8px; border-radius: 5px; }
.surface-controls button[aria-pressed="true"] { background: white; color: #298893; box-shadow: 0 1px 3px #203c5112; }

.select-car-button { width: 100%; min-height: 34px; border-radius: 7px; margin-top: 8px; background: #f6e7ed; color: #876475; font-size: 11px; }
.select-car-button[aria-pressed="true"] { background: #ead2dd; color: #6f3e57; box-shadow: inset 0 0 0 1px #c68fa6; }

.car-drive-buttons button { white-space: nowrap; font-size: 10px; }

/* A larger world needs reachable camera and driving controls. */
.world-navigation { position:absolute;z-index:2;right:18px;top:116px;display:flex;gap:3px;padding:4px;border:1px solid #fff9;border-radius:10px;background:#f8fcfaeb; }
.world-navigation button { min-height:36px;padding:6px 9px;border-radius:7px;background:transparent;color:#4c7b70;font-size:11px;white-space:nowrap; }
.world-navigation button:hover { background:#e0eee7; }
.world-navigation [data-action^="zoom-"] { min-width:36px;font-size:17px; }
.car-drive-buttons .drive-run { grid-column:2 / 4;background:#408e80;color:white;border-color:#408e80; }
.play-button { min-height:40px;margin-top:8px;border-radius:9px;color:#4b847a;background:#edf5f1;border:1px solid #cee1d9;font-size:12px; }
.car-drive-buttons .drive-run[aria-pressed="true"] { background:#c86c65;border-color:#c86c65; }
.driving-state { min-height:16px;color:#836575;font-size:10px;line-height:1.6;margin:8px 0; }
.car-camera-controls { display:grid;grid-template-columns:1fr 1fr;gap:5px; }
.car-camera-controls button { min-height:36px;border-radius:7px;background:#f5e8ed;color:#876475;font-size:10px; }
.car-camera-controls button[aria-pressed="true"] { background:#ead2dd;color:#6f3e57;box-shadow:inset 0 0 0 1px #c68fa6; }
.blueprint-art--grand-castle i:nth-child(-n+2) { width:calc(23 * var(--art-unit));height:calc(48 * var(--art-unit));bottom:calc(12 * var(--art-unit));border-color:#50afba;background:#97d8e288; }
.blueprint-art--grand-castle i:nth-child(1) { left:calc(50% - 39 * var(--art-unit)); }
.blueprint-art--grand-castle i:nth-child(2) { left:calc(50% + 15 * var(--art-unit));border-color:#ad81c7;background:#c2a6e077; }
.blueprint-art--grand-castle i:nth-child(-n+2)::before { content:'';position:absolute;left:-3px;right:-3px;top:calc(-18 * var(--art-unit));height:calc(18 * var(--art-unit));background:#e7b34d;clip-path:polygon(50% 0,100% 100%,0 100%); }
.blueprint-art--grand-castle i:nth-child(3) { width:calc(33 * var(--art-unit));height:calc(32 * var(--art-unit));left:calc(50% - 16 * var(--art-unit));bottom:calc(12 * var(--art-unit));border-color:#e78ba2;background:#edb5c260; }
.blueprint-art--grand-castle i:nth-child(3)::after { content:'';position:absolute;width:42%;height:65%;bottom:-2px;left:29%;background:#eff5f2;border-radius:50% 50% 0 0; }
@media(max-width:1030px) { .world-navigation { top:104px;right:12px; } .world-navigation button { padding:5px 7px;font-size:10px; } }
@media(max-width:850px) and (min-width:641px) { .blueprint-list { flex-wrap:nowrap;overflow-x:auto;padding-bottom:4px; } .blueprint-card { flex:0 0 138px; } }
@media(max-width:640px) { .blueprint-list { display:flex;overflow-x:auto;scroll-snap-type:x proximity;padding-bottom:5px; } .blueprint-card { flex:0 0 108px;scroll-snap-align:start; } .world-navigation { top:97px;right:10px; } .car-drive-buttons button { min-height:44px;font-size:12px; } .car-camera-controls button { min-height:42px;font-size:12px; } }

/* A larger picture-book library, with thumbnails drawn from the actual plans. */
.browse-library { display:flex;align-items:center;gap:7px;width:100%;padding:11px 9px;margin:0 0 12px;border-radius:10px;background:#dceddf;color:#315c4e;font-size:11px;min-height:44px; }
.browse-library strong { margin-left:auto;font-size:12px; }
.rail-description { margin:8px 0 12px;color:#778d83; }
.blueprint-card { display:grid;grid-template-columns:60px minmax(0,1fr);column-gap:9px;align-content:center;min-height:87px;padding:8px;flex-shrink:0; }
.blueprint-card .model-thumbnail { grid-row:1 / 3;display:grid;place-items:center; }
.model-thumbnail { border-radius:9px;background:#f0f5ec;overflow:hidden; }
.model-thumbnail svg { display:block;width:100%;height:100%; }
.blueprint-card .model-thumbnail svg { height:61px; }
.blueprint-card-name { margin:5px 0;font-size:12px;line-height:1.45; }
.blueprint-card-meta { font-size:9px;line-height:1.5; }
.blueprint-list { padding-bottom:12px; }
.blueprint-card.is-active::after,.blueprint-card[aria-pressed="true"]::after { top:4px;right:4px;width:13px;height:13px;font-size:9px; }
.library-dialog { width:min(1100px,94vw);max-width:1100px;max-height:92dvh;padding:28px;background:#f8faf6;border:1px solid #d9e6da;border-radius:22px;overflow-y:auto;overscroll-behavior:contain; }
.library-dialog::backdrop { background:#243b426b;backdrop-filter:blur(5px); }
.library-header { display:flex;justify-content:space-between;gap:18px;align-items:flex-start; }
.library-header h2 { margin:10px 0;font-size:32px;letter-spacing:-.035em;color:#264e42; }
.library-header p { margin:0;font-size:12px;color:#718879;line-height:1.7; }
.library-header .icon-button { flex-shrink:0;background:#e7eee6; }
.library-filters { display:flex;gap:15px;margin:24px 0 15px; }
.library-filters label { display:flex;align-items:center;gap:12px;font-size:11px;color:#607868; }
.library-search { flex:1; }
.library-filters input,.library-filters select { border:1px solid #d4e1d6;background:white;border-radius:10px;height:44px;font:inherit;color:#355748;padding:0 12px;min-width:0; }
.library-search input { flex:1;font-size:13px; }
.library-filters select { min-width:132px;font-size:12px; }
.library-categories { display:flex;flex-wrap:wrap;gap:7px; }
.library-categories button { display:flex;align-items:center;gap:9px;background:#eaf0e6;border:1px solid transparent;border-radius:8px;min-height:40px;padding:8px 12px;font-size:12px;color:#56715d; }
.library-categories button span { font-size:10px;opacity:.7; }
.library-categories button[aria-pressed="true"] { background:#305c48;color:#fff; }
.library-results-heading { display:flex;justify-content:space-between;margin:22px 0 12px;font-size:11px;color:#8b9b8b; }
#library-result-count { font-weight:700;color:#58705f; }
.library-grid { display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px; }
.library-card { background:#fff;border:1px solid #e2e9dd;border-radius:13px;padding:10px;text-align:left;min-width:0;box-shadow:0 3px 7px #203e2110;transition:transform .15s,border-color .15s; }
.library-card:hover { border-color:#74a78a;transform:translateY(-2px); }
.library-card[aria-pressed="true"] { border:2px solid #589d7b;padding:9px; }
.library-card .model-thumbnail { height:136px;background:linear-gradient(165deg,#edf7f2,#f6f4e7); }
.library-card:nth-child(3n+2) .model-thumbnail { background:linear-gradient(165deg,#fcf2e5,#f0f4e1); }
.library-card:nth-child(3n+3) .model-thumbnail { background:linear-gradient(165deg,#f7eef6,#edf3fa); }
.library-card .blueprint-card-name { font-size:15px;margin:12px 2px 4px; }
.library-card .blueprint-card-meta { margin:0 2px;font-size:11px; }
.library-card-story { display:block;font-size:11px;line-height:1.65;color:#7b8d81;margin:8px 2px;min-height:36px; }
.library-card-bottom { border-top:1px solid #edf0e9;padding-top:10px;display:flex;justify-content:space-between;align-items:center;font-size:10px;color:#8b9b8d;gap:5px; }
.difficulty-tag { padding:4px 6px;border-radius:5px;color:#527b5c;background:#ebf3e7;white-space:nowrap; }
.difficulty-tag[data-difficulty="medium"] { color:#9b793c;background:#fbf2df; }
.difficulty-tag[data-difficulty="hard"] { color:#906578;background:#f8ebf0; }
.library-empty { text-align:center;padding:50px 15px;color:#6d836f; }
.library-empty p,.library-footnote { font-size:11px;line-height:1.8; }
.library-footnote { margin:22px 0 0;color:#899787; }
.parts-tray { flex-wrap:wrap;gap:12px;padding:12px 14px; }
.tray-pieces { flex:0 0 100%;min-width:0;display:block; }
.tray-label { display:flex;justify-content:space-between;margin:0 0 7px;align-items:baseline; }
.tray-label strong { font-size:11px;color:#4b7161; }
.tray-label span { font-size:9px;color:#91a294; }
.piece-tools { display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:5px; }
.piece-tool { width:100%;height:57px;min-width:0;padding:4px;gap:2px;border-radius:8px;font-size:9px; }
.piece-tool svg { display:block;width:38px;height:32px;max-width:100%;flex-shrink:0; }
.piece-tool:disabled { opacity:.28; }
.tray-colors { flex-shrink:0; }
.tray-placement { flex:1;min-width:132px;border:0;padding:0; }
.tray-height { margin:0;padding:0;border:0; }
.tray-height > .small-label { display:none; }
.tray-colors > .small-label,.placement-heading { display:none; }
.color-swatches { display:flex;flex-wrap:wrap;max-width:88px;gap:6px; }
.color-swatch { width:20px;height:20px; }
.pose-controls { display:flex; flex-wrap:wrap; }
.pose-controls button { flex:1 0 44px;min-height:44px;padding:6px;font-size:10px; }
.height-control button { width:27px;height:33px; }
.material-counts { line-height:1.9; }
.drag-chip svg { width:64px;height:64px;filter:drop-shadow(0 4px 3px #38564830); }
@media(min-width:851px){
 .blueprint-drawer { display:block; }
 .blueprints-panel { scrollbar-width:thin;scrollbar-color:#b5d0c1 transparent; }
 .browse-library { position:sticky;top:0;z-index:2; }
}
@media(max-width:850px){
 .blueprint-drawer { display:block; }
 .blueprints-panel .panel-heading { display:none; }
 .blueprints-panel .rail-description { display:none; }
 .browse-library { margin-bottom:7px;padding:8px 12px;min-height:39px;width:auto;gap:12px; }
 .blueprint-list { display:flex;overflow-x:auto;gap:8px;padding-bottom:5px;max-width:100%; }
 .blueprint-card { flex:0 0 153px;min-height:71px;grid-template-columns:51px minmax(0,1fr);column-gap:6px; }
 .blueprint-card .model-thumbnail svg { height:51px; }
 .blueprint-card-name { font-size:10px;margin:3px 0; }
 .blueprint-card-meta { font-size:8px; }
 .blueprints-panel>.print-button { position:absolute;right:0;top:0;margin:0;min-height:39px; }
 .parts-tray { padding:10px;gap:9px; }
 .library-grid { grid-template-columns:repeat(3,minmax(0,1fr)); }
 .library-dialog { padding:20px; }
 .library-card .model-thumbnail { height:117px; }
}
@media(max-width:640px){
 .library-dialog { width:96vw;max-height:94dvh;padding:16px;border-radius:16px; }
 .library-header h2 { font-size:25px; }
 .library-filters { flex-wrap:wrap;gap:10px;margin-top:18px; }
 .library-search { flex-basis:100%; }
 .library-categories { gap:5px; }
 .library-categories button { padding:7px 9px;font-size:11px; }
 .library-grid { grid-template-columns:repeat(2,minmax(0,1fr));gap:9px; }
 .library-card .model-thumbnail { height:108px; }
 .library-card .blueprint-card-name { font-size:13px; }
 .library-card-bottom { flex-wrap:wrap;font-size:9px; }
 .library-results-heading>span:last-child { display:none; }
 .tray-pieces { flex:0 0 100%; }
 .piece-tool { height:58px;font-size:8px; }
 .piece-tool svg { width:32px;height:32px; }
 .tray-placement { min-width:126px;flex:1; }
 .tray-height { width:auto;flex-basis:100%;justify-content:flex-end; }
 .tray-height>.small-label { display:block;margin-right:auto; }
 .parts-tray { gap:9px; }
}
@media(min-width:851px) and (max-width:1100px){
 .workshop { grid-template-columns:168px minmax(0,1fr) 205px;gap:12px;padding-left:14px;padding-right:14px; }
 .blueprint-card { grid-template-columns:54px minmax(0,1fr); }
 .blueprint-card-meta { font-size:9px; }
 .blueprint-card-name { font-size:11px; }
}
.browse-library strong { white-space:nowrap; }
.model-thumbnail { display:block; }
.library-card { display:flex;flex-direction:column;align-items:stretch; }
.library-card .model-thumbnail { flex:0 0 136px; }
.library-card-bottom { margin-top:auto; }
@media(max-width:850px){.library-card .model-thumbnail { flex-basis:117px; }}
@media(max-width:640px){.library-card .model-thumbnail { flex-basis:108px; }}

/* Return to the original without resetting a child's creation. */
.stage-reference-actions { display:flex;flex-direction:column;align-items:flex-end;gap:7px;pointer-events:auto; }
.reference-button { border:1px solid #b5d1c8;background:#fffef3ed;color:#335c51;border-radius:10px;min-height:37px;padding:7px 11px;font-size:11px;box-shadow:0 3px 10px #395d4808;white-space:nowrap; }
.reference-button[aria-pressed="true"] { background:#dff2e6;border-color:#7cae94; }
.sound-button { border:1px solid #dce7e0;border-radius:10px;background:#f2f7ef;color:#517766;min-height:36px;padding:6px 10px;font-size:11px;white-space:nowrap; }
.sound-button[aria-pressed="false"] { background:#f5f5f2;color:#8e9690; }
.header-actions { gap:9px; }
.tray-tabs { display:flex;gap:4px;flex-basis:100%;border-bottom:1px solid #e5eee6;padding-bottom:7px; }
.tray-tabs button { min-height:32px;padding:5px 11px;border:0;border-radius:7px;background:transparent;color:#7b948a;font-size:11px; }
.tray-tabs button[aria-pressed="true"] { background:#e4f1e8;color:#2f6559;font-weight:700; }
.tray-tabs small { font-size:8px;padding:3px 5px;border-radius:4px;background:#f3e9c9;color:#947641;margin-left:4px; }
.tile-materials { width:100%;display:flex;flex-wrap:wrap;align-items:center;gap:9px; }
#tile-materials[hidden],#rail-materials[hidden] { display:none; }
.rail-materials { width:100%; }
.rail-intro { display:flex;align-items:center;justify-content:space-between;font-size:11px;color:#426f62; }
.rail-intro>span { font-size:10px;color:#869a8c; }
.rail-note { font-size:10px;line-height:1.7;color:#8a978c;margin:5px 0 9px; }
.rail-tools { display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:7px; }
.rail-tools button { min-width:0;border:1px solid #e2eae5;border-radius:9px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;background:#f5f8f4;color:#647f71;min-height:67px;font-size:10px;touch-action:none; }
.rail-tools button[aria-pressed="true"] { border-color:#80afa2;background:#e3f0e9; }
.rail-tools svg { width:48px;height:40px; }
.rail-tools strong { font-size:25px;font-weight:400;height:37px; }
.rail-tools button:disabled,.rail-actions button:disabled,.rail-start:disabled { opacity:.4; }
.rail-actions { display:flex;flex-wrap:wrap;gap:6px;margin:10px 0; }
.rail-actions button { border:1px solid #dce5de;border-radius:7px;background:#fafcf8;color:#5e7e6b;font-size:10px;min-height:31px;padding:6px 9px; }
.rail-actions button:first-child { background:#fff6dc;border-color:#eadbb8;color:#92723c; }
.rail-start { width:100%;border:0;border-radius:8px;background:#4d999b;color:white;min-height:37px;font-size:12px;font-weight:700; }
@media(max-width:640px){.reference-button { padding:6px 8px;font-size:9px; }.stage-reference-actions { gap:5px; }.sound-button { font-size:10px;padding:5px 7px; }.header-actions { gap:5px; }.stage-heading h1 { max-width:9em; }.rail-tools button { min-height:69px; }}

.road-style-switch { display:flex;gap:4px;padding:3px;background:#eef2ed;border-radius:9px; }
.road-style-switch button { border:0;border-radius:6px;padding:5px 14px;min-height:30px;background:transparent;color:#7b8d82;font-size:11px; }
.road-style-switch button[aria-pressed="true"] { background:#fff;color:#36594d;box-shadow:0 1px 4px #37554814;font-weight:700; }
.road-style-switch button:disabled { opacity:.5; }
.road-tool-icon { display:none; }
[data-style="road"] .road-tool-icon { display:block; }
[data-style="road"] .rail-tool-icon { display:none; }

/* Tile tools start above the bottom controls; the grip moves them within the canvas. */
.canvas-workspace .piece-controls { position: absolute; z-index: 6; top: auto; bottom: 78px; left: calc(50% + (var(--left-clearance, 0px) - var(--right-clearance, 0px)) / 2); transform: translateX(-50%); display: flex; flex-direction: column; align-items: stretch; gap: 2px; width: max-content; max-width: min(760px, calc(100% - var(--left-clearance, 0px) - var(--right-clearance, 0px) - 28px)); overflow: auto; padding: 5px; border: 1px solid #d1e4d9; border-radius: 12px; background: #fbfdf9f5; box-shadow: 0 4px 16px #31564b12; color: #426d5f; }
.piece-controls.is-dragging { pointer-events: none; opacity: .35; }
.piece-controls-body { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px; min-width: 0; }
.piece-controls-chrome { display: flex; align-items: center; gap: 2px; min-width: 0; }
.piece-controls .piece-controls-chrome .piece-controls-label { flex: 1 1 auto; max-width: none; padding: 0 4px; }
.piece-controls .piece-controls-chrome button { min-width: 44px; padding: 8px; background: transparent; }
.piece-controls .piece-controls-grip { cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.piece-controls.is-repositioning .piece-controls-grip { cursor: grabbing; }
.piece-controls .piece-controls-grip .icon { fill: currentColor; stroke: none; }
.piece-controls .piece-controls-collapse { font-size: 22px; font-weight: 400; }
.piece-controls .piece-controls-expand { gap: 8px; }
.canvas-workspace .piece-controls.is-collapsed { width: max-content; }
.piece-controls.is-collapsed .piece-controls-label { display: none; }
.piece-controls [hidden] { display: none !important; }
.piece-controls .piece-controls-label { flex: 0 1 auto; min-width: 0; max-width: 210px; padding: 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 650; }
.piece-controls button { display: inline-flex; flex: 0 0 auto; justify-content: center; align-items: center; gap: 6px; min-height: 44px; padding: 8px 10px; border-radius: 8px; background: #e7f2ec; color: #3c7160; font-size: 11px; font-weight: 650; white-space: nowrap; touch-action: manipulation; }
.piece-controls button:hover:not(:disabled) { background: #d6eade; }
.piece-controls .piece-controls-invert[aria-pressed="true"] { background: #cfe7da; box-shadow: inset 0 0 0 1px #8db9a1; }
.piece-controls button:focus-visible { outline: 3px solid #147987; outline-offset: 2px; }
.piece-controls button:disabled { opacity: .45; }
.piece-controls button .icon { width: 16px; height: 16px; flex-basis: 16px; }
.piece-controls kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 20px; padding: 0 4px; border: 1px solid #c9ded2; border-radius: 4px; background: #ffffffa6; color: #608473; font-family: inherit; font-size: 10px; font-weight: 500; line-height: 1; }
.piece-controls .piece-controls-tilt, .piece-controls .piece-controls-height { display: flex; flex: 0 0 auto; align-items: center; gap: 1px; padding: 0 2px; border-inline: 1px solid #dce9e0; }
.piece-controls .piece-controls-tilt button, .piece-controls .piece-controls-height button { width: 44px; min-width: 44px; padding: 8px; background: transparent; font-size: 19px; font-weight: 500; }
.piece-controls .piece-controls-angle, .piece-controls .piece-controls-level { min-width: 42px; padding: 0 3px; text-align: center; font-size: 11px; font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.piece-controls .piece-controls-angle { min-width: 54px; }
.piece-controls .piece-controls-return { min-width: 44px; background: #f2ede5; color: #806d58; }
.piece-controls .piece-controls-return:hover:not(:disabled) { background: #eae2d5; }
.piece-controls .piece-controls-dismiss { min-width: 44px; padding: 8px; background: transparent; color: #789386; }
.piece-controls .piece-controls-dismiss kbd { border: 0; background: transparent; padding: 0; }
@media screen and (max-width: 600px) {
  .piece-controls .piece-controls-return { width: 44px; padding: 8px; }
  .piece-controls .piece-controls-return span { display: none; }
}
@media screen and (max-width: 600px) {
  .canvas-workspace .piece-controls { width: 320px; max-width: calc(100% - 24px); padding: 4px; }
  .piece-controls-body { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); column-gap: 0; row-gap: 3px; width: 100%; }
  .piece-controls .piece-controls-label { max-width: none; padding: 0 4px; font-size: 10px; line-height: 16px; }
  .piece-controls .piece-controls-tilt, .piece-controls .piece-controls-height { grid-row: 1; justify-self: center; padding: 0; border-inline: 0; }
  .piece-controls .piece-controls-tilt { grid-column: 1 / 4; }
  .piece-controls .piece-controls-height { grid-column: 4 / -1; }
  .piece-controls .piece-controls-angle, .piece-controls .piece-controls-level { padding: 0; font-size: 10px; }
  .piece-controls .piece-controls-angle { min-width: 50px; }
  .piece-controls-body > button { grid-row: 2; justify-self: center; min-width: 44px; }
  .piece-controls-body > button kbd { display: none; }
  .piece-controls-body > [data-action="turn-active-piece"] { grid-column: 1 / 3; }
  .piece-controls .piece-controls-invert { grid-column: 3; }
  .piece-controls button { min-height: 44px; padding: 7px 9px; font-size: 10px; }
  .piece-controls .piece-controls-more { grid-column: 4; }
  .piece-controls .piece-controls-return { grid-column: 5; }
  .piece-controls .piece-controls-dismiss { grid-column: 6; gap: 3px; }
}
@media print { .piece-controls { display: none !important; } }

/* Premium assembly picker uses the same native dialog behavior as My plans. */
.assembly-picker-dialog { width:min(730px,calc(100vw - 32px)); max-height:calc(100dvh - 40px); margin:auto; padding:22px; border:1px solid #d5e5d9; border-radius:20px; background:#fbfcf7; color:#365c50; box-shadow:0 18px 70px #26423730; font:inherit; overflow:auto; overscroll-behavior:contain; }
.assembly-picker-dialog::backdrop { background:#254d4245; backdrop-filter:blur(3px); }
.assembly-picker-dialog [hidden] { display:none !important; }
.assembly-picker-header { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.assembly-picker-heading { display:flex; align-items:center; flex-wrap:wrap; gap:7px 10px; }
.assembly-picker-heading h2 { margin:0; font-size:23px; line-height:1.25; }
.assembly-picker-badge { padding:4px 7px; border:1px solid #e7d8b0; border-radius:6px; background:#f8efda; color:#8b7040; font-size:10px; font-weight:700; }
.assembly-picker-button { display:inline-flex; align-items:center; justify-content:center; min-height:44px; padding:9px 12px; border:1px solid #d3e5d9; border-radius:9px; background:#eaf3ea; color:#3b6756; font:inherit; font-size:12px; line-height:1.4; font-weight:650; touch-action:manipulation; }
.assembly-picker-button:hover:not(:disabled) { background:#dfeede; }
.assembly-picker-button:disabled { opacity:.5; }
.assembly-picker-close { width:44px; flex:0 0 44px; padding:4px; border-color:transparent; background:transparent; font-size:26px; font-weight:400; }
.assembly-picker-intro { margin:9px 0 4px; font-size:13px; line-height:1.6; }
.assembly-picker-note,.assembly-picker-car-note { margin:0 0 16px; color:#738979; font-size:11px; line-height:1.6; }
.assembly-picker-access { display:flex; flex-wrap:wrap; align-items:center; gap:8px 14px; padding:13px; margin:16px 0; border-radius:11px; background:#f2eddf; font-size:12px; line-height:1.6; }
.assembly-picker-access p { flex:1 0 100%; margin:0; }
.assembly-picker-access .assembly-picker-paused { flex:1 1 auto; color:#8c7957; font-size:11px; }
.assembly-picker-account { display:inline-flex; align-items:center; min-height:44px; text-decoration:underline; text-underline-offset:3px; font-weight:650; }
.assembly-picker-surface { display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin:16px 0 7px; }
.assembly-picker-surface-label { margin-right:5px; color:#708578; font-size:12px; }
.assembly-picker-surface [aria-pressed="true"] { background:#4e8e78; border-color:#4e8e78; color:white; }
.assembly-picker-status { padding:11px 13px; border-radius:9px; background:#edf4ee; font-size:12px; line-height:1.6; }
.assembly-picker-status[data-kind="error"] { background:#fbf0e1; color:#94704d; }
.assembly-picker-list { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; margin:17px 0 0; padding:0; list-style:none; }
.assembly-picker-card { display:flex; flex-direction:column; min-width:0; padding:10px; border:1px solid #dce7dc; border-radius:13px; background:#fffef9; }
.assembly-picker-card h3 { margin:9px 0 4px; font-size:13px; line-height:1.45; overflow-wrap:anywhere; }
.assembly-picker-description { flex:1; margin:0; color:#789080; font-size:11px; line-height:1.5; }
.assembly-picker-count { margin:8px 0; color:#617e6c; font-size:10px; }
.assembly-picker-place { width:100%; padding-inline:6px; font-size:11px; }
.assembly-picker-art { position:relative; display:grid; place-items:center; width:100%; height:100px; padding:0; border:0; overflow:hidden; border-radius:8px; background:#edf5ef; cursor:zoom-in; }
.assembly-picker-art .blueprint-thumbnail { width:100%; height:100%; object-fit:contain; }
.assembly-picker-art:focus-visible { outline:3px solid #4e8e78; outline-offset:2px; }
.assembly-picker-enlarge { position:absolute; bottom:5px; right:5px; display:grid; place-items:center; width:25px; height:25px; border-radius:7px; background:#fffdf3db; color:#436f5e; font-size:19px; }
.assembly-picker-back { flex:0 0 auto; }
.assembly-preview-stage { position:relative; height:clamp(220px,48dvh,420px); margin-top:16px; overflow:hidden; border-radius:14px; background:#edf5ef; }
.assembly-preview-stage canvas { display:block; width:100%; height:100%; touch-action:none; cursor:grab; }
.assembly-preview-stage canvas:active { cursor:grabbing; }
.assembly-preview-fallback { position:absolute; inset:0; width:100%; height:100%; object-fit:contain; }
.assembly-preview-status,.assembly-preview-hint { margin:8px 0 0; text-align:center; color:#708578; font-size:12px; }
.assembly-preview-controls { display:flex; justify-content:center; gap:7px; margin-top:8px; }
.assembly-preview-controls button { min-width:44px; font-size:20px; }
.assembly-preview-place { width:100%; margin-top:8px; background:#4e8e78; color:white; border-color:#4e8e78; font-size:14px; }
.assembly-preview-place:hover:not(:disabled) { background:#3e7965; }
.assembly-picker-dialog[data-preview="true"] .assembly-picker-access { margin:10px 0; padding:5px 12px; }
.assembly-picker-dialog[data-preview="true"] .assembly-picker-access p { flex:1 1 180px; }
#workspace-materials .tray-tabs { flex-wrap:wrap; }
#workspace-materials .tray-tabs [data-action="assemblies-open"] { min-height:44px; }
@media(max-width:600px) {
 .assembly-picker-dialog { width:calc(100vw - 20px); max-height:calc(100dvh - 20px); padding:16px; border-radius:16px; }
 .assembly-picker-list { grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
 .assembly-picker-heading h2 { font-size:21px; }
 .assembly-picker-card { padding:9px; }
 .assembly-picker-art { height:88px; }
}
@media(max-width:340px) { .assembly-picker-list { grid-template-columns:1fr; } }
@media print { .assembly-picker-dialog { display:none !important; } }
/* Builder actions stay close to the selected structure, including touch screens. */
.build-context-menu{position:fixed;z-index:180;width:236px;max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px);overflow-y:auto;padding:7px;border:1px solid #c9ded3;border-radius:16px;background:rgba(251,253,247,.98);box-shadow:0 14px 40px #23473826;animation:build-menu-pop .16s ease-out;transform-origin:top left;}
.build-context-menu[hidden]{display:none;}
.piece-tool{position:relative;}
.premium-material-badge{position:absolute;right:2px;top:2px;padding:2px 4px;border-radius:4px;background:#f5e8bb;color:#876721;font-size:8px;font-weight:650;line-height:1;}
.piece-tool.is-premium-locked{opacity:.6;}
.build-context-heading{padding:7px 10px 10px;font-size:12px;font-weight:650;color:#779388;border-bottom:1px solid #e0eae2;margin-bottom:4px;}
.build-context-menu button{display:block;width:100%;border:0;border-radius:9px;background:transparent;padding:10px;text-align:left;font:inherit;font-size:13px;color:#315f50;cursor:pointer;}
.build-context-menu button:hover,.build-context-menu button:focus-visible,.build-context-menu button.is-active{background:#e1efe6;outline:0;}
.build-context-menu button:disabled{color:#a8b7ae;cursor:default;background:transparent;}
@keyframes build-menu-pop{from{opacity:0;transform:scale(.94) translateY(-4px);}to{opacity:1;transform:none;}}
@media(prefers-reduced-motion:reduce){.build-context-menu{animation:none;}}

/* Keep building rules compact and away from the model. */
.canvas-workspace .build-rules-entry { position: absolute; z-index: 5; top: 158px; left: 18px; display: inline-flex; align-items: center; min-height: 44px; padding: 10px 14px; border: 1px solid #bdd4c7; border-radius: 12px; background: #f9fcf6ed; color: #416c5a; box-shadow: 0 3px 12px #33574d0a; font-size: 12px; font-weight: 600; touch-action: manipulation; }
.build-rules-entry[hidden] { display: none !important; }
.build-rules-entry:hover:not(:disabled) { background: #e6f1e6; }
.build-rules-entry:focus-visible { outline: 3px solid #147987; outline-offset: 3px; }
.build-rules-dialog { width: min(440px, calc(100vw - 32px)); }
.build-rules-options { display: grid; gap: 12px; margin: 24px 0 20px; }
.build-rules-options button { display: grid; gap: 6px; min-height: 82px; padding: 18px; border: 1px solid #d9e7dd; border-radius: 14px; background: #f7faf5; color: #41675a; text-align: left; }
.build-rules-options button strong { font-size: 16px; }
.build-rules-options button span { font-size: 13px; line-height: 1.5; color: #74877a; }
.build-rules-options button[aria-pressed="true"] { border-color: #72a48a; background: #eaf3e9; box-shadow: 0 0 0 2px #dcebdd; }
.build-rules-options button:focus-visible { outline: 3px solid #147987; outline-offset: 3px; }
.build-rules-note { font-size: 12px; color: #809186; line-height: 1.7; }
.support-dialog { width: min(490px, calc(100vw - 32px)); }
.support-dialog .confirm-actions { flex-wrap: wrap; }
.support-dialog .confirm-actions button { min-height: 44px; }
@media (max-width: 760px) { .canvas-workspace .build-rules-entry { top: 148px; left: 12px; font-size: 11px; } }
@media print { .build-rules-entry { display: none !important; } }

/* Account transitions keep the previous parent's workspace private until saved. */
.web-account-transition{position:fixed;inset:0;z-index:10000;background:#edf5f0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:16px;padding:32px;text-align:center;color:#244c43;font:16px/1.6 system-ui,sans-serif}
.web-account-transition[hidden]{display:none}
.web-account-transition p{max-width:36rem}
.web-account-transition button,.web-account-transition a{padding:12px 20px;border:1px solid #a4c3b7;border-radius:12px;background:#fff;color:inherit;text-decoration:none;cursor:pointer}
