:root {
    --bg-color: #0d0202;
    --red-primary: #d31027;
    --red-dark: #7a0010;
    --gold-light: #fff2a8;
    --gold-primary: #ffd700;
    --gold-dark: #b8860b;
    --text-color: #fdf5e6;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: 'Noto Serif SC', serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.background-effects {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: drift 10s infinite alternate linear;
}

.glow-orb.top-left {
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, var(--red-primary) 0%, transparent 70%);
    top: -10vw;
    left: -10vw;
}

.glow-orb.bottom-right {
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--gold-dark) 0%, transparent 70%);
    bottom: -20vw;
    right: -10vw;
    animation-delay: -5s;
}

@keyframes drift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(5vw, 5vw); }
}

.container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 600px;
    padding: 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.header {
    margin-bottom: 3rem;
    animation: fadeInDown 1s ease-out;
}

.title {
    font-family: 'Zhi Mang Xing', cursive;
    font-size: 4.5rem;
    background: linear-gradient(135deg, var(--gold-light), var(--gold-primary), var(--gold-dark));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 10px rgba(255, 215, 0, 0.4));
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.2rem;
    color: #ffc9b3;
    letter-spacing: 2px;
    opacity: 0.9;
}

/* Caishen Animation */
.caishen-wrapper {
    position: relative;
    width: 220px;
    height: 220px;
    margin: 0 auto;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    justify-content: center;
    align-items: center;
}

.rays {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    margin-left: -150px;
    margin-top: -150px;
    background: repeating-conic-gradient(
        from 0deg,
        rgba(255, 215, 0, 0.1) 0deg 15deg,
        transparent 15deg 30deg
    );
    border-radius: 50%;
    animation: spin 20s linear infinite;
    z-index: -1;
    pointer-events: none;
}

.caishen-wrapper:hover {
    transform: scale(1.08);
}

.caishen-wrapper:active {
    transform: scale(0.95);
}

.caishen-svg {
    width: 100%;
    height: 100%;
    animation: bounce 3s ease-in-out infinite;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.5));
}

.yuanbao {
    transform-origin: 100px 170px;
    animation: breathe 2s infinite alternate;
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-12px); }
}

@keyframes breathe {
    0% { transform: scale(0.95); filter: brightness(1) drop-shadow(0 0 5px var(--gold-primary)); }
    100% { transform: scale(1.05); filter: brightness(1.2) drop-shadow(0 0 15px var(--gold-light)); }
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Number Result */
.result-container {
    margin-top: 3rem;
    min-height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.number-display {
    font-size: 5rem;
    font-weight: 900;
    letter-spacing: 16px;
    background: linear-gradient(to bottom, var(--gold-light), var(--gold-primary), var(--gold-dark));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 20px rgba(255, 215, 0, 0.5));
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.number-display.active {
    opacity: 1;
    transform: scale(1);
    animation: zap 0.5s ease-out;
}

.number-display .placeholder {
    font-size: 1.5rem;
    letter-spacing: 4px;
    color: rgba(255, 215, 0, 0.4);
    background: none;
    -webkit-text-fill-color: rgba(255, 215, 0, 0.4);
    filter: none;
    font-weight: 400;
}

@keyframes zap {
    0% { transform: scale(0.2) translateY(50px); opacity: 0; filter: brightness(2); }
    50% { transform: scale(1.1); filter: brightness(1.5); }
    100% { transform: scale(1); opacity: 1; filter: brightness(1); }
}

/* History */
.history-container {
    margin-top: 3rem;
    width: 100%;
}

.history-container h3 {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 1rem;
    font-weight: 400;
    letter-spacing: 2px;
}

.history-list {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    min-height: 30px;
}

.history-item {
    font-size: 1.2rem;
    color: var(--gold-dark);
    font-family: monospace;
    font-weight: bold;
    opacity: 0;
    animation: fadeUp 0.4s forwards;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 0.8; transform: translateY(0); }
}

/* Particles */
.particle {
    position: absolute;
    pointer-events: none;
    user-select: none;
    z-index: 100;
    animation: fall ease-in-out forwards;
}

@keyframes fall {
    0% { 
        transform: translate(0, 0) scale(1) rotate(0deg); 
        opacity: 1; 
    }
    100% { 
        transform: translate(var(--end-x), var(--end-y)) scale(0.5) rotate(720deg); 
        opacity: 0; 
    }
}

/* Responsive */
@media (max-width: 480px) {
    .title { font-size: 3.5rem; }
    .caishen-wrapper { width: 180px; height: 180px; }
    .number-display { font-size: 4rem; letter-spacing: 10px; }
}
