/* Design by Scale – Design a 3D print. Blueprint navy + teal, light and dark, big buttons for children. */
:root {
  --navy: #0b2545; --teal: #67e8d0; --acc: #0a7d8c; --acc-ink: #fff;
  --bg: #eef3f9; --panel: #ffffff; --panel2: #f4f7fb; --ink: #1d2330; --muted: #5a6275; --line: #d5dde8;
  --stage: #e9eef6; --ok: #2a8a4f; --bad: #c2392f; --warn: #a86a00;
  --disp: "Sora", system-ui, -apple-system, "Segoe UI", sans-serif; --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tap: 44px; color-scheme: light;
}
:root[data-theme="dark"] {
  --acc: #67e8d0; --acc-ink: #06223a; --bg: #081426; --panel: #0f1e36; --panel2: #13264a; --ink: #eef4ff; --muted: #a9bedf; --line: #26395a;
  --stage: #0b1a30; --ok: #4fd27b; --bad: #ff6b61; --warn: #ffc15e; color-scheme: dark;
}
* { box-sizing: border-box }
[hidden] { display: none !important }
html, body { height: 100%; margin: 0; overflow: hidden }
body { background: var(--bg); color: var(--ink); font: 16px/1.45 var(--body); display: flex; flex-direction: column; height: 100dvh; overscroll-behavior: none }
.skip { position: absolute; left: -9999px } .skip:focus { left: 12px; top: 12px; z-index: 90; background: #fff; color: #000; padding: 8px 12px; border-radius: 8px }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0) }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px }
button, input, select { font: inherit; color: inherit }
button { cursor: pointer }
.btn, .ib { min-height: var(--tap); border-radius: 12px; border: 1px solid var(--line); background: var(--panel); padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; font-weight: 600 }
.ib { min-width: var(--tap); padding: 0; font-size: 20px }
.btn:hover, .ib:hover { border-color: var(--acc) }
.btn.acc { background: var(--acc); color: var(--acc-ink); border-color: var(--acc) }
.btn.big { min-height: 56px; width: 100%; font-size: 18px; border-radius: 16px }
.btn.danger { color: var(--bad) }
.btn:disabled, .ib:disabled { opacity: .45; cursor: default }
input:not([type=checkbox]), select { min-height: var(--tap); border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: 0 10px; max-width: 100% }
select { width: 100%; font-weight: 600 }

/* top bar */
.bar { flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 10px; background: var(--navy); color: #eef4ff; min-height: 58px }
.bar .btn, .bar .ib { background: rgba(255,255,255,.08); border-color: rgba(207,227,255,.25); color: #eef4ff }
.bar .btn.acc { background: var(--teal); color: #06223a; border-color: var(--teal) }
.brand { font: 700 1.1rem var(--disp); color: #eef4ff; text-decoration: none; white-space: nowrap; min-height: var(--tap); display: inline-flex; align-items: center }
.brand .acc { color: var(--teal) }
.ttl { margin: 0 0 0 6px; font: 700 1.05rem var(--disp); white-space: nowrap }
.grow { flex: 1 }
.menuwrap { position: relative }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 34px rgba(0,0,0,.25); padding: 6px; width: 290px; max-width: calc(100vw - 20px); max-height: 75vh; overflow: auto }
.menu button { display: flex; width: 100%; min-height: var(--tap); align-items: center; gap: 10px; border: 0; background: none; text-align: left; padding: 0 10px; border-radius: 10px }
.menu button:hover, .menu button:focus-visible { background: var(--panel2) }
.menu .mh { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 10px 2px }

/* 3D view */
.main { flex: 1; display: flex; min-height: 0 }
.stage { flex: 1; position: relative; min-width: 0; background: var(--stage); overflow: hidden }
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none }
#cv:focus { outline: none } #cv:focus-visible { outline: 3px solid var(--teal); outline-offset: -3px }
.no3d { position: absolute; inset: 60px 16px; display: grid; place-items: center; text-align: center; color: var(--muted) }
.views { position: absolute; left: 10px; top: 10px; display: flex; gap: 4px; z-index: 3 }
.vb { min-height: var(--tap); min-width: 56px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); font-weight: 700; padding: 0 10px; box-shadow: 0 2px 8px rgba(0,0,0,.1) }
.vb[aria-pressed="true"] { background: var(--acc); color: var(--acc-ink); border-color: var(--acc) }
.pill { position: absolute; right: 10px; top: 10px; z-index: 3; min-height: var(--tap); border-radius: 999px; border: 1px solid var(--line); background: var(--panel); padding: 0 14px; font-weight: 700; box-shadow: 0 2px 8px rgba(0,0,0,.1); max-width: calc(100% - 230px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.pill.bad { color: var(--bad) } .pill.ok { color: var(--ok) }
.zoom { position: absolute; right: 10px; bottom: 10px; z-index: 3; display: flex; gap: 4px }
.zoom .ib { background: var(--panel); box-shadow: 0 2px 8px rgba(0,0,0,.1); font-size: 24px }
.plateinfo { position: absolute; left: 10px; bottom: 10px; z-index: 3; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 13px; color: var(--muted); max-width: calc(100% - 130px) }

/* side panel */
.side { flex: none; width: 380px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain; padding: 4px 14px 24px }
.box { padding: 12px 0; border-bottom: 1px solid var(--line) }
.box:last-child { border-bottom: 0 }
.box h2 { font: 700 1.05rem var(--disp); margin: 0 0 10px }
.shapes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px }
.shapes button { min-height: 72px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--panel2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 700; font-size: 14px }
.shapes button .ic { font-size: 28px; line-height: 1 }
.shapes button:hover { border-color: var(--acc) }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px }
.chips:empty { display: none }
.chips button { min-height: var(--tap); border-radius: 999px; border: 1px solid var(--line); background: var(--panel); padding: 0 12px; font-size: 14px; display: inline-flex; gap: 6px; align-items: center }
.chips button[aria-pressed="true"] { border-color: var(--acc); background: var(--acc); color: var(--acc-ink) }
.chips .dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25) }
.sel h2 { display: flex; align-items: center; gap: 8px }
.sel h2 .grow { flex: 1 }
.size { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 8px; margin-bottom: 10px }
.size .lbl { font-weight: 700 } .size .lbl small { display: block; font-weight: 400; color: var(--muted); font-size: 13px }
.size .num { display: flex; align-items: center; gap: 4px; justify-self: end }
.size .num input { width: 88px; font-size: 22px; font-weight: 700; text-align: right }
.size .pm { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px }
.size .pm button { min-height: 48px; font-size: 16px }
.colors { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px }
.colors button { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--line); padding: 0 }
.colors button[aria-pressed="true"] { outline: 3px solid var(--acc); outline-offset: 2px }
.acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px }
.acts .btn { white-space: normal; text-align: center; min-height: 48px; line-height: 1.15 }
.fld { display: grid; gap: 4px; font-weight: 600; margin: 10px 0 }
.fld input { width: 100%; font-weight: 400 }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px }
.row2 .btn { white-space: normal; line-height: 1.15 }
.small { color: var(--muted); font-size: .9rem }
.other { display: grid; gap: 6px; margin-top: 8px }
.other label { display: flex; align-items: center; gap: 8px; font-weight: 600 }
.other input { width: 100px }
.verdict { font-weight: 700; margin: 0 0 8px }
.verdict.ok { color: var(--ok) } .verdict.bad { color: var(--bad) }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px }
.checks li { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); font-size: 15px }
.checks li.bad { border-color: var(--bad) } .checks li.warn { border-color: var(--warn) }
.checks li .i { flex: none } .checks li span.t { flex: 1 }
.checks li .btn { min-height: var(--tap); padding: 0 10px; font-size: 14px }
.ver { opacity: .8 }

