:root { --ink:#1d2421; --muted:#6e7772; --line:#dce2de; --paper:#fff; --ground:#f3f5f2; --green:#146f5d; --green-soft:#e7f1ed; --gold:#b18b45; }
* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--ground); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; letter-spacing: 0; }
button, input, select { color: inherit; font: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }
.topbar { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 220px minmax(280px, 520px) 1fr; align-items: center; gap: 28px; min-height: 72px; padding: 10px 24px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.product-switcher { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 10px; }
.product-switcher label { color: var(--muted); font-size: 12px; }
.product-switcher select { width: 100%; height: 40px; padding: 0 34px 0 12px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.save-state { justify-self: end; display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.save-state span { width: 7px; height: 7px; border-radius: 50%; background: #33a27d; }
.workspace { display: grid; grid-template-columns: minmax(300px, 390px) minmax(420px, 1fr) 310px; min-height: calc(100vh - 72px); }
.material-panel, .summary-panel { min-width: 0; background: var(--paper); }
.material-panel { border-right: 1px solid var(--line); }
.summary-panel { padding: 22px; border-left: 1px solid var(--line); }
.panel-heading, .stage-head, .summary-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.panel-heading { padding: 19px 18px 14px; }
.panel-heading > div, .stage-head > div, .summary-head { display: flex; align-items: center; gap: 10px; }
.panel-heading span, .step, .summary-head > span { color: var(--green); font-family: Georgia, serif; font-size: 12px; font-weight: 700; }
h1, h2 { margin: 0; font-size: 17px; }
.panel-heading input { width: 158px; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; outline: none; }
.panel-heading input:focus { border-color: var(--green); }
.category-tabs, .group-tabs { display: flex; overflow-x: auto; gap: 6px; padding: 0 18px 10px; scrollbar-width: none; }
.category-tabs::-webkit-scrollbar, .group-tabs::-webkit-scrollbar { display: none; }
.category-tabs button, .group-tabs button { flex: 0 0 auto; padding: 7px 11px; border: 1px solid var(--line); border-radius: 4px; background: #fff; font-size: 12px; }
.category-tabs button.active { color: #fff; border-color: var(--green); background: var(--green); }
.group-tabs { padding-top: 1px; border-bottom: 1px solid #edf0ee; }
.group-tabs button { padding: 5px 9px; color: var(--muted); border-color: transparent; background: #f3f5f3; font-size: 11px; }
.group-tabs button.active { color: var(--green); border-color: #bdd1ca; background: var(--green-soft); }
.material-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 9px; overflow-y: auto; max-height: calc(100vh - 196px); padding: 12px 18px 30px; }
.material-card { min-width: 0; padding: 0; overflow: hidden; text-align: left; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.material-card:hover, .material-card:focus-visible { border-color: var(--green); outline: none; box-shadow: 0 5px 16px rgba(24,63,52,.09); }
.material-image { position: relative; display: grid; width: 100%; aspect-ratio: 1; place-items: center; overflow: hidden; background: #edf1ee; }
.material-image img { width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
.material-image i { position: absolute; right: 6px; bottom: 6px; display: grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: #fff; background: var(--green); font-style: normal; font-size: 18px; }
.material-info { display: grid; gap: 2px; padding: 8px; }
.material-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.material-info span { color: var(--muted); font-size: 10px; }
.loading, .empty-materials { grid-column: 1 / -1; padding: 44px 15px; color: var(--muted); text-align: center; }
.design-stage { min-width: 0; padding: 24px; background: #eef1ed; }
.stage-head { min-height: 44px; }
.stage-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.icon-button { display: grid; width: 34px; height: 34px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); background: #fff; font-size: 20px; }
.bracelet-stage { position: relative; min-height: 520px; margin: 20px 0 12px; overflow: hidden; border: 1px solid #d8ddd9; border-radius: 7px; background: #e5e9e4 url('/assets/source-trays/tray-ivory.jpg') center/cover no-repeat; box-shadow: inset 0 0 70px rgba(37,51,44,.1); }
.bracelet-stage::after { position: absolute; inset: 9%; content: ""; border: 1px solid rgba(255,255,255,.5); border-radius: 50%; pointer-events: none; }
.bracelet-ring { position: absolute; inset: 50% auto auto 50%; width: min(72%, 440px); aspect-ratio: 1; transform: translate(-50%,-50%); }
.bead { position: absolute; display: grid; place-items: center; padding: 0; overflow: hidden; border: 1px solid rgba(255,255,255,.7); border-radius: 50%; background: #cfd8d2; box-shadow: 0 4px 8px rgba(28,40,34,.22), inset -3px -4px 7px rgba(34,42,38,.2), inset 3px 3px 6px rgba(255,255,255,.5); transform: translate(-50%,-50%); }
.bead img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.bead:hover::after { position: absolute; inset: 0; display: grid; place-items: center; content: "×"; color: #fff; background: rgba(22,34,28,.45); font-size: 17px; }
.stage-empty { position: absolute; inset: 50% auto auto 50%; z-index: 2; display: grid; gap: 7px; width: 240px; padding: 18px; transform: translate(-50%,-50%); text-align: center; border-radius: 6px; background: rgba(255,255,255,.82); backdrop-filter: blur(8px); }
.stage-empty span { color: var(--muted); font-size: 11px; }
.stage-measure { position: absolute; right: 15px; bottom: 14px; z-index: 3; display: flex; gap: 6px; }
.stage-measure span { padding: 5px 8px; border-radius: 4px; color: #fff; background: rgba(25,35,30,.66); font-size: 10px; }
.stage-tools { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.stage-tools button { min-height: 35px; padding: 0 13px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.stage-tools button:disabled { cursor: default; opacity: .4; }
.stage-tools p { margin: 0; color: var(--muted); text-align: center; font-size: 10px; }
.summary-head { justify-content: flex-start; padding-bottom: 17px; border-bottom: 1px solid var(--line); }
.wrist-field { display: grid; gap: 8px; margin-top: 20px; color: var(--muted); font-size: 11px; }
.wrist-field > div { display: grid; grid-template-columns: 1fr 38px; border: 1px solid var(--line); border-radius: 5px; background: #fff; }
.wrist-field input { min-width: 0; height: 42px; padding: 0 12px; border: 0; outline: 0; background: transparent; font-size: 15px; font-weight: 650; }
.wrist-field span { display: grid; place-items: center; color: var(--muted); border-left: 1px solid var(--line); font-size: 11px; }
.fit-status { display: flex; gap: 10px; margin: 15px 0; padding: 12px; border-radius: 5px; background: #f2f5f3; }
.fit-status > span { width: 8px; height: 8px; flex: 0 0 8px; margin-top: 4px; border-radius: 50%; background: #adb5b0; }
.fit-status.good > span { background: #2d9c73; }
.fit-status.warn > span { background: #c09238; }
.fit-status strong { font-size: 11px; }
.fit-status p { margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.selected-list { display: grid; gap: 7px; max-height: 210px; overflow-y: auto; margin: 16px 0; }
.selected-item { display: grid; grid-template-columns: 32px minmax(0,1fr) auto; align-items: center; gap: 8px; padding: 6px; border: 1px solid #e5e9e6; border-radius: 5px; }
.selected-item img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; background: #eee; }
.selected-item div { min-width: 0; }
.selected-item strong, .selected-item span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-item strong { font-size: 10px; }
.selected-item span { margin-top: 2px; color: var(--muted); font-size: 9px; }
.selected-item b { font-size: 10px; }
.price-list { margin: 18px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.price-list div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.price-list dt { color: var(--muted); font-size: 11px; }
.price-list dd { margin: 0; font-size: 11px; font-weight: 650; }
.price-list .total { margin-top: 7px; padding-top: 12px; border-top: 1px solid var(--line); }
.price-list .total dt { color: var(--ink); font-size: 13px; font-weight: 650; }
.price-list .total dd { color: var(--green); font-size: 21px; }
.designer-credit { margin-top: 13px; padding: 9px 11px; color: #735923; border-left: 3px solid var(--gold); background: #f8f3e9; font-size: 10px; }
.primary-action { width: 100%; min-height: 44px; margin-top: 16px; border: 0; border-radius: 5px; color: #fff; background: var(--green); font-weight: 650; }
.primary-action:hover { background: #0f5e4e; }
.summary-note { margin: 9px 0 0; color: var(--muted); text-align: center; font-size: 9px; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 28px; max-width: calc(100vw - 32px); padding: 10px 16px; transform: translate(-50%,20px); opacity: 0; color: #fff; border-radius: 5px; background: rgba(24,30,27,.92); pointer-events: none; transition: .2s ease; font-size: 12px; }
.toast.show { transform: translate(-50%,0); opacity: 1; }
@media (max-width: 1100px) { .workspace { grid-template-columns: 300px minmax(400px,1fr); } .summary-panel { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 30px; border-top: 1px solid var(--line); border-left: 0; } .summary-head, .wrist-field, .fit-status, .selected-list { grid-column: 1; } .price-list, .designer-credit, .primary-action, .summary-note { grid-column: 2; } .price-list { grid-row: 2 / span 2; } }
@media (max-width: 760px) { .topbar { position: static; grid-template-columns: 1fr auto; gap: 12px; padding: 10px 14px; } .product-switcher { grid-column: 1 / -1; grid-row: 2; } .product-switcher label { display: none; } .save-state { font-size: 10px; } .workspace { display: flex; flex-direction: column; min-height: 0; } .design-stage { order: 1; padding: 16px 14px; } .material-panel { order: 2; border-top: 1px solid var(--line); border-right: 0; } .summary-panel { order: 3; display: block; padding: 18px 14px 28px; } .bracelet-stage { min-height: 390px; } .material-grid { grid-template-columns: repeat(4,minmax(0,1fr)); max-height: none; } .panel-heading input { width: 145px; } .stage-tools p { display: none; } .stage-tools { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .material-grid { grid-template-columns: repeat(3,minmax(0,1fr)); padding: 10px 12px 24px; } .panel-heading, .category-tabs, .group-tabs { padding-left: 12px; padding-right: 12px; } .bracelet-stage { min-height: 340px; } .bracelet-ring { width: 84%; } }

/* Studio layout: the reference uses a focused canvas, a workflow rail and a bottom material browser. */
.topbar { grid-template-columns: 230px minmax(330px, 1fr) auto; min-height: 78px; padding: 10px 30px; background: #fdfcf8; }
.brand { width: 86px; height: 56px; gap: 0; }
.brand img { display: block; width: 78px; height: 56px; object-fit: contain; object-position: left center; background: transparent; }
.main-nav { display: flex; justify-content: center; gap: 4px; }
.main-nav a { min-width: 72px; padding: 8px 13px; color: var(--muted); text-align: center; border-radius: 16px; text-decoration: none; font-size: 11px; }
.main-nav a.active { color: #fff; background: #1d1e1b; }
.main-nav i { display: inline-grid; width: 13px; height: 13px; place-items: center; margin-left: 2px; color: #fff; border-radius: 50%; background: #ad4b3c; font-size: 8px; font-style: normal; }
.topbar-tools { display: flex; align-items: center; gap: 17px; }
.account-button { min-width: 88px; height: 34px; padding: 0 12px; border: 1px solid #d7ddd9; border-radius: 5px; color: #17685a; background: #fff; font-size: 11px; }
.account-button.logged-in { color: #fff; border-color: #17685a; background: #17685a; }
.qr-modal { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(23,29,26,.48); }
.qr-modal[hidden] { display: none; }
.qr-dialog { position: relative; width: min(360px, 100%); padding: 30px 28px 26px; border: 1px solid #e1e4df; border-radius: 10px; background: #fff; box-shadow: 0 18px 60px rgba(20,30,25,.2); text-align: center; }
.qr-dialog h2 { margin: 0; font-size: 20px; }
.qr-status { min-height: 40px; margin: 10px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.login-qr { display: block; width: 220px; height: 220px; margin: 0 auto; image-rendering: pixelated; }
.qr-close { position: absolute; top: 10px; right: 12px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; color: #767d78; background: transparent; font-size: 22px; }
.qr-refresh { height: 34px; margin-top: 18px; padding: 0 14px; border: 1px solid #d7ddd9; border-radius: 5px; color: #17685a; background: #f7faf8; font-size: 11px; }
.checkout-modal, .payment-modal { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 24px; background: rgba(23,29,26,.48); }
.checkout-modal[hidden], .payment-modal[hidden] { display: none; }
.checkout-dialog { position: relative; display: grid; gap: 14px; width: min(440px, 100%); max-height: calc(100dvh - 40px); overflow-y: auto; padding: 28px; border: 1px solid #e1e4df; border-radius: 10px; background: #fff; box-shadow: 0 18px 60px rgba(20,30,25,.2); }
.checkout-dialog h2 { margin: 0; font-size: 20px; }
.checkout-dialog label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; }
.checkout-dialog select, .checkout-dialog input { width: 100%; height: 38px; padding: 0 10px; border: 1px solid #d7ddd9; border-radius: 5px; background: #fff; }
.delivery-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 6px; background: #eef1ee; }
.delivery-tabs button { height: 34px; border: 0; border-radius: 4px; color: var(--muted); background: transparent; }
.delivery-tabs button.active { color: #fff; background: var(--green); }
#shippingFields, #pickupFields { display: grid; gap: 12px; }
#shippingFields[hidden], #pickupFields[hidden], .new-address[hidden] { display: none; }
.new-address { display: grid; gap: 8px; padding: 10px; border: 1px solid #e2e6e3; border-radius: 6px; background: #f8faf8; }
.new-address > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.new-address > div:nth-child(2) { grid-template-columns: repeat(3,minmax(0,1fr)); }
.checkout-dialog .pickup-contact { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; margin: 0; }
.checkout-total { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; border-top: 1px solid #e2e6e3; }
.checkout-total strong { color: var(--green); font-size: 22px; }
.checkout-pay { height: 42px; border: 0; border-radius: 5px; color: #fff; background: var(--green); font-weight: 700; }
.checkout-pay:disabled { cursor: wait; opacity: .55; }
.payment-order { margin-top: 12px; color: var(--muted); font-size: 11px; }
.topbar-tools .product-switcher { display: flex; }
.topbar-tools .product-switcher label { display: none; }
.topbar-tools .product-switcher select { width: 220px; height: 34px; font-size: 11px; }
.workspace { grid-template-columns: 190px minmax(0,1fr) 300px; grid-template-rows: minmax(0,1fr) 270px; height: calc(100vh - 78px); min-height: 0; overflow: hidden; background: #f5f0e7; }
.steps-panel { grid-column: 1; grid-row: 1; padding: 74px 18px 20px 28px; background: #f5f0e7; }
.steps-title { margin-bottom: 25px; color: #252621; font-size: 12px; font-weight: 700; }
.steps-panel ol { display: grid; gap: 25px; margin: 0; padding: 0; list-style: none; }
.steps-panel li { position: relative; display: grid; grid-template-columns: 26px 1fr; gap: 8px; color: #858077; }
.steps-panel li:not(:last-child)::after { position: absolute; top: 28px; left: 12px; width: 1px; height: 23px; content: ""; background: #d8d1c4; }
.steps-panel b { display: grid; width: 25px; height: 25px; place-items: center; border: 1px solid #d6d0c4; border-radius: 50%; font-size: 11px; font-weight: 600; }
.steps-panel li.active b { color: #fff; border-color: #1e1e1c; background: #1e1e1c; }
.steps-panel li.done b { color: #fff; border-color: var(--green); background: var(--green); }
.steps-panel strong, .steps-panel span { display: block; }
.steps-panel strong { color: #3b3933; font-size: 11px; }
.steps-panel li.active strong { color: #1e1e1c; }
.steps-panel span { margin-top: 4px; font-size: 9px; line-height: 1.45; }
.design-stage { grid-column: 2; grid-row: 1; min-height: 0; overflow: hidden; padding: 23px 30px 16px; background: #f5f0e7; }
.stage-head { max-width: 760px; margin: 0 auto; }
.stage-head h2 { font-family: Georgia, serif; font-size: 18px; }
.stage-head p { font-size: 10px; }
.bracelet-stage { min-height: 0; height: calc(100% - 70px); margin: 16px auto 10px; max-width: 780px; border-color: #d5cabb; background-image: url('/assets/source-trays/tray-wood.jpg'); background-size: cover; box-shadow: 0 10px 28px rgba(58,45,31,.13), inset 0 0 80px rgba(57,41,27,.16); }
.bracelet-stage::after { inset: 10%; border-color: rgba(255,255,255,.68); }
.bracelet-ring { width: min(64%, 460px); }
.stage-empty { background: rgba(255,255,255,.9); }
.stage-empty[hidden] { display: none; }
.stage-tools { max-width: 780px; margin: 0 auto; }
.summary-panel { grid-column: 3; grid-row: 1 / span 2; min-height: 0; overflow-y: auto; margin: 14px 14px 14px 0; padding: 28px 22px 22px; border: 1px solid #e0d8cb; border-radius: 18px; background: #fbfaf6; box-shadow: 0 12px 30px rgba(63,51,36,.10); }
.summary-head { border-bottom-color: #e2ddd4; }
.summary-head h2 { font-family: Georgia, serif; font-size: 16px; }
.fit-status { background: #f2f0e9; }
.price-list .total dd { font-size: 24px; }
.history-panel { margin-top: 26px; padding-top: 15px; border-top: 1px solid #e2ddd4; }
.history-panel > div:first-child { display: flex; justify-content: space-between; color: #9b9386; font-size: 9px; letter-spacing: .12em; }
.history-panel > div:first-child span { letter-spacing: 0; }
.history-empty { margin-top: 15px; padding: 16px 10px; color: #9b9386; border: 1px dashed #d9d1c4; text-align: center; font-size: 10px; }
.material-panel { grid-column: 1 / 3; grid-row: 2; overflow: hidden; border-top: 1px solid #ddd5c7; border-right: 0; background: #fbfaf6; }
.material-panel .panel-heading { padding: 13px 28px 8px; }
.material-panel .panel-heading h1 { font-family: Georgia, serif; font-size: 14px; }
.material-panel .panel-heading > div { gap: 8px; }
.material-panel .panel-heading span { font-size: 10px; }
.material-panel .category-tabs, .material-panel .group-tabs { padding-left: 28px; padding-right: 28px; }
.material-panel .material-grid { grid-template-columns: repeat(10, minmax(105px,1fr)); gap: 8px; max-height: 184px; padding: 10px 28px 20px; overflow-x: auto; overflow-y: hidden; }
.material-panel .material-card { border-color: #e5e0d8; }
.material-panel .material-image { aspect-ratio: 1.18; }
.material-panel .material-info { padding: 6px 8px; }
.material-panel .material-info strong { font-size: 10px; }
.material-panel .material-info span { font-size: 9px; }
@media (max-width: 900px) { .topbar { grid-template-columns: 180px 1fr; } .main-nav { display: none; } .topbar-tools { justify-self: end; } .workspace { grid-template-columns: 150px minmax(0,1fr) 270px; } .steps-panel { padding-left: 16px; } }
@media (max-width: 720px) { .topbar { grid-template-columns: 1fr auto; min-height: 66px; padding: 9px 14px; } .topbar-tools { grid-column: 1 / -1; grid-row: 2; width: 100%; } .topbar-tools .product-switcher { width: 100%; } .topbar-tools .product-switcher select { width: 100%; } .workspace { display: flex; flex-direction: column; height: auto; min-height: 0; overflow: visible; } .steps-panel { order: 0; padding: 14px; } .steps-panel ol { grid-template-columns: repeat(4,1fr); gap: 4px; } .steps-panel li { grid-template-columns: 22px 1fr; gap: 4px; } .steps-panel li:not(:last-child)::after { display: none; } .steps-panel b { width: 21px; height: 21px; font-size: 9px; } .steps-panel strong { font-size: 9px; } .steps-panel span { display: none; } .design-stage { order: 1; padding: 14px; } .bracelet-stage { height: 390px; } .summary-panel { order: 2; padding: 18px 14px 28px; } .material-panel { order: 3; } .material-panel .material-grid { grid-template-columns: repeat(4, 105px); max-height: none; overflow-y: hidden; } }

/* The web canvas uses the same Verlet engine as the mini program. Keep the full tray visible and let the page scroll instead of cropping it. */
.workspace { grid-template-rows: minmax(560px, 1fr) 330px; height: auto; min-height: 890px; overflow: visible; }
.design-stage { min-height: 560px; }
.bracelet-stage { height: calc(100% - 70px); min-height: 0; background-color: #eee9df; background-repeat: no-repeat; background-position: center; background-size: contain; }
.bracelet-stage::after { inset: 50% auto auto 50%; width: auto; height: 72%; aspect-ratio: 1; transform: translate(-50%,-50%); border-radius: 50%; }
.physics-layer { position: absolute; top: 50%; left: 50%; height: 72%; aspect-ratio: 1; transform: translate(-50%,-50%); }
.bead-canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.stage-tools { grid-template-columns: auto auto 1fr auto; }
.stage-tools .arrange-button { color: #fff; border-color: #1d1e1b; background: #1d1e1b; }
.material-panel .material-grid { grid-template-columns: repeat(2, 112px); grid-template-rows: repeat(2, 124px); grid-auto-flow: column; grid-auto-columns: 112px; gap: 8px 10px; max-height: 268px; overflow-x: auto; overflow-y: hidden; }
.material-panel .material-card { height: 124px; }
.material-panel .material-image { height: 90px; aspect-ratio: auto; }
.material-panel .material-image b { position: absolute; top: 5px; left: 5px; display: grid; width: 18px; height: 18px; place-items: center; color: #fff; border-radius: 50%; background: var(--green); font-size: 9px; }
.material-panel .material-info { min-height: 33px; }
@media (max-width: 720px) { .workspace { min-height: 0; } .design-stage { min-height: 440px; } .bracelet-stage { height: 390px; } .stage-tools { grid-template-columns: repeat(2,1fr); } .material-panel .material-grid { grid-template-columns: repeat(2, 112px); grid-template-rows: repeat(2, 124px); max-height: 268px; } }

/* Single-screen responsive studio. */
:root { --studio-header: 64px; --material-height: clamp(250px, 34dvh, 310px); }
html, body { width: 100%; height: 100%; overflow: hidden; }
.topbar { position: relative; height: var(--studio-header); min-height: var(--studio-header); padding: 7px 24px; }
.workspace {
  grid-template-columns: clamp(132px, 11vw, 174px) minmax(460px, 1fr) clamp(250px, 20vw, 292px);
  grid-template-rows: minmax(0, 1fr) var(--material-height);
  width: 100%; height: calc(100dvh - var(--studio-header)); min-height: 0; overflow: hidden;
}
.steps-panel { padding: clamp(24px, 5vh, 52px) 14px 14px 20px; overflow: hidden; }
.steps-title { margin-bottom: clamp(15px, 3vh, 24px); }
.steps-panel ol { gap: clamp(13px, 2.6vh, 23px); }
.steps-panel li:not(:last-child)::after { height: clamp(12px, 2.5vh, 22px); }
.design-stage { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; padding: 12px clamp(12px, 2vw, 26px) 10px; overflow: hidden; background: #f5f0e7; }
.stage-head { width: min(100%, 760px); min-height: 38px; }
.stage-head h2 { font-size: clamp(15px, 1.35vw, 18px); }
.stage-head p { margin-top: 2px; }
.stage-canvas { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 52px; align-items: center; min-width: 0; min-height: 0; gap: 10px; }
.tray-disc {
  position: relative; justify-self: center; width: min(88%, calc(100dvh - var(--studio-header) - var(--material-height) - 82px)); max-width: 610px; aspect-ratio: 1;
  overflow: hidden; border: 1px solid rgba(91,70,48,.22); border-radius: 50%;
  background-color: transparent; background-repeat: no-repeat; background-position: center; background-size: 136% 136%;
  box-shadow: 0 12px 30px rgba(71,53,35,.14); transform: translateX(clamp(0px, 3.5vw, 56px));
}
.tray-disc::after { display: none; }
.physics-layer { position: absolute; inset: 9%; width: auto; height: auto; aspect-ratio: auto; transform: none; }
.bead-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.stage-empty { width: min(220px, 62%); padding: 14px; }
.stage-measure { right: 11%; bottom: 8%; gap: 7px; }
.stage-measure span { white-space: nowrap; }
.canvas-tools { display: grid; align-content: center; gap: 7px; }
.canvas-tools button { display: grid; width: 46px; height: 46px; place-items: center; gap: 0; padding: 4px 2px; border: 1px solid #d8d2c8; border-radius: 6px; background: rgba(255,255,255,.88); }
.canvas-tools button:hover, .canvas-tools button:focus-visible { border-color: var(--green); outline: none; background: #fff; }
.canvas-tools button:disabled { cursor: default; opacity: .4; }
.canvas-tools button b { font-size: 17px; line-height: 1; font-weight: 500; }
.canvas-tools button span { color: var(--muted); font-size: 9px; }
.canvas-tools .arrange-button { color: #fff; border-color: #1d1e1b; background: #1d1e1b; }
.canvas-tools .arrange-button span { color: rgba(255,255,255,.75); }
.summary-toggle, .summary-close { display: none; }
.summary-panel { display: flex; flex-direction: column; min-height: 0; overflow: hidden; padding: 16px 16px 14px; }
.summary-head { flex: 0 0 auto; padding-bottom: 10px; }
.wrist-field { flex: 0 0 auto; margin-top: 12px; gap: 5px; }
.wrist-field input { height: 36px; }
.fit-status { flex: 0 0 auto; margin: 10px 0; padding: 9px 10px; }
.selected-list { flex: 1 1 auto; min-height: 42px; max-height: none; margin: 6px 0; }
.price-list { flex: 0 0 auto; margin-top: 7px; padding-top: 7px; }
.price-list div { padding: 3px 0; }
.price-list .total { margin-top: 3px; padding-top: 7px; }
.price-list .total dd { font-size: 20px; }
.primary-action { flex: 0 0 auto; min-height: 38px; margin-top: 9px; }
.summary-note { flex: 0 0 auto; margin-top: 5px; }
.history-panel { display: none; }
.material-panel { display: grid; grid-template-rows: 38px 30px 29px minmax(0, 1fr); min-height: 0; overflow: hidden; background: #f5f0e7; }
.material-panel .panel-heading { min-height: 0; padding: 6px 20px 4px; }
.material-panel .panel-heading input { height: 30px; }
.material-panel .category-tabs, .material-panel .group-tabs { align-items: center; min-height: 0; padding: 0 20px 4px; }
.material-panel .group-tabs { padding-bottom: 3px; }
.material-panel .category-tabs button { padding: 4px 9px; }
.material-panel .group-tabs button { padding: 3px 8px; }
.material-panel .material-grid {
  grid-template-columns: repeat(auto-fill, 116px); grid-template-rows: none; grid-auto-flow: row; grid-auto-columns: auto;
  justify-content: space-between; align-content: start; gap: 7px 9px; width: 100%; height: 100%; max-height: none; min-height: 0; padding: 6px 20px 10px; overflow-x: hidden; overflow-y: auto; background: #f5f0e7;
}
.material-panel .material-card { height: 100%; min-height: 0; }
.material-panel .material-image { height: calc(100% - 30px); min-height: 44px; aspect-ratio: auto; background: #f2f3f0; }
.material-panel .material-image img { width: 100%; height: 100%; padding: 2px; object-fit: contain; image-rendering: auto; }
.material-panel .material-info { height: 29px; min-height: 0; gap: 0; padding: 3px 6px; }
.material-panel .material-info strong { font-size: 9px; }
.material-panel .material-info span { font-size: 8px; }
@media (max-height: 760px) {
  :root { --studio-header: 56px; --material-height: clamp(246px, 38dvh, 280px); }
  .stage-head p, .steps-panel span, .summary-note { display: none; }
  .topbar-tools .product-switcher select { height: 31px; }
  .steps-panel { padding-top: 22px; }
  .canvas-tools { gap: 5px; }
  .canvas-tools button { width: 42px; height: 42px; }
  .selected-item { padding: 4px; }
  .selected-item img { width: 28px; height: 28px; }
}
@media (max-width: 1080px) {
  .topbar { grid-template-columns: 170px minmax(260px, 1fr) auto; gap: 12px; }
  .workspace { grid-template-columns: minmax(420px, 1fr) 270px; }
  .steps-panel { display: none; }
  .design-stage { grid-column: 1; }
  .material-panel { grid-column: 1; }
  .summary-panel { grid-column: 2; }
}
@media (max-width: 780px) {
  :root { --studio-header: 54px; --material-height: clamp(230px, 38dvh, 280px); }
  .topbar { grid-template-columns: auto minmax(130px, 1fr); gap: 8px; height: var(--studio-header); padding: 6px 10px; }
  .main-nav, .save-state { display: none; }
  .topbar-tools { grid-column: 2; grid-row: 1; width: 100%; justify-self: stretch; }
  .topbar-tools .product-switcher, .topbar-tools .product-switcher select { width: 100%; }
  .workspace { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) var(--material-height); height: calc(100dvh - var(--studio-header)); overflow: hidden; }
  .design-stage { grid-column: 1; grid-row: 1; padding: 8px 8px 6px; }
  .stage-head { min-height: 32px; }
  .stage-head p { display: none; }
  .stage-canvas { grid-template-columns: minmax(0, 1fr) 43px; gap: 5px; }
  .tray-disc { width: min(86%, calc(100dvh - var(--studio-header) - var(--material-height) - 64px)); }
  .canvas-tools button { width: 39px; height: 39px; }
  .canvas-tools button span { display: none; }
  .canvas-tools .summary-toggle { display: grid; }
  .material-panel { grid-column: 1; grid-row: 2; }
  .material-panel .panel-heading { padding-left: 10px; padding-right: 10px; }
  .material-panel .panel-heading input { width: 132px; }
  .material-panel .category-tabs, .material-panel .group-tabs { padding-left: 10px; padding-right: 10px; }
  .material-panel .material-grid { grid-template-columns: repeat(2, 92px); grid-auto-columns: 92px; padding-left: 10px; padding-right: 10px; }
  .summary-panel { position: fixed; z-index: 40; top: var(--studio-header); right: 0; bottom: 0; display: flex; width: min(88vw, 310px); margin: 0; transform: translateX(102%); border: 1px solid var(--line); border-right: 0; border-radius: 18px 0 0 18px; box-shadow: -14px 0 32px rgba(34,40,36,.16); transition: transform .2s ease; }
  .summary-panel.open { transform: translateX(0); }
  .summary-close { display: grid; width: 30px; height: 30px; margin-left: auto; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: #fff; }
}
@media (max-width: 420px) {
  .panel-heading h1 { font-size: 12px; }
  .stage-head h2 { font-size: 14px; }
  .stage-empty { width: 58%; padding: 9px; font-size: 11px; }
  .stage-empty span { display: none; }
}

/* Material browser refresh: complete previews, explicit size selection, and two comfortable rows. */
:root { --material-height: clamp(300px, 46dvh, 360px); }
.design-stage { padding-top: 10px; padding-bottom: 8px; }
.stage-canvas { gap: 8px; }
.tray-disc { width: min(82%, calc(100dvh - var(--studio-header) - var(--material-height) - 74px)); max-width: 560px; }
.material-panel { grid-template-rows: 38px 28px 28px minmax(0, 1fr); background: #f5f0e7; }
.material-panel .panel-heading { padding: 6px 20px 3px; }
.material-panel .material-grid { grid-template-columns: repeat(auto-fill, 116px); grid-template-rows: none; grid-auto-flow: row; grid-auto-columns: auto; justify-content: space-between; align-content: start; gap: 7px 9px; padding: 6px 20px 10px; }
.material-panel .material-card { display: grid; grid-template-rows: minmax(0, 1fr) 40px; height: 124px; min-height: 0; border-radius: 8px; background: #fff; }
.material-panel .material-image { height: auto; min-height: 0; background: #f0f2ef; }
.material-panel .material-image img { position: absolute; inset: 6px; display: block; width: calc(100% - 12px); height: calc(100% - 12px); margin: 0; padding: 0; object-fit: contain; object-position: center; }
.material-card { cursor: pointer; }
.material-card:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.selected-list { align-content: start; grid-auto-rows: min-content; }
.selected-item { min-height: 44px; }
.canvas-tools button { overflow: hidden; }
.canvas-tools button b, .canvas-tools button span { pointer-events: none; }
.material-panel .material-image i { display: none; }
.material-panel .material-image b { top: 6px; left: 6px; }
.stock-badge { position: absolute; right: 5px; bottom: 5px; padding: 2px 4px; color: #fff; border-radius: 3px; background: rgba(22,31,27,.62); font-size: 8px; }
.material-panel .material-info { display: grid; grid-template-rows: 15px 22px; min-height: 0; padding: 4px 6px 3px; }
.material-panel .material-info strong { min-width: 0; font-size: 10px; line-height: 15px; }
.material-controls { display: grid; grid-template-columns: minmax(0, 1fr) 22px; gap: 4px; min-width: 0; }
.size-select { min-width: 0; height: 22px; padding: 0 2px; border: 1px solid #d8dfda; border-radius: 4px; background: #f8faf8; font-size: 9px; }
.add-material { display: grid; width: 22px; height: 22px; place-items: center; padding: 0; border: 0; border-radius: 50%; color: #fff; background: var(--green); font-size: 17px; line-height: 1; }
.add-material:hover, .add-material:focus-visible { background: #0f5e4e; outline: 2px solid #b8d9ce; outline-offset: 1px; }
@media (max-height: 760px) {
  :root { --material-height: clamp(292px, 46dvh, 328px); }
  .tray-disc { width: min(78%, calc(100dvh - var(--studio-header) - var(--material-height) - 68px)); }
}
@media (max-width: 780px) {
  :root { --material-height: clamp(270px, 46dvh, 330px); }
  .tray-disc { width: min(78%, calc(100dvh - var(--studio-header) - var(--material-height) - 60px)); transform: none; }
  .material-panel .material-grid { grid-template-columns: repeat(2, 104px); grid-auto-columns: 104px; overflow-x: hidden; overflow-y: auto; }
}

/* Match the mini-program studio: the material browser floats above the page,
   while the tools and measurements stay outside the tray image. */
.material-panel {
  margin: 0 14px 12px;
  border: 1px solid #ddd5c7;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(71,53,35,.08);
}
.stage-canvas { grid-template-rows: minmax(0, 1fr) 30px; }
.tray-disc { grid-column: 1; grid-row: 1; max-height: 100%; }
.stage-measure {
  position: static;
  grid-column: 1;
  grid-row: 2;
  align-self: end;
  justify-self: center;
  z-index: 6;
  gap: 8px;
  transform: translateX(clamp(0px, 3.5vw, 56px));
}
.stage-measure span {
  min-width: 58px;
  padding: 6px 9px;
  border-radius: 6px;
  text-align: center;
  white-space: nowrap;
  background: rgba(35,40,36,.72);
  font-size: 11px;
}
.canvas-tools { grid-column: 2; grid-row: 1 / span 2; gap: 9px; }
.canvas-tools button {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  box-shadow: 0 2px 4px rgba(35,40,36,.05);
}
.canvas-tools button b { font-size: 22px; }
.canvas-tools button span { font-size: 11px; }
.canvas-tools .arrange-button { border-radius: 10px; }
@media (max-height: 760px) and (min-width: 781px) {
  .canvas-tools { gap: 6px; }
  .canvas-tools button { width: 52px; height: 52px; }
  .canvas-tools button b { font-size: 19px; }
  .canvas-tools button span { font-size: 10px; }
}
@media (max-width: 780px) {
  .material-panel { margin: 0 8px 8px; border-radius: 16px; }
  .stage-canvas { grid-template-columns: minmax(0, 1fr) 52px; gap: 7px; }
  .canvas-tools { gap: 7px; }
  .canvas-tools button { width: 52px; height: 52px; border-radius: 9px; }
  .canvas-tools button b { font-size: 19px; }
  .canvas-tools button span { display: block; font-size: 10px; }
  .stage-measure { transform: none; }
}

/* Larger default ivory tray with room for physically scaled beads. */
.tray-disc { width: min(94%, calc(100dvh - var(--studio-header) - var(--material-height) - 12px)); height: auto; max-width: 630px; max-height: none; aspect-ratio: 1 / 1; }
@media (max-height: 760px) and (min-width: 781px) {
  .tray-disc { width: min(90%, calc(100dvh - var(--studio-header) - var(--material-height) - 8px)); }
}
@media (max-width: 780px) {
  .tray-disc { width: min(92%, calc(100dvh - var(--studio-header) - var(--material-height) - 18px)); }
}
