/* Blackjack Dice Styles - Complete with Timer System */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e1e2e, #2a2d47, #16213e);
    color: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    overflow-x: auto;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    font-weight: 600;
}

/* === SCREEN MANAGEMENT === */
.screen {
    width: 100%;
    max-width: 1400px;
}

/* === CONNECTION SCREEN === */
.connection-form {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 400px;
    margin: 0 auto;
}

.connection-form h2 {
    margin-bottom: 30px;
    color: #FFD700;
    font-weight: 600;
}

.connection-form input {
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 16px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.connection-form input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.connection-form button {
    width: 100%;
    padding: 15px;
    margin: 20px 0;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.connection-form button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(76, 175, 80, 0.3);
}

#connectionStatus {
    margin-top: 20px;
    font-size: 14px;
}

/* === WAITING SCREEN === */
.waiting-info {
    text-align: center;
    padding: 60px 40px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 500px;
    margin: 0 auto;
}

.waiting-info h2 {
    margin-bottom: 30px;
    color: #FFD700;
    font-weight: 600;
}

#roomInfo {
    font-size: 18px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#playersCount {
    font-size: 16px;
    margin-bottom: 30px;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === GAME CONTAINER === */
.game-container {
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    gap: 20px;
    width: 100%;
    height: 600px;
}

/* === PLAYER PANELS === */
.player-section {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: column;
    position: relative;
}

.player-section.active {
    border-color: #4CAF50;
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.3);
}

.player-section.my-player {
    border-color: #FFD700;
    background: rgba(255, 215, 0, 0.08);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.player-info h2 {
    font-size: 1.4em;
    font-weight: 600;
    margin: 0;
}

.player-role {
    font-size: 0.8em;
    opacity: 0.7;
    margin-top: 3px;
}

.hp-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
}

.hp-display .hp-icon {
    color: #4CAF50;
    font-size: 16px;
}

/* === HP BAR === */
.hp-bar {
    width: 100%;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0 20px 0;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.hp-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #45a049);
    transition: width 0.5s ease;
    border-radius: 10px;
}