/* dialogs */
dialog { border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--ink); padding: 18px; width: min(560px, calc(100vw - 20px)); max-height: calc(100dvh - 30px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.35) }
dialog::backdrop { background: rgba(5,15,30,.5) }
dialog h2 { font: 700 1.2rem var(--disp); margin: 0 0 10px }
dialog h3 { font: 700 1rem var(--disp); margin: 16px 0 6px }
.steps { margin: 0; padding: 0 0 0 4px; list-style: none; display: grid; gap: 8px }
.steps li { padding: 8px 10px; background: var(--panel2); border-radius: 12px }
ol.steps { counter-reset: s } #sendDlg ol.steps li { counter-increment: s } #sendDlg ol.steps li::before { content: counter(s) ". "; font-weight: 700 }
.dlgbtns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px }
.dlrow { display: flex; flex-wrap: wrap; gap: 8px }
.dlrow .btn { flex: 1 1 200px }
.linkbtn { border: 0; background: none; color: var(--acc); text-decoration: underline; padding: 0 4px; min-height: var(--tap); font-weight: 600 }
.warnbox { border: 1px solid var(--bad); border-radius: 12px; padding: 8px 10px; color: var(--bad); font-weight: 600 }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 99; background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 12px; max-width: calc(100vw - 24px); box-shadow: 0 8px 24px rgba(0,0,0,.3); opacity: 0; pointer-events: none; transition: opacity .2s }
.toast.on { opacity: 1 }

/* embed (Family Ecosphere) */
body.embed .brand, body.embed #themeBtn { display: none }
body.readonly #addBox .shapes, body.readonly #selBox .acts, body.readonly #selBox .size .pm, body.readonly #selBox .colors { display: none }

/* phone: the 3D view on top, the buttons underneath */
@media (max-width: 760px) {
  .long { display: none }
  .wide-only { display: none !important }
  .main { flex-direction: column }
  .stage { flex: 0 0 44% }
  .side { width: auto; flex: 1; border-left: 0; border-top: 1px solid var(--line) }
  .pill { max-width: calc(100% - 210px); padding: 0 10px; font-size: 14px }
  .vb { min-width: 48px }
}
/* v1.6 DBS_ACCOUNTS: room for the 🔑 / ☁️ account button on narrow phones – the title keeps its 🖨️ only */
@media (max-width: 430px) { .ttl .t3d { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap } }
