:root {
    --gold: #D4AF37;
    --gold-light: #F5E6A3;
    --gold-dark: #A8882C;
    --red: #C41E3A;
    --red-dark: #8B0000;
    --dark: #0a0a0a;
}

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

html {
    scroll-behavior: smooth;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: var(--gold);
    color: #000;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: rgba(212, 175, 55, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 175, 55, 0.5);
}

/* ========== PARTICLE CANVAS ========== */
#particleCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ========== GOLD TEXT ========== */
.gold-text {
    background: linear-gradient(135deg, #F5E6A3 0%, #D4AF37 40%, #C9A84C 60%, #F5E6A3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== LANDING ========== */
.landing-section {
    position: relative;
    background: radial-gradient(ellipse at center bottom, rgba(139, 0, 0, 0.15) 0%, transparent 70%);
}

.landing-glow {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(196, 30, 58, 0.12) 0%, transparent 70%);
    filter: blur(60px);
    animation: glowPulse 4s ease-in-out infinite;
}

@keyframes glowPulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.2); opacity: 1; }
}

/* ========== ENVELOPE ========== */
.envelope-container {
    perspective: 800px;
    width: 180px;
    height: 240px;
    transition: transform 0.3s ease;
}

.envelope-container:hover {
    transform: scale(1.05);
}

.envelope-body {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.envelope-front {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, #C41E3A 0%, #8B0000 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 0 40px rgba(196, 30, 58, 0.3),
        0 20px 60px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(212, 175, 55, 0.3);
}

.envelope-symbol {
    font-size: 72px;
    color: var(--gold);
    text-shadow: 0 0 30px rgba(212, 175, 55, 0.5);
    font-family: "Noto Serif SC", serif;
    font-weight: 900;
    animation: symbolGlow 3s ease-in-out infinite;
}

@keyframes symbolGlow {
    0%, 100% { text-shadow: 0 0 20px rgba(212, 175, 55, 0.3); }
    50% { text-shadow: 0 0 40px rgba(212, 175, 55, 0.6), 0 0 80px rgba(212, 175, 55, 0.2); }
}

.envelope-flap {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    height: 50%;
    background: linear-gradient(180deg, #DC143C 0%, #C41E3A 100%);
    clip-path: polygon(0 0, 100% 0, 50% 80%);
    transform-origin: top center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    border: 2px solid rgba(212, 175, 55, 0.2);
}

.envelope-gold-trim {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: 0.5;
}

.envelope-container.opened .envelope-flap {
    transform: rotateX(-180deg);
}

.envelope-container.opened .envelope-body {
    transform: translateY(-20px);
}

/* ========== BUTTONS ========== */
.btn-gold {
    position: relative;
    padding: 14px 36px;
    background: linear-gradient(135deg, var(--gold-dark), var(--gold));
    color: #000;
    font-weight: 700;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    font-family: "Noto Sans SC", sans-serif;
    font-size: 15px;
    letter-spacing: 0.05em;
}

.btn-gold::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s ease;
}

.btn-gold:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(212, 175, 55, 0.3);
}

.btn-gold:hover::before {
    left: 100%;
}

.btn-gold-large {
    position: relative;
    padding: 18px 48px;
    background: linear-gradient(135deg, var(--red), var(--gold));
    color: #fff;
    font-weight: 700;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    font-family: "Noto Sans SC", sans-serif;
    font-size: 17px;
    letter-spacing: 0.1em;
    box-shadow: 0 4px 20px rgba(196, 30, 58, 0.3);
}

.btn-gold-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 40px rgba(196, 30, 58, 0.4), 0 0 60px rgba(212, 175, 55, 0.15);
}

.btn-outline {
    padding: 14px 36px;
    background: transparent;
    color: var(--gold);
    font-weight: 600;
    border: 1px solid rgba(212, 175, 55, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: "Noto Sans SC", sans-serif;
    font-size: 15px;
}

.btn-outline:hover {
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--gold);
    transform: translateY(-1px);
}

