body {
    min-height: 100vh;
}

.game-container {
    max-width: 900px;
}

.game-area {
    background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
    padding: 28px;
    border-radius: 14px;
    box-shadow: var(--shadow);
    text-align: center;
}

h1 {
    color: var(--primary-color);
    margin: 0;
}

.status {
    min-height: 1.7em;
    margin: 12px 0 14px;
    color: var(--secondary-color);
    font-size: 1.2rem;
    font-weight: 700;
}

.how-to-play {
    width: 100%;
    text-align: left;
    background: #f8fafc;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
}

.how-to-play summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--secondary-color);
}

.how-to-play-content {
    margin-top: 12px;
    color: var(--text-color);
}

.how-to-play-content h4 {
    color: var(--primary-color);
    margin: 10px 0 4px;
}

.online-info,
.ai-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.ai-info.hidden,
.online-info.hidden {
    display: none;
}

.ai-info-label {
    color: #6b4e00;
    background: #fff7db;
    border: 1px solid #f5d76e;
    border-radius: 999px;
    padding: 7px 14px;
    font-weight: 700;
}

.opponent-name {
    color: var(--text-muted);
    font-weight: 700;
}

.war-banner {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 2px auto 14px;
    padding: 8px 24px;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff5f6d, #ffc371);
    color: white;
    font-size: 1.35rem;
    font-weight: 900;
    letter-spacing: 0.04em;
    box-shadow: 0 8px 18px rgba(231, 76, 60, 0.25);
    animation: bannerPop 0.45s ease;
}

.war-banner.hidden {
    display: none;
}

@keyframes bannerPop {
    0% { transform: scale(0.72); opacity: 0; }
    70% { transform: scale(1.08); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.score-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.player-count-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, border-color 0.2s;
}

.player-count-card.winner {
    border-color: var(--success-color);
    transform: translateY(-2px);
}

.player-label {
    display: block;
    color: var(--secondary-color);
    font-weight: 800;
}

.pile-count {
    display: block;
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 2px;
}

.battle-table {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 18px;
    align-items: stretch;
    background: radial-gradient(circle at center, #157347 0%, #0f5c39 70%);
    border: 8px solid #8b5a2b;
    border-radius: 20px;
    padding: 20px;
    box-shadow: inset 0 0 24px rgba(0, 0, 0, 0.28);
}

.battle-side {
    min-width: 0;
}

.battle-name {
    color: white;
    font-weight: 900;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 12px;
}

.played-cards {
    min-height: 132px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.table-center {
    min-width: 92px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.deck-stack {
    position: relative;
    width: 64px;
    height: 88px;
}

.deck-stack span {
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, #23395d, #406e8e);
    border: 3px solid white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.25);
}

.deck-stack span:nth-child(1) { transform: translate(-6px, 6px) rotate(-7deg); }
.deck-stack span:nth-child(2) { transform: translate(0, 2px) rotate(2deg); }
.deck-stack span:nth-child(3) { transform: translate(6px, -3px) rotate(8deg); }

.pot-count {
    color: white;
    font-weight: 800;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 999px;
    padding: 6px 10px;
    white-space: nowrap;
}

.card {
    width: 68px;
    height: 98px;
    background: white;
    border: 2px solid #dde3ea;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.22);
    user-select: none;
    position: relative;
}

.card .rank {
    font-size: 1.35rem;
    font-weight: 900;
    line-height: 1;
}

.card .suit {
    font-size: 1.55rem;
    line-height: 1.1;
}

.card.hearts,
.card.diamonds {
    color: #d63031;
}

.card.clubs,
.card.spades {
    color: #1f2937;
}

.card.face-down {
    background:
        repeating-linear-gradient(45deg, rgba(255,255,255,0.12) 0 6px, transparent 6px 12px),
        linear-gradient(135deg, #1a3a6d, #2f80ed);
    border-color: white;
}

.card.face-down::after {
    content: "⚔️";
    color: white;
    font-size: 1.6rem;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.35));
}

.card.revealed {
    animation: flipIn 0.52s ease both;
}

.card.winning-card {
    outline: 4px solid #f1c40f;
    transform: translateY(-4px);
}

@keyframes flipIn {
    0% {
        transform: rotateY(90deg) translateY(14px);
        opacity: 0;
    }
    55% {
        transform: rotateY(-10deg) translateY(-4px);
        opacity: 1;
    }
    100% {
        transform: rotateY(0) translateY(0);
        opacity: 1;
    }
}

.round-log {
    min-height: 2.4em;
    margin: 16px auto 0;
    padding: 10px 14px;
    color: #5c4508;
    background: #fff8dc;
    border: 1px solid #f5d76e;
    border-radius: 10px;
    font-weight: 700;
}

.game-buttons {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

#flip-btn {
    background: #d35400;
}

#flip-btn:hover {
    background: #e67e22;
}

#exit-game-btn {
    padding: 10px 20px;
}

@media (max-width: 720px) {
    .game-area {
        padding: 18px;
    }

    .battle-table {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 14px;
    }

    .table-center {
        order: -1;
        min-width: 0;
    }

    .played-cards {
        min-height: 110px;
    }
}

@media (max-width: 520px) {
    .header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .score-row {
        grid-template-columns: 1fr;
    }

    .card {
        width: 52px;
        height: 76px;
        border-radius: 8px;
    }

    .card .rank {
        font-size: 1.05rem;
    }

    .card .suit {
        font-size: 1.2rem;
    }

    .deck-stack {
        width: 50px;
        height: 70px;
    }
}
