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

@import url('https://fonts.googleapis.com/css2?family=Ma+Shan+Zheng&family=Noto+Sans+SC:wght@400;700&display=swap');

:root {
    --red-primary: #D4213D;
    --red-dark: #8B0000;
    --red-light: #FF4444;
    --gold-primary: #FFD700;
    --gold-dark: #DAA520;
    --gold-light: #FFEC8B;
    --bg-gradient-start: #8B0000;
    --bg-gradient-end: #DC143C;
}

body {
    font-family: 'Noto Sans SC', sans-serif;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

#camera-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
    z-index: 1;
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

#ui-layer > * {
    pointer-events: auto;
}

#score-panel {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.9), rgba(212, 33, 61, 0.9));
    border: 3px solid var(--gold-primary);
    border-radius: 15px;
    padding: 15px 40px;
    text-align: center;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5), inset 0 0 20px rgba(255, 215, 0, 0.1);
}

#score-label {
    display: block;
    font-size: 18px;
    color: var(--gold-light);
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#score-value {
    display: block;
    font-size: 48px;
    font-family: 'Ma Shan Zheng', cursive;
    color: var(--gold-primary);
    text-shadow: 0 0 10px var(--gold-primary), 2px 2px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.2;
}

#decorations {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.lantern {
    position: absolute;
    font-size: 60px;
    animation: swing 3s ease-in-out infinite;
    filter: drop-shadow(0 0 10px rgba(255, 100, 0, 0.8));
}

.lantern-left {
    top: 10px;
    left: 20px;
    animation-delay: 0s;
}

.lantern-right {
    top: 10px;
    right: 20px;
    animation-delay: 1.5s;
}

@keyframes swing {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

#fu-character {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 200px;
    font-family: 'Ma Shan Zheng', cursive;
    color: rgba(255, 215, 0, 0.1);
    pointer-events: none;
    z-index: 0;
}

#control-panel {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 20px;
}

.game-btn {
    padding: 15px 40px;
    font-size: 20px;
    font-family: 'Noto Sans SC', sans-serif;
    font-weight: bold;
    color: var(--gold-primary);
    background: linear-gradient(135deg, var(--red-dark), var(--red-primary));
    border: 3px solid var(--gold-primary);
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 215, 0, 0.3);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.game-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4), 0 0 30px rgba(255, 215, 0, 0.5);
}

.game-btn:active {
    transform: scale(0.98);
}

.game-btn.primary {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold-primary));
    color: var(--red-dark);
    font-size: 24px;
    padding: 20px 50px;
}

.game-btn.hidden {
    display: none;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.95), rgba(212, 33, 61, 0.95));
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, rgba(139, 0, 0, 0.8), rgba(180, 30, 50, 0.8));
    border: 4px solid var(--gold-primary);
    border-radius: 20px;
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.4), inset 0 0 30px rgba(255, 215, 0, 0.1);
    max-width: 500px;
}

.game-title {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 48px;
    color: var(--gold-primary);
    text-shadow: 0 0 20px var(--gold-primary), 3px 3px 6px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
}

.game-subtitle {
    font-size: 24px;
    color: var(--gold-light);
    margin-bottom: 30px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

.instructions {
    text-align: left;
    background: rgba(0, 0, 0, 0.2);
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
    border: 2px solid var(--gold-dark);
}

.instructions h3 {
    color: var(--gold-primary);
    margin-bottom: 15px;
    font-size: 20px;
}

.instructions ul {
    list-style: none;
    padding: 0;
}

.instructions li {
    color: var(--gold-light);
    padding: 8px 0;
    font-size: 16px;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--gold-dark);
    border-top: 4px solid var(--gold-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

#loading-text {
    color: var(--gold-light);
    font-size: 20px;
}

.game-over-title {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 42px;
    color: var(--gold-primary);
    text-shadow: 0 0 15px var(--gold-primary);
    margin-bottom: 20px;
}

.final-score {
    font-size: 28px;
    color: var(--gold-light);
    margin-bottom: 30px;
}

#final-score-value {
    font-family: 'Ma Shan Zheng', cursive;
    font-size: 36px;
    color: var(--gold-primary);
}

.firework {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: firework-explode 1s ease-out forwards;
    pointer-events: none;
}

@keyframes firework-explode {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(3);
        opacity: 0;
    }
}

.slice-trail {
    position: absolute;
    pointer-events: none;
    z-index: 10;
}

@media (max-width: 768px) {
    .game-title {
        font-size: 36px;
    }
    
    .game-subtitle {
        font-size: 18px;
    }
    
    #score-panel {
        padding: 10px 25px;
    }
    
    #score-value {
        font-size: 36px;
    }
    
    .lantern {
        font-size: 40px;
    }
    
    .game-btn {
        padding: 12px 30px;
        font-size: 16px;
    }
    
    .game-btn.primary {
        font-size: 20px;
        padding: 15px 40px;
    }
    
    .overlay-content {
        padding: 25px;
        margin: 20px;
    }
    
    .instructions {
        padding: 15px;
    }
    
    .instructions li {
        font-size: 14px;
    }
}
