/* ==========================================================================
   2048 Multiplayer Arena Stylesheet
   Split-screen 1v1 Local & Bot Duels
   ========================================================================== */

.mp-container {
    max-width: 980px;
    margin: 0 auto;
    padding: 1rem 0;
}

.mp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    background: var(--bg-surface, #1e293b);
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md, 12px);
    border: 1px solid var(--border-color, #334155);
}

.mp-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.mp-badge {
    background: linear-gradient(135deg, #ef4444 0%, #f59e0b 100%);
    color: #fff;
    font-weight: 900;
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 999px;
    letter-spacing: 0.05em;
}

.mp-mode-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 999px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.mp-mode-btn {
    background: transparent;
    border: none;
    color: var(--text-muted, #94a3b8);
    font-size: 0.82rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mp-mode-btn.active {
    background: var(--primary, #f59e0b);
    color: #000;
}

.mp-timer-box {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: monospace;
    font-size: 1.25rem;
    font-weight: 800;
    color: #f8fafc;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-mp-restart {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #f8fafc);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-mp-restart:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Banner Victory */
.mp-banner {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(245, 158, 11, 0.95));
    border-radius: 14px;
    padding: 1.75rem;
    text-align: center;
    color: #fff;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 30px rgba(239, 68, 68, 0.35);
    animation: bannerPop 0.3s ease;
}

@keyframes bannerPop {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.mp-banner h2 {
    font-size: 2rem;
    margin-bottom: 0.3rem;
    font-weight: 900;
}

.mp-banner p {
    font-size: 1.05rem;
    margin-bottom: 1rem;
    opacity: 0.95;
}

/* Dual Arena Grid */
.mp-arena-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.25rem;
    align-items: start;
}

.mp-vs-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 160px;
}

.vs-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444 0%, #f59e0b 100%);
    color: #fff;
    font-weight: 900;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.6);
    border: 3px solid #fff;
}

.mp-player-card {
    background: var(--bg-surface, #1e293b);
    border-radius: 16px;
    padding: 1.25rem;
    border: 2px solid var(--border-color, #334155);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

#mp-card-p1 {
    border-color: #3b82f6;
}

#mp-card-p2 {
    border-color: #ef4444;
}

.mp-player-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mp-player-name {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary, #fff);
}

.p1-top .mp-player-name {
    color: #60a5fa;
}

.p2-top .mp-player-name {
    color: #f87171;
}

.mp-controls-hint {
    font-size: 0.75rem;
    color: var(--text-muted, #94a3b8);
    margin-top: 2px;
}

.mp-player-stats {
    display: flex;
    gap: 0.6rem;
}

.mp-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    padding: 4px 10px;
    border-radius: 6px;
    min-width: 55px;
}

.stat-label {
    font-size: 0.65rem;
    color: var(--text-muted, #94a3b8);
    font-weight: 700;
}

.stat-val {
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
}

.stat-val.highlight {
    color: #f59e0b;
}

/* Board Frame & Tiles */
.mp-board-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #0f172a;
    border-radius: 12px;
    padding: 6px;
    user-select: none;
    touch-action: none;
}

.mp-grid-bg {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 6px;
    width: 100%;
    height: 100%;
}

.mp-cell {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

.mp-tiles-layer {
    position: absolute;
    inset: 6px;
    pointer-events: none;
}

.mp-tile {
    position: absolute;
    width: calc((100% - 18px) / 4);
    height: calc((100% - 18px) / 4);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: clamp(0.9rem, 2.5vw, 1.4rem);
    transition: transform 120ms ease;
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35), 0 4px 8px rgba(0, 0, 0, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

.mp-tile.tile-2 { background: linear-gradient(180deg, #fafafa 0%, #e4e4e7 100%); color: #27272a; text-shadow: none; }
.mp-tile.tile-4 { background: linear-gradient(180deg, #fef08a 0%, #fde047 100%); color: #451a03; text-shadow: none; }
.mp-tile.tile-8 { background: linear-gradient(180deg, #fed7aa 0%, #fb923c 100%); color: #ffffff; text-shadow: 0 1px 3px rgba(0,0,0,0.4); }
.mp-tile.tile-16 { background: linear-gradient(180deg, #fdba74 0%, #f97316 100%); color: #ffffff; }
.mp-tile.tile-32 { background: linear-gradient(180deg, #fca5a5 0%, #ef4444 100%); color: #ffffff; }
.mp-tile.tile-64 { background: linear-gradient(180deg, #f87171 0%, #dc2626 100%); color: #ffffff; }
.mp-tile.tile-128 { background: linear-gradient(180deg, #67e8f9 0%, #06b6d4 100%); color: #ffffff; font-size: 1.1rem; box-shadow: 0 3px 0 #0891b2, 0 0 15px rgba(6, 182, 212, 0.5); }
.mp-tile.tile-256 { background: linear-gradient(180deg, #93c5fd 0%, #3b82f6 100%); color: #ffffff; font-size: 1.1rem; box-shadow: 0 3px 0 #2563eb, 0 0 18px rgba(59, 130, 246, 0.5); }
.mp-tile.tile-512 { background: linear-gradient(180deg, #c4b5fd 0%, #8b5cf6 100%); color: #ffffff; font-size: 1.1rem; box-shadow: 0 3px 0 #7c3aed, 0 0 20px rgba(139, 92, 246, 0.5); }
.mp-tile.tile-1024 { background: linear-gradient(180deg, #f472b6 0%, #db2777 100%); color: #ffffff; font-size: 0.95rem; box-shadow: 0 3px 0 #be185d, 0 0 25px rgba(219, 39, 119, 0.6); }
.mp-tile.tile-2048 { background: linear-gradient(180deg, #fef08a 0%, #eab308 100%); color: #713f12; font-size: 0.95rem; box-shadow: 0 3px 0 #ca8a04, 0 0 28px rgba(234, 179, 8, 0.8); border: 2px solid #fef08a; }
.mp-tile.tile-super { background: linear-gradient(180deg, #38bdf8 0%, #6366f1 100%); color: #ffffff; font-size: 0.85rem; box-shadow: 0 3px 0 #4f46e5, 0 0 30px rgba(99, 102, 241, 0.9); }

/* D-Pad controls for touch / mobile */
.mp-dpad {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 1rem;
    gap: 4px;
}

.dpad-mid {
    display: flex;
    gap: 4px;
}

.dpad-btn {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
}

.dpad-btn:active {
    background: var(--primary, #f59e0b);
    color: #000;
}

@media (max-width: 820px) {
    .mp-container {
        padding: 0 0.5rem;
        margin: 0.5rem auto 2rem;
    }

    .mp-arena-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .mp-vs-divider {
        padding-top: 0;
        margin: -0.25rem 0;
    }

    .mp-player-card {
        padding: 0.75rem;
    }

    .mp-player-header {
        margin-bottom: 0.5rem;
    }

    .mp-player-stats {
        gap: 0.35rem;
    }

    .mp-stat {
        min-width: 48px;
        padding: 3px 6px;
    }

    .stat-label {
        font-size: 0.58rem;
    }

    .stat-val {
        font-size: 0.92rem;
    }

    .mp-dpad {
        margin-top: 0.75rem;
        gap: 3px;
    }

    .dpad-mid {
        gap: 3px;
    }

    .dpad-btn {
        width: 46px;
        height: 46px;
        border-radius: 6px;
        font-size: 1.15rem;
    }
}

