@import url('_tokens.css');

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--text);
    background: var(--navy-3);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    position: relative;
}

/* ===== Backgrounds ===== */
.bg-base {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% -10%, rgba(242, 168, 37, 0.22), transparent 55%),
        radial-gradient(ellipse at 85% 0%, rgba(140, 60, 220, 0.25), transparent 60%),
        radial-gradient(ellipse at top, var(--navy-1) 0%, var(--navy-2) 45%, var(--navy-3) 100%);
    z-index: -3;
}

.bg-base::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'><g fill='none' stroke='%23f2c14e' stroke-opacity='0.12'><circle cx='15' cy='15' r='5'/><circle cx='45' cy='45' r='5'/><text x='12' y='19' font-family='Georgia' font-size='7' fill='%23f2c14e' fill-opacity='0.18' stroke='none'>$</text><text x='42' y='49' font-family='Georgia' font-size='7' fill='%23f2c14e' fill-opacity='0.18' stroke='none'>$</text></g></svg>");
    background-size: 60px 60px;
    opacity: 0.55;
    mix-blend-mode: screen;
    pointer-events: none;
}

.bg-blob {
    position: fixed;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    filter: blur(130px);
    opacity: 0.55;
    z-index: -2;
    pointer-events: none;
    animation: drift 32s ease-in-out infinite alternate;
}
.bg-blob--gold {
    top: -160px;
    left: -120px;
    background: radial-gradient(circle, rgba(255, 199, 90, 0.9), rgba(255, 150, 20, 0.2) 60%, transparent 75%);
}
.bg-blob--purple {
    bottom: -180px;
    right: -140px;
    background: radial-gradient(circle, rgba(160, 85, 255, 0.8), rgba(82, 30, 170, 0.2) 60%, transparent 75%);
    animation-duration: 38s;
    animation-delay: -10s;
}

/* ===== Money rain ===== */
#money-rain {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.money {
    position: absolute;
    top: -12vh;
    width: 40px;
    height: 40px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    opacity: 0;
    will-change: transform, opacity;
    animation: fall linear infinite;
    filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.45))
            drop-shadow(0 0 12px rgba(255, 199, 90, 0.35));
}
.money--bill {
    width: 58px;
    height: 32px;
}

@keyframes fall {
    0%   { transform: translate3d(var(--sway, 0), -12vh, 0) rotate(0deg); opacity: 0; }
    10%  { opacity: 0.85; }
    85%  { opacity: 0.85; }
    100% { transform: translate3d(calc(var(--sway, 0) * -1), 118vh, 0) rotate(540deg); opacity: 0; }
}

.money--burst {
    animation-duration: 1.8s !important;
    animation-timing-function: cubic-bezier(.3,.7,.4,1) !important;
}

/* Sparkles */
#sparkles {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}
.sparkle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #fff3b0;
    box-shadow: 0 0 10px 2px rgba(255, 220, 120, 0.9);
    animation: twinkle 3.5s ease-in-out infinite;
}
/* ===== Page layout ===== */
.page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
}

/* ===== Card ===== */
.card {
    width: 100%;
    max-width: 560px;
    background: linear-gradient(145deg, var(--card-bg-1), var(--card-bg-2));
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 40px 36px 32px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow:
        0 0 80px rgba(255, 183, 0, 0.2),
        0 30px 60px rgba(0, 0, 0, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 220, 130, 0.45), transparent 30%, transparent 70%, rgba(255, 160, 50, 0.45));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    pointer-events: none;
    opacity: 0.8;
}

/* ===== Header ===== */
.card__header {
    text-align: center;
    margin-bottom: 24px;
}

.app-icon {
    width: 112px;
    height: 112px;
    margin: 0 auto 18px;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 30% 25%, #1a1a4a, #0a0820);
    box-shadow:
        0 0 0 3px #f2c14e,
        0 0 0 6px rgba(242, 193, 78, 0.25),
        0 12px 40px rgba(255, 183, 0, 0.5),
        inset 0 0 30px rgba(255, 183, 0, 0.2);
    animation: breathe 4s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}
.app-icon img {
    width: 100%;
    height: 100%;
    border-radius: 24px;
    object-fit: cover;
    display: block;
}
.app-icon__fallback {
    display: none;
}

