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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.page {
    display: none;
    width: 100%;
}

.page.active {
    display: block;
}

/* 选择页面样式 */
.title {
    font-size: 2.5rem;
    text-align: center;
    color: #fff;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.1rem;
    text-align: center;
    color: #f0f0f0;
    margin-bottom: 40px;
    opacity: 0.9;
}

.drink-selection {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

.drink-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 20px;
    padding: 25px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.drink-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.2);
    background: rgba(255, 255, 255, 0.95);
}

.drink-btn:active {
    transform: translateY(-2px);
}

.drink-icon {
    font-size: 3rem;
}

.drink-name {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
}

/* 游戏页面样式 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 30px;
}

.current-drink {
    font-size: 1.8rem;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 10px 15px;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-3px);
}

.slot-machine {
    width: 100%;
    max-width: 400px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    width: 100%;
    max-width: 100vw;
}

.grid-item {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    color: #333;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    min-height: 80px;
    padding: 8px;
    text-align: center;
}

.grid-item.invisible {
    background: transparent;
    pointer-events: none;
    visibility: hidden;
}

.grid-item .icon {
    font-size: 3.5rem;
    margin-bottom: 4px;
    display: block;
}

.grid-item .text {
    font-size: 0.6rem;
    line-height: 1;
    word-break: break-all;
    max-width: 100%;
}

.grid-item.selected {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #333;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    animation: pulse 2s infinite;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 0;
    border-radius: 25px;
    width: 90%;
    max-width: 400px;
    animation: modal-appear 0.3s ease-out;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

@keyframes modal-appear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.7);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-header h3 {
    color: #fff;
    margin: 0;
    font-size: 1.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.close {
    color: rgba(255, 255, 255, 0.8);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 25px;
    text-align: center;
}

.result-text {
    font-size: 1.8rem;
    font-weight: bold;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin: 0;
    padding: 20px 0;
}

.action-btn {
    width: 100%;
    padding: 18px;
    font-size: 1.3rem;
    font-weight: bold;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #FF6B6B, #FF8E53);
    color: white;
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.3);
}

.action-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(255, 107, 107, 0.4);
    animation: bounce-button 0.6s ease-in-out infinite;
}

.action-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    animation: none;
}

.action-btn.spinning {
    background: linear-gradient(135deg, #4ECDC4, #44A08D);
    animation: pulse 1s ease-in-out infinite;
}

.action-btn:only-child {
    margin-bottom: 0;
}

/* 响应式设计 */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .title {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }
    
    .subtitle {
        font-size: 1rem;
        margin-bottom: 30px;
    }
    
    .drink-btn {
        padding: 18px 15px;
        gap: 12px;
    }
    
    .drink-icon {
        font-size: 2.2rem;
    }
    
    .drink-name {
        font-size: 1.2rem;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .current-drink {
        font-size: 1.4rem;
        text-align: center;
    }
    
    .back-btn {
        font-size: 0.9rem;
        padding: 8px 12px;
    }
    
    .grid-container {
        padding: 12px;
        gap: 6px;
        margin-bottom: 20px;
    }
    
    .grid-item {
        min-height: 50px;
        padding: 3px;
    }
    
    .grid-item .icon {
        font-size: 1.3rem;
    }
    
    .grid-item .text {
        font-size: 0.55rem;
    }
    
    .action-btn {
        font-size: 1.2rem;
        padding: 16px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20% auto;
    }
    
    .modal-header h3 {
        font-size: 1.3rem;
    }
    
    .result-text {
        font-size: 1.5rem;
        padding: 15px 0;
    }
}

/* 超小屏幕优化 */
@media (max-width: 360px) {
    .title {
        font-size: 1.6rem;
    }
    
    .grid-container {
        padding: 8px;
        gap: 4px;
    }
    
    .grid-item {
        min-height: 45px;
        padding: 2px;
    }
    
    .grid-item .icon {
        font-size: 1.2rem;
    }
    
    .grid-item .text {
        font-size: 0.5rem;
    }
}