:root {
    --bg-gradient: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.7);
    --accent: #00e5ff;
    --accent-hover: #00b4d8;
    --card-bg: rgba(255, 255, 255, 0.15);
    --card-hover: rgba(255, 255, 255, 0.25);
    --card-cpu-bg: rgba(255, 100, 100, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.game-container {
    width: 100%;
    max-width: 900px;
    height: 100vh;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.text-center {
    text-align: center;
}

header {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

.score-board {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.player-score {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-value {
    font-size: 2.5rem;
    font-weight: 800;
}

.status-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

#game-status {
    font-size: 1.2rem;
    font-weight: 600;
}

.carry-over-tag {
    background: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 193, 7, 0.4);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.carry-over-tag.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

/* Main Play Area */
.play-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
}

.side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.deck-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
}

.hand-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    min-height: 120px;
    perspective: 1000px;
}

/* Battle Arena */
.battle-arena {
    padding: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 40px;
    position: relative;
    min-height: 220px;
}

.vs-badge {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
    animation: pulse 2s infinite;
}

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

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

.battle-slot {
    width: 100px;
    height: 140px;
    border: 2px dashed var(--glass-border);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: all 0.3s ease;
}

.placeholder-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--glass-border);
    text-transform: uppercase;
}

/* Cards */
.card {
    width: 80px;
    height: 112px;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    user-select: none;
    position: relative;
    transform-style: preserve-3d;
}

.card.face-up {
    background: rgba(255, 255, 255, 0.9);
    color: #1a1a2e;
}

.card.face-down {
    background: linear-gradient(135deg, #16222a 0%, #3a6073 100%);
    color: transparent;
    border: 2px solid var(--glass-border);
    background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.05) 0px, rgba(255, 255, 255, 0.05) 10px, transparent 10px, transparent 20px);
}

.user-side .card:hover {
    transform: translateY(-15px) scale(1.05);
    background: var(--card-hover);
    box-shadow: 0 15px 30px rgba(0, 229, 255, 0.2);
    border-color: var(--accent);
}

.user-side .card.face-up:hover {
    background: #ffffff;
}

/* Modals */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 200;
    background: rgba(15, 32, 39, 0.85);
    backdrop-filter: blur(20px);
}

.overlay.hidden {
    display: none;
}

.title-large {
    font-size: 4rem;
    font-weight: 900;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.6);
    margin-bottom: 40px;
    letter-spacing: 4px;
    color: var(--accent);
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 300px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border: 1px solid var(--glass-border);
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: 30px;
    cursor: not-allowed;
    text-transform: uppercase;
}

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 2px solid var(--accent);
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.btn-outline:hover {
    background: rgba(0, 229, 255, 0.1);
    box-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
}

.rules-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
    text-align: left;
}

.rule-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 12px;
}

.rule-item p {
    margin-bottom: 0 !important;
    font-size: 1rem !important;
}

.rule-icon {
    font-size: 2.5rem;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 40px;
    text-align: center;
    z-index: 300;
    min-width: 300px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal.hidden {
    display: none;
}

.modal h2 {
    font-size: 2.5rem;
    color: var(--accent);
    margin-bottom: 20px;
}

.modal p {
    font-size: 1.2rem;
    margin-bottom: 30px;
}

.btn-primary {
    background: var(--accent);
    color: #0f2027;
    border: none;
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 229, 255, 0.4);
}

/* Utility Animations classes */
.selected {
    transform: scale(1.1) !important;
    border-color: var(--accent) !important;
}

.winner-card {
    animation: winPulse 1s ease infinite;
    border-color: #00e676 !important;
    box-shadow: 0 0 20px rgba(0, 230, 118, 0.5) !important;
}

.loser-card {
    opacity: 0.5;
    transform: scale(0.9) !important;
}

.ten-sum-win {
    animation: epicWin 1s ease infinite !important;
    border-color: #e040fb !important;
    box-shadow: 0 0 30px rgba(224, 64, 251, 0.6) !important;
    color: #e040fb !important;
}

@keyframes winPulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes epicWin {
    0% {
        transform: scale(1) rotate(0deg);
    }

    25% {
        transform: scale(1.1) rotate(5deg);
    }

    75% {
        transform: scale(1.1) rotate(-5deg);
    }

    100% {
        transform: scale(1) rotate(0deg);
    }
}

/* Pile UI */
.pile-container {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 10;
}

.pile-container.bottom-left {
    bottom: 30px;
    left: 30px;
}

.pile-container.bottom-right {
    bottom: 30px;
    right: 30px;
}

.pile-container.top-left {
    top: 30px;
    left: 30px;
}

.pile-container.top-right {
    top: 30px;
    right: 30px;
}

.pile-info {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--glass-bg);
    padding: 4px 12px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.pile-card {
    transform: scale(0.8);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    cursor: default;
    opacity: 1;
    transition: opacity 0.3s;
}

.pile-card:hover {
    transform: scale(0.8);
    /* Disable user-side hover scale on piles */
}

.discard-pile {
    opacity: 0.3;
    color: var(--text-muted);
    font-size: 2rem;
}

.discard-pile.has-cards {
    opacity: 1;
    color: #1a1a2e;
}

/* Prediction Highlights */
.predict-win {
    border-color: #00e676 !important;
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.6) !important;
    transform: translateY(-5px);
}

.predict-10 {
    border-color: #e040fb !important;
    box-shadow: 0 0 15px rgba(224, 64, 251, 0.6) !important;
    transform: translateY(-5px);
}

.predict-dim {
    opacity: 0.5;
}