:root {
  --bg: #f6f3ee;
  --panel: #fbfaf7;
  --ink: #1f2124;
  --ink-2: #5d6066;
  --ink-3: #8d9096;
  --line: #e6e1d8;
  --accent: #6f4526;
  --accent-ink: #fff;
  --accent-soft: #f2e8dc;
  --glass: rgba(251, 250, 247, 0.82);
  --r: 14px;
  --shadow: 0 10px 30px rgba(32, 26, 18, 0.12);
  font-family: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); }
button { font: inherit; color: inherit; cursor: pointer; }

#app { display: grid; grid-template-columns: 1fr 400px; height: 100vh; height: 100dvh; }
#stage { position: relative; overflow: hidden; background: #cdd6dc; }
#viewport { position: absolute; inset: 0; }
#viewport canvas { display: block; touch-action: none; }

/* loader */
#loader { position: absolute; inset: 0; display: grid; place-items: center; background: linear-gradient(180deg, #e9edf0, #dde3e6); z-index: 5; transition: opacity 0.6s; }
#loader.done { opacity: 0; pointer-events: none; }
.loader-title { font-weight: 600; letter-spacing: 0.02em; margin-bottom: 14px; color: var(--ink-2); }
.loader-bar { width: 220px; height: 3px; background: rgba(0, 0, 0, 0.08); border-radius: 2px; overflow: hidden; }
.loader-bar i { display: block; height: 100%; width: 5%; background: var(--accent); transition: width 0.6s ease; }

