:root {
  --bg: #0b0b0e; --panel: #15151a; --line: #2a2a33; --text: #e4e2dd; --muted: #8d8a85;
  --accent: #ee1b4e; --ok: #8be0a4; --warn: #ff8a6b;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 12.5px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; }
body { --lw: 290px; --rw: 340px; display: grid; grid-template-columns: var(--lw) minmax(0, 1fr) var(--rw); height: 100vh; }
#stage { position: relative; min-width: 0; min-height: 0; container-type: inline-size; }
canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; }
canvas:active { cursor: grabbing; }
#hint { position: absolute; left: 12px; bottom: 10px; color: var(--muted); font-size: 12px;
  pointer-events: none; text-shadow: 0 1px 2px #000; }
#stage.device #hint { color: #6f6b66; text-shadow: none; }
#tabs { position: absolute; top: 12px; left: 12px; width: 200px; }
#lock { position: absolute; top: 12px; left: 220px; width: 32px; height: 30px; padding: 0; display: grid; place-items: center;
  background: #1d1d24; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
#lock svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#lock:hover { color: var(--text); }
#lock.on { background: var(--accent); border-color: var(--accent); color: #fff; }
#lock .shut, #lock.on .open { display: none; }
#lock.on .shut { display: inline; }
#shapeTag { position: absolute; top: 14px; right: 14px; text-align: right; pointer-events: none;
  text-shadow: 0 1px 3px #000; }
#shapeTag b { display: block; font-size: 16px; font-weight: 600; }
#shapeTag span { color: #cfccc6; font-size: 12px; }
#stage.device #shapeTag { text-shadow: none; color: #2a2826; }
#stage.device #shapeTag span { color: #6f6b66; }
@container (max-width: 520px) { #shapeTag { top: 50px; right: auto; left: 14px; text-align: left; } }   /* below the tabs */
aside { background: var(--panel); overflow-y: auto; padding: 12px 14px 14px; min-height: 0; }
#left { border-right: 1px solid var(--line); }
#right { border-left: 1px solid var(--line); }
/* Minimize buttons: a chevron in the panel, or the whole rail once it is minimized */
aside { position: relative; }
.fold { position: absolute; top: 10px; width: 26px; height: 26px; padding: 0; display: grid; place-items: center;
  background: none; color: var(--muted); border: 1px solid transparent; border-radius: 6px; font: inherit; cursor: pointer; }
.fold svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.fold span { display: none; }
.fold:hover { color: var(--text); background: #1d1d24; border-color: var(--line); }
#left .fold { right: 10px; }
#right .fold { left: 10px; }
#rtabs { margin-left: 28px; }
aside.min { padding: 0; overflow: hidden; }
aside.min > :not(.fold) { display: none; }
aside.min .fold { position: static; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 14px 0; border: 0; border-radius: 0; }
aside.min .fold svg { transform: rotate(180deg); flex: none; }
aside.min .fold span { display: block; writing-mode: vertical-rl; }
#left.min .fold span { transform: rotate(180deg); }
.brand { display: flex; align-items: baseline; gap: 6px; margin-bottom: 2px; }
.brand b { font-size: 14px; }
.brand span { color: var(--muted); font-size: 12px; }
h2 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  margin: 12px 0 5px; font-weight: 600; }
label { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
select, input[type=file], input[type=number] { width: 100%; background: #1d1d24; color: var(--text);
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font: inherit; }
input[type=number] { width: 76px; flex: none; font-variant-numeric: tabular-nums; }
input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); }
input[type=color] { width: 34px; height: 24px; padding: 0 2px; border: 1px solid var(--line); border-radius: 6px; background: #1d1d24; flex: none; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #1d1d24; }
.seg button { flex: 1; background: #1d1d24; color: var(--muted); border: 0; padding: 5px 3px;
  font: inherit; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--accent); color: #fff; }
.seg button:disabled { opacity: .35; cursor: not-allowed; }
.row { justify-content: space-between; }
.row span { color: var(--muted); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
button.plain { background: #1d1d24; color: var(--text); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 10px; font: inherit; cursor: pointer; margin-top: 6px; }
.btns { display: flex; gap: 6px; }
.btns button.plain { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.chips button { background: #1d1d24; color: var(--text); border: 1px solid var(--line); border-radius: 99px;
  padding: 2px 9px; font: inherit; font-size: 11.5px; cursor: pointer; }
.chips button.on { border-color: var(--accent); color: #fff; background: #3a1420; }
svg.box { width: 100%; height: auto; background: #101014; border: 1px solid var(--line); border-radius: 6px; display: block; }
#pad { touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
#layout { height: min(46vh, 420px); }
.shape { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 6px 0 2px; }
#shapeName { font-size: 13.5px; font-weight: 600; }
#shapeFaces { color: var(--muted); font-size: 11.5px; text-align: right; }
.tabbar { margin-bottom: 10px; }
.pane { display: none; }
.pane.on { display: block; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 12px; }
td, th { padding: 2px 0 2px 6px; text-align: right; }
td:first-child, th:first-child { text-align: left; color: var(--muted); font-weight: normal; padding-left: 0; }
th { color: var(--muted); font-weight: normal; }
.bad { color: var(--warn); }
.good { color: var(--ok); }
.err { color: var(--warn); font-size: 11.5px; margin: 3px 0 0; }
.err:empty { display: none; }
.val { min-width: 34px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.note { color: var(--muted); font-size: 11px; margin: 4px 0 0; }
[hidden] { display: none !important; }
@media (max-height: 800px) and (min-width: 901px) {
  #pad { height: 140px; }
  #left h2 { margin-top: 9px; }
  #buildNote { display: none; }
}
@media (max-width: 1180px) { body { --lw: 260px; --rw: 300px; } }
body:has(#left.min) { --lw: 34px; }
body:has(#right.min) { --rw: 34px; }
@media (max-width: 900px) {
  body { display: flex; flex-direction: column; height: auto; }
  #stage { height: 60vh; flex: none; order: -1; }
  aside { overflow: visible; border: 0 !important; border-top: 1px solid var(--line) !important; }
  #layout { height: auto; }
  aside.min .fold { flex-direction: row; justify-content: center; padding: 8px 0; }
  aside.min .fold svg { transform: rotate(-90deg); }
  #right.min .fold svg { transform: rotate(90deg); }
  #left.min .fold span, #right.min .fold span { writing-mode: initial; transform: none; }
}
