/* A stationary preview and an independently scrollable editor: no page-long chase after the model. */
.builder-page{--builder-header:66px;--builder-buy:84px;height:100vh;height:100dvh;overflow:hidden;display:grid;grid-template-rows:var(--builder-header) minmax(0,1fr) var(--builder-buy)}
.builder-page [hidden]{display:none!important}
.builder-page .site-header{position:relative;top:auto}
.builder-page .site-header .wrap{height:var(--builder-header);width:calc(100% - 36px)}
.builder-page .builder{height:100%;min-height:0;overflow:hidden;grid-template-columns:minmax(0,1.15fr) minmax(390px,.85fr)}
.builder-page .build-stage{position:relative;top:0;height:100%;min-height:0;overflow:hidden}
.builder-page .build-stage canvas,.builder-page .organizer-stage{position:absolute;inset:66px 0 64px;width:100%;height:calc(100% - 130px)}
.builder-page .stage-note{top:16px;bottom:auto;left:24px;right:24px;font-size:12px;line-height:1.4;max-width:520px;margin:0 auto;z-index:1;color:#45504b}
.builder-page .stage-toolbar{bottom:14px;left:12px;right:12px;gap:6px;flex-wrap:wrap;align-items:center;z-index:2}
.builder-page .stage-toolbar .chip-btn,.builder-page .stage-toolbar .seg button{font-size:12px;padding:8px 11px;white-space:nowrap}
.builder-page .panel{padding:0;min-width:0;min-height:0;display:flex;flex-direction:column;background:var(--cream);overflow:hidden}
.panel-head{padding:18px 24px 0;flex:none;border-bottom:1px solid var(--line);background:var(--cream)}
.builder-heading{display:flex;align-items:center;gap:12px;margin-bottom:14px;min-height:32px}
.builder-heading h1{font:600 19px/1.2 var(--display);letter-spacing:-.02em}
.back-btn{flex:none;border:1px solid var(--line-2);background:var(--paper);border-radius:999px;font-size:12px;font-weight:700;padding:8px 11px;cursor:pointer}
.builder-page .product-switch{margin-bottom:14px;gap:8px}
.builder-page .product-switch button{padding:10px 12px;font-size:13px;border-radius:12px}
.builder-page .product-switch small{font-size:11px}
.builder-page .steps-nav{margin:0;gap:4px;padding-bottom:0}
.builder-page .steps-nav button{font-size:12px;padding:10px 4px;min-width:58px}
.panel-body{min-height:0;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;scroll-padding-top:14px;padding:18px 24px 26px;-webkit-overflow-scrolling:touch}
.builder-page .block{margin-bottom:20px}
.builder-page .block h2{font:600 15px/1.3 var(--display);display:flex;justify-content:space-between;align-items:baseline;gap:10px;margin-bottom:12px}
.builder-page .block h2 small{font:600 11px/1.4 var(--text);color:var(--muted)}
.builder-page .picked{font-size:12px;line-height:1.5;margin:8px 0 0}
.preset-intro{font-size:13px;color:var(--muted);margin:0 0 14px}
.builder-page .presets{grid-template-columns:repeat(3,minmax(0,1fr));gap:9px}
.builder-page .preset{font-size:12px;line-height:1.35;min-height:106px;padding:12px;position:relative}
.builder-page .preset[aria-pressed=true]{border-color:var(--accent);box-shadow:0 0 0 1px var(--accent);background:var(--accent-soft)}
.builder-page .preset .dots{height:27px;align-items:center}
.builder-page .preset .dots i{width:24px;height:24px;margin-right:-5px}
.preset-actions{margin-top:16px;display:grid;grid-template-columns:1fr;gap:8px}
.preset-actions p{margin:0 0 4px;font-weight:700;font-size:14px}
.preset-actions .btn,.custom-start{width:100%;font-size:14px;padding:13px 16px}
.custom-start{margin-top:16px}
.builder-page .part-chips{flex-wrap:nowrap;overflow-x:auto;gap:6px;padding:2px 2px 7px;scrollbar-width:thin}
.builder-page .part-chips button{white-space:nowrap;flex:none;font-size:12px;padding:8px 11px 8px 8px}
.builder-page .part-chips button i{width:15px;height:15px;flex:none}
.builder-page .materials-row{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
.builder-page .materials-row button{border:2px solid color-mix(in srgb,var(--material-color,#999) 62%,var(--paper));border-left-width:5px;padding:8px 9px;font-size:11px;line-height:1.3;min-height:56px}
.builder-page .materials-row button[aria-pressed=true]{border-color:var(--material-color,#777);background:color-mix(in srgb,var(--material-color,#999) 11%,var(--paper));box-shadow:0 0 0 1px var(--material-color,#777)}
.builder-page .materials-row button small{font-size:10px}
.builder-page .color-row{flex-wrap:nowrap;overflow-x:auto;gap:11px;padding:5px 4px 8px;margin-top:11px;scrollbar-width:thin;overscroll-behavior-x:contain}
.builder-page .color-row button{flex:0 0 38px;width:38px;height:38px;min-width:38px}
.random-row{display:flex;flex-wrap:wrap;gap:7px;margin-top:11px}
.dice-btn{border:1px solid var(--line-2);border-radius:10px;padding:8px 10px;background:var(--paper);font-size:12px;font-weight:700;cursor:pointer}
.block>.dice-btn{margin-top:10px}
.dice-btn:hover{border-color:var(--accent);background:var(--accent-soft)}
.builder-page .lock-toggle{font-size:11px;font-weight:600;line-height:1.4;margin:12px 0}
.builder-page .toggle{font-size:12px}
.builder-page .toggle input{flex:none;width:18px;height:18px}
.color-tools{display:flex;gap:14px;justify-content:space-between;align-items:center;font-size:11px;margin-top:12px}
.builder-page .layout-grid{display:flex;overflow-x:auto;gap:8px;padding:2px 2px 8px;scrollbar-width:thin}
.builder-page .layout-grid button{flex:0 0 100px;min-width:100px;max-width:100px;padding:7px;font-size:11px;grid-template-rows:76px auto auto}
.builder-page .layout-grid button svg{height:76px;width:100%}
.builder-page .tray-tabs{margin-bottom:14px}
.builder-page .tray-tabs button{padding:8px 4px;font-size:12px}
.decoration-modes{display:grid;grid-template-columns:1fr 1fr 1.2fr;gap:7px}
.decoration-modes button{border:1.5px solid var(--line-2);border-radius:12px;padding:10px 7px;font-size:12px;font-weight:700;background:var(--paper);cursor:pointer}
.decoration-modes button[aria-pressed=true]{border-color:var(--accent);background:var(--accent-soft)}
.builder-page .field input{font-size:16px}
.builder-page .field>span{font-size:13px}
.builder-page .field>span small{color:var(--muted)}
.builder-page .field small{font-size:11px}
.upload-label{display:grid;gap:10px;border:1px dashed var(--accent);border-radius:14px;padding:14px;font-size:13px;background:var(--paper)}
.upload-label span{font-weight:700}
.upload-label input{width:100%;font-size:12px}
.upload-status{font-size:13px;overflow-wrap:anywhere}
.upload-status[data-error=true]{color:#a53525}
.builder-page .next-step{width:100%;font-size:13px;padding:12px 16px}
.builder-page .qty input{width:60px;min-width:0;text-align:center;border:0;background:transparent;font-size:17px;font-weight:700;-moz-appearance:textfield}
.builder-page .qty input::-webkit-inner-spin-button,.builder-page .qty input::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}
.builder-page .quality-switch{margin:0 0 20px}
.builder-page .quality-switch .seg{max-width:100%;border-radius:15px}
.builder-page .quality-switch .seg button{padding:8px 12px;font-size:12px}
.builder-page .quality-switch>span{font-size:11px}
.builder-page .sticky-buy{position:relative;bottom:auto;right:auto;width:100%;height:var(--builder-buy);padding:12px 24px;grid-row:3;gap:12px;z-index:30}
.builder-page .sticky-buy .sum{margin-right:auto}
.builder-page .sticky-buy .sum b{font-size:23px}
.builder-page .sticky-buy .btn{font-size:13px;padding:13px 20px}
.builder-page .sticky-buy .sum span{font-size:10px}
.builder-page .toast{bottom:calc(var(--builder-buy) + 14px)}
@media(min-width:981px){.builder-page .sticky-buy{padding-left:calc(53.5% + 24px)}}
@media(max-width:980px){
  .builder-page{--builder-header:58px;--builder-buy:calc(76px + env(safe-area-inset-bottom));--preview-h:clamp(220px,36dvh,350px)}
  .builder-page .builder{grid-template-columns:1fr;grid-template-rows:var(--preview-h) minmax(0,1fr)}
  .builder-page .build-stage{height:100%;border-right:0;border-bottom:1px solid var(--line)}
  .builder-page .stage-note{top:8px;left:16px;right:16px;font-size:10px;line-height:1.35;max-width:460px}
  .builder-page .build-stage canvas,.builder-page .organizer-stage{inset:41px 0 47px;height:calc(100% - 88px)}
  .builder-page .stage-toolbar{bottom:7px;gap:4px;left:6px;right:6px;flex-wrap:nowrap}
  .builder-page .stage-toolbar .chip-btn,.builder-page .stage-toolbar .seg button{padding:7px 9px;font-size:11px}
  .builder-page .stage-toolbar .seg{padding:3px}
  .panel-head{padding:10px 15px 0}
  .builder-heading{margin-bottom:7px;min-height:29px;gap:10px}
  .builder-heading h1{font-size:15px}
  .back-btn{padding:6px 9px;font-size:11px}
  .builder-page .steps-nav button{font-size:11px;padding:8px 4px}
  .builder-page .product-switch{margin-bottom:9px}
  .builder-page .product-switch button{padding:7px 10px;font-size:12px}
  .builder-page .product-switch small{font-size:10px}
  .panel-body{padding:13px 15px 24px}
  .builder-page .block{margin-bottom:17px}
  .builder-page .block h2{font-size:13px;margin-bottom:10px}
  .builder-page .materials-row{grid-template-columns:repeat(3,minmax(0,1fr))}
  .builder-page .materials-row button{min-height:51px;padding:7px 6px;font-size:10px}
  .builder-page .presets{grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
  .builder-page .preset{padding:10px 8px;min-height:98px;font-size:11px}
  .builder-page .sticky-buy{padding:9px 15px calc(9px + env(safe-area-inset-bottom))}
  .builder-page .sticky-buy .btn{padding:12px 14px;font-size:12px;max-width:55%;line-height:1.3}
  .builder-page .sticky-buy .sum b{font-size:20px}
  .builder-page .sticky-buy .sum span{max-width:160px;line-height:1.35}
}
@media(max-height:680px) and (max-width:980px){.builder-page{--preview-h:195px;--builder-header:50px;--builder-buy:calc(65px + env(safe-area-inset-bottom))}.builder-page .site-header .logo{font-size:18px}.builder-page .build-stage canvas{inset:34px 0 43px;height:calc(100% - 77px)}.builder-page .stage-note{font-size:9px}.panel-body{padding-top:9px}}
@media(max-width:380px){.builder-page .stage-toolbar .chip-btn,.builder-page .stage-toolbar .seg button{padding:7px;font-size:10px}.builder-page .presets{grid-template-columns:repeat(2,minmax(0,1fr))}.builder-heading h1{font-size:13px}.decoration-modes button{font-size:10px}}
@media(prefers-reduced-motion:reduce){.builder-page *{scroll-behavior:auto!important}}
/* Three ways to choose colours, and automatic matching folded under one button. */
.path-cards{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:6px 0 18px}
.path-cards button{display:grid;gap:4px;justify-items:start;text-align:left;padding:12px;border-radius:16px;border:1.5px solid var(--line);background:var(--paper);cursor:pointer}
.path-cards button span{font-size:22px}
.path-cards button b{font:700 14px/1.2 var(--display)}
.path-cards button small{color:var(--muted);font-size:12px;line-height:1.3}
.path-cards button[aria-pressed=true]{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft)}
@media(max-width:560px){.path-cards{grid-template-columns:1fr}.path-cards button{grid-template-columns:auto 1fr;column-gap:10px}.path-cards button span{grid-row:1/3}}
.harmony-toggle{width:100%;display:flex;justify-content:space-between;align-items:center;padding:13px 16px;border-radius:14px;border:1.5px dashed var(--line-2);background:transparent;font-weight:800;font-size:15px;cursor:pointer}
.harmony-toggle[aria-expanded=true]{border-style:solid;border-color:var(--accent)}
.harmony-toggle[aria-expanded=true] span{transform:rotate(180deg)}
#harmony-body{display:grid;gap:10px;margin-top:12px}
.harmony-style{display:flex;align-items:center;gap:10px;font-weight:700}
.harmony-style select{flex:1;padding:10px 12px;border-radius:12px;border:1.5px solid var(--line-2);background:var(--paper);font:inherit;font-weight:700}
.harmony-about{margin:0}
.harmony-roll{width:100%;font-size:17px;padding:16px}
.harmony-count{margin:0;text-align:center;font-weight:800;color:var(--accent)}
.harmony-count.flash{animation:harmony-flash .7s ease}
@keyframes harmony-flash{0%{transform:scale(1.25);opacity:.4}100%{transform:none;opacity:1}}
.harmony-history{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.harmony-history>span{font-size:12px;font-weight:700;color:var(--muted);margin-left:4px}
.harmony-history .dots{display:flex;padding:4px 6px;border-radius:999px;border:1.5px solid var(--line);background:var(--paper);cursor:pointer}
.harmony-history .dots[aria-pressed=true]{border-color:var(--ink)}
.harmony-history .dots i{width:14px;height:14px;border-radius:50%;margin-right:-4px;border:1.5px solid #fff}
.harmony-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.harmony-more summary{cursor:pointer;font-weight:700;color:var(--muted)}
.harmony-keep{display:flex;flex-wrap:wrap;gap:6px;margin:8px 0}
.harmony-keep button{border:1.5px solid var(--line);border-radius:999px;padding:6px 11px;background:var(--paper);font-weight:700;font-size:12px;cursor:pointer}
.harmony-keep button[aria-pressed=true]{border-color:var(--ink);background:var(--ink);color:#fff}
