/* =====================================
   CARD BATTLER GAME - WORKING UI STYLES
   ===================================== */

/* === SCENARIO SELECTION SCREEN === */
.scenario-selection-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 15000;
    color: white;
    padding: 20px;
}

.scenario-selection-screen.hidden {
    display: none !important;
}

.scenario-header {
    text-align: center;
    margin-bottom: 40px;
}

.scenario-header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.scenario-header h2 {
    font-size: 1.5rem;
    color: #ccc;
    margin-bottom: 20px;
}

.scenario-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 20px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.scenario-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border-radius: 12px;
    border: 3px solid;
    background: rgba(255,255,255,0.1);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 150px;
    font-family: Arial, sans-serif;
    backdrop-filter: blur(5px);
    position: relative; /* Enable positioning for win stars */
}

.scenario-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    background: rgba(255,255,255,0.2);
}

.scenario-icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.scenario-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 5px;
    text-align: center;
}

.scenario-subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    text-align: center;
}

/* Scenario color themes */
.scenario-gray {
    border-color: #777;
    background: linear-gradient(135deg, rgba(119,119,119,0.3), rgba(85,85,85,0.3));
}

.scenario-gray:hover {
    border-color: #999;
    background: linear-gradient(135deg, rgba(119,119,119,0.4), rgba(85,85,85,0.4));
}

.scenario-red {
    border-color: #dc3545;
    background: linear-gradient(135deg, rgba(220,53,69,0.3), rgba(176,42,55,0.3));
}

.scenario-red:hover {
    border-color: #f85b69;
    background: linear-gradient(135deg, rgba(220,53,69,0.4), rgba(176,42,55,0.4));
}

.scenario-yellow {
    border-color: #ffc107;
    background: linear-gradient(135deg, rgba(255,193,7,0.3), rgba(212,159,6,0.3));
}

.scenario-yellow:hover {
    border-color: #ffcd39;
    background: linear-gradient(135deg, rgba(255,193,7,0.4), rgba(212,159,6,0.4));
}

.scenario-green {
    border-color: #28a745;
    background: linear-gradient(135deg, rgba(40,167,69,0.3), rgba(32,134,55,0.3));
}

.scenario-green:hover {
    border-color: #34ce57;
    background: linear-gradient(135deg, rgba(40,167,69,0.4), rgba(32,134,55,0.4));
}

.scenario-blue {
    border-color: #007bff;
    background: linear-gradient(135deg, rgba(0,123,255,0.3), rgba(0,98,204,0.3));
}

.scenario-blue:hover {
    border-color: #339aff;
    background: linear-gradient(135deg, rgba(0,123,255,0.4), rgba(0,98,204,0.4));
}

.scenario-purple {
    border-color: #6f42c1;
    background: linear-gradient(135deg, rgba(111,66,193,0.3), rgba(89,53,154,0.3));
}

.scenario-purple:hover {
    border-color: #8a63d2;
    background: linear-gradient(135deg, rgba(111,66,193,0.4), rgba(89,53,154,0.4));
}

/* Scenario interaction states */
.scenario-btn.selected {
    border-width: 4px;
    box-shadow: 0 0 20px rgba(255,255,255,0.5);
}

.scenario-selection-screen.loading {
    pointer-events: none;
}

/* Scenario loading overlay */
.scenario-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 16000;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    font-size: 3rem;
    animation: spin 2s linear infinite;
}

.loading-text {
    margin-top: 10px;
    font-size: 1.2rem;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}


/* Scenario error display */
.scenario-error {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 17000;
}

.error-content {
    background: #dc3545;
    color: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
}

.error-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.error-text {
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.error-close {
    background: rgba(255,255,255,0.2);
    border: 2px solid white;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
}

.error-close:hover {
    background: rgba(255,255,255,0.3);
}

/* Scenario confirmation modal */
.scenario-confirmation-modal {
    z-index: 18000;
}

.scenario-confirmation-content {
    max-width: 500px;
    width: 90%;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 3px solid #444;
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
}

.scenario-confirmation-header {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    text-align: center;
    border-bottom: 2px solid #444;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.confirmation-scenario-icon {
    font-size: 3rem;
    margin-bottom: 5px;
}

.confirmation-scenario-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: #ffd700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.scenario-confirmation-body {
    padding: 25px;
    color: white;
}

.scenario-description {
    font-size: 1.1rem;
    line-height: 1.4;
    margin-bottom: 15px;
    text-align: center;
}

.scenario-details {
    font-size: 0.9rem;
    color: #ccc;
    text-align: center;
    font-style: italic;
}

.scenario-confirmation-actions {
    padding: 20px 25px;
    display: flex;
    gap: 15px;
    justify-content: center;
    border-top: 2px solid #444;
    background: rgba(0,0,0,0.2);
}

.scenario-cancel-btn,
.scenario-confirm-btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

.scenario-cancel-btn {
    background: #555;
    border: 2px solid #777;
    color: white;
}

.scenario-cancel-btn:hover {
    background: #666;
    border-color: #999;
    transform: translateY(-2px);
}

.scenario-confirm-btn {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: 2px solid #45a049;
    color: white;
}

