/* Designer app */
body.app { min-height: 100vh; }
.wrap.wide { width: calc(100% - 32px); max-width: none; }
.units { display: inline-flex; border-radius: 999px; box-shadow: inset 0 0 0 1.5px var(--line-2); padding: 3px; }
.units button { border: 0; background: none; font: 600 13px/1 var(--mono); padding: 7px 11px; border-radius: 999px; cursor: pointer; color: var(--ink-2); }
.units button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.studio { display: grid; grid-template-columns: 380px 1fr; gap: 0; min-height: calc(100vh - 64px); }
.panel { border-right: 1px solid var(--line); background: color-mix(in srgb, var(--card) 80%, transparent); overflow-y: auto;
  max-height: calc(100vh - 64px); position: sticky; top: 64px; padding: 10px 0 40px; }
.stage { display: grid; grid-template-rows: minmax(340px, 1.1fr) minmax(300px, 1fr); gap: 16px; padding: 16px; min-width: 0; }
@media (min-width: 1400px) { .stage { grid-template-rows: none; grid-template-columns: 1.15fr 1fr; align-items: stretch; height: calc(100vh - 64px); } }
@media (max-width: 900px) {
  .studio { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; border-right: 0; border-top: 1px solid var(--line); order: 2; }
  .stage { order: 1; grid-template-rows: auto 320px; padding: 12px; }
}

.stepbox { border-bottom: 1px dashed var(--line-2); padding: 0; }
[hidden] { display: none !important; }
.step-h { display: flex; gap: 12px; align-items: center; width: 100%; border: 0; background: none; text-align: left; padding: 16px 20px; cursor: pointer; color: inherit; font: inherit; }
.step-h .n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--ink); color: var(--paper); font: 600 13px/1 var(--mono); }
.step-h b { display: block; font-size: 16px; }
.step-h small { color: var(--ink-3); font-size: 13px; }
.stepbox:not(.open) .step-b { display: none; }
.step-b { padding: 0 20px 20px; display: grid; gap: 12px; }

