:root {
  --paper: #f4f1ea; --surface: #fbf9f5; --ink: #161412; --dim: #5e5952; --faint: #8b857b; --line: #dfd9ce; --line2: #cbc4b7;
  --accent: #8c4f2c; --danger: #a63a26; --r: 2px; --bar: 56px; --lib: 272px; --props: 288px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--paper); color: var(--ink); font: 400 14px/1.45 "Plus Jakarta Sans", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.only-mobile { display: none !important; }

/* top bar */
.bar { position: fixed; inset: 0 0 auto 0; height: var(--bar); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 0 12px; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 20; }
.bar-l, .bar-r { display: flex; align-items: center; gap: 2px; min-width: 0; }
.bar-r { justify-content: flex-end; }
.brand { display: grid; place-items: center; width: 40px; height: 40px; color: var(--ink); }
.mark { width: 28px; height: 28px; }
.mark path { fill: none; stroke: currentColor; stroke-width: 7; stroke-linejoin: miter; stroke-linecap: butt; }
.pname { width: min(260px, 100%); min-width: 0; height: 34px; padding: 0 8px; background: transparent; border: 1px solid transparent; }
.pname:hover { border-color: var(--line); }
.pname:focus { border-color: var(--ink); outline: none; background: #fff; }
.ib { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; background: none; border: 0; border-radius: var(--r); color: var(--dim); transition: background .15s, color .15s; }
.ib:hover:not(:disabled) { background: var(--paper); color: var(--ink); }
.ib:disabled { opacity: .35; cursor: default; }
.ib.on { background: var(--ink); color: var(--paper); }
.sep { width: 1px; height: 20px; margin: 0 6px; background: var(--line); }
.save { height: 36px; margin-left: 6px; padding: 0 18px; background: var(--ink); color: var(--paper); border: 1px solid var(--ink); font-size: 13px; letter-spacing: .04em; transition: background .15s, color .15s; }
.save:hover { background: transparent; color: var(--ink); }
.seg { display: inline-flex; border: 1px solid var(--line2); }
.seg button { min-height: 34px; padding: 0 16px; background: none; border: 0; color: var(--dim); font-size: 13px; transition: background .15s, color .15s; }
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--ink); color: var(--paper); }
.menu-wrap { position: relative; }
.pop { position: absolute; right: 0; top: 42px; min-width: 200px; padding: 4px; background: var(--surface); border: 1px solid var(--line2); display: grid; box-shadow: 0 12px 30px rgba(30, 24, 18, .14); }
.pop[hidden] { display: none; }
.pop button { text-align: left; background: none; border: 0; padding: 8px 10px; }
.pop button:hover { background: var(--paper); }
.pop hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* layout */
.lib, .props { position: fixed; top: var(--bar); bottom: 0; background: var(--surface); z-index: 10; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }
.lib { left: 0; width: var(--lib); border-right: 1px solid var(--line); padding: 12px; }
.props { right: 0; width: var(--props); border-left: 1px solid var(--line); padding: 16px; }
.stage { position: fixed; top: var(--bar); bottom: 0; left: var(--lib); right: var(--props); background: var(--paper); }
.viewport { position: absolute; inset: 0; }
.viewport canvas { display: block; touch-action: none; }
body[data-mode="2d"] .v3d, body[data-mode="3d"] .v2d { visibility: hidden; }
.dock { position: absolute; left: 12px; top: 12px; display: grid; gap: 2px; padding: 4px; background: var(--surface); border: 1px solid var(--line2); z-index: 2; }
.dock button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; background: none; border: 0; color: var(--dim); transition: background .15s, color .15s; }
.dock button:hover { background: var(--paper); color: var(--ink); }
.dock button.on { background: var(--ink); color: var(--paper); }
.dock i { height: 1px; margin: 3px 4px; background: var(--line); }
.hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); padding: 5px 12px; background: var(--surface); border: 1px solid var(--line); color: var(--dim); font-size: 12.5px; white-space: nowrap; pointer-events: none; }
.walk-hud { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); padding: 6px 14px; background: var(--ink); color: var(--paper); font-size: 13px; }

