/* ==================== 基础样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6b5ce7;
    --primary-dark: #5a4dd1;
    --secondary-color: #ff6b6b;
    --accent-color: #ffd93d;
    --bg-color: #1a1a2e;
    --card-bg: #16213e;
    --text-color: #eee;
    --text-muted: #aaa;
    --border-radius: 12px;
    --dice-size: 60px;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: var(--text-color);
    overflow-x: hidden;
}

/* ==================== 屏幕切换 ==================== */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* ==================== 启动界面 ==================== */
.start-container {
    max-width: 600px;
    margin: auto;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.game-title {
    font-size: 3rem;
    background: linear-gradient(45deg, var(--accent-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    text-shadow: 0 0 30px rgba(255, 217, 61, 0.3);
}

.game-subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 30px;
}

.rules-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.rules-section h2 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.rules-list {
    list-style: none;
    padding: 0;
}

.rules-list li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
    color: var(--text-muted);
    line-height: 1.6;
}

.rules-list li::before {
    content: '🎲';
    position: absolute;
    left: 0;
}

.rules-list li strong {
    color: var(--accent-color);
}

/* ==================== 按钮样式 ==================== */
.btn {
    padding: 12px 30px;
    font-size: 1.1rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary-color), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(107, 92, 231, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(107, 92, 231, 0.6);
}

.btn-bid {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
}

.btn-challenge {
    background: linear-gradient(45deg, var(--secondary-color), #ee5a5a);
    color: white;
}

.btn-challenge:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

.btn-shake {
    background: linear-gradient(45deg, var(--accent-color), #ff9f43);
    color: #1a1a2e;
}

.btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.btn:active:not(:disabled) {
    transform: scale(0.95);
}

/* ==================== 游戏主界面 ==================== */
#game-screen {
    max-width: 900px;
    margin: 0 auto;
    gap: 20px;
}

/* ==================== 玩家区域 ==================== */
.player-area {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-area {
    flex-direction: row;
}

.user-area {
    flex-direction: row-reverse;
}

.player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.player-avatar {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.player-name {
    font-weight: bold;
    font-size: 1.1rem;
}

.player-score {
    color: var(--accent-color);
    font-size: 0.9rem;
}

/* ==================== 骰子容器 ==================== */
.dice-container {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
    flex: 1;
}

/* ==================== 骰子样式 ==================== */
.dice {
    width: var(--dice-size);
    height: var(--dice-size);
    background: linear-gradient(145deg, #ffffff, #e6e6e6);
    border-radius: 12px;
    position: relative;
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.3),
        inset 0 -3px 5px rgba(0, 0, 0, 0.1),
        inset 0 3px 5px rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease;
}

.dice:hover {
    transform: translateY(-5px);
}

/* 骰子背面（AI骰子） */
.dice-back {
    background: linear-gradient(145deg, #4a4a6a, #3a3a5a);
    box-shadow: 
        0 4px 8px rgba(0, 0, 0, 0.4),
        inset 0 -3px 5px rgba(0, 0, 0, 0.3),
        inset 0 3px 5px rgba(255, 255, 255, 0.1);
}

.dice-back::after {
    content: '?';
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.3);
    font-weight: bold;
}

/* 骰子点数 - 使用圆点 */
.dice[data-value="1"]::before {
    content: '';
    width: 12px;
    height: 12px;
    background: #333;
    border-radius: 50%;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.dice[data-value="2"]::before {
    content: '';
    width: 10px;
    height: 10px;
    background: transparent;
    border-radius: 50%;
    box-shadow: 
        -12px -12px 0 #333,
        12px 12px 0 #333;
}

.dice[data-value="3"]::before {
    content: '';
    width: 10px;
    height: 10px;
    background: #333;
    border-radius: 50%;
    box-shadow: 
        -12px -12px 0 #333,
        12px 12px 0 #333;
}

.dice[data-value="4"]::before {
    content: '';
    width: 10px;
    height: 10px;
    background: transparent;
    border-radius: 50%;
    box-shadow: 
        -15px -15px 0 #333,
        15px -15px 0 #333,
        -15px 15px 0 #333,
        15px 15px 0 #333;
}

.dice[data-value="5"]::before {
    content: '';
    width: 10px;
    height: 10px;
    background: #333;
    border-radius: 50%;
    box-shadow: 
        -15px -15px 0 #333,
        15px -15px 0 #333,
        0 0 0 #333,
        -15px 15px 0 #333,
        15px 15px 0 #333;
}

.dice[data-value="6"]::before {
    content: '';
    width: 10px;
    height: 10px;
    background: transparent;
    border-radius: 50%;
    box-shadow: 
        -15px -15px 0 #333,
        15px -15px 0 #333,
        -15px 0 0 #333,
        15px 0 0 #333,
        -15px 15px 0 #333,
        15px 15px 0 #333;
}

/* 1点为红色 */
.dice[data-value="1"]::before {
    background: #e74c3c;
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

/* 摇骰子动画 */
@keyframes shake {
    0%, 100% { transform: rotate(0deg) translateY(0); }
    10% { transform: rotate(-10deg) translateY(-5px); }
    20% { transform: rotate(10deg) translateY(-5px); }
    30% { transform: rotate(-10deg) translateY(-5px); }
    40% { transform: rotate(10deg) translateY(-5px); }
    50% { transform: rotate(-5deg) translateY(-3px); }
    60% { transform: rotate(5deg) translateY(-3px); }
    70% { transform: rotate(-5deg) translateY(-3px); }
    80% { transform: rotate(5deg) translateY(-3px); }
    90% { transform: rotate(0deg) translateY(0); }
}

.dice.shaking {
    animation: shake 0.5s ease-in-out;
}

/* ==================== AI对话区 ==================== */
.dialogue-area {
    display: flex;
    justify-content: center;
}

.dialogue-bubble {
    background: linear-gradient(135deg, rgba(107, 92, 231, 0.3), rgba(107, 92, 231, 0.1));
    border: 2px solid rgba(107, 92, 231, 0.5);
    border-radius: 20px;
    padding: 15px 25px;
    font-size: 1.1rem;
    max-width: 80%;
    text-align: center;
    position: relative;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 10px rgba(107, 92, 231, 0.3); }
    50% { box-shadow: 0 0 20px rgba(107, 92, 231, 0.6); }
}

/* ==================== 游戏信息区 ==================== */
.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius);
}

.current-bid {
    font-size: 1.2rem;
}

.bid-label {
    color: var(--text-muted);
}

.bid-content {
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.4rem;
}

.turn-indicator {
    font-size: 1.1rem;
    padding: 8px 20px;
    border-radius: 20px;
    background: rgba(78, 205, 196, 0.2);
    color: #4ecdc4;
    font-weight: bold;
}

.turn-indicator.ai-turn {
    background: rgba(255, 107, 107, 0.2);
    color: var(--secondary-color);
}

/* ==================== 操作区域 ==================== */
.action-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius);
}

.bid-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.bid-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bid-input-group label {
    color: var(--text-muted);
}

.bid-input-group select {
    padding: 8px 15px;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(30, 30, 50, 0.9);
    color: var(--text-color);
    cursor: pointer;
    min-width: 60px;
}

.bid-input-group select option {
    background: #1a1a2e;
    color: var(--text-color);
    padding: 8px;
}

.bid-input-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(30, 30, 50, 1);
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.mode-info {
    text-align: center;
    color: var(--accent-color);
    font-size: 0.9rem;
    margin-top: 10px;
}

/* ==================== 结果弹窗 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    text-align: center;
    animation: slideIn 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#result-title {
    color: var(--accent-color);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

#result-details {
    margin-bottom: 20px;
    line-height: 1.8;
    color: var(--text-muted);
}

#result-details strong {
    color: var(--text-color);
}

.all-dice-reveal {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.reveal-section {
    text-align: center;
}

.reveal-section h4 {
    margin-bottom: 10px;
    color: var(--text-muted);
}

.reveal-dice {
    display: flex;
    gap: 8px;
}

.reveal-dice .dice {
    width: 45px;
    height: 45px;
}

/* ==================== 动画 ==================== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    :root {
        --dice-size: 50px;
    }

    .game-title {
        font-size: 2rem;
    }

    .rules-section {
        padding: 15px;
    }

    .player-area {
        flex-direction: column !important;
        gap: 15px;
    }

    .dice-container {
        gap: 10px;
    }

    .bid-controls {
        flex-direction: column;
        gap: 10px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .game-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .dialogue-bubble {
        font-size: 1rem;
        padding: 12px 18px;
    }
}

@media (max-width: 480px) {
    :root {
        --dice-size: 40px;
    }

    .screen {
        padding: 10px;
    }

    .dice[data-value="2"]::before,
    .dice[data-value="3"]::before {
        box-shadow: 
            -10px -10px 0 #333,
            10px 10px 0 #333;
    }

    .dice[data-value="3"]::before {
        box-shadow: 
            -10px -10px 0 #333,
            0 0 0 #333,
            10px 10px 0 #333;
    }

    .dice[data-value="4"]::before {
        box-shadow: 
            -10px -10px 0 #333,
            10px -10px 0 #333,
            -10px 10px 0 #333,
            10px 10px 0 #333;
    }

    .dice[data-value="5"]::before {
        box-shadow: 
            -10px -10px 0 #333,
            10px -10px 0 #333,
            0 0 0 #333,
            -10px 10px 0 #333,
            10px 10px 0 #333;
    }

    .dice[data-value="6"]::before {
        box-shadow: 
            -10px -10px 0 #333,
            10px -10px 0 #333,
            -10px 0 0 #333,
            10px 0 0 #333,
            -10px 10px 0 #333,
            10px 10px 0 #333;
    }
}

/* ==================== 特殊效果 ==================== */
.winner {
    animation: winnerPulse 1s ease infinite;
}

@keyframes winnerPulse {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(255, 217, 61, 0.5);
        border-color: var(--accent-color);
    }
    50% { 
        box-shadow: 0 0 40px rgba(255, 217, 61, 0.8);
        border-color: #fff;
    }
}

.loser {
    opacity: 0.6;
    filter: grayscale(0.5);
}

/* 禁用状态 */
.disabled {
    pointer-events: none;
    opacity: 0.5;
}
