/* ==================== 基础样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --game-gradient: linear-gradient(45deg, #ff6b6b, #ffd700);
    --card-bg: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--primary-gradient);
    min-height: 100vh;
    overflow-x: hidden;
    color: white;
}

.hidden {
    display: none !important;
}

/* ==================== 开场动画 ==================== */
#intro-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 1s ease-out;
}

.intro-text {
    text-align: center;
    color: white;
}

.intro-line {
    font-size: 4rem;
    font-weight: bold;
    opacity: 0;
    transform: translateY(30px);
    animation: lineAppear 1s ease-out forwards;
}

.intro-line:nth-child(1) {
    animation-delay: 0.5s;
    color: #ffd700;
    text-shadow: 0 0 20px #ffd700;
}

.intro-line:nth-child(2) {
    animation-delay: 1s;
    color: #ff6b6b;
    text-shadow: 0 0 20px #ff6b6b;
}

.intro-subtitle {
    font-size: 1.5rem;
    color: #fff;
    margin-top: 2rem;
    opacity: 0;
    animation: subtitleAppear 1s ease-out 2s forwards;
}

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

@keyframes subtitleAppear {
    to { opacity: 1; }
}

/* 粒子效果 */
.intro-particles, .outro-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.8) 0%, transparent 70%);
    border-radius: 50%;
    animation: particleFloat 3s ease-in-out infinite;
}

@keyframes particleFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0; }
    50% { transform: translateY(-100px) rotate(180deg); opacity: 1; }
}