@keyframes breathe {
    0%, 100% { box-shadow: 0 0 0 3px #f2c14e, 0 0 0 6px rgba(242, 193, 78, 0.25), 0 12px 40px rgba(255, 183, 0, 0.5), inset 0 0 30px rgba(255, 183, 0, 0.2); }
    50%      { box-shadow: 0 0 0 3px #f2c14e, 0 0 0 8px rgba(242, 193, 78, 0.4), 0 18px 60px rgba(255, 183, 0, 0.75), inset 0 0 40px rgba(255, 183, 0, 0.3); }
}

.brand-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(242, 193, 78, 0.12);
    border: 1px solid rgba(242, 193, 78, 0.35);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #ffe28a;
    margin-bottom: 14px;
}
.brand-chip__dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.9);
}

.card__title {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 34px;
    line-height: 1.15;
    margin: 0 0 8px;
    background: linear-gradient(90deg, #ffe28a, #f2a825);
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
    letter-spacing: -0.01em;
}

.card__subtitle {
    color: var(--text-muted);
    font-size: 15px;
    margin: 0;
}

/* ===== Warning ===== */
.warning {
    display: flex;
    gap: 14px;
    padding: 16px 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.1), rgba(242, 168, 37, 0.1));
    border: 1px solid rgba(255, 150, 50, 0.4);
    margin-bottom: 24px;
}
.warning__icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffd76a, #f2a825);
    color: #3a1e00;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(242, 168, 37, 0.45);
}
.warning__icon svg { width: 20px; height: 20px; }
.warning__body strong {
    display: block;
    font-size: 15px;
    color: #ffd38a;
    margin-bottom: 4px;
    font-weight: 700;
}
.warning__body p {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.55;
    color: #d8d0e2;
}

/* ===== Steps ===== */
.form { display: block; }

.step {
    display: flex;
    gap: 14px;
    padding-top: 8px;
    margin-bottom: 8px;
    transition: opacity 0.5s ease, max-height 0.5s ease, transform 0.5s ease;
}

.step--hidden {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transform: translateY(-6px);
    pointer-events: none;
    margin: 0;
    padding: 0;
}

.step--revealed {
    opacity: 1;
    max-height: 800px;
    transform: translateY(0);
    pointer-events: auto;
    padding-top: 20px;
    margin-top: 12px;
    border-top: 1px dashed rgba(242, 193, 78, 0.2);
}

.step__badge {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-2), var(--gold-4));
    color: #2a1500;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(242, 168, 37, 0.4);
}

.step__content {
    flex: 1;
    min-width: 0;
}

/* ===== Fields ===== */
.field__label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #e8dfc8;
    margin-bottom: 8px;
    letter-spacing: 0.02em;
}

.field {
    position: relative;
    display: flex;
    align-items: center;
}
.field input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field input::placeholder { color: #7b7590; }
.field input:focus {
    border-color: var(--gold-2);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(242, 168, 37, 0.3);
}
.field--with-prefix input {
    padding-left: 44px;
}
.field__prefix {
    position: absolute;
    left: 14px;
    color: var(--gold-2);
    font-weight: 700;
    font-size: 16px;
    pointer-events: none;
}

.field--otp input {
    text-align: center;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 22px;
    letter-spacing: 12px;
    padding: 16px 12px;
}

.field__help {
    font-size: 12.5px;
    color: var(--text-muted);
    margin: 8px 0 0;
    line-height: 1.5;
}
.field__error {
    font-size: 13px;
    color: #ff9090;
    margin-top: 8px;
    min-height: 0;
    line-height: 1.4;
}
.field__error:not(:empty) {
    margin-top: 10px;
}

.resend-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    font-size: 13px;
    color: var(--text-muted);
}
.resend-row strong { color: #ffe28a; }
.resend-btn {
    background: none;
    border: none;
    color: var(--gold-2);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.resend-btn:disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}
.resend-btn:not(:disabled):hover {
    background: rgba(242, 168, 37, 0.12);
    color: #ffe28a;
}

/* ===== Acknowledge checkbox ===== */
.ack {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    margin-top: 18px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.ack:hover { border-color: rgba(242, 193, 78, 0.35); background: rgba(255,255,255,0.05); }
.ack input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.ack__box {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid rgba(242, 193, 78, 0.5);
    background: rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: transparent;
    transition: all 0.2s;
    margin-top: 1px;
}
.ack__box svg { width: 14px; height: 14px; }
.ack input:checked + .ack__box {
    background: linear-gradient(135deg, var(--gold-2), var(--gold-4));
    border-color: var(--gold-3);
    color: #2a1500;
    box-shadow: 0 4px 12px rgba(242, 168, 37, 0.4);
}
.ack input:focus-visible + .ack__box {
    box-shadow: 0 0 0 3px rgba(242, 168, 37, 0.4);
}
.ack__text {
    font-size: 13.5px;
    line-height: 1.55;
    color: #cfc7dd;
}
.ack__text strong { color: #ff9aa2; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 15px 20px;
    border: none;
    border-radius: 14px;
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.01em;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
    margin-top: 18px;
}
.btn:disabled {
    cursor: not-allowed;
    filter: grayscale(0.4) brightness(0.75);
}
.btn__coin {
    display: inline-flex;
    width: 22px;
    height: 22px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #2a1500;
    color: #ffe28a;
    font-weight: 800;
    font-size: 13px;
    box-shadow: inset 0 -2px 0 rgba(0,0,0,0.3);
}
.btn__trash { width: 18px; height: 18px; }

.btn--gold {
    background: linear-gradient(135deg, #ffd76a 0%, #f2a825 50%, #c57a10 100%);
    color: #2a1500;
    box-shadow:
        0 10px 30px rgba(242, 168, 37, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}
.btn--gold:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow:
        0 14px 36px rgba(242, 168, 37, 0.55),
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        inset 0 -2px 0 rgba(0, 0, 0, 0.15);
}
.btn--gold:not(:disabled):active { transform: translateY(0); }

.btn--danger {
    background: linear-gradient(135deg, var(--danger-1), var(--danger-2));
    color: #fff;
    box-shadow:
        0 10px 30px rgba(212, 37, 42, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.btn--danger:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 36px rgba(212, 37, 42, 0.6), inset 0 1px 0 rgba(255,255,255,0.2);
}

.btn--ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.15);
    text-decoration: none;
    margin-top: 24px;
}
.btn--ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(242, 193, 78, 0.45);
}

.btn--shake {
    animation: shake 0.4s ease-in-out;
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* Shimmer overlay on gold button */
.btn--gold::after {
    content: "";
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,0.45) 50%, transparent 70%);
    animation: shimmer 3.2s ease-in-out infinite;
}