.scenario-confirm-btn:hover {
    background: linear-gradient(135deg, #5CBF60, #4CAF50);
    border-color: #4CAF50;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

/* Card Library Button */
.card-library-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #4CAF50, #45a049);
    border: 2px solid #45a049;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.card-library-btn:hover {
    background: linear-gradient(135deg, #5CBF60, #4CAF50);
    border-color: #4CAF50;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

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

.card-library-content {
    max-width: 90vw;
    max-height: 90vh;
    width: 1200px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 3px solid #444;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-library-header {
    background: rgba(255,255,255,0.1);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #444;
    flex-shrink: 0;
}

.card-library-header h2 {
    color: #ffd700;
    margin: 0;
    font-size: 1.8rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.modal-close-btn {
    background: #555;
    border: 2px solid #777;
    color: white;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close-btn:hover {
    background: #666;
    border-color: #999;
    transform: scale(1.1);
}

.card-library-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: rgba(0,0,0,0.2);
}

.tier-section {
    margin-bottom: 30px;
}

.tier-title {
    color: #ffd700;
    font-size: 1.5rem;
    margin: 0 0 15px 0;
    padding: 10px 15px;
    background: rgba(255,215,0,0.1);
    border-left: 4px solid #ffd700;
    border-radius: 0 8px 8px 0;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    justify-items: center;
}

/* Card library uses standard game-card styling */

/* Scrollbar styling for card library */
.card-library-body::-webkit-scrollbar {
    width: 12px;
}

.card-library-body::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
    border-radius: 6px;
}

.card-library-body::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #444, #666);
    border-radius: 6px;
}

.card-library-body::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #555, #777);
}

/* Multiplayer Coming Soon Section */
.multiplayer-section {
    margin-top: 30px;
    display: flex;
    justify-content: center;
}

.multiplayer-coming-soon-btn {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    border: 2px solid #6c757d;
    border-radius: 15px;
    color: #fff;
    padding: 20px 30px;
    cursor: not-allowed;
    text-align: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    opacity: 0.7;
    min-width: 200px;
}

.multiplayer-coming-soon-btn:hover {
    opacity: 0.8;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.multiplayer-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.multiplayer-title {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 4px;
}

.multiplayer-subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    font-style: italic;
}

/* Reset Progress Button - Corner */
.reset-progress-btn-corner {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #dc3545, #c82333);
    border: 1px solid #dc3545;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    z-index: 16000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.8;
}

.reset-progress-btn-corner:hover {
    background: linear-gradient(135deg, #c82333, #a71e2a);
    border-color: #c82333;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
    opacity: 1;
}

.reset-progress-btn-corner:active {
    transform: scale(1.05);
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: #1a1a2e;
    color: white;
    min-height: 100vh;
    padding: 5px;
}

/* === LOADING INDICATOR === */
.app-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20000;
    color: white;
    font-size: 18px;
    font-weight: bold;
}

.app-loading.hidden {
    display: none !important;
}

/* === LAYOUT === */
.game-container {
    max-width: none;
    margin: 0;
    margin-right: 550px; /* Make room for right-side stacked layout */
    padding-left: 5px;
    position: relative;
}

.game-container.hidden {
    display: none !important;
}

.player-area {
    margin: 5px 0;
    padding: 11px;
    border: 2px solid #444;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
}

/* Removed player-section since we separated the info boxes */

.battlefield-container {
    width: 100%;
    max-width: 900px; /* Increased width to utilize central space better */
}

/* === DECK BUTTON STYLING === */
.btn-deck {
    background: linear-gradient(135deg, #ffd700, #ffb347);
    border: 2px solid #ff8c00;
    color: #1a1a2e;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.4);
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
}

.btn-deck:hover {
    background: linear-gradient(135deg, #ffed4e, #ffd700);
    border-color: #ff6347;
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.6);
}

.btn.btn-deck.btn-deck-inline:hover {
    background: linear-gradient(135deg, #ffed4e, #ffd700);
    border-color: #ff6347;
    transform: none !important;
}

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

/* Inline deck button for info boxes - legacy styles, now moved to hand area */


/* === STACKED RIGHT-SIDE LAYOUT === */
.player-info-box {
    position: fixed;
    width: 330px;
    padding: 10px;
    background: rgba(255,255,255,0.1);
    border: 2px solid #444;
    border-radius: 8px;
    font-size: 12px;
    z-index: 500;
    overflow: visible; /* Allow Dragon Flame display to float */
    box-sizing: border-box;
}

.ai-info {
    top: 10px; /* Moved up 10px from 20px */
    right: 215px;
    height: 80px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.player-info-box.ai-info h3 {
    margin-top: -10px;
}

.ai-info .btn-deck {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translateX(-50%) translateY(5px);
    font-size: 11px;
    padding: 4px 8px;
    width: 60px;
    min-width: 60px;
    background: linear-gradient(135deg, #ffd700, #ffb347);
    border: 2px solid #ff8c00;
    color: #1a1a2e;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.4);
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
}

.ai-info .btn-deck:hover {
    transform: translateX(-50%) translateY(5px) scale(1.05);
    background: linear-gradient(135deg, #ffed4e, #ffd700);
    border-color: #ff6347;
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.6);
}

.player-info {
    bottom: 275px; /* Adjusted positioning */
    right: 215px;
    height: 100px; /* Increased height for End Turn button */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* === GAME LOG - GREEN BOX (MIDDLE RIGHT) === */
.game-log-display {
    position: fixed;
    top: 97px; /* Fine-tuned positioning */
    right: 215px;
    width: 330px;
    height: 215px; /* Increased height by 15px for more log entries */
    background: rgba(0, 30, 0, 0.9); /* Slightly green tint */
    border: 2px solid rgba(100, 255, 150, 0.4);
    border-radius: 10px;
    padding: 12px;
    backdrop-filter: blur(8px);
    z-index: 500;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.game-log-header {
    color: #4ecdc4;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 8px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 6px;
}

.game-log-content {
    flex: 1;
    overflow-y: auto;
    font-size: 12px;
    line-height: 1.4;
}

.game-log-entry {
    padding: 4px 8px;
    margin: 2px 0;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    border-left: 2px solid rgba(74, 144, 226, 0.5);
}

/* Specific styling for different log entry types */
.game-log-spell {
    border-left-color: rgba(138, 43, 226, 0.8); /* Purple border for spells */
    background: rgba(138, 43, 226, 0.1); /* Light purple background */
}

.game-log-combat {
    border-left-color: rgba(220, 20, 60, 0.8); /* Red border for combat */
    background: rgba(220, 20, 60, 0.1); /* Light red background */
}

.game-log-ability {
    border-left-color: rgba(255, 215, 0, 0.8); /* Gold border for abilities */
    background: rgba(255, 215, 0, 0.1); /* Light gold background */
}

.player-info-box h3 {
    margin: 0;
    font-size: 14px;
    color: #4ecdc4;
    text-align: center;
    line-height: 1.2;
    transform: translateY(15px);
}

.health {
    font-size: 38px;
    font-weight: bold;
    color: #ff6b6b;
    margin: 5px 0;
    background: none;
    border: none;
    padding: 0;
}

.gold {
    font-size: 18px;
    color: #ffd93d;
    margin: 5px 0;
}

.player-stats {
    font-size: 14px;
    color: #ccc;
    margin: 5px 0;
}

.player-stats-compact {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0;
}

.player-stats-compact .health {
    flex-shrink: 0;
}

.player-stats-compact .gold {
    flex-shrink: 0;
}

.player-stats-compact .health {
    font-size: 28px;
    font-weight: bold;
    color: #2563eb;
    margin: -25px 0 0 0;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: transparent;
    border: 2px solid #2563eb;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.4);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    width: 100px !important;
    justify-content: center;
}

.player-stats-compact .gold {
    font-size: 28px;
    font-weight: bold;
    color: #ffd700;
    margin: -25px 0 0 0;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: transparent;
    border: 2px solid #ffd700;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.4);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    flex-shrink: 0;
    width: 100px !important;
    justify-content: center;
    padding-left: 7px;
    padding-right: 13px;
}

.player-stats-compact .cards-info {
    font-size: 11px;
    color: #ccc;
    margin: 0;
    white-space: nowrap;
}

/* === DRAGON FLAME DISPLAY === */
.dragon-flame-display {
    position: absolute;
    top: 2px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 5px;
    background: linear-gradient(135deg, #8b4513, #ff6b35);
    border: 2px solid #d2691e;
    border-radius: 6px;
    color: #ffffff;
    font-weight: bold;
    font-size: 11px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 2px 4px rgba(139, 69, 19, 0.3);
    z-index: 10;
}

.dragon-flame-icon {
    font-size: 12px;
    filter: drop-shadow(0 0 2px rgba(255, 107, 53, 0.5));
}

/* Dragon Flame display when positioned in battlefield */
.battlefield-dragon-flame {
    position: absolute;
    top: 0;
    right: -40px;
    z-index: 150;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    background: transparent;
    border: 2px solid #ff6b35;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
    font-weight: bold;
}

.battlefield-dragon-flame .dragon-flame-icon {
    font-size: 18px;
    filter: drop-shadow(0 0 4px rgba(255, 107, 53, 0.8));
}

.battlefield-dragon-flame .dragon-flame-count {
    font-size: 20px;
    color: #ff6b35;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    min-width: 25px;
    text-align: center;
}

/* === SOULS DISPLAY (positioned in battlefield) === */
.battlefield-souls {
    position: absolute;
    top: 45px; /* Just below Dragon Flame indicator */
    right: -40px;
    z-index: 150;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 8px;
    background: transparent;
    border: 2px solid #9b59b6;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(155, 89, 182, 0.4);
    font-weight: bold;
}

.battlefield-souls .souls-icon {
    font-size: 18px;
    filter: drop-shadow(0 0 4px rgba(155, 89, 182, 0.8));
}

.battlefield-souls .souls-count {
    font-size: 20px;
    color: #9b59b6;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    min-width: 25px;
    text-align: center;
}

/* Turn indicator when positioned in battlefield */
.battlefield-turn {
    position: absolute;
    bottom: 0;
    right: -40px;
    z-index: 150;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: transparent;
    border: 2px solid #ff6b35;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
    width: 40px;
    height: 40px;
    transition: opacity 0.3s ease;
    opacity: 0.3;
}

.battlefield-turn.active {
    opacity: 1;
    border-color: #00ff00;
    box-shadow: 0 2px 8px rgba(0, 255, 0, 0.3);
}

.battlefield-turn .turn-icon {
    font-size: 20px;
    color: #ffffff;
}

.dragon-flame-count {
    min-width: 12px;
    text-align: center;
    font-size: 11px;
}

/* Dragon Flame gain animation */
@keyframes dragonFlameGain {
    0% { 
        transform: scale(1); 
    }
    50% { 
        transform: scale(1.3); 
        filter: brightness(1.5);
        box-shadow: 0 0 20px #ff6b35;
    }
    100% { 
        transform: scale(1); 
    }
}

.dragon-flame-display.gaining {
    animation: dragonFlameGain 0.6s ease-out;
    transform-origin: center center;
    will-change: transform;
}

/* Souls gain animation */
@keyframes soulsGain {
    0% { 
        transform: scale(1); 
    }
    50% { 
        transform: scale(1.3); 
        filter: brightness(1.5);
        box-shadow: 0 0 20px #9333ea;
    }
    100% { 
        transform: scale(1); 
    }
}

.souls-display.gaining {
    animation: soulsGain 0.6s ease-out;
    transform-origin: center center;
    will-change: transform;
}

/* Floating resource indicators */
.floating-indicator {
    position: fixed;
    pointer-events: none;
    z-index: 10000;
    font-weight: bold;
    font-size: 16px;
    animation: floatUp 1.5s ease-out forwards;
}

.dragon-flame-indicator {
    color: #ff6b35;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(255, 107, 53, 0.5);
}

.souls-indicator {
    color: #9333ea;
    text-shadow: 
        2px 2px 4px rgba(0, 0, 0, 0.8),
        0 0 10px rgba(147, 51, 234, 0.5);
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) translateX(-50%);
    }
    100% {
        opacity: 0;
        transform: translateY(-40px) translateX(-50%);
    }
}

/* === BATTLEFIELD === */
.battlefield {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px 25px; /* Maintain horizontal spacing, reduce vertical */
    row-gap: 12px; /* Smaller vertical gap */
    margin: 8px 0; /* Reduced vertical margins */
    padding-right: 40px; /* Extra space for buff indicators */
    position: relative; /* For positioning Dragon Flame display */
}

/* AI Player Area - Soft red theme (first player-area) */
.player-area:first-child {
    background: rgba(220, 38, 38, 0.15) !important;
}

/* Player Area - Soft green theme (third child because of info box) */
.player-area:nth-child(3) {
    background: rgba(34, 197, 94, 0.15) !important;
}

.battlefield-row {
    display: contents;
}

.slot-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 45px; /* Increased spacing for buff indicators */
}

.slot {
    width: 175px; /* Increased back to larger size */
    height: 125px; /* Reduced height to save vertical space */
    border: 2px dashed #666;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.02);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.slot.valid-drop {
    border-color: #4ecdc4;
    background: rgba(78, 205, 196, 0.2);
}

.slot.drag-over {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.3);
    border-style: solid;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    transform: scale(1.02);
}

.slot.front-row {
    border-color: #ff6b6b;
}

.slot.back-row {
    border-color: #4ecdc4;
}

.slot-buff {
    position: absolute;
    top: 50%;
    right: -30px;
    transform: translateY(-50%);
    background: rgba(74, 144, 226, 0.9);
    color: white;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 9px;
    font-weight: bold;
    min-width: 18px;
    text-align: center;
    border: 1px solid rgba(74, 144, 226, 1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    display: none; /* Hidden by default */
    white-space: nowrap;
    z-index: 5;
}

.slot-buff.active {
    display: block;
}

.slot-buff.attack-buff {
    background: rgba(220, 38, 38, 0.9);
    border-color: #dc2626;
}

.slot-buff.health-buff {
    background: rgba(22, 163, 74, 0.9);
    border-color: #16a34a;
}

.slot-buff.mixed-buff {
    background: rgba(147, 51, 234, 0.9);
    border-color: #9333ea;
}

/* === UNIT CARDS === */
.unit-card {
    width: 110px;
    height: 70px;
    border-radius: 6px;
    border: 2px solid;
    background: linear-gradient(145deg, #f0f0f0, #e0e0e0);
    color: #333;
    font-size: 10px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
}

.unit-card:hover {
    transform: scale(1.05);
    z-index: 10;
}

.unit-card.can-attack {
    box-shadow: 0 0 15px #00ff00, 0 0 25px #00ff00;
    border-color: #00ff00 !important;
}

.unit-card.red { border-color: #dc2626; }
.unit-card.green { border-color: #16a34a; }
.unit-card.blue { border-color: #2563eb; }
.unit-card.yellow { border-color: #eab308; }
.unit-card.purple { border-color: #9333ea; }

.unit-header {
    padding: 2px 4px;
    color: white;
    font-size: 9px;
    font-weight: bold;
    text-align: center;
}

.unit-card.red .unit-header { background: #dc2626; }
.unit-card.green .unit-header { background: #16a34a; }
.unit-card.blue .unit-header { background: #2563eb; }
.unit-card.yellow .unit-header { background: #eab308; }
.unit-card.purple .unit-header { background: #9333ea; }

/* Old absolute positioning - now using flexbox in .game-card
.unit-stats {
    position: absolute;
    bottom: 2px;
    left: 4px;
    right: 4px;
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 14px;
    align-items: center;
}
*/

.attack, .unit-attack { 
    color: #dc2626;
    background: rgba(220, 38, 38, 0.15);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(220, 38, 38, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-weight: bold;
    font-size: 14px;
}

.attack::before, .unit-attack::before {
    content: "⚔️";
    font-size: 12px;
}

.health, .unit-health { 
    color: #16a34a;
    background: rgba(22, 163, 74, 0.15);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(22, 163, 74, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-weight: bold;
    font-size: 14px;
}

/* Removed ::before content to prevent duplicate heart icons in health displays */

.unit-health.damaged {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.15);
    border-color: rgba(220, 38, 38, 0.4);
}

.unit-attack.can-attack {
    color: #16a34a;
    background: rgba(22, 163, 74, 0.25);
    border-color: rgba(22, 163, 74, 0.5);
    box-shadow: 0 0 5px rgba(22, 163, 74, 0.3);
}

/* === UNIFIED CARD SYSTEM === */
.game-card {
    border-radius: 8px;
    border: 2px solid;
    background: linear-gradient(145deg, #f8f8f8, #e8e8e8);
    color: #333;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    padding: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* Override game-card transitions for draft cards */
.game-card.draft-card {
    transition: background 0.2s ease;
}

.game-card .card-header {
    background: linear-gradient(135deg, rgba(0,0,0,0.8), rgba(0,0,0,0.6));
    color: white;
    padding: 3px 6px;
    text-align: center;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.game-card .card-name {
    font-weight: bold;
    font-size: 16px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    padding-top: 2px; /* Align with tier indicator */
    line-height: 20px; /* Match tier indicator height for vertical alignment */
}

.game-card .card-ability {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    margin: 4px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    text-align: center;
    font-style: italic;
    color: #444;
    font-size: 10px;
    line-height: 1.3;
    min-height: 30px;
}

/* Stats container for all cards */
.game-card .card-stats {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 6px;
    background: rgba(0, 0, 0, 0.05);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.game-card .stat-attack,
.game-card .stat-health {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.game-card .stat-attack {
    background: rgba(220, 38, 38, 0.15);
    color: #dc2626;
}

.game-card .stat-health {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

/* CORNER STATS LAYOUT - For all card types */
.game-card--battlefield,
.game-card--hand,
.game-card--draft {
    position: relative;
}

.game-card--battlefield .card-stats,
.game-card--hand .card-stats,
.game-card--draft .card-stats {
    display: block;
    padding: 0;
    background: none;
    border: none;
    position: static;
}

.game-card--battlefield .stat-attack,
.game-card--battlefield .stat-health,
.game-card--hand .stat-attack,
.game-card--hand .stat-health,
.game-card--draft .stat-attack,
.game-card--draft .stat-health {
    position: absolute;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    gap: 0;
    font-weight: bold;
    z-index: 10;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
    background: none;
}

/* Battlefield card stats */
.game-card--battlefield .stat-attack,
.game-card--battlefield .stat-health {
    width: 34px;
    height: 34px;
}

.game-card--battlefield .stat-attack {
    bottom: 3px;
    left: 3px;
    background: linear-gradient(135deg, #f87171, #dc2626);
    color: white;
    border: 2px solid #991b1b;
}

.game-card--battlefield .stat-health {
    bottom: 3px;
    right: 3px;
    background: linear-gradient(135deg, #4ade80, #16a34a);
    color: white;
    border: 2px solid #166534;
}

/* Hand card stats - slightly smaller */
.game-card--hand .stat-attack,
.game-card--hand .stat-health {
    width: 30px;
    height: 30px;
}

.game-card--hand .stat-attack {
    bottom: 3px;
    left: 3px;
    background: linear-gradient(135deg, #f87171, #dc2626);
    color: white;
    border: 2px solid #991b1b;
}

.game-card--hand .stat-health {
    bottom: 3px;
    right: 3px;
    background: linear-gradient(135deg, #4ade80, #16a34a);
    color: white;
    border: 2px solid #166534;
}

/* Draft card stats - larger for visibility */
.game-card--draft .stat-attack,
.game-card--draft .stat-health {
    width: 40px;
    height: 40px;
}

.game-card--draft .stat-attack {
    bottom: 5px;
    left: 5px;
    background: linear-gradient(135deg, #f87171, #dc2626);
    color: white;
    border: 2px solid #991b1b;
}

.game-card--draft .stat-health {
    bottom: 5px;
    right: 5px;
    background: linear-gradient(135deg, #4ade80, #16a34a);
    color: white;
    border: 2px solid #166534;
}

/* Damaged health indicator */
.game-card--battlefield .stat-health.damaged,
.game-card--hand .stat-health.damaged,
.game-card--draft .stat-health.damaged {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-color: #92400e;
}

.game-card .stat-icon {
    font-size: 12px;
}

.game-card .stat-value {
    font-size: 14px;
}

.game-card .card-tags {
    text-align: center;
    padding: 4px;
    background: rgba(0, 0, 0, 0.08);
    min-height: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.game-card .tag {
    display: inline-block;
    background: rgba(70, 130, 180, 0.2);
    color: #2c5282;
    padding: 2px 6px;
    margin: 0 2px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
    border: 1px solid rgba(70, 130, 180, 0.3);
}

/* Card size variants */
.game-card--battlefield {
    width: 165px; /* Slightly wider for better text readability */
    height: 140px;
    position: relative;
}

.game-card--battlefield .card-header {
    padding: 2px 5px;
}

.game-card--battlefield .card-name {
    font-size: 13px;
}

.game-card--battlefield .card-ability {
    font-size: 11px;
    padding: 6px 8px;
    min-height: 35px;
    margin: 2px 4px 39px 4px; /* Bottom margin for stat circles only */
    line-height: 1.3;
}

/* Ensure battlefield card tags are visible */
.game-card--battlefield .card-tags {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    min-height: 14px;
    padding: 2px 4px;
    position: absolute;
    bottom: 5px; /* At the very bottom */
    left: 39px; /* Start after the attack circle (34px + 5px margin) */
    right: 39px; /* End before the health circle (34px + 5px margin) */
    text-align: center;
}

.game-card--battlefield .tag {
    background: rgba(70, 130, 180, 0.3);
    border: 1px solid rgba(70, 130, 180, 0.5);
    color: #1e3a5f;
    font-weight: 600;
    font-size: 9px;
}

/* Ensure hand card tags are visible */
.game-card--hand .card-tags {
    background: rgba(0, 0, 0, 0.12);
    border-radius: 8px;
    min-height: 14px;
    padding: 2px 4px;
    position: absolute;
    bottom: 5px; /* At the very bottom */
    left: 35px; /* Start after the attack circle */
    right: 35px; /* End before the health circle */
    text-align: center;
}

.game-card--hand .tag {
    background: rgba(70, 130, 180, 0.3);
    border: 1px solid rgba(70, 130, 180, 0.5);
    color: #1e3a5f;
    font-weight: 600;
    font-size: 8px;
    margin: 1px;
}

/* Hide icons for all corner stat cards */
.game-card--battlefield .stat-icon,
.game-card--hand .stat-icon,
.game-card--draft .stat-icon {
    display: none;
}

/* Stat values for each card type */
.game-card--battlefield .stat-value {
    font-size: 18px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1;
}

.game-card--hand .stat-value {
    font-size: 16px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1;
}

.game-card--draft .stat-value {
    font-size: 20px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    line-height: 1;
}

.game-card--hand {
    width: 150px;
    height: 120px;
    min-width: 150px;
    flex-shrink: 0;
}

.game-card--hand .card-header {
    padding: 2px 5px;
}

.game-card--hand .card-name {
    font-size: 13px;
}

.game-card--hand .card-ability {
    font-size: 10px;
    padding: 6px 8px;
    min-height: 30px;
    margin: 2px 4px 34px 4px; /* Bottom margin for stat circles only */
    line-height: 1.3;
}

.game-card--hand .stat-icon {
    font-size: 10px;
}

.game-card--hand .stat-value {
    font-size: 12px;
}

.game-card--draft {
    width: 160px;
    height: 220px;
    border-width: 3px;
}

.game-card--draft .card-header {
    padding: 4px 6px;
}

.game-card--draft .card-name {
    font-size: 15px;
}

.game-card--draft .card-ability {
    font-size: 12px;
    padding: 10px 12px;
    min-height: 80px;
    margin: 4px 6px 48px 6px; /* Bottom margin for stat circles */
    line-height: 1.4;
}

.game-card--draft .stat-icon {
    font-size: 14px;
}

.game-card--draft .stat-value {
    font-size: 16px;
}

.game-card--draft .card-tags {
    padding: 6px;
}

/* Color variations */
.game-card.red .card-header {
    background: linear-gradient(135deg, #dc2626, #991b1b);
}

.game-card.blue .card-header {
    background: linear-gradient(135deg, #2563eb, #1e40af);
}

.game-card.green .card-header {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.game-card.yellow .card-header {
    background: linear-gradient(135deg, #eab308, #ca8a04);
}

.game-card.purple .card-header {
    background: linear-gradient(135deg, #9333ea, #7c3aed);
}

.game-card.neutral .card-header {
    background: linear-gradient(135deg, #6b7280, #4b5563);
}

/* Special states */
.game-card.selected {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
    transform: translateY(-5px);
}

/* Attack animation for units */
.game-card.attacking {
    animation: attackPulse 0.8s ease-in-out;
    z-index: 1000;
}

@keyframes attackPulse {
    0% {
        transform: scale(1) translateX(0);
    }
    25% {
        transform: scale(1.05) translateX(10px);
        box-shadow: 0 0 20px rgba(255, 0, 0, 0.6);
    }
    50% {
        transform: scale(1.1) translateX(5px);
        box-shadow: 0 0 25px rgba(255, 0, 0, 0.8);
    }
    75% {
        transform: scale(1.05) translateX(-5px);
        box-shadow: 0 0 15px rgba(255, 0, 0, 0.4);
    }
    100% {
        transform: scale(1) translateX(0);
        box-shadow: none;
    }
}

/* Different animation speeds for different abilities */
.game-card.attacking.quick-strike {
    animation-duration: 0.4s;
}

.game-card.attacking.slow {
    animation-duration: 1.2s;
}

.game-card .stat-health.damaged {
    color: #dc2626;
    background: rgba(220, 38, 38, 0.2);
}

/* Removed distracting pulse animation from attack numbers - card border glow is sufficient */

/* Removed pulse-attack keyframe animation - no longer needed */

/* Attack indicator for battlefield units */
.game-card .attack-indicator {
    position: absolute;
    top: 5px;
    right: 2px;
    font-size: 14px;
    animation: bounce 2s infinite;
}

/* Tier indicator for cards */
.tier-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 11px;
    font-weight: bold;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding-top: 1px;
}

.crown-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #8B4513;
    font-size: 12px;
    font-weight: bold;
    border-radius: 50%;
    border: 1px solid rgba(255, 215, 0, 0.8);
    z-index: 5;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* === IN-PLAY UNIT CARDS === */
.unit {
    width: 165px; /* Wider for better text readability */
    height: 115px;
    border-radius: 8px;
    border: 2px solid;
    background: linear-gradient(145deg, #f8f8f8, #e8e8e8);
    color: #333;
    font-size: 10px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    padding: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.unit:hover {
    transform: scale(1.02);
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.unit.can-attack {
    box-shadow: 0 0 15px #00ff00, 0 0 25px #00ff00;
    border-color: #00ff00 !important;
}

.unit.red { border-color: #dc2626; }
.unit.green { border-color: #16a34a; }
.unit.blue { border-color: #2563eb; }
.unit.yellow { border-color: #eab308; }
.unit.purple { border-color: #9333ea; }

.unit .unit-header {
    background: inherit;
    padding: 4px 6px;
    color: white;
    font-size: 9px;
    font-weight: bold;
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.unit.red .unit-header { background: #dc2626; }
.unit.green .unit-header { background: #16a34a; }
.unit.blue .unit-header { background: #2563eb; }
.unit.yellow .unit-header { background: #eab308; }
.unit.purple .unit-header { background: #9333ea; }

.unit .unit-name {
    flex: 1;
    font-size: 14px;
    font-weight: bold;
}

.unit .unit-ability {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    line-height: 1.2;
    margin: 6px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 3px;
    text-align: center;
    font-style: italic;
    color: #444;
}

.unit .unit-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    margin: 0 4px;
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
}

.unit .unit-tags {
    text-align: center;
    padding: 3px 6px;
    font-size: 9px;
    background: rgba(0, 0, 0, 0.05);
    color: #666;
    font-weight: 500;
    line-height: 1;
    margin: 0 4px 4px 4px;
}

.unit .unit-tags .tag {
    margin: 0 1px;
}

.attack-indicator {
    position: absolute;
    top: -2px;
    right: -5px;
    background: rgba(0, 255, 0, 0.9);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    animation: pulse 1.5s infinite;
    box-shadow: 0 0 5px rgba(0, 255, 0, 0.5);
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 1;
    }
    50% { 
        transform: scale(1.1); 
        opacity: 0.8;
    }
}

/* Old absolute positioning - now using flexbox in .game-card
.unit-ability {
    position: absolute;
    top: 18px;
    left: 4px;
    right: 4px;
    font-size: 8px;
    text-align: center;
}
*/

/* === END TURN BUTTON STYLING === */
#endTurnBtn {
    background: linear-gradient(135deg, #dc2626, #b91c1c) !important;
    border-color: #991b1b !important;
    color: white !important;
    font-weight: bold !important;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3) !important;
    transition: all 0.2s ease !important;
    padding: 6px 12px !important;
    font-size: 11px !important;
    border-radius: 4px !important;
    width: 100% !important;
    margin: 0 !important;
}

#endTurnBtn:hover:not(:disabled) {
    background: linear-gradient(135deg, #b91c1c, #991b1b) !important;
    box-shadow: 0 4px 8px rgba(220, 38, 38, 0.4) !important;
    transform: translateY(-1px) !important;
}

#endTurnBtn:active:not(:disabled) {
    transform: translateY(0) !important;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.3) !important;
}

#endTurnBtn:disabled {
    background: linear-gradient(135deg, #6b7280, #4b5563) !important;
    border-color: #374151 !important;
    color: #9ca3af !important;
    transform: none !important;
}

/* === HAND CARDS - EXTENDED BOTTOM RIGHT === */
.hand-cards-horizontal {
    position: fixed;
    bottom: 72px; /* Moved up for final positioning */
    right: 10px; /* Extend to screen edge */
    left: calc(100% - 550px); /* Start from appropriate left position */
    height: 198px; /* Reduced height for better proportions */
    display: flex;
    flex-direction: column;
    padding: 15px;
    background: rgba(0, 0, 30, 0.9);
    border-radius: 10px;
    border: 2px solid rgba(100, 150, 255, 0.4);
    backdrop-filter: blur(8px);
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    /* Always visible - removed :empty display: none */
}

.hand-header {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    margin-bottom: 16px; /* Increased from 11px to 16px = 5px more space = buttons move up further */
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
    min-height: 32px;
    width: 100%;
}


.btn-deck-hand {
    padding: 3px 8px;
    font-size: 11px;
    border-radius: 4px;
    background: linear-gradient(135deg, #ffd700, #ffb347);
    border: 2px solid #ff8c00;
    color: #1a1a2e;
    white-space: nowrap;
    font-weight: bold;
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.4);
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3);
}

.btn-deck-hand:hover {
    background: linear-gradient(135deg, #ffed4e, #ffd700);
    border-color: #ff6347;
    transform: scale(1.05);
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.6);
}

/* Hand Header Buttons - Equally Spaced Design */
.hand-header .btn {
    padding: 5px 10px;
    font-size: 11px;
    border-radius: 5px;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex: 1;
    max-width: 140px;
    text-align: center;
    margin-top: -5px; /* Move buttons up 5px while keeping gray line in place */
}

.hand-header .btn-deck-hand {
    background: linear-gradient(135deg, #ffd700, #ffb347);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #8b4513;
    font-weight: 600;
}

.hand-header .btn-deck-hand:hover {
    background: linear-gradient(135deg, #ffed4e, #ffd700);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.6);
}

.hand-header .btn-secondary {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
}

.hand-header .btn-secondary:hover {
    background: linear-gradient(135deg, #7c3aed, #6366f1);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.4);
}

.hand-header .btn-deck-draw {
    background: linear-gradient(135deg, #8b5a3c, #6d4c32);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-weight: 600;
}

.hand-header .btn-deck-draw:hover {
    background: linear-gradient(135deg, #a0673f, #8b5a3c);
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(139, 90, 60, 0.4);
}

.hand-cards-container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 7px;
    justify-content: space-evenly;
    align-items: center;
    flex: 1;
    min-height: 120px; /* Ensure space for cards even when empty */
    margin-left: -8px; /* Shift cards 8px to the left to prevent overflow */
}

/* Removed :empty hiding - hand area now always visible */

.hand-card {
    width: 170px; /* Wider for better text readability */
    height: 130px; /* Taller to use available vertical space */
    min-width: 170px;
    flex-shrink: 0;
    border-radius: 10px;
    border: 2px solid;
    background: linear-gradient(145deg, #f8f8f8, #e8e8e8);
    color: #333;
    font-size: 11px;
    cursor: grab;
    transition: all 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 0;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.hand-card.red { border-color: #dc2626; }
.hand-card.green { border-color: #16a34a; }
.hand-card.blue { border-color: #2563eb; }
.hand-card.yellow { border-color: #eab308; }
.hand-card.purple { border-color: #9333ea; }

.hand-card .unit-header {
    padding: 5px 8px;
    color: white;
    font-size: 10px;
    font-weight: bold;
    text-align: center;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hand-card .unit-name {
    flex: 1;
    font-size: 11px;
    font-weight: bold;
}

.hand-card .unit-ability {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    line-height: 1.3;
    margin: 5px;
    padding: 5px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 4px;
    text-align: center;
    font-style: italic;
    color: #444;
}

.hand-card .unit-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    margin: 0 4px;
}

.hand-card .unit-tags {
    text-align: center;
    padding: 3px;
    font-size: 8px;
    background: rgba(0, 0, 0, 0.05);
    color: #666;
    font-weight: 500;
    line-height: 1;
    margin: 0 3px 3px 3px;
}

.hand-card .unit-tags .tag {
    margin: 0 1px;
}

.hand-card.red .unit-header { background: #dc2626; }
.hand-card.green .unit-header { background: #16a34a; }
.hand-card.blue .unit-header { background: #2563eb; }
.hand-card.yellow .unit-header { background: #eab308; }
.hand-card.purple .unit-header { background: #9333ea; }

.hand-card:hover {
    transform: translateY(-8px) scale(1.08);
    z-index: 1001;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.hand-card.dragging {
    opacity: 0.7;
    transform: rotate(5deg);
}

/* === BUTTONS === */
.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    margin: 2px 0;
    width: 100%;
    text-align: center;
    display: block;
    font-size: 13px;
}

.btn:hover {
    transform: translateY(-2px);
}

/* Override general btn hover for draft tier buttons */
.fixed-controls .btn-primary:hover:not(:disabled) {
    transform: none;
}

/* Enhanced Draft Button Styling - Dark Blue Theme - RECREATED FROM SCRATCH */
.btn-primary {
    /* Base structure - exact measurements preserved */
    background: linear-gradient(135deg, #1e3a8a, #1e40af);
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.2);
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 8px rgba(30, 58, 138, 0.4);
    position: relative;
    overflow: hidden;
    
    /* Clean transition only for background and border */
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
    /* Clean hover - only background and border change */
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-color: rgba(147, 197, 253, 0.3);
    /* Remove all transform and box-shadow changes that cause weird effects */
}

.btn-primary:disabled {
    background: linear-gradient(135deg, #4a5568, #2d3748);
    box-shadow: none;
    color: #718096;
    border-color: rgba(255, 255, 255, 0.1);
    cursor: not-allowed;
}

.btn-primary:disabled::before,
.btn-primary:disabled::after {
    display: none;
}

/* Special state indicators */
.btn-primary[data-status="no-gold"]::after {
    content: "💰";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    opacity: 0.3;
    pointer-events: none;
}

.btn-primary[data-status="hand-full"]::after {
    content: "🚫";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    opacity: 0.4;
    pointer-events: none;
}

.btn-primary[data-status="no-cards"] {
    background: linear-gradient(135deg, #7c2d12, #991b1b);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-primary[data-status="no-cards"]::after {
    content: "∅";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    color: rgba(255, 255, 255, 0.5);
    pointer-events: none;
}

.btn-secondary {
    background: #666;
    color: white;
}

.btn-deck-draw {
    background: #8b5a3c;
    color: white;
}

/* How to Play button - matches deck button style */
#howToPlayBtnSidebar {
    background: linear-gradient(135deg, #ffd700, #ffb347) !important;
    color: #1a1a2e !important;
    border: 2px solid #ff8c00 !important;
    box-shadow: 0 2px 6px rgba(255, 215, 0, 0.4) !important;
    font-weight: bold !important;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.3) !important;
}

#howToPlayBtnSidebar:hover {
    background: linear-gradient(135deg, #ffed4e, #ffd700) !important;
    border-color: #ff6347 !important;
    box-shadow: 0 4px 10px rgba(255, 215, 0, 0.6) !important;
    transform: translateY(-2px) !important;
}

/* Draw from Deck button - brown color to differentiate from draft buttons */
#drawDeckBtn:not(:disabled) {
    background: #8b5a3c;
    color: white;
}

#drawDeckBtn:not(:disabled):hover {
    background: #a06b47;
    box-shadow: 0 4px 12px rgba(139, 90, 60, 0.3);
}

.btn:disabled {
    background: #333;
    color: #666;
    cursor: not-allowed;
    transform: none;
}

/* Enhanced Remaining Count Badge */
.remaining-count {
    position: absolute;
    top: -3px;
    right: -6px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: 2px solid #ffffff;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 10;
}

/* Low stock warning */
.remaining-count.low-stock {
    background: linear-gradient(135deg, #dc2626, #991b1b);
    border-color: #fecaca;
    animation: pulse-warning 1s infinite ease-in-out;
}

@keyframes pulse-warning {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
    50% { 
        transform: scale(1.15);
        box-shadow: 0 4px 12px rgba(220, 38, 38, 0.6);
    }
}

/* Enhanced Draft Button Layout & Typography - EXACT MEASUREMENTS PRESERVED */
.control-section .btn-primary {
    position: relative;
    margin-bottom: 6px;
    width: 100%;
    padding: 11px 12px;  /* EXACT: 11px top/bottom, 12px left/right */
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 18px;     /* EXACT: 18px font size */
    line-height: 1.2;
}

.control-section .btn-primary .tier-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0;
}

.control-section .btn-primary .tier-name {
    font-size: 16px;    /* EXACT: 16px tier name font size */
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0px;
}

/* GOLD COST STYLING - NEON GLOW REMOVED */
.control-section .btn-primary .tier-cost.gold-cost {
    font-size: 14px !important;
    font-weight: bold !important;
    color: #ffd700 !important;
    background: rgba(255, 215, 0, 0.15) !important;
    border: 1px solid #ffd700 !important;
    border-radius: 4px !important;
    padding: 2px 6px !important;
    /* NEON GLOW EFFECTS REMOVED */
    box-shadow: none !important;
    text-shadow: none !important;
    white-space: nowrap !important;
    display: inline-block !important;
    margin-top: 0px !important;
    margin-left: 8px !important;
}

/* Ensure no other tier-cost rules override this */
.control-section .btn-primary .tier-cost {
    font-size: 14px;
    font-weight: bold;
    color: #ffd700;
    background: rgba(255, 215, 0, 0.15);
    border: 1px solid #ffd700;
    border-radius: 4px;
    padding: 2px 6px;
    /* NEON GLOW EFFECTS REMOVED */
    box-shadow: none;
    text-shadow: none;
    white-space: nowrap;
    display: inline-block;
    margin-top: 0px;
    margin-left: 8px;
}

/* === FIXED CONTROLS - SIDEBAR === */
.fixed-controls {
    position: fixed;
    top: 10px;
    right: 10px;
    bottom: 275px; /* Stop above hand area, aligned with player info */
    width: 200px;
    background: rgba(0, 0, 0, 0.85);
    padding: 15px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    overflow-y: hidden;
}

.control-section {
    margin-bottom: 15px;
}

/* Enhanced Control Section Headers */
.control-section h4 {
    margin-bottom: 12px;
    color: #4ecdc4;
    font-size: 15px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid #4ecdc4;
    padding-bottom: 8px;
    text-shadow: 0 0 6px rgba(78, 205, 196, 0.4);
    position: relative;
}

.control-section h4::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 30%;
    height: 2px;
    background: linear-gradient(90deg, #4ecdc4, transparent);
    box-shadow: 0 0 4px rgba(78, 205, 196, 0.6);
}

/* === MODALS === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

/* Draft overlay specific positioning */
#draftOverlay.modal-overlay {
    background: rgba(0, 0, 0, 0.5); /* Less dark so battlefield is more visible */
    justify-content: flex-end; /* Align to right side */
    padding-right: 200px; /* Move 150px more to the left (was 50px, now 200px) */
}

.modal-overlay.active {
    display: flex !important;
}

.modal-content {
    background: linear-gradient(145deg, #2c2c2c, #1a1a1a);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideInFromTop 0.4s ease-out;
}

/* Draft modal specific content styling */
#draftOverlay .modal-content {
    width: 420px;
    max-width: 420px;
    height: auto;
    max-height: 92vh;
    padding: 25px;
    animation: slideInFromRight 0.4s ease-out;
}

.modal-header {
    text-align: center;
    margin-bottom: 25px;
}

.modal-header h2 {
    color: #ffd700;
    font-size: 24px;
    margin-bottom: 10px;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: #ccc;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

/* === DRAFT MODAL === */
.draft-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    justify-items: center;
    margin: 18px 0 15px 0;
}

/* Center the third card below the first two */
.draft-options .draft-card:nth-child(3) {
    grid-column: 1 / -1;
    justify-self: center;
}

.draft-card {
    width: 170px;
    height: 220px;
    border-radius: 8px;
    border: 3px solid;
    background: linear-gradient(145deg, #f8f8f8, #e8e8e8);
    color: #333;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    position: relative;
    padding: 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.draft-card:hover {
    background: linear-gradient(145deg, #ffffff, #f0f0f0);
}

.draft-card.red { border-color: #dc2626; }
.draft-card.green { border-color: #16a34a; }
.draft-card.blue { border-color: #2563eb; }
.draft-card.yellow { border-color: #eab308; }
.draft-card.purple { border-color: #9333ea; }

.draft-card .unit-header {
    background: inherit;
    margin: 0;
    padding: 12px 8px;
    border-radius: 5px 5px 0 0;
    text-align: center;
    color: white;
    font-weight: bold;
    font-size: 13px;
}

.draft-card.red .unit-header { background: #dc2626; }
.draft-card.green .unit-header { background: #16a34a; }
.draft-card.blue .unit-header { background: #2563eb; }
.draft-card.yellow .unit-header { background: #eab308; }
.draft-card.purple .unit-header { background: #9333ea; }

.card-name {
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
    color: white;
}

.draft-card .unit-ability {
    font-size: 13px;
    text-align: center;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.3;
    margin: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    font-style: italic;
}

.draft-card .unit-stats {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    margin: 0 8px 8px 8px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.draft-card .unit-tags {
    text-align: center;
    padding: 8px;
    margin: 0 8px 8px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    color: #666;
}

/* === DRAFT CONTROLS === */
.draft-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.draft-gold-display {
    position: absolute;
    right: 0;
    bottom: 0;
    background: transparent;
    color: #ffd700;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    border: 2px solid #ffd700;
    box-shadow: 0 3px 10px rgba(255, 215, 0, 0.4);
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.8);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.reroll-btn {
    background: linear-gradient(145deg, #7c3aed, #5b21b6);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
    min-width: 130px;
}

.reroll-btn:hover:not(:disabled) {
    background: linear-gradient(145deg, #8b5cf6, #7c3aed);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

.reroll-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.reroll-btn:disabled {
    background: linear-gradient(145deg, #6b7280, #4b5563);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.6;
}

.reroll-btn:disabled:hover {
    transform: none;
}

/* === DECK MODAL === */
.deck-modal {
    position: relative;
    max-width: 900px;
}

.deck-description {
    text-align: center;
    margin: 10px 0 20px 0;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    border-left: 3px solid #4f46e5;
}

.deck-description p {
    margin: 0;
    color: #e5e7eb;
    font-size: 14px;
    font-style: italic;
}

/* === GAME END MODAL === */
.game-end-modal {
    z-index: 20000; /* Higher than scenario selection */
}

.game-end-content {
    position: relative;
    max-width: 500px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border: 3px solid #ffd700;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: gameEndAppear 0.5s ease-out;
}

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

.game-end-header {
    text-align: center;
    padding: 30px 30px 20px 30px;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.game-end-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: gameEndIconPulse 2s infinite ease-in-out;
}

@keyframes gameEndIconPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.game-end-header h2 {
    margin: 0;
    font-size: 2.5rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.game-end-header.victory h2 {
    color: #10b981; /* Green for victory */
}

.game-end-header.defeat h2 {
    color: #ef4444; /* Red for defeat */
}

.game-end-body {
    padding: 20px 30px;
    text-align: center;
}

.game-end-body p {
    margin: 0;
    font-size: 1.1rem;
    color: #e5e7eb;
    line-height: 1.5;
}

.game-end-actions {
    padding: 20px 30px 30px 30px;
    text-align: center;
}

.game-end-btn {
    font-size: 1.1rem;
    padding: 12px 30px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
}

.game-end-btn:hover {
    background: linear-gradient(135deg, #5b52e8, #8b47ed);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.deck-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin: 25px 0;
    max-height: 60vh;
    overflow-y: auto;
    padding: 10px;
}

/* Deck cards styled like draft cards */
.deck-card {
    width: 160px;
    height: 220px;
    border-radius: 8px;
    border: 3px solid;
    background: linear-gradient(145deg, #f8f8f8, #e8e8e8);
    color: #333;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.deck-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
    z-index: 10;
}

.deck-card.red { border-color: #dc2626; }
.deck-card.green { border-color: #16a34a; }
.deck-card.blue { border-color: #2563eb; }
.deck-card.yellow { border-color: #eab308; }
.deck-card.purple { border-color: #9333ea; }

/* Card header with color background */
.deck-card .card-header {
    background: inherit;
    margin: 0;
    padding: 12px 8px;
    border-radius: 5px 5px 0 0;
    text-align: center;
    color: white;
}

.deck-card.red .card-header { background: linear-gradient(135deg, #dc2626, #991b1b); }
.deck-card.green .card-header { background: linear-gradient(135deg, #16a34a, #0a5c2a); }
.deck-card.blue .card-header { background: linear-gradient(135deg, #2563eb, #1e40af); }
.deck-card.yellow .card-header { background: linear-gradient(135deg, #eab308, #ca8a04); }
.deck-card.purple .card-header { background: linear-gradient(135deg, #9333ea, #7e22ce); }

.deck-card .card-name {
    font-size: 14px;
    font-weight: bold;
    text-align: center;
    color: white;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Card ability section */
.deck-card .card-ability {
    font-size: 12px;
    text-align: center;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.4;
    margin: 10px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 4px;
    min-height: 80px;
    color: #333;
}

/* Stats displayed as circles at the bottom */
.deck-card .card-stats {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: none;
}

.deck-card .stat-attack,
.deck-card .stat-health {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    color: white;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.4);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.deck-card .stat-attack {
    background: linear-gradient(135deg, #f87171, #dc2626);
    border: 2px solid #991b1b;
}

.deck-card .stat-health {
    background: linear-gradient(135deg, #4ade80, #16a34a);
    border: 2px solid #166534;
}

/* Tags section */
.deck-card .card-tags {
    text-align: center;
    padding: 8px;
    margin: 0 8px 55px 8px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    color: #666;
}

.deck-card .tag {
    display: inline-block;
    padding: 2px 6px;
    margin: 0 2px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
    font-size: 10px;
}

.empty-deck {
    text-align: center;
    color: #ccc;
    font-style: italic;
    padding: 40px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
}

/* === HOW TO PLAY MODAL === */
.how-to-play-content {
    max-width: 600px;
}

.how-to-play-content h3 {
    color: #4ecdc4;
    margin: 20px 0 10px 0;
    font-size: 18px;
}

.how-to-play-content p {
    margin: 8px 0;
    line-height: 1.5;
    color: #ccc;
}

/* === GAME LOG === */
.game-log-panel {
    position: fixed;
    right: -400px;
    top: 0;
    width: 400px;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    padding: 20px;
    transition: right 0.3s ease;
    z-index: 5000;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.game-log-panel.visible {
    right: 0;
}

.game-log-panel.hidden {
    right: -400px;
}

.log-header {
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-controls {
    display: flex;
    gap: 5px;
    align-items: center;
}

.log-close-btn, .log-clear-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    padding: 4px 8px;
    transition: all 0.2s;
}

.log-close-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 16px;
    border-radius: 50%;
}

.log-close-btn:hover, .log-clear-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.log-entries {
    height: calc(100vh - 120px);
    overflow-y: auto;
    padding-right: 10px;
}

.log-entry {
    padding: 8px 12px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.4;
    border-left: 3px solid rgba(74, 144, 226, 0.5);
}

/* === NOTIFICATIONS === */
.notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    z-index: 11000;
    padding: 15px 25px;
    border-radius: 8px;
    font-weight: bold;
    color: white;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
    max-width: 400px;
    text-align: center;
}

.notification.show {
    transform: translateX(-50%) translateY(0);
}

.notification.info { background: linear-gradient(145deg, #4a90e2, #357abd); }
.notification.success { background: linear-gradient(145deg, #28a745, #1e7e34); }
.notification.warning { background: linear-gradient(145deg, #ffc107, #e0a800); color: #000; }
.notification.error { background: linear-gradient(145deg, #dc3545, #bd2130); }

/* === ANIMATIONS === */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideInFromRight {
    from { 
        transform: translateX(50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* === KEYWORD TOOLTIP === */
.keyword-tooltip {
    position: fixed;
    background: linear-gradient(135deg, #2a2a3e, #1a1a2e);
    border: 2px solid #4a4a6e;
    border-radius: 8px;
    padding: 12px;
    max-width: 250px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.8);
    z-index: 10000;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.keyword-tooltip .tooltip-header {
    font-weight: bold;
    color: #ffd700;
    margin-bottom: 8px;
    font-size: 14px;
    text-transform: uppercase;
    border-bottom: 1px solid #4a4a6e;
    padding-bottom: 4px;
}

.keyword-tooltip .tooltip-description {
    color: #e0e0e0;
    font-size: 12px;
    line-height: 1.4;
    white-space: pre-line;
}

/* === KEYWORD DEFINITION BOX === */
.keyword-definition-box {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(135deg, #1a2332, #0d1520);
    border-top: 2px solid #4a5568;
    padding: 8px 16px;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.4);
    z-index: 5000;
    opacity: 1;
    overflow: hidden;
}

.keyword-box-header {
    font-size: 14px;
    font-weight: bold;
    color: #ffd700;
    text-align: left;
    margin-bottom: 6px;
    text-transform: uppercase;
    border-bottom: 1px solid #4a5568;
    padding-bottom: 2px;
    display: inline-block;
    margin-right: 20px;
}

.keyword-box-content {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    justify-content: flex-start;
    align-items: center;
    height: 36px;
    overflow-x: auto;
    overflow-y: hidden;
    flex: 1;
}

.keyword-box-empty {
    color: #718096;
    font-style: italic;
    text-align: left;
    width: 100%;
    line-height: 36px;
    margin-left: 20px;
}

.keyword-definition {
    background: rgba(74, 85, 104, 0.2);
    border: 1px solid #4a5568;
    border-radius: 6px;
    padding: 4px 12px;
    min-width: 180px;
    max-width: 500px;
    flex-shrink: 0;
    white-space: nowrap;
}

.keyword-text {
    font-weight: bold;
    color: #e2e8f0;
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.keyword-name-highlight {
    color: #ffd700;
}

/* === GAME SETTINGS === */
.game-settings-button {
    background: rgba(74, 85, 104, 0.7);
    border: 2px solid #6b7280;
    border-radius: 6px;
    color: #f8fafc;
    font-size: 16px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.game-settings-button:hover {
    background: rgba(255, 215, 0, 0.2);
    border-color: #ffd700;
    color: #ffd700;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.game-settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 15000;
}

.game-settings-modal.hidden {
    display: none !important;
}

.settings-modal-content {
    background: linear-gradient(135deg, #1a2332, #0d1520);
    border: 2px solid #4a5568;
    border-radius: 12px;
    padding: 30px;
    min-width: 400px;
    color: #e2e8f0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

.settings-modal-content h3 {
    color: #ffd700;
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.settings-option {
    margin-bottom: 20px;
}

.settings-option label {
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    cursor: pointer;
}

.settings-option input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.2);
}

.settings-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 25px;
}

.settings-quit-button, .settings-close-button {
    padding: 12px 20px;
    border: 2px solid #4a5568;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-quit-button {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.settings-quit-button:hover {
    background: linear-gradient(135deg, #c82333, #a02127);
    border-color: #ffd700;
}

.settings-close-button {
    background: linear-gradient(135deg, #4a5568, #2d3748);
    color: #e2e8f0;
}

.settings-close-button:hover {
    background: linear-gradient(135deg, #2d3748, #1a202c);
    border-color: #ffd700;
}

/* === GAME END MODAL === */
.game-end-modal {
    z-index: 10000;
}

.game-end-content {
    max-width: 400px;
    padding: 30px;
    text-align: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #2c2c44 100%);
    border: 2px solid #4ecdc4;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.game-end-header {
    margin-bottom: 20px;
}

.game-end-icon {
    font-size: 64px;
    margin-bottom: 10px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.game-end-header h2 {
    font-size: 32px;
    color: #4ecdc4;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.game-end-body {
    margin-bottom: 25px;
}

.game-end-body p {
    font-size: 16px;
    color: #e0e0e0;
    margin: 0;
}

.game-end-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.game-end-btn {
    padding: 12px 24px;
    font-size: 16px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #4ecdc4, #44a3aa);
    color: white;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.4);
}

.game-end-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.6);
}

.game-end-btn:active {
    transform: translateY(0);
}

/* Victory specific styles */
.game-end-modal.victory .game-end-header h2 {
    color: #4ecdc4;
}

.game-end-modal.victory .game-end-icon {
    color: #ffd700;
}

/* Defeat specific styles */
.game-end-modal.defeat .game-end-header h2 {
    color: #ff6b6b;
}

.game-end-modal.defeat .game-end-icon {
    color: #999;
}

/* === WIN STARS === */
.win-star {
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 20px;
    z-index: 10;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    animation: starGlow 2s ease-in-out infinite alternate;
}

@keyframes starGlow {
    from { 
        filter: drop-shadow(0 0 3px #ffd700); 
        transform: scale(1);
    }
    to { 
        filter: drop-shadow(0 0 8px #ffd700); 
        transform: scale(1.1);
    }
}

/* === UTILITY CLASSES === */
.hidden { display: none !important; }
.invisible { opacity: 0; }
.disabled { pointer-events: none; opacity: 0.5; }
.text-center { text-align: center; }
.mt-10 { margin-top: 10px; }
.mb-10 { margin-bottom: 10px; }
.p-10 { padding: 10px; }

/* === HEALTH ANIMATION STYLES === */

/* Health damage animation */
.health-decrease {
    animation: healthDamage 0.8s ease-out;
    transform-origin: center;
}

@keyframes healthDamage {
    0% {
        transform: scale(1);
        color: inherit;
    }
    25% {
        transform: scale(1.2);
        color: #dc2626;
        text-shadow: 0 0 8px rgba(220, 38, 38, 0.6);
    }
    50% {
        transform: scale(0.9);
        color: #991b1b;
        text-shadow: 0 0 4px rgba(153, 27, 27, 0.4);
    }
    100% {
        transform: scale(1);
        color: inherit;
        text-shadow: none;
    }
}

/* Health healing animation */
.health-increase {
    animation: healthHeal 0.8s ease-out;
    transform-origin: center;
}

@keyframes healthHeal {
    0% {
        transform: scale(1);
        color: inherit;
    }
    25% {
        transform: scale(1.15);
        color: #16a34a;
        text-shadow: 0 0 8px rgba(22, 163, 74, 0.6);
    }
    50% {
        transform: scale(0.95);
        color: #15803d;
        text-shadow: 0 0 4px rgba(21, 128, 61, 0.4);
    }
    100% {
        transform: scale(1);
        color: inherit;
        text-shadow: none;
    }
}

/* Low health warning animation */
.low-health {
    animation: lowHealthPulse 1.5s ease-in-out infinite;
}

@keyframes lowHealthPulse {
    0%, 100% {
        color: #dc2626;
        text-shadow: 0 0 6px rgba(220, 38, 38, 0.8);
    }
    50% {
        color: #991b1b;
        text-shadow: 0 0 10px rgba(153, 27, 27, 1);
        transform: scale(1.05);
    }
}

/* === UNAVAILABLE SCENARIO STYLES === */
.scenario-btn.scenario-unavailable {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(80%);
    position: relative;
}

.scenario-btn.scenario-unavailable:hover {
    transform: none;
    box-shadow: none;
    background: rgba(255,255,255,0.1);
}

.scenario-btn.scenario-unavailable .unavailable-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
}

.scenario-btn.scenario-unavailable .unavailable-icon {
    font-size: 2rem;
    margin-bottom: 5px;
}

.scenario-btn.scenario-unavailable .unavailable-text {
    font-size: 0.9rem;
    font-weight: bold;
    text-align: center;
}

/* Shake animation for unavailable scenarios */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ==================== CHAMPION SELECTION STYLES ==================== */

.champion-selection-modal {
    z-index: 20000;
}

.champion-selection-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    padding: 1rem;
    max-width: 1200px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.champion-selection-header {
    text-align: center;
    margin-bottom: 0.5rem;
}

.champion-selection-header h1 {
    font-size: 2rem;
    color: #ffd700;
    margin-bottom: 0.25rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.champion-selection-header p {
    color: #aaa;
    font-size: 1.1rem;
}

/* Champion Cards Display (Card Library Format) */
.champion-cards-display {
    background: linear-gradient(135deg, #2a2a3e 0%, #1a1a2e 100%);
    border-radius: 15px;
    padding: 1rem;
    border: 2px solid #444;
    margin-bottom: 0.5rem;
    transition: all 0.3s ease;
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
}

.champion-cards-with-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
    justify-items: center;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
    padding: 0 20px;
}

.card-with-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.card-info-below {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    min-height: 40px;
    padding: 0.25rem;
}

.card-cost {
    color: #ffd700;
    font-weight: bold;
    font-size: 1rem;
    text-align: center;
}

.card-copies {
    color: #aaa;
    font-size: 0.85rem;
    font-weight: normal;
    text-align: center;
}

.champion-cards-placeholder {
    color: #888;
    font-size: 1.2rem;
    text-align: center;
    font-style: italic;
}

.champion-spellbook-header {
    color: #ffd700;
    font-size: 1.1rem;
    font-weight: bold;
    text-align: center;
    margin: 0;
    padding: 0.5rem 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 140px; /* Match card height */
    min-width: 160px;
    border: 2px solid rgba(255, 215, 0, 0.5);
    border-radius: 8px;
    background: rgba(255, 215, 0, 0.1);
}

/* Champion Selection Grid (5x2 by Color) */
.champion-selection-grid {
    margin-top: 0;
}

.champion-grid-body {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 8px;
    min-height: 120px;
}

.champion-grid-slot {
    display: flex;
    align-items: stretch;
    justify-content: center;
}

/* Champion Grid Buttons */
.champion-grid-btn {
    border: 3px solid;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
    width: 100%;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
}

.champion-grid-btn:hover:not(.champion-grid-placeholder) {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.champion-grid-btn.selected {
    border-width: 4px;
    box-shadow: 0 0 20px rgba(255,255,255,0.5);
    transform: scale(1.05);
}

.champion-grid-btn-red { 
    border-color: #ff6b6b;
    background: linear-gradient(135deg, rgba(255,107,107,0.4), rgba(220,88,88,0.4));
}
.champion-grid-btn-yellow { 
    border-color: #ffd93d;
    background: linear-gradient(135deg, rgba(255,217,61,0.4), rgba(255,193,7,0.4));
}
.champion-grid-btn-green { 
    border-color: #6bcf7f;
    background: linear-gradient(135deg, rgba(107,207,127,0.4), rgba(72,178,95,0.4));
}
.champion-grid-btn-blue { 
    border-color: #4ecdc4;
    background: linear-gradient(135deg, rgba(78,205,196,0.4), rgba(52,152,219,0.4));
}
.champion-grid-btn-purple { 
    border-color: #8a63d2;
    background: linear-gradient(135deg, rgba(111,66,193,0.4), rgba(89,53,154,0.4));
}

.champion-grid-placeholder {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(80%);
}

.champion-grid-placeholder:hover {
    transform: none;
    box-shadow: none;
}

.champion-grid-name {
    font-weight: bold;
    font-size: 0.8rem;
    text-align: center;
    line-height: 1.1;
}

.champion-grid-stats {
    font-size: 0.75rem;
    color: #aaa;
    font-weight: normal;
}

/* PLAY Button */
.champion-selection-actions {
    display: flex;
    justify-content: center;
    padding: 0.5rem 0;
    margin: 0.25rem 0 0.5rem 0;
}

.play-champion-btn {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: #fff;
    border: none;
    border-radius: 15px;
    padding: 1rem 3rem;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.play-champion-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(78, 205, 196, 0.4);
}

.play-champion-btn:disabled {
    background: linear-gradient(135deg, #666 0%, #444 100%);
    cursor: not-allowed;
    opacity: 0.6;
}

.play-champion-btn:disabled:hover {
    transform: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* Spell card stats styling for champion selection */
.champion-cards-display .spell-cost,
.champion-cards-display .spell-stock {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.champion-cards-display .spell-cost {
    background: rgba(255, 215, 0, 0.15);
    color: #ffd700;
}

.champion-cards-display .spell-stock {
    background: rgba(70, 130, 180, 0.15);
    color: #4682b4;
}

/* Increase tag size for champion selection screen */
.champion-cards-display .tag {
    font-size: 12px !important;
    padding: 3px 8px !important;
    margin: 0 3px !important;
}

/* ==================== SPELLBOOK STYLES ==================== */

.spellbook-modal {
    z-index: 15000;
    background: rgba(0, 0, 0, 0.6); /* Less dark so battlefield is visible */
    align-items: flex-start; /* Align to top instead of center */
    padding-top: 5vh; /* Add top padding to move modal up */
}

.spellbook-content {
    background: linear-gradient(135deg, #2a1a3e 0%, #1a0e2e 100%);
    border-radius: 20px;
    padding: 2rem;
    max-width: 1200px;
    width: 95%;
    max-height: 80vh;
    overflow-y: auto;
}

.spellbook-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 2px solid #ffd700;
    padding-bottom: 1rem;
}

.spellbook-header h2 {
    color: #ffd700;
    font-size: 2rem;
}

.spellbook-gold-display {
    font-size: 1.8rem;
    font-weight: bold;
    color: #ffd700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spellbook-gold-display span {
    font-size: 2rem;
}

.spellbook-spells-grid {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: nowrap;
    overflow-x: auto;
}

.spell-card-with-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.spell-buy-button {
    background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    text-align: center;
}

.spell-buy-button:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    background: linear-gradient(135deg, #5fddd4 0%, #55b09d 100%);
}

.spell-buy-button.disabled {
    background: linear-gradient(135deg, #555 0%, #444 100%);
    color: #999;
    cursor: not-allowed;
    opacity: 0.7;
    border: 1px solid #666;
}

.spell-buy-button.disabled:hover {
    transform: none;
    box-shadow: none;
    background: linear-gradient(135deg, #555 0%, #444 100%);
}

/* Gray out the entire card when spell is not available */
.spell-card-with-button:has(.spell-buy-button.disabled) .game-card {
    opacity: 0.6;
    filter: grayscale(30%);
}

.spell-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

/* Spell stock indicator below buy buttons */
.spell-stock-indicator {
    background: rgba(0, 0, 0, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    margin-top: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.spell-name {
    color: #fff;
    font-weight: bold;
}

.spell-cost {
    background: #ffd700;
    color: #000;
    padding: 0.2rem 0.4rem;
    border-radius: 5px;
    font-size: 0.9rem;
    font-weight: bold;
}

.spell-description {
    color: #ddd;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.spell-stock {
    color: #999;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.spell-buy-btn {
    width: 100%;
    padding: 0.5rem;
    background: linear-gradient(135deg, #66bb6a 0%, #4caf50 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.spell-buy-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 5px 10px rgba(76, 175, 80, 0.4);
}

.spell-buy-btn:disabled {
    background: #444;
    cursor: not-allowed;
}

.spellbook-footer {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid #444;
}

.spellbook-status {
    color: #aaa;
    font-size: 1.1rem;
}

.spellbook-status.portal-ready {
    color: #ffd700;
    font-weight: bold;
    animation: pulse 2s infinite;
}

/* Increase tag size for spellbook */
.spellbook-modal .tag {
    font-size: 12px !important;
    padding: 3px 8px !important;
    margin: 0 3px !important;
}

/* Portal styles */
.portal-modal {
    z-index: 15000;
}

.portal-content {
    background: linear-gradient(145deg, #2c2c2c, #1a1a1a);
    border: 2px solid #ffd700;
    border-radius: 15px;
    padding: 0;
    max-width: 500px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 215, 0, 0.2);
    animation: slideInFromTop 0.4s ease-out;
}

.portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #4a148c, #6a1b9a);
    padding: 20px 25px;
    border-radius: 13px 13px 0 0;
    border-bottom: 2px solid #ffd700;
}

.portal-header h2 {
    color: #ffd700;
    font-size: 1.8rem;
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
    animation: glow 2s ease-in-out infinite;
}

.portal-body {
    padding: 2rem;
}

.champion-portal-card {
    margin-bottom: 2rem;
}

.champion-summon-card {
    background: linear-gradient(135deg, #3a2a4e 0%, #2a1a3e 100%);
    border: 3px solid #ffd700;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.summon-champion-btn {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #000;
    border: none;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.summon-champion-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.6);
}

.summon-champion-btn:disabled,
.summon-champion-btn.disabled {
    background: #666 !important;
    color: #999 !important;
    cursor: not-allowed !important;
    opacity: 0.6;
    transform: none !important;
    box-shadow: none !important;
}

/* Spellbook button states */
#spellDraftBtn.portal-ready {
    background: linear-gradient(135deg, #9c27b0 0%, #6a1b9a 100%);
    animation: pulse 2s infinite;
}

#spellDraftBtn.portal-open {
    background: linear-gradient(135deg, #9c27b0 0%, #6a1b9a 100%);
    color: #fff;
    animation: glow 2s ease-in-out infinite;
}

#spellDraftBtn.portal-closed {
    background: #444;
    color: #999;
    cursor: not-allowed;
}

/* Spell cards in hand now use the same styling as unit cards - only minor adjustments needed */
.hand-card.spell-card {
    /* Spells inherit all styling from .game-card and .hand-card - no special styling needed */
}

/* Remove any spell-specific hover behavior - let unit card hover take precedence */

/* Remove old spell-specific elements that we're not using anymore */
.spell-indicator {
    display: none;
}

.spell-effect {
    /* This is now handled by .card-ability */
}

.cast-indicator {
    display: none;
}

/* Spell targeting */
.spell-target-valid {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8) !important;
    cursor: crosshair !important;
}

/* Ensure battlefield always has consistent border for stable dimensions */
.battlefield {
    border: 2px solid transparent !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
}

/* Special highlighting for battlefield targeting */
.battlefield.spell-target-valid {
    background: rgba(255, 215, 0, 0.15) !important;
    border-color: rgba(255, 215, 0, 0.8) !important;
    animation: battlefield-glow 2s infinite alternate !important;
}

@keyframes battlefield-glow {
    0% { box-shadow: 0 0 20px rgba(255, 215, 0, 0.8); }
    100% { box-shadow: 0 0 35px rgba(255, 215, 0, 1); }
}

/* Column targeting overlays */
.column-overlay {
    background: rgba(255, 215, 0, 0.15);
    border: 2px solid rgba(255, 215, 0, 0.8);
    border-radius: 8px;
    cursor: crosshair;
    animation: column-glow 2s infinite alternate;
    transition: all 0.3s ease;
}

.column-overlay:hover {
    background: rgba(255, 215, 0, 0.25);
    border-color: rgba(255, 215, 0, 1);
}

@keyframes column-glow {
    0% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); }
    100% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.9); }
}

/* Row targeting overlays */
.row-overlay {
    background: rgba(255, 215, 0, 0.15);
    border: 2px solid rgba(255, 215, 0, 0.8);
    border-radius: 8px;
    cursor: crosshair;
    animation: row-glow 2s infinite alternate;
    transition: all 0.3s ease;
}

.row-overlay:hover {
    background: rgba(255, 215, 0, 0.25);
    border-color: rgba(255, 215, 0, 1);
}

@keyframes row-glow {
    0% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); }
    100% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.9); }
}

/* Battlefield drag ready effect (when dragging starts) */
.battlefield.battlefield-drag-ready {
    background: rgba(255, 215, 0, 0.1) !important;
    border-color: rgba(255, 215, 0, 0.6) !important;
    animation: battlefield-pulse 2s infinite alternate !important;
}

/* Battlefield drag over effect (when hovering over) */
.battlefield.battlefield-drag-over {
    background: rgba(255, 215, 0, 0.2) !important;
    border-color: rgba(255, 215, 0, 1) !important;
    box-shadow: 0 0 40px rgba(255, 215, 0, 0.9) !important;
}

@keyframes battlefield-pulse {
    0% { box-shadow: 0 0 15px rgba(255, 215, 0, 0.5); }
    100% { box-shadow: 0 0 25px rgba(255, 215, 0, 0.8); }
}

/* Animations */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes glow {
    0% { text-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
    50% { text-shadow: 0 0 20px rgba(255, 215, 0, 0.8), 0 0 30px rgba(255, 215, 0, 0.5); }
    100% { text-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
}