* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 50%, #7e22ce 100%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* 背景动画粒子效果 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.game-container {
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 30px;
    padding: 40px;
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.4),
        0 10px 30px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    max-width: 800px;
    width: 100%;
    position: relative;
    z-index: 1;
    transform-style: preserve-3d;
}

h1 {
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    font-size: 2.8em;
    font-weight: 900;
    text-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
    letter-spacing: 2px;
}

.rules-panel {
    background: linear-gradient(145deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 
        0 5px 15px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.rules-panel h2 {
    font-size: 1.3em;
    color: #555;
    margin-bottom: 12px;
    font-weight: 700;
}

.rules-panel ul {
    list-style: none;
    padding-left: 0;
}

.rules-panel li {
    margin: 10px 0;
    color: #666;
    font-size: 0.95em;
    padding-left: 20px;
    position: relative;
}

.rules-panel li::before {
    content: '●';
    position: absolute;
    left: 0;
    color: #667eea;
    font-size: 1.2em;
}

.wheel-container {
    display: flex;
    justify-content: center;
    margin: 30px 0;
    perspective: 1000px;
}

#wheelCanvas {
    border: 5px solid transparent;
    border-radius: 50%;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%) border-box;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 10px 30px rgba(102, 126, 234, 0.2),
        inset 0 0 30px rgba(255, 255, 255, 0.1);
    transform: translateZ(20px);
    transition: all 0.3s ease;
}

#wheelCanvas:hover {
    transform: translateZ(30px) scale(1.02);
}

.controls {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin: 30px 0;
    perspective: 1000px;
}

.spin-btn {
    padding: 18px 45px;
    font-size: 1.3em;
    font-weight: bold;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform-style: preserve-3d;
}

.spin-btn::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;
}

.spin-btn:hover::before {
    left: 100%;
}

