* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --gold: #fbbf24;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #1a1a2e 100%);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
}

/* 通用样式 */
.screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.screen.hidden {
    display: none;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn.primary {
    background: var(--primary);
    color: white;
}

.btn.primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.btn.secondary {
    background: var(--secondary);
    color: white;
}

.btn.secondary:hover {
    background: #475569;
}

.btn.danger {
    background: var(--danger);
    color: white;
}

.btn.large {
    padding: 16px 32px;
    font-size: 18px;
}

.btn.small {
    padding: 6px 12px;
    font-size: 14px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 登录界面 */
.login-container {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.login-container h1 {
    font-size: 2.5rem;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.input-group {
    margin-bottom: 16px;
}

.input-group input {
    width: 100%;
    padding: 14px;
    border: 2px solid #334155;
    border-radius: 8px;
    background: var(--bg-dark);
    color: var(--text-light);
    font-size: 16px;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.error {
    color: var(--danger);
    margin: 16px 0;
    min-height: 20px;
}

.rules-toggle {
    margin-top: 20px;
}

/* 规则界面 */
.rules-container {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
}

.rules-container h2 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--gold);
}

.rules-content section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #334155;
}

.rules-content h3 {
    color: var(--primary);
    margin-bottom: 8px;
}

.rules-content ul {
    margin-left: 20px;
}

.rules-content li {
    margin: 6px 0;
    color: var(--text-muted);
}

.rules-content strong {
    color: var(--text-light);
}

/* 房间等待界面 */
.lobby-container {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.room-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin: 20px 0;
}

#room-code-display {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--gold);
    letter-spacing: 3px;
}

.players-list h3 {
    margin-bottom: 10px;
    color: var(--text-muted);
}

.players-list ul {
    list-style: none;
}

.players-list li {
    padding: 10px;
    margin: 5px 0;
    background: var(--bg-dark);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
}

.players-list li .ready-status {
    color: var(--success);
}

.players-list li .not-ready {
    color: var(--text-muted);
}

.lobby-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.status {
    margin-top: 15px;
    color: var(--text-muted);
}

/* 游戏界面 */
#game-screen {
    flex-direction: column;
    max-width: 1000px;
    margin: 0 auto;
    gap: 15px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    flex-wrap: wrap;
    gap: 10px;
}

.round-info {
    display: flex;
    gap: 15px;
}

.round-info span {
    padding: 5px 12px;
    background: var(--bg-dark);
    border-radius: 6px;
}

.turn-info {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    padding: 10px 20px;
    border-radius: 8px;
}

.current-turn {
    display: flex;
    align-items: center;
    gap: 10px;
}

.turn-player {
    font-weight: bold;
}

.turn-badge {
    background: var(--gold);
    color: var(--bg-dark);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.my-turn .turn-badge {
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* 游戏主区域 */
.game-main {
    display: flex;
    gap: 20px;
}

.players-area {
    flex: 1;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 15px;
}

.players-area h3 {
    margin-bottom: 15px;
    color: var(--text-muted);
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}

.player-card {
    background: var(--bg-dark);
    border-radius: 10px;
    padding: 12px;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.player-card.current {
    border-color: var(--gold);
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.3);
}

.player-card.self {
    background: #2d3a4f;
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.player-name {
    font-weight: bold;
    font-size: 0.9rem;
}

.shield-badge {
    font-size: 0.8rem;
}

.player-scores {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.player-scores strong {
    color: var(--text-light);
}

.player-status-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-align: center;
    padding: 3px;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

.player-card.current .player-status-text {
    color: var(--gold);
}

.player-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    min-height: 26px;
}

.mini-card {
    width: 24px;
    height: 30px;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.mini-card.number {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.mini-card.bonus {
    background: linear-gradient(135deg, var(--success), #059669);
}

.mini-card.freeze {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
}

.mini-card.draw3 {
    background: linear-gradient(135deg, var(--warning), #d97706);
}

.mini-card.shield {
    background: linear-gradient(135deg, #ec4899, #db2777);
}

/* 操作区域 */
.action-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 12px;
    min-width: 180px;
}

.deck-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.deck-pile {
    position: relative;
}

.deck-back {
    width: 80px;
    height: 112px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.action-buttons .btn {
    width: 100%;
}

/* 我的面板 */
.my-panel {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 15px 20px;
    background: var(--bg-card);
    border-radius: 12px;
    flex-wrap: wrap;
}

.my-status {
    display: flex;
    gap: 15px;
    align-items: center;
}

.my-name {
    font-weight: bold;
}

.my-score strong {
    color: var(--gold);
    font-size: 1.2rem;
}

.my-round strong {
    color: var(--success);
}

.my-bonus {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.card-icons {
    display: flex;
    gap: 5px;
}

.shield-indicator {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.shield-indicator.active {
    background: linear-gradient(135deg, #ec4899, #db2777);
}

.shield-indicator.inactive {
    background: var(--bg-dark);
    color: var(--text-muted);
}

.status-text {
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: bold;
    background: var(--bg-dark);
}

.status-myturn {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    animation: pulse 1s infinite;
}

.status-waiting {
    color: var(--text-muted);
}

.status-stand {
    background: var(--success);
}

.status-freezed {
    background: #06b6d4;
}

.status-eliminated {
    background: var(--danger);
}

/* 我的卡牌 */
.my-cards-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 15px;
}

.my-cards-section h4 {
    margin-bottom: 10px;
    color: var(--text-muted);
}

.cards-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 70px;
    padding: 10px;
    background: var(--bg-dark);
    border-radius: 8px;
}

.card {
    width: 50px;
    height: 70px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.card.number {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.card.bonus {
    background: linear-gradient(135deg, var(--success), #059669);
}

.card.freeze {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
}

.card.draw3 {
    background: linear-gradient(135deg, var(--warning), #d97706);
}

.card.shield {
    background: linear-gradient(135deg, #ec4899, #db2777);
}

/* 模态框 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-card);
    padding: 30px;
    border-radius: 16px;
    text-align: center;
    min-width: 300px;
}

.modal-content h3 {
    margin-bottom: 20px;
    color: var(--gold);
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.option-btn {
    padding: 15px;
    background: var(--bg-dark);
    border: 2px solid #334155;
    border-radius: 8px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s;
}

.option-btn:hover {
    border-color: var(--primary);
    background: var(--primary);
}

/* 游戏日志 */
.game-log {
    position: fixed;
    right: 10px;
    bottom: 10px;
    width: 200px;
    max-height: 150px;
    background: var(--bg-card);
    border-radius: 8px;
    padding: 10px;
    overflow-y: auto;
}

.game-log h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 5px;
}

#log-entries {
    font-size: 0.7rem;
}

.log-entry {
    padding: 3px 0;
    border-bottom: 1px solid #334155;
    color: var(--text-muted);
}

.log-entry.important {
    color: var(--danger);
    font-weight: bold;
}

/* 通知 */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 15px 30px;
    background: var(--primary);
    border-radius: 8px;
    font-size: 1.1rem;
    z-index: 2000;
}

.notification.hidden {
    display: none;
}

/* 游戏结束 */
.end-container {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 16px;
    text-align: center;
    max-width: 500px;
}

.end-container h2 {
    font-size: 2rem;
    margin-bottom: 30px;
}

.scores-list {
    margin: 20px 0;
}

.scores-list .score-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-dark);
    border-radius: 8px;
    margin: 8px 0;
}

.scores-list .score-row.winner {
    background: linear-gradient(135deg, var(--gold), #f59e0b);
    color: var(--bg-dark);
}

.winner-display {
    margin: 20px 0;
    font-size: 1.5rem;
}

.winner-display .crown {
    font-size: 3rem;
}

.end-container .btn {
    margin: 10px;
}

/* 响应式 */
@media (max-width: 800px) {
    .game-main {
        flex-direction: column;
    }
    
    .game-log {
        display: none;
    }
    
    .players-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }
    
    .my-panel {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .my-bonus {
        margin-left: 0;
    }
}
