/* Layout: drafting table. Wide-set Archivo headlines, mono for measurements, teal ink on a cool paper ground. */
:root {
  --bg: #eef1f3; --panel: #ffffff; --ink: #1d2a36; --muted: #5d6b78; --line: #d5dce2;
  --grid: #e3e8ec; --grid-major: #c9d2da; --accent: #1f6f8b; --accent-ink: #ffffff; --accent-soft: #d9eaf0;
  --door: #a5692c; --glass: #5aa9c9; --danger: #b3412f;
  --sky: #dfe8ee; --ground: #c9d3c2; --wall3d: #f3efe6; --floor3d: #d8cfc0;
  --lawn: #d6ead0; --paved: #e4e2dd; --stair: #8a6f4d;
  --lawn3d: #7fa65a; --paved3d: #b9b6ae; --roof3d: #cfc8bb; --stair3d: #9b9285;
  --scrim: rgb(20 30 40 / 0.45);
  --display: "Archivo", system-ui, sans-serif;
  --body: "Archivo", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12181e; --panel: #1a222a; --ink: #e4ebf0; --muted: #93a2af; --line: #2c3843;
    --grid: #1f2830; --grid-major: #2d3a45; --accent: #5fb4d2; --accent-ink: #0d1a20; --accent-soft: #1d3a46;
    --door: #d39a5c; --glass: #7cc3de; --danger: #e07a66;
    --sky: #1b2530; --ground: #2a3328; --wall3d: #e6e0d4; --floor3d: #8f8574;
    --lawn: #24361f; --paved: #2a2e31; --stair: #c9a476;
    --lawn3d: #4f6e3a; --paved3d: #6d6a64; --roof3d: #8a8478; --stair3d: #7b7368; --scrim: rgb(0 0 0 / 0.6); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12181e; --panel: #1a222a; --ink: #e4ebf0; --muted: #93a2af; --line: #2c3843;
  --grid: #1f2830; --grid-major: #2d3a45; --accent: #5fb4d2; --accent-ink: #0d1a20; --accent-soft: #1d3a46;
  --door: #d39a5c; --glass: #7cc3de; --danger: #e07a66;
  --sky: #1b2530; --ground: #2a3328; --wall3d: #e6e0d4; --floor3d: #8f8574;
  --lawn: #24361f; --paved: #2a2e31; --stair: #c9a476;
  --lawn3d: #4f6e3a; --paved3d: #6d6a64; --roof3d: #8a8478; --stair3d: #7b7368; --scrim: rgb(0 0 0 / 0.6); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 400 15px/1.55 var(--body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
#root { min-height: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
button { font: 500 0.88rem var(--body); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1120px; margin-inline: auto; }

/* ---------- header ---------- */
.app { display: flex; flex-direction: column; min-height: 100%; }
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1120px; width: 100%; margin-inline: auto; padding-block: 14px;
}
.page-editor .site-header { max-width: none; padding-block: 10px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; font: 800 1.1rem var(--display); font-stretch: 112%; }
.brand em { font-style: normal; color: var(--accent); }
.site-header nav { display: flex; gap: 6px; align-items: center; }
.site-header nav a { text-decoration: none; padding: 7px 12px; border-radius: 8px; font-weight: 500; font-size: 0.92rem; }
.site-header nav a:hover { background: var(--accent-soft); }
.site-header nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 2px; }
.site-header .nav-cta { background: var(--ink); color: var(--bg); }
.site-header .nav-cta:hover { background: var(--accent); color: var(--accent-ink); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  padding: 12px 18px; border-radius: var(--radius); font-weight: 600; font-size: 0.98rem; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { border-color: var(--line); background: var(--panel); }
.btn-ghost:hover { border-color: var(--accent); }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- home ---------- */
.home h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; font-stretch: 118%; margin-bottom: 22px; }
.home h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 6px; }
.home p { margin: 0; color: var(--muted); }
.hero {
  max-width: 1120px; margin-inline: auto; padding-block: 28px 56px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 36px; align-items: center;
}
.eyebrow { font: 500 0.75rem var(--mono); text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent) !important; margin-bottom: 14px !important; }
.hero h1 { font-size: clamp(2.3rem, 5.4vw, 4rem); line-height: 1.02; font-weight: 800; font-stretch: 125%; letter-spacing: -0.025em; }
.lede { font-size: 1.1rem; max-width: 34em; margin-block: 18px 26px !important; color: var(--ink) !important; opacity: 0.85; }
.fine { font-size: 0.85rem; margin-top: 14px !important; }
.hero-visual { position: relative; min-width: 0; }
.hero-viewer { height: clamp(320px, 48vw, 520px); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); }
.hero-viewer canvas { display: block; }
.spec-card {
  position: absolute; left: 14px; bottom: 14px; display: flex; gap: 14px; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px 10px 10px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.08); max-width: calc(100% - 28px);
}
.spec-card .thumb { width: 54px; height: 84px; flex: none; }
.spec-card dl { margin: 0; display: grid; grid-template-columns: auto auto; gap: 2px 16px; font-size: 0.78rem; }
.spec-card dl div { display: contents; }
.spec-card dt { color: var(--muted); }
.spec-card dd { margin: 0; font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }

