:root {
    color-scheme: light;
    --ink: #18182b;
    --muted: #57566d;
    --violet: #4834da;
    --line: #e0def0;
    --background: #f9f8ff;
    font: 100%/1.5 "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #7766f6; outline-offset: 4px; }
h1, h2, h3, p, figure { margin: 0; }

.frame { width: min(100% - 48px, 1080px); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); background: #fff; }
.header-content { height: 72px; display: flex; align-items: center; justify-content: space-between; }
.wordmark { display: inline-flex; align-items: center; color: var(--ink); text-decoration: none; font-size: 1.27rem; font-weight: 750; letter-spacing: -.045em; }
.brand-mark { display: grid; place-items: center; width: 35px; height: 35px; margin-right: 10px; border-radius: 10px; color: white; background: var(--violet); font-weight: 800; font-size: .86rem; letter-spacing: -.03em; }
.wordmark .domain, .header-label { color: var(--muted); }
.header-label { font-size: .875rem; font-weight: 650; }

.intro { padding-block: clamp(38px, 6vw, 78px) clamp(25px, 4vw, 40px); }
h1 { font-size: clamp(3.25rem, 8vw, 6rem); line-height: .95; font-weight: 800; letter-spacing: -.075em; }
h1 span { color: var(--violet); }
.intro p { margin-top: 18px; color: var(--muted); font-size: clamp(1rem, 2vw, 1.18rem); }
.studio { display: grid; grid-template-columns: 1.07fr 1fr; gap: 22px; padding-bottom: 54px; }
.methods { margin: 0 0 22px; padding: 0; border: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.methods legend { margin-bottom: 8px; font-weight: 650; }
.methods label { padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; background: white; cursor: pointer; }
.methods label:has(:checked) { border-color: var(--violet); color: var(--violet); background: #efedff; }
.methods input { accent-color: var(--violet); }
#view-list { padding: 0; margin: 12px 0; list-style: none; }
#view-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; overflow-wrap: anywhere; }
.work-card { min-width: 0; padding: clamp(22px, 3.6vw, 36px); border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: 0 8px 24px #30256909; }
h2 { font-size: 1.53rem; line-height: 1.2; letter-spacing: -.035em; }
.muted { color: var(--muted); margin-top: 9px; }
.drop-zone { min-height: 186px; margin-top: 22px; padding: 16px; border: 1.5px dashed #a89cec; border-radius: 15px; background: #f8f6ff; display: grid; place-items: center; text-align: center; transition: border-color .15s, background .15s; }
.drop-zone.is-dragging { border-color: var(--violet); background: #ece7ff; }
.upload-icon { position: relative; display: grid; place-items: center; width: 42px; height: 42px; margin: 0 auto 6px; border-radius: 12px; background: #eae4ff; color: var(--violet); }
.upload-icon i { display: block; width: 16px; height: 15px; margin-top: 8px; border: 1.8px solid currentColor; border-top: none; border-radius: 3px; }
.upload-icon::before { content: ""; width: 2px; height: 15px; background: currentColor; position: absolute; top: 10px; }
.upload-icon::after { content: ""; width: 6px; height: 6px; border-top: 2px solid; border-left: 2px solid; transform: rotate(45deg); position: absolute; top: 11px; }
.picker-button, .text-button, .change-button { padding: 5px 2px; border: 0; background: none; color: var(--violet); font-weight: 700; }
.picker-button:hover, .text-button:hover, .change-button:hover { text-decoration: underline; text-underline-offset: .18em; }
.drop-zone p { color: var(--muted); font-size: .875rem; }
.photo-preview { position: relative; width: 100%; }
.photo-preview img { display: block; max-width: 100%; width: 100%; height: 152px; object-fit: contain; border-radius: 10px; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }
.change-button { min-height: 40px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: .875rem; }
#photo-crop-note { margin-top: 6px; }
.photo-options { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; column-gap: 12px; margin-top: 8px; color: var(--muted); font-size: .875rem; }
.photo-options button { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.camera-icon { display: inline-grid; width: 15px; height: 11px; border: 1.5px solid currentColor; border-radius: 2px; place-items: center; }
.camera-icon::after { content: ""; width: 4px; height: 4px; border: 1px solid currentColor; border-radius: 50%; }
.primary { display: grid; place-items: center; min-height: 53px; width: 100%; margin-top: 16px; border: 0; border-radius: 11px; background: var(--violet); color: white; font: inherit; font-weight: 750; text-decoration: none; }
.primary:hover:not(:disabled) { background: #3825be; }
.primary:disabled { color: #524aaa; background: #e8e3ff; }
.error-message { color: #a22547; font-size: .9rem; margin-top: 8px; }

.example-card { min-width: 0; min-height: 388px; display: grid; grid-template-rows: 1fr auto; overflow: hidden; border: 1px solid #d9d0fc; border-radius: 22px; background: #eee9ff; }
.example-stage { position: relative; isolation: isolate; min-height: 300px; background: radial-gradient(ellipse at 49% 40%, #e7dfff, transparent 59%), linear-gradient(150deg, #f4f0ff, #d7ccff); overflow: hidden; }
.example-stage::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: linear-gradient(#5f47c813 1px, transparent 1px), linear-gradient(90deg, #5f47c813 1px, transparent 1px); background-size: 28px 28px; mask-image: radial-gradient(ellipse at center, transparent 20%, #000 83%); }
.example-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
#model-preview, #model-preview-lite { cursor: grab; touch-action: none; }
#model-preview:active, #model-preview-lite:active { cursor: grabbing; }
.preview-feedback { position: absolute; inset: 0; display: grid; place-items: center; padding: 18px; text-align: center; color: var(--muted); }
.model-tools { display: flex; gap: 6px; }
.model-tools button { width: 42px; height: 40px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 1.25rem; }
figcaption { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 13px 20px; color: #413478; font-size: .875rem; font-weight: 650; background: #f6f2ff; border-top: 1px solid #d9d0fc; }
#preview-format { letter-spacing: .08em; }
#preview-hint { display: block; margin-top: 3px; color: var(--muted); font-weight: 400; font-size: .875rem; }

.result { min-height: 330px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 13px; }
.result-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 13px; color: var(--violet); background: #eee9ff; }
.result-icon::after { content: ""; width: 19px; height: 19px; border: 2px solid #c5baff; border-top-color: var(--violet); border-radius: 50%; animation: spin 1.3s linear infinite; }
.result-icon[data-state="complete"]::after, .result-icon[data-state="failed"]::after { width: auto; height: auto; border: 0; animation: none; font-size: 1.5rem; font-weight: 750; }
.result-icon[data-state="complete"]::after { content: "✓"; }
.result-icon[data-state="failed"]::after { content: "!"; }
.result-note { font-size: .875rem; color: var(--muted); }
.notification-card { width: 100%; padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: #f8f6ff; }
.notification-card h3 { font-size: 1.09rem; line-height: 1.3; }
.notification-card p { margin-top: 6px; color: var(--muted); font-size: .9rem; }
.notification-card label { display: block; margin-top: 12px; font-size: .9rem; font-weight: 650; }
.notification-card input { width: 100%; min-height: 44px; margin-top: 4px; padding: 8px 10px; border: 1px solid #b9b0db; border-radius: 8px; color: var(--ink); background: #fff; font: inherit; }
.notification-card .primary { min-height: 44px; margin-top: 8px; }
.notification-card .error-message { color: #a22547; }
@keyframes spin { to { transform: rotate(360deg); } }

dialog { width: min(440px, calc(100% - 32px)); padding: 22px; border: 1px solid var(--line); border-radius: 18px; color: var(--ink); }
dialog::backdrop { background: #17132aaa; }
.camera-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
video { display: block; width: 100%; max-height: 50vh; margin-top: 16px; border-radius: 12px; background: #212035; }
#camera-status:not(:empty) { margin-top: 8px; color: var(--muted); font-size: .875rem; }
#crop-dialog { width: min(620px, calc(100% - 32px)); }
.crop-help { margin: 8px 0 14px; color: var(--muted); font-size: .9rem; }
.crop-stage { display: grid; place-items: center; background: var(--background); border-radius: 10px; padding: 10px; }
#crop-editor { display: block; max-width: 100%; max-height: 47vh; cursor: crosshair; touch-action: none; }
.crop-actions { margin-top: 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.crop-actions button { white-space: nowrap; }
.crop-actions .primary { width: auto; margin: 0; padding-inline: 20px; min-height: 44px; }

@media (max-width: 720px) {
    .frame { width: calc(100% - 32px); }
    .header-content { height: 62px; }
    .studio { grid-template-columns: 1fr; gap: 16px; }
    .example-card { min-height: 276px; }
    .example-stage { min-height: 250px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::after { animation-duration: 0s !important; transition-duration: 0s !important; }
}