.hp-fill.low {
    background: linear-gradient(90deg, #ff9800, #f57c00);
}

.hp-fill.critical {
    background: linear-gradient(90deg, #f44336, #d32f2f);
    animation: pulse-hp 1s infinite;
}

@keyframes pulse-hp {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.hp-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 600;
    font-size: 12px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

/* === DICE COUNTER === */
.dice-counter {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 15px 0;
}

.dice-icon {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.dice-icon.used {
    background: #4CAF50;
    border-color: #4CAF50;
    color: white;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.5);
}

/* === SCORE DISPLAY === */
.score-display {
    font-size: 72px;
    font-weight: 700;
    text-align: center;
    margin: 20px 0;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
    background: rgba(0,0,0,0.2);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.score-display.hidden-score {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.4);
    font-size: 48px;
}

.score-display.bust {
    color: #f44336;
    background: rgba(244, 67, 54, 0.1);
    animation: shake 0.5s ease-in-out;
    border-color: #f44336;
}

.score-display.twenty-one {
    color: #FFD700;
    background: rgba(255, 215, 0, 0.1);
    animation: glow 1s ease-in-out;
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.3); }
    50% { box-shadow: 0 0 30px rgba(255, 215, 0, 0.6); }
}

/* === CENTER PANEL === */
.center-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.game-status {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    padding: 20px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
    flex: 1;
}

.round-info {
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    padding: 12px;
    font-size: 18px;
    font-weight: 600;
    color: #FFD700;
    margin-bottom: 15px;
}

/* === TIMER SYSTEM === */
.timer {
    font-size: 28px;
    font-weight: 700;
    color: #FFD700;
    margin: 15px 0;
    padding: 12px 20px;
    background: rgba(0,0,0,0.3);
    border-radius: 15px;
    display: inline-block;
    border: 1px solid rgba(255, 215, 0, 0.3);
    transition: all 0.3s ease;
    min-width: 80px;
    text-align: center;
}

.timer.warning {
    color: #f44336;
    background: rgba(244, 67, 54, 0.2);
    border-color: #f44336;
    animation: timerPulse 1s infinite;
    box-shadow: 0 0 20px rgba(244, 67, 54, 0.4);
}

.timer.disabled {
    color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    animation: none;
}

@keyframes timerPulse {
    0%, 100% { 
        opacity: 1; 
        transform: scale(1);
    }
    50% { 
        opacity: 0.8; 
        transform: scale(1.05);
    }
}

/* Timer hints */
.timer-hint {
    margin: 10px 0;
    padding: 12px 15px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.4;
    animation: hintAppear 0.3s ease-out;
}

.timer-hint.action {
    background: rgba(33, 150, 243, 0.15);
    border: 1px solid rgba(33, 150, 243, 0.3);
    color: #64B5F6;
}

.timer-hint.waiting {
    background: rgba(255, 152, 0, 0.15);
    border: 1px solid rgba(255, 152, 0, 0.3);
    color: #ffb74d;
    text-align: center;
}

@keyframes hintAppear {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.hint-text {
    font-weight: 600;
    margin-bottom: 5px;
}

.hint-timer {
    font-size: 12px;
    opacity: 0.8;
    font-style: italic;
}

/* Keyboard shortcut styling */
kbd {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 12px;
    font-family: monospace;
    color: #FFD700;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* Waiting icon animation */
.waiting-icon {
    display: inline-block;
    animation: waitingRotate 2s linear infinite;
}

@keyframes waitingRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Auto-action notification */
.auto-action-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, rgba(255, 152, 0, 0.95), rgba(255, 193, 7, 0.95));
    color: white;
    padding: 20px 30px;
    border-radius: 15px;
    font-size: 18px;
    font-weight: 600;
    z-index: 1000;
    border: 2px solid #ff9800;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: autoActionAppear 3s ease-out forwards;
    text-align: center;
    backdrop-filter: blur(5px);
}

@keyframes autoActionAppear {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.05);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.95);
    }
}

/* === GAME PHASE === */
#gamePhase {
    font-size: 16px;
    font-weight: 600;
    margin: 15px 0;
    padding: 12px;
    background: rgba(33, 150, 243, 0.15);
    border: 1px solid rgba(33, 150, 243, 0.3);
    border-radius: 12px;
    color: #64B5F6;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.3s ease;
}

#gamePhase.my-turn {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.3);
    color: #4CAF50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.2);
}

#gamePhase.opponent-turn {
    background: rgba(158, 158, 158, 0.15);
    border-color: rgba(158, 158, 158, 0.3);
    color: #9e9e9e;
}

#gamePhase.urgent {
    background: rgba(244, 67, 54, 0.15);
    border-color: rgba(244, 67, 54, 0.3);
    color: #f44336;
    animation: phaseUrgent 2s infinite;
}

@keyframes phaseUrgent {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-2px); }
    75% { transform: translateX(2px); }
}

/* === DICE CONTAINER === */
.dice-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
    padding: 20px;
    background: rgba(0,0,0,0.2);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.dice {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #fff, #f5f5f5);
    color: #333;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    border: 2px solid rgba(0,0,0,0.1);
}

.dice.rolling {
    animation: roll 0.6s ease-in-out;
    background: linear-gradient(135deg, #FFD700, #FFA500);
}

@keyframes roll {
    0%, 100% { transform: rotateX(0deg) rotateY(0deg) scale(1); }
    25% { transform: rotateX(180deg) rotateY(90deg) scale(1.1); }
    50% { transform: rotateX(360deg) rotateY(180deg) scale(1.2); }
    75% { transform: rotateX(540deg) rotateY(270deg) scale(1.1); }
}

/* === BUTTONS === */
.button {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

.button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button.danger {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.3);
}

.button.danger:hover:not(:disabled) {
    box-shadow: 0 6px 16px rgba(244, 67, 54, 0.4);
}

/* === GAME CONTROLS === */
#gameControls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

/* === ROLL OPTIONS === */
.roll-options {
    display: none;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin: 20px 0;
    padding: 20px;
    background: rgba(0,0,0,0.2);
    border-radius: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    z-index: 10;
}

.roll-options.show {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.dice-choice-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    border: none;
    padding: 15px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 3px;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    min-width: 120px;
    text-align: center;
    border: 1px solid transparent;
}

.dice-choice-btn.safe {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-color: #4CAF50;
}

.dice-choice-btn.danger {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    border-color: #f44336;
    opacity: 0.8;
}

.dice-choice-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.4);
}