/* ==================== 主内容区 ==================== */
main {
    padding: 2rem;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

.title {
    text-align: center;
    font-size: 3rem;
    color: white;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    margin-bottom: 0.5rem;
    animation: titleBounce 1s ease-out;
}

@keyframes titleBounce {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.subtitle {
    text-align: center;
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 3rem;
}

/* ==================== 游戏区域 ==================== */
.game-section {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 3rem;
    backdrop-filter: blur(10px);
    box-shadow: var(--card-shadow);
}

.game-section h2 {
    text-align: center;
    color: white;
    margin-bottom: 1rem;
}

.game-instruction {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1rem;
    line-height: 1.6;
}

/* 游戏选择按钮 */
.game-selector {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.game-selector-btn {
    padding: 0.8rem 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.game-selector-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.game-selector-btn.active {
    background: var(--game-gradient);
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

/* 游戏状态 */
.game-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 1rem;
}

.stat {
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
}

/* 游戏画布 */
#game-canvas {
    display: block;
    margin: 0 auto 1rem;
    border-radius: 15px;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    cursor: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* 游戏控制按钮 */
.game-controls {
    text-align: center;
    margin-top: 1rem;
}

.game-btn {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    border: none;
    border-radius: 30px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0.5rem;
    font-weight: bold;
}

.game-btn.primary {
    background: var(--game-gradient);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.game-btn.secondary {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.game-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
}

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

/* ==================== 蛋糕装饰游戏 ==================== */
.cake-controls {
    margin-top: 1.5rem;
}

.decoration-panel {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    padding: 1.5rem;
}

.decoration-panel h3 {
    text-align: center;
    color: #ffd700;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.decorations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.decoration-item {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.decoration-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

.decoration-item.selected {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.2);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.decoration-emoji {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

.decoration-name {
    display: block;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 0.3rem;
}

.decoration-price {
    display: block;
    font-size: 0.8rem;
    color: #ffd700;
}

/* ==================== 3D漫游入口 ==================== */
.roaming-entrance {
    margin-top: 1.5rem;
}

.roaming-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.3) 0%, rgba(118, 75, 162, 0.3) 100%);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.roaming-card h3 {
    color: #ffd700;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.roaming-card p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1.5rem;
}

/* ==================== 祝福区域 ==================== */
.wishes-section {
    margin-bottom: 3rem;
}

.wishes-section h2 {
    text-align: center;
    color: white;
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
}

.wishes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.wish-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    backdrop-filter: blur(10px);
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
    animation: cardFloat 3s ease-in-out infinite;
}

.wish-card:nth-child(1) { animation-delay: 0s; }
.wish-card:nth-child(2) { animation-delay: 0.5s; }
.wish-card:nth-child(3) { animation-delay: 1s; }
.wish-card:nth-child(4) { animation-delay: 1.5s; }

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

.wish-card:hover {
    transform: translateY(-15px) scale(1.05);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

.wish-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.wish-card h3 {
    color: #ffd700;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.wish-card p {
    color: rgba(255, 255, 255, 0.9);
}

/* ==================== 蛋糕许愿区 ==================== */
.cake-section {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 3rem;
    backdrop-filter: blur(10px);
    box-shadow: var(--card-shadow);
}

.cake-section h2 {
    text-align: center;
    color: white;
    margin-bottom: 2rem;
}

.cake-container {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.cake {
    position: relative;
    width: 200px;
    height: 180px;
}

.cake-layer {
    position: absolute;
    border-radius: 10px;
    left: 50%;
    transform: translateX(-50%);
}

.layer1 {
    width: 200px;
    height: 50px;
    bottom: 0;
    background: linear-gradient(180deg, #8B4513 0%, #654321 100%);
    box-shadow: inset 0 -5px 10px rgba(0, 0, 0, 0.3);
}

.layer2 {
    width: 160px;
    height: 50px;
    bottom: 50px;
    background: linear-gradient(180deg, #FFB6C1 0%, #FF69B4 100%);
    box-shadow: inset 0 -5px 10px rgba(0, 0, 0, 0.2);
}

.layer3 {
    width: 120px;
    height: 50px;
    bottom: 100px;
    background: linear-gradient(180deg, #FFA07A 0%, #FF6347 100%);
    box-shadow: inset 0 -5px 10px rgba(0, 0, 0, 0.2);
}

.candles {
    position: absolute;
    bottom: 150px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 30px;
}

.candle {
    width: 10px;
    height: 40px;
    background: linear-gradient(180deg, #FFD700 0%, #FFA500 100%);
    border-radius: 5px 5px 0 0;
    position: relative;
    animation: candleFlicker 0.5s ease-in-out infinite alternate;
}

@keyframes candleFlicker {
    from { transform: rotate(-2deg); }
    to { transform: rotate(2deg); }
}

.flame {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 15px;
    height: 20px;
    background: linear-gradient(180deg, #FFD700 0%, #FF6347 50%, transparent 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flameDance 0.3s ease-in-out infinite alternate;
}

@keyframes flameDance {
    from { transform: translateX(-50%) scale(1); opacity: 1; }
    to { transform: translateX(-50%) scale(1.1); opacity: 0.8; }
}

@keyframes flameExtinguish {
    to { transform: translateX(-50%) scale(0); opacity: 0; }
}

.wish-btn {
    display: block;
    margin: 0 auto;
    padding: 1rem 3rem;
    font-size: 1.2rem;
    background: var(--primary-gradient);
    border: none;
    border-radius: 30px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.wish-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.wish-result {
    text-align: center;
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(255, 215, 0, 0.2);
    border-radius: 10px;
    animation: resultPulse 1s ease-in-out infinite;
}

@keyframes resultPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* ==================== 落幕动画 ==================== */
#outro-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.outro-content {
    text-align: center;
    color: white;
    animation: outroFadeIn 2s ease-out;
}

@keyframes outroFadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

.outro-message h2 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #ffd700;
    text-shadow: 0 0 20px #ffd700;
}

.outro-message p {
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.outro-wishes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    max-width: 400px;
    margin: 0 auto 2rem;
}

.outro-wish {
    background: rgba(255, 255, 255, 0.2);
    padding: 1rem;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    animation: wishSlideIn 0.5s ease-out forwards;
    opacity: 0;
}

.outro-wish:nth-child(1) { animation-delay: 0.5s; }
.outro-wish:nth-child(2) { animation-delay: 1s; }
.outro-wish:nth-child(3) { animation-delay: 1.5s; }
.outro-wish:nth-child(4) { animation-delay: 2s; }

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

.outro-heart {
    font-size: 2rem;
    margin-top: 2rem;
    animation: heartBeat 1s ease-in-out infinite;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .title { font-size: 2rem; }
    .intro-line { font-size: 2.5rem; }
    .wishes-grid { grid-template-columns: 1fr; }
    .outro-wishes { grid-template-columns: 1fr; }
    #game-canvas { max-width: 100%; }
    .game-selector { flex-direction: column; }
    .game-selector-btn { width: 100%; }
    .game-stats { flex-direction: column; gap: 0.5rem; align-items: center; }
}

/* ==================== 3D游戏全屏页面 ==================== */
body.roaming-fullscreen {
    overflow: hidden;
}

body.roaming-fullscreen #roaming-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
}

body.roaming-fullscreen .roaming-ui {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 10001;
    background: rgba(0, 0, 0, 0.7);
    padding: 15px 25px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

body.roaming-fullscreen .roaming-stats {
    color: white;
    font-size: 1.2rem;
}

body.roaming-fullscreen .roaming-stats span {
    color: #ffd700;
    font-weight: bold;
}

body.roaming-fullscreen .roaming-controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    display: flex;
    gap: 1rem;
}

body.roaming-fullscreen #roaming-instructions {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 40px;
    border-radius: 20px;
    z-index: 10002;
    text-align: center;
    max-width: 500px;
    backdrop-filter: blur(10px);
    border: 2px solid #ffd700;
}

body.roaming-fullscreen #roaming-instructions h3 {
    color: #ffd700;
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

body.roaming-fullscreen #roaming-instructions p {
    margin: 10px 0;
    line-height: 1.6;
}
