/* 3D Studio — bounded model viewport and independently scrolling inspector. */
.designer-body { --studio-orange: #ffa15c; --studio-muted: #a6a7ad; --studio-border: #2c2e33; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; background: #111214; color: #eeeef0; }
.designer-body section { padding: 0; }
.studio-symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.designer-body svg:not(.studio-symbols):not(.template-art svg) { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.designer-body .sr-only, .accessible-file { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.designer-body button:disabled { cursor: default; opacity: .35; }
.guest-design-note { margin: 0 0 18px; padding: 12px 14px; border: 1px solid #4a3930; border-radius: 9px; background: #241d18; color: #efc9aa; font-size: .76rem; line-height: 1.7; }
#previewQuality { display: block; margin-top: 5px; color: #c9c3ba; font-size: .66rem; }
#previewQuality[hidden] { display: none; }
.designer-body button, .designer-body input, .designer-body select { -webkit-tap-highlight-color: transparent; }
.designer-body .btn-primary { background: #f89044; color: #19120d; border-color: #f89044; font-size: .77rem; font-weight: 700; }
.designer-body .btn-primary:hover { background: #ffab6c; border-color: #ffab6c; }
.designer-body .btn-ghost { background: #212226; color: #e5e5e8; border-color: var(--studio-border); }
.designer-body .btn-sm { padding: .7rem .85rem; border-radius: 8px; }
.designer-body .btn-full { justify-content: center; width: 100%; font-size: .78rem; padding: .85rem; }
.app-header { height: 68px; padding: 0 20px; border-bottom: 1px solid var(--studio-border); display: flex; align-items: center; gap: 22px; background: #17181b; position: relative; z-index: 5; }
.app-brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.app-brand img { width: 32px; height: 37px; object-fit: contain; }
.app-brand span { display: flex; flex-direction: column; line-height: 1.1; }
.app-brand strong { font-family: var(--font-heading); font-size: 1.2rem; font-weight: 800; letter-spacing: .04em; color: #f6f3ee; }
.app-brand strong b { color: var(--studio-orange); font-weight: 600; }
.app-brand small { margin-top: 5px; color: #a6a7ad; font: .5rem var(--font-mono); letter-spacing: .11em; }
.project-tools { display: flex; align-items: center; gap: 5px; padding-left: 18px; border-left: 1px solid var(--studio-border); }
.header-tool { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 10px; border-radius: 7px; background: transparent; color: #bfc0c5; font-size: .74rem; white-space: nowrap; }
.header-tool:hover { color: #fff; background: #2b2d32; }
.header-tool svg { width: 17px !important; height: 17px !important; }
.app-header-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.save-state { margin-left: 12px; color: #a7b4aa; font-size: .63rem; white-space: nowrap; }
.save-state::before { content: ''; display: inline-block; width: 5px; height: 5px; margin-right: 7px; border-radius: 50%; background: #7cbe95; }

.designer-shell { height: calc(100vh - 68px); height: calc(100dvh - 68px); min-height: 0; display: grid; grid-template-columns: 82px minmax(0,1fr) 354px; }
.workflow-rail { min-height: 0; display: flex; flex-direction: column; align-items: stretch; padding: 14px 8px 10px; background: #17181b; border-right: 1px solid var(--studio-border); }
.workflow-tabs { display: flex; flex-direction: column; gap: 8px; }
.workflow-tab { position: relative; min-height: 76px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: #a6a7ad; }
.workflow-tab span { font-size: .63rem; line-height: 1.4; white-space: nowrap; }
.workflow-tab small { position: absolute; top: 5px; right: 6px; font: .45rem var(--font-mono); opacity: .5; }
.workflow-tab svg { width: 22px !important; height: 22px !important; }
.workflow-tab:hover { background: #222327; color: #f2f2f4; }
.workflow-tab.active { color: #ffb578; background: #35281f; border-color: #664329; }
.history-tools { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: auto; padding-top: 18px; }
.history-tools button { width: 42px; height: 36px; display: grid; place-items: center; border-radius: 7px; background: transparent; color: #b8bac1; }
.history-tools button:hover:not(:disabled) { color: #fff; background: #292b30; }
.history-tools svg { width: 18px !important; height: 18px !important; }
.studio-home { display: flex; flex-direction: column; align-items: center; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--studio-border); color: #a6a7ad; line-height: 1.3; }
.studio-home span { margin-top: 4px; font-size: .57rem; }
.studio-home:hover { color: var(--studio-orange); }

.preview-stage { min-width: 0; min-height: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; background: #151619; overflow: hidden; }
.stage-toolbar { min-height: 57px; padding: 9px 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; border-bottom: 1px solid var(--studio-border); background: #191a1e; }
.view-switch { display: flex; padding: 3px; background: #111215; border: 1px solid #303136; border-radius: 8px; }
.view-switch button { min-width: 33px; padding: 5px 9px; background: transparent; color: #aeb0b7; border-radius: 5px; font-size: .69rem; }
.view-switch button.active { background: #37332f; color: #ffc08d; font-weight: 700; box-shadow: 0 1px 3px #0004; }
.view-switch button:hover:not(.active) { color: #fff; }
.stage-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.icon-action { padding: 7px 8px; border: 1px solid #33343a; background: #232429; border-radius: 6px; color: #b7b9c0; font-size: .65rem; white-space: nowrap; }
.icon-action:hover { border-color: #8c6546; color: #ffc08d; }
.icon-action.active, .icon-action[aria-pressed="true"] { border-color: #795235; color: #ffc08d; background: #342a22; }
.canvas-wrap { position: relative; min-height: 0; min-width: 0; width: 100%; height: 100%; overflow: hidden; cursor: grab; touch-action: none; user-select: none; isolation: isolate; }
.canvas-wrap:active { cursor: grabbing; }
.canvas-wrap.can-drag { cursor: move; }
.dimension-overlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; overflow: visible; }
.dimension-overlay line { stroke: var(--studio-orange, #ff9f45); stroke-width: 1.2; }
.dimension-overlay line.dim-guide { stroke-dasharray: 3 3; opacity: .55; }
.dimension-overlay text { fill: #fff3e3; font: 600 12px/1 "IBM Plex Mono", ui-monospace, monospace; paint-order: stroke; stroke: #11151c; stroke-width: 4px; stroke-linejoin: round; }
.move-readout { position: absolute; left: 50%; top: 58px; transform: translateX(-50%); z-index: 2; padding: 6px 12px; border-radius: 999px; background: rgb(17 21 28 / .86); border: 1px solid rgb(255 159 69 / .5); color: #fff3e3; font: 600 12px/1.4 "IBM Plex Mono", ui-monospace, monospace; pointer-events: none; white-space: nowrap; }
.canvas-wrap:focus-visible { outline: 2px solid var(--studio-orange); outline-offset: -2px; }
.build-progress { position: absolute; z-index: 3; bottom: 18px; left: 12px; right: 12px; width: min(440px, calc(100% - 24px)); margin: auto; padding: 14px 16px; border: 1px solid #886243; border-radius: 12px; background: #202126f5; color: #f3e5d9; box-shadow: 0 8px 28px #0005; cursor: default; touch-action: auto; }
.build-progress-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.build-progress-heading strong { font-size: .8rem; }
#buildElapsed { color: #c2c5ce; font-size: .68rem; font-variant-numeric: tabular-nums; }
.build-progress p { margin: 8px 0 3px; font-size: .72rem; line-height: 1.65; }
.build-progress small { display: block; color: #d1b79f; font-size: .65rem; }
.build-progress-track { height: 3px; margin-top: 10px; overflow: hidden; border-radius: 3px; background: #474039; }
.build-progress-track span { display: block; width: 35%; height: 100%; background: #ffb578; animation: build-wait 1.5s ease-in-out infinite alternate; }
.build-progress[data-state="done"] { border-color: #638d70; }
.build-progress[data-state="error"] { border-color: #ce877b; }
.build-progress:not([data-state="working"]) .build-progress-track { display: none; }
#buildRetry { margin-top: 10px; padding: 9px 14px; border-radius: 6px; background: #ffb578; color: #26180e; font-size: .75rem; }
.text-build-status { margin: 7px 0 0; color: #b7bdc7; font-size: .7rem; line-height: 1.6; }
.text-build-status[data-state="working"] { color: #ffc08d; }
.text-build-status[data-state="done"] { color: #a9d6b5; }
.text-build-status[data-state="error"] { color: #ffbeb1; }
@keyframes build-wait { to { transform: translateX(185%); } }
@media (prefers-reduced-motion: reduce) { .build-progress-track span { animation: none; width: 100%; opacity: .65; } }
#designCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.viewport-caption { position: absolute; z-index: 2; top: 23px; left: 25px; display: flex; flex-direction: column; gap: 5px; pointer-events: none; max-width: calc(100% - 110px); }
.viewport-eyebrow { color: #8d919b; font: .52rem var(--font-mono); letter-spacing: .18em; }
#viewportStatus { color: #c5c7cd; font-size: .67rem; }
.dimension-chip { position: absolute; z-index: 2; padding: 4px 8px; border: 1px solid #e8a27338; border-radius: 5px; background: #16181bdd; color: #dbb79d; font: .62rem var(--font-mono); pointer-events: none; }
.dimension-width { left: 50%; bottom: 58px; transform: translateX(-50%); }
.dimension-depth { right: 23px; top: 23px; }
.viewport-material { position: absolute; bottom: 24px; left: 25px; display: flex; align-items: center; gap: 6px; color: #c4c7cc; font: .59rem var(--font-mono); pointer-events: none; }
.viewport-material i { width: 6px; height: 6px; background: #d4a788; border-radius: 50%; }
.viewport-material span { color: #92959f; font: .6rem var(--font-body); }
.drag-hint { position: absolute; bottom: 24px; right: 25px; display: flex; gap: 13px; color: #92959f; font-size: .6rem; white-space: nowrap; pointer-events: none; }
.drag-hint span + span::before { content: '·'; margin-right: 13px; color: #60636d; }
.quick-metrics { min-width: 0; display: grid; grid-template-columns: 1.35fr 1fr 1fr 1fr; min-height: 87px; border-top: 1px solid var(--studio-border); background: #1a1b1f; }
.quick-metrics > div { min-width: 0; padding: 15px 16px 11px; border-right: 1px solid var(--studio-border); }
.quick-metrics > div:last-child { border-right: 0; }
.quick-metrics span { display: block; margin-bottom: 4px; color: #a5a7b0; font-size: .59rem; }
.quick-metrics strong { color: #f0f0f2; font: 700 .68rem var(--font-mono); overflow-wrap: anywhere; }
.quick-metrics .metric-price strong { color: #ffb77d; font-size: 1.13rem; line-height: 1.4; }
.quick-metrics small { display: block; color: #a4a6af; font-size: .5rem; line-height: 1.4; }

.control-panel { min-height: 0; min-width: 0; display: flex; flex-direction: column; background: #1b1c20; border-left: 1px solid var(--studio-border); overflow: hidden; }
.control-scroll { min-height: 0; flex: 1; overflow-y: auto; overflow-x: hidden; scrollbar-gutter: stable; }
.inspector-panel { min-width: 0; }
.panel-heading { padding: 22px 22px 19px; }
.panel-kicker { display: block; margin-bottom: 7px; color: #d8a17a; font: .5rem var(--font-mono); letter-spacing: .12em; }
.panel-heading h1, .panel-heading h2 { color: #f1f0ed; font-size: 1.25rem; font-weight: 600; line-height: 1.5; letter-spacing: -.015em; }
.panel-heading p { margin-top: 3px; color: #a4a6af; font-size: .72rem; }
.template-search { position: relative; margin: 0 20px 14px; }
.template-search svg { position: absolute; left: 11px; top: 11px; width: 16px !important; height: 16px !important; color: #9ea1aa; pointer-events: none; }
.template-search input { width: 100%; height: 38px; padding: 8px 12px 8px 35px; background: #141519; border: 1px solid #34363d; border-radius: 7px; color: #efeff2; font-size: .72rem; }
.template-search input::placeholder { color: #9598a3; }
.template-categories { display: flex; gap: 5px; margin: 0 20px 17px; }
.template-categories button { padding: 5px 10px; border: 1px solid transparent; border-radius: 20px; background: #25262b; color: #acafb8; font-size: .65rem; white-space: nowrap; }
.template-categories button.active { color: #ffd0ad; background: #3d2c20; border-color: #754b2d; }
.template-categories button:hover { color: #fff; }
.style-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; padding: 0 20px; }
.style-option { min-width: 0; text-align: left; padding: 0 0 10px; color: #eeeef0; background: #212327; border: 1px solid #383a41; border-radius: 10px; overflow: hidden; transition: border-color .15s, background .15s; }
.style-option:hover { border-color: #a0785b; background: #282a2e; }
.style-option.active { border-color: #f5a16b; box-shadow: 0 0 0 1px #f5a16b55; background: #302923; }
.template-art { position: relative; display: block; width: 100%; aspect-ratio: 1.5; border-bottom: 1px solid #ffffff09; overflow: hidden; }
.template-art svg { width: 100%; height: 100%; display: block; transition: transform .25s; }
.template-art text { font: 900 23px sans-serif; }
.style-option:hover .template-art svg { transform: translateY(-2px) scale(1.025); }
.style-option.active .template-art::after { content: '✓'; position: absolute; right: 7px; top: 7px; width: 17px; height: 17px; border-radius: 50%; background: #ffc290; color: #3d2819; font: 700 10px/17px sans-serif; text-align: center; }
.art-nameplate { background: radial-gradient(ellipse at 50% 20%,#4b3d36,#29282a); }
.art-keychain { background: radial-gradient(ellipse at 50% 20%,#48453a,#28292a); }
.art-clicker { background: radial-gradient(ellipse at 50% 20%,#423d50,#29292e); }
.art-lightbox { background: radial-gradient(ellipse at 50% 70%,#55412a,#292728); }
.art-infinity { background: radial-gradient(ellipse at 50% 65%,#204c4c,#20292c 64%,#1c2023); }
.art-doublelight { background: radial-gradient(ellipse at 50% 60%,#5a3427,#2c2624 64%,#202123); }
.art-trimcap { background: radial-gradient(ellipse at 50% 70%, #514736, #272822 65%, #202123); }
.art-fullcolor { background: radial-gradient(ellipse at 50% 70%, #314c58, #212731 65%, #202123); }
.reference-template .template-art { position: relative; }
.template-badge { position: absolute; top: 7px; left: 8px; color: #e4d7bd; font-size: 9px; letter-spacing: .15px; font-weight: 500; }
.trimcap-controls { background: linear-gradient(160deg, #343026, #272523); }
.fullcolor-controls { background: linear-gradient(160deg, #253a3c, #242930); }
.art-five-d { background: radial-gradient(ellipse at 50% 52%,#554b25,#2d2b24 63%,#202123); }
.art-desk { background: radial-gradient(ellipse at 50% 20%,#344b44,#282d2d); }
.art-badge { background: radial-gradient(ellipse at 50% 20%,#354650,#272b30); }
.art-stacked { background: radial-gradient(ellipse at 50% 20%,#49353c,#2b282c); }
.art-outline { background: radial-gradient(ellipse at 50% 20%,#424637,#292c29); }
.art-keycap { background: radial-gradient(ellipse at 50% 30%,#4d3a2c,#28262a 66%,#202123); }
.keycap-controls { background: linear-gradient(160deg, #362c25, #262427); }
.style-option strong { display: block; margin: 9px 10px 1px; font-size: .73rem; font-weight: 600; }
.style-option small { display: block; margin: 0 10px; color: #b1afb1; font-size: .54rem; line-height: 1.6; }
.panel-note { margin: 19px 20px 24px; color: #a0a3ad; font-size: .64rem; line-height: 1.9; }
.control-section { padding: 18px 22px; border-top: 1px solid var(--studio-border); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.section-heading h3 { font-size: .78rem; color: #efeff1; font-weight: 600; }
.section-heading > small { color: #a9abb4; font: .58rem var(--font-mono); }
.section-heading > svg { color: #9ca0aa; width: 16px !important; height: 16px !important; }
.small-tag { color: #b0adb0; font-size: .56rem; }
.control-group { min-width: 0; margin-bottom: 13px; }
.control-group:last-child { margin-bottom: 0; }
.control-group label, .range-control label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; color: #bfc1c9; font-size: .7rem; }
.designer-input { width: 100%; padding: 10px 11px; color: #efeff2; background: #141519; border: 1px solid #383a43; border-radius: 7px; font-size: .75rem; }
.designer-input:focus { border-color: #c18b64; }
.designer-input option { background: #1b1c20; }
.text-input { padding: 12px; font-size: 1.06rem; }
textarea.text-input { display: block; width: 100%; min-height: 3.4em; resize: vertical; line-height: 1.45; font-family: inherit; }
.text-input::placeholder { color: #858992; }
.range-control { margin: 15px 0; }
.range-control:last-child { margin-bottom: 0; }
.range-control output { color: #c9a88d; font: .59rem var(--font-mono); white-space: nowrap; }
.range-inputs { display: flex; align-items: center; gap: 14px; }
.range-inputs input[type="range"] { flex: 1; min-width: 0; width: 100%; height: 20px; accent-color: #eaa272; cursor: pointer; }
.range-inputs input[type="number"] { width: 63px; flex-shrink: 0; padding: 6px 4px 6px 8px; border: 1px solid #3b3d46; border-radius: 6px; background: #15161a; color: #e2e3e7; font: .66rem var(--font-mono); }
.advanced-controls { margin-top: 16px; border-top: 1px solid var(--studio-border); }
.advanced-controls summary { padding: 11px 0 2px; color: #bcbdc5; cursor: pointer; font-size: .7rem; }
.advanced-controls[open] summary { color: #e8ae83; }
.image-upload-button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 21px 10px; border: 1px dashed #59504a; border-radius: 9px; background: #25221f; color: #edb895; cursor: pointer; text-align: center; }
.image-upload-button svg { width: 27px !important; height: 27px !important; }
.image-upload-button strong { font-size: .76rem; font-weight: 500; }
.image-upload-button span { color: #b0a59e; font-size: .57rem; }
.image-upload-button:hover { border-color: #eca16c; background: #30261f; }
.accessible-file:focus-visible + .image-upload-button { outline: 2px solid var(--studio-orange); outline-offset: 3px; }
.image-file-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.image-file-row small { overflow: hidden; color: #9fa2ad; font-size: .62rem; text-overflow: ellipsis; white-space: nowrap; }
.image-file-row button { padding: 3px 7px; border-radius: 4px; background: #422b2c; color: #efb0a7; font-size: .62rem; flex-shrink: 0; }
.image-clear-all { width: 100%; margin-top: 12px; padding: 9px 12px; border: 1px solid #704146; border-radius: 7px; background: #332326; color: #f0b4b7; font-size: .7rem; text-align: left; }
.image-clear-all:hover, .image-clear-all:focus-visible { border-color: #dc858b; background: #493034; color: #fff; }
.image-adjustments { padding-top: 3px; }
.image-color-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 15px; color: #bfc1c9; font-size: .7rem; }
.image-color-label input { width: 65px; height: 30px; padding: 0; border: 0; background: transparent; }
.text-action { background: transparent; color: #e9ae81; font-size: .65rem; }
.text-action:hover { color: #ffceab; }
.color-row { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; }
.color-row label { color: #b0b3bd; font-size: .64rem; text-align: center; }
.color-row input { display: block; width: 100%; height: 37px; margin-bottom: 5px; padding: 3px; border: 1px solid #42444c; border-radius: 7px; background: #282a30; cursor: pointer; }
.color-row input::-webkit-color-swatch-wrapper { padding: 0; }
.color-row input::-webkit-color-swatch { border: 0; border-radius: 4px; }
.field-help { margin-top: 10px; color: #a4a7b1; font-size: .62rem; line-height: 1.85; }
.toggle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 17px; }
.toggle-grid label { position: relative; cursor: pointer; }
.toggle-grid input { position: absolute; opacity: 0; }
.toggle-grid span { display: flex; align-items: center; gap: 7px; padding: 9px; color: #aaadb6; background: #23252a; border: 1px solid #383a42; border-radius: 7px; font-size: .66rem; }
.toggle-grid span::before { content: ''; width: 11px; height: 11px; border: 1px solid #72757f; border-radius: 3px; }
.toggle-grid input:checked + span { color: #f2c3a1; border-color: #715139; background: #33291f; }
.toggle-grid input:checked + span::before { content: '✓'; display: grid; place-items: center; background: #efb080; color: #302319; border-color: #efb080; font: 700 9px sans-serif; }
.toggle-grid input:focus-visible + span { outline: 2px solid #ffb578; outline-offset: 2px; }
.specialty-controls { background: #26221f; }
.specialty-controls .section-heading h3 { color: #edbc98; }
.shape-controls { background: #242321; }
.shape-controls .section-heading h3 { color: #f1c39e; }
.shape-controls .small-tag { color: #c5b3a2; }
.shape-controls .field-help { margin-top: 13px; }
.infinity-controls { background: linear-gradient(180deg,#202b2b,#222523); }
.infinity-controls .section-heading h3 { color: #aef4e8; }
.doublelight-controls { background: linear-gradient(180deg,#2b2420,#272321); }
.doublelight-controls .section-heading h3 { color: #ffc19e; }
.five-d-controls { background: linear-gradient(180deg,#29271f,#252421); }
.five-d-controls .section-heading h3 { color: #f0d77b; }
.production-caveat { padding: 10px 11px; border: 1px solid #5c5540; border-radius: 7px; background: #1b1c1dcc; }
.production-caveat strong { color: #f3d89b; font-weight: 600; }
.infinity-export-options { margin-top: 18px; padding: 15px; border: 1px solid #4c4941; border-radius: 9px; background: #222321; }
.infinity-export-options .section-heading { margin-bottom: 14px; }
.infinity-export-options .section-heading h3 { color: #e9d6b4; }
.cut-format-control { padding-top: 2px; }
.cut-download { margin-top: 3px; }
.production-file-note { margin-top: 14px; padding-top: 11px; border-top: 1px solid #41423e; }
.production-file-note p { color: #afb1b0; font-size: .61rem; line-height: 1.75; }
.production-file-note p + p { margin-top: 7px; }
.production-file-note strong { color: #dfc9a8; font-weight: 600; }
.template-art.art-keychain text, .template-art.art-nameplate text { font-family: "Sarabun", sans-serif; font-weight: 800; }
.quantity-control { display: flex; align-items: center; justify-content: space-between; margin: 17px 0; color: #bfc1c9; font-size: .7rem; }
.quantity-control > div { display: flex; align-items: center; border: 1px solid #3a3c44; border-radius: 7px; overflow: hidden; }
.quantity-control button, .quantity-control output { width: 33px; height: 31px; display: grid; place-items: center; background: #26282e; color: #e8e9ed; }
.quantity-control button:hover { background: #3b3330; }
.quantity-control output { border-inline: 1px solid #3a3c44; background: #16171b; font: .7rem var(--font-mono); }
.price-summary { margin: 16px 0; padding: 14px; border-radius: 9px; background: #30261f; border: 1px solid #58402d; }
.price-summary > div { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; color: #c7b5a7; font-size: .65rem; }
.price-summary strong { color: #f4decf; font-size: .67rem; white-space: nowrap; }
.price-summary p { margin-top: 11px; padding-top: 10px; border-top: 1px solid #554132; color: #c1aa98; font-size: .6rem; line-height: 1.8; }
.control-panel .btn + .btn { margin-top: 8px; }
.estimate-link { display: block; color: #e3b18c; font-size: .7rem; }
.estimate-link:hover { text-decoration: underline; }
.reset-action { margin-top: 18px; padding: 7px 0; background: transparent; color: #ad9693; font-size: .66rem; }
.reset-action:hover { color: #f3b2a5; }
.parts-list { display: flex; flex-direction: column; gap: 6px; }
.part-row { display: grid; grid-template-columns: 18px minmax(0,1fr) 30px; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 7px; background: #23252a; }
.part-row > input[type="checkbox"] { width: 15px; height: 15px; accent-color: #efb080; cursor: pointer; }
.part-row > input[type="color"] { width: 30px; height: 28px; padding: 2px; background: #363840; border: 1px solid #51545e; border-radius: 5px; cursor: pointer; }
.part-row > input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.part-row > input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 3px; }
.part-row > input:disabled { cursor: default; opacity: .4; }
.parts-list .part-row > button { min-width: 0; padding: 7px 8px; background: transparent; border-color: transparent; overflow-wrap: anywhere; }
.parts-list .part-row > button.active, .parts-list .part-row > button[aria-pressed="true"] { border-color: #a57552; background: #362d27; }
.toggle-grid input:disabled + span { opacity: .55; cursor: default; }
.designer-status.error { background: #3b2424; color: #ffbeb1; }
#viewportStatus.error { color: #ffb5a4; }
.parts-list button, .part-item { width: 100%; display: flex; align-items: center; gap: 8px; padding: 9px 10px; background: #24262c; color: #c4c7d0; border: 1px solid #3a3d46; border-radius: 7px; text-align: left; font-size: .7rem; }
.parts-list button.active, .parts-list button[aria-pressed="true"], .part-item.active { border-color: #a57552; background: #362d27; color: #ffd2b1; }
.parts-list small { color: #afb1ba; margin-left: auto; font-size: .58rem; }
.selected-part { margin-bottom: 10px; color: #a6a9b2; font-size: .65rem; }
#selectedPartName { color: #e8b38d; }
.design-warnings:not(:empty) { margin-top: 14px; padding: 10px 12px; border: 1px solid #776134; border-radius: 7px; background: #3a3021; color: #e8ca94; font-size: .65rem; line-height: 1.85; }
.design-warnings ul { padding-left: 16px; }
.designer-status { flex-shrink: 0; min-height: 0; padding: 0 20px; color: #bbd6c1; font-size: .66rem; line-height: 1.7; overflow-wrap: anywhere; }
.designer-status:not(:empty) { padding-top: 9px; padding-bottom: 9px; border-top: 1px solid var(--studio-border); background: #242923; }
.inspector-footer { flex-shrink: 0; display: flex; align-items: center; gap: 6px; padding: 10px 17px; border-top: 1px solid var(--studio-border); background: #18191d; color: #a4a7b0; font-size: .53rem; }
.footer-dot { width: 5px; height: 5px; border-radius: 50%; background: #83a68a; }
.inspector-footer > span:last-child { margin-left: auto; color: #9b9ea8; font: .45rem var(--font-mono); letter-spacing: .06em; }
.inspector-footer > a { margin-left: auto; color: #bfc4d0; text-underline-offset: 3px; }
.no-script-notice { position: fixed; z-index: 10; inset: auto 16px 16px; padding: 20px; background: #3e2b1e; color: #ffe1c8; border: 1px solid #c48b61; border-radius: 10px; }
.no-script-notice a { text-decoration: underline; }

@media (min-width: 1600px) {
  .designer-shell { grid-template-columns: 88px minmax(0,1fr) 380px; }
  .panel-heading { padding-top: 26px; }
  .template-art { aspect-ratio: 1.45; }
  .style-option strong { font-size: .8rem; }
  .style-option small { font-size: .59rem; }
  .quick-metrics strong { font-size: .82rem; }
}
@media (max-width: 1190px) {
  .designer-shell { grid-template-columns: 72px minmax(0,1fr) 326px; }
  .workflow-rail { padding-inline: 5px; }
  .save-state { display: none; }
  .stage-toolbar { justify-content: center; }
  .drag-hint { right: 16px; gap: 8px; font-size: .54rem; }
  .drag-hint span + span::before { margin-right: 8px; }
  .viewport-material span { display: none; }
  .quick-metrics > div { padding: 14px 10px 10px; }
  .quick-metrics span { font-size: .55rem; }
  .quick-metrics strong { font-size: .61rem; }
  .template-categories button { padding-inline: 8px; }
}
@media (max-width: 960px) and (min-width: 841px) {
  .designer-shell { grid-template-columns: 67px minmax(0,1fr) 303px; }
  .app-header { gap: 15px; padding-inline: 14px; }
  .header-tool { padding-inline: 6px; }
  .preview-download span { display: none; }
  .quick-metrics { grid-template-columns: 1.4fr 1fr; }
  .quick-metrics > div { padding: 8px 12px; }
  .quick-metrics > div:nth-child(-n+2) { border-bottom: 1px solid var(--studio-border); }
  .quick-metrics strong { font-size: .64rem; }
  .viewport-material { display: none; }
  .drag-hint { left: 0; right: 0; justify-content: center; }
  .panel-heading, .control-section { padding-inline: 18px; }
  .template-search, .template-categories { margin-inline: 16px; }
  .style-list { padding-inline: 16px; gap: 9px; }
  .style-option small { font-size: .5rem; }
}
@media (max-width: 840px) {
  .designer-body { height: auto; min-height: 100vh; overflow: auto; }
  .app-header { min-height: 64px; height: auto; padding: 11px 16px; gap: 10px; flex-wrap: wrap; }
  .app-brand strong { font-size: 1.1rem; }
  .app-brand small { font-size: .44rem; }
  .app-brand img { width: 28px; height: 33px; }
  .project-tools { padding-left: 10px; gap: 0; }
  .header-tool { padding-inline: 7px; }
  .app-header-actions { gap: 5px; }
  .preview-download span { display: none; }
  .designer-shell { height: auto; min-height: 0; display: grid; grid-template-columns: 1fr; }
  .workflow-rail { padding: 7px 12px; display: flex; flex-direction: row; align-items: center; border-right: 0; border-bottom: 1px solid var(--studio-border); }
  .workflow-tabs { flex: 1; flex-direction: row; gap: 6px; }
  .workflow-tab { flex: 1; min-width: 0; min-height: 58px; gap: 4px; border-radius: 8px; }
  .workflow-tab svg { width: 18px !important; height: 18px !important; }
  .workflow-tab span { font-size: .6rem; }
  .workflow-tab small { display: none; }
  .history-tools { margin-top: 0; padding-top: 0; padding-left: 8px; gap: 1px; }
  .history-tools button { width: 32px; height: 27px; }
  .history-tools svg { width: 15px !important; height: 15px !important; }
  .studio-home { display: none; }
  .preview-stage { height: 530px; height: clamp(420px,62svh,620px); min-height: 0; }
  .stage-toolbar { min-height: 48px; padding: 7px 13px; justify-content: space-between; }
  .view-switch button { padding: 4px 8px; min-width: 30px; }
  .stage-actions { gap: 4px; }
  .icon-action { padding: 6px 7px; font-size: .61rem; }
  .viewport-caption { top: 17px; left: 19px; }
  .dimension-depth { top: 17px; right: 19px; }
  .viewport-material { left: 19px; bottom: 20px; }
  .drag-hint { bottom: 20px; }
  .drag-hint span:first-child { font-size: 0; }
  .drag-hint span:first-child::after { content: 'ลากหนึ่งนิ้วเพื่อหมุน'; font-size: .56rem; }
  .drag-hint span:nth-child(2) { font-size: 0; }
  .drag-hint span:nth-child(2)::after { content: 'สองนิ้วเลื่อน / ซูม'; font-size: .56rem; }
  .drag-hint span:nth-child(3) { display: none; }
  .quick-metrics { min-height: 75px; }
  .quick-metrics > div { padding: 10px 14px; }
  .quick-metrics strong { font-size: .68rem; }
  .control-panel { min-height: 400px; overflow: visible; border-left: 0; border-top: 1px solid var(--studio-border); }
  .control-scroll { overflow: visible; }
  .panel-heading { padding: 23px 22px 18px; }
  .panel-heading h1, .panel-heading h2 { font-size: 1.3rem; }
  .template-search { max-width: 450px; }
  .style-list { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; }
  .style-option strong { font-size: .78rem; }
  .style-option small { font-size: .59rem; }
  .template-categories button { font-size: .7rem; }
  .control-section { padding: 20px 24px; }
  .control-group label, .range-control label { font-size: .79rem; }
  .range-inputs { gap: 24px; }
  .range-inputs input[type="number"] { width: 76px; padding: 8px; font-size: .76rem; }
  .range-control output { font-size: .68rem; }
  .section-heading h3 { font-size: .86rem; }
  .designer-input { font-size: .87rem; }
  .field-help, .panel-note { font-size: .7rem; }
  .inspector-footer { padding: 12px 22px; font-size: .62rem; }
}
@media (max-width: 560px) {
  .app-header { padding: 10px 12px; gap: 8px; }
  .app-brand { gap: 7px; }
  .app-brand strong { font-size: 1rem; }
  .app-brand small { font-size: .39rem; letter-spacing: .08em; }
  .app-brand img { width: 25px; height: 29px; }
  .project-tools { margin-left: auto; border-left: 0; padding-left: 0; }
  .project-tools .header-tool span { display: none; }
  .project-tools .header-tool { padding: 8px 6px; }
  .app-header-actions { margin-left: 0; flex-basis: 100%; justify-content: space-between; }
  .preview-download { display: flex; min-height: 40px; }
  .preview-download span { display: inline; font-size: .65rem; }
  .designer-body .btn-sm { padding: 9px 10px; font-size: .65rem; }
  .app-header-actions .btn svg { width: 15px !important; height: 15px !important; }
  .workflow-rail { padding: 6px 8px; }
  .workflow-tab { min-height: 57px; }
  .workflow-tab span { font-size: .55rem; }
  .history-tools { padding-left: 3px; }
  .history-tools button { width: 26px; }
  .preview-stage { height: clamp(440px,66svh,550px); }
  .stage-toolbar { justify-content: center; gap: 6px; padding: 8px 10px; }
  .view-switch { padding: 2px; }
  .view-switch button { min-width: 32px; padding: 4px 9px; font-size: .63rem; }
  .stage-actions { justify-content: center; }
  .icon-action { font-size: .58rem; padding: 5px 7px; }
  .viewport-caption { left: 16px; top: 16px; }
  .viewport-eyebrow { font-size: .44rem; }
  #viewportStatus { font-size: .6rem; }
  .dimension-depth { top: 16px; right: 16px; font-size: .54rem; }
  .dimension-width { bottom: 48px; font-size: .56rem; }
  .viewport-material { display: none; }
  .drag-hint { left: 0; right: 0; justify-content: center; gap: 10px; }
  .quick-metrics { grid-template-columns: 1.2fr 1fr; min-height: 114px; }
  .quick-metrics > div { padding: 9px 14px; }
  .quick-metrics > div:nth-child(-n+2) { border-bottom: 1px solid var(--studio-border); }
  .quick-metrics > div:nth-child(2) { border-right: 0; }
  .quick-metrics span { font-size: .55rem; margin-bottom: 2px; }
  .quick-metrics strong { font-size: .63rem; }
  .quick-metrics .metric-price { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 6px; }
  .quick-metrics .metric-price strong { font-size: 1.05rem; }
  .quick-metrics .metric-price small { grid-column: 1/-1; font-size: .47rem; }
  .style-list { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .template-art { aspect-ratio: 1.55; }
  .style-option strong { font-size: .82rem; }
  .style-option small { font-size: .61rem; }
  .panel-heading { padding-inline: 20px; }
  .panel-heading p { font-size: .75rem; }
  .control-section { padding: 20px; }
  .toggle-grid span { padding: 11px; font-size: .72rem; }
  .price-summary > div { font-size: .7rem; }
  .price-summary p { font-size: .66rem; }
  .infinity-export-options { padding: 14px; }
  .production-file-note p { font-size: .67rem; }
}
@media (prefers-reduced-motion: reduce) {
  .designer-body *, .designer-body *::before, .designer-body *::after { transition: none !important; scroll-behavior: auto !important; }
}

.bed-dimensions { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-bottom:14px; }
.bed-dimensions label { min-width:0; font-size:12px; color:var(--text-muted, #b0ada6); }
.bed-dimensions input { width:100%; min-width:0; margin-top:6px; }
#bedCheck.bed-warning { color:#ffba82; }

#bedFlag { color:#ffba82; }

/* Colour controls share a modal in the top layer, clear of inspector clipping.
   Visual viewport dimensions also keep it above an on-screen keyboard. */
.studio-color-picker { position: fixed; inset: auto; margin: 0; transform: translate(-50%, -50%); width: min(360px, calc(var(--picker-width, 100vw) - 24px)); max-width: none; max-height: calc(var(--picker-height, 100dvh) - 24px); padding: 20px; overflow: auto; overscroll-behavior: contain; border: 1px solid #595149; border-radius: 16px; background: #202226; color: #f2eeea; box-shadow: 0 18px 70px #0009; }
.studio-color-picker::backdrop { background: #080b11b8; }
.color-picker-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.color-picker-heading h2 { min-width: 0; flex: 1; font-size: 1rem; line-height: 1.5; overflow-wrap: anywhere; }
.color-picker-heading button { flex: 0 0 40px; height: 40px; border-radius: 8px; background: #33363c; color: #eee; font-size: 24px; }
.color-picker-preview { height: 48px; border: 1px solid #ffffff40; border-radius: 8px; margin-bottom: 14px; }
.color-picker-swatches { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.color-picker-swatches button { width: 100%; min-height: 36px; border: 1px solid #ffffff40; border-radius: 7px; }
.color-picker-swatches button[aria-pressed="true"] { outline: 2px solid #ffb578; outline-offset: 2px; }
.color-picker-hex { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 12px; font-size: .85rem; }
.color-picker-hex input { width: 100%; min-width: 0; padding: 10px; border: 1px solid #62656e; border-radius: 7px; background: #15171b; color: #fff; font: 16px var(--font-mono); }
.color-picker-hex input[aria-invalid="true"] { border-color: #ff9393; }
.color-picker-error { color: #ffb6b6; font-size: .8rem; line-height: 1.5; }
.color-picker-error:not(:empty) { margin-top: 8px; }
.color-picker-rgb { display: grid; gap: 8px; margin: 16px 0; }
.color-picker-rgb label { display: grid; grid-template-columns: 48px minmax(0, 1fr) 30px; align-items: center; gap: 10px; font-size: .8rem; }
.color-picker-rgb input { width: 100%; min-width: 0; height: 32px; accent-color: #ffb578; }
.color-picker-rgb output { text-align: right; font-variant-numeric: tabular-nums; }
.color-picker-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
.color-picker-actions button { min-height: 44px; padding: 8px 20px; border-radius: 8px; background: #373a40; color: #eee; font-size: .9rem; }
.color-picker-actions button[type="submit"] { background: #ffa15c; color: #201710; font-weight: 600; }
.studio-color-picker button:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* Custom clicker tools use the existing panel width at every viewport size. */
.clicker-intro { background: linear-gradient(130deg, #203b33, #343829); border-radius: 12px; padding: 16px !important; color: #edf4e7; }
.clicker-intro .field-help { color: #c6d5c9; }
.clicker-check { display: flex; align-items: center; gap: 9px; margin: 12px 0; font-size: .85rem; }
.clicker-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.clicker-mode button { padding: 9px; border: 1px solid #48534d; border-radius: 8px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.clicker-mode button[aria-pressed="true"] { background: #255a4d; color: white; border-color: #255a4d; }
.clicker-icons { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 6px; margin: 12px 0; max-height: 280px; overflow-y: auto; }
.clicker-icons button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 3px; min-width: 0; border: 1px solid #dce5de; border-radius: 8px; background: #f7faf7; cursor: pointer; }
.clicker-icons button:hover, .clicker-icons button:focus-visible { border-color: #3f866e; background: #e5f2e8; }
.clicker-icons img { width: 26px; height: 26px; }
.clicker-icons small { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; color: #456457; }
.clicker-press { display: flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 12px; padding: 9px 14px; background: #eaf2ed; color: #255a4d; font-size: 12px; }
.clicker-press input { width: min(160px, 35vw); accent-color: #3f866e; }
#clickRegionSelect { margin: 6px 0 12px; }
#clickRegionEditor .range-control { margin-top: 12px; }
.clicker-details { margin: 18px 0; padding: 13px; border: 1px solid #3b4941; border-radius: 10px; background: #1c2520; }
.clicker-details > summary { cursor: pointer; color: #d5e5d9; font-weight: 600; font-size: .8rem; }
.clicker-details[open] > summary { margin-bottom: 14px; }
.clicker-details .text-action { white-space: normal; text-align: left; }

/* Fast colour changes and a quiet, full-window presentation of the same model. */
.preview-stage { grid-template-rows: auto auto minmax(0,1fr) auto; }
.finish-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 11px 16px; background: #1c1d21; border-bottom: 1px solid var(--studio-border); }
.finish-bar > label { display: flex; align-items: center; gap: 8px; color: #b9bbc3; font-size: .72rem; }
.finish-bar select { width: 132px; min-width: 0; padding: 7px; border: 1px solid #414149; border-radius: 7px; background: #25262c; color: #eeeef0; font: inherit; }
.finish-swatches { display: flex; align-items: center; gap: 7px; }
.finish-swatches button { position: relative; width: 25px; height: 25px; padding: 0; border: 2px solid #ffffff38; border-radius: 50%; background: var(--swatch); transition: transform .15s; }
.finish-swatches button:hover:not(:disabled) { transform: translateY(-2px); }
.finish-swatches button[aria-pressed="true"] { outline: 2px solid var(--studio-orange); outline-offset: 3px; }
.finish-swatches button:disabled { opacity: .35; cursor: wait; }
.finish-custom input { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 7px; background: none; cursor: pointer; }
#studioShow { margin-left: auto; padding: 9px 13px; background: #ffa15c; color: #26180e; border-radius: 8px; font-size: .74rem; font-weight: 700; white-space: nowrap; }
.finish-bar :focus-visible, .showcase-toolbar button:focus-visible { outline: 2px solid #ffb984; outline-offset: 4px; }
.showcase-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 16px 24px; background: #191a1e; border-bottom: 1px solid #34353b; }
.showcase-title { color: #fff0e2; font-weight: 700; }
.showcase-title small { margin-left: 10px; color: #a3a5ad; font-size: .58rem; letter-spacing: .16em; }
.showcase-controls { display: flex; flex-wrap: wrap; gap: 7px; }
.showcase-controls button { padding: 9px 13px; border: 1px solid #42434b; border-radius: 9px; background: #25262c; color: #d1d3da; font-size: .75rem; }
.showcase-controls button[aria-pressed="true"] { border-color: #c18658; color: #ffd1a9; background: #3a2d23; }
#studioExit { background: #ffa15c; border-color: #ffa15c; color: #26180e; font-weight: 700; }
.designer-body.studio-showing { overflow: hidden; }
.studio-showing .preview-stage { position: fixed; inset: 0; z-index: 1000; width: 100%; height: 100dvh; grid-template-rows: auto minmax(0,1fr); }
.studio-showing .stage-toolbar, .studio-showing .finish-bar, .studio-showing .quick-metrics,
.studio-showing .dimension-chip, .studio-showing .viewport-material, .studio-showing .drag-hint { display: none; }
.studio-showing .viewport-caption { opacity: .75; }
.studio-showing.studio-paper #viewportStatus { color: #484744; }
.studio-showing.studio-paper .viewport-eyebrow { color: #77736d; }
@media (max-width: 760px) {
  .preview-stage { height: clamp(540px,78svh,720px); }
  .finish-bar { gap: 10px; padding: 12px; }
  .finish-bar select { width: 112px; }
  .finish-swatches { order: 3; width: 100%; justify-content: space-between; padding: 3px 2px; }
  .finish-swatches button { width: 30px; height: 30px; }
  .finish-custom { margin-left: auto; }
  #studioShow { margin-left: 0; padding: 9px; }
  .showcase-toolbar { padding: max(12px,env(safe-area-inset-top)) 14px 12px; }
  .showcase-title { font-size: .85rem; }
  .showcase-controls { gap: 6px; }
  .showcase-controls button { padding: 10px; font-size: .72rem; }
}
@media (prefers-reduced-motion: reduce) { .finish-swatches button { transition: none; } }

.send-shop-done { display: grid; gap: 8px; }
.send-shop-done[hidden] { display: none; }
.send-shop-done b { font-size: 1.05rem; color: #7cbe95; }
.send-shop-done p { margin: 0; }
a.header-tool { text-decoration: none; }
#sendShopForm > [hidden] { display: none !important; }

/* Send-to-shop dialog: its base styles live in member.css, which the designer does not load. */
.send-shop-dialog { width: min(460px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 24px; margin: auto; background: #1b1c20; color: #eeeef0; border: 1px solid #383a43; border-radius: 14px; box-shadow: 0 24px 60px #000a; font-family: var(--font-body); }
.send-shop-dialog::backdrop { background: #0b0a09b3; }
.send-shop-dialog h2 { margin: 0 0 6px; font-size: 1.2rem; line-height: 1.4; color: #fff; }
.send-shop-dialog form > p { margin: 0 0 18px; color: #a4a7b1; font-size: .78rem; line-height: 1.75; }
.send-shop-dialog .control-group { margin-bottom: 14px; }
.send-shop-dialog .control-group label { font-size: .76rem; }
.send-shop-dialog .designer-input { font-size: .85rem; padding: 11px 12px; }
.send-shop-dialog .admin-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.send-shop-dialog .btn { padding: 10px 16px; border-radius: 8px; font-size: .82rem; font-weight: 700; text-decoration: none; }
.send-shop-dialog .btn-ghost { background: transparent; color: #d7d8dd; border: 1px solid #45474f; }
.send-shop-dialog .btn-primary { background: #f89044; color: #19120d; border: 1px solid #f89044; }
.send-shop-dialog .btn-primary:disabled { opacity: .6; }
.send-shop-done p { color: #c9cad0; font-size: .85rem; line-height: 1.75; }
.clear-all-dialog { width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 24px; margin: auto; background: #1b1c20; color: #eeeef0; border: 1px solid #704146; border-radius: 14px; box-shadow: 0 24px 60px #000a; font-family: var(--font-body); }
.clear-all-dialog::backdrop { background: #0b0a09b3; }
.clear-all-dialog h2 { margin: 0 0 10px; font-size: 1.2rem; color: #fff; }
.clear-all-dialog p { margin: 0 0 12px; color: #c9cad0; font-size: .82rem; line-height: 1.7; }
.clear-all-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.clear-all-actions .btn { padding: 10px 16px; border-radius: 8px; font-size: .82rem; font-weight: 700; }
.clear-all-actions .clear-all-confirm { border: 1px solid #bd6b72; background: #9e4952; color: #fff; }
.clear-all-actions .clear-all-confirm:hover { background: #b95862; }

/* สัญลักษณ์ลอยรอบชื่อ + ปุ่มพรีเซ็ตน่ารัก */
.cute-preset { display: grid; gap: 3px; width: 100%; padding: 13px 14px; text-align: left; color: #ffe3cc; background: linear-gradient(135deg, #3a2a1d, #2b2320); border: 1px solid #8a5b39; border-radius: 10px; cursor: pointer; }
.cute-preset:hover, .cute-preset:focus-visible { border-color: #ff9b50; }
.cute-preset strong { font-size: .8rem; }
.cute-preset span { color: #c9b8a8; font-size: .62rem; line-height: 1.5; }
.symbol-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 7px; margin: 8px 0 10px; }
.symbol-palette button { display: grid; place-items: center; aspect-ratio: 1; padding: 0; color: #e8e2da; background: #23252a; border: 1px solid #383a42; border-radius: 9px; cursor: pointer; }
.symbol-palette button:hover:not(:disabled), .symbol-palette button:focus-visible { color: #ffb47a; border-color: #ff9b50; }
.symbol-palette button:disabled { opacity: .4; cursor: default; }
.symbol-palette svg, .symbol-list svg { width: 26px !important; height: 26px !important; fill: currentColor !important; stroke: none !important; }
.symbol-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.symbol-list button { display: flex; align-items: center; gap: 5px; padding: 5px 9px 5px 6px; color: #aaadb6; background: #23252a; border: 1px solid #383a42; border-radius: 8px; font-size: .62rem; cursor: pointer; }
.symbol-list button svg { width: 18px !important; height: 18px !important; }
.symbol-list button[aria-selected="true"] { color: #f2c3a1; border-color: #ff9b50; background: #33291f; }
.symbol-editor { padding-top: 6px; border-top: 1px dashed #383a42; }
.symbol-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.text-action.danger { color: #ff9a8a; }

.symbol-button { display: inline-flex; align-items: center; gap: 7px; padding: 9px 12px; color: #f0ece6; background: #2a2d33; border: 1px solid #4a4d57; border-radius: 8px; font-size: .74rem; font-weight: 600; cursor: pointer; }
.symbol-button:hover, .symbol-button:focus-visible { border-color: #ff9b50; color: #ffd3b0; }
.symbol-button.danger { color: #ffd0c8; background: #4a2320; border-color: #b4463d; }
.symbol-button.danger:hover, .symbol-button.danger:focus-visible { background: #64302b; border-color: #ff7a6b; color: #fff; }
.symbol-button.wide { width: 100%; justify-content: center; margin: 0 0 10px; }
.symbol-button kbd, .symbol-control kbd { padding: 1px 6px; color: #d9d4cc; background: #15171b; border: 1px solid #555a66; border-radius: 4px; font: inherit; font-size: .62rem; }
.symbol-actions { gap: 8px; margin: 10px 0 8px; }

.symbol-palette { max-height: 250px; overflow-y: auto; padding: 2px; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); }
.designer-body .symbol-palette svg { width: 24px !important; height: 24px !important; }

/* Customer workflow: quote first; printing controls remain available on demand. */
.app-header-actions { min-width: 0; }
#downloadSTL { max-width: 170px; white-space: normal; overflow-wrap: anywhere; line-height: 1.5; }
#sendToShop { white-space: nowrap; }
.header-more { position: relative; flex-shrink: 0; }
.header-more > summary { cursor: pointer; padding: 12px 8px; color: #bfc0c5; font-size: .74rem; border-radius: 7px; }
.header-more-items { position: absolute; right: 0; top: 100%; z-index: 25; width: 190px; padding: 8px; background: #202126; border: 1px solid var(--studio-border); border-radius: 10px; box-shadow: 0 8px 24px #0006; }
.header-more-items .header-tool { width: 100%; min-height: 44px; justify-content: flex-start; }
.header-more-items .clear-all-action { color: #f0b4b7; }
.header-more-items .clear-all-action:hover { background: #493034; color: #fff; }
.header-more > summary:focus-visible, .studio-details > summary:focus-visible { outline: 2px solid var(--studio-orange); outline-offset: 2px; }
.studio-details > summary { padding: 16px 20px; color: #eed5bf; cursor: pointer; font-size: .78rem; font-weight: 600; line-height: 1.65; }
.print-settings { border-block: 1px solid var(--studio-border); }
.share-options { margin-top: 18px; border: 1px solid var(--studio-border); border-radius: 8px; padding-bottom: 0; }
.share-options[open] { padding-bottom: 12px; }
.share-options .btn { width: calc(100% - 24px); margin: 8px 12px 0; }
.quote-total { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin: 16px 0; }
.quote-total > span { color: #cccdd3; font-size: .8rem; }
.quote-total small { display: block; margin-top: 4px; color: #a6a7ad; }
.quote-total strong { color: #ffb77d; font-size: 1.3rem; }
.quote-warnings { margin: 18px 20px; }
.mobile-preview-expand { display: none; }
@media (max-width: 1190px) {
  .project-tools .header-tool span { display: none; }
  .app-header-actions { gap: 6px; }
  #downloadSTL { max-width: 145px; }
}
@media (max-width: 840px) {
  html:has(.designer-body.mobile-editing:not(.studio-showing)) { scroll-padding-top: calc(70px + clamp(180px,28svh,230px)); }
  .app-header-actions { flex-wrap: wrap; }
  .app-header { z-index: 30; }
  .workflow-rail { position: sticky; top: 0; height: 70px; z-index: 20; }
  .preview-stage { scroll-margin-top: 70px; }
  .mobile-editing .preview-stage { position: sticky; top: 70px; z-index: 10; align-self: start; height: clamp(180px,28svh,230px); grid-template-rows: minmax(0,1fr) auto; border-bottom: 1px solid #4b3b30; box-shadow: 0 5px 15px #0004; }
  .mobile-editing .control-panel { scroll-margin-top: 10px; }
  .mobile-editing .stage-toolbar, .mobile-editing .finish-bar, .mobile-editing .viewport-caption,
  .mobile-editing .dimension-chip, .mobile-editing .drag-hint, .mobile-editing .viewport-material { display: none; }
  .mobile-editing .quick-metrics { grid-template-columns: 1.2fr 1fr; min-height: 0; }
  .mobile-editing .quick-metrics > div { padding: 5px 10px; border-bottom: 0; }
  .mobile-editing .quick-metrics > div:nth-child(2), .mobile-editing .quick-metrics > div:nth-child(3),
  .mobile-editing .metric-price small, .mobile-editing #metricSizeCm { display: none; }
  .mobile-editing .quick-metrics strong { font-size: .58rem; }
  .mobile-editing .quick-metrics .metric-price strong { font-size: .95rem; }
  .mobile-editing .mobile-preview-expand { display: block; position: absolute; z-index: 4; right: 8px; top: 8px; min-height: 36px; padding: 7px 10px; border-radius: 7px; background: #25262cee; border: 1px solid #876346; color: #ffd0a7; font-size: .7rem; }
  .mobile-editing .build-progress { bottom: 6px; padding: 7px 10px; }
  .mobile-editing .build-progress[data-state="done"] { display: none; }
  .mobile-editing .build-progress[data-state="working"] #buildHelp { display: none; }
  .mobile-editing .build-progress small { font-size: .6rem; }
  .mobile-editing .build-progress-heading strong { font-size: .7rem; }
  .mobile-editing .panel-heading { padding-block: 12px; }
  .mobile-editing .panel-kicker { display: none; }
  .mobile-editing .panel-heading h1, .mobile-editing .panel-heading h2 { font-size: 1.05rem; }
  .studio-showing.mobile-editing .preview-stage { position: fixed; top: 0; height: 100dvh; z-index: 1000; grid-template-rows: auto minmax(0,1fr); }
  .studio-showing .mobile-preview-expand { display: none; }
}
@media (max-width: 560px) {
  .app-header-actions { display: grid; width: 100%; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 5px 8px; }
  #sendToShop { grid-column: 1; grid-row: 1; min-height: 44px; padding-inline: 6px; font-size: .72rem; }
  .header-more { grid-column: 2; grid-row: 1; justify-self: end; }
  #myDesignsLink { grid-column: 1; grid-row: 2; min-height: 40px; justify-content: flex-start; }
  #studioSignIn { grid-column: 1; grid-row: 2; min-height: 40px; justify-content: flex-start; }
  #downloadSTL { grid-column: 2; grid-row: 2; width: 100%; max-width: none; min-width: 0; min-height: 40px; font-size: .67rem; padding: 6px; }
  .project-tools .header-tool { width: 40px; min-height: 40px; }
}
@media (max-width: 840px) {
  .designer-input, .range-inputs input[type="number"] { font-size: 16px; }
}
.keychain-shape-presets { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.keychain-shape-presets button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; min-height: 82px; border: 1px solid #444049; border-radius: 12px; background: #25232a; color: #e9c9d7; font-size: .78rem; }
.designer-body #keychainShapePresets svg { width: 34px; height: 34px; fill: currentColor; stroke: none; }
.keychain-shape-presets button:hover, .keychain-shape-presets button[aria-pressed="true"] { border-color: #f3a979; background: #41302b; color: #ffc391; }
.keychain-shape-presets button:focus-visible { outline: 2px solid #ffb984; outline-offset: 3px; }

/* Per-letter editing shares the symbol inspector's compact, touch-friendly controls. */
.letter-control { margin-top: 18px; padding-top: 15px; border-top: 1px solid #3a3c43; }
.letter-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 9px 0 13px; }
.letter-list button { min-width: 34px; min-height: 36px; padding: 4px 9px; border: 1px solid #444650; border-radius: 8px; background: #25272e; color: #edf1f4; cursor: pointer; font-size: .86rem; }
.letter-list button:hover, .letter-list button:focus-visible, .letter-list button[aria-selected="true"] { border-color: #71d9f0; color: #d9f8ff; background: #243a40; }
.letter-list button:focus-visible { outline: 2px solid #71d9f0; outline-offset: 2px; }
.keychain-shape-presets { max-height: 310px; overflow-y: auto; padding: 2px; }
.keychain-shape-presets button { min-height: 72px; font-size: .69rem; }