.dice-choice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.dice-preview {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 4px;
}

.score-preview {
    font-size: 12px;
    opacity: 0.9;
    background: rgba(0,0,0,0.2);
    padding: 2px 8px;
    border-radius: 8px;
}

/* === BLUFF SECTION === */
.bluff-section {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(15px);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-top: 15px;
}

.bluff-section h3 {
    text-align: center;
    margin-bottom: 15px;
    color: #FFD700;
    font-weight: 600;
}

.bluff-cards {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 15px 0;
    flex-wrap: wrap;
}

.bluff-card {
    width: 140px;
    height: 80px;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid rgba(33, 150, 243, 0.5);
    font-weight: 600;
    text-align: center;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(33, 150, 243, 0.3);
}

.bluff-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(33, 150, 243, 0.4);
}

.bluff-card.selected {
    border-color: #4CAF50;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    box-shadow: 0 8px 20px rgba(76, 175, 80, 0.4);
}

.bluff-card.available {
    border-color: #4CAF50;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
    animation: cardPulse 2s infinite;
}

@keyframes cardPulse {
    0%, 100% {
        box-shadow: 0 0 10px rgba(76, 175, 80, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
    }
}

/* === GAME LOG === */
.game-log {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 15px;
    padding: 15px;
    height: 220px;
    overflow-y: auto;
    font-size: 13px;
    line-height: 1.4;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 15px;
}

.log-entry {
    margin-bottom: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    line-height: 1.4;
    border-left: 3px solid transparent;
}

.log-entry.damage {
    background: rgba(244, 67, 54, 0.15);
    border-left-color: #f44336;
    color: #ffcdd2;
}

.log-entry.heal {
    background: rgba(76, 175, 80, 0.15);
    border-left-color: #4CAF50;
    color: #c8e6c9;
}

.log-entry.info {
    background: rgba(33, 150, 243, 0.15);
    border-left-color: #2196F3;
    color: #bbdefb;
}

.log-entry.warning {
    background: rgba(255, 152, 0, 0.15);
    border-left-color: #ff9800;
    color: #ffe0b2;
}

.log-entry.timer {
    background: rgba(255, 152, 0, 0.15);
    border-left-color: #ff9800;
    color: #ffe0b2;
    position: relative;
}

.log-entry.timer::before {
    content: "⏰";
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
}

/* === SCROLLBAR STYLING === */
.game-log::-webkit-scrollbar {
    width: 6px;
}

.game-log::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.game-log::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.game-log::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* === ANIMATIONS === */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.phase-transition {
    animation: phaseChange 0.5s ease-in-out;
}

@keyframes phaseChange {
    0% { opacity: 1; transform: translateY(0); }
    50% { opacity: 0; transform: translateY(-10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* === UTILITY CLASSES === */
.hidden {
    display: none !important;
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 1200px) {
    .game-container {
        grid-template-columns: 280px 1fr 280px;
        gap: 15px;
    }
}

@media (max-width: 900px) {
    .game-container {
        grid-template-columns: 1fr;
        height: auto;
        gap: 15px;
    }
    
    .player-section {
        height: auto;
    }
    
    .score-display {
        font-size: 48px;
        min-height: 80px;
        padding: 15px;
    }
    
    .dice-container {
        gap: 10px;
        padding: 15px;
    }
    
    .dice {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .bluff-cards {
        flex-direction: column;
        align-items: center;
    }
    
    .bluff-card {
        width: 200px;
        height: 60px;
    }
    
    .connection-form {
        margin: 20px;
        padding: 30px 20px;
    }
    
    .timer {
        font-size: 24px;
        padding: 10px 15px;
        margin: 10px 0;
    }
    
    .timer-hint {
        font-size: 13px;
        padding: 10px 12px;
    }
    
    .hint-text {
        margin-bottom: 3px;
    }
    
    .hint-timer {
        font-size: 11px;
    }
    
    .auto-action-notification {
        font-size: 16px;
        padding: 15px 20px;
        max-width: 90%;
    }
    
    kbd {
        font-size: 11px;
        padding: 1px 4px;
    }
}

/* === PHASE TRANSITIONS === */
.phase-transition {
    animation: phaseTransition 0.5s ease-in-out;
}

.transition-active {
    background: rgba(255, 152, 0, 0.2) !important;
    border-color: rgba(255, 152, 0, 0.4) !important;
    color: #ffb74d !important;
}

.timer-hint.transition {
    background: rgba(255, 152, 0, 0.2);
    border: 1px solid rgba(255, 152, 0, 0.4);
    color: #ffb74d;
    text-align: center;
    font-style: italic;
}

.transition-icon {
    display: inline-block;
    animation: transitionSpin 1.5s linear infinite;
}

@keyframes transitionSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes phaseTransition {
    0% { opacity: 1; transform: translateY(0); }
    50% { opacity: 0.7; transform: translateY(-5px); }
    100% { opacity: 1; transform: translateY(0); }
}

.sound-toggle {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sound-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* === VISUAL EFFECTS === */

/* Particles */
.particle {
    position: fixed;
    pointer-events: none;
    font-weight: bold;
    font-size: 18px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    z-index: 1000;
    animation: particleFloat 2s ease-out forwards;
}

.particle-damage {
    animation: particleDamage 1.5s ease-out forwards;
}

.particle-critical {
    font-size: 24px;
    animation: particleCritical 2s ease-out forwards;
}

.particle-bust {
    font-size: 20px;
    animation: particleBust 1.8s ease-out forwards;
}

.particle-heal {
    animation: particleHeal 2s ease-out forwards;
}

.particle-golden {
    font-size: 22px;
    animation: particleGolden 2.5s ease-out forwards;
}

@keyframes particleFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(0.5);
    }
}

@keyframes particleDamage {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
    50% {
        transform: translateY(-40px) scale(1.2) rotate(-5deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-120px) scale(0.8) rotate(-10deg);
    }
}

@keyframes particleCritical {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) scale(1.3) rotate(5deg);
    }
    50% {
        transform: translateY(-60px) scale(1.1) rotate(-3deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-150px) scale(0.7) rotate(8deg);
    }
}

@keyframes particleBust {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
    30% {
        transform: translateY(-30px) scale(1.4) rotate(-8deg);
    }
    60% {
        transform: translateY(-70px) scale(0.9) rotate(5deg);
    }
    100% {
        opacity: 0;
        transform: translateY(-130px) scale(0.6) rotate(-12deg);
    }
}

@keyframes particleHeal {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-60px) scale(1.1);
    }
    100% {
        opacity: 0;
        transform: translateY(-140px) scale(0.8);
    }
}

