.mug-layout-preview { padding: 18px; border: 1px solid #e5ded3; background: #fffcf8; border-radius: 20px; text-align: left; }
.layout-preview-heading { display: flex; justify-content: space-between; align-items: center; }
.layout-preview-heading h3 { margin: 0; color: var(--blue); font-size: 18px; }
.layout-preview-heading > span { color: var(--soft-ink); font-size: 12px; }
.layout-cup-stage { position: relative; width: 280px; height: 245px; margin: 14px auto 0; }
.layout-cup { position: absolute; left: 28px; top: 29px; width: 208px; height: 190px; border-radius: 0 0 48% 48% / 0 0 13% 13%; background: white; overflow: hidden; box-shadow: 0 16px 18px -15px #43382c80; border: 1px solid #e0dfdb; }
.layout-cup-pattern { position: absolute; inset: 14px 0 13px; background: white; background-size: auto 100%; background-repeat: repeat-x; }
[data-theme="star_sky"] .layout-cup-pattern { background-image: url('/mugs/images/theme-storybook-stripes.png'); }
[data-theme="storybook"] .layout-cup-pattern { background-image: url('/mugs/images/theme-starry-sky.png'); }
.layout-cup-shading { position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg,#73736e32,transparent 22%,#fff6 40%,transparent 65%,#62645c30); border-bottom: 9px solid #f8f7f3; border-radius: inherit; z-index: 110; }
.layout-cup-rim { position: absolute; left: 28px; top: 14px; width: 208px; height: 33px; background: linear-gradient(#cccfcf,#f4f5f1); border: 7px solid #fff; border-radius: 50%; box-shadow: 0 -1px 2px #b4b5b555; pointer-events: none; }
.layout-cup-handle { position: absolute; left: 220px; top: 47px; width: 58px; height: 120px; border: 14px solid #f9f9f5; border-left-width: 10px; border-radius: 40%; box-shadow: 2px 1px 4px #b6b6b799,inset 2px 1px 4px #b6b6b755; }
.layout-cup-characters { position: absolute; inset: 0; }
.layout-character-slot { position: absolute; top: 40px; width: 75px; height: 118px; border: 0; background: none; padding: 0; cursor: pointer; transform-origin: center; }
.layout-character-slot > svg { width: 70px; height: 105px; fill: #495056; opacity: .88; }
.layout-slot-camera { position: absolute; left: 25px; top: 56px; width: 26px; height: 26px; color: white; }
.layout-slot-camera svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.8; }
.layout-slot-number { position: absolute; top: 92px; left: 28px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #fff; color: var(--blue); font-size: 12px; font-weight: 800; border: 1px solid #d9cec0; }
.layout-character-slot[aria-pressed="true"] .layout-slot-number { background: var(--blue); color: white; }
.layout-reference-face { position: absolute; top: 4px; left: 5px; width: 65px; height: 91px; border-radius: 10px; object-fit: contain; background: white; border: 2px solid white; box-shadow: 0 2px 5px #43382c30; }
.layout-character-slot.has-photo > svg, .layout-character-slot.has-photo .layout-slot-camera { display: none; }
.layout-character-slot.has-photo .layout-slot-number { z-index: 1; }
.layout-rotation { display: flex; gap: 10px; align-items: center; }
.layout-rotation > button { width: 44px; height: 44px; flex: 0 0 44px; background: white; border: 1px solid #ded6ca; border-radius: 50%; color: var(--blue); font-size: 24px; }
.layout-rotation label { flex: 1; display: grid; text-align: center; gap: 4px; font-size: 11px; color: var(--soft-ink); }
.layout-rotation input { width: 100%; min-width: 0; accent-color: var(--blue); min-height: 28px; }
.layout-character-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.layout-character-tabs button { min-height: 40px; max-width: 100%; overflow-wrap: anywhere; border: 1px solid #dcd3c6; border-radius: 10px; background: white; padding: 8px 10px; color: var(--blue); font: inherit; font-size: 12px; }
.layout-character-tabs button[aria-pressed="true"] { color: white; background: var(--blue); border-color: var(--blue); }
.layout-order-controls { display: flex; gap: 8px; justify-content: space-between; align-items: center; margin-top: 12px; }
.layout-order-controls button { background: none; border: 0; color: var(--blue); font: inherit; font-size: 12px; min-height: 44px; padding: 4px; }
.layout-order-controls span { color: var(--soft-ink); font-size: 11px; }
.layout-order-status { font-size: 12px; color: var(--blue); margin: 4px 0 0; }
.layout-order-status:empty { display: none; }
.mug-layout-preview button:disabled { opacity: .35; cursor: default; }
.mug-layout-preview button:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.character-detail-card[hidden] { display: none !important; }
.layout-order-controls[hidden], .layout-character-tabs[hidden] { display: none; }
.layout-character-toolbar { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.layout-character-toolbar .layout-character-tabs { gap: 6px; }
.layout-character-tabs button { display: grid; place-items: center; min-width: 40px; height: 40px; padding: 6px; border-radius: 50%; }
.layout-character-toolbar .add-character-button { width: auto; min-height: 40px; margin: 0; padding: 7px 10px; gap: 4px; border-radius: 20px; }
.layout-character-toolbar svg, .layout-rotation button svg, .layout-order-controls svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.layout-rotation > button, .layout-order-controls button { display: grid; place-items: center; }
.layout-order-controls { justify-content: center; gap: 12px; margin-top: 4px; }
.layout-order-controls button { width: 40px; }
@media (max-width: 360px) { .mug-layout-preview { padding: 12px; } .layout-cup-stage { margin-left: calc((100% - 280px) / 2); transform: scale(.88); margin-top: -1px; margin-bottom: -18px; } }
