/* ============================================================
   LIVE ARENA — Ranked Play, Spectating, Leaderboard
   ============================================================ */

/* ── Utility ───────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Section Container ─────────────────────────────────── */
.arena-section {
    position: relative;
    overflow: hidden;
}
.arena-section .section-header {
    flex-wrap: wrap;
    gap: 12px;
}
.arena-section .section-header h2 {
    white-space: nowrap;
}
.arena-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}
.arena-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}
.arena-live-pulse {
    color: #22c55e;
    font-weight: 600;
}

/* Pulsing dot */
.pulse-dot, .pulse-dot-sm {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    animation: arenaPulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}
.pulse-dot-sm {
    width: 6px;
    height: 6px;
}
@keyframes arenaPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.5; transform: scale(0.8); }
}

/* Play button */
.arena-btn-play {
    font-weight: 700;
    letter-spacing: 0.3px;
    padding: 8px 20px;
    font-size: 0.85rem;
    border-radius: 8px;
    text-decoration: none;
}

/* ── Tabs ──────────────────────────────────────────────── */
.arena-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-primary);
    padding-bottom: 0;
}
.arena-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 8px 16px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.arena-tab:hover {
    color: var(--text-primary);
}
.arena-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ── Panels ────────────────────────────────────────────── */
.arena-panel {
    min-height: 120px;
}
.arena-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 40px 0;
    font-size: 0.82rem;
}

/* ── Live Games Grid ───────────────────────────────────── */
.arena-live-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Single game row */
.arena-game-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr auto auto;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-secondary);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
    animation: arenaRowIn 0.3s ease both;
}
.arena-game-row:hover {
    background: var(--bg-hover);
    border-color: var(--accent);
    transform: translateX(2px);
}
@keyframes arenaRowIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Player columns */
.arena-player {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.arena-player.right {
    flex-direction: row-reverse;
    text-align: right;
}
.arena-player-name {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}
.arena-player-tier {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Ink color dots */
.arena-ink-dots {
    display: flex;
    gap: 3px;
}
.arena-ink-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.1);
}

/* Score column (center) */
.arena-score {
    text-align: center;
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-primary);
    padding: 0 8px;
    min-width: 50px;
    font-variant-numeric: tabular-nums;
}
.arena-score-vs {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.7rem;
}

/* Meta columns */
.arena-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 0.68rem;
    color: var(--text-muted);
    min-width: 50px;
}
.arena-meta-elo {
    font-weight: 700;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.arena-turn-badge {
    font-size: 0.62rem;
    padding: 1px 5px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    color: var(--text-muted);
}

/* Spectator badge */
.arena-spectate-badge {
    font-size: 0.65rem;
    color: var(--accent);
    display: flex;
    align-items: center;
    gap: 3px;
    min-width: 45px;
    justify-content: flex-end;
}

/* Show more button */
.arena-show-more {
    display: block;
    margin: 12px auto 0;
    font-size: 0.78rem;
}

/* Empty state */
.arena-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 30px 0;
    font-size: 0.82rem;
}
.arena-empty-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    opacity: 0.5;
}
.arena-empty p {
    margin: 4px 0;
}