@keyframes particleGolden {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
        text-shadow: 0 0 10px #FFD700;
    }
    25% {
        transform: translateY(-40px) scale(1.3) rotate(10deg);
        text-shadow: 0 0 20px #FFD700;
    }
    50% {
        transform: translateY(-80px) scale(1.1) rotate(-5deg);
        text-shadow: 0 0 15px #FFD700;
    }
    100% {
        opacity: 0;
        transform: translateY(-160px) scale(0.9) rotate(15deg);
        text-shadow: 0 0 5px #FFD700;
    }
}

/* Screen effects */
.screen-flash {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.screen-shake-light {
    animation: shakeLight 0.6s ease-in-out;
}

.screen-shake-medium {
    animation: shakeMedium 0.6s ease-in-out;
}

.screen-shake-heavy {
    animation: shakeHeavy 0.8s ease-in-out;
}

@keyframes shakeLight {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-2px) translateY(1px); }
    20% { transform: translateX(2px) translateY(-1px); }
    30% { transform: translateX(-1px) translateY(1px); }
    40% { transform: translateX(1px) translateY(-1px); }
    50% { transform: translateX(-1px) translateY(0px); }
    60% { transform: translateX(1px) translateY(1px); }
    70% { transform: translateX(-1px) translateY(-1px); }
    80% { transform: translateX(1px) translateY(0px); }
    90% { transform: translateX(-1px) translateY(1px); }
}

