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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #2c5530, #1a3a1d);
    color: #fff;
    min-height: 100vh;
    padding: 20px;
}

#game-container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 20px;
    padding: 20px;
    backdrop-filter: blur(10px);
}

#game-header {
    text-align: center;
    margin-bottom: 30px;
}

#game-header h1 {
    font-size: 2.5rem;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

#game-status {
    font-size: 1.2rem;
    margin-top: 10px;
    color: #fff;
}

#players-area {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
}

.player-area {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    min-width: 300px;
    backdrop-filter: blur(5px);
}

.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-weight: bold;
    gap: 10px;
}

.player-name {
    color: #ffd700;
    flex: 1;
}

.player-score {
    font-size: 1.1rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 40px;
    text-align: center;
}

.player-score.positive {
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.player-score.negative {
    color: #f44336;
    background: rgba(244, 67, 54, 0.1);
}

.card-count::after {
    content: '张牌';
}

#center-area {
    text-align: center;
    margin: 30px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
}

/* 倍数显示容器 */
.multiplier-container {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 15px 0;
    padding: 10px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.current-multiplier, .base-score {
    display: flex;
    align-items: center;
    gap: 8px;
}

.multiplier-container .label {
    color: #ffd700;
    font-size: 0.9rem;
}

.multiplier-container .value {
    font-weight: bold;
    font-size: 1.2rem;
    color: #fff;
    padding: 4px 8px;
    background: rgba(255, 215, 0, 0.2);
    border-radius: 6px;
}

.score-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049) !important;
    border: none;
    color: white;
    margin-left: 10px;
}

#landlord-cards, #last-play {
    margin-bottom: 20px;
}

#landlord-cards h3, #last-play h3 {
    color: #ffd700;
    margin-bottom: 10px;
}

.landlord-card-container, .last-play-cards {
    display: flex;
    justify-content: center;
    gap: 10px;
    min-height: 80px;
    align-items: center;
}

#game-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

button {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.15s ease;
    will-change: transform, box-shadow;
}

button:enabled {
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

button:enabled:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

button:enabled:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.05s ease;
}

button:disabled {
    background: #666;
    color: #999;
    cursor: not-allowed;
}

.player-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    min-height: 100px;
}

.hidden-cards {
    justify-content: center;
}

.card {
    width: 60px;
    height: 84px;
    border: 2px solid #333;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s cubic-bezier(0.4, 0, 0.2, 1), 
                border-color 0.1s ease,
                box-shadow 0.15s ease;
    font-weight: bold;
    font-size: 0.9rem;
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.card.visible {
    background: white;
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.card.hidden {
    background: linear-gradient(135deg, #1e3c72, #2a5298);
    color: transparent;
}

.card.visible:hover {
    transform: translateY(-3px) translateZ(0);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
}

.card.selected {
    transform: translateY(-8px) translateZ(0);
    border-color: #ffd700;
    box-shadow: 0 4px 8px rgba(255, 215, 0, 0.4);
}

.card.selecting {
    transform: translateY(-4px) translateZ(0);
    transition: transform 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.card.deselecting {
    transform: translateY(0) translateZ(0);
    transition: transform 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.card.red {
    color: #d32f2f;
}

.card.black {
    color: #333;
}

.card .suit {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.card .value {
    font-size: 1rem;
    font-weight: bold;
}

#current-player-cards .card {
    width: 70px;
    height: 98px;
}

#game-log {
    position: fixed;
    right: 20px;
    top: 20px;
    width: 300px;
    max-height: 400px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 10px;
    padding: 15px;
    backdrop-filter: blur(10px);
}

#game-log h3 {
    color: #ffd700;
    margin-bottom: 10px;
    text-align: center;
}

#log-content {
    max-height: 320px;
    overflow-y: auto;
    font-size: 0.9rem;
    line-height: 1.4;
}

.log-entry {
    margin-bottom: 8px;
    padding: 5px;
    border-left: 3px solid #ffd700;
    padding-left: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.log-entry.system {
    border-left-color: #4caf50;
}

.log-entry.error {
    border-left-color: #f44336;
}

@media (max-width: 1024px) {
    #game-log {
        position: relative;
        right: auto;
        top: auto;
        width: 100%;
        margin-top: 20px;
    }
    
    #players-area {
        flex-direction: column;
        gap: 15px;
    }
    
    .player-area {
        min-width: auto;
    }
    
    .card {
        width: 50px;
        height: 70px;
        font-size: 0.8rem;
    }
    
    #current-player-cards .card {
        width: 60px;
        height: 84px;
    }
}

/* 动画效果 */
@keyframes cardDeal {
    from {
        transform: scale(0.8) translateY(-20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.card.dealing {
    animation: cardDeal 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cardFlip {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(90deg) scale(0.95);
    }
    100% {
        transform: rotateY(0deg) scale(1);
    }
}

.card.flipping {
    animation: cardFlip 0.3s ease-in-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.4);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 0 0 6px rgba(255, 215, 0, 0);
    }
}

.player-area.current-turn {
    animation: pulse 2s infinite ease-in-out;
    border: 2px solid #ffd700;
}

/* 性能优化和交互改进 */
.player-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    justify-content: center;
    min-height: 100px;
    contain: layout;
    transform: translateZ(0);
}

.card-container {
    perspective: 1000px;
}