/* ===== Footer ===== */
.card__footer {
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
}
.secure {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}
.secure svg { width: 16px; height: 16px; color: var(--gold-2); }

.cancel-link {
    color: var(--gold-2);
    text-decoration: none;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid rgba(242, 193, 78, 0.3);
    transition: all 0.2s;
}
.cancel-link:hover {
    background: rgba(242, 193, 78, 0.1);
    border-color: var(--gold-2);
    color: #ffe28a;
}

/* ===== Success card ===== */
.card--success {
    text-align: center;
    padding: 48px 36px;
}
.success-check {
    width: 100px;
    height: 100px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.2), rgba(34, 197, 94, 0.3));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 40px rgba(74, 222, 128, 0.35);
}
.success-check svg {
    width: 64px;
    height: 64px;
    stroke: #4ade80;
    stroke-width: 3.5;
}
.success-check__circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    animation: stroke 0.7s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}
.success-check__mark {
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    animation: stroke 0.45s cubic-bezier(0.65, 0, 0.45, 1) 0.55s forwards;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke: #4ade80;
    stroke-width: 3.5;
    fill: none;
}
@keyframes stroke {
    to { stroke-dashoffset: 0; }
}
.success-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 28px;
    margin: 0 0 12px;
    background: linear-gradient(90deg, #ffe28a, #f2a825);
    -webkit-background-clip: text;
            background-clip: text;
    color: transparent;
}
.success-body {
    color: var(--text-muted);
    font-size: 14.5px;
    line-height: 1.6;
    margin: 0 auto;
    max-width: 420px;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(20, 14, 40, 0.95);
    border: 1px solid rgba(255, 107, 107, 0.4);
    color: #fff;
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    z-index: 1000;
    max-width: calc(100vw - 40px);
}
.toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== Responsive ===== */
@media (max-width: 560px) {
    .page { padding: 28px 14px; }
    .card {
        padding: 30px 22px 24px;
        border-radius: 22px;
    }
    .card__title { font-size: 28px; }
    .app-icon { width: 92px; height: 92px; border-radius: 22px; }
    .warning { padding: 14px; gap: 12px; }
    .warning__icon { width: 32px; height: 32px; }
    .step { gap: 12px; }
    .step__badge { width: 30px; height: 30px; font-size: 14px; }
    .btn { padding: 14px 16px; font-size: 14px; }
    .card__footer { flex-direction: column-reverse; align-items: stretch; text-align: center; }
    .cancel-link { text-align: center; }
    .secure { justify-content: center; }
    .field--otp input { font-size: 18px; letter-spacing: 8px; }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
    .bg-blob,
    .app-icon,
    .btn--gold::after,
    .sparkle,
    .money {
        animation: none !important;
    }
    .money { display: none; }
}