/* catalogue */
.search input { width: 100%; height: 38px; padding: 0 10px; background: var(--paper); border: 1px solid var(--line); }
.search input:focus { outline: none; border-color: var(--ink); background: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 0 12px; margin: 10px 0 2px; }
.chips button { padding: 4px 0; background: none; border: 0; border-bottom: 1px solid transparent; color: var(--dim); font-size: 13px; transition: color .15s, border-color .15s; }
.chips button:hover { color: var(--ink); }
.chips button.on { color: var(--ink); border-color: var(--ink); }
.lib h4 { margin: 16px 0 6px; font-weight: 500; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 8px; }
.card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 6px; border: 1px solid var(--line); background: var(--surface); color: var(--dim); font-size: 12.5px; line-height: 1.25; text-align: center; transition: background .15s, color .15s; }
.card:hover { background: var(--paper); color: var(--ink); }
.card img { width: 100%; aspect-ratio: 4/3; object-fit: contain; pointer-events: none; }
.card .ico { display: grid; place-items: center; width: 100%; aspect-ratio: 5/3; }
.card .ico svg { width: 30px; height: 30px; stroke-width: 1.1; color: var(--ink); }
.item-card { cursor: grab; }
.empty { color: var(--faint); padding: 14px 4px; }

/* properties */
.ph { display: flex; align-items: center; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.ph img, .big-ico { width: 60px; height: 46px; flex: none; object-fit: contain; display: grid; place-items: center; background: var(--paper); }
.big-ico svg { width: 24px; height: 24px; stroke-width: 1.1; }
.ph small { display: block; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.ph b { font-weight: 500; font-size: 15px; }
.ph > div:last-child { flex: 1; min-width: 0; }
.ph .field { margin: 2px 0 0; height: 32px; }
.ph .field input { font-weight: 500; }
.ph select { width: 100%; height: 32px; padding: 0 6px; margin-top: 2px; background: var(--surface); border: 1px solid var(--line); }
.props h5 { margin: 16px 0 6px; font-weight: 500; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.field { display: flex; align-items: center; gap: 6px; margin-top: 6px; padding: 0 8px; height: 36px; background: var(--surface); border: 1px solid var(--line); }
.field:focus-within { border-color: var(--ink); }
.field span { color: var(--faint); font-size: 12px; white-space: nowrap; }
.field span:empty { display: none; }
.field input { flex: 1; min-width: 0; width: 100%; background: none; border: 0; outline: none; text-align: right; }
.field input[type="text"] { text-align: left; }
.field em { font-style: normal; color: var(--faint); font-size: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.grid3 .field { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; height: auto; padding: 4px 7px 5px; gap: 0 4px; }
.grid3 .field span { grid-column: 1 / -1; font-size: 10.5px; }
.grid3 .field input { text-align: left; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 24px; height: 24px; border: 1px solid var(--line2); background: var(--c); padding: 0; position: relative; }
.sw.on { outline: 2px solid var(--ink); outline-offset: 1px; }
.sw.custom { background: repeating-linear-gradient(45deg, var(--line2) 0 2px, var(--surface) 2px 5px); overflow: hidden; cursor: pointer; }
.sw.custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 16px; }
.btn { min-height: 36px; padding: 6px 10px; border: 1px solid var(--line2); background: var(--surface); color: var(--ink); font-size: 13px; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--paper); border-color: var(--ink); }
.btn.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.btn.primary:hover { background: #2c2925; }
.btn.danger { color: var(--danger); border-color: #d9b3a8; }
.btn.ghost { background: none; border-color: transparent; color: var(--dim); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(70px, 1fr)); margin-top: 12px; border: 1px solid var(--line); }
.stats div { padding: 8px 10px; border-left: 1px solid var(--line); }
.stats div:first-child { border-left: 0; }
.stats b { display: block; font-weight: 500; font-size: 16px; }
.stats span { font-size: 11px; color: var(--faint); }
.floors { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.floor { display: flex; align-items: center; gap: 7px; padding: 5px; border: 1px solid var(--line); background: none; color: var(--dim); font-size: 12px; line-height: 1.2; text-align: left; }
.floor i { width: 20px; height: 20px; background: var(--c); flex: none; border: 1px solid rgba(22, 20, 18, .12); }
.floor:hover { border-color: var(--line2); color: var(--ink); }
.floor.on { border-color: var(--ink); color: var(--ink); }
.toggle { display: flex; align-items: center; justify-content: space-between; flex-direction: row-reverse; gap: 10px; padding: 6px 0; color: var(--dim); cursor: pointer; }
.toggle input { appearance: none; width: 30px; height: 16px; margin: 0; border: 1px solid var(--line2); background: var(--surface); position: relative; transition: background .15s; flex: none; cursor: pointer; }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; background: var(--faint); transition: transform .15s, background .15s; }
.toggle input:checked { background: var(--ink); border-color: var(--ink); }
.toggle input:checked::after { transform: translateX(14px); background: var(--paper); }
.tip { margin-top: 18px; color: var(--faint); font-size: 12.5px; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(22, 20, 18, .42); padding: 16px; }
.modal[hidden] { display: none; }
.sheet { position: relative; width: min(1000px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line2); padding: 28px; }
.close { position: absolute; right: 10px; top: 8px; width: 36px; height: 36px; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--dim); }
.start-head small { letter-spacing: .14em; text-transform: uppercase; font-size: 11px; color: var(--accent); }
.start-head h2, .share h2, .help h2 { font-weight: 300; font-size: 30px; margin: 4px 0 6px; line-height: 1.15; }
.start-head p, .share p { color: var(--dim); margin: 0 0 16px; }
.resume { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 12px 14px; margin-bottom: 14px; border: 1px solid var(--ink); background: none; text-align: left; }
.resume b { font-weight: 500; }
.resume span { color: var(--dim); }
.ways { display: grid; grid-template-columns: 1.5fr 1fr; gap: 12px; }
.ways section { padding: 16px; border: 1px solid var(--line); }
.ways section.wide { grid-column: 1 / -1; }
.ways h3 { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px; font-weight: 500; font-size: 15px; }
.ways h3 i { font-style: normal; font-size: 11px; color: var(--accent); }
.ways .mini h3:not(:first-child) { margin-top: 16px; }
.ways p { color: var(--dim); margin: -4px 0 8px; font-size: 13px; }
.tpls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tpl { display: grid; gap: 2px; padding: 6px; border: 1px solid var(--line); background: none; text-align: left; transition: border-color .15s; }
.tpl:hover { border-color: var(--ink); }
.tpl canvas { width: 100%; }
.tpl b { font-weight: 500; margin-top: 4px; }
.tpl span { color: var(--faint); font-size: 12px; }
.wizard { display: grid; gap: 10px; }
.wizard label { display: grid; gap: 4px; color: var(--dim); font-size: 12.5px; }
.wizard input, .wizard select { height: 38px; padding: 0 10px; background: var(--surface); border: 1px solid var(--line); }
.wizard .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wizard .seg { display: flex; flex-wrap: wrap; }
.wizard .seg button { flex: 1; padding: 0 8px; font-size: 12.5px; }
.wizard .btn { min-height: 42px; }
.saved { display: grid; gap: 6px; }
.saved-row { display: grid; grid-template-columns: 96px 1fr auto auto; gap: 10px; align-items: center; padding: 6px; border: 1px solid var(--line); }
.saved-row img, .noimg { width: 96px; height: 54px; object-fit: cover; background: var(--paper); }
.saved-row b { font-weight: 500; }
.saved-row span { display: block; color: var(--faint); font-size: 12px; }
.copy { display: flex; gap: 8px; }
.copy input { flex: 1; min-width: 0; padding: 8px 10px; background: var(--paper); border: 1px solid var(--line); color: var(--dim); }
.warn { color: var(--danger) !important; margin-top: 10px !important; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; margin-top: 12px; }
.keys div { display: flex; align-items: center; gap: 10px; color: var(--dim); }
kbd { min-width: 88px; padding: 3px 8px; background: var(--paper); border: 1px solid var(--line); font: 500 12px "Plus Jakarta Sans", system-ui; color: var(--ink); text-align: center; }
.toast { position: fixed; left: 50%; bottom: 52px; transform: translate(-50%, 16px); padding: 8px 16px; background: var(--ink); color: var(--paper); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1100px) { :root { --lib: 232px; --props: 256px; } }
@media (max-width: 900px) {
  :root { --bar: 52px; }
  .only-mobile { display: inline-grid !important; }
  .pname, #snapshot, #daynight, .sep { display: none; }
  .bar { grid-template-columns: auto auto 1fr; gap: 6px; padding: 0 6px; }
  .stage { left: 0; right: 0; }
  .lib, .props { width: min(300px, 86vw); transform: translateX(-105%); transition: transform .25s; box-shadow: 0 0 40px rgba(30, 24, 18, .2); }
  .props { transform: translateX(105%); }
  body.lib-open .lib, body.props-open .props { transform: none; }
  .hint { display: none; }
  .ways, .tpls, .keys { grid-template-columns: 1fr; }
  .sheet { padding: 20px 16px; }
  .saved-row { grid-template-columns: 72px 1fr; }
}

.bare .bar, .bare .lib, .bare .props, .bare .dock, .bare .hint, .bare .toast { display: none !important; }
.bare .stage { position: fixed; inset: 0; }