@keyframes shakeMedium {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-4px) translateY(2px); }
    20% { transform: translateX(4px) translateY(-2px); }
    30% { transform: translateX(-3px) translateY(2px); }
    40% { transform: translateX(3px) translateY(-2px); }
    50% { transform: translateX(-2px) translateY(1px); }
    60% { transform: translateX(2px) translateY(-1px); }
    70% { transform: translateX(-2px) translateY(2px); }
    80% { transform: translateX(2px) translateY(-1px); }
    90% { transform: translateX(-1px) translateY(1px); }
}

@keyframes shakeHeavy {
    0%, 100% { transform: translateX(0); }
    10% { transform: translateX(-8px) translateY(4px) rotate(1deg); }
    20% { transform: translateX(8px) translateY(-4px) rotate(-1deg); }
    30% { transform: translateX(-6px) translateY(3px) rotate(1deg); }
    40% { transform: translateX(6px) translateY(-3px) rotate(-1deg); }
    50% { transform: translateX(-4px) translateY(2px) rotate(0.5deg); }
    60% { transform: translateX(4px) translateY(-2px) rotate(-0.5deg); }
    70% { transform: translateX(-3px) translateY(3px) rotate(0.5deg); }
    80% { transform: translateX(3px) translateY(-2px) rotate(-0.5deg); }
    90% { transform: translateX(-2px) translateY(1px) rotate(0deg); }
}

/* Player flash effects */
.flash-damage {
    animation: flashRed 0.5s ease-in-out;
}

.flash-critical {
    animation: flashCritical 0.8s ease-in-out;
}

.flash-bust {
    animation: flashBust 0.6s ease-in-out;
}

.flash-heal {
    animation: flashGreen 0.5s ease-in-out;
}

@keyframes flashRed {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(255, 68, 68, 0.3); }
}

@keyframes flashCritical {
    0%, 100% { 
        background-color: transparent; 
        box-shadow: none;
    }
    25% { 
        background-color: rgba(255, 68, 68, 0.4);
        box-shadow: 0 0 30px rgba(255, 68, 68, 0.6);
    }
    75% { 
        background-color: rgba(255, 68, 68, 0.2);
        box-shadow: 0 0 20px rgba(255, 68, 68, 0.4);
    }
}

@keyframes flashBust {
    0%, 100% { background-color: transparent; }
    33% { background-color: rgba(255, 102, 0, 0.3); }
    66% { background-color: rgba(255, 68, 68, 0.3); }
}

@keyframes flashGreen {
    0%, 100% { background-color: transparent; }
    50% { background-color: rgba(76, 175, 80, 0.3); }
}

/* Score special effects */
.score-21-burst {
    animation: score21Burst 1s ease-out;
}

.score-bust-shake {
    animation: scoreBustShake 0.6s ease-in-out;
}

@keyframes score21Burst {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(255, 215, 0, 0.7);
    }
    50% {
        transform: scale(1.2);
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.7);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    }
}

