/* ===== 全局样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 50%, #388e3c 100%);
    min-height: 100vh;
    width: 100%;
    color: #333;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== 标题栏 ===== */
.header {
    text-align: center;
    padding: 15px 0;
}

.header h1 {
    font-size: 2rem;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 2px;
}

/* ===== 设置面板 ===== */
.settings-panel {
    display: flex;
    justify-content: center;
    gap: 30px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 15px 25px;
    margin-bottom: 20px;
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.setting-group label {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.setting-group select {
    padding: 8px 15px;
    border-radius: 8px;
    border: none;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.setting-group select:hover {
    transform: scale(1.05);
}

.base-score-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.base-score-custom-input {
    width: 100px;
    padding: 8px 12px;
    border-radius: 8px;
    border: 2px solid #4caf50;
    background: #fff;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s;
}

.base-score-custom-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3);
}

.setting-group span {
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

/* ===== 玩家卡片区域 ===== */
.players-section {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.player-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.player-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4caf50, #8bc34a);
}

.player-card.landlord::before {
    background: linear-gradient(90deg, #ff6f00, #ffa000);
}

.player-card.farmer::before {
    background: linear-gradient(90deg, #1565c0, #42a5f5);
}

.player-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0,0,0,0.2);
}

.player-name {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    cursor: text;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.2s;
    position: relative;
    user-select: none;
}

.player-name:hover {
    background: #f5f5f5;
}

.player-name::before {
    content: '✏️ ';
    font-size: 12px;
    opacity: 0.5;
}

.player-name-editing {
    background: #e8f5e9 !important;
    outline: 2px solid #4caf50;
}

.player-role {
    font-size: 14px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
    margin-bottom: 12px;
    min-width: 60px;
}

.role-landlord {
    background: #fff3e0;
    color: #ff6f00;
}

.role-farmer {
    background: #e3f2fd;
    color: #1565c0;
}

.role-none {
    background: #f5f5f5;
    color: #999;
}

.player-score {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 10px 0;
    transition: all 0.3s ease;
}

.score-positive {
    color: #4caf50;
}

.score-negative {
    color: #f44336;
}

.score-zero {
    color: #666;
}

.btn-role {
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.btn-role:hover {
    transform: scale(1.05);
}

.btn-role.active {
    transform: scale(1.05);
}

.btn-landlord.active {
    background: #ff6f00;
    color: #fff;
    border-color: #ff6f00;
}

.btn-farmer.active {
    background: #1565c0;
    color: #fff;
    border-color: #1565c0;
}

/* ===== 玩家按钮区域 ===== */
.player-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.btn-extra {
    padding: 10px 8px;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-steal {
    border-color: #ff6f00;
    color: #ff6f00;
}

.btn-steal:hover {
    background: #fff3e0;
    transform: scale(1.05);
}

.btn-steal.active {
    background: #ff6f00;
    color: #fff;
    box-shadow: 0 2px 8px rgba(255, 111, 0, 0.4);
}

.btn-double {
    border-color: #e91e63;
    color: #e91e63;
}

.btn-double:hover {
    background: #fce4ec;
    transform: scale(1.05);
}

.btn-double.active {
    background: #e91e63;
    color: #fff;
    box-shadow: 0 2px 8px rgba(233, 30, 99, 0.4);
}

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

/* ===== 操作面板 ===== */
.actions-panel {
    background: rgba(255,255,255,0.95);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.bid-group {
    margin-bottom: 15px;
}

.bid-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.bid-buttons {
    display: flex;
    gap: 10px;
}

.btn-bid {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #9c27b0;
    border-radius: 10px;
    background: #fff;
    color: #9c27b0;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-bid:hover {
    background: #f3e5f5;
    transform: scale(1.05);
}

.btn-bid.active {
    background: #9c27b0;
    color: #fff;
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.4);
}

/* ===== 春天选项 ===== */
.spring-group {
    margin-bottom: 15px;
}

.spring-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.spring-buttons {
    display: flex;
    gap: 10px;
}

.btn-spring {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #4caf50;
    border-radius: 10px;
    background: #fff;
    color: #4caf50;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-spring:hover {
    background: #e8f5e9;
    transform: scale(1.05);
}

.btn-spring.active {
    background: #4caf50;
    color: #fff;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.btn-spring[data-spring="landlord"].active {
    background: #ff6f00;
    border-color: #ff6f00;
    box-shadow: 0 4px 12px rgba(255, 111, 0, 0.4);
}

.btn-spring[data-spring="farmer"].active {
    background: #1565c0;
    border-color: #1565c0;
    box-shadow: 0 4px 12px rgba(21, 101, 192, 0.4);
}

.bomb-group {
    margin-bottom: 15px;
}

.bomb-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.bomb-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.bomb-controls-row {
    display: flex;
    flex-direction: row;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
}

.btn-bomb {
    padding: 10px 20px;
    border: 2px solid #ff6f00;
    border-radius: 10px;
    background: #fff;
    color: #ff6f00;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-bomb:hover {
    background: #fff3e0;
    transform: scale(1.05);
}

.btn-bomb.active {
    background: #ff6f00;
    color: #fff;
    box-shadow: 0 4px 12px rgba(255, 111, 0, 0.4);
}

.bomb-count-control {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.btn-bomb-decrease,
.btn-bomb-increase {
    width: 36px;
    height: 36px;
    border: 2px solid #4caf50;
    border-radius: 8px;
    background: #fff;
    color: #4caf50;
    font-size: 20px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-bomb-decrease:hover,
.btn-bomb-increase:hover {
    background: #4caf50;
    color: #fff;
    transform: scale(1.1);
}

.bomb-count {
    min-width: 40px;
    text-align: center;
    font-size: 18px;
    color: #ff6f00;
}

.current-multiplier-display {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    padding: 12px 20px;
    border-radius: 10px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    border: 2px solid #ff6f00;
    margin-top: 20px;
    margin-bottom: 20px;
}

.multiplier-value {
    font-size: 24px;
    font-weight: 800;
    color: #ff6f00;
}

.result-buttons {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.btn-result {
    flex: 1;
    padding: 15px 20px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-landlord-win {
    background: linear-gradient(135deg, #ff6f00, #ffa000);
    color: #fff;
}

.btn-landlord-win:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255,111,0,0.4);
}

.btn-farmer-win {
    background: linear-gradient(135deg, #1565c0, #42a5f5);
    color: #fff;
}

.btn-farmer-win:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(21,101,192,0.4);
}

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

.random-btn {
    text-align: center;
}

.btn-random {
    padding: 10px 25px;
    border: 2px dashed rgba(255,255,255,0.5);
    border-radius: 10px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-random:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.05);
}

/* ===== 历史记录面板 ===== */
.history-panel {
    background: rgba(255,255,255,0.95);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.history-header h3 {
    color: #333;
    font-size: 18px;
}

.btn-export {
    padding: 8px 15px;
    border: 2px solid #4caf50;
    border-radius: 8px;
    background: #fff;
    color: #4caf50;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-export:hover {
    background: #4caf50;
    color: #fff;
}

.history-list {
    max-height: 250px;
    overflow-y: auto;
}

.history-list::-webkit-scrollbar {
    width: 6px;
}

.history-list::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 3px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    animation: slideIn 0.3s ease;
}

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

.history-item:last-child {
    border-bottom: none;
}

.history-round {
    font-weight: 700;
    color: #666;
    min-width: 50px;
}

.history-detail {
    flex: 1;
    font-size: 13px;
    color: #333;
}

.history-scores {
    display: flex;
    gap: 12px;
    font-size: 13px;
    font-weight: 600;
}

.history-score-change {
    padding: 2px 8px;
    border-radius: 4px;
}

.change-positive {
    background: #e8f5e9;
    color: #4caf50;
}

.change-negative {
    background: #ffebee;
    color: #f44336;
}

.change-zero {
    background: #f5f5f5;
    color: #999;
}

.history-empty {
    text-align: center;
    padding: 30px;
    color: #999;
    font-size: 14px;
}

/* ===== 底部操作按钮 ===== */
.footer-actions {
    display: flex;
    gap: 15px;
    justify-content: space-between;
}

.footer-actions button {
    flex: 1;
    padding: 12px 15px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary {
    border: 2px solid rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.2);
    color: #fff;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.02);
}

.btn-danger {
    border: 2px solid #f44336;
    background: rgba(244, 67, 54, 0.2);
    color: #fff;
}

.btn-danger:hover {
    background: rgba(244, 67, 54, 0.4);
    transform: scale(1.02);
}

/* ===== 姓名编辑输入框 ===== */
.name-edit-input {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 12px 20px;
    border: 2px solid #4caf50;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    width: 200px;
    z-index: 1000;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

/* ===== 动画效果 ===== */
@keyframes scoreChange {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.score-animate {
    animation: scoreChange 0.5s ease;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .container {
        width: 100%;
        padding: 12px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .settings-panel {
        flex-direction: column;
        gap: 10px;
        padding: 15px;
    }
    
    .players-section {
        grid-template-columns: 1fr;
        gap: 12px;
        width: 100%;
    }
    
    .player-card {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        text-align: left;
        width: 100%;
    }
    
    .player-card .player-score {
        grid-column: 1 / -1;
        text-align: center;
        font-size: 2rem;
    }
    
    .player-card .player-buttons {
        grid-column: 1 / -1;
        gap: 10px;
    }
    
    .player-card .btn-role,
    .player-card .btn-extra {
        font-size: 14px;
        padding: 12px 10px;
        width: 100%;
    }
    
    .actions-panel {
        width: 100%;
        padding: 15px;
    }
    
    .bid-buttons,
    .spring-buttons,
    .result-buttons {
        width: 100%;
    }
    
    .bomb-controls-row {
        flex-direction: column;
        gap: 10px;
    }
    
    .bomb-count-control {
        width: 100%;
        justify-content: space-between;
    }
    
    .spring-buttons {
        flex-direction: column;
    }
    
    .btn-spring {
        width: 100%;
    }
    
    .bomb-controls {
        gap: 8px;
    }
    
    .btn-bomb {
        width: 100%;
        align-self: stretch;
    }
    
    .base-score-input-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .base-score-custom-input {
        width: 100%;
    }
    
    .result-buttons {
        flex-direction: column;
    }
    
    .settings-panel {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
}

/* ===== 超小屏幕优化 ===== */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 1.3rem;
    }
    
    .player-card {
        padding: 15px;
    }
    
    .player-card .btn-role,
    .player-card .btn-extra {
        font-size: 13px;
        padding: 10px 8px;
    }
    
    .actions-panel {
        padding: 12px;
    }
    
    .footer-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .footer-actions button {
        width: 100%;
        z-index: 100;
        position: relative;
    }
}
