:root {
    --bg: #ffffff;
    --card: rgba(255, 255, 255, 0.94);
    --card-border: rgba(93, 77, 190, 0.16);
    --text: #17152c;
    --muted: #687089;
    --blue: #1687ff;
    --purple: #7c4dff;
    --cyan: #18c7ff;
    --danger: #c83254;
    --shadow: 0 24px 60px rgba(42, 53, 110, 0.16);
}

html {
    scroll-behavior: smooth;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", sans-serif;
    color: var(--text);
    background: #ffffff;
}

.page {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 0 0 72px;
}

.hero {
    display: grid;
    justify-items: center;
    text-align: center;
    min-height: 100vh;
    align-content: center;
    margin-bottom: 0;
    padding: 32px 0;
}

.brand-logo {
    width: min(260px, 64vw);
    height: auto;
    margin: 0 auto 22px;
}

.kicker,
.card-kicker {
    margin: 0 0 8px;
    font-family: "Bebas Neue", sans-serif;
    letter-spacing: 0.18em;
    color: var(--purple);
}

.hero h1 {
    margin: 0;
    max-width: 760px;
    font-family: "Bebas Neue", sans-serif;
    font-size: clamp(3rem, 7vw, 5.8rem);
    line-height: 0.92;
    letter-spacing: 0.02em;
    color: var(--text);
}

.hero-start-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 24px;
    min-height: 54px;
    padding: 0 28px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--blue) 0%, var(--purple) 100%);
    color: #ffffff;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 16px 34px rgba(91, 87, 190, 0.24);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.hero-start-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 20px 42px rgba(91, 87, 190, 0.28);
}

.stepper {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stepper-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(93, 77, 190, 0.14);
    background: rgba(255, 255, 255, 0.78);
    color: var(--muted);
}

.stepper-item.is-active,
.stepper-item.is-complete {
    color: var(--text);
    background: rgba(255, 255, 255, 0.98);
}

.stepper-item.is-active {
    border-color: rgba(124, 77, 255, 0.45);
    box-shadow: 0 12px 30px rgba(91, 87, 190, 0.12);
}

.stepper-index {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(22, 135, 255, 0.1);
    font-weight: 800;
}

.stepper-item.is-active .stepper-index,
.stepper-item.is-complete .stepper-index {
    background: linear-gradient(135deg, var(--blue) 0%, var(--purple) 100%);
    color: #ffffff;
}

.stepper-label {
    font-weight: 800;
}

.wizard-step {
    display: none;
}

.wizard-step.is-active {
    display: block;
}

.card {
    position: relative;
    border-radius: 24px;
    border: 1px solid var(--card-border);
    background: var(--card);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), transparent 34%);
    pointer-events: none;
}

.stage-card {
    padding: 24px;
}

.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.card-head h2 {
    margin: 0;
    font-size: 1.5rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(22, 135, 255, 0.24);
    background: rgba(22, 135, 255, 0.1);
    color: #1459bb;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-gold {
    border-color: rgba(124, 77, 255, 0.26);
    background: rgba(124, 77, 255, 0.1);
    color: #5c38ca;
}

.stage-layout,
.result-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
    gap: 22px;
    align-items: start;
}

.camera-shell,
.result-shell {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    aspect-ratio: 4 / 5;
    border: 1px solid rgba(93, 77, 190, 0.16);
    background:
        linear-gradient(135deg, rgba(24, 199, 255, 0.12), rgba(124, 77, 255, 0.12)),
        #ffffff;
}

#camera,
.preview,
.result-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-overlay,
.result-placeholder {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    text-align: center;
    color: var(--muted);
    font-weight: 700;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(247, 249, 255, 0.86)),
        repeating-linear-gradient(
            135deg,
            rgba(22, 135, 255, 0.06) 0,
            rgba(22, 135, 255, 0.06) 12px,
            transparent 12px,
            transparent 24px
        );
}

.result-loading {
    display: grid;
    gap: 14px;
    justify-items: center;
}

.spinner {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 4px solid rgba(124, 77, 255, 0.14);
    border-top-color: var(--purple);
    animation: spin 0.9s linear infinite;
}

.side-panel {
    padding: 8px 4px;
}

.side-panel h3 {
    margin: 0 0 10px;
    font-size: 1.2rem;
}

.side-panel p {
    margin: 0;
    color: var(--muted);
    line-height: 1.7;
}

.theme-stage {
    display: grid;
    gap: 18px;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.theme-card {
    display: block;
    cursor: pointer;
}

.theme-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.theme-card-frame {
    display: block;
    padding: 10px;
    border-radius: 24px;
    border: 2px solid rgba(93, 77, 190, 0.14);
    background: #ffffff;
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.theme-card-frame img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border-radius: 18px;
}

.theme-meta {
    display: grid;
    gap: 6px;
    padding: 12px 8px 0;
}

.theme-meta strong {
    font-size: 1.08rem;
}

.theme-meta span {
    color: var(--muted);
    line-height: 1.6;
}

.theme-card input:checked + .theme-card-frame {
    transform: translateY(-4px);
    border-color: rgba(124, 77, 255, 0.64);
    box-shadow: 0 18px 40px rgba(91, 87, 190, 0.18);
}

.field {
    display: grid;
    gap: 8px;
}

.field span {
    font-weight: 800;
}

.field textarea {
    width: 100%;
    border: 1px solid rgba(93, 77, 190, 0.18);
    border-radius: 18px;
    background: #ffffff;
    color: var(--text);
    padding: 14px 16px;
    font: inherit;
    outline: none;
}

.field textarea:focus {
    border-color: rgba(124, 77, 255, 0.58);
    box-shadow: 0 0 0 3px rgba(124, 77, 255, 0.12);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 18px;
}

.actions.vertical {
    flex-direction: column;
}

.actions.split {
    justify-content: space-between;
}

.btn {
    appearance: none;
    border: 0;
    border-radius: 999px;
    padding: 14px 18px;
    font: inherit;
    font-weight: 800;
    text-align: center;
    cursor: pointer;
    transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue) 0%, var(--purple) 100%);
    color: #ffffff;
}

.btn-secondary {
    background: rgba(22, 135, 255, 0.1);
    border: 1px solid rgba(22, 135, 255, 0.22);
    color: #1459bb;
}

.btn-accent {
    background: linear-gradient(135deg, #18c7ff 0%, #7c4dff 100%);
    color: #ffffff;
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(93, 77, 190, 0.2);
    color: var(--muted);
}

.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.status {
    margin-top: 16px;
    min-height: 24px;
    color: var(--muted);
    line-height: 1.6;
}

.status.is-error {
    color: var(--danger);
}

.hidden {
    display: none !important;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 960px) {
    .stage-layout,
    .result-layout,
    .theme-grid,
    .stepper {
        grid-template-columns: 1fr;
    }

    .page {
        width: min(100% - 18px, 1180px);
        padding-top: 0;
    }

    .brand-logo {
        width: min(340px, 86vw);
    }

    .stage-card {
        padding: 18px;
    }
}