label { display: grid; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
label small { font-weight: 400; color: var(--ink-3); }
input, select { font: 500 15px/1.2 var(--body); color: var(--ink); background: #fff; border: 1.5px solid var(--line-2); border-radius: 10px; padding: 10px 11px; width: 100%; min-width: 0; }
input:focus, select:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(214,69,42,.15); }
input.bad { border-color: var(--red); background: #fff6f3; }
#dw, #dd, #dh, #ih, #sw, #sd { font-family: var(--mono); }
.fields { display: grid; gap: 10px; }
.fields.three { grid-template-columns: repeat(3, 1fr); }
.fields.two { grid-template-columns: 1fr 1fr; }
.row { grid-template-columns: 1fr 1.25fr; align-items: center; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline small { white-space: nowrap; }
.hint { margin: 0; font-size: 13px; color: var(--ink-3); }
.hint.center { text-align: center; }
.alert { background: #fff3e8; border: 1px solid #f0c9a8; border-radius: 10px; padding: 12px 14px; font-size: 14px; color: #6b3a14; display: grid; gap: 10px; }
.alert .btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.outsize { font-size: 12.5px; color: var(--ink-2); background: var(--paper); border-radius: 8px; padding: 8px 10px; }

.tpls { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tpl { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 6px 6px 7px; cursor: pointer; display: grid; gap: 4px; font: 600 11px/1.15 var(--body); color: var(--ink-2); text-align: center; }
.tpl:hover { border-color: var(--ink); }
.tpl.on { border-color: var(--red); box-shadow: 0 0 0 3px rgba(214,69,42,.14); }
.tpl svg { width: 100%; height: auto; }

.sel { background: var(--paper); border-radius: 12px; padding: 12px; display: grid; gap: 10px; }
.seltitle { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 8px; }
.toolrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.tool { display: grid; justify-items: center; gap: 4px; border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 4px; cursor: pointer; font: 600 11.5px/1.1 var(--body); color: var(--ink); }
.tool:hover { border-color: var(--ink); }
.tool svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool svg path { stroke: var(--red); }
.tool.danger { color: var(--red-2); }
.tool[disabled] { opacity: .35; cursor: not-allowed; }
.undo { display: flex; gap: 14px; align-items: center; font-size: 13px; }
.undo .mono { margin-left: auto; color: var(--ink-3); }
.link { border: 0; background: none; color: var(--ink-2); font: 600 13px var(--body); cursor: pointer; padding: 0; }
.link:hover { color: var(--red); }
.link[disabled] { opacity: .35; cursor: default; }

.colors { display: flex; flex-wrap: wrap; gap: 8px; }
.color { width: 38px; height: 38px; border-radius: 10px; border: 0; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); position: relative; }
.color[aria-checked="true"]::after { content: ""; position: absolute; inset: -4px; border-radius: 13px; border: 2px solid var(--red); }
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line-2); border-radius: 10px; overflow: hidden; background: #fff; width: max-content; }
.qty button { border: 0; background: none; font: 600 18px/1 var(--body); width: 38px; height: 40px; cursor: pointer; color: var(--ink); }
.qty input { border: 0; border-radius: 0; width: 46px; text-align: center; padding: 8px 0; font-family: var(--mono); }

.pricebox { display: grid; gap: 10px; }
.est { display: flex; justify-content: space-between; align-items: baseline; }
.est span { font-size: 13px; color: var(--ink-3); }
.est b { font-size: 30px; font-weight: 600; letter-spacing: -.03em; }
.est.final span { color: var(--green); font-weight: 600; }
.btn.full { width: 100%; }
#order { display: grid; gap: 12px; }
#ship { display: grid; gap: 6px; }
.shipopt { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; font-weight: 500; color: var(--ink); background: #fff; }
.shipopt:has(input:checked) { border-color: var(--ink); }
.shipopt input { width: auto; }
.shipopt small { display: block; color: var(--ink-3); font-weight: 400; }
.lines { display: grid; gap: 4px; font-size: 14px; }
.lines div { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-2); }
.lines .tot { border-top: 1px solid var(--line-2); padding-top: 8px; margin-top: 4px; font-weight: 700; font-size: 17px; color: var(--ink); }
.check { grid-template-columns: auto 1fr; align-items: start; gap: 10px; font-weight: 500; }
.check input { width: 18px; height: 18px; margin-top: 1px; }
.err { color: var(--red-2); font-size: 14px; margin: 0; min-height: 1em; }

.board { background: var(--card); border: 1px solid var(--line); border-radius: 16px; display: grid; grid-template-rows: auto 1fr; min-height: 0; overflow: hidden; box-shadow: var(--shadow); }
.board-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.plan-wrap { position: relative; padding: 18px; min-height: 0; display: grid; place-items: center;
  background-image: linear-gradient(rgba(28,40,56,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(28,40,56,.05) 1px, transparent 1px); background-size: 12px 12px; }
#plan { width: 100%; height: 100%; max-height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; overflow: visible; }
#plan .cell { fill: #fff; stroke: none; cursor: pointer; transition: fill .15s; }
#plan .cell:hover { fill: #fff4ef; }
#plan .cell.on { fill: #ffe6dd; }
#plan .rim { fill: #c9bfae; }
#plan .lbl { font-family: var(--mono); font-weight: 600; fill: var(--ink-2); pointer-events: none; text-anchor: middle; dominant-baseline: middle; }
#plan .hit { stroke: transparent; cursor: col-resize; }
#plan .hit.h { cursor: row-resize; }
#plan .grip { fill: var(--red); opacity: 0; transition: opacity .15s; pointer-events: none; }
#plan g.div:hover .grip, #plan g.div.drag .grip { opacity: 1; }
#plan .dim { font-family: var(--mono); font-weight: 600; fill: var(--red); }
#plan .dimline { stroke: var(--red); stroke-width: 1; fill: none; }

.view3d { position: relative; min-height: 0; background: radial-gradient(ellipse at 50% 35%, #fbf8f2 0%, #ebe3d4 100%); }
.view3d canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.badge { position: absolute; left: 12px; bottom: 12px; background: rgba(28,40,56,.85); color: var(--paper); font-size: 12px; padding: 6px 9px; border-radius: 7px; }
.badge:empty { display: none; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 12px; font-size: 14px; opacity: 0; transition: all .25s; pointer-events: none; z-index: 50; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 900px) { .tpls { grid-template-columns: repeat(4, 1fr); } }

.lblfield { margin-top: 10px; }
.check small { font-weight: 400; color: var(--ink-3); }
#plan .tag { font-family: var(--display); font-style: italic; font-weight: 500; fill: var(--red); pointer-events: none; text-anchor: middle; dominant-baseline: middle; }
#plan .lidmark { fill: url(#hatch); pointer-events: none; }

/* lid checkbox: text + price on one line */
.check { grid-template-columns: auto 1fr; }
.check small { margin-left: 4px; }
.logo svg { flex: none; }
#share { white-space: nowrap; }

/* Phones: plan pinned on top while you edit; steps scroll beneath; 3D after the steps */
@media (max-width: 900px) {
  .studio { display: flex; flex-direction: column; }
  .stage { display: contents; }
  .stage > .board:first-child { order: 1; position: sticky; top: 64px; z-index: 5; height: 42vh; min-height: 260px; margin: 10px 12px 0; }
  .panel { order: 2; }
  .stage > .board.three { order: 3; height: 340px; margin: 12px; }
  .board-h { padding: 8px 12px; }
  .plan-wrap { padding: 8px; }
  .units button { padding: 6px 9px; }
  .site-head .wrap.wide { gap: 10px; }
  .logo span { font-size: 17px; }
}
@media (max-width: 420px) { #share { display: none; } }
.plan-wrap { position: relative; }
#plan { position: absolute; inset: 14px; width: calc(100% - 28px); height: calc(100% - 28px); }
@media (max-width: 900px) { #plan { inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); } }

/* Finish, colors, label fonts */
@font-face { font-family: "dmd-sans"; src: url("/assets/fonts/dmd-sans.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "dmd-rounded"; src: url("/assets/fonts/dmd-rounded.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "dmd-slab"; src: url("/assets/fonts/dmd-slab.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "dmd-script"; src: url("/assets/fonts/dmd-script.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "dmd-stencil"; src: url("/assets/fonts/dmd-stencil.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "dmd-type"; src: url("/assets/fonts/dmd-type.ttf") format("truetype"); font-display: swap; }

.finish { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.finish button { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 9px 6px; cursor: pointer; font: 600 13px/1.1 var(--body); color: var(--ink); }
.finish button[aria-checked="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.finish button small { display: block; font-weight: 400; color: var(--ink-3); font-size: 11px; margin-top: 3px; }
.color.tl { background-image: linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%), linear-gradient(45deg, #ddd 25%, #fff 25%, #fff 75%, #ddd 75%) !important; background-size: 10px 10px !important; background-position: 0 0, 5px 5px !important; overflow: hidden; }
.color.tl i { position: absolute; inset: 0; border-radius: 10px; opacity: .62; }
.color .so { position: absolute; right: -3px; top: -3px; width: 11px; height: 11px; border-radius: 50%; background: #f0b429; border: 2px solid #fff; }
.fontrow { display: grid; gap: 6px; margin-top: 8px; }
.fontpick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fontpick button { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 4px 6px; cursor: pointer; color: var(--ink); display: grid; gap: 2px; justify-items: center; }
.fontpick button b { font-size: 19px; line-height: 1.1; font-weight: 400; white-space: nowrap; overflow: hidden; max-width: 100%; }
.fontpick button span { font: 500 10.5px/1 var(--body); color: var(--ink-3); }
.fontpick button[aria-checked="true"] { border-color: var(--red); box-shadow: 0 0 0 3px rgba(214,69,42,.14); }

/* Plastic family + finishes + finish-specific swatches */
.family { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-radius: 12px; box-shadow: inset 0 0 0 1.5px var(--line-2); padding: 3px; }
.family button { border: 0; background: none; border-radius: 9px; padding: 9px; cursor: pointer; font: 700 14px/1 var(--body); color: var(--ink-2); }
.family button[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.finish { grid-template-columns: repeat(3, 1fr); }
.finish button { padding: 8px 4px; }
.color i { position: absolute; inset: 0; border-radius: 10px; }
.color i.chk { background-image: linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%), linear-gradient(45deg, #ddd 25%, #fff 25%, #fff 75%, #ddd 75%); background-size: 10px 10px; background-position: 0 0, 5px 5px; overflow: hidden; }
.color i.chk b { position: absolute; inset: 0; opacity: .62; }
.color { overflow: visible; }
.colors { gap: 9px; }

/* ?render=1: full-screen 3D only (used to make the example images on the idea pages) */
body.render .site-head, body.render .panel, body.render .stage > .board:first-child, body.render .board-h, body.render .badge, body.render .toast { display: none !important; }
body.render .studio { display: block; min-height: 0; }
body.render .stage { display: block; padding: 0; height: 100vh; }
body.render .board.three { border: 0; border-radius: 0; box-shadow: none; height: 100vh; display: block; }
body.render .view3d { height: 100vh; background: #f4efe6; }

.presetnote { display: grid; gap: 6px; background: var(--paper); border-radius: 12px; padding: 12px 14px; font-size: 14px; color: var(--ink-2); }
.presetnote b { color: var(--ink); font-size: 15px; }
body.preset #toobig, body.preset #outsize { display: none !important; }

#skindnote { margin-top: -4px; }

#linerbox { display: grid; gap: 8px; }
#slinerwrap { margin-top: -4px; }

/* Drag-and-drop pieces above the plan */
.board.has-palette { grid-template-rows: auto auto 1fr; }
.palette { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); background: #fff; }
.palette .pl-h { flex: none; font: 700 10.5px/1 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 0 2px 0 6px; }
.palette .pl-h:first-child { margin-left: 0; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 5px; border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 9px 4px 6px;
  font: 600 12px/1 var(--body); color: var(--ink); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; white-space: nowrap; }
.chip:hover { border-color: var(--ink); }
.chip i { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--red); display: grid; place-items: center; font: 700 9px/1 var(--body); font-style: normal; color: var(--red); }
.chip.size i { border-style: dashed; }
.chip-ghost { position: fixed; z-index: 90; pointer-events: none; transform: translate(-50%, -130%); box-shadow: var(--shadow); border-color: var(--ink); cursor: grabbing; }
#plan .cell.drop { fill: #ffd9cc; stroke: var(--red); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.plan-text { position: absolute; z-index: 5; transform: translate(-50%, -50%); width: min(210px, 70%); padding: 8px 10px; border: 2px solid var(--red); border-radius: 9px;
  background: #fff; font: 600 15px/1.2 var(--body); color: var(--ink); text-align: center; box-shadow: var(--shadow); outline: none; }
body.render .palette { display: none !important; }

#plan .del { cursor: pointer; }
#plan .del circle { fill: var(--red); stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
#plan .del path { stroke: #fff; stroke-linecap: round; fill: none; }
#plan .del:hover circle { fill: var(--red-2); }

.plan-turn { position: absolute; z-index: 5; transform: translate(-50%, 0); border: 1.5px solid var(--ink); background: var(--ink); color: #fff; border-radius: 999px; padding: 5px 12px; font: 600 12px/1 var(--body); cursor: pointer; white-space: nowrap; }

#plan .holdmark { fill: url(#hatch); stroke: var(--red); stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: none; }
#plan .holdmark.bad { fill: #ffb9a8; stroke-dasharray: none; stroke-width: 2; }

/* 3D view buttons, live-shape warning, plan buttons */
.viewbar { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; z-index: 2; }
.vbtn { border: 1.5px solid var(--line-2); background: rgba(251,248,242,.92); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: 600 12px/1 var(--body); cursor: pointer; }
.vbtn[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.vbtn.ar { background: var(--red); color: #fff; border-color: var(--red); }
.shapewarn { position: absolute; left: 12px; right: 12px; top: 48px; z-index: 2; background: #fff4ef; border: 1.5px solid var(--red); color: var(--red-2); border-radius: 10px; padding: 8px 12px; font: 600 12.5px/1.35 var(--body); }
.planbtns { display: inline-flex; gap: 6px; margin-left: auto; margin-right: 12px; }
.pbtn { border: 1.5px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; padding: 5px 10px; font: 600 11.5px/1 var(--body); cursor: pointer; white-space: nowrap; }
.pbtn:hover { border-color: var(--ink); }
#plan .cell.nodrop { fill: #ffe1e1; stroke: #b3261e; stroke-width: 1.5; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.chip-ghost.no { border-color: #b3261e; color: #b3261e; }
.chip-ghost.no::after { content: " · " attr(data-why); font-weight: 700; }
@media (max-width: 900px) { .board-h .hint { display: none; } .planbtns { margin-right: 0; } }
@media (max-width: 900px) {
  .palette { flex-wrap: nowrap; overflow-x: auto; padding: 6px 10px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .palette::-webkit-scrollbar { display: none; }
  .board.has-palette .board-h .eyebrow { display: none; }
  .planbtns { margin-left: 0; }
  .stage > .board:first-child { height: 48vh; min-height: 300px; }
  .viewbar { left: 10px; justify-content: flex-start; }
}

/* Accounts */
.acct { border: 0; border-radius: 18px; padding: 28px 26px 24px; width: min(460px, calc(100vw - 28px)); max-height: calc(100vh - 40px); overflow-y: auto; background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(28,40,56,.55); }
.acct::backdrop { background: rgba(28,40,56,.45); }
.acct h2 { font: 600 24px/1.15 var(--display); margin: 0 0 8px; }
.acct h3 { font: 700 12px/1 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin: 22px 0 8px; }
.acct-x { position: absolute; top: 10px; right: 12px; border: 0; background: none; font-size: 26px; line-height: 1; color: var(--ink-2); cursor: pointer; padding: 6px; }
.acct-p { color: var(--ink-2); font-size: 14.5px; line-height: 1.45; margin: 0 0 14px; }
.acct form { display: grid; gap: 10px; }
.acct label { display: grid; gap: 6px; font: 600 13px/1.2 var(--body); }
.acct label small { font-weight: 400; color: var(--ink-3); }
.acct input { border: 1.5px solid var(--line-2); border-radius: 10px; padding: 12px 13px; font: 500 16px/1.2 var(--body); background: #fff; color: var(--ink); }
.acct input:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.acct .btn.full { width: 100%; }
.acct-err { color: var(--red-2); font-size: 13.5px; margin: 0; min-height: 1em; }
.acct-ok { background: #e8f3ec; color: var(--green); border-radius: 9px; padding: 8px 12px; font: 600 13.5px/1.3 var(--body); margin: 0 0 12px; }
.acct-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.acct-list li { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: #fff; }
.acct-list li div { flex: 1; min-width: 0; display: grid; gap: 3px; }
.acct-list li b { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-list li span { font-size: 12px; color: var(--ink-3); }
.acct .link { background: none; border: 0; color: var(--ink-2); text-decoration: underline; cursor: pointer; font: 500 13px/1 var(--body); padding: 4px; }
.acct .link.danger { color: var(--red-2); }
.savecard { margin: 14px 20px 0; border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 12px 14px; display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); line-height: 1.4; }
.savecard b { color: var(--ink); font-size: 14px; }
.savecard .btn { justify-self: start; }
@media (max-width: 720px) { #share { display: none; } .nav { gap: 8px; } }
body.render .savecard { display: none !important; }

/* Two-colour text */
label.check { display: flex; align-items: center; gap: 8px; font: 600 13.5px/1.2 var(--body); margin: 10px 0 6px; cursor: pointer; }
label.check input { width: 18px; height: 18px; accent-color: var(--red); }
.tcolors { display: flex; flex-wrap: wrap; gap: 9px; margin: 6px 0 8px; }
.tcolors .color { width: 30px; height: 30px; border-radius: 8px; }
