:root {
    --ivory: #f7f4ee;
    --paper: #fffdf9;
    --ink: #1f1f1d;
    --muted: #77746d;
    --line: #ded9cf;
    --gold: #a98445;
    --gold-deep: #7e612f;
    --wine: #6e2f3d;
    --sage: #839388;
    --pearl: #d9d6ce;
    --shadow: 0 18px 60px rgba(42, 36, 25, .11);
    --radius: 6px;
}

* { box-sizing: border-box; }
html { background: var(--ivory); color: var(--ink); }
body {
    margin: 0;
    min-width: 320px;
    font-family: "Noto Serif SC", "Songti SC", "STSong", "Microsoft YaHei", serif;
    background: var(--ivory);
    color: var(--ink);
    letter-spacing: 0;
}
button, input, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.app-shell { min-height: 100vh; }
.topbar {
    height: 78px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 32px;
    border-bottom: 1px solid var(--line);
    background: rgba(247, 244, 238, .96);
    position: relative;
    z-index: 20;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); width: max-content; }
.brand-mark {
    width: 38px; height: 38px; display: grid; place-items: center;
    border: 1px solid var(--ink); font-size: 20px; line-height: 1;
}
.brand-copy { display: grid; gap: 3px; }
.brand-copy strong { font-size: 21px; font-weight: 600; }
.brand-copy small { font: 9px/1.2 Arial, sans-serif; color: var(--muted); letter-spacing: 1.8px; }
.flow-indicator { display: flex; align-items: center; gap: 14px; font-family: "Microsoft YaHei", sans-serif; }
.flow-indicator span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #99958d; }
.flow-indicator span b { font: 10px Arial; font-weight: 500; }
.flow-indicator span.active { color: var(--ink); }
.flow-indicator i { display: block; width: 34px; height: 1px; background: var(--line); }
.top-actions { display: flex; justify-content: flex-end; align-items: center; gap: 22px; font-family: "Microsoft YaHei", sans-serif; }
.icon-text-button, .admin-link { border: 0; background: none; font-size: 12px; text-decoration: none; cursor: pointer; }
.icon-text-button { display: inline-flex; gap: 7px; align-items: center; }
.icon-text-button span { color: var(--gold-deep); font-size: 19px; }
.admin-link { color: var(--muted); }