@keyframes scoreBustShake {
    0%, 100% { transform: translateX(0) scale(1); }
    10% { transform: translateX(-3px) scale(1.05); }
    20% { transform: translateX(3px) scale(0.95); }
    30% { transform: translateX(-2px) scale(1.03); }
    40% { transform: translateX(2px) scale(0.97); }
    50% { transform: translateX(-2px) scale(1.02); }
    60% { transform: translateX(2px) scale(0.98); }
    70% { transform: translateX(-1px) scale(1.01); }
    80% { transform: translateX(1px) scale(0.99); }
    90% { transform: translateX(-1px) scale(1.005); }
}

/* === VICTORY/DEFEAT ANIMATIONS === */

/* Victory Trophy */
.victory-trophy {
    position: fixed;
    font-size: 60px;
    z-index: 1001;
    pointer-events: none;
    animation: trophyAppear 4s ease-out forwards;
    text-shadow: 0 0 20px #FFD700;
}

@keyframes trophyAppear {
    0% {
        opacity: 0;
        transform: translateY(50px) scale(0.5) rotate(-10deg);
    }
    20% {
        opacity: 1;
        transform: translateY(-20px) scale(1.2) rotate(5deg);
    }
    40% {
        transform: translateY(0px) scale(1) rotate(-2deg);
    }
    60% {
        transform: translateY(-10px) scale(1.1) rotate(1deg);
    }
    80% {
        transform: translateY(0px) scale(1) rotate(0deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0px) scale(1) rotate(0deg);
    }
}

/* Victory Confetti */
.victory-confetti {
    position: fixed;
    font-size: 24px;
    z-index: 1000;
    pointer-events: none;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(0) rotate(0deg) scale(1);
    }
    50% {
        opacity: 1;
        transform: translateY(-80px) rotate(180deg) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translateY(200px) rotate(360deg) scale(0.5);
    }
}

/* Defeat Symbol */
.defeat-symbol {
    position: fixed;
    font-size: 50px;
    z-index: 1001;
    pointer-events: none;
    animation: defeatSymbolAppear 3.5s ease-out forwards;
}

@keyframes defeatSymbolAppear {
    0% {
        opacity: 0;
        transform: translateY(-30px) scale(0.3);
    }
    30% {
        opacity: 1;
        transform: translateY(10px) scale(1.1);
    }
    60% {
        transform: translateY(0px) scale(1);
    }
    100% {
        opacity: 0.8;
        transform: translateY(20px) scale(0.9);
    }
}

/* Defeat Particles */
.defeat-particle {
    position: fixed;
    font-size: 20px;
    z-index: 1000;
    pointer-events: none;
    animation: defeatParticleFall 2.5s ease-out forwards;
}

@keyframes defeatParticleFall {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    50% {
        opacity: 0.8;
        transform: translateY(60px) scale(0.8);
    }
    100% {
        opacity: 0;
        transform: translateY(150px) scale(0.5);
    }
}

/* Player State Effects */
.player-victory {
    animation: playerVictoryGlow 4s ease-in-out;
    transform: scale(1.05);
}

.player-defeat {
    animation: playerDefeatDarken 3.5s ease-in-out;
    transform: scale(0.95);
}

@keyframes playerVictoryGlow {
    0%, 100% {
        box-shadow: 0 0 0 rgba(255, 215, 0, 0);
        border-color: rgba(255, 215, 0, 0.2);
    }
    25% {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.6);
        border-color: rgba(255, 215, 0, 0.8);
    }
    50% {
        box-shadow: 0 0 50px rgba(255, 215, 0, 0.8);
        border-color: rgba(255, 215, 0, 1);
    }
    75% {
        box-shadow: 0 0 40px rgba(255, 215, 0, 0.7);
        border-color: rgba(255, 215, 0, 0.9);
    }
}

@keyframes playerDefeatDarken {
    0%, 100% {
        filter: brightness(1) saturate(1);
        box-shadow: none;
    }
    50% {
        filter: brightness(0.6) saturate(0.5);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    }
}

/* Game Over Screen */
.game-over-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: overlayAppear 1s ease-out;
    transition: opacity 1s ease;
}

