/* Monet canvas. One dark sheet: header, notes on the left, the part in the middle, a 380 px panel of cards. */
:root {
  --bg-body: #121620; --bg-surface: #1a1f2e; --bg-elevated: #212738; --border: #2e3650; --border-strong: #3a4368;
  --text: #d4d4d4; --text-bright: #fff; --text-muted: #8a8fa3; --accent: #d4832f;
  --btn-bg: #242a3a; --btn-hover: #2e3548; --ok: #6fd58a; --err: #ff8888; --warn: #ffc14d;
}
* { box-sizing: border-box; }
html { color-scheme: dark; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg-body); color: var(--text); font: 13px/1.45 Montserrat, system-ui, sans-serif; font-variant-numeric: tabular-nums; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
button { background: var(--btn-bg); color: var(--text); border: 1px solid var(--border-strong); border-radius: 4px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
button:hover { background: var(--btn-hover); }
button.primary { border-color: var(--accent); color: var(--accent); }
button.primary:hover { background: var(--accent); color: #fff; }
button.on { border-color: var(--accent); color: var(--accent); }
button:disabled { opacity: .45; cursor: default; }
input, select, textarea { background: var(--bg-body); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 6px 8px; font-size: 12px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.muted { color: var(--text-muted); }
.ok { color: var(--ok); } .err { color: var(--err); } .warn { color: var(--warn); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }

/* the app */
.app { display: grid; grid-template: 44px 1fr / 230px 1fr 380px; height: 100vh; }
header { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 0 14px; background: var(--bg-surface); border-bottom: 1px solid var(--border); }
header b { color: var(--text-bright); font-weight: 600; letter-spacing: .16em; }
header .sp { flex: 1; }
header a.quiet { color: var(--text-muted); text-decoration: none; font-size: 12px; }
header a.quiet:hover { color: var(--accent); }
.start h2 { font-size: 16px; color: var(--text-bright); margin: 0 0 6px; font-weight: 600; }
aside, .panel { background: var(--bg-surface); overflow-y: auto; }
aside { border-right: 1px solid var(--border); padding: 10px 0; }
.panel { border-left: 1px solid var(--border); padding: 10px; }
.head { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin: 0 0 8px; }
aside section { margin-bottom: 14px; }
aside .fold { padding: 2px 14px 6px; }

/* folding: any panel on the side shuts on a click on its head, and stays as it was left */
.fold { display: flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; }
.fold .head { flex: 1; margin: 0; }
.fold .head h2 { text-transform: none; letter-spacing: 0; }
.fold .r { flex: none; }
.fold:hover .head, .fold:hover .chev { color: var(--text); }
.chev { width: 11px; color: var(--text-muted); font-size: 14px; line-height: 1; }
.chev::before { content: '▾'; }
.folded > .fold .chev::before { content: '▸'; }
.folded > .body { display: none; }
.card > .body { margin-top: 9px; }

/* three places to work, and what belongs to each */
.away { display: none !important; }
.rooms { display: inline-flex; margin-left: 10px; border: 1px solid var(--border-strong); border-radius: 5px; overflow: hidden; }
.rooms button { border: 0; border-radius: 0; padding: 6px 14px; background: transparent; color: var(--text-muted); font-weight: 500; }
.rooms button + button { border-left: 1px solid var(--border-strong); }
.rooms button.on { background: var(--accent); color: #fff; }
.tools { display: contents; }
/* beside the cursor while drawing: where it is, and the size of what is being drawn */
#sketchTip { position: absolute; left: 0; top: 0; background: rgba(16, 19, 27, .9); border: 1px solid var(--border-strong); color: var(--text-bright); border-radius: 4px; padding: 1px 7px; font-size: 12px; pointer-events: none; white-space: nowrap; z-index: 2; }

.item .grow { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.item .x { flex: none; padding: 0 5px; border: 0; background: none; color: var(--text-muted); }
.item .x:hover { color: var(--accent); background: none; }
.item input.off { flex: 0 0 52px; padding: 2px 5px; text-align: right; }
#sketchValue { width: 56px; text-align: right; }
#sketchTip.err { border-color: var(--err); color: var(--err); }

/* the names of the planes, each at a corner of its sheet */
#planeLabels span { position: absolute; left: 0; top: 0; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; pointer-events: none; white-space: nowrap; text-shadow: 0 0 4px #10131b, 0 0 2px #10131b; z-index: 1; }
.plane { cursor: pointer; }
.plane:hover b { color: var(--accent); }

/* the box of a box select: dashed when it takes what it touches, solid when only what is wholly inside */
#marquee { position: absolute; border: 1px solid var(--accent); background: rgba(212, 131, 47, .10); pointer-events: none; z-index: 2; }
#marquee.touching { border-style: dashed; }
.item { display: flex; align-items: center; gap: 8px; padding: 5px 14px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item:hover { background: var(--bg-elevated); }
.item.sel { background: var(--bg-elevated); color: var(--text-bright); box-shadow: inset 2px 0 var(--accent); }
.item small { color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-muted); }
.dot.green { background: var(--ok); } .dot.red { background: var(--err); } .dot.yellow { background: var(--warn); }

/* the view */
.view { position: relative; overflow: hidden; background: radial-gradient(ellipse at 50% 35%, #232a3d, #10131b); }
.view canvas { display: block; width: 100%; height: 100%; }
.bar { position: absolute; left: 10px; max-width: calc(100% - 20px); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; background: rgba(26, 31, 46, .88); border: 1px solid var(--border); border-radius: 6px; padding: 6px; }
.bar.top { top: 10px; } .bar.bottom { bottom: 10px; }
.bar input[type=range] { width: 110px; padding: 0; }
.bar .sep { width: 1px; align-self: stretch; background: var(--border); }
.hint { position: absolute; right: 12px; bottom: 10px; color: var(--text-muted); font-size: 11px; text-align: right; pointer-events: none; }
/* building: how far along (by how long it took last time), and under it how long the last build took */
.build { position: absolute; left: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; font-size: 12px; pointer-events: none; }
#compare:not([hidden]) ~ .build { bottom: 56px; }
.busy { min-width: 250px; max-width: 420px; color: var(--warn); background: rgba(26, 31, 46, .92); border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; }
.busy .track { height: 4px; margin-top: 6px; border-radius: 2px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.busy .track[hidden] { display: none; }
.busy .track i { display: block; height: 100%; width: 0; border-radius: 2px; background: var(--warn); transition: width .15s linear; }
.busy .track.unknown i { width: 30%; animation: sweep 1.2s ease-in-out infinite alternate; transition: none; }
.busy .track.over i { animation: throb .8s ease-in-out infinite alternate; }
@keyframes sweep { from { margin-left: 0; } to { margin-left: 70%; } }
@keyframes throb { from { opacity: 1; } to { opacity: .45; } }
.last { color: var(--text-muted); background: rgba(26, 31, 46, .7); border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; pointer-events: auto; cursor: default; }
.last b { color: var(--text); font-weight: 600; }
.last.failed b { color: var(--err, #e0707a); }

/* cards: label | value rows */
.card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; margin: 0 0 10px; }
.card h2 { font-size: 15px; color: var(--text-bright); margin: 0; font-weight: 600; }
.row { display: flex; gap: 8px; align-items: baseline; padding: 2px 0; }
.row > .k { flex: 0 0 42%; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; }
.row > .v { flex: 1; text-align: right; overflow-wrap: anywhere; }
.row .x { flex: none; padding: 0 6px; border: 0; background: none; color: var(--text-muted); }
.row .x:hover { color: var(--err); background: none; }
.line { display: flex; gap: 6px; align-items: center; margin-top: 8px; }
.line > input, .line > select { flex: 1; }
.pill { display: inline-block; border-radius: 10px; padding: 1px 9px; font-size: 11px; font-weight: 600; border: 1px solid currentColor; }
.doc { white-space: pre-wrap; margin: 0; color: var(--text); font: inherit; }
.check { padding: 5px 0; border-top: 1px solid var(--border); }
.check:first-of-type { border-top: 0; }
.check .why { color: var(--text-muted); font-size: 11.5px; }
.tag, .part { cursor: pointer; }
.part.sel, .tag.sel { box-shadow: inset 2px 0 var(--accent); padding-left: 8px; margin-left: -8px; }
.measured { margin-top: 8px; }
.big { font-size: 15px; color: var(--text-bright); }
/* the length of a measured line, written beside it in the view */
#dim { position: absolute; left: 0; top: 0; background: rgba(16, 19, 27, .88); border: 1px solid #5fd0ff; color: #bfeaff; border-radius: 4px; padding: 1px 7px; font-size: 12.5px; font-weight: 600; pointer-events: none; white-space: nowrap; z-index: 2; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }
details summary { cursor: pointer; color: var(--text-muted); }
pre.src { margin: 8px 0 0; max-height: 320px; overflow: auto; background: var(--bg-body); border: 1px solid var(--border); border-radius: 4px; padding: 8px; }

dialog { background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border-strong); border-radius: 8px; padding: 18px 20px; width: min(680px, 92vw); }
dialog::backdrop { background: rgba(0, 0, 0, .55); }
dialog h2 { margin: 0 0 4px; color: var(--text-bright); font-size: 16px; }
dialog h3 { margin: 16px 0 4px; font-size: 12px; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
dialog code, dialog pre { background: var(--bg-body); border: 1px solid var(--border); border-radius: 4px; }
dialog code { padding: 1px 5px; }
dialog pre { padding: 8px; overflow-x: auto; user-select: all; margin: 6px 0; }

/* the start page */
.start { max-width: 560px; margin: 0 auto; padding: 12vh 20px 40px; }
.start h1 { font-size: 30px; letter-spacing: .2em; color: var(--text-bright); margin: 0; font-weight: 600; }
.start .tag { color: var(--accent); margin: 4px 0 22px; cursor: default; }
.start p { line-height: 1.6; }
.start .card { padding: 16px; margin-top: 22px; }
.start input { width: 100%; font-size: 14px; padding: 9px 10px; }
.start button { width: 100%; margin-top: 12px; padding: 10px; font-size: 13px; }
.start footer { margin-top: 26px; text-align: center; font-size: 11.5px; color: var(--text-muted); }

@media (max-width: 1000px) { .app { grid-template: 44px 55vh auto / 1fr; height: auto; } aside { display: none; } .panel { border-left: 0; } }
