/* Experience Studio. All brand colors and fonts arrive as CSS variables from the brand config. */
:root {
  --bg: #0b0a09; --surface: #16130f; --text: #f5efe4; --muted: #a89f90;
  --accent: #d9b45a; --accent-text: #17120a;
  --font-head: Georgia, 'Times New Roman', serif;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --line: color-mix(in srgb, var(--text) 14%, transparent);
  --soft: color-mix(in srgb, var(--text) 6%, transparent);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font-body); display: flex; flex-direction: column; opacity: 0; transition: opacity .25s; }
body.ready { opacity: 1; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 500; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* header */
.top { display: flex; align-items: center; gap: 16px; padding: 10px 20px; border-bottom: 1px solid var(--line); flex: none; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brand img { height: 38px; width: auto; border-radius: 6px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-family: var(--font-head); font-size: 18px; font-weight: 500; white-space: nowrap; }
.brand-text small { font-size: 10px; letter-spacing: .28em; text-transform: uppercase; color: var(--accent); }
.studio-name { padding-left: 16px; border-left: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.top nav { margin-left: auto; display: flex; gap: 18px; }
.top nav a { color: var(--muted); text-decoration: none; font-size: 14px; white-space: nowrap; }
.top nav a:hover { color: var(--accent); }

/* layout */
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 16px; padding: 16px 20px; }
.stage { position: relative; border-radius: var(--radius); overflow: hidden; background: #0a0908; min-height: 0; border: 1px solid var(--line); }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.stage-top { position: absolute; left: 18px; top: 16px; right: 18px; pointer-events: none; color: #fff; text-shadow: 0 1px 12px rgba(0,0,0,.7); }
.chip { display: inline-block; font-size: 10px; letter-spacing: .22em; text-transform: uppercase; padding: 5px 10px; border-radius: 99px; background: rgba(0,0,0,.55); color: #fff; text-shadow: none; }
.stage-top h1 { font-size: clamp(20px, 2.6vw, 34px); margin-top: 8px; }
.stage-fallback { position: absolute; inset: 0; display: grid; place-items: center; padding: 30px; text-align: center; color: #cfc7ba; }
.stage-controls { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; padding: 0 12px; }
.seg { display: inline-flex; background: rgba(0,0,0,.62); border: 1px solid rgba(255,255,255,.14); border-radius: 99px; padding: 3px; backdrop-filter: blur(6px); }
.seg button { border: 0; background: none; color: #e9e2d6; padding: 6px 12px; border-radius: 99px; font-size: 13px; white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.seg.wide { display: flex; background: var(--soft); border-color: var(--line); backdrop-filter: none; }
.seg.wide button { flex: 1; color: var(--text); padding: 9px 12px; }

/* panel */
.panel { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.steps { list-style: none; margin: 0; padding: 8px; display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; }
.steps li { flex: 1; }
.steps button { width: 100%; border: 0; background: none; color: var(--muted); padding: 6px 4px; border-radius: 8px; font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 3px; white-space: nowrap; }
.steps span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); font-size: 11px; }
.steps button[aria-current="step"] { color: var(--text); }
.steps button[aria-current="step"] span { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 700; }
.panel-body { flex: 1; overflow-y: auto; padding: 18px; min-height: 0; }
.panel-body h2 { font-size: 23px; margin-bottom: 6px; }
.panel-body h3 { font-size: 13px; font-family: var(--font-body); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 20px 0 10px; }
.panel-body h3 small { color: var(--muted); letter-spacing: 0; text-transform: none; font-weight: 400; margin-left: 6px; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 12px; }
.fine { color: var(--muted); font-size: 12px; margin-top: 16px; }

.field { display: block; margin-bottom: 12px; flex: 1; min-width: 0; }
.field span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color-scheme: light dark; }
.field select option { color: #111; }
.row { display: flex; gap: 10px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.cards { display: grid; gap: 10px; }
.card { position: relative; text-align: left; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.card[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.card-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.card-head strong { font-family: var(--font-head); font-size: 18px; font-weight: 500; }
.card-head b { color: var(--accent); font-size: 17px; }
.card small { color: var(--accent); font-size: 12px; }
.card-desc { color: var(--muted); font-size: 13px; }
.badge { align-self: flex-start; font-style: normal; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; background: var(--accent); color: var(--accent-text); padding: 2px 8px; border-radius: 99px; font-weight: 700; margin-bottom: 4px; }
.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.tags i { font-style: normal; font-size: 11px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 99px; }

.toggles { display: grid; gap: 8px; }
.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--soft); cursor: pointer; }
.toggle input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.toggle-main { flex: 1; min-width: 0; }
.toggle-main strong { display: block; font-weight: 600; }
.toggle-main small { color: var(--muted); font-size: 12.5px; }
.toggle-price { color: var(--accent); font-size: 13px; white-space: nowrap; font-weight: 600; }
.toggle.is-inc { border-color: color-mix(in srgb, var(--accent) 50%, transparent); cursor: default; }
.toggle.is-locked { opacity: .55; cursor: not-allowed; }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); gap: 8px; }
.swatch { position: relative; background: none; border: 1px solid transparent; border-radius: 10px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; }
.swatch i { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-style: normal; font-size: 18px; }
.swatch[aria-pressed="true"] { border-color: var(--accent); color: var(--text); background: var(--soft); }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

.sum { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--soft); }
.sum-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; font-size: 14px; }
.sum-row b { font-weight: 500; white-space: nowrap; }
.sum-row.head { font-family: var(--font-head); font-size: 18px; }
.sum-row.total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 12px; font-weight: 600; }
.sum-row.total b { color: var(--accent); font-size: 20px; font-weight: 600; }
.sum-row small { font-size: 12px; color: var(--muted); font-weight: 400; }
.sum .hint { margin: 0 0 8px; }

.btn { border: 1px solid var(--line); background: none; padding: 10px 16px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.block { width: 100%; padding: 13px; }
.btn[disabled] { opacity: .6; cursor: wait; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions .btn { font-size: 13px; padding: 8px 12px; font-weight: 500; }
.notice { padding: 10px 12px; border-radius: 10px; font-size: 14px; margin: 10px 0; }
.notice.ok { background: color-mix(in srgb, #2ea36b 18%, transparent); border: 1px solid #2ea36b; }
.notice.err { background: color-mix(in srgb, #d9534f 16%, transparent); border: 1px solid #d9534f; }

.panel-foot { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 40%, var(--surface)); }
.estimate { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.estimate small { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.estimate strong { font-family: var(--font-head); font-size: 24px; color: var(--accent); font-weight: 500; }
.estimate span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.foot-actions { display: flex; gap: 8px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 20; max-width: calc(100vw - 32px); }
[hidden] { display: none !important; }
#printSheet { display: none; }

/* tablets and phones: showroom on top, builder below */
@media (max-width: 900px) {
  html, body { height: auto; }
  body { display: block; }
  .top { padding: 8px 14px; gap: 10px; }
  .top nav, .studio-name { display: none; }
  .layout { display: block; padding: 0; }
  .stage { position: sticky; top: 0; z-index: 5; height: 40vh; min-height: 230px; border-radius: 0; border-width: 0 0 1px; }
  .stage-top h1 { display: none; }
  .stage-controls { bottom: 8px; gap: 5px; }
  .seg button { padding: 5px 9px; font-size: 12px; }
  .panel { border-radius: 0; border: 0; overflow: visible; }
  .panel-body { overflow: visible; padding: 16px 16px 24px; }
  .panel-foot { position: sticky; bottom: 0; z-index: 6; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .row { flex-direction: column; gap: 0; }
}
@media (max-height: 560px) and (min-width: 901px) {
  .top { padding: 6px 20px; }
  .brand img { height: 28px; }
  .layout { padding: 10px 20px; }
}

@media print {
  body { background: #fff; color: #111; opacity: 1; display: block; }
  .top, .layout, .toast { display: none !important; }
  #printSheet { display: block; padding: 24px; font: 14px/1.5 Arial, sans-serif; }
  #printSheet h1 { font: 500 26px Georgia, serif; margin-bottom: 12px; }
  #printSheet h1 small { font-size: 14px; color: #666; }
  #printSheet img { width: 100%; border-radius: 8px; margin-bottom: 12px; }
  #printSheet .sum { border: 1px solid #ccc; background: none; }
  #printSheet .sum-row.total b, #printSheet .hint, #printSheet .fine, #printSheet small { color: #333; }
}