.clockwise-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.counterclockwise-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.spin-btn:hover:not(:disabled) {
    transform: translateY(-4px) translateZ(10px);
    box-shadow: 
        0 12px 30px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.spin-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.result-display {
    text-align: center;
    margin: 25px 0;
    padding: 25px;
    border-radius: 15px;
    font-size: 1.6em;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transform-style: preserve-3d;
}

.result-display.hidden {
    display: none;
}

.result-display.reward {
    background: linear-gradient(145deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border: 3px solid #28a745;
    box-shadow: 
        0 10px 30px rgba(40, 167, 69, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.result-display.penalty {
    background: linear-gradient(145deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border: 3px solid #dc3545;
    box-shadow: 
        0 10px 30px rgba(220, 53, 69, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.stats-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 25px 0;
}

.stats-btn {
    padding: 12px 30px;
    font-size: 1.05em;
    border: 3px solid #667eea;
    border-radius: 12px;
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    color: #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stats-btn:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.clear-btn {
    border-color: #dc3545;
    color: #dc3545;
}

.clear-btn:hover {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(220, 53, 69, 0.4);
}

.stats-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 20px;
    padding: 35px;
    box-shadow: 
        0 30px 80px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    max-width: 650px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1000;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.stats-panel.hidden {
    display: none;
}

.stats-panel h2 {
    color: #333;
    margin-bottom: 25px;
    font-size: 1.8em;
    font-weight: 700;
}

.stats-summary p {
    margin: 12px 0;
    font-size: 1.15em;
    color: #555;
    font-weight: 500;
}

.stats-summary .reward {
    color: #28a745;
    font-weight: bold;
}

.stats-summary .penalty {
    color: #dc3545;
    font-weight: bold;
}

.recent-games {
    margin: 25px 0;
}

.recent-games table {
    width: 100%;
    border-collapse: collapse;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.recent-games th,
.recent-games td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.recent-games th {
    background: linear-gradient(145deg, #667eea 0%, #764ba2 100%);
    font-weight: bold;
    color: white;
}

.recent-games tr:hover {
    background: #f8f9fa;
}

.close-btn {
    display: block;
    margin: 25px auto 0;
    padding: 12px 35px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.05em;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3d8f 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .game-container {
        padding: 20px;
    }

    h1 {
        font-size: 1.8em;
        margin-bottom: 15px;
    }

    .rules-panel {
        padding: 12px;
        margin-bottom: 15px;
    }

    .rules-panel h2 {
        font-size: 1em;
    }

    .rules-panel li {
        font-size: 0.85em;
    }

    .wheel-container {
        margin: 15px 0;
    }

    #wheelCanvas {
        width: 100%;
        height: auto;
        max-width: 400px;
    }

    .controls {
        flex-direction: column;
        gap: 12px;
        margin: 15px 0;
    }

    /* 确保按钮在移动设备上足够大（需求9.2） */
    .spin-btn {
        width: 100%;
        padding: 16px 20px;
        font-size: 1.1em;
        min-height: 50px; /* 确保触摸目标足够大 */
    }

    .result-display {
        font-size: 1.2em;
        padding: 15px;
    }

    .stats-controls {
        flex-direction: column;
        gap: 10px;
    }

    .stats-btn {
        width: 100%;
        padding: 12px 20px;
        min-height: 44px; /* 确保触摸目标足够大 */
    }

    .stats-panel {
        width: 95%;
        padding: 20px;
        max-height: 85vh;
    }

    .stats-panel h2 {
        font-size: 1.3em;
    }

    .stats-summary p {
        font-size: 1em;
    }

    .recent-games table {
        font-size: 0.85em;
    }

    .recent-games th,
    .recent-games td {
        padding: 8px 5px;
    }
}

/* 小屏幕设备（手机竖屏） */
@media (max-width: 480px) {
    h1 {
        font-size: 1.5em;
    }

    .rules-panel h2 {
        font-size: 0.95em;
    }

    .rules-panel li {
        font-size: 0.8em;
        margin: 6px 0;
    }

    #wheelCanvas {
        max-width: 320px;
    }

    .spin-btn {
        font-size: 1em;
        padding: 14px 16px;
    }

    .result-display {
        font-size: 1em;
        padding: 12px;
    }

    .stats-panel {
        padding: 15px;
    }

    .stats-panel h2 {
        font-size: 1.1em;
    }

    .stats-summary p {
        font-size: 0.9em;
        margin: 8px 0;
    }

    .recent-games table {
        font-size: 0.75em;
    }

    .recent-games th,
    .recent-games td {
        padding: 6px 3px;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .game-container {
        max-width: 90%;
    }

    .wheel-container {
        margin: 10px 0;
    }

    #wheelCanvas {
        max-width: 350px;
    }

    .controls {
        flex-direction: row;
        gap: 15px;
    }

    .spin-btn {
        width: auto;
        min-width: 150px;
    }
}

/* 大屏幕优化 */
@media (min-width: 1200px) {
    .game-container {
        max-width: 900px;
    }

    h1 {
        font-size: 3em;
    }

    #wheelCanvas {
        width: 650px;
        height: 650px;
    }
}

/* 庆祝动画效果 - 彩纸飘落 */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    opacity: 0;
    animation: confetti-fall 3s ease-out forwards;
    z-index: 1000;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* 庆祝动画 - 结果显示弹跳 */
.result-display.celebration {
    animation: celebration-bounce 0.6s ease-out;
}

@keyframes celebration-bounce {
    0%, 100% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.1);
    }
    50% {
        transform: scale(0.95);
    }
    75% {
        transform: scale(1.05);
    }
}

/* 遗憾动画 - 抖动效果 */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

/* 遗憾动画 - 结果显示淡入 */
.result-display.regret {
    animation: regret-fade 0.5s ease-in;
}

@keyframes regret-fade {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 转盘旋转时的光晕效果 */
#wheelCanvas.spinning {
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.6), 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: glow-pulse 1s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.6), 0 10px 30px rgba(0, 0, 0, 0.2);
    }
    50% {
        box-shadow: 0 0 50px rgba(102, 126, 234, 0.8), 0 10px 40px rgba(0, 0, 0, 0.3);
    }
}

/* 增强按钮点击效果 */
.spin-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.95);
}

/* 结果显示增强效果 */
.result-display.reward {
    box-shadow: 0 5px 20px rgba(40, 167, 69, 0.3);
}

.result-display.penalty {
    box-shadow: 0 5px 20px rgba(220, 53, 69, 0.3);
}


/* 响应式设计 */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .game-container {
        padding: 25px;
        border-radius: 20px;
    }

    h1 {
        font-size: 2em;
        margin-bottom: 15px;
    }

    .rules-panel {
        padding: 15px;
        margin-bottom: 20px;
    }

    .rules-panel h2 {
        font-size: 1.1em;
    }

    .rules-panel li {
        font-size: 0.9em;
    }

    .wheel-container {
        margin: 20px 0;
    }

    #wheelCanvas {
        width: 100%;
        height: auto;
        max-width: 400px;
    }

    .controls {
        flex-direction: column;
        gap: 15px;
        margin: 20px 0;
    }

    .spin-btn {
        width: 100%;
        padding: 16px 20px;
        font-size: 1.15em;
        min-height: 55px;
    }

    .result-display {
        font-size: 1.3em;
        padding: 18px;
    }

    .stats-controls {
        flex-direction: column;
        gap: 12px;
    }

    .stats-btn {
        width: 100%;
        padding: 14px 20px;
        min-height: 50px;
    }

    .stats-panel {
        width: 95%;
        padding: 25px;
        max-height: 85vh;
    }

    .stats-panel h2 {
        font-size: 1.5em;
    }

    .stats-summary p {
        font-size: 1.05em;
    }

    .recent-games table {
        font-size: 0.9em;
    }

    .recent-games th,
    .recent-games td {
        padding: 10px 6px;
    }
}

