:root {
    --ink: #1d1d1f;
    --muted: #6e6e73;
    --line: rgba(0, 0, 0, .11);
    --blue: #0071e3;
    --blue-dark: #0064c8;
    --green: #20844b;
    --orange: #b65d07;
    --page: #f5f5f7;
    --card: #fff;
    --font: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body { margin: 0; overflow-x: hidden; color: var(--ink); background: var(--page); font-family: var(--font); -webkit-font-smoothing: antialiased; }
button, input, select { color: inherit; font: inherit; }
button, label, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.skip-link { position: fixed; z-index: 300; top: 8px; left: 8px; padding: 10px 14px; border-radius: 99px; background: #fff; transform: translateY(-150%); }
.skip-link:focus { transform: none; }

.eyebrow { margin: 0 0 18px; color: var(--muted); font-size: .82rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

.customizer-shell { width: min(1440px, calc(100% - 24px)); margin: 12px auto; border-radius: 30px; background: #fff; box-shadow: 0 22px 70px rgba(0,0,0,.07); }
.progress { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); width: min(1050px, calc(100% - 48px)); margin: 0 auto; padding: 28px 0 24px; list-style: none; }
.progress li { position: relative; display: grid; justify-items: center; gap: 8px; color: #9a9a9f; font-size: 12px; text-align: center; }
.progress li::before { position: absolute; z-index: 0; top: 13px; right: 50%; width: 100%; height: 2px; background: #e4e4e7; content: ""; }
.progress li:first-child::before { display: none; }
.progress span { z-index: 1; display: grid; width: 28px; height: 28px; place-items: center; border: 2px solid #dedee2; border-radius: 50%; background: #fff; font-size: 11px; font-weight: 750; }
.progress li.is-active, .progress li.is-done { color: var(--ink); }
.progress li.is-active span { color: #fff; border-color: var(--blue); background: var(--blue); box-shadow: 0 0 0 5px rgba(0,113,227,.12); }
.progress li.is-done span { color: #fff; border-color: var(--green); background: var(--green); }
.progress li.is-done::before, .progress li.is-active::before { background: var(--green); }

.workspace { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(400px, .95fr); min-height: 900px; border-top: 1px solid var(--line); }
.control-column { padding: 36px clamp(24px, 4vw, 62px) 62px; font-size: .8rem; }
.step-card { padding: 28px 0; border-bottom: 1px solid var(--line); opacity: .62; transition: opacity .25s ease; }
.step-card:first-child { padding-top: 0; }
.step-card.is-open, .step-card.is-complete { opacity: 1; }
.step-heading { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: start; }
.step-heading > span { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 10px; color: var(--blue); background: #edf5ff; font-weight: 760; }
.step-heading h2 { margin: 0; font-size: .875rem; letter-spacing: -.035em; }
.step-heading p { margin: 7px 0 0; color: var(--muted); line-height: 1.55; }

.subject-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 22px 0 14px; padding: 4px; border-radius: 13px; background: #f0f0f2; }
.subject-switch button { min-height: 42px; border: 0; border-radius: 10px; background: transparent; font-weight: 650; }
.subject-switch button[aria-checked="true"] { background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.upload-dropzone { display: grid; min-height: 182px; padding: 26px; place-items: center; align-content: center; border: 1.5px dashed #b9b9bf; border-radius: 20px; background: #fafafa; text-align: center; cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.upload-dropzone:hover, .upload-dropzone:focus-within, .upload-dropzone.is-dragging { border-color: var(--blue); background: #f3f8ff; transform: translateY(-1px); }
.upload-icon { display: grid; width: 52px; height: 52px; margin-bottom: 14px; place-items: center; border-radius: 50%; color: var(--blue); background: #eaf4ff; }
.upload-icon svg { stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.upload-dropzone small { margin-top: 7px; color: var(--muted); font-size: .8rem; line-height: 1.5; }
.check-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.check-list > div, .final-checks > div { display: grid; grid-template-columns: 30px 1fr; gap: 10px; align-items: center; padding: 13px; border-radius: 14px; background: #f5f5f7; }
.check-list > div > span, .final-checks > div > span { display: grid; width: 26px; height: 26px; place-items: center; border-radius: 50%; color: #fff; background: var(--green); font-weight: 800; }
.check-list > div > span::before { content: "✓"; }
.check-list .is-warning > span { background: var(--orange); }
.check-list .is-warning > span::before { content: "!"; }
.final-checks .is-warning > span { background: var(--orange); }
.check-list p, .final-checks p { margin: 0; }
.check-list strong, .final-checks strong { display: block; }
.check-list small, .final-checks small { display: block; margin-top: 2px; color: var(--muted); line-height: 1.35; }

.processing-card { display: grid; grid-template-columns: 64px 1fr; gap: 16px; align-items: center; margin-top: 20px; padding: 16px; border-radius: 16px; background: #f5f5f7; }
.processing-visual { position: relative; overflow: hidden; width: 64px; height: 64px; border-radius: 15px; background: linear-gradient(135deg, #dceafa, #f3e5dd); }
.processing-visual span { position: absolute; border-radius: 50%; background: rgba(255,255,255,.88); }
.processing-visual span:nth-child(1) { top: 12px; left: 20px; width: 25px; height: 25px; }
.processing-visual span:nth-child(2) { right: 8px; bottom: 8px; width: 24px; height: 24px; }
.processing-visual span:nth-child(3) { bottom: 7px; left: 8px; width: 18px; height: 18px; }
.processing-card.is-running .processing-visual::after { position: absolute; inset: -40%; background: linear-gradient(110deg, transparent 36%, rgba(255,255,255,.85) 50%, transparent 64%); content: ""; animation: scan 1.4s linear infinite; }
@keyframes scan { to { transform: translateX(70%); } }
.processing-card p { margin: 5px 0 0; color: var(--muted); line-height: 1.5; }

.field-label, .style-fieldset legend { display: block; margin: 22px 0 9px; font-weight: 700; }
select { width: 100%; min-height: 48px; padding: 0 40px 0 14px; border: 1px solid #c9c9ce; border-radius: 13px; background: #fff; }
select:focus { border-color: var(--blue); outline: 3px solid rgba(0,113,227,.13); }
select:disabled { background: #f5f5f7; cursor: not-allowed; }
.style-fieldset { margin: 20px 0 0; padding: 0; border: 0; }
.style-fieldset:disabled { opacity: .55; }
.style-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.style-option { display: grid; overflow: hidden; padding: 0; border: 1.5px solid transparent; border-radius: 15px; background: #f5f5f7; text-align: left; }
.style-option:hover { transform: translateY(-1px); }
.style-option[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,.12); }
.style-thumb { display: block; aspect-ratio: 2 / 3; background-repeat: no-repeat; background-size: 300% 200%; }
.style-copy { display: block; padding: 9px 10px 11px; }
.style-copy strong { display: block; }
.style-copy small { display: block; overflow: hidden; margin-top: 5px; color: var(--muted); font-size: .8rem; text-overflow: ellipsis; white-space: nowrap; }
.layout-controls { margin-top: 20px; padding: 16px; border-radius: 16px; background: #f5f5f7; }
.layout-heading { display: flex; justify-content: space-between; margin-bottom: 13px; }
.layout-heading span { color: var(--muted); }
.layout-controls label { display: grid; grid-template-columns: 72px 1fr 42px; gap: 10px; align-items: center; margin-top: 10px; color: #4b4b4f; }
.layout-controls input { width: 100%; accent-color: var(--blue); }
.layout-controls output { text-align: right; }
.primary-button { width: 100%; min-height: 48px; margin-top: 20px; padding: 0 22px; border: 0; border-radius: 99px; color: #fff; background: var(--blue); font-weight: 700; transition: background .2s, transform .2s; }
.primary-button:hover:not(:disabled), .primary-button:focus-visible:not(:disabled) { background: var(--blue-dark); transform: translateY(-1px); }
.primary-button:disabled { color: #999; background: #e4e4e7; cursor: not-allowed; }

.candidate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.candidate-empty { grid-column: 1 / -1; margin: 0; padding: 28px 18px; border-radius: 16px; color: var(--muted); background: #f5f5f7; line-height: 1.55; text-align: center; }
.candidate { overflow: hidden; padding: 0; border: 2px solid transparent; border-radius: 17px; background: #f5f5f7; }
.candidate img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.candidate span { display: block; padding: 10px; font-weight: 700; }
.candidate[aria-pressed="true"] { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,.12); }
.final-checks { display: grid; gap: 8px; margin-top: 14px; }
.phase-note { margin: 12px 8px 0; color: var(--muted); line-height: 1.5; text-align: center; }

.preview-column { min-width: 0; border-right: 1px solid var(--line); background: linear-gradient(160deg, #edf2f8 0, #f5eee9 100%); }
.preview-sticky { position: sticky; top: 52px; padding: 30px clamp(22px, 4vw, 54px) 40px; font-size: .8rem; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; color: #55555a; font-weight: 650; }
.preview-toolbar button { padding: 6px 10px; border: 0; border-radius: 99px; color: var(--blue); background: rgba(255,255,255,.64); }
.preview-toolbar button:disabled { color: #999; cursor: not-allowed; }
.phone-stage { display: grid; min-height: 650px; padding: 36px 0 20px; place-items: center; align-content: center; }
.phone-case { position: relative; width: min(310px, 68vw); aspect-ratio: .51; overflow: hidden; border: 8px solid rgba(45,45,49,.88); border-radius: 48px; background: #e8e5e1; box-shadow: 0 40px 80px rgba(61,50,42,.25), inset 0 0 0 2px rgba(255,255,255,.55); }
.case-art { position: absolute; inset: 0; overflow: hidden; background: linear-gradient(155deg,#f3ece5,#dce8f1); }
.case-art > img { position: absolute; top: 50%; left: 50%; width: 100%; height: 100%; object-fit: cover; transform: translate(-50%,-50%) scale(1); transform-origin: center; transition: transform .25s ease; }
.empty-art { display: grid; width: 100%; height: 100%; place-items: center; align-content: center; color: rgba(29,29,31,.44); text-align: center; }
.empty-art span { display: grid; width: 58px; height: 58px; place-items: center; border: 1px solid rgba(29,29,31,.24); border-radius: 50%; font-weight: 200; }
.empty-art p { margin: 14px 0 0; line-height: 1.5; }
.camera-cutout { position: absolute; z-index: 4; top: 22px; left: 22px; width: 112px; height: 112px; border-radius: 29px; background: rgba(231,231,229,.96); box-shadow: 0 2px 8px rgba(0,0,0,.24), inset 0 0 0 2px rgba(255,255,255,.7); }
.camera-cutout i { position: absolute; width: 38px; height: 38px; border: 6px solid #171719; border-radius: 50%; background: radial-gradient(circle at 38% 35%, #426984 0 8%, #101821 25%, #000 55%); box-shadow: 0 0 0 2px #a7a7a7; }
.camera-cutout i:nth-child(1) { top: 10px; left: 10px; }
.camera-cutout i:nth-child(2) { right: 10px; bottom: 10px; }
.camera-cutout i:nth-child(3) { bottom: 10px; left: 10px; }
.camera-cutout b { position: absolute; top: 18px; right: 18px; width: 13px; height: 13px; border-radius: 50%; background: #e7dfcb; box-shadow: 0 0 0 2px #b8b3a9; }
.safe-area { position: absolute; z-index: 3; inset: 7%; border: 1.5px dashed rgba(255,255,255,.95); border-radius: 30px; box-shadow: 0 0 0 999px rgba(0,0,0,.13); opacity: 0; transition: opacity .2s; }
.phone-case.show-safe .safe-area { opacity: 1; }
.case-gloss { position: absolute; z-index: 5; inset: 0; border-radius: 39px; background: linear-gradient(115deg, rgba(255,255,255,.23), transparent 22%, transparent 72%, rgba(255,255,255,.13)); pointer-events: none; }
.model-caption { margin: 20px 0 0; color: #646469; text-align: center; }
.status-banner { display: grid; grid-template-columns: 10px 1fr; gap: 12px; align-items: center; max-width: 430px; margin: 0 auto; padding: 14px 16px; border: 1px solid rgba(0,0,0,.08); border-radius: 16px; background: rgba(255,255,255,.7); backdrop-filter: blur(10px); }
.status-banner > span { width: 9px; height: 9px; border-radius: 50%; background: #8f8f94; }
.status-banner.is-working > span { background: var(--blue); box-shadow: 0 0 0 5px rgba(0,113,227,.12); animation: pulse 1.4s infinite; }
.status-banner.is-success > span { background: var(--green); }
.status-banner.is-error > span { background: #d93535; }
@keyframes pulse { 50% { transform: scale(.72); opacity: .65; } }
.status-banner p { margin: 0; }
.status-banner strong, .status-banner small { display: block; }
.status-banner small { margin-top: 3px; color: var(--muted); }

.photo-guide { padding: 100px 24px; text-align: center; }
.photo-guide h2 { max-width: 740px; margin: 0 auto; font-size: clamp(2.3rem, 4.2vw, 4rem); line-height: 1; letter-spacing: -.06em; }
.guide-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; width: min(1100px,100%); margin: 48px auto 0; text-align: left; }
.guide-grid article { min-height: 210px; padding: 30px; border-radius: 24px; background: #fff; }
.guide-grid span { color: var(--blue); font-size: 12px; font-weight: 750; }
.guide-grid h3 { margin: 38px 0 0; font-size: 1.35rem; }
.guide-grid p { margin: 10px 0 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.toast { position: fixed; z-index: 400; right: 22px; bottom: 22px; max-width: min(380px,calc(100% - 44px)); padding: 14px 18px; border-radius: 14px; color: #fff; background: rgba(29,29,31,.94); box-shadow: 0 12px 34px rgba(0,0,0,.24); font-size: 13px; line-height: 1.5; }

@media (max-width: 960px) {
    .workspace { grid-template-columns: 1fr; }
    .preview-column { border-right: 0; border-bottom: 1px solid var(--line); }
    .preview-sticky { position: static; }
    .phone-stage { min-height: 560px; }
    .phone-case { width: 260px; }
    .camera-cutout { transform: scale(.84); transform-origin: top left; }
}

@media (max-width: 640px) {
    .customizer-shell { width: 100%; margin: 8px 0; border-radius: 24px; }
    .progress { width: calc(100% - 28px); padding-top: 22px; }
    .progress strong { display: none; }
    .workspace { min-height: 0; }
    .preview-sticky { padding: 22px 18px 28px; }
    .phone-stage { min-height: 480px; padding-top: 24px; }
    .phone-case { width: 224px; border-width: 7px; border-radius: 38px; }
    .camera-cutout { top: 16px; left: 16px; transform: scale(.72); }
    .control-column { padding: 28px 20px 44px; }
    .step-heading { grid-template-columns: 36px 1fr; }
    .check-list { grid-template-columns: 1fr; }
    .style-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .guide-grid { grid-template-columns: 1fr; }
    .photo-guide { padding: 76px 20px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
