*,*::before,*::after{box-sizing:border-box}
body{margin:0}
img{max-width:100%}
[hidden]{display:none!important}
/* Layout: full-bleed 3D stage + slim control column (stacks below the stage on phones) */
:root{
  --bg:#f2eeea;
  --panel:#fbf9f7;
  --ink:#2f2b2a;
  --muted:#7b706e;
  --rose:#b5677a;
  --rose-soft:#f1e1e2;
  --line:#e4dad6;
  --stage:#ece6e1;
  --chip:#ffffff;
  --font-display:"Playfair Display", Georgia, "Times New Roman", serif;
  --font-ui:"Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#1b1919; --panel:#232020; --ink:#f1ebe7; --muted:#a99f9c; --rose:#dc97a3;
    --rose-soft:#3a2a2d; --line:#383232; --stage:#2a2626; --chip:#2c2828; color-scheme:dark;
  }
}
:root[data-theme="dark"]{
  --bg:#1b1919; --panel:#232020; --ink:#f1ebe7; --muted:#a99f9c; --rose:#dc97a3;
  --rose-soft:#3a2a2d; --line:#383232; --stage:#2a2626; --chip:#2c2828; color-scheme:dark;
}
html,body{height:100%}
body{background:var(--bg);color:var(--ink);font-family:var(--font-ui);font-size:14px;line-height:1.45}
.app{display:grid;grid-template-columns:minmax(0,1fr) 340px;height:100%}
.stage{position:relative;min-height:0;background:var(--stage);overflow:hidden;transition:background .4s}
.stage::after{content:"";position:absolute;inset:0;pointer-events:none;background:radial-gradient(120% 90% at 50% 35%,transparent 55%,rgba(0,0,0,.07))}
#gl{position:absolute;inset:0}
#gl canvas{display:block;width:100%;height:100%;touch-action:none}
.brand{position:absolute;top:18px;left:20px;z-index:2;pointer-events:none;color:#3b3736}
.brand .ch{font-weight:400;letter-spacing:.42em;font-size:12px}
.brand .fc{font-family:var(--font-display);font-weight:800;font-size:26px;line-height:1.05;letter-spacing:-.01em}
.brand .fc i{font-weight:300;font-style:normal;font-family:var(--font-ui);letter-spacing:.02em}
.stage[data-dark="1"] .brand{color:#f3ece8}
.hint{position:absolute;left:16px;bottom:16px;z-index:2;font-size:12px;color:var(--muted);background:var(--panel);border:1px solid var(--line);padding:6px 10px;border-radius:999px;pointer-events:none}
.loading{position:absolute;inset:0;display:grid;place-items:center;z-index:3;font-size:13px;letter-spacing:.08em;color:var(--muted);background:var(--stage)}

.panel{background:var(--panel);border-left:1px solid var(--line);overflow-y:auto;padding:22px 22px 28px;display:flex;flex-direction:column;gap:22px}
.eyebrow{font-size:11px;letter-spacing:.16em;text-transform:uppercase;color:var(--rose);font-weight:600}
h1{margin:4px 0 2px;font-family:var(--font-display);font-size:28px;line-height:1.1;font-weight:800;text-wrap:balance}
h1 span{font-family:var(--font-ui);font-weight:300}
.sub{color:var(--muted);font-size:13px}
.sec{display:flex;flex-direction:column;gap:10px}
.sec h2{margin:0;font-size:11px;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);font-weight:600}
.seg{display:grid;grid-template-columns:repeat(2,1fr);background:var(--bg);border:1px solid var(--line);border-radius:10px;padding:3px;gap:3px}
.seg button{font:inherit;font-size:12.5px;font-weight:500;border:0;background:transparent;color:var(--ink);padding:8px 4px;border-radius:7px;cursor:pointer}
.seg button[aria-pressed="true"]{background:var(--chip);box-shadow:0 1px 3px rgba(0,0,0,.12);color:var(--rose);font-weight:600}
.range-row{display:flex;align-items:center;gap:12px}
input[type=range]{flex:1;accent-color:var(--rose)}
.pct{font-variant-numeric:tabular-nums;font-size:12px;color:var(--muted);width:38px;text-align:right}
.parts{list-style:none;margin:0;padding:0;border:1px solid var(--line);border-radius:10px;overflow:hidden}
.parts li+li{border-top:1px solid var(--line)}
.parts button{all:unset;box-sizing:border-box;display:flex;justify-content:space-between;align-items:center;gap:10px;width:100%;padding:9px 12px;cursor:pointer;font-size:13px}
.parts button:hover{background:var(--rose-soft)}
.parts button[aria-current="true"]{background:var(--rose-soft);color:var(--rose);font-weight:600}
.parts .dim{font-variant-numeric:tabular-nums;color:var(--muted);font-size:12px;white-space:nowrap}
.chips{display:flex;flex-wrap:wrap;gap:8px}
.chip{font:inherit;font-size:12px;font-weight:500;display:inline-flex;align-items:center;gap:7px;padding:6px 10px 6px 6px;border-radius:999px;border:1px solid var(--line);background:var(--chip);color:var(--ink);cursor:pointer}
.chip[aria-pressed="true"]{border-color:var(--rose);box-shadow:0 0 0 1px var(--rose) inset;color:var(--rose)}
.sw{width:18px;height:18px;border-radius:50%;box-shadow:0 0 0 1px rgba(0,0,0,.12) inset}
.field{display:flex;flex-direction:column;gap:6px}
.field label{font-size:12px;color:var(--muted)}
.field input{font:inherit;font-size:14px;padding:9px 11px;border:1px solid var(--line);border-radius:8px;background:var(--chip);color:var(--ink)}
.toggle{display:flex;align-items:center;gap:10px;font-size:13px;cursor:pointer}
.toggle input{accent-color:var(--rose);width:16px;height:16px}
.btn{font:inherit;font-weight:600;font-size:13px;padding:10px 14px;border-radius:9px;border:0;background:var(--rose);color:#fff;cursor:pointer}
.note{font-size:12px;color:var(--muted)}
button:focus-visible,input:focus-visible{outline:2px solid var(--rose);outline-offset:2px}

@media (max-width:820px){
  html,body{height:auto}
  .app{grid-template-columns:1fr;grid-template-rows:62vh auto;height:auto}
  .panel{border-left:0;border-top:1px solid var(--line);padding:20px 16px 28px}
  .brand .fc{font-size:21px}
}
