@font-face{font-family:Studio;src:local('Segoe UI Variable'),local('Segoe UI');font-display:swap}
.piece-preview img,.shape-card-image img{display:block;width:100%;height:150px;object-fit:contain}
@media(max-width:600px){.shape-card-image img{height:130px}}
.piece-hero{text-align:center;padding:0 0 16px}.piece-preview{height:150px;border-radius:10px;background:radial-gradient(ellipse at center,#f1f3e9,#e7ecde);margin-bottom:12px;overflow:hidden}.piece-preview svg{display:block;width:100%;height:150px;stroke:none}.piece-hero h3{font:400 24px/1.2 Georgia,serif;margin:8px 0 6px;letter-spacing:-.5px}.piece-hero p{color:#7c8b75;font-size:11px;line-height:1.6;margin:0}.piece-hero .small-badge{font-size:8px;letter-spacing:1.3px}#shapeLibraryDialog{width:850px;max-width:calc(100vw - 28px)}.shape-library-toolbar{display:flex;flex-direction:column;gap:12px;margin:20px 0}.shape-library-toolbar input{width:100%}#shapeCategories{display:flex;flex-wrap:wrap;gap:5px}#shapeCategories button{font-size:10px;text-transform:capitalize;border-radius:20px;background:#edf1e7;color:#7b8b70;padding:6px 12px}#shapeCategories button.active{background:#284536;color:#fff}#shapeLibraryItems{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}.shape-card{display:flex;flex-direction:column;text-align:left;padding:0;border:1px solid #e0e6d6;border-radius:9px;background:#fff;color:#2b4233;overflow:hidden}.shape-card.active{border-color:#5d7a48;box-shadow:0 0 0 1px #5d7a48}.shape-card-image{width:100%;background:radial-gradient(ellipse at 50% 40%,#f5f5eb,#e9eedf);height:150px}.shape-card-image svg{display:block;width:100%;height:150px;stroke:none}.shape-card>div:nth-child(2){padding:12px 14px 8px;flex:1}.shape-card strong{display:block;font-size:13px;font-weight:600}.shape-card span{font-size:10px;line-height:1.6;color:#819075;display:block;margin-top:5px}.shape-card small{padding:8px 14px;border-top:1px solid #edf0e7;display:flex;justify-content:space-between;align-items:center;font-size:8px;letter-spacing:1.2px;color:#89977d}.shape-card small b{font-size:14px;font-weight:400;line-height:1}.inspector select{font-size:10px;padding:6px}#shapeLibraryItems:empty:after{content:'No shapes match this search.';font-size:12px;color:#87957a;padding:25px 0;grid-column:1/-1}
@media(max-width:600px){#shapeLibraryItems{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}#shapeLibraryDialog{padding:18px}.shape-card-image,.shape-card-image svg{height:130px}.shape-card>div:nth-child(2){padding:10px}.shape-card strong{font-size:12px}.shape-card small{padding:7px 10px}.shape-card span{font-size:9px}#shapeCategories button{padding:5px 9px;font-size:9px}}
:root{--ink:#213b34;--muted:#7c8b82;--paper:#fafbf8;--line:#e4e8e1;--accent:#c66844;--accent-light:#f7e6dc;--green:#233e34;--shadow:0 12px 50px #162b2214;color-scheme:light;font:14px/1.5 Studio,'Segoe UI',sans-serif;color:var(--ink);background:#f0f2eb}
*{box-sizing:border-box}body{margin:0;overflow:hidden}button,input,select{font:inherit}button,a,input,select{outline-offset:3px}button{cursor:pointer}button{transition:background .15s,color .15s,box-shadow .15s}button:disabled{opacity:.3;cursor:default}button:hover:not(:disabled){filter:brightness(.96)}a{color:inherit;text-decoration:none}svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:1.5}input[type=checkbox]{accent-color:var(--green);width:13px;height:13px}input[type=range]{accent-color:var(--green);width:100%;margin:9px 0 3px;height:4px;cursor:ew-resize}input[type=color]{width:29px;height:29px;padding:0;border:0;border-radius:7px;overflow:hidden;cursor:pointer}input[type=number],select,.text-input{border:1px solid #dbe1d7;border-radius:7px;background:#fff;color:var(--ink);padding:7px 10px;max-width:100%;min-width:0}input[type=number]{width:80px;font-variant-numeric:tabular-nums}select{width:100%;padding:9px}input[type=search]{border:1px solid var(--line);border-radius:7px;padding:9px 13px;min-width:0}button{border:0}.topbar{height:76px;display:flex;align-items:center;gap:28px;padding:0 26px;background:var(--paper);border-bottom:1px solid var(--line);position:relative;z-index:10}.brand{display:flex;align-items:center;gap:10px;flex-shrink:0;font-size:23px;letter-spacing:-.8px;font-weight:650}.brand svg{width:32px;height:32px;stroke:none;fill:var(--green)}.brand-light{font-weight:350;margin-left:3px}.local-badge{font-size:8px;font-weight:600;letter-spacing:1.6px;padding:2px 5px;border:1px solid #cfd8cd;border-radius:3px;margin-left:4px;color:#7b8c7c}.project-name{display:flex;flex-direction:column;border-left:1px solid var(--line);padding-left:25px;line-height:1.4;min-width:170px}.project-name input{border:0;background:transparent;font-size:13px;color:var(--ink);font-weight:600;width:200px;padding:0}.project-name span{font-size:10px;color:var(--muted)}.header-actions{margin-left:auto;display:flex;gap:9px;align-items:center}.divider{width:1px;height:22px;background:var(--line);display:inline-block;margin:0 6px}.primary-button,.quiet-button{padding:10px 17px;border-radius:7px;font-weight:600;font-size:12px;white-space:nowrap}.primary-button{background:var(--green);color:white;box-shadow:0 3px 7px #233e3417}.primary-button span{margin-left:16px}.quiet-button{background:transparent;color:var(--ink)}.quiet-button:hover{background:#eef1e9}.icon-button{background:transparent;border-radius:7px;font-size:25px;width:32px;color:var(--ink);line-height:1}.workspace{height:calc(100dvh - 76px);display:flex}.tool-rail{width:78px;flex:none;background:var(--paper);border-right:1px solid var(--line);display:flex;align-items:center;flex-direction:column;gap:12px;padding:25px 6px}.tool-rail button{display:flex;align-items:center;flex-direction:column;justify-content:center;gap:5px;width:64px;height:63px;color:#7d8b80;background:transparent;border-radius:9px;font-size:9px;letter-spacing:.2px}.tool-rail button svg{width:21px;height:21px}.tool-rail button.active{color:var(--green);background:#e9eee3}.tool-rail button.active:before{content:'';position:absolute;left:0;width:3px;height:25px;background:var(--green);border-radius:0 4px 4px 0}.settings{width:294px;flex:none;background:var(--paper);border-right:1px solid var(--line);display:flex;flex-direction:column;z-index:3}.settings-heading{padding:28px 24px 23px}.eyebrow{font-size:9px;letter-spacing:1.9px;font-weight:700;color:#82917e;display:block}.settings-heading h1{font-family:Georgia,'Times New Roman',serif;font-size:28px;font-weight:400;letter-spacing:-1.2px;margin:9px 0 5px;line-height:1.2}.settings-heading p{font-size:11px;color:var(--muted);margin:0}.control-body{padding:0 24px 20px;overflow:auto;flex:1;scrollbar-width:thin;scrollbar-color:#ced6ca transparent}.control-section{border-top:1px solid var(--line);padding:19px 0 14px}.section-title{margin:0 0 13px;font-size:10px;letter-spacing:1.4px;text-transform:uppercase;font-weight:650;display:flex;justify-content:space-between}.small-badge{font-size:8px;letter-spacing:.5px;background:#e9eee3;color:#61794d;border-radius:4px;padding:1px 5px}.field{margin-bottom:14px}.field-head{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:11px;margin-bottom:4px}.field-head output{color:#77856f;font-variant-numeric:tabular-nums}.field p,.control-note{font-size:10px;color:#8a9486;margin:5px 0 0;line-height:1.6}.field-pair{display:grid;grid-template-columns:1fr 1fr;gap:11px}.field-pair input{width:100%}.field-pair label,.input-label{display:block;font-size:10px;color:#7c8a78;margin:0 0 5px}.shape-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin-bottom:18px}.shape-grid button{display:flex;flex-direction:column;align-items:center;gap:6px;background:#f2f4ed;border:1px solid transparent;border-radius:7px;padding:10px 2px;color:#84917a;font-size:9px}.shape-grid button.active{border-color:#8e9f7d;color:var(--green);background:#edf1e7}.shape-grid svg{width:24px;height:24px;stroke-width:1}.segmented{display:flex;border-radius:7px;padding:3px;background:#edf0e8;gap:3px}.segmented button{flex:1;padding:6px 3px;background:transparent;color:#8a9483;border-radius:4px;font-size:10px}.segmented button.active{background:#fff;color:var(--ink);box-shadow:0 1px 4px #233e3412}.toggle{display:flex;align-items:center;gap:9px;font-size:11px;margin:11px 0}.full-button{width:100%;padding:9px;border:1px solid var(--line);border-radius:6px;color:var(--ink);background:white;font-size:11px;margin-top:6px}.mini-button{padding:5px 7px;border-radius:4px;font-size:10px;color:var(--ink);background:#edf1e8}.settings-footer{border-top:1px solid var(--line);display:flex;gap:7px;align-items:center;padding:14px 20px;font-size:10px;color:#89947f;flex:none}.live-dot{height:5px;width:5px;border-radius:50%;background:#73926b;display:inline-block;box-shadow:0 0 0 3px #73926b13;flex-shrink:0}.settings-footer button{margin-left:auto;background:#edf0e8;color:#89947f;border-radius:50%;height:20px;width:20px;font-size:11px}.stage{position:relative;flex:1;min-width:0;display:flex;flex-direction:column;background:radial-gradient(ellipse at 50% 36%,#f7f8f1 0,#e9ede3 85%)}.stage-header{display:flex;align-items:center;justify-content:space-between;padding:25px 30px;position:absolute;top:0;left:0;right:0;z-index:2;pointer-events:none}.stage-header>div{pointer-events:auto}.stage-caption{display:flex;gap:12px;align-items:center;margin-top:5px;font-size:13px;font-weight:600}.pill{font-size:9px;background:#fff9;color:#86947d;padding:3px 8px;border-radius:20px;font-weight:400}.view-switch{display:flex;gap:3px;background:#f9faf5cd;border:1px solid #e0e5d9;border-radius:8px;padding:3px;box-shadow:0 2px 10px #374b3005}.view-switch button{padding:7px 13px;border-radius:5px;font-size:10px;background:transparent;color:#84917a}.view-switch button.active{background:#dfe7d5;color:#314a33}.stage #viewport{position:absolute;inset:0 0 173px;overflow:hidden}#viewport canvas{width:100%;height:100%;display:block;outline:0}#loading{position:absolute;top:48%;left:50%;transform:translate(-50%,-50%);font-size:12px;color:#83917d;display:flex;gap:10px;align-items:center}.spinner{width:16px;height:16px;border:2px solid #d7dfcf;border-top-color:#546e48;border-radius:50%;animation:spin 1s linear infinite}@keyframes spin{to{transform:rotate(360deg)}}.canvas-tools{position:absolute;top:99px;left:50%;transform:translateX(-50%);z-index:2;background:#fafcf7ed;border:1px solid #e1e6da;box-shadow:0 4px 15px #3a4f330a;border-radius:8px;display:flex;align-items:center;gap:3px;padding:4px}.canvas-tools button{background:transparent;color:#84927c;font-size:13px;display:flex;align-items:center;gap:6px;padding:7px 9px;border-radius:5px}.canvas-tools button span{font-size:10px}.canvas-tools button.active{background:#e5ebdb;color:#405637}.canvas-tools .divider{height:18px;margin:0 3px}.stage-info{position:absolute;bottom:202px;left:32px;right:32px;display:flex;gap:12px;align-items:center;pointer-events:none}.material-swatch{height:27px;width:27px;border-radius:50%;background:conic-gradient(#b85d3d,#eec7a8,#f6e3c8,#b85d3d);box-shadow:0 2px 6px #76523620;border:2px solid #fff9}.stage-info strong{display:block;font-size:10px;font-weight:600}.stage-info span{font-size:9px;color:#89947f;display:block;margin-top:3px}.stage-stats{display:flex;gap:24px;margin-left:auto;text-align:right}.stage-stats strong{font-size:17px;font-weight:350;letter-spacing:-.5px}.preview-flags{position:absolute;bottom:173px;left:32px;right:32px;display:flex;gap:15px;justify-content:center;height:26px;align-items:center}.preview-flags label{font-size:9px;display:flex;align-items:center;gap:4px;color:#7c8975;cursor:pointer}.preview-flags input{height:11px;width:11px}.preset-strip{height:132px;background:#fafbf7d9;border-top:1px solid #dfe5d7;display:flex;gap:23px;align-items:center;padding:18px 30px;position:absolute;bottom:30px;left:0;right:0;overflow:hidden}.preset-intro{width:120px;flex:none}.preset-intro .eyebrow{font-size:8px;letter-spacing:1.5px}.preset-intro strong{font-family:Georgia,serif;font-weight:400;font-size:20px;display:block;line-height:1.2;margin-top:7px;max-width:100px}.preset-strip #presets{display:flex;gap:12px;flex:1;min-width:0;overflow:auto;scrollbar-width:none}.preset-card{padding:0;background:transparent;min-width:90px;flex:1;text-align:left;max-width:128px;color:#697c60}.preset-art{height:63px;border:3px solid white;border-radius:6px;overflow:hidden;box-shadow:0 2px 6px #2a40241a;display:grid;grid-template-columns:repeat(10,1fr);gap:1px;padding:6px;background:#e4e7df}.preset-art i{display:block;transform:skewY(-15deg);background:#aa6b4c}.preset-card span{display:block;font-size:9px;margin-top:6px}.random-button{border:1px solid #dce3d3;border-radius:7px;padding:13px 16px;background:#f5f7ef;color:#718465;font-size:24px;line-height:1;flex:none}.random-button .surprise-label{font-size:10px;display:block;margin-top:7px;white-space:nowrap}.surprise-actions{display:flex;align-items:center;gap:6px;flex:none}.statusbar{height:30px;position:absolute;bottom:0;left:0;right:0;background:#f5f7ef;border-top:1px solid #e5eadd;display:flex;align-items:center;justify-content:space-between;padding:0 23px;font-size:9px;color:#99a38e}.statusbar>span:first-child{display:flex;align-items:center;gap:7px}.statusbar .live-dot{width:4px;height:4px}.status-separator{margin:0 8px;color:#c2caba}.inspector{position:absolute;right:22px;top:164px;width:205px;padding:22px 18px;background:#fbfcf7f5;border:1px solid #e2e7d9;border-radius:10px;box-shadow:var(--shadow);z-index:5}.inspector h3{font-family:Georgia,serif;font-size:20px;font-weight:400;margin:8px 0}.inspector p{font-size:10px;color:var(--muted);white-space:pre-line}.inspector .quiet-button{font-size:10px;padding:8px 4px;display:block}.close-button{background:transparent;font-size:24px;color:#85917c;line-height:1;padding:4px}.inspector>.close-button{position:absolute;right:7px;top:7px}.palette-row{display:flex;gap:7px;flex-wrap:wrap;margin:12px 0}.colour-chip{height:27px;width:27px;border-radius:50%;border:3px solid #fff;box-shadow:0 0 0 1px #d9dfd2;position:relative}.colour-chip.active{box-shadow:0 0 0 2px #344e30}.palette-edit{display:flex;gap:8px;align-items:center;margin:9px 0}.palette-edit label{font-size:11px;flex:1}.palette-edit .mini-button{padding:2px 7px;color:#a3ab9b}.preset-palettes{display:grid;grid-template-columns:1fr 1fr;gap:6px}.preset-palettes button{height:29px;border-radius:5px;display:flex;padding:3px;gap:0;border:1px solid #e0e5d7;background:white;overflow:hidden}.preset-palettes i{display:block;flex:1}.force-card,.brush-card{border:1px solid var(--line);border-radius:7px;padding:10px;margin:9px 0;background:#f4f6ef}.force-card.active{border-color:#aab99b}.force-card-head{display:flex;justify-content:space-between;align-items:center;font-size:11px}.force-card-head>button{background:transparent;color:#788b6f;padding:3px}.force-controls{padding-top:12px}.force-card .field{margin-bottom:8px}.force-card input[type=number]{font-size:10px;width:100%;padding:4px 6px}.force-card .field-pair{margin:8px 0}.force-add{display:grid;grid-template-columns:1fr 1fr;gap:6px}.force-add button{border:1px solid var(--line);background:white;color:#6b805e;border-radius:6px;padding:9px 5px;font-size:10px}.stat-row{display:flex;justify-content:space-between;font-size:11px;margin:10px 0}.stat-row span{color:var(--muted)}details{border-top:1px solid var(--line);padding:13px 0}summary{cursor:pointer;font-size:11px;font-weight:600;list-style:none;display:flex;justify-content:space-between}summary:after{content:'+';color:#93a087}details[open] summary:after{content:'−'}details>div{margin-top:15px}.warning{background:#f6ead7;color:#9c783c;border:1px solid #e8d3ad;border-radius:6px;padding:10px;font-size:10px;line-height:1.6}.good{background:#eaf0e1;padding:10px;border-radius:6px;font-size:10px;color:#65824e;line-height:1.6}dialog{border:1px solid #dce2d3;border-radius:14px;max-width:min(800px,calc(100vw - 40px));max-height:calc(100dvh - 60px);padding:30px;background:#fbfcf7;color:var(--ink);box-shadow:0 25px 100px #182d2633}dialog::backdrop{background:#1f302850;backdrop-filter:blur(4px)}.dialog-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:35px}.dialog-heading h2{font-family:Georgia,serif;font-weight:400;font-size:30px;letter-spacing:-.8px;margin:7px 0 0}.dialog-description{font-size:12px;color:var(--muted)}.export-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin:18px 0}.export-card{display:flex;flex-direction:column;text-align:left;gap:8px;padding:17px;background:white;border:1px solid #e0e6d7;border-radius:8px;color:var(--ink);min-height:150px}.export-card.featured{background:#edf2e6;border-color:#b9c9aa}.export-card strong{font-size:12px}.export-card>span:last-child{font-size:10px;color:var(--muted);line-height:1.6}.file-icon{font-size:10px;border:1px solid #ced8c3;border-radius:4px;padding:5px 6px;align-self:flex-start;color:#779164}.export-note{font-size:10px;color:#8b9684;line-height:1.7}.export-summary{display:flex;gap:30px;padding:14px 0;border-top:1px solid var(--line);border-bottom:1px solid var(--line);font-size:12px}.export-summary span{display:block;font-size:9px;color:var(--muted)}#exportProgress{font-size:12px;color:var(--accent)}.library-toolbar{display:flex;gap:10px;margin:20px 0}.library-toolbar input{flex:1}.library-item{border-top:1px solid var(--line);display:flex;align-items:center;gap:15px;padding:15px 0}.library-item>div{flex:1}.library-item strong{font-size:13px}.library-item span{font-size:10px;display:block;color:var(--muted)}.help-content{font-size:13px;line-height:1.8;max-width:600px}.help-content li{margin:10px 0}#toast{position:fixed;bottom:46px;left:50%;transform:translate(-50%,20px);background:#233e34;color:#eff4e9;padding:12px 20px;border-radius:8px;font-size:12px;box-shadow:0 4px 30px #20372833;opacity:0;pointer-events:none;z-index:100;transition:opacity .15s,transform .15s;max-width:75vw}#toast.visible{opacity:1;transform:translate(-50%,0)}#webglError{margin:180px auto;max-width:400px;padding:25px;font-size:14px}#webglError[hidden],#loading[hidden],.inspector[hidden]{display:none}
.design-warnings{background:#f2e5c9;color:#8e6f35;font-size:9px;border-radius:12px;padding:3px 8px;white-space:nowrap}.next-preset{width:24px;min-width:24px;height:32px;border-radius:50%;font-size:24px;line-height:1;background:#edf1e6;color:#718465;padding:0}.next-preset:hover{background:#e3ead9}
@media(min-width:1600px){.settings{width:318px}.settings-heading{padding-top:34px}.control-body{padding-left:27px;padding-right:27px}.tool-rail{width:86px}.preset-strip{gap:30px}.preset-art{height:68px}.preset-card{max-width:140px}}
@media(max-width:1150px){.project-name{display:none}.topbar{padding:0 18px}.settings{width:262px}.settings-heading,.control-body{padding-left:18px;padding-right:18px}.tool-rail{width:66px}.tool-rail button{width:56px}.canvas-tools button{padding:7px}.canvas-tools button span{display:none}.preset-intro{display:none}.preset-strip{gap:12px;padding:18px}.stage-header{padding:22px}.random-button{padding:13px 10px}.preview-flags{gap:8px;left:10px;right:10px}.stage-info{left:22px;right:22px}#hint{display:none}.view-switch button{padding:7px 9px}.stage-caption{gap:7px}}
@media(max-width:800px){.topbar{height:64px;gap:10px}.brand{font-size:20px}.brand .local-badge{display:none}.header-actions{gap:2px}.workspace{height:calc(100dvh - 64px)}.tool-rail{width:54px;padding:17px 2px;gap:5px}.tool-rail button{width:48px;font-size:8px}.settings{width:220px}.settings-heading{padding-top:24px}.settings-heading h1{font-size:25px}.control-body{padding-left:14px;padding-right:14px}.stage-header{padding:18px 14px;align-items:flex-start;gap:12px;flex-direction:column}.stage-caption{font-size:11px}.canvas-tools{top:132px}.preset-strip{height:108px;bottom:30px}.stage #viewport{bottom:150px}.preview-flags{bottom:138px;flex-wrap:wrap;height:auto;gap:2px 7px}.stage-info{bottom:180px;left:12px;right:12px}.stage-stats{gap:14px}.material-swatch,.stage-info>div:nth-child(2){display:none}.preset-art{height:44px}.preset-card{min-width:65px}.random-button{padding:7px 8px;font-size:19px}.stage-stats strong{font-size:14px}.statusbar{padding:0 10px;font-size:8px}.statusbar>span:last-child{display:none}.inspector{width:170px;right:10px;top:190px}.export-grid{grid-template-columns:1fr 1fr}.export-summary{gap:15px}.library-toolbar{flex-wrap:wrap}dialog{padding:20px}.dialog-heading h2{font-size:25px}}

/* Phone layout: the full-width preview stays above a scrolling control sheet. */
@media(max-width:700px){
  :root{--mobile-header-height:96px;--mobile-preview-height:clamp(300px,48svh,430px)}
  html{overflow-x:hidden}
  body{overflow-x:hidden;overflow-y:auto;min-width:280px}
  .topbar{height:var(--mobile-header-height);padding:9px 12px;gap:6px;display:flex;flex-direction:column;align-items:stretch;justify-content:center;position:sticky;top:0;z-index:30}
  .brand{align-self:flex-start;font-size:19px;line-height:28px;gap:7px}
  .brand svg{width:27px;height:27px}
  .project-name,.brand .local-badge{display:none}
  .header-actions{width:100%;margin-left:0;gap:4px;justify-content:space-between;min-width:0}
  .header-actions>.quiet-button{display:inline-flex;align-items:center;justify-content:center;font-size:10px;padding:8px 6px;min-height:32px}
  .header-actions .icon-button{width:26px;min-width:26px;font-size:23px;height:32px}
  .header-actions .divider{display:none}
  .header-actions .primary-button{padding:9px 10px;font-size:10px;min-height:32px;margin-left:auto}
  .header-actions .primary-button span{display:none}
  .workspace{height:auto;min-height:calc(100svh - var(--mobile-header-height));display:flex;flex-direction:column;overflow:visible}
  .stage{order:0;position:sticky;top:var(--mobile-header-height);z-index:12;flex:none;width:100%;height:var(--mobile-preview-height);min-height:300px;border-bottom:1px solid var(--line)}
  .stage-header{padding:8px 10px;flex-direction:row;align-items:center;gap:7px}
  .stage-header .eyebrow{display:none}
  .stage-caption{margin-top:0;font-size:11px;gap:6px;max-width:calc(100vw - 185px)}
  #artTitle{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:125px}
  .stage-caption .pill{font-size:8px;padding:3px 5px;white-space:nowrap;flex:none}
  .view-switch{padding:2px;gap:1px}
  .view-switch button{padding:7px 8px;font-size:9px;min-height:29px}
  .canvas-tools{top:47px;padding:3px;gap:2px;max-width:calc(100% - 16px);white-space:nowrap}
  .canvas-tools button{padding:6px 8px;min-width:29px;min-height:31px;justify-content:center}
  .canvas-tools button span,.canvas-tools .divider{display:none}
  .stage #viewport{inset:0 0 90px}
  .stage-info{display:none}
  .preview-flags{bottom:66px;left:0;right:0;height:24px;justify-content:flex-start;flex-wrap:nowrap;gap:11px;padding:2px 10px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}
  .preview-flags label{flex:none;white-space:nowrap;font-size:9px;min-height:22px}
  .preview-flags input{width:13px;height:13px}
  .preset-strip{height:42px;bottom:24px;gap:6px;padding:5px 8px}
  .preset-intro,.preset-art{display:none}
  .random-button{display:inline-flex;align-items:center;gap:4px;padding:5px 7px;min-height:31px;font-size:15px}
  .random-button .surprise-label{margin:0;font-size:10px}
  .surprise-actions{gap:4px}
  .preset-strip #presets{gap:6px;align-items:center;min-height:30px;touch-action:pan-x}
  .preset-card{flex:none;min-width:74px;max-width:none;padding:7px 8px;border:1px solid #dce3d3;border-radius:5px;background:#fff;text-align:center}
  .preset-card span{font-size:9px;line-height:14px;margin:0;white-space:nowrap}
  .next-preset{height:28px;width:25px;min-width:25px}
  .statusbar{height:24px;padding:0 9px;font-size:8px;gap:6px}
  .statusbar>span:first-child{min-width:0;overflow:hidden;white-space:nowrap}
  #renderStatus,#surpriseStatus{overflow:hidden;text-overflow:ellipsis}
  .statusbar #hint,.statusbar>span:last-child{display:none}
  .tool-rail{order:1;position:sticky;top:calc(var(--mobile-header-height) + var(--mobile-preview-height));z-index:20;flex:none;width:100%;height:57px;padding:4px 6px;gap:3px;flex-direction:row;justify-content:space-between;overflow-x:auto;overflow-y:hidden;border-right:0;border-bottom:1px solid var(--line)}
  .tool-rail button{flex:1;min-width:43px;width:auto;height:48px;font-size:9px;gap:2px;border-radius:6px}
  .tool-rail button svg{width:19px;height:19px}
  .tool-rail button.active:before{content:none}
  .settings{order:2;width:100%;flex:none;min-width:0;overflow:visible;border-right:0}
  .settings-heading{padding:19px 18px 14px}
  .settings-heading h1{font-size:27px}
  .control-body{padding:0 18px 26px;overflow:visible;flex:none}
  .control-section{padding:17px 0}
  .section-title{font-size:11px}
  .field-head,.toggle,.full-button{font-size:12px}
  .field-head output{flex:none}
  .field-pair label,.input-label{font-size:11px}
  input[type=range]{height:24px;margin:7px 0 5px}
  select,input[type=number]{min-height:38px;font-size:13px}
  .shape-grid button{font-size:11px;min-height:63px}
  .full-button{min-height:38px}
  .settings-footer{display:none}
  .inspector{top:84px;right:8px;width:185px;max-height:calc(var(--mobile-preview-height) - 95px);overflow:auto;padding:15px;z-index:25}
  dialog{width:calc(100vw - 18px);max-width:calc(100vw - 18px);max-height:calc(100dvh - 24px);padding:16px;overflow:auto}
  .dialog-heading{gap:12px}
  .dialog-heading h2{font-size:25px}
  .export-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .export-card{padding:12px;min-height:130px;min-width:0}
  .export-summary{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;font-size:11px}
  .export-summary>div:last-child{grid-column:1/-1}
  .library-toolbar{flex-wrap:wrap;gap:7px}
  .library-toolbar input{width:100%;flex-basis:100%}
  .library-item{gap:8px;overflow-wrap:anywhere}
  .library-item>div{min-width:0}
  #toast{bottom:16px;max-width:calc(100vw - 24px);padding:10px 14px;font-size:11px}
  #webglError{margin:85px 12px 0;max-width:none;padding:12px;font-size:12px;line-height:1.5}
}
@media(max-width:360px){
  .header-actions{gap:2px}
  .header-actions>.quiet-button{font-size:9px;padding:8px 4px}
  .header-actions .primary-button{font-size:9px;padding:9px 7px}
  .header-actions .icon-button{width:23px;min-width:23px}
  .stage-caption{max-width:calc(100vw - 170px)}
  #artTitle{max-width:64px}
  .stage-caption .pill{font-size:7px}
  .view-switch button{font-size:8px;padding:7px 6px}
  .canvas-tools button{padding:6px;min-width:27px}
}
/* On short landscape displays, let the preview scroll away to leave editing room. */
@media(max-width:700px) and (max-height:520px){
  :root{--mobile-header-height:84px;--mobile-preview-height:280px}
  .topbar{padding-top:5px;padding-bottom:5px}
  .stage{position:relative;top:auto;min-height:280px}
  .tool-rail{top:var(--mobile-header-height)}
}

.collision-status{margin-top:12px;border:1px solid #cbd9c5;border-radius:8px;padding:11px;font-size:11px;line-height:1.55;background:#eef3e7;color:#365140}.collision-status[data-state="pending"]{background:#f4eddb;color:#6d5b2f;border-color:#e5d6ae}.collision-status[data-state="error"]{background:#f9e8df;color:#873f30;border-color:#e1b5a7}.collision-notice{position:absolute;top:72px;left:20px;right:20px;z-index:7;max-width:640px;margin:0 auto;padding:11px 16px;border-radius:8px;border:1px solid #d8c89b;background:#fff8e8f5;color:#655026;font-size:12px;box-shadow:0 6px 24px #263b2817;pointer-events:none}.collision-notice[hidden]{display:none}.collision-notice[data-state="error"]{background:#fff0e9f7;border-color:#dcafa1;color:#803d2f}@media(max-width:700px){.collision-notice{left:8px;right:8px;top:62px;font-size:11px;padding:8px 10px}}

/* Application appearance is independent of the actual artwork palette. */
:root{
  --muted:#5c6d61;
  --app-bg:#f0f2eb;
  --panel:#ffffff;
  --surface-soft:#edf1e8;
  --panel-inset:#e3eadc;
  --selected-fill:#e5eddd;
  --selected-border:#839b72;
  --action:#233e34;
  --on-action:#f8fcf4;
  --focus:#a64e2c;
  --warning-bg:#f6ead7;
  --warning-ink:#75551f;
  --warning-line:#d9bd86;
  --good-bg:#eaf0e1;
  --good-ink:#456033;
  --good-line:#bbcfac;
  --error-bg:#fae8e0;
  --error-ink:#873f30;
  --error-line:#d8aa9c;
  --preview-bg:#e9ede3;
  --preview-ink:#263e30;
  --preview-muted:#4f6554;
  --preview-line:#a9b5a6;
  background:var(--app-bg);
}
:root[data-theme="dark"]{
  color-scheme:dark;
  --ink:#e5eee1;
  --muted:#b2c0b3;
  --paper:#1d2d25;
  --app-bg:#14221b;
  --panel:#24372c;
  --surface-soft:#2c4032;
  --panel-inset:#344b39;
  --line:#405143;
  --green:#b5d4ad;
  --accent:#efaa83;
  --accent-light:#4a3529;
  --selected-fill:#3d583f;
  --selected-border:#a6c893;
  --action:#b8d5af;
  --on-action:#192c20;
  --focus:#f1bb95;
  --shadow:0 12px 50px #0000004d;
  --warning-bg:#493d25;
  --warning-ink:#f2d49b;
  --warning-line:#8b7446;
  --good-bg:#2d432c;
  --good-ink:#c0dbae;
  --good-line:#5d7952;
  --error-bg:#4b302b;
  --error-ink:#ffc1aa;
  --error-line:#9b6756;
  --preview-bg:#263a30;
  --preview-ink:#e7eee1;
  --preview-muted:#bac9b8;
  --preview-line:#53674f;
}
body{background:var(--app-bg)}
button,input,select,textarea{color:var(--ink)}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,summary:focus-visible{
  outline:2px solid var(--focus);outline-offset:3px;
}
input[type=number],input[type=search],select,.text-input{
  background:var(--panel);border-color:var(--line);color:var(--ink);
}
input::placeholder{color:var(--muted);opacity:.9}
input[type=checkbox],input[type=range]{accent-color:var(--action)}
.primary-button{background:var(--action);color:var(--on-action)}
.quiet-button:hover,.mini-button,.settings-footer button,.next-preset{background:var(--surface-soft);color:var(--ink)}
.full-button,.force-add button,.preset-palettes button{background:var(--panel);border-color:var(--line);color:var(--ink)}
.brand svg{fill:var(--green)}
.local-badge{color:var(--muted);border-color:var(--line)}
.eyebrow,.settings-heading p,.field p,.control-note,.input-label,.field-pair label,
.field-head output,.settings-footer,.piece-hero p,.shape-card span,.shape-card small,
.file-icon,.export-note,.force-card-head>button,.preset-card,.library-item span,
.close-button,.palette-edit .mini-button,#shapeLibraryItems:empty:after{color:var(--muted)}
.small-badge{background:var(--surface-soft);color:var(--ink)}
.control-body{scrollbar-color:var(--selected-border) var(--paper)}
.tool-rail button{color:var(--muted)}
.tool-rail button.active{color:var(--green);background:var(--selected-fill)}
.shape-grid button{color:var(--muted);background:var(--surface-soft)}
.shape-grid button.active{color:var(--ink);background:var(--selected-fill);border-color:var(--selected-border)}
.segmented{background:var(--surface-soft)}
.segmented button{color:var(--muted)}
.segmented button.active{color:var(--ink);background:var(--panel)}
.force-card,.brush-card{background:var(--surface-soft)}
.force-card.active{border-color:var(--selected-border)}
.warning,.design-warnings{background:var(--warning-bg);color:var(--warning-ink);border-color:var(--warning-line)}
.good{background:var(--good-bg);color:var(--good-ink)}
dialog{background:var(--paper);border-color:var(--line)}
dialog::backdrop{background:#0b160ecc}
.export-card{background:var(--panel);border-color:var(--line)}
.export-card.featured{background:var(--selected-fill);border-color:var(--selected-border)}
.file-icon{border-color:var(--selected-border)}
.inspector{background:var(--paper);border-color:var(--line)}
.colour-chip{border-color:var(--panel);box-shadow:0 0 0 1px var(--line)}
.colour-chip.active{box-shadow:0 0 0 2px var(--green)}
.piece-preview,.shape-card-image{background:radial-gradient(ellipse at 50% 40%,var(--surface-soft),var(--panel-inset))}
.shape-card{background:var(--panel);color:var(--ink);border-color:var(--line)}
.shape-card.active{border-color:var(--selected-border);box-shadow:0 0 0 1px var(--selected-border)}
.shape-card small{border-color:var(--line)}
#shapeCategories button{background:var(--surface-soft);color:var(--muted)}
#shapeCategories button.active{background:var(--action);color:var(--on-action)}
#toast{background:var(--action);color:var(--on-action)}
.help-content a{text-decoration:underline;text-decoration-color:var(--selected-border)}

/* Preview lettering follows the chosen backdrop, not the UI theme. */
.stage{background:var(--preview-bg);color:var(--preview-ink)}
.stage-header .eyebrow,.stage-info span{color:var(--preview-muted)}
.stage-header{background:transparent}
.stage-info{background:transparent;color:var(--preview-ink);border:0;box-shadow:none}
.stage-info strong{color:var(--preview-ink)}
.stage-caption{color:var(--preview-ink)}
.stage-caption .pill{background:var(--paper);color:var(--muted);border:1px solid var(--line)}
.view-switch,.canvas-tools{background:var(--paper);border-color:var(--line);color:var(--ink)}
.view-switch button,.canvas-tools button{color:var(--muted)}
.view-switch button.active,.canvas-tools button.active{background:var(--selected-fill);color:var(--ink)}
.stage .divider{background:var(--line)}
.preview-flags{background:var(--paper);border-top:1px solid var(--line);color:var(--ink)}
.preview-flags label{color:var(--muted)}
.preset-strip{background:var(--paper);border-color:var(--line);color:var(--ink)}
.preset-art{border-color:var(--panel)}
.random-button{background:var(--surface-soft);border-color:var(--line);color:var(--ink)}
.random-button-all{background:var(--selected-fill);border-color:var(--selected-border)}
.statusbar{background:var(--paper);border-color:var(--line);color:var(--muted)}
.status-separator{color:var(--line)}
.next-preset:hover{background:var(--selected-fill)}
#loading,#webglError{color:var(--preview-ink)}
.spinner{border-color:var(--preview-line);border-top-color:var(--preview-ink)}
.collision-status{background:var(--good-bg);color:var(--good-ink);border-color:var(--good-line)}
.collision-status[data-state="pending"],.collision-notice{background:var(--warning-bg);color:var(--warning-ink);border-color:var(--warning-line)}
.collision-status[data-state="error"],.collision-notice[data-state="error"]{background:var(--error-bg);color:var(--error-ink);border-color:var(--error-line)}
.collision-notice[data-state="error"]{pointer-events:auto}
.collision-notice button{display:block;margin-top:8px;min-height:44px;color:inherit;border:1px solid currentColor;border-radius:6px;padding:8px 12px;background:transparent;cursor:pointer}

/* Always-visible workspace and appearance preferences. */
.topbar{gap:20px}
.workspace-preferences{display:flex;align-items:center;gap:8px;flex:none;margin-left:auto}
.preference-control{display:flex;flex-direction:column;gap:3px;min-width:0}
.preference-control>span{font-size:9px;line-height:1.2;color:var(--muted);font-weight:600;letter-spacing:.3px}
.preference-control select{width:auto;min-width:91px;padding:6px 9px;font-size:11px;line-height:1.35;height:32px}
.preference-control:first-child select{min-width:109px}
.header-actions{margin-left:0;flex-shrink:0}
.mode-hint{font-size:11px;line-height:1.6;color:var(--muted);margin:11px 0}
.mode-hint a,.simple-note a{text-decoration:underline;text-underline-offset:3px}
.backdrop-preview{display:flex;gap:9px;align-items:center;padding:10px;margin:10px 0;border:1px solid var(--line);border-radius:8px;background:var(--surface-soft);color:var(--ink);font-size:11px;line-height:1.45}
.backdrop-preview>i,.backdrop-preview>.backdrop-swatch{display:block;width:25px;height:25px;flex:none;border:1px solid var(--selected-border);border-radius:7px;background:var(--preview-bg)}
.backdrop-preview strong{display:block;font-size:11px;font-weight:600}
.backdrop-preview small{display:block;font-size:10px;color:var(--muted);margin-top:2px}

/* The simple workspace narrows the choices, preserving the artwork itself. */
:root[data-mode="simple"] .tool-rail,:root[data-mode="simple"] .advanced-only{display:none!important}
:root[data-mode="simple"] .settings{width:320px}
.simple-intro{padding:1px 0 16px}
.simple-intro h2{font:400 23px/1.22 Georgia,serif;letter-spacing:-.5px;margin:0 0 8px;color:var(--ink)}
.simple-intro p{font-size:12px;line-height:1.65;color:var(--muted);margin:0}
.simple-steps{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin:15px 0 0;padding:0;list-style:none}
.simple-steps>*{min-width:0;padding:9px 5px;text-align:center;font-size:10px;line-height:1.4;color:var(--muted);background:var(--surface-soft);border-radius:6px}
.simple-steps>.active{color:var(--ink);background:var(--selected-fill);box-shadow:inset 0 0 0 1px var(--selected-border)}
.simple-note{padding:11px 12px;margin:12px 0;border-radius:7px;border-left:3px solid var(--selected-border);background:var(--surface-soft);font-size:11px;line-height:1.6;color:var(--muted)}
.simple-size-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
.simple-size-grid button{padding:11px 4px;min-height:49px;border:1px solid var(--line);border-radius:7px;background:var(--panel);color:var(--ink);font-size:11px;line-height:1.4}
.simple-size-grid button.active{background:var(--selected-fill);border-color:var(--selected-border)}
.simple-size-grid strong,.simple-size-grid span{display:block}
.simple-size-grid span{font-size:9px;color:var(--muted);margin-top:3px}
.simple-palette-name{font-size:11px;font-weight:600;line-height:1.5;color:var(--ink);margin:10px 0 5px}
.simple-finish{border-top:1px solid var(--line);padding:17px 0}
.simple-finish .primary-button{width:100%;min-height:44px}
.simple-finish button{min-height:44px}
:root[data-mode="simple"] .palette-row{flex-wrap:wrap}
:root[data-mode="simple"] .palette-row input[type=color]{width:44px;height:44px;flex:none}
:root[data-mode="simple"] .preset-palettes button{height:44px;min-height:44px}
:root[data-mode="simple"] .export-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
.simple-finish p{color:var(--muted);font-size:11px;line-height:1.6;margin:10px 0}
.mode-upgrade{display:block;width:100%;padding:11px;margin:10px 0 0;border:1px dashed var(--selected-border);border-radius:7px;color:var(--ink);background:transparent;font-size:11px;text-align:center}
.mode-upgrade:hover{background:var(--surface-soft)}

@media(min-width:1600px){:root[data-mode="simple"] .settings{width:340px}}
@media(max-width:1350px){.topbar{gap:13px;padding-left:18px;padding-right:18px}.project-name{display:none}.header-actions{gap:5px}.header-actions .quiet-button{padding-left:10px;padding-right:10px}}
@media(max-width:1000px){.topbar{gap:10px}.brand{font-size:21px;gap:7px}.brand .local-badge{display:none}.workspace-preferences{gap:6px}.preference-control select{min-width:75px;padding-left:7px;padding-right:7px}.preference-control:first-child select{min-width:96px}.header-actions .primary-button{padding-left:12px;padding-right:12px}.header-actions .primary-button span{margin-left:7px}}
@media(min-width:701px) and (max-width:1000px){
  .topbar{height:124px;display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:56px 44px;gap:6px 14px;padding:8px 18px;align-items:center}
  .topbar .brand{grid-column:1;grid-row:1;font-size:21px}
  .workspace-preferences{grid-column:2;grid-row:1;margin:0;justify-self:end}
  .preference-control>span{font-size:9px}
  .preference-control select{height:44px;min-height:44px;font-size:12px}
  .header-actions{grid-column:1/-1;grid-row:2;width:100%;justify-content:flex-end;gap:8px;margin:0}
  .header-actions>.quiet-button{display:inline-flex;align-items:center;justify-content:center;min-height:44px;padding:9px 14px;font-size:12px}
  .header-actions .divider{display:none}
  .header-actions .icon-button{height:44px;min-width:36px;width:36px}
  .header-actions .primary-button{min-height:44px;font-size:12px;padding:10px 15px}
  .workspace{height:calc(100dvh - 124px)}
}
@media(max-width:700px){
  :root{--mobile-header-height:108px}
  .topbar{height:var(--mobile-header-height);display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-rows:44px 44px;gap:5px 10px;padding:7px 12px;align-items:center;justify-content:stretch}
  .brand{grid-column:1;grid-row:1;align-self:center;font-size:19px}
  .workspace-preferences{grid-column:2;grid-row:1;margin:0;gap:6px;justify-self:end}
  .preference-control>span{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
  .preference-control select{height:44px;min-height:44px;font-size:12px;min-width:75px;padding:9px 7px}
  .preference-control:first-child select{min-width:99px}
  .header-actions{grid-column:1/-1;grid-row:2;margin:0;gap:5px;min-height:44px}
  .header-actions .icon-button{height:44px;min-width:30px;width:30px}
  .header-actions>.quiet-button{min-height:44px;font-size:11px;padding:8px}
  .header-actions .primary-button{min-height:44px;font-size:11px;padding:9px 12px}
  :root[data-mode="simple"] .settings{width:100%}
  :root[data-mode="simple"] .export-grid{grid-template-columns:minmax(0,1fr)}
  :root[data-mode="simple"] .export-card{min-height:120px}
  .simple-intro h2{font-size:25px}
  .simple-intro p,.simple-note,.simple-finish p,.mode-hint{font-size:12px}
  .simple-steps>*{font-size:11px;padding:11px 5px}
  .simple-size-grid button{min-height:55px;font-size:12px}
  .simple-size-grid span{font-size:10px}
  .mode-upgrade{min-height:44px;font-size:12px}
  .backdrop-preview{font-size:12px;min-height:44px}
  .preset-card{background:var(--panel);border-color:var(--line);color:var(--muted)}
  .view-switch button{min-height:32px}
}
@media(max-width:480px){
  :root{--mobile-header-height:144px}
  .topbar{grid-template-columns:minmax(0,1fr);grid-template-rows:28px 44px 44px;row-gap:5px;padding-top:8px;padding-bottom:8px}
  .brand{grid-column:1;grid-row:1;font-size:18px;line-height:26px}
  .brand svg{width:25px;height:25px}
  .workspace-preferences{grid-column:1;grid-row:2;width:100%;justify-self:stretch;display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .preference-control select,.preference-control:first-child select{width:100%;min-width:0;font-size:13px}
  .header-actions{grid-column:1;grid-row:3;gap:3px}
  .header-actions>.quiet-button{font-size:10px;padding:8px 6px}
  .header-actions .primary-button{font-size:10px;padding:9px 9px}
  .header-actions .icon-button{width:27px;min-width:27px}
}
@media(max-width:360px){.topbar{padding-left:9px;padding-right:9px}.header-actions>.quiet-button{padding-left:4px;padding-right:4px;font-size:9px}.header-actions .primary-button{padding-left:7px;padding-right:7px;font-size:9px}.header-actions .icon-button{min-width:24px;width:24px}}
@media(max-width:700px) and (max-height:520px){
  .topbar{position:relative}
  .tool-rail{top:0}
}
@media(prefers-reduced-motion:reduce){button,#toast{transition:none}.spinner{animation-duration:2s}}
.piece-size-choices{border:0;padding:0;margin:16px 0 12px;min-width:0}
.piece-size-choices legend{font-size:12px;font-weight:600;margin-bottom:9px;color:var(--ink)}
.piece-size-choices>div{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
.piece-size-choices label{display:flex;align-items:center;justify-content:center;gap:6px;min-height:44px;padding:7px 5px;border:1px solid var(--line);border-radius:7px;background:var(--paper);color:var(--ink);font-size:12px;cursor:pointer}
.piece-size-choices input{accent-color:var(--accent);width:16px;height:16px;margin:0;flex-shrink:0}
.piece-size-choices label:has(input:checked){border-color:var(--accent);background:var(--panel)}
.piece-size-choices label:focus-within{outline:2px solid var(--accent);outline-offset:2px}