/* ========== GLASS CARD ========== */
.glass-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* ========== WIZARD ========== */
.wizard-section {
    position: relative;
    background: radial-gradient(ellipse at top, rgba(139, 0, 0, 0.08) 0%, transparent 60%);
}

.wizard-step {
    display: none;
    animation: stepIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

@keyframes stepIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes stepOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-40px);
    }
}

/* ========== OPTION CARDS ========== */
.option-card {
    cursor: pointer;
    display: block;
}

.option-inner {
    display: flex;
    flex-direction: column;
    padding: 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    transition: all 0.3s ease;
}

.option-card:hover .option-inner {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(212, 175, 55, 0.2);
    transform: translateY(-2px);
}

.option-card input:checked + .option-inner {
    background: rgba(212, 175, 55, 0.08);
    border-color: var(--gold);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.1), inset 0 0 30px rgba(212, 175, 55, 0.03);
}

.option-card .stars {
    color: rgba(212, 175, 55, 0.4);
    font-size: 12px;
    letter-spacing: 2px;
}

.option-card input:checked + .option-inner .stars {
    color: var(--gold);
}

/* ========== RANGE SLIDER ========== */
.custom-range {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    outline: none;
}

.custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gold);
    cursor: pointer;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.custom-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.6);
}

.custom-range::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--gold);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.4);
}

/* ========== LOADING ========== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.95);
    z-index: 100;
    backdrop-filter: blur(20px);
}

.loading-coin {
    font-size: 48px;
    animation: coinFloat 2s ease-in-out infinite;
    display: inline-block;
}

.loading-coin.delay-1 {
    animation-delay: 0.3s;
}

.loading-coin.delay-2 {
    animation-delay: 0.6s;
}

@keyframes coinFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-30px) rotate(15deg); }
}

.loading-envelope {
    display: flex;
    gap: 20px;
}

/* ========== RESULTS ========== */
.result-section {
    position: relative;
    background: radial-gradient(ellipse at center top, rgba(139, 0, 0, 0.1) 0%, transparent 50%);
}

.main-result-card {
    text-align: center;
    padding: 48px 24px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.08) 0%, rgba(196, 30, 58, 0.06) 100%);
    border: 1px solid rgba(212, 175, 55, 0.15);
    border-radius: 20px;
    position: relative;
    overflow: hidden;
}

.main-result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold), transparent);
    opacity: 0.5;
}

.stat-card {
    padding: 24px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(212, 175, 55, 0.15);
    transform: translateY(-2px);
}

.chart-container {
    position: relative;
    max-height: 300px;
}

.tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* ========== TIPS ========== */
#tipsList li {
    padding: 14px 16px 14px 40px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    position: relative;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

#tipsList li::before {
    content: '◆';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold);
    font-size: 8px;
}

#tipsList li:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.7);
}

/* ========== RESULT ANIMATIONS ========== */
.result-item {
    opacity: 0;
    transform: translateY(30px);
}

.result-item.visible {
    animation: resultReveal 0.7s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    animation-delay: calc(var(--delay) * 120ms);
}

@keyframes resultReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    opacity: 0;
    transform: scale(0.9);
}

.result-header.visible {
    animation: headerReveal 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes headerReveal {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========== CONFETTI ========== */
.confetti-piece {
    position: fixed;
    width: 8px;
    height: 12px;
    z-index: 200;
    pointer-events: none;
    animation: confettiFall 3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(-20px) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* ========== LANDING EXIT ========== */
.landing-exit {
    animation: landingExit 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes landingExit {
    to {
        opacity: 0;
        transform: scale(0.95) translateY(-30px);
    }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 640px) {
    .envelope-container {
        width: 140px;
        height: 186px;
    }
    
    .envelope-symbol {
        font-size: 54px;
    }
    
    .main-result-card {
        padding: 32px 16px;
    }

    #totalAmount {
        font-size: 2.5rem;
    }

    .option-inner {
        padding: 16px;
    }
}