/* ── Tier Colors ───────────────────────────────────────── */
.tier-bronze      { background: rgba(205,127,50,0.15); color: #cd7f32; }
.tier-silver      { background: rgba(192,192,192,0.15); color: #c0c0c0; }
.tier-gold        { background: rgba(255,215,0,0.15); color: #ffd700; }
.tier-platinum    { background: rgba(125,211,252,0.15); color: #7dd3fc; }
.tier-diamond     { background: rgba(96,165,250,0.15); color: #60a5fa; }
.tier-master      { background: rgba(155,93,229,0.15); color: #9b5de5; }
.tier-grandmaster { background: rgba(239,68,68,0.15); color: #ef4444; }
.tier-legend      { background: rgba(251,191,36,0.15); color: #fbbf24; border: 1px solid rgba(251,191,36,0.25); }

/* ── Ink Colors ────────────────────────────────────────── */
.ink-amber    { background: #fbbf24; }
.ink-amethyst { background: #9b5de5; }
.ink-emerald  { background: #2d9e4f; }
.ink-ruby     { background: #e63946; }
.ink-sapphire { background: #0096c7; }
.ink-steel    { background: #8b9eb0; }

/* ── Leaderboard ───────────────────────────────────────── */
.arena-leaderboard {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.arena-lb-row {
    display: grid;
    grid-template-columns: 36px 1fr auto auto auto auto;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-secondary);
    border-radius: 6px;
    transition: background 0.15s;
    animation: arenaRowIn 0.3s ease both;
}
.arena-lb-row:hover {
    background: var(--bg-hover);
}
.arena-lb-row.top-3 {
    border-color: rgba(251,191,36,0.2);
}
.arena-lb-rank {
    font-weight: 800;
    font-size: 0.85rem;
    text-align: center;
    color: var(--text-muted);
}
.arena-lb-row.top-3 .arena-lb-rank {
    color: #ffd700;
}
.arena-lb-name {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.arena-lb-elo {
    font-weight: 700;
    font-size: 0.82rem;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}
.arena-lb-record {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.arena-lb-streak {
    font-size: 0.7rem;
    color: #f59e0b;
    font-weight: 600;
}
.arena-lb-winrate {
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.arena-lb-winrate.high { background: rgba(34,197,94,0.12); color: #22c55e; }
.arena-lb-winrate.mid  { background: rgba(245,158,11,0.12); color: #f59e0b; }
.arena-lb-winrate.low  { background: rgba(239,68,68,0.12); color: #ef4444; }

/* ── My Stats Card ─────────────────────────────────────── */
.arena-my-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}
.arena-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-secondary);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    transition: border-color 0.2s;
}
.arena-stat-card:hover {
    border-color: var(--accent);
}
.arena-stat-card .stat-icon {
    font-size: 1.8rem;
    margin-bottom: 8px;
}
.arena-stat-card .stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}
.arena-stat-card .stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.arena-stat-card .stat-sub {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 6px;
}
.arena-stat-card.card-tier {
    border-color: rgba(125,211,252,0.2);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(125,211,252,0.04) 100%);
}

/* ── Matchmaking Overlay ───────────────────────────────── */
.arena-matchmaking-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: mmFadeIn 0.3s ease;
}
@keyframes mmFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.arena-matchmaking-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-primary);
    border-radius: 16px;
    padding: 40px 50px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.arena-matchmaking-modal h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 20px 0 8px;
}
.arena-mm-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.arena-mm-timer {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    margin: 12px 0;
}
.arena-mm-earn {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Matchmaking animation rings */
.arena-mm-animation {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto;
}
.arena-mm-ring {
    position: absolute;
    inset: 0;
    border: 2px solid transparent;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: mmSpin 1.2s linear infinite;
}
.arena-mm-ring-2 {
    inset: 8px;
    border-top-color: rgba(155,93,229,0.6);
    animation-direction: reverse;
    animation-duration: 1.8s;
}
.arena-mm-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
}
@keyframes mmSpin {
    to { transform: rotate(360deg); }
}

/* ── Match Found Overlay ───────────────────────────────── */
.arena-match-found {
    text-align: center;
}
.arena-match-found h3 {
    font-size: 1.3rem;
    color: #22c55e;
    margin-bottom: 16px;
    animation: mmPulseIn 0.5s ease;
}
@keyframes mmPulseIn {
    0%   { transform: scale(0.8); opacity: 0; }
    60%  { transform: scale(1.05); }
    100% { transform: scale(1); opacity: 1; }
}
.arena-match-vs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 16px 0;
}
.arena-match-player {
    text-align: center;
}
.arena-match-player .name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}
.arena-match-player .elo {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}
.arena-match-divider {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-muted);
}

/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
    .arena-game-row {
        grid-template-columns: 1fr auto 1fr;
        padding: 8px 10px;
    }
    .arena-meta, .arena-spectate-badge {
        display: none;
    }
    .arena-player-name {
        max-width: 100px;
        font-size: 0.75rem;
    }
    .arena-lb-row {
        grid-template-columns: 28px 1fr auto auto;
        padding: 6px 10px;
        gap: 6px;
    }
    .arena-lb-streak, .arena-lb-record {
        display: none;
    }
    .arena-tabs {
        overflow-x: auto;
    }
    .arena-matchmaking-modal {
        padding: 30px 24px;
    }
    .arena-my-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 480px) {
    .arena-my-stats {
        grid-template-columns: 1fr;
    }
    .arena-stats {
        font-size: 0.72rem;
        gap: 10px;
    }
    .arena-ink-dots {
        display: none;
    }
}