.band { background: var(--panel); border-block: 1px solid var(--line); padding-block: 56px; margin-inline: calc(-1 * max(16px, env(safe-area-inset-left, 0px))); padding-inline: max(16px, env(safe-area-inset-left, 0px)); }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
.steps li { border-top: 2px solid var(--ink); padding-top: 16px; }
.step-n { font: 500 0.8rem var(--mono); color: var(--accent); display: block; margin-bottom: 10px; }

.features, .audience, .faq { padding-block: 64px 8px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 32px; }
.feature-grid article { padding-left: 14px; border-left: 1px solid var(--grid-major); }
.aud-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.aud-grid article { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.faq details { border-bottom: 1px solid var(--line); padding-block: 14px; max-width: 760px; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 1.02rem; }
.faq details p { margin-top: 8px; max-width: 62ch; }
.closing { padding-block: 72px; text-align: center; }
.closing .wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.closing h2 { font-size: clamp(1.8rem, 4vw, 2.8rem) !important; }
.site-footer { border-top: 1px solid var(--line); padding-block: 22px; font: 400 0.8rem var(--mono); color: var(--muted); }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------- editor ---------- */
.page-editor { height: 100%; }
.editor { flex: 1; display: flex; flex-direction: column; gap: 10px; min-height: 0; padding-bottom: 12px; }
.editor-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.name-input {
  font: 700 1.15rem var(--display); font-stretch: 110%; color: var(--ink); background: transparent;
  border: 1px solid transparent; border-radius: 8px; padding: 5px 8px; min-width: 0; width: 15em; max-width: 100%;
}
.name-input:hover { border-color: var(--line); }
.name-input:focus { border-color: var(--accent); outline: none; background: var(--panel); }
.save-state { font: 400 0.78rem var(--mono); color: var(--muted); }
.save-state.saved { color: var(--accent); }
.save-state.error { color: var(--danger); }
.spacer { flex: 1; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 3px; padding: 3px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.seg button { background: transparent; border: 0; border-radius: 7px; padding: 7px 11px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button:hover:not(:disabled) { background: var(--accent-soft); }
.seg button:disabled { opacity: 0.4; cursor: default; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg button.primary { background: var(--ink); color: var(--bg); font-weight: 600; }
.seg button.primary:hover { background: var(--accent) !important; color: var(--accent-ink); }
.ti { width: 1em; text-align: center; font-size: 0.95em; }
.ti-door { color: var(--door); }
.ti-window { color: var(--glass); }
[aria-pressed="true"] .ti { color: inherit; }

.stage { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-height: 0; }
.pane { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; min-height: 340px; }
.plan-canvas, .viewer { position: absolute; inset: 0; width: 100%; height: 100%; }
.plan-canvas { display: block; touch-action: none; cursor: crosshair; }
.viewer canvas { display: block; }
.pane-tag {
  position: absolute; z-index: 2; top: 10px; left: 12px; pointer-events: none;
  font: 500 0.7rem var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
  background: var(--panel); padding: 3px 7px; border-radius: 5px; border: 1px solid var(--line);
}
.walk-help {
  position: absolute; z-index: 2; left: 12px; bottom: 12px; margin: 0; max-width: 55%;
  font-size: 0.78rem; color: var(--muted); background: var(--panel); padding: 5px 8px; border-radius: 6px; border: 1px solid var(--line);
}
.walkpad {
  position: absolute; z-index: 2; right: calc(12px + env(safe-area-inset-right, 0px)); bottom: 12px;
  display: grid; grid-template-columns: repeat(3, 42px); grid-template-areas: ". f ." "l b r"; gap: 4px;
}
.walkpad button { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 9px 0; cursor: pointer; touch-action: none; }
.wp-f { grid-area: f; } .wp-l { grid-area: l; } .wp-b { grid-area: b; } .wp-r { grid-area: r; }
.statusbar { display: flex; flex-wrap: wrap; gap: 4px 18px; font: 400 0.8rem var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.statusbar b { color: var(--ink); font-weight: 500; }
.statusbar .hint { color: var(--ink); font-family: var(--body); font-size: 0.86rem; flex-basis: 100%; }

/* ---------- projects ---------- */
.projects { width: 100%; padding-block: 18px 48px; }
.projects-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 24px; }
.projects-head h1 { font-size: 2rem; font-weight: 800; font-stretch: 118%; }
.project-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.project-card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; display: flex; flex-direction: column; }
.project-link { text-decoration: none; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 6px; }
.project-link:hover h2 { color: var(--accent); }
.project-card .thumb { width: 100%; height: 150px; background: var(--bg); border-radius: 8px; padding: 6px; }
.thumb-empty { display: grid; place-items: center; color: var(--muted); font-size: 0.85rem; }
.project-card h2 { font-size: 1.02rem; font-weight: 600; }
.project-card .meta { margin: 0; font: 400 0.76rem var(--mono); color: var(--muted); }
.card-actions { display: flex; gap: 8px; align-items: center; padding: 0 14px 12px; font-size: 0.82rem; flex-wrap: wrap; }
.card-actions button { background: transparent; border: 1px solid var(--line); border-radius: 7px; padding: 5px 10px; cursor: pointer; }
.card-actions button.danger { border-color: var(--danger); color: var(--danger); }
.empty { background: var(--panel); border: 1px dashed var(--grid-major); border-radius: 14px; padding: 40px 24px; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.empty p { margin: 0 0 8px; color: var(--muted); }

/* ---------- floors, view options, generator ---------- */
.btn-sm { padding: 7px 12px; font-size: 0.86rem; border: 0; cursor: pointer; font-family: var(--body); }
.icon-btn { background: transparent; border: 0; cursor: pointer; padding: 6px 8px; border-radius: 6px; color: var(--muted); }
.icon-btn:hover { background: var(--accent-soft); color: var(--ink); }
.link-btn { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; padding: 6px; }
.levels { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.levels [role="tab"] { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; margin-bottom: -1px; cursor: pointer; font-weight: 500; color: var(--muted); }
.levels [role="tab"][aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.levels .add-level { background: none; border: 1px dashed var(--grid-major); border-radius: 7px; padding: 5px 10px; cursor: pointer; margin-left: 6px; }
.levels .add-level:hover { border-color: var(--accent); color: var(--accent); }
.confirm { display: inline-flex; gap: 6px; align-items: center; font-size: 0.85rem; margin-left: 6px; }
.confirm button { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px; cursor: pointer; }
.confirm .danger { border-color: var(--danger); color: var(--danger); }
.view-opts { position: absolute; z-index: 2; top: 8px; right: calc(8px + env(safe-area-inset-right, 0px)); display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; max-width: calc(100% - 150px); }
.view-opts button { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; cursor: pointer; font-size: 0.82rem; }
.view-opts button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.view-opts button.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }
.notes-bar { display: flex; gap: 8px; align-items: flex-start; background: var(--accent-soft); border-radius: var(--radius); padding: 8px 10px 8px 14px; font-size: 0.88rem; }
.notes-bar ul { margin: 0; padding-left: 16px; flex: 1; min-width: 0; }

.gen-backdrop { position: fixed; inset: 0; z-index: 50; background: var(--scrim); display: flex; justify-content: flex-end; }
.gen-panel {
  background: var(--panel); width: min(460px, 100%); height: 100%; overflow-y: auto;
  padding: calc(18px + env(safe-area-inset-top, 0px)) calc(20px + env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) 20px;
  display: flex; flex-direction: column; gap: 16px; box-shadow: -10px 0 40px rgb(0 0 0 / 0.15);
}
.gen-head { display: flex; justify-content: space-between; align-items: center; }
.gen-head h2 { font-size: 1.35rem; font-weight: 800; font-stretch: 115%; }
.gen-intro { margin: -8px 0 0; color: var(--muted); }
.gen-panel fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.gen-panel legend { font: 500 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 8px; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 11px; cursor: pointer; font-weight: 600; }
.chips button small { font: 400 0.7rem var(--mono); color: var(--muted); }
.chips button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.row2 { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label { font-size: 0.82rem; color: var(--muted); }
.field input { font: 500 1rem var(--mono); width: 7em; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.calc { margin: 0; font: 400 0.8rem var(--mono); color: var(--muted); line-height: 1.4; }
.calc b { color: var(--accent); font-weight: 500; font-size: 0.95rem; }
.stepper-ctl { display: flex; align-items: stretch; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
.stepper-ctl button { border: 0; background: transparent; width: 36px; font-size: 1.1rem; cursor: pointer; }
.stepper-ctl button:disabled { opacity: 0.35; cursor: default; }
.stepper-ctl input { border: 0; border-radius: 0; width: 3.2em; text-align: center; -moz-appearance: textfield; }
.stepper-ctl input::-webkit-inner-spin-button { -webkit-appearance: none; }
.checks { display: grid; grid-template-columns: 1fr; gap: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); }
.check span { display: flex; flex-direction: column; font-weight: 500; }
.check small { font-weight: 400; color: var(--muted); font-size: 0.8rem; }
.hint-line { margin: 0; font-size: 0.82rem; color: var(--muted); }
.gen-notes { margin: 0; padding: 10px 10px 10px 28px; background: var(--accent-soft); border-radius: 8px; font-size: 0.86rem; }
.gen-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; position: sticky; bottom: 0; background: var(--panel); padding-top: 8px; }
.gen-actions .btn { border: 0; cursor: pointer; font-family: var(--body); }
.gen-actions span { font-size: 0.8rem; color: var(--muted); flex: 1 1 160px; }
.gen-actions span.blocked { color: var(--danger); font-weight: 500; }
.gen-actions { z-index: 3; border-top: 1px solid var(--line); padding-bottom: 4px; }
.front-hint b { color: var(--accent); }

/* ---------- plot of any shape ---------- */
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mode-switch button { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-weight: 600; text-align: left; }
.mode-switch button small { font-weight: 400; font-size: 0.75rem; color: var(--muted); }
.mode-switch button[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.plot-shape { display: flex; flex-direction: column; gap: 10px; }
.plot-preview { width: 100%; height: 280px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.side-table { display: flex; flex-direction: column; gap: 4px; }
.side-row { display: grid; grid-template-columns: 3.4em 1fr 1fr 2.2em; gap: 6px; align-items: center; padding: 3px 4px; border-radius: 7px; }
.side-row.on { background: var(--accent-soft); }
.side-head { font: 500 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.side-row input { font: 500 0.95rem var(--mono); width: 100%; min-width: 0; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--ink); }
.side-row input:disabled { background: transparent; color: var(--muted); border-style: dashed; }
.side-name { font-weight: 600; display: flex; flex-direction: column; line-height: 1.1; }
.side-name small { font-weight: 400; font-size: 0.68rem; color: var(--muted); }
.side-row.closing { color: var(--muted); border-top: 1px dashed var(--line); padding-top: 6px; }
.side-row .mono { font: 400 0.9rem var(--mono); padding-left: 9px; }
.add-side { align-self: flex-start; background: none; border: 1px dashed var(--grid-major); border-radius: 7px; padding: 6px 12px; cursor: pointer; }
.add-side:hover { border-color: var(--accent); color: var(--accent); }
.plot-problem { margin: 0; color: var(--danger); font-size: 0.86rem; font-weight: 500; }
.gen-actions .btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- hand-drawn plot ---------- */
.step-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.step-title { margin: 0; font-weight: 600; }
.step-title b { color: var(--accent); font-family: var(--mono); }
.plot-draw { display: flex; flex-direction: column; gap: 8px; }
.draw-bar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.draw-msg { font-size: 0.86rem; color: var(--ink); min-width: 0; flex: 1 1 200px; min-height: 2.8em; display: flex; align-items: center; line-height: 1.35; }
.chips.small button { padding: 4px 9px; font: 500 0.75rem var(--mono); }
.draw-area { width: 100%; aspect-ratio: 1.3; max-width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; touch-action: none; cursor: crosshair; user-select: none; }
.draw-area.closed { cursor: default; }
.draw-grid .g1 { stroke: var(--grid); stroke-width: 0.12; }
.draw-grid .g5 { stroke: var(--grid-major); stroke-width: 0.25; }
.draw-scale { fill: var(--muted); font-family: var(--mono); }
.draw-fill { fill: var(--accent-soft); }
.draw-line { fill: none; stroke: var(--ink); stroke-linejoin: round; stroke-linecap: round; }
.draw-area .pt { fill: var(--ink); }
.draw-area .pt.first { fill: var(--accent); }
.draw-area .pt.ghost { fill: var(--accent); opacity: 0.6; }
.draw-area .len { fill: var(--ink); font-family: var(--mono); }
.draw-area .len.front { fill: var(--accent); font-weight: 600; }
.draw-area .ang { fill: var(--door); font-family: var(--mono); }
.edge-hit { stroke: var(--accent); stroke-opacity: 0; cursor: pointer; stroke-linecap: round; }
.edge-hit:hover { stroke-opacity: 0.35; }
.edge-front { stroke: var(--accent); stroke-linecap: round; }
.draw-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.draw-actions > button:not(.btn):not(.link-btn) { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; cursor: pointer; }
.draw-actions button:disabled { opacity: 0.4; cursor: default; }
.draw-actions .spacer { flex: 1; }
.draw-actions .calc { margin: 0; }

/* ---------- room name card ---------- */
.room-card {
  position: absolute; z-index: 4; left: 10px; bottom: 10px; width: min(360px, calc(100% - 20px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.18); display: flex; flex-direction: column; gap: 10px;
}
.room-card-head { display: flex; align-items: center; gap: 8px; }
.room-card-title { font-weight: 700; font-family: var(--display); flex: 1; }
.room-card-size { font: 500 0.78rem var(--mono); color: var(--accent); white-space: nowrap; }
.room-name-input { font: 600 1rem var(--body); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); width: 100%; }
.room-name-input:focus { outline: none; border-color: var(--accent); }
.kind-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.kind-chips button { background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; font-size: 0.78rem; cursor: pointer; }
.kind-chips button[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.room-card-note { margin: 0; font-size: 0.78rem; color: var(--muted); }
.room-card-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.room-card-actions .btn { border: 0; cursor: pointer; font-family: var(--body); }
.room-card-tip { font-size: 0.74rem; color: var(--muted); flex-basis: 100%; }
.ti-edit { color: var(--accent); }

/* ---------- colours ---------- */
.color-panel {
  position: absolute; z-index: 5; inset: 0; overflow-y: auto; background: var(--panel);
  padding: 14px 16px 20px; display: flex; flex-direction: column; gap: 12px;
}
.color-head { display: flex; justify-content: space-between; align-items: center; }
.color-head h2 { font-size: 1.2rem; font-weight: 800; font-stretch: 112%; }
.auto-btn { border: 0; cursor: pointer; font-family: var(--body); align-self: flex-start; }
.color-panel section { display: flex; flex-direction: column; gap: 8px; }
.color-sub { font: 500 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin: 6px 0 2px; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.theme-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); cursor: pointer; font-weight: 600; font-size: 0.85rem; text-align: left; }
.theme-chip[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-sw { display: flex; width: 100%; height: 14px; border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.theme-sw i { flex: 1; }
.color-row { display: grid; grid-template-columns: minmax(0, 9.5em) minmax(0, 1fr); gap: 8px; align-items: center; }
.color-name { font-size: 0.86rem; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.swatch-row { display: flex; flex-wrap: wrap; gap: 5px; }
.swatch { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--grid-major); cursor: pointer; padding: 0; position: relative; display: inline-grid; place-items: center; }
.swatch[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.swatch.custom span { font-size: 0.7rem; color: #1d2a36; background: rgb(255 255 255 / 0.75); border-radius: 3px; padding: 0 2px; line-height: 1.2; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }
.room-paint { display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; color: var(--muted); }
@media (max-width: 520px) { .color-row { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- sign in ---------- */
.gen-backdrop.center { justify-content: center; align-items: center; padding: 16px; }
.signin-card { position: relative; background: var(--panel); border-radius: 14px; padding: 24px 22px 18px; width: min(420px, 100%); display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 60px rgb(0 0 0 / 0.25); }
.signin-card h2 { font-size: 1.25rem; font-weight: 800; font-stretch: 110%; padding-right: 28px; }
.signin-card p { margin: 0; color: var(--muted); }
.signin-x { position: absolute; top: 10px; right: 10px; }
.google-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 16px; border-radius: 10px; border: 1px solid var(--line); background: #ffffff; color: #1f1f1f; font: 600 0.95rem var(--body); cursor: pointer; }
.google-btn:hover { box-shadow: 0 2px 10px rgb(0 0 0 / 0.12); }
.google-btn:disabled { opacity: 0.6; cursor: wait; }
.signin-err { color: var(--danger) !important; font-size: 0.86rem; font-weight: 500; margin: 0; }
.signin-fine { font-size: 0.76rem; }
.signin-link { background: none; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; cursor: pointer; font-weight: 600; }
.signin-link:hover { border-color: var(--accent); color: var(--accent); }
.account { position: relative; }
.avatar-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); padding: 0; overflow: hidden; cursor: pointer; background: var(--accent); color: var(--accent-ink); font-weight: 700; display: grid; place-items: center; }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }
.account-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-width: 200px; box-shadow: 0 10px 30px rgb(0 0 0 / 0.15); display: flex; flex-direction: column; gap: 4px; }
.account-menu p { margin: 0 0 6px; font-size: 0.85rem; overflow-wrap: anywhere; }
.account-menu small { color: var(--muted); }
.account-menu a, .account-menu button { text-align: left; background: none; border: 0; padding: 7px 8px; border-radius: 6px; cursor: pointer; text-decoration: none; font: 500 0.9rem var(--body); color: var(--ink); }
.account-menu a:hover, .account-menu button:hover { background: var(--accent-soft); }
.save-btn { background: var(--ink); color: var(--bg); border: 0; cursor: pointer; font-family: var(--body); }
.save-btn:hover { background: var(--accent); color: var(--accent-ink); }
.save-btn:disabled { opacity: 0.6; cursor: wait; }
.save-state.warn { color: var(--danger); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .hide-sm { display: none; }
  .view-opts { max-width: calc(100% - 16px); top: 40px; }
  .hero { grid-template-columns: 1fr; padding-top: 12px; }
  .steps, .feature-grid, .aud-grid { grid-template-columns: 1fr; }
  .stage { grid-template-columns: 1fr; }
  .pane { height: 56vh; }
  .page-editor, html:has(.page-editor), html:has(.page-editor) body { height: auto; }
  .spec-card { position: static; margin-top: 10px; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