/* stage overlays */
.stage-head { position: absolute; top: 16px; left: 16px; right: 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; pointer-events: none; z-index: 3; }
.brand { display: flex; gap: 10px; align-items: center; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding: 9px 14px 9px 10px; border-radius: 12px; box-shadow: var(--shadow); pointer-events: auto; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.brand-mark svg { width: 20px; height: 20px; }
.brand b { display: block; font-size: 14px; }
.brand small { display: block; font-size: 11.5px; color: var(--ink-2); }
.models { display: flex; gap: 4px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding: 4px; border-radius: 12px; box-shadow: var(--shadow); pointer-events: auto; }
.models button { border: 0; background: none; padding: 9px 16px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--ink-2); }
.models button.on { background: var(--ink); color: #fff; }

.stage-foot { position: absolute; left: 16px; right: 16px; bottom: 16px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; z-index: 3; pointer-events: none; }
.seg { display: flex; gap: 2px; padding: 4px; background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-radius: 12px; box-shadow: var(--shadow); pointer-events: auto; }
.seg button { border: 0; background: none; padding: 8px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.seg button:hover { background: rgba(0, 0, 0, 0.05); color: var(--ink); }
.seg button.on { background: var(--ink); color: #fff; }
.seg svg { width: 18px; height: 18px; }
.hint { position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%); font-size: 12px; color: #fff; background: rgba(20, 22, 24, 0.55); padding: 6px 12px; border-radius: 20px; transition: opacity 0.6s; pointer-events: none; z-index: 3; }
.hint.done { opacity: 0; }

/* panel */
#panel { display: flex; flex-direction: column; background: var(--panel); border-left: 1px solid var(--line); min-height: 0; }
.panel-scroll { flex: 1; overflow-y: auto; padding: 26px 24px 12px; scrollbar-width: thin; }
.project .eyebrow { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.project h1 { margin: 6px 0 6px; font-size: 30px; letter-spacing: -0.02em; font-weight: 700; }
.project .tag { margin: 0 0 16px; color: var(--ink-2); font-size: 14px; line-height: 1.45; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; margin: 0 0 8px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.specs div { background: var(--panel); padding: 10px 12px; }
.specs dt { font-size: 11.5px; color: var(--ink-3); }
.specs dd { margin: 2px 0 0; font-weight: 600; font-size: 14px; }
.project .rooms { font-size: 12.5px; color: var(--ink-3); line-height: 1.5; margin: 10px 0 12px; }
.project .base { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--ink); color: #fff; }
.project .base span { font-size: 12.5px; opacity: 0.75; }
.project .base b { font-size: 18px; letter-spacing: -0.01em; white-space: nowrap; }
.gifts { display: flex; flex-wrap: wrap; gap: 6px; padding: 18px 0 8px; border-top: 1px solid var(--line); margin-top: 18px; }
.gifts span { font-size: 12px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 6px 10px; border-radius: 20px; }

.opt { padding: 20px 0 6px; border-top: 1px solid var(--line); margin-top: 18px; }
.opt h2 { font-size: 16px; margin: 0 0 12px; display: flex; align-items: baseline; gap: 10px; }
.opt h2 em { font-style: normal; font-size: 11px; color: var(--accent); font-weight: 700; letter-spacing: 0.06em; }
.opt h2 span { margin-left: auto; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.opt h3 { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 14px 0 8px; }
.opt .pal:first-of-type h3 { margin-top: 4px; }
.note { font-size: 12.5px; color: var(--ink-3); line-height: 1.45; margin: 10px 0 0; }

.list { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.row:hover { border-color: #cfc6b8; }
.row.on { border-color: var(--accent); background: var(--accent-soft); }
.row input { accent-color: var(--accent); margin: 0; width: 16px; height: 16px; flex: none; }
.row span { flex: 1; min-width: 0; }
.row b { display: block; font-size: 13.5px; font-weight: 600; }
.row small { display: block; font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.row em { font-style: normal; font-size: 12.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }

/* option cards: one per row — name and price on the first line, note below */
.cards { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.card {
  display: grid; grid-template-columns: 1fr auto; column-gap: 12px; row-gap: 2px; align-items: baseline;
  width: 100%; border: 1px solid var(--line); background: #fff; border-radius: 11px; padding: 11px 14px; text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.card:hover { border-color: #cfc6b8; }
.card.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.card b { grid-column: 1; grid-row: 1; font-size: 14px; font-weight: 600; min-width: 0; }
.card em { grid-column: 2; grid-row: 1; font-style: normal; font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.card small { grid-column: 1 / -1; grid-row: 2; font-size: 12px; color: var(--ink-3); line-height: 1.4; }

.pal { margin-bottom: 10px; }
.pal.off { opacity: 0.45; pointer-events: none; }
.sws { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.sw { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 7px 8px; text-align: left; min-width: 0; }
.sw i { width: 24px; height: 24px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.sw span { font-size: 12.5px; font-weight: 600; line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.sw small { display: block; font-size: 11px; font-weight: 500; color: var(--ink-3); }
.sw:hover { border-color: #cfc6b8; }
.sw.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.sw { min-height: 44px; }


.summary { border-top: 1px solid var(--line); padding: 14px 24px 18px; background: #fff; }
.sum-lines { display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; }
.sum-lines div { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; color: var(--ink-2); }
.sum-lines b { font-weight: 600; color: var(--ink); white-space: nowrap; }
.sum-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.sum-total span { font-size: 13px; color: var(--ink-2); }
.sum-total strong { font-size: 26px; letter-spacing: -0.02em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 11px; padding: 14px 18px; font-weight: 700; font-size: 14.5px; text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); width: 100%; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: #f0ece5; color: var(--ink); }

dialog { border: 0; border-radius: 18px; padding: 0; width: min(460px, calc(100vw - 32px)); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); }
dialog::backdrop { background: rgba(20, 18, 15, 0.45); backdrop-filter: blur(3px); }
.req { padding: 26px 26px 22px; position: relative; }
.req h3 { margin: 0 0 14px; font-size: 21px; }
.req ul { list-style: none; padding: 0; margin: 0; font-size: 13.5px; }
.req li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.req li span { color: var(--ink-3); }
.req li:last-child { font-weight: 700; font-size: 15px; border-bottom: 0; }
.req-actions { display: grid; grid-template-columns: 1fr 1.3fr; gap: 8px; margin-top: 16px; }
.req-close { position: absolute; top: 12px; right: 14px; border: 0; background: none; font-size: 26px; color: var(--ink-3); }

@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; grid-template-rows: 56vh 1fr; }
  #panel { border-left: 0; border-top: 1px solid var(--line); }
  .panel-scroll { padding: 18px 16px 10px; }
  .summary { padding: 10px 16px 12px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
  .sum-lines { display: none; }
  .sum-total { flex-direction: column; align-items: flex-start; margin: 0; }
  .sum-total strong { font-size: 21px; }
  .summary .btn.primary { width: auto; padding: 12px 16px; }
  .stage-head { top: 10px; left: 10px; right: 10px; }
  .brand small { display: none; }
  .stage-foot { bottom: 10px; left: 10px; right: 10px; gap: 6px; }
  .seg button { padding: 7px 9px; font-size: 12px; }
  .seg button span { display: none; }
  #views { overflow-x: auto; max-width: 100%; }
  .hint { display: none; }
}
@media (max-width: 520px) {
  .brand { display: none; }
  .stage-head { justify-content: center; }
}
