:root {
    --card-bg: #bedc9c;
    --title-green: #2f7141;
    --title-muted: #6f7e61;
    --mustela-blue: #005cb3;
    --button-green: #2f7b49;
    --button-muted: #748d6d;
    --text-dark: #4f4f4f;
    --white: #ffffff;
    --side-pad: clamp(10px, 3vw, 48px);
    --frame-w: min(calc(100vw - var(--side-pad) - var(--side-pad)), 54svh);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    min-height: 100svh;
    margin: 0;
    background: var(--card-bg);
    color: var(--text-dark);
    display: flex;
    justify-content: center;
    font-family: Arial, Helvetica, sans-serif;
}

.page-shell {
    width: 100%;
    min-height: 100svh;
    padding: clamp(8px, 2.4vw, 34px) var(--side-pad) clamp(14px, 3vw, 48px);
    background: var(--card-bg);
    display: flex;
    justify-content: center;
}

.eyebrow {
    display: none;
}

.avatar-card {
    width: var(--frame-w);
    padding: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero-title {
    width: 100%;
    margin: 0 0 clamp(16px, min(3.5vw, 2svh), 56px);
    text-align: center;
    line-height: 0.82;
}

.hero-title span,
.hero-title strong {
    display: block;
    letter-spacing: 0;
}

.hero-title span {
    color: var(--title-green);
    font-size: clamp(24px, min(7.9vw, 4.3svh), 112px);
    font-weight: 900;
}

.hero-title strong {
    margin-top: clamp(2px, min(0.6vw, 0.35svh), 10px);
    color: var(--title-muted);
    font-size: clamp(20px, min(6.6vw, 3.6svh), 92px);
    font-weight: 900;
}

.photo-frame {
    width: 100%;
    aspect-ratio: 244 / 303;
    height: auto;
    border-radius: clamp(7px, min(2.2vw, 1.2svh), 28px);
    background: transparent;
    overflow: hidden;
}

.image-stage {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    overflow: hidden;
    background: #ebe9df;
}

.result-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.photo-frame.is-loading .result-image {
    display: none;
}

.loading-state {
    position: absolute;
    inset: 0;
    padding: clamp(24px, min(7vw, 4svh), 110px) clamp(20px, min(6vw, 3.2svh), 90px);
    background: linear-gradient(180deg, #eef2e5 0%, #dbe7ca 100%);
    color: var(--title-green);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: clamp(14px, min(4vw, 2.2svh), 56px);
}

.photo-frame:not(.is-loading) .loading-state {
    display: none;
}

.loading-state p {
    margin: 0;
    font-size: clamp(13px, min(4.3vw, 2.3svh), 52px);
    font-weight: 800;
    line-height: 1.15;
}

.spinner {
    width: clamp(38px, min(12vw, 6.8svh), 150px);
    height: clamp(38px, min(12vw, 6.8svh), 150px);
    border-radius: 50%;
    border: clamp(3px, min(0.9vw, 0.5svh), 12px) solid rgba(47, 113, 65, 0.18);
    border-top-color: var(--title-green);
    animation: spin 0.85s linear infinite;
}

.download-btn {
    width: 100%;
    min-height: clamp(35px, min(11vw, 6.3svh), 140px);
    margin-top: clamp(14px, min(4.2vw, 2.5svh), 64px);
    border-radius: 999px;
    background: var(--button-green);
    color: var(--white);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: clamp(7px, min(2.2vw, 1.2svh), 28px);
    font-size: clamp(12px, min(4vw, 2.2svh), 48px);
    font-weight: 900;
    line-height: 1;
    transition: transform 120ms ease, background 120ms ease;
}

.download-btn:hover,
.download-btn:focus-visible {
    background: #286d40;
    transform: translateY(-1px);
}

.download-btn svg {
    width: clamp(16px, min(5vw, 2.8svh), 62px);
    height: clamp(16px, min(5vw, 2.8svh), 62px);
    fill: currentColor;
    flex: 0 0 auto;
}

.download-btn.is-disabled {
    pointer-events: none;
    background: var(--button-muted);
    opacity: 0.72;
}

.brand-logo {
    display: block;
    width: clamp(92px, min(30vw, 16.4svh), 390px);
    height: auto;
    margin-top: clamp(20px, min(6vw, 3.6svh), 90px);
}

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

@media (max-height: 480px) {
    :root {
        --frame-w: min(calc(100vw - var(--side-pad) - var(--side-pad)), 52svh);
    }
}