.studio {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(460px, 1fr) minmax(300px, 354px);
    min-height: calc(100vh - 78px);
}
.material-library, .configuration { padding: 26px 24px; background: var(--paper); min-width: 0; }
.material-library { border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.configuration { border-left: 1px solid var(--line); }
.panel-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.panel-heading.compact { align-items: center; margin-bottom: 12px; }
.eyebrow { display: block; margin-bottom: 6px; font: 9px/1 Arial, sans-serif; color: var(--gold-deep); letter-spacing: 1.6px; }
.panel-heading h1, .panel-heading h2 { font-size: 21px; line-height: 1.2; margin: 0; font-weight: 600; }
.material-count, .design-id { font: 10px/1 Arial, sans-serif; color: var(--muted); padding-bottom: 3px; }

.material-tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.material-tabs button { height: 40px; border: 0; background: transparent; color: var(--muted); font-size: 13px; cursor: pointer; position: relative; }
.material-tabs button.active { color: var(--ink); font-weight: 600; }
.material-tabs button.active::after { content: ""; position: absolute; height: 2px; left: 18%; right: 18%; bottom: -1px; background: var(--gold); }
.search-box { display: flex; height: 38px; border: 1px solid var(--line); align-items: center; gap: 8px; padding: 0 11px; margin-bottom: 16px; background: #fbfaf6; }
.search-box span { font: 23px Arial; transform: rotate(-20deg); color: #928f87; }
.search-box input { border: 0; outline: 0; background: transparent; min-width: 0; width: 100%; font: 12px "Microsoft YaHei", sans-serif; color: var(--ink); }
.search-box input::placeholder { color: #aaa69d; }
.material-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
    overflow-y: auto; align-content: start; padding-right: 3px; max-height: calc(100vh - 350px);
    scrollbar-width: thin; scrollbar-color: #c8c1b6 transparent;
}
.library-loading { grid-column: 1/-1; padding: 60px 10px; text-align: center; color: var(--muted); font-size: 13px; }
.material-card { border: 1px solid transparent; background: #f6f3ed; padding: 10px; cursor: pointer; text-align: left; min-height: 133px; position: relative; transition: border-color .2s, background .2s, transform .2s; }
.material-card:hover { border-color: #beb5a5; transform: translateY(-1px); }
.material-card.selected { border-color: var(--gold); background: #fffdf8; }
.material-visual { height: 68px; display: grid; place-items: center; overflow: hidden; position: relative; }
.material-card .display-bead { width: 50px; height: 50px; }
.material-card[data-type="accessory"] .display-bead { width: 44px; height: 44px; }
.material-card[data-type="rope"] .display-bead { width: 58px; height: 34px; border-radius: 50%; border: 4px solid var(--material-color); background: transparent !important; box-shadow: inset 0 0 0 1px rgba(255,255,255,.4), 0 4px 10px rgba(31,31,29,.12); }
.material-name { display: block; font-size: 13px; line-height: 1.3; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.material-meta { display: flex; justify-content: space-between; margin-top: 6px; align-items: baseline; font-family: "Microsoft YaHei", sans-serif; }
.material-meta span { font-size: 10px; color: var(--muted); }
.material-meta strong { font: 12px Arial; color: var(--gold-deep); }
.material-add { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; border: 1px solid #b6aea0; background: rgba(255,255,255,.8); display: grid; place-items: center; font: 15px Arial; }
.selection-helper { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 9px; min-height: 58px; }
.helper-swatch { width: 28px; height: 28px; border-radius: 50%; background: var(--pearl); border: 1px solid rgba(31,31,29,.1); }
.selection-helper div { display: grid; gap: 2px; min-width: 0; }
.selection-helper small { font: 9px "Microsoft YaHei", sans-serif; color: var(--muted); }
.selection-helper strong { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selection-helper button { border: 1px solid var(--ink); background: transparent; height: 30px; padding: 0 9px; font-size: 11px; cursor: pointer; }
.selection-helper button:disabled { opacity: .35; cursor: not-allowed; }

.design-stage { min-width: 0; min-height: min(660px, calc(100vh - 78px)); display: flex; flex-direction: column; padding: 24px 30px 20px; position: relative; overflow: hidden; }
.stage-toolbar { display: flex; justify-content: space-between; align-items: center; position: relative; z-index: 4; }
.view-switch { display: inline-flex; padding: 3px; background: #ebe7df; }
.view-switch button { min-width: 58px; height: 28px; border: 0; background: transparent; font-size: 11px; color: var(--muted); cursor: pointer; }
.view-switch button.active { background: var(--paper); color: var(--ink); box-shadow: 0 1px 5px rgba(31,31,29,.09); }
.history-tools { display: flex; gap: 7px; }
.icon-button { width: 32px; height: 32px; border: 1px solid var(--line); background: rgba(255,253,249,.72); font: 17px Arial; cursor: pointer; }
.icon-button:disabled { opacity: .35; }

.preview-wrap { flex: 1; min-height: 460px; position: relative; display: grid; place-items: center; }
.soft-grid { position: absolute; inset: 10% 5%; pointer-events: none; opacity: .34; background-image: linear-gradient(#d9d4ca 1px, transparent 1px), linear-gradient(90deg, #d9d4ca 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(circle, #000 0, transparent 66%); }
.bracelet-stage { width: min(430px, 82%); aspect-ratio: 1; position: relative; transition: width .35s, height .35s; }
.bracelet-rope { position: absolute; width: 65%; height: 65%; left: 17.5%; top: 17.5%; border-radius: 50%; border: 3px solid var(--rope-color, #d2cec5); box-shadow: 0 1px 0 rgba(255,255,255,.8), inset 0 0 12px rgba(31,31,29,.07); opacity: .9; }
.bracelet-pieces { position: absolute; inset: 0; }
.bracelet-piece { position: absolute; left: 50%; top: 50%; width: var(--size); height: var(--size); margin: calc(var(--size) / -2); transform: rotate(var(--angle)) translateY(calc(var(--radius) * -1)) rotate(calc(var(--angle) * -1)); cursor: grab; user-select: none; touch-action: none; transition: box-shadow .18s, filter .18s, opacity .18s; z-index: 2; }
.bracelet-piece:active { cursor: grabbing; }
.bracelet-piece.selected { z-index: 8; filter: brightness(1.06); box-shadow: 0 0 0 3px rgba(169,132,69,.32), 0 8px 18px rgba(31,31,29,.18); }
.bracelet-piece.dragging { opacity: .76; transition: none; }
.bracelet-piece.accessory { border-radius: 35%; }
.stage-center { position: absolute; inset: 34%; border-radius: 50%; display: grid; place-content: center; text-align: center; gap: 5px; color: #8b867d; pointer-events: none; }
.stage-center span { font: 29px Georgia, serif; color: #b0aa9f; }
.stage-center small { font: 8px Arial; letter-spacing: 1.3px; }
.length-status { position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%); display: grid; grid-template-columns: auto auto; align-items: center; column-gap: 7px; row-gap: 2px; white-space: nowrap; padding: 8px 12px; background: rgba(255,253,249,.86); backdrop-filter: blur(8px); border: 1px solid rgba(222,217,207,.8); }
.length-status .status-dot { width: 7px; height: 7px; background: var(--sage); border-radius: 50%; grid-row: 1/3; }
.length-status strong { font: 11px "Microsoft YaHei", sans-serif; }
.length-status small { font: 9px Arial, sans-serif; color: var(--muted); }
.length-status.warning .status-dot { background: var(--gold); }
.length-status.error .status-dot { background: var(--wine); }
.preview-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; gap: 7px; }
.preview-empty[hidden] { display: none; }
.empty-gem { font-size: 44px; color: var(--gold); }
.preview-empty strong { font-size: 15px; }
.preview-empty small { color: var(--muted); font-size: 11px; }
.stage-actions { display: flex; justify-content: center; align-items: center; gap: 8px; position: relative; z-index: 3; }
.stage-actions button { height: 40px; border: 1px solid var(--line); padding: 0 16px; font: 11px "Microsoft YaHei", sans-serif; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; }
.secondary-action { background: rgba(255,253,249,.7); }
.primary-action { background: var(--ink); border-color: var(--ink) !important; color: white; min-width: 132px; justify-content: center; }
.stage-tip { margin: 9px 0 0; text-align: center; color: var(--muted); font: 9px "Microsoft YaHei", sans-serif; }

.config-section { padding: 19px 0 21px; border-bottom: 1px solid var(--line); }
.section-label { display: flex; align-items: baseline; gap: 8px; margin-bottom: 16px; }
.section-label > span { font: 9px Arial; color: var(--gold-deep); }
.section-label > strong { font-size: 13px; font-weight: 600; }
.section-label > small { margin-left: auto; color: var(--muted); font-size: 10px; }
.size-stepper { height: 54px; border: 1px solid var(--line); display: grid; grid-template-columns: 48px 1fr 48px; align-items: stretch; background: #fbf9f4; }
.size-stepper button { border: 0; background: transparent; font-size: 20px; cursor: pointer; }
.size-stepper button:first-child { border-right: 1px solid var(--line); }
.size-stepper button:last-child { border-left: 1px solid var(--line); }
.size-stepper div { display: flex; align-items: baseline; justify-content: center; gap: 4px; }
.size-stepper strong { font: 25px Georgia, serif; }
.size-stepper small { font: 11px Arial; color: var(--muted); }
.size-range { appearance: none; width: 100%; height: 2px; background: #cfc9bf; margin: 20px 0 8px; display: block; }
.size-range::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--gold); border: 3px solid var(--paper); box-shadow: 0 0 0 1px var(--gold); cursor: pointer; }
.range-labels { display: flex; justify-content: space-between; font: 9px "Microsoft YaHei", sans-serif; color: var(--muted); }
.fit-control { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fit-control button { min-height: 52px; border: 1px solid var(--line); background: transparent; font-size: 12px; cursor: pointer; }
.fit-control button small { display: block; margin-top: 4px; font: 9px Arial; color: var(--muted); }
.fit-control button.active { border-color: var(--gold); background: #fbf7ed; color: var(--gold-deep); }
.material-inspector { min-height: 139px; }
.inspector-empty { padding: 9px 0; color: var(--muted); font-size: 11px; }
.inspector-material { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.mini-bead { width: 34px; height: 34px; border-radius: 50%; background: var(--pearl); }
.inspector-material div { display: grid; gap: 3px; }
.inspector-material strong { font-size: 12px; }
.inspector-material small { font: 9px Arial; color: var(--muted); }
.piece-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.piece-actions button { border: 1px solid var(--line); height: 29px; background: transparent; font-size: 9px; padding: 0 3px; cursor: pointer; }
.piece-actions .danger-text { color: var(--wine); }
.price-section { padding-top: 18px; }
.price-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; font-family: "Microsoft YaHei", sans-serif; font-size: 10px; color: var(--muted); }
.price-row strong { color: var(--ink); font: 11px Arial; font-weight: 500; }
.grand-total { margin: 18px 0 16px; padding-top: 16px; border-top: 1px solid var(--ink); display: flex; justify-content: space-between; align-items: center; }
.grand-total div { display: grid; gap: 4px; }
.grand-total span { font-size: 13px; font-weight: 600; }
.grand-total small { font: 8px "Microsoft YaHei", sans-serif; color: var(--muted); }
.grand-total > strong { font: 25px Georgia, serif; color: var(--gold-deep); }
.checkout-button { width: 100%; height: 50px; border: 0; background: var(--ink); color: white; display: flex; justify-content: space-between; align-items: center; padding: 0 20px; cursor: pointer; font-size: 13px; }
.checkout-button b { font: 19px Arial; font-weight: 400; }

.display-bead, .bracelet-piece, .mini-bead {
    --mc: var(--material-color, #d9d6ce);
    border-radius: 50%;
    background-color: var(--mc);
    background-image: radial-gradient(circle at 31% 25%, rgba(255,255,255,.94) 0 5%, rgba(255,255,255,.37) 7%, transparent 25%), radial-gradient(circle at 63% 68%, rgba(0,0,0,.16), transparent 49%), linear-gradient(128deg, transparent 27%, rgba(255,255,255,.28) 36%, transparent 44%);
    border: 1px solid rgba(44,38,30,.16);
    box-shadow: inset -5px -6px 10px rgba(38,31,25,.14), inset 4px 4px 8px rgba(255,255,255,.35), 0 4px 7px rgba(31,31,29,.18);
    background-size: cover;
    background-position: center;
}
.texture-clear { opacity: .84; backdrop-filter: blur(2px); border-color: rgba(120,130,135,.3); }
.texture-rose::after, .texture-amethyst::after, .texture-jade::after, .texture-moon::after, .texture-rutilated::after, .texture-agate::after, .display-bead.texture-rose::after, .display-bead.texture-amethyst::after, .display-bead.texture-jade::after, .display-bead.texture-moon::after, .display-bead.texture-rutilated::after, .display-bead.texture-agate::after { content: ""; position: absolute; inset: 16% 22% 18% 18%; border-radius: 50%; background: rgba(255,255,255,.16); filter: blur(3px); transform: rotate(25deg); pointer-events: none; }
.display-bead { position: relative; }
.texture-obsidian { background-image: radial-gradient(circle at 31% 25%, rgba(255,255,255,.58) 0 4%, transparent 22%), radial-gradient(circle at 55% 68%, #08080a, #343238 58%, #131315); }
.texture-gold { background-image: radial-gradient(circle at 28% 20%, #fff5c6 0 4%, transparent 18%), linear-gradient(135deg, #7c5721, #e1c06f 32%, #8a6329 55%, #f0d891 72%, #805d27); border-color: #a17c37; }
.texture-silver { background-image: radial-gradient(circle at 28% 20%, white 0 5%, transparent 20%), linear-gradient(135deg, #777b7d, #f1f1ef 35%, #92989b 56%, #f5f5f2 76%, #777c7f); }
.texture-pearl { background-image: radial-gradient(circle at 31% 25%, white 0 6%, rgba(255,255,255,.4) 15%, transparent 31%), linear-gradient(135deg, #cbc5b9, #fffdf7 40%, #d7d0c3 62%, #f6efe5); }

.modal { position: fixed; inset: 0; z-index: 100; display: none; }
.modal.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(19,19,18,.58); backdrop-filter: blur(5px); }
.modal-panel { position: absolute; background: var(--paper); box-shadow: var(--shadow); }
.checkout-panel { width: min(920px, calc(100% - 32px)); max-height: calc(100vh - 38px); overflow-y: auto; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 34px; }
.modal-close { position: absolute; right: 20px; top: 16px; width: 34px; height: 34px; border: 0; background: transparent; font: 23px Arial; cursor: pointer; }
.modal-title h2 { margin: 0 0 8px; font-size: 25px; font-weight: 600; }
.modal-title p { margin: 0; color: var(--muted); font-size: 11px; }
.checkout-layout { display: grid; grid-template-columns: 270px 1fr; gap: 32px; margin-top: 28px; }
.order-preview-mini { min-height: 345px; background: #f1eee7; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px; }
#mini-bracelet { width: 210px; height: 210px; position: relative; }
.order-preview-mini > span { margin-top: 20px; font: 10px "Microsoft YaHei", sans-serif; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid label { display: grid; gap: 7px; }
.form-grid label.full { grid-column: 1/-1; }
.form-grid label span { font: 10px "Microsoft YaHei", sans-serif; color: #5e5b55; }
.form-grid input, .form-grid textarea { width: 100%; border: 1px solid var(--line); background: #fbfaf6; border-radius: 0; padding: 10px 11px; outline: none; font: 12px "Microsoft YaHei", sans-serif; resize: vertical; }
.form-grid input:focus, .form-grid textarea:focus { border-color: var(--gold); }
.checkout-total { display: flex; justify-content: space-between; align-items: center; padding: 18px 0 14px; margin-top: 5px; border-top: 1px solid var(--line); }
.checkout-total span { font-size: 12px; }
.checkout-total strong { font: 22px Georgia, serif; color: var(--gold-deep); }
.submit-order { width: 100%; height: 47px; border: 0; background: var(--ink); color: white; cursor: pointer; }

.ar-modal { background: #0f0f0e; }
.ar-shell { position: absolute; inset: 0; overflow: hidden; background: #0f0f0e; }
#ar-video, #ar-canvas { position: absolute; width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
#ar-canvas { pointer-events: none; }
.ar-shade { position: absolute; inset: 0; box-shadow: inset 0 0 180px rgba(0,0,0,.45); pointer-events: none; }
.ar-header { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: 26px 30px; color: white; z-index: 3; }
.ar-header div { display: grid; gap: 6px; }
.ar-header span { font: 9px Arial; letter-spacing: 2px; color: #d7bd84; }
.ar-header strong { font-size: 14px; font-weight: 500; }
.ar-header button { width: 39px; height: 39px; border-radius: 50%; border: 1px solid rgba(255,255,255,.5); color: white; background: rgba(0,0,0,.2); font: 24px Arial; cursor: pointer; }
.ar-status { position: absolute; left: 50%; top: 16%; transform: translateX(-50%); color: white; display: flex; align-items: center; gap: 8px; font: 11px "Microsoft YaHei", sans-serif; background: rgba(0,0,0,.38); padding: 8px 12px; }
.ar-status i { width: 7px; height: 7px; border-radius: 50%; background: #d7bd84; animation: pulse 1.2s infinite; }
.ar-status.tracking i { background: #8fb199; animation: none; }
.ar-controls { position: absolute; left: 50%; bottom: max(28px, env(safe-area-inset-bottom)); transform: translateX(-50%); color: white; display: grid; grid-template-columns: 100px 74px 100px; align-items: center; gap: 24px; z-index: 3; }
.ar-controls > button:not(.capture-button) { color: white; background: rgba(15,15,14,.48); border: 1px solid rgba(255,255,255,.4); height: 38px; font-size: 11px; cursor: pointer; }
.capture-button { width: 72px; height: 72px; border-radius: 50%; background: transparent; border: 2px solid white; padding: 6px; cursor: pointer; }
.capture-button i { display: block; width: 100%; height: 100%; border-radius: 50%; background: white; }
@keyframes pulse { 50% { opacity: .35; } }

.success-sheet { position: fixed; z-index: 120; inset: 0; background: var(--paper); display: none; place-content: center; justify-items: center; text-align: center; padding: 24px; }
.success-sheet.open { display: grid; }
.success-mark { width: 60px; height: 60px; border: 1px solid var(--gold); border-radius: 50%; display: grid; place-items: center; font: 26px Arial; color: var(--gold-deep); margin-bottom: 20px; }
.success-sheet > span { font: 9px Arial; letter-spacing: 2px; color: var(--gold-deep); }
.success-sheet h2 { font-size: 27px; margin: 10px 0 8px; }
.success-sheet p { font-size: 13px; }
.success-sheet small { color: var(--muted); font-size: 11px; max-width: 420px; line-height: 1.8; }
.success-sheet button { margin-top: 24px; width: 190px; height: 44px; background: var(--ink); color: white; border: 0; cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 18px); background: var(--ink); color: white; padding: 10px 16px; font: 11px "Microsoft YaHei", sans-serif; z-index: 200; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; box-shadow: 0 8px 28px rgba(0,0,0,.24); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.fly-bead { position: fixed !important; z-index: 300; pointer-events: none; margin: 0 !important; transition: left .42s cubic-bezier(.2,.8,.2,1), top .42s cubic-bezier(.2,.8,.2,1), transform .42s, opacity .42s; }

.view-line .bracelet-stage { width: min(620px, 95%); height: 210px; aspect-ratio: auto; }
.view-line .bracelet-rope { width: 82%; height: 0; left: 9%; top: 50%; border: 0; border-top: 3px solid var(--rope-color, #d2cec5); border-radius: 0; }
.view-line .stage-center { display: none; }

@media (max-width: 1160px) {
    .studio { grid-template-columns: 280px minmax(420px, 1fr) 310px; }
    .material-library, .configuration { padding-left: 18px; padding-right: 18px; }
    .design-stage { padding-left: 18px; padding-right: 18px; }
    .bracelet-stage { width: min(390px, 88%); }
    .flow-indicator { display: none; }
    .topbar { grid-template-columns: 1fr auto; }
}

@media (max-width: 900px) {
    .topbar { height: 64px; padding: 0 16px; position: sticky; top: 0; }
    .brand-mark { width: 34px; height: 34px; }
    .brand-copy strong { font-size: 18px; }
    .top-actions .admin-link { display: none; }
    .studio { display: flex; flex-direction: column; min-height: auto; }
    .design-stage { order: 1; min-height: auto; padding: 12px 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 64px; background: var(--ivory); z-index: 10; }
    .material-library { order: 2; border: 0; border-bottom: 1px solid var(--line); padding: 20px 16px; }
    .configuration { order: 3; border: 0; padding: 20px 16px 110px; }
    .stage-toolbar { position: absolute; left: 12px; right: 12px; top: 10px; }
    .preview-wrap { min-height: 320px; height: 42vh; max-height: 390px; }
    .bracelet-stage { width: min(320px, 78vw); }
    .stage-actions { gap: 5px; }
    .stage-actions button { padding: 0 10px; }
    .stage-actions .secondary-action:last-of-type { display: none; }
    .stage-tip { display: none; }
    .material-grid { display: flex; overflow-x: auto; overflow-y: hidden; max-height: none; padding: 0 0 9px; scroll-snap-type: x proximity; }
    .material-card { min-width: 132px; scroll-snap-align: start; }
    .selection-helper { margin-top: 8px; position: sticky; bottom: 0; background: var(--paper); }
    .config-section { max-width: 640px; margin: 0 auto; }
    .price-section { position: fixed; left: 0; right: 0; bottom: 0; background: var(--paper); border-top: 1px solid var(--line); padding: 10px 16px max(10px, env(safe-area-inset-bottom)); z-index: 30; display: grid; grid-template-columns: 1fr 200px; gap: 12px; align-items: center; }
    .price-row { display: none; }
    .grand-total { border: 0; padding: 0; margin: 0; }
    .grand-total small { display: none; }
    .checkout-button { height: 48px; }
    .checkout-layout { grid-template-columns: 1fr; }
    .order-preview-mini { min-height: 240px; }
}

@media (max-width: 560px) {
    .top-actions .icon-text-button { font-size: 0; }
    .top-actions .icon-text-button span { font-size: 22px; }
    .design-stage { top: 64px; }
    .preview-wrap { min-height: 286px; height: 40vh; max-height: 330px; }
    .bracelet-stage { width: min(285px, 76vw); }
    .length-status { bottom: 0; }
    .stage-actions button { font-size: 10px; height: 37px; }
    .stage-actions button span { display: none; }
    .view-switch button { min-width: 50px; }
    .history-tools .icon-button { width: 29px; height: 29px; }
    .material-library .panel-heading { margin-bottom: 14px; }
    .material-library .panel-heading h1 { font-size: 19px; }
    .material-card { min-width: 122px; min-height: 126px; }
    .material-visual { height: 62px; }
    .piece-actions { grid-template-columns: repeat(2, 1fr); }
    .price-section { grid-template-columns: 1fr 174px; }
    .grand-total > strong { font-size: 21px; }
    .grand-total span { font-size: 11px; }
    .checkout-button { padding: 0 14px; font-size: 11px; }
    .checkout-panel { width: 100%; max-height: 92vh; top: auto; bottom: 0; transform: translateX(-50%); padding: 25px 18px; }
    .modal-title h2 { font-size: 22px; }
    .checkout-layout { margin-top: 20px; gap: 18px; }
    .order-preview-mini { display: none; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid label { grid-column: 1/-1; }
    .ar-controls { grid-template-columns: 84px 66px 84px; gap: 16px; }
    .capture-button { width: 64px; height: 64px; }
    .ar-header { padding: 20px 16px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