.card-interactive {
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.card.visible {
    background: white;
    color: #333;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

.card.visible:active {
    transform: translateY(-1px) scale(0.98);
    transition: transform 0.05s ease;
}

/* 批量选择动画 */
@keyframes batchSelect {
    0% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
    100% { transform: translateY(-8px); }
}

.card.batch-selecting {
    animation: batchSelect 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* 快速反馈效果 */
@keyframes quickFeedback {
    0% { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15); }
    50% { box-shadow: 0 0 8px rgba(255, 215, 0, 0.5); }
    100% { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15); }
}

.card.quick-feedback {
    animation: quickFeedback 0.2s ease-in-out;
}

/* 按钮交互优化 */
button:focus {
    outline: 2px solid #ffd700;
    outline-offset: 2px;
}

button:focus:not(:focus-visible) {
    outline: none;
}

/* 减少重绘和回流 */
#current-player-cards {
    contain: layout style;
}

.game-message {
    contain: layout;
    transform: translateZ(0);
}

/* 触摸设备优化 */
@media (hover: none) {
    .card.visible:hover {
        transform: none;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    }
    
    .card.selected {
        transform: translateY(-6px) translateZ(0);
    }
}

/* 减少动画在低性能设备上的影响 */
@media (prefers-reduced-motion: reduce) {
    .card,
    button,
    .player-area {
        transition: none;
        animation: none;
    }
    
    .card.selected {
        border-color: #ffd700;
        box-shadow: 0 0 0 2px #ffd700;
        transform: none;
    }
}

/* 卡牌高亮样式 */
.card.highlighted {
    border-color: #00bcd4;
    box-shadow: 0 0 8px rgba(0, 188, 212, 0.5);
    z-index: 10;
}

/* 临时消息样式 */
.temp-message {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
}

/* 活跃按钮状态 */
button.active {
    transform: translateY(1px) scale(0.98);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* 卡牌容器优化 */
.player-cards.optimized {
    will-change: transform;
    transform: translateZ(0);
}

/* === 积分系统样式 === */

/* 积分变化动画 */
.score-change-animation {
    position: fixed;
    font-size: 1.5rem;
    font-weight: bold;
    z-index: 2000;
    pointer-events: none;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    animation: scoreFloat 1s ease-out forwards;
}

@keyframes scoreFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(1.2);
    }
}

/* 积分面板 */
.score-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    background: rgba(0, 0, 0, 0.95);
    border-radius: 20px;
    backdrop-filter: blur(20px);
    z-index: 3000;
    display: none;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.score-panel.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 215, 0, 0.1));
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}

.panel-header h2 {
    color: #ffd700;
    font-size: 1.8rem;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.panel-content {
    padding: 0;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

/* 标签导航 */
.tab-nav {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    background: none;
    border: none;
    color: #ccc;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tab-btn.active {
    color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ffd700, #ffed4e);
}

.tab-btn:hover:not(.active) {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

/* 标签内容 */
.tab-content {
    display: none;
    padding: 30px;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 积分显示 */
.score-display {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.score-item {
    display: grid;
    grid-template-columns: 50px 1fr 80px 60px;
    gap: 15px;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    transition: background 0.2s ease;
}

.score-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.score-item .rank {
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffd700;
    text-align: center;
}

.score-item .player-name {
    color: #fff;
    font-weight: 500;
}

.score-item .total-score {
    font-weight: bold;
    text-align: center;
}

.score-item .win-rate {
    text-align: center;
    color: #ccc;
}

/* 游戏统计 */
.game-stats {
    margin-top: 20px;
}

.game-stats h4 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.stat-item {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    margin-bottom: 8px;
    color: #fff;
}

.stat-item.special {
    background: rgba(255, 215, 0, 0.1);
    color: #ffd700;
    font-weight: bold;
}

.no-stats {
    color: #888;
    text-align: center;
    font-style: italic;
    padding: 20px;
}

/* 排行榜 */
.ranking-display {
    color: #fff;
}

.ranking-header {
    display: grid;
    grid-template-columns: 60px 1fr 80px 80px 80px;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: 10px;
    margin-bottom: 10px;
    font-weight: bold;
    color: #ffd700;
}

.ranking-row {
    display: grid;
    grid-template-columns: 60px 1fr 80px 80px 80px;
    gap: 15px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 5px;
    transition: background 0.2s ease;
}

.ranking-row:hover {
    background: rgba(255, 255, 255, 0.08);
}

.rank-col, .score-col, .rate-col, .games-col {
    text-align: center;
}

.name-col {
    text-align: left;
}

/* 历史记录 */
.history-display {
    color: #fff;
}

.history-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    transition: background 0.2s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

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

.history-header .date {
    color: #888;
    font-size: 0.9rem;
}

.history-header .winner {
    font-weight: bold;
}

.history-header .winner.landlord {
    color: #ff6b35;
}

.history-header .winner.farmer {
    color: #4CAF50;
}

.history-scores {
    display: flex;
    gap: 15px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.score-change {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
}

.multiplier {
    color: #ffd700;
    font-size: 0.9rem;
    text-align: right;
}

.no-history {
    color: #888;
    text-align: center;
    font-style: italic;
    padding: 40px;
}

/* 设置页面 */
.settings-group {
    margin-bottom: 30px;
}

.settings-group h4 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

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

.score-select {
    width: 100%;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1rem;
}

.score-select option {
    background: #333;
    color: #fff;
}

.data-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.data-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.data-btn:not(.danger) {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
}

.data-btn.danger {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

.data-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .score-panel {
        width: 95%;
        max-height: 90vh;
    }
    
    .panel-header {
        padding: 15px 20px;
    }
    
    .panel-header h2 {
        font-size: 1.5rem;
    }
    
    .tab-content {
        padding: 20px;
    }
    
    .score-item {
        grid-template-columns: 40px 1fr 70px 50px;
        gap: 10px;
        padding: 10px;
    }
    
    .ranking-header, .ranking-row {
        grid-template-columns: 50px 1fr 70px 60px 60px;
        gap: 10px;
    }
    
    .data-buttons {
        flex-direction: column;
    }
    
    .multiplier-container {
        flex-direction: column;
        gap: 15px;
        align-items: center;
    }
}