@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&family=Cormorant+Garamond:ital,wght@0,500;0,600;1,400;1,600&display=swap');

:root {
    --gold: #f0cf85;
    --gold-bright: #fff4cf;
    --gold-deep: #b07b26;
    --gold-soft: rgba(240, 207, 133, 0.6);
    --gold-glow: rgba(240, 207, 133, 0.18);
    --crimson: #9d1730;
    --crimson-soft: rgba(157, 23, 48, 0.35);
    --ink: #060309;
    --glass: rgba(12, 8, 16, 0.72);
    --border: rgba(240, 207, 133, 0.18);
    --border-soft: rgba(255, 255, 255, 0.08);
    --text-dim: rgba(255, 255, 255, 0.52);
    --text-faint: rgba(255, 255, 255, 0.34);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Cinzel', serif;
    background: var(--ink);
    color: #fff;
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    position: relative;
    isolation: isolate;
}

/* ─── Ambient background ─── */
body::before {
    content: '';
    position: fixed;
    inset: -2%;
    background: url('background.png') no-repeat center 32% / cover;
    filter: brightness(0.46) saturate(1.05) contrast(1.02);
    transform: scale(1.04);
    z-index: -3;
    animation: bg-drift 38s ease-in-out infinite alternate;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(120% 80% at 50% 0%, rgba(157, 23, 48, 0.28), transparent 62%),
        radial-gradient(90% 60% at 50% 105%, rgba(0, 0, 0, 0.94), transparent 78%),
        linear-gradient(180deg, rgba(6, 3, 9, 0.76) 0%, rgba(6, 3, 9, 0.56) 42%, rgba(6, 3, 9, 0.94) 100%);
    pointer-events: none;
}

@keyframes bg-drift {
    from { transform: scale(1.04) translate3d(0, 0, 0); }
    to   { transform: scale(1.09) translate3d(0, -1.2%, 0); }
}

.embers {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: -1;
}

.ember {
    position: absolute;
    bottom: -12px;
    width: var(--size, 3px);
    height: var(--size, 3px);
    border-radius: 50%;
    background: radial-gradient(circle, #ffe9b0 0%, rgba(240, 180, 90, 0.75) 45%, rgba(180, 60, 40, 0) 72%);
    box-shadow: 0 0 8px rgba(255, 196, 110, 0.55);
    animation: ember-rise var(--dur, 14s) linear var(--delay, 0s) infinite;
}

@keyframes ember-rise {
    0%   { transform: translate3d(0, 0, 0) scale(0.6); opacity: 0; }
    12%  { opacity: var(--o, 0.6); }
    70%  { opacity: var(--o, 0.45); }
    100% { transform: translate3d(var(--drift, 40px), -102svh, 0) scale(1.15); opacity: 0; }
}

/* ─── Layout ─── */
.stage {
    width: 100%;
    display: flex;
    justify-content: center;
    z-index: 1;
}

.hidden {
    display: none !important;
}

.screen {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: rgba(240, 207, 133, 0.7);
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 0 rgba(240, 207, 133, 0.6);
    animation: dot-pulse 2.2s ease-out infinite;
    flex: none;
}

@keyframes dot-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(240, 207, 133, 0.55); }
    70%  { box-shadow: 0 0 0 7px rgba(240, 207, 133, 0); }
    100% { box-shadow: 0 0 0 0 rgba(240, 207, 133, 0); }
}

/* ─── Loading screen ─── */
#loading-screen {
    justify-content: center;
    min-height: 100svh;
    padding: 20px;
    transition: opacity 0.5s ease;
}

#loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-card {
    position: relative;
    width: 100%;
    max-width: 460px;
    padding: 46px 36px 34px;
    text-align: center;
    background:
        radial-gradient(120% 90% at 50% 0%, rgba(157, 23, 48, 0.16), transparent 60%),
        rgba(10, 6, 14, 0.82);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow:
        0 0 0 1px rgba(240, 207, 133, 0.05) inset,
        0 30px 80px rgba(0, 0, 0, 0.68),
        0 0 60px rgba(240, 207, 133, 0.06);
    overflow: hidden;
    animation: card-in 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.loading-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 12%;
    right: 12%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 244, 207, 0.85), transparent);
    opacity: 0.7;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
    to   { opacity: 1; transform: none; }
}