.victory-overlay {
    background: linear-gradient(135deg, 
        rgba(255, 215, 0, 0.9), 
        rgba(255, 165, 0, 0.8), 
        rgba(255, 215, 0, 0.9)
    );
}

.defeat-overlay {
    background: linear-gradient(135deg, 
        rgba(108, 117, 125, 0.9), 
        rgba(73, 80, 87, 0.8), 
        rgba(108, 117, 125, 0.9)
    );
}

.game-over-content {
    text-align: center;
    color: white;
    animation: contentSlideIn 1.2s ease-out;
}

.game-over-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.victory-icon {
    animation: iconBounce 2s infinite;
}

.defeat-icon {
    animation: iconSway 3s infinite;
}

.game-over-title {
    font-size: 48px;
    font-weight: bold;
    margin: 20px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.victory-title {
    color: #FFD700;
    animation: titleGlow 2s infinite alternate;
}

.defeat-title {
    color: #f8f9fa;
}

.game-over-subtitle {
    font-size: 24px;
    margin: 15px 0;
    opacity: 0.9;
}

.game-over-celebration {
    font-size: 32px;
    margin-top: 20px;
    animation: celebrationPulse 1.5s infinite;
}

.game-over-message {
    font-size: 18px;
    margin-top: 20px;
    opacity: 0.8;
    font-style: italic;
}

@keyframes overlayAppear {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes contentSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-50px) scale(0.8);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes iconBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes iconSway {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

@keyframes titleGlow {
    0% { text-shadow: 2px 2px 4px rgba(0,0,0,0.5), 0 0 10px #FFD700; }
    100% { text-shadow: 2px 2px 4px rgba(0,0,0,0.5), 0 0 30px #FFD700; }
}

@keyframes celebrationPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* === GAME MODE SELECTION === */
.game-mode-selector {
    margin-bottom: 25px;
}

.game-mode-selector h3 {
    margin-bottom: 15px;
    color: #FFD700;
    font-size: 18px;
}

.mode-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.mode-btn {
    flex: 1;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.mode-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.mode-btn.active {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-color: #4CAF50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
}

.game-options {
    margin-top: 20px;
}

/* === AI DIFFICULTY SELECTOR === */
.ai-difficulty-selector h4 {
    color: #FFD700;
    margin-bottom: 15px;
    text-align: center;
}

.difficulty-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.difficulty-btn {
    padding: 15px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 14px;
    line-height: 1.3;
}

.difficulty-btn small {
    display: block;
    font-size: 11px;
    opacity: 0.8;
    margin-top: 5px;
}

.difficulty-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.difficulty-btn.active {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    border-color: #2196F3;
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.3);
}

/* Difficulty-specific colors */
.difficulty-btn[data-difficulty="easy"].active {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border-color: #4CAF50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
}

.difficulty-btn[data-difficulty="normal"].active {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    border-color: #2196F3;
    box-shadow: 0 0 15px rgba(33, 150, 243, 0.3);
}

.difficulty-btn[data-difficulty="hard"].active {
    background: linear-gradient(135deg, #ff9800, #f57c00);
    border-color: #ff9800;
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.3);
}

.difficulty-btn[data-difficulty="nightmare"].active {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    border-color: #f44336;
    box-shadow: 0 0 15px rgba(244, 67, 54, 0.3);
}

#startAIButton {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #9c27b0, #7b1fa2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

#startAIButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(156, 39, 176, 0.3);
}

/* === AI PLAYER STYLING === */
.ai-player {
    border-color: rgba(156, 39, 176, 0.3) !important;
    background: rgba(156, 39, 176, 0.05) !important;
}

.ai-player .player-info h2::after {
    content: " 🤖";
    font-size: 0.8em;
}

/* Responsive */
@media (max-width: 600px) {
    .mode-buttons {
        flex-direction: column;
    }
    
    .difficulty-buttons {
        grid-template-columns: 1fr;
    }
}