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

body {
    font-family: 'Arial', sans-serif;
    background-color: #1a1a2e;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    font-size: 18px;
    line-height: 1.6;
}

/* ===== GAME CONTAINER ===== */
.game-container {
    width: 100%;
    max-width: 900px;
    background-color: #16213e;
    border: 2px solid #4cc9f0;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 0 30px rgba(76, 201, 240, 0.3);
    max-height: 95vh;
    overflow-y: auto;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    color: #4cc9f0;
    font-size: 2.2em;
}

/* ===== GAME INFO ===== */
.game-info {
    display: flex;
    justify-content: space-between;
    background-color: rgba(0, 0, 0, 0.3);
    padding: 12px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

#turn-counter {
    font-weight: bold;
    color: #f72585;
}

.mana-display {
    display: flex;
    gap: 20px;
}

/* ===== PLAYER BOARDS ===== */
.board {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
}

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

.hp-count {
    font-size: 0.9em;
    color: #4cc9f0;
}

/* ===== CARDS CONTAINERS ===== */
.cards-container, .battle-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    padding: 10px;
    min-height: 120px;
    max-height: 30vh;
    overflow-y: auto;
    margin: 10px 0;
}

/* ===== CARD STYLES ===== */
.card {
    width: 110px;
    height: 165px;
    background: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    user-select: none;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.card-name {
    font-weight: bold;
    font-size: 16px;
    text-align: center;
    margin-bottom: 8px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

.card-stats {
    display: flex;
    justify-content: space-around;
}

.card-attack, .card-health {
    background-color: rgba(0, 0, 0, 0.4);
    padding: 3px 10px;
    border-radius: 15px;
    font-weight: bold;
}

.card-attack {
    color: #f72585;
}

.card-health {
    color: #4cc9f0;
}

.card-cost {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: gold;
    color: #3a0ca3;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* ===== CARD ABILITIES ===== */
.card.taunt {
    border: 3px solid gold;
}

.card.taunt::after {
    content: "Provocation";
    position: absolute;
    bottom: 5px;
    left: 0;
    right: 0;
    font-size: 10px;
    color: gold;
    background-color: rgba(0, 0, 0, 0.7);
    text-align: center;
    padding: 2px 0;
}

.card.charge {
    background: linear-gradient(135deg, #f72585 0%, #b5179e 100%);
}

.card.divine-shield {
    position: relative;
}

.card.divine-shield::before {
    content: "";
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border: 2px dashed rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    animation: pulse 2s infinite;
}

/* ===== HEALTH BARS ===== */
.hp-bar {
    width: 100%;
    height: 15px;
    background-color: #e63946;
    border-radius: 8px;
    overflow: hidden;
    margin: 8px 0;
}

.hp-fill {
    height: 100%;
    background-color: #06d6a0;
    width: 100%;
    transition: width 0.5s ease;
}

/* ===== ACTION BUTTONS ===== */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

button {
    background: linear-gradient(135deg, #7209b7 0%, #3a0ca3 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1.1em;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 160px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ===== BATTLEFIELD SEPARATOR ===== */
.battlefield-separator {
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #4cc9f0 50%, transparent 100%);
    margin: 15px 0;
}

/* ===== MODAL STYLES ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    z-index: 100;
    overflow-y: auto;
}

.modal-content {
    background-color: #16213e;
    margin: 5% auto;
    padding: 25px;
    border: 2px solid #4cc9f0;
    border-radius: 15px;
    width: 90%;
    max-width: 700px;
    position: relative;
}

.close {
    position: absolute;
    top: 15px;
    right: 25px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: white;
}

.rules-content h2 {
    color: #4cc9f0;
    margin-bottom: 20px;
    text-align: center;
}

.rules-content h3 {
    color: #f72585;
    margin: 20px 0 10px;
}

.rules-content p, .rules-content li {
    margin-bottom: 10px;
}

.rules-content ol, .rules-content ul {
    padding-left: 25px;
}

.card-examples {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    margin: 25px 0;
}

.example-card {
    text-align: center;
    margin: 15px;
}

.example-card .card {
    margin: 0 auto 10px;
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 0.3; }
    100% { opacity: 0.7; }
}

@keyframes cardDraw {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes cardPlay {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes attackAnimation {
    0% { transform: translateX(0); }
    25% { transform: translateX(20px); }
    50% { transform: translateX(0); }
    75% { transform: translateX(10px); }
    100% { transform: translateX(0); }
}

.card-draw {
    animation: cardDraw 0.5s ease-out;
}

.card-play {
    animation: cardPlay 0.3s ease-in-out;
}

.attack-animation {
    animation: attackAnimation 0.6s ease-in-out;
}

@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

.shake {
    animation: shake 0.4s ease-in-out;
}

/* ===== SCROLLBARS ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #4cc9f0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a8fd9;
}

/* ===== TOUCH CONTROLS ===== */
.card[draggable="true"] {
    cursor: grab;
}

.card[draggable="true"]:active {
    cursor: grabbing;
}

.card.dragging {
    opacity: 0.7;
    transform: scale(1.05);
    z-index: 10;
}

.card.attacking {
    border: 2px solid #f72585;
    box-shadow: 0 0 15px #f72585;
}

.card.has-attacked {
    opacity: 0.6;
    filter: grayscale(50%);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    body {
        font-size: 16px;
        padding: 10px;
    }

    .game-container {
        padding: 15px;
        max-height: 100vh;
        border-radius: 0;
    }

    .card {
        width: 90px;
        height: 135px;
        font-size: 14px;
    }

    .card-name {
        font-size: 14px;
    }

    .card-stats {
        font-size: 13px;
    }

    .action-buttons {
        flex-direction: column;
        gap: 10px;
    }

    button {
        width: 100%;
        padding: 15px;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
        padding: 20px 15px;
    }
}

@media (min-width: 1200px) {
    .card {
        width: 120px;
        height: 180px;
    }
}