.sigil {
    position: relative;
    width: 108px;
    height: 108px;
    margin: 0 auto 22px;
    display: grid;
    place-items: center;
}

.sigil-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(240, 207, 133, 0.26);
    border-top-color: rgba(255, 244, 207, 0.9);
    animation: spin 6s linear infinite;
}

.sigil-ring--slow {
    inset: 11px;
    border-color: rgba(240, 207, 133, 0.14);
    border-bottom-color: var(--crimson);
    animation: spin 9s linear infinite reverse;
}

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

.sigil-core {
    font-size: 42px;
    filter: drop-shadow(0 0 14px var(--gold-soft));
    animation: icon-pulse 2.6s ease-in-out infinite;
}

@keyframes icon-pulse {
    0%, 100% { transform: scale(1);    filter: drop-shadow(0 0 10px var(--gold-soft)); }
    50%      { transform: scale(1.1);  filter: drop-shadow(0 0 24px var(--gold-soft)); }
}

.loading-card .eyebrow {
    margin-bottom: 22px;
}

.loading-step {
    display: none;
}

.loading-step.active {
    display: block;
    animation: step-in 0.5s ease both;
}

@keyframes step-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

.loading-step h2 {
    font-family: 'Cinzel', serif;
    font-weight: 600;
    font-size: clamp(16px, 4.4vw, 21px);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--gold-bright);
    text-shadow: 0 0 22px rgba(240, 207, 133, 0.3);
    margin-bottom: 20px;
}

.progress-bar {
    position: relative;
    height: 6px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    overflow: hidden;
}

.progress {
    position: relative;
    width: 0%;
    height: 100%;
    border-radius: 100px;
    background: linear-gradient(90deg, #8c5a14, #f0cf85 55%, #fff8de);
    box-shadow: 0 0 14px rgba(240, 207, 133, 0.6);
    transition: width 2.6s cubic-bezier(0.32, 0.72, 0.24, 1);
    overflow: hidden;
}

.progress::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.55) 50%, transparent 100%);
    animation: shimmer 1.7s linear infinite;
}

@keyframes shimmer {
    from { transform: translateX(-120%); }
    to   { transform: translateX(120%); }
}

.step-label {
    margin-top: 12px;
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-faint);
    min-height: 14px;
    transition: color 0.3s ease;
}

.loading-checks {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--border-soft);
    text-align: left;
}

.loading-checks li {
    position: relative;
    padding-left: 26px;
    font-size: 11px;
    letter-spacing: 0.06em;
    color: var(--text-faint);
    transition: color 0.45s ease;
}

.loading-checks li::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    width: 9px;
    height: 9px;
    margin-top: -5px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    transition: all 0.4s ease;
}

.loading-checks li.done {
    color: rgba(255, 255, 255, 0.8);
}

.loading-checks li.done::before {
    background: var(--gold);
    border-color: var(--gold-bright);
    box-shadow: 0 0 10px rgba(240, 207, 133, 0.65);
}

/* ─── Offerwall screen ─── */
#offerwall-screen {
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    padding: 18px;
    opacity: 0;
    transition: opacity 0.5s ease;
}

#offerwall-screen.visible {
    opacity: 1;
}

.offerwall-header {
    text-align: center;
    padding: 6px 4px 0;
    margin-bottom: 18px;
}

.offerwall-header .eyebrow {
    margin-bottom: 14px;
}

.offerwall-header h1 {
    font-family: 'Cinzel', serif;
    font-weight: 700;
    font-size: clamp(25px, 5.4vw, 44px);
    line-height: 1.14;
    letter-spacing: 0.015em;
    margin-bottom: 14px;
    background: linear-gradient(100deg,
        #d8b066 0%, #fff4cf 18%, #ecca86 36%,
        #b9852f 54%, #fff8e2 74%, #d8b066 100%);
    background-size: 260% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gold-flow 9s linear infinite;
    filter: drop-shadow(0 4px 26px rgba(240, 207, 133, 0.18));
}

.offerwall-header h1 em {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-weight: 600;
    font-size: 1.1em;
    background: linear-gradient(180deg, #fff6da, #e9b968 70%, #c2822d);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

@keyframes gold-flow {
    from { background-position: 0% 50%; }
    to   { background-position: 260% 50%; }
}

.lede {
    max-width: 500px;
    margin: 0 auto 18px;
    font-family: 'Cormorant Garamond', serif;
    font-size: clamp(15px, 3.6vw, 18px);
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.66);
}

.trust-row {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.trust-row li {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px;
    border-radius: 100px;
    border: 1px solid var(--border);
    background: rgba(240, 207, 133, 0.05);
    font-size: 9.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.72);
    white-space: nowrap;
}

.trust-row li::before {
    content: '✦';
    font-size: 9px;
    color: var(--gold);
    text-shadow: 0 0 8px rgba(240, 207, 133, 0.7);
}

/* ─── Steps strip ─── */
.steps-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 13px 6px;
    margin-bottom: 18px;
    border-top: 1px solid var(--border-soft);
    border-bottom: 1px solid var(--border-soft);
}

.step {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 9px;
    position: relative;
}

.step + .step::before {
    content: '';
    position: absolute;
    left: -3px;
    top: 2px;
    bottom: 2px;
    width: 1px;
    background: linear-gradient(180deg, transparent, var(--border), transparent);
}

.step-num {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 15px;
    color: var(--gold-deep);
    letter-spacing: 0.04em;
}

.step-text {
    font-size: 10px;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

/* ─── Frame ─── */
.iframe-wrapper {
    position: relative;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(8, 5, 12, 0.86);
    border: 1px solid var(--border);
    box-shadow:
        0 0 0 1px rgba(240, 207, 133, 0.04) inset,
        0 24px 60px rgba(0, 0, 0, 0.62),
        0 0 46px rgba(240, 207, 133, 0.07);
}

.iframe-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 244, 207, 0.8), transparent);
    z-index: 2;
    pointer-events: none;
}

.frame-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.01));
    border-bottom: 1px solid var(--border-soft);
}

.frame-title {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 9.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.78);
}

.frame-hint {
    font-size: 8.5px;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: var(--text-faint);
}

#offerwall-frame {
    display: block;
    width: 100%;
    height: 600px;
    border: none;
    background: #0b0710;
}

.fine-print {
    margin-top: 12px;
    text-align: center;
    font-size: 9.5px;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.26);
}

/* ─── Staggered entrance for the offerwall ─── */
#offerwall-screen.visible .offerwall-header { animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both; }
#offerwall-screen.visible .steps-strip     { animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both; }
#offerwall-screen.visible .iframe-wrapper  { animation: rise 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both; }
#offerwall-screen.visible .fine-print      { animation: rise 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.3s both; }

@keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
}

/* ─── Mobile (≤ 600px) ─── */
@media (max-width: 600px) {
    body {
        align-items: flex-start;
        padding: 0;
    }

    #loading-screen {
        padding: 18px 16px;
    }

    .loading-card {
        padding: 38px 24px 28px;
        border-radius: 18px;
    }

    .sigil {
        width: 92px;
        height: 92px;
        margin-bottom: 18px;
    }

    .sigil-core {
        font-size: 36px;
    }

    #offerwall-screen {
        padding: 16px 12px 20px;
    }

    .offerwall-header {
        margin-bottom: 12px;
    }

    .offerwall-header h1 {
        font-size: clamp(24px, 7.6vw, 34px);
        margin-bottom: 10px;
    }

    .lede {
        font-size: 15px;
        margin-bottom: 14px;
    }

    .trust-row li {
        padding: 5px 10px;
        font-size: 8.5px;
    }

    .steps-strip {
        display: none;
    }

    .frame-bar {
        padding: 8px 11px;
    }

    .frame-hint {
        display: none;
    }

    #offerwall-frame {
        height: calc(100svh - 290px);
        min-height: 360px;
    }
}

/* ─── Desktop (≥ 601px) ─── */
@media (min-width: 601px) {
    body {
        padding: 26px;
    }

    #offerwall-screen {
        padding: 22px;
    }
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }

    body::before {
        animation: none;
    }

    .embers {
        display: none;
    }
}
