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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    max-width: 900px;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* 标题 */
.game-header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

.game-header h1 {
    color: #667eea;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.help-btn {
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    font-size: 1.5em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.help-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-50%) scale(1.1);
}

/* 玩家面板 */
.players-panel {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin-bottom: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
}

.player-card {
    text-align: center;
    padding: 15px 25px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s, box-shadow 0.3s;
}

.player-card.active {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(102, 126, 234, 0.3);
    border: 3px solid #667eea;
}

.player-avatar {
    font-size: 3.5em;
    margin-bottom: 10px;
    text-align: center;
    line-height: 1;
}

.player-name {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
    margin-bottom: 8px;
}

.player-score {
    font-size: 1.1em;
    color: #666;
    margin-bottom: 5px;
}

.player-score span {
    font-weight: bold;
    color: #667eea;
    font-size: 1.3em;
}

.player-role {
    font-size: 0.9em;
    color: #999;
    font-style: italic;
}

.vs-badge {
    font-size: 2em;
    font-weight: bold;
    color: #667eea;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* 游戏信息 */
.game-info {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    font-weight: 500;
}

.game-info span {
    color: #667eea;
    font-weight: bold;
}

.pool-info, .beans-remaining {
    color: #333;
}

.pool-info span, .beans-remaining span {
    color: #e74c3c;
    font-size: 1.2em;
}

/* 豆子容器 */
.beans-container {
    position: relative;
    width: 100%;
    height: 500px;
    background: radial-gradient(ellipse at center, #ffffff 0%, #f0f0f0 70%, #e0e0e0 100%);
    border-radius: 50%;
    box-shadow:
        inset 0 0 30px rgba(0, 0, 0, 0.1),
        0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
    overflow: hidden;
}

.bean {
    position: absolute;
    width: 36px;
    height: 28px;
    cursor: pointer;
    transition: transform 0.3s;
    user-select: none;
    border-radius: 50%;
    box-shadow:
        inset 2px 2px 4px rgba(255, 255, 255, 0.4),
        inset -2px -2px 4px rgba(0, 0, 0, 0.2),
        2px 2px 4px rgba(0, 0, 0, 0.3);
}

.bean::before {
    content: '';
    position: absolute;
    top: 4px;
    left: 6px;
    width: 6px;
    height: 4px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 50%;
}

.bean-red {
    background: linear-gradient(145deg, #d4534a 0%, #a93226 100%);
}

.bean-yellow {
    background: linear-gradient(145deg, #f4d03f 0%, #d4ac0d 100%);
}

.bean-blue {
    background: linear-gradient(145deg, #5dade2 0%, #2874a6 100%);
}

.bean-green {
    background: linear-gradient(145deg, #52be80 0%, #1d8348 100%);
}

.bean-purple {
    background: linear-gradient(145deg, #af7ac5 0%, #7d3c98 100%);
}

.bean-bomb {
    background: linear-gradient(145deg, #424949 0%, #1a1a1a 100%);
}

.bean-bomb::after {
    content: '💣';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.9em;
}

.bean:hover:not(.disabled):not(.drawn):not(.hidden) {
    transform: scale(1.15);
}

.bean.disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.bean.drawn {
    opacity: 0.2;
    cursor: not-allowed;
}

.bean.hidden {
    opacity: 0;
    pointer-events: none;
}

.bean.explode {
    animation: explode 0.5s ease-in-out;
}

@keyframes explode {
    0% { transform: scale(1); }
    50% { transform: scale(1.8); }
    100% { transform: scale(1); }
}

/* 操作面板 */
.actions-panel {
    text-align: center;
    margin-bottom: 20px;
}

.instruction {
    font-size: 1.1em;
    color: #667eea;
    margin-bottom: 15px;
    font-weight: 500;
}

.buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    font-size: 1em;
    font-weight: 600;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
}

.btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-continue {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
}

.btn-stop {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

/* 进度条 */
.draw-progress {
    margin-top: 15px;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    color: #667eea;
    font-weight: 600;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease-out;
}

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

.modal-content h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.modal-content p {
    margin: 15px 0;
    color: #333;
}

.highlight {
    color: #667eea;
    font-weight: bold;
}

.hint {
    color: #999;
    font-size: 0.9em;
    margin: 10px 0;
}

.hint span {
    color: #667eea;
    font-weight: bold;
    font-size: 1.2em;
}

.form-group {
    margin: 20px 0;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #666;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.decision-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.decision-buttons button {
    flex: 1;
}

/* 特殊 Modal 样式 */
.modal-explode {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
}

.modal-explode h2, .modal-explode p {
    color: white;
}

.explode-message {
    font-size: 1.5em;
    font-weight: bold;
    margin: 20px 0;
}

.modal-success {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.modal-success h2, .modal-success p {
    color: white;
}

.score-change {
    font-size: 2em;
    font-weight: bold;
    margin: 10px 0;
}

.modal-gameover {
    background: linear-gradient(135deg, #f9d423 0%, #ff4e50 100%);
}

.modal-gameover h2, .modal-gameover p {
    color: white;
}

.winner-message {
    font-size: 1.5em;
    font-weight: bold;
    margin: 20px 0;
}

.final-scores {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
}

.final-scores p {
    font-size: 1.2em;
    color: white;
}

/* 规则 Modal 样式 */
.modal-rules {
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.rules-content {
    text-align: left;
    margin: 20px 0;
}

.rule-section {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.rule-section h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.rule-section p {
    color: #333;
    line-height: 1.6;
    margin: 8px 0;
}

.rule-section ul {
    margin: 10px 0;
    padding-left: 20px;
}

.rule-section li {
    color: #333;
    line-height: 1.8;
    margin: 5px 0;
}

.rule-section strong {
    color: #e74c3c;
}

/* 响应式 */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }

    .game-header {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }

    .game-header h1 {
        font-size: 1.5em;
        order: 1;
    }

    .help-btn {
        width: 32px;
        height: 32px;
        font-size: 1.2em;
        position: static;
        transform: none;
        order: 2;
    }

    .help-btn:hover {
        transform: scale(1.1);
    }

    .players-panel {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }

    .player-card {
        padding: 10px 20px;
    }

    .player-avatar {
        font-size: 2.5em;
    }

    .player-name {
        font-size: 1.1em;
    }

    .player-score {
        font-size: 0.9em;
    }

    .vs-badge {
        transform: rotate(90deg);
        font-size: 1.5em;
    }

    .game-info {
        flex-direction: column;
        gap: 8px;
        text-align: center;
        font-size: 0.9em;
        padding: 10px;
    }

    .beans-container {
        height: 350px;
        max-width: 350px;
        margin: 0 auto 15px auto;
    }

    .bean {
        width: 28px;
        height: 22px;
    }

    .bean::before {
        top: 3px;
        left: 5px;
        width: 5px;
        height: 3px;
    }

    .bean-bomb::after {
        font-size: 0.7em;
    }

    .instruction {
        font-size: 1em;
        margin-bottom: 10px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9em;
    }

    .buttons {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .decision-buttons {
        flex-direction: column;
    }

    .progress-bar {
        height: 16px;
    }

    .progress-text {
        font-size: 0.9em;
    }

    .modal-content {
        padding: 20px;
        max-width: 95%;
    }

    .modal-content h2 {
        font-size: 1.3em;
    }

    .modal-rules {
        max-height: 75vh;
    }
}
