:root {
    --bg: #081412;
    --card: rgba(10, 18, 17, 0.84);
    --card-border: rgba(255, 255, 255, 0.08);
    --text: #f7f2df;
    --muted: #b1beb5;
    --green: #1ecf74;
    --yellow: #f0c65d;
    --danger: #ff8f7d;
    --shadow: 0 30px 70px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(240, 198, 93, 0.16), transparent 24%),
        radial-gradient(circle at bottom right, rgba(30, 207, 116, 0.16), transparent 28%),
        linear-gradient(160deg, #07100d 0%, #020504 100%);
}

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

.hero {
    margin-bottom: 24px;
}

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

.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;
}

.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(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--muted);
}

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

.stepper-item.is-active {
    border-color: rgba(240, 198, 93, 0.45);
}

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

.stepper-item.is-active .stepper-index,
.stepper-item.is-complete .stepper-index {
    background: linear-gradient(135deg, var(--yellow) 0%, #fff0b6 100%);
    color: #19170f;
}

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

.wizard-step {
    display: none;
}

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

.card {
    position: relative;
    border-radius: 30px;
    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.05), transparent 30%);
    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(30, 207, 116, 0.35);
    background: rgba(30, 207, 116, 0.14);
    color: #c6f8da;
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-gold {
    border-color: rgba(240, 198, 93, 0.35);
    background: rgba(240, 198, 93, 0.12);
    color: #ffe5a1;
}

.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(255, 255, 255, 0.08);
    background:
        linear-gradient(135deg, rgba(240, 198, 93, 0.12), rgba(30, 207, 116, 0.12)),
        #07100d;
}

#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(4, 8, 7, 0.16), rgba(4, 8, 7, 0.68)),
        repeating-linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.04) 0,
            rgba(255, 255, 255, 0.04) 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(255, 255, 255, 0.16);
    border-top-color: var(--yellow);
    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(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    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(240, 198, 93, 0.58);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

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

.field span {
    font-weight: 800;
}

.field textarea {
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    padding: 14px 16px;
    font: inherit;
    outline: none;
}

.field textarea:focus {
    border-color: rgba(240, 198, 93, 0.58);
    box-shadow: 0 0 0 3px rgba(240, 198, 93, 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(--yellow) 0%, #ffe6a3 100%);
    color: #17150d;
}

.btn-secondary {
    background: linear-gradient(135deg, rgba(30, 207, 116, 0.22), rgba(30, 207, 116, 0.38));
    border: 1px solid rgba(30, 207, 116, 0.35);
    color: var(--text);
}

.btn-accent {
    background: linear-gradient(135deg, #ffe29e 0%, #f1c655 100%);
    color: #16130a;
}

.btn-ghost {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.12);
    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: 24px;
    }

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