* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

body {
    background: url('../imgs/bg.jpg') no-repeat center center fixed;
    background-size: cover;
    color: #fff;
}

/* 页面通用样式 */
.page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.page.active {
    display: flex;
}

.page-content {
    text-align: center;
    padding: 20px;
    width: 100%;
    max-width: 400px;
}

/* 加载页面 */
#loading-page {
    background: transparent;
}

.loading-content {
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 游戏标题 */
.game-title {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.subtitle {
    font-size: 1.2rem;
    color: #ffe4b5;
    margin-bottom: 40px;
}

/* 用户信息 */
.user-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    padding: 15px;
    background: rgba(139, 0, 0, 0.5);
    border-radius: 50px;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid #ffd700;
}

.nickname {
    font-size: 1.3rem;
    font-weight: bold;
}

/* 按钮样式 */
.btn {
    padding: 15px 50px;
    font-size: 1.2rem;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: bold;
}

.btn-primary {
    background: linear-gradient(45deg, #ffd700, #ffec8b, #ffd700);
    color: #8b0000;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.5);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.7);
}

.btn-secondary {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 2px solid #fff;
}

.btn-success {
    background: linear-gradient(45deg, #ffd700, #ffec8b, #ffd700);
    color: #8b0000;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.5);
}

.btn-danger {
    background: linear-gradient(45deg, #eb3349, #f45c43);
    color: #fff;
}

/* 等待大厅 */
.player-count {
    font-size: 1.5rem;
    margin-bottom: 20px;
}

.player-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    margin-bottom: 8px;
}

.player-item .avatar {
    width: 40px;
    height: 40px;
}

.player-item .nickname {
    font-size: 1rem;
}

.waiting-tip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    opacity: 0.8;
}

.pulse-dot {
    width: 12px;
    height: 12px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* 游戏页面 */
#game-page {
    flex-direction: column;
    justify-content: space-between;
    background: transparent;
}

.game-header {
    display: flex;
    justify-content: space-around;
    width: 100%;
    padding: 20px;
    padding-top: 40px;
}

.timer, .score {
    text-align: center;
}

.timer span, .score span {
    font-size: 3rem;
    font-weight: bold;
    display: block;
}

.timer {
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.score {
    color: #4ade80;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.timer small, .score small {
    font-size: 1rem;
    color: #ffe4b5;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.game-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    touch-action: none;
    user-select: none;
}

.money-stack {
    width: 280px;
    height: 180px;
    background: linear-gradient(145deg, #c41e3a, #8b0000);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    box-shadow: 
        0 10px 30px rgba(0,0,0,0.5),
        inset 0 2px 10px rgba(255,255,255,0.2);
    cursor: pointer;
    transition: transform 0.1s;
}

.money-stack:active {
    transform: scale(0.95);
}

.money-stack::before {
    content: '💴';
    font-size: 80px;
    position: absolute;
}

.money-hint {
    position: absolute;
    bottom: -50px;
    font-size: 1rem;
    color: rgba(255,255,255,0.6);
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* 飘出的钱动画 */
.flying-money {
    position: absolute;
    font-size: 40px;
    pointer-events: none;
    animation: flyUp 0.6s ease-out forwards;
    z-index: 100;
}

@keyframes flyUp {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-150px) rotate(20deg) scale(0.5);
    }
}

.game-footer {
    padding: 20px;
    text-align: center;
}

.rank-preview {
    font-size: 1.2rem;
    color: #ffd700;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.7);
}

/* 倒计时页面 */
#countdown-page {
    background: rgba(0,0,0,0.9);
    z-index: 1000;
}

.countdown-number {
    font-size: 150px;
    font-weight: bold;
    animation: countdownPulse 1s ease-in-out;
}

@keyframes countdownPulse {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* 结果页面 */
#result-page {
    background: transparent;
    overflow-y: auto;
}

#result-page .page-content {
    max-width: 500px;
    padding: 40px 20px;
}

.my-result {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    border-radius: 15px;
    margin: 20px 0 30px;
}

.my-result .highlight {
    color: #fbbf24;
    font-size: 2rem;
    font-weight: bold;
}

.leaderboard {
    margin: 20px 0;
    text-align: left;
}

.rank-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255,255,255,0.05);
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.3s;
}

.rank-item:nth-child(1) {
    background: linear-gradient(90deg, rgba(255,215,0,0.3), transparent);
    border-left: 4px solid gold;
}

.rank-item:nth-child(2) {
    background: linear-gradient(90deg, rgba(192,192,192,0.3), transparent);
    border-left: 4px solid silver;
}

.rank-item:nth-child(3) {
    background: linear-gradient(90deg, rgba(205,127,50,0.3), transparent);
    border-left: 4px solid #cd7f32;
}

.rank-number {
    width: 30px;
    font-size: 1.2rem;
    font-weight: bold;
    color: #fbbf24;
}

.rank-item:nth-child(1) .rank-number::before { content: '🥇'; }
.rank-item:nth-child(2) .rank-number::before { content: '🥈'; }
.rank-item:nth-child(3) .rank-number::before { content: '🥉'; }

.rank-item .avatar {
    width: 40px;
    height: 40px;
    margin: 0 10px;
}

.rank-info {
    flex: 1;
}

.rank-nickname {
    font-weight: bold;
}

.rank-score {
    font-size: 0.9rem;
    color: #4ade80;
}

/* 管理员面板 */
.admin-panel {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    padding: 15px;
    border-radius: 10px;
    z-index: 9999;
    text-align: center;
}

.admin-panel.hidden {
    display: none;
}

.admin-panel h3 {
    margin-bottom: 15px;
    color: #f87171;
}

.admin-panel .btn {
    display: block;
    width: 100%;
    margin-bottom: 10px;
    padding: 10px 20px;
    font-size: 1rem;
}

.admin-info {
    margin-top: 10px;
    font-size: 0.9rem;
    text-align: left;
}

.admin-info p {
    margin: 5px 0;
}

/* 隐藏类 */
.hidden {
    display: none !important;
}

/* 响应式 */
@media (max-width: 360px) {
    .game-title {
        font-size: 2rem;
    }
    
    .money-stack {
        width: 240px;
        height: 150px;
    }
    
    .money-stack::before {
        font-size: 60px;
    }
}