/* 小屏幕设备（手机竖屏） */
@media (max-width: 480px) {
    h1 {
        font-size: 1.7em;
    }

    .rules-panel h2 {
        font-size: 1em;
    }

    .rules-panel li {
        font-size: 0.85em;
        margin: 8px 0;
    }

    #wheelCanvas {
        max-width: 320px;
    }

    .spin-btn {
        font-size: 1.05em;
        padding: 15px 18px;
    }

    .result-display {
        font-size: 1.15em;
        padding: 15px;
    }

    .stats-panel {
        padding: 20px;
    }

    .stats-panel h2 {
        font-size: 1.3em;
    }

    .stats-summary p {
        font-size: 0.95em;
        margin: 10px 0;
    }

    .recent-games table {
        font-size: 0.8em;
    }

    .recent-games th,
    .recent-games td {
        padding: 8px 4px;
    }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
    .game-container {
        max-width: 90%;
    }

    .wheel-container {
        margin: 15px 0;
    }

    #wheelCanvas {
        max-width: 350px;
    }

    .controls {
        flex-direction: row;
        gap: 20px;
    }

    .spin-btn {
        width: auto;
        min-width: 160px;
    }
}

/* 大屏幕优化 */
@media (min-width: 1200px) {
    .game-container {
        max-width: 900px;
    }

    h1 {
        font-size: 3.2em;
    }

    #wheelCanvas {
        width: 650px;
        height: 650px;
    }
}

/* 庆祝动画效果 - 彩纸飘落 */
.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    top: -10px;
    opacity: 0;
    animation: confetti-fall 3s ease-out forwards;
    z-index: 1000;
}

@keyframes confetti-fall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(720deg);
    }
}

/* 庆祝动画 - 结果显示弹跳 */
.result-display.celebration {
    animation: celebration-bounce 0.6s ease-out;
}

@keyframes celebration-bounce {
    0%, 100% {
        transform: scale(1) translateZ(0);
    }
    25% {
        transform: scale(1.15) translateZ(20px);
    }
    50% {
        transform: scale(0.95) translateZ(-10px);
    }
    75% {
        transform: scale(1.08) translateZ(15px);
    }
}

/* 遗憾动画 - 抖动效果 */
.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-8px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(8px);
    }
}

/* 遗憾动画 - 结果显示淡入 */
.result-display.regret {
    animation: regret-fade 0.5s ease-in;
}

@keyframes regret-fade {
    0% {
        opacity: 0;
        transform: scale(0.8) translateZ(-20px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateZ(0);
    }
}

/* 转盘旋转时的3D光晕效果（不使用旋转动画） */
#wheelCanvas.spinning {
    box-shadow: 
        0 0 40px rgba(102, 126, 234, 0.8),
        0 0 80px rgba(118, 75, 162, 0.6),
        0 20px 60px rgba(0, 0, 0, 0.3),
        inset 0 0 30px rgba(255, 255, 255, 0.2);
    animation: glow-pulse 1s ease-in-out infinite, scale-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        filter: brightness(1) drop-shadow(0 0 20px rgba(102, 126, 234, 0.6));
    }
    50% {
        filter: brightness(1.1) drop-shadow(0 0 40px rgba(102, 126, 234, 0.9));
    }
}

/* 3D缩放脉冲效果 */
@keyframes scale-pulse {
    0%, 100% {
        transform: translateZ(20px) scale(1);
    }
    50% {
        transform: translateZ(30px) scale(1.02);
    }
}

/* 增强按钮点击效果 */
.spin-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.96) translateZ(0);
    box-shadow: 
        0 4px 10px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* 结果显示增强3D效果 */
.result-display.reward {
    box-shadow: 
        0 15px 40px rgba(40, 167, 69, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        0 0 30px rgba(40, 167, 69, 0.2);
}

.result-display.penalty {
    box-shadow: 
        0 15px 40px rgba(220, 53, 69, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.6),
        0 0 30px rgba(220, 53, 69, 0.2);
}

/* 统计面板背景遮罩 */
.stats-panel::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: -1;
}

/* 滚动条美化 */
.stats-panel::-webkit-scrollbar {
    width: 10px;
}

.stats-panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.stats-panel::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

.stats-panel::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #5568d3 0%, #6a3d8f 100%);
}

/* 加载动画 */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 按钮光泽效果 */
.spin-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.spin-btn:hover::after {
    opacity: 1;
}
