/* ═══════════════════════════════════════════════════════════════════════════
   TetroWars – Multiplayer Stylesheet
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Multiplayer Wrapper ────────────────────────────────────────────────── */
.multiplayer-wrapper {
    min-height: calc(100vh - 72px);
    display: flex;
    flex-direction: column;
}

/* ─── Guest Banner ──────────────────────────────────────────────────────── */
.guest-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.5rem;
    background: var(--warning-bg);
    color: var(--warning);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
}

.guest-banner a {
    color: inherit;
    text-decoration: underline;
}

.guest-banner a:hover {
    opacity: 0.8;
}

/* ─── Connection Status Bar ──────────────────────────────────────────────── */
.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    justify-content: center;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.connection-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.connection-status-connecting {
    background: var(--warning-bg);
    color: var(--warning);
}

.connection-status-connecting .connection-dot {
    background: var(--warning);
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.connection-status-connected {
    background: var(--success-bg);
    color: var(--success);
}

.connection-status-connected .connection-dot {
    background: var(--success);
}

.connection-status-disconnected {
    background: var(--danger-bg);
    color: var(--danger);
}

.connection-status-disconnected .connection-dot {
    background: var(--danger);
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ─── Lobby View ─────────────────────────────────────────────────────────── */
.lobby-view {
    flex: 1;
    padding: 2rem 0;
}

.lobby-container {
    max-width: 900px;
}

.lobby-title {
    text-align: center;
    margin-bottom: 0.5rem;
}

/* ─── Mode Tabs ──────────────────────────────────────────────────────── */
.mode-tabs {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 1.5rem;
}

.mode-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 24px;
    font-family: var(--font-primary);
    font-size: var(--font-base);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
    clip-path: polygon(8px 0, calc(100% - 8px) 0, 100% 8px, 100% calc(100% - 8px), calc(100% - 8px) 100%, 8px 100%, 0 calc(100% - 8px), 0 8px);
}

.mode-tab:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.3);
}

.mode-tab--active {
    color: var(--bg-primary);
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.mode-tab--active:hover {
    color: var(--bg-primary);
}


/* ─── Mode Cards ─────────────────────────────────────────────────────────── */
.mode-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-grid);
    width: 100%;
}

/* Uses global .card + .card-body */
.mode-cards .card {
    display: flex;
    cursor: pointer;
    transition: background 0.3s, filter 0.3s;
}

.mode-cards .card:hover {
    background: var(--accent-primary);
    filter: drop-shadow(0 0 12px rgba(0, 229, 255, 0.3));
}

.mode-cards .card--accent {
    background: rgba(0, 229, 255, 0.2);
}

.mode-cards .card--accent:hover {
    filter: drop-shadow(0 0 16px rgba(0, 229, 255, 0.4));
}

.mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 20px 24px;
    min-height: 200px;
    width: 100%;
    flex: 1;
    position: relative;
}

.mode-card__icon {
    color: var(--accent-primary);
    margin-bottom: 16px;
}

.mode-card h3 {
    font-family: var(--font-primary);
    font-size: var(--font-lg);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.mode-card p {
    font-size: var(--font-sm);
    color: var(--text-muted);
    line-height: 1.5;
    margin-bottom: 16px;
    flex: 1;
}

.mode-card__badge {
    position: absolute;
    top: 12px;
    right: 24px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 2px 8px;
    background: var(--accent-primary);
    color: var(--bg-primary);
    clip-path: polygon(4px 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px);
}

.mode-card__cta {
    font-family: var(--font-primary);
    font-size: var(--font-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-primary);
    margin-top: auto;
    transition: color 0.2s, text-shadow 0.2s;
}

.mode-cards .card:hover .mode-card__cta {
    color: var(--accent-primary);
    text-shadow: 0 0 6px rgba(0, 229, 255, 0.4);
}

/* ─── Searching Overlay ──────────────────────────────────────────────────── */
.searching-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.searching-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
    padding: 3rem;
}

.searching-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.searching-content h2 {
    font-size: var(--font-xl);
    font-weight: 700;
}

.searching-content p {
    color: var(--text-muted);
    font-size: var(--font-base);
}

/* ─── Room View ──────────────────────────────────────────────────────────── */
.room-view {
    flex: 1;
    padding: 2rem 0;
}

.room-container {
    max-width: 1100px;
}

/* ─── Room Header Bar ────────────────────────────────────────────────── */
.room-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    margin-bottom: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.room-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.room-mode-icon {
    color: var(--accent-primary);
    display: flex;
    flex-shrink: 0;
}

.room-mode-title {
    font-size: var(--font-base);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.room-ranked-tag {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 3px 10px;
    border: 1px solid var(--input-border);
    border-radius: 3px;
}

/* Room code group */
.room-code-group {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: 0.5rem;
}

.room-code-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.room-code {
    font-family: var(--font-mono, monospace);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: 0.08em;
}

.room-code-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.15rem;
    border-radius: 3px;
    transition: color 0.15s;
}

.room-code-copy:hover {
    color: var(--accent-primary);
}

/* Private toggle switch */
.room-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    user-select: none;
    margin-left: 0.5rem;
}

.room-toggle input {
    display: none;
}

.room-toggle-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.room-toggle-track {
    width: 28px;
    height: 16px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    position: relative;
    transition: background 0.2s;
}

.room-toggle input:checked ~ .room-toggle-track {
    background: var(--accent-primary);
}

.room-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.room-toggle input:checked ~ .room-toggle-track .room-toggle-thumb {
    transform: translateX(12px);
}

.room-header-leave {
    margin-left: auto;
}

.room-section-heading {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.room-player-count {
    font-size: var(--font-sm);
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.room-player-sep {
    color: var(--text-muted);
    opacity: 0.5;
    margin: 0 1px;
}

.room-code-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.room-code {
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 0.08em;
    color: var(--accent-primary);
    font-weight: 700;
    font-size: var(--font-sm);
    user-select: all;
}

/* Progress bar as bottom accent edge */
.room-header-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
}

.room-header-progress.hidden { display: none; }

.room-header-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent-primary);
    transition: width 0.4s ease;
}

.room-header-progress-complete .room-header-progress-fill {
    box-shadow: 0 0 8px rgba(0, 229, 255, 0.4);
}

/* ─── Room Panel (clip-path card containing players + chat) ──────────── */
.room-panel {
    padding: 1.5rem;
}

.room-panel h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

/* ─── Room Grid: Players left, Chat right ────────────────────────────── */
.room-grid {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 1.5rem;
    min-height: 400px;
}

.room-grid-left {
    display: flex;
    flex-direction: column;
}

.room-grid-right {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
    padding-left: 1.5rem;
}

.player-list-panel {
    flex: 1;
    overflow-y: auto;
    max-height: 55vh;
    scrollbar-width: thin;
    scrollbar-color: var(--input-border) transparent;
}

.player-list-panel::-webkit-scrollbar {
    width: 6px;
}

.player-list-panel::-webkit-scrollbar-track {
    background: transparent;
}

.player-list-panel::-webkit-scrollbar-thumb {
    background: var(--input-border);
    border-radius: 3px;
}

.chat-messages {
    flex: 1;
    min-height: 120px;
}

.chat-placeholder {
    color: var(--text-muted);
    font-size: var(--font-sm);
    font-style: italic;
    opacity: 0.5;
    padding: 1rem 0;
    text-align: center;
}

.room-actions {
    display: flex;
    gap: 0.75rem;
}

.room-actions .btn-full {
    flex: 1;
}


/* (Ready progress bar styles now in .room-header-progress above) */

/* ─── Default List Layout ────────────────────────────────────────────────── */
.player-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ─── Compact Card Grid (5+ players) ─────────────────────────────────────── */
.player-list.player-list-compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

/* ─── Team Grouping ─────────────────────────────────────────────────────── */

.team-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.5rem 0.25rem;
    margin-top: 0.75rem;
    border-bottom: 2px solid var(--team-color, var(--border-color));
    list-style: none;
    grid-column: 1 / -1;
}

.team-heading:first-child {
    margin-top: 0;
}

.team-heading-name {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--team-color, var(--text-muted));
}

.btn-switch-team {
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
    border: 1px solid var(--team-color, var(--border-color));
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--team-color, var(--text-muted));
    cursor: pointer;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: background 0.15s, color 0.15s;
}

.btn-switch-team:hover {
    background: var(--team-color, var(--border-color));
    color: #fff;
}

/* Team tint on player items — subtle left accent */
.player-item[style*="--team-color"] {
    border-left: 2px solid var(--team-color);
    margin-left: 2px;
}

/* In compact mode, use top border instead (cards) */
.player-list-compact .player-item[style*="--team-color"] {
    border-left: none;
    margin-left: 0;
    border-top: 2px solid var(--team-color);
}

/* ─── Compact Card Item ──────────────────────────────────────────────────── */
.player-list-compact .player-item {
    --rank-color: #c0c0c0;
    flex-direction: row;
    padding: 0;
    gap: 0;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, rgba(255,255,255,0.03) 100%);
    border: 1px solid rgba(255,255,255,0.06);
    overflow: hidden;
    position: relative;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.player-list-compact .player-item:hover {
    border-color: color-mix(in srgb, var(--rank-color) 40%, transparent);
    box-shadow: 0 0 12px color-mix(in srgb, var(--rank-color) 15%, transparent);
}

/* Avatar swatch — square, left-aligned, future-proof for uploaded images */
.card-avatar {
    width: 48px;
    aspect-ratio: 1;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--rank-color) 18%, var(--bg-tertiary));
    border-right: 2px solid color-mix(in srgb, var(--rank-color) 35%, transparent);
    background-size: cover;
    background-position: center;
}

.card-avatar-letter {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--rank-color);
    text-shadow: 0 0 10px color-mix(in srgb, var(--rank-color) 40%, transparent);
}

/* Card info — right side */
.card-info {
    flex: 1;
    min-width: 0;
    padding: 0.45rem 0.55rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.2rem;
}

/* Top row: name + ready icon */
.card-top {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.card-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    font-size: 0.82rem;
    line-height: 1.2;
}

.card-ready-icon {
    flex-shrink: 0;
    filter: drop-shadow(0 0 4px rgba(0, 229, 255, 0.4));
}

.card-waiting-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.3;
    flex-shrink: 0;
}

/* Bottom row: rank + ELO + badges */
.card-bottom {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.card-rank-label {
    font-size: 0.65rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1;
}

.card-rank-label.card-unranked {
    color: var(--text-muted);
    font-weight: 600;
    font-style: italic;
    opacity: 0.6;
}

.card-elo {
    font-size: 0.62rem;
    font-weight: 600;
    color: var(--text-muted);
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    line-height: 1;
}

/* Compact badges */
.player-list-compact .player-badge {
    font-size: 0.58rem;
    padding: 0.05rem 0.3rem;
    margin-left: auto;
}

/* Ready state */
.player-list-compact .player-item.player-ready {
    border-color: var(--accent-primary-dark);
    background: linear-gradient(135deg, var(--accent-primary-light) 0%, var(--bg-tertiary) 100%);
}

.player-list-compact .player-item.player-ready .card-avatar {
    background: var(--accent-primary-dark);
    border-right-color: var(--accent-primary-dark);
}

.player-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.player-item.player-self {
    /* Same as others — "You" badge is enough distinction */
}

.player-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}


.player-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-badge {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.1rem 0.5rem;
    border-radius: var(--radius-full);
}

.player-badge-host {
    background: var(--warning-bg);
    color: var(--warning);
}

.player-badge-bot {
    background: var(--accent-primary-light);
    color: var(--accent-primary);
}

.player-badge-you {
    background: var(--success-bg);
    color: var(--success);
}

.player-level {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--text-muted);
    margin-left: auto;
    margin-right: 8px;
}

/* Remove bot button */
.kick-player-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.15);
    cursor: pointer;
    border-radius: 50%;
    transition: color 0.15s, background 0.15s;
    padding: 0;
    flex-shrink: 0;
}

.kick-player-btn:hover {
    color: var(--danger);
    background: rgba(244, 67, 54, 0.12);
}

/* Bot Controls */
.bot-controls {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.bot-controls h4 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.bot-controls-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.bot-controls-row .form-control {
    flex: 1;
}

/* Game Starting Overlay */
.game-starting-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: var(--accent-primary);
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    animation: startingPulse 1.5s ease-in-out infinite;
}

.game-starting-overlay .spinner {
    animation: spin 1s linear infinite;
    color: var(--accent-primary);
    flex-shrink: 0;
}

@keyframes startingPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

/* Ready Button — Waiting State */
.btn-ready-waiting {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-color) !important;
    color: var(--text-muted) !important;
    cursor: default !important;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-ready-waiting .spinner {
    animation: spin 1s linear infinite;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ─── Ready State ────────────────────────────────────────────────────────── */

/* Steady state: subtle green tint */
.player-item.player-ready {
    background: var(--accent-primary-light);
    box-shadow: inset 0 0 0 1px var(--accent-primary-dark);
}

.player-item.player-ready .player-icon {
    background: var(--accent-primary-dark);
    color: var(--accent-primary);
}

/* ── Entry: row flash + shockwave ─────────────────────────────────────── */
.player-item.player-ready-enter {
    animation: ready-row-pulse 0.8s ease;
    position: relative;
    overflow: hidden;
}

/* Cyan flash that sweeps across the row */
.player-item.player-ready-enter::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(0, 229, 255, 0.3), transparent);
    animation: ready-sweep 0.6s ease-out forwards;
    pointer-events: none;
    z-index: 1;
}

@keyframes ready-row-pulse {
    0%   { background: var(--bg-tertiary); box-shadow: none; }
    15%  { background: rgba(0, 229, 255, 0.25); box-shadow: 0 0 20px rgba(0, 229, 255, 0.2), inset 0 0 0 1px rgba(0, 229, 255, 0.5); }
    40%  { background: rgba(0, 229, 255, 0.12); box-shadow: 0 0 10px rgba(0, 229, 255, 0.08), inset 0 0 0 1px rgba(0, 229, 255, 0.25); }
    100% { background: var(--accent-primary-light); box-shadow: inset 0 0 0 1px var(--accent-primary-dark); }
}

@keyframes ready-sweep {
    0%   { transform: translateX(-100%); opacity: 1; }
    100% { transform: translateX(100%); opacity: 0; }
}

/* ── Checkmark container ──────────────────────────────────────────────── */
.ready-check {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--accent-primary);
    position: relative;
}

.ready-check-pending {
    color: var(--text-muted);
}

/* ── Shockwave ring expanding from the checkmark ──────────────────────── */
.player-ready-enter .ready-check::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
    animation: ready-shockwave 0.7s ease-out 0.2s forwards;
    opacity: 0;
}

@keyframes ready-shockwave {
    0%   { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(2.8); opacity: 0; }
}

/* ── SVG stroke-draw animations (only on new ready) ──────────────────── */
.player-ready-enter .ready-check-circle {
    stroke-dasharray: 63;
    stroke-dashoffset: 63;
    animation: ready-circle-draw 0.4s ease forwards;
}

.player-ready-enter .ready-check-mark {
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
    animation: ready-check-draw 0.3s ease 0.3s forwards;
}

@keyframes ready-circle-draw {
    to { stroke-dashoffset: 0; }
}

@keyframes ready-check-draw {
    to { stroke-dashoffset: 0; }
}

/* ── Check icon bounces in ────────────────────────────────────────────── */
.player-ready-enter .ready-check svg {
    animation: ready-check-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.1s both;
}

@keyframes ready-check-pop {
    0%   { transform: scale(0) rotate(-45deg); opacity: 0; }
    50%  { transform: scale(1.4) rotate(5deg); opacity: 1; }
    75%  { transform: scale(0.9) rotate(-2deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}


/* ── Reduced motion ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .player-item.player-ready-enter,
    .player-item.player-ready-enter::before,
    .player-ready-enter .ready-check::after,
    .player-ready-enter .ready-check svg,
    .ready-check-circle,
    .ready-check-mark {
        animation: none;
    }
    .ready-check-circle { stroke-dashoffset: 0; }
    .ready-check-mark   { stroke-dashoffset: 0; }
}

/* Room Actions (sticky defined above, layout here) */
.room-actions .btn {
    width: 100%;
    justify-content: center;
}

.room-actions .btn-lg {
    gap: 0.5rem;
}

.room-actions .btn-lg svg {
    flex-shrink: 0;
}

/* ─── Game View ──────────────────────────────────────────────────────────── */
.game-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
}

/* ─── Multiplayer Game Container (CSS Grid, mode-aware) ─────────────────── */
.multiplayer-game-container {
    display: grid;
    align-items: start;
    justify-content: center;
    gap: 0.75rem;
    flex: 1;
    padding: 0 1rem;
    margin: 0 auto;
    width: 100%;
}

/* ─── Spectate Mode ─────────────────────────────────────────────────────── */

body.spectating .game-sidebar-left,
body.spectating .game-sidebar-right,
body.spectating .game-center-column {
    display: none;
}

body.spectating .multiplayer-game-container[data-layout] {
    display: block;
    max-width: 100%;
    padding: 0;
}

body.spectating .opponents-zone {
    max-height: none;
    overflow: visible;
    width: 90%;
    margin: 0 auto;
    padding: 20px 0;
}

body.spectating .spectate-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 15px;
}

body.spectating .opponent-mini {
    position: relative;
    padding: 0;
    border: none;
    background: none;
}

body.spectating .opponent-mini .board {
    width: 100%;
    aspect-ratio: 1 / 2;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

body.spectating .opponent-mini canvas {
    display: block;
    width: 100%;
    height: 100%;
}

body.spectating .opponent-name {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-primary);
    max-width: none;
    padding: 2px 0;
}

body.spectating .opponent-score {
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent-primary);
}

body.spectating .opponent-name {
    font-size: 0.9rem;
    max-width: none;
}

body.spectating .opponent-score {
    font-size: 0.8rem;
}

/* Elimination animation in spectate */
.spectate-eliminating {
    animation: spectate-eliminate 0.6s ease forwards;
}

@keyframes spectate-eliminate {
    0% { opacity: 1; transform: scale(1); }
    30% { opacity: 1; transform: scale(1.05); border-color: var(--danger); box-shadow: 0 0 20px rgba(244, 67, 54, 0.4); }
    100% { opacity: 0; transform: scale(0.8); }
}

/* Layout: Duel (1v1) — side by side */
.multiplayer-game-container[data-layout="duel"] {
    grid-template-columns: auto auto auto 1rem auto;
    grid-template-areas: "sidebar-l center sidebar-r . opponents";
    max-width: 1400px;
}

/* Layout: Arena (2-7 opponents) — board + grid */
.multiplayer-game-container[data-layout="arena"] {
    grid-template-columns: auto auto auto auto auto;
    grid-template-areas: "sidebar-l center sidebar-r . opponents";
    max-width: 1400px;
}

/* Layout: Colosseum (8-63 opponents) — featured opponents */
.multiplayer-game-container[data-layout="colosseum"] {
    grid-template-columns: auto auto auto 1rem auto;
    grid-template-areas: "sidebar-l center sidebar-r . opponents";
    max-width: 1600px;
}

/* Grid area assignments */
.game-sidebar-left   { grid-area: sidebar-l; }
.game-center-column  { grid-area: center; }
.game-sidebar-right  { grid-area: sidebar-r; }
.opponents-zone      { grid-area: opponents; }



/* Game Sidebars */
.game-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.game-sidebar-left {
    align-items: stretch;
    width: 160px;
}

.game-sidebar-right {
    align-items: flex-start;
}

/* Sidebar boxes (Hold, Stats — same width) */
.sidebar-box {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.6rem;
}

.sidebar-box-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.hold-box {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hold-box .sidebar-box-label {
    align-self: flex-start;
}

.hold-box canvas {
    display: block;
}

.stats-box {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

/* Next panel (right sidebar) */
.panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.5rem;
}

.panel-title {
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.next-panel canvas {
    display: block;
}

/* Stat items */
.stat-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.stat-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

/* Center column: board only */
.game-center-column {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Game Board Wrapper */
/* Shared board container — used for own board AND opponent boards */
.board {
    position: relative;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    line-height: 0;
}

.board canvas {
    display: block;
}

/* ─── Garbage Indicator ──────────────────────────────────────────────────── */
.garbage-indicator {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 6px;
    height: 0;
    background: var(--danger);
    opacity: 0.85;
    transition: height 0.3s ease;
    border-radius: 0 3px 0 0;
    z-index: 5;
}

.garbage-indicator.garbage-warning {
    background: var(--warning);
}

.garbage-indicator.garbage-danger {
    background: var(--danger);
    animation: garbage-pulse 0.8s ease-in-out infinite;
}

@keyframes garbage-pulse {
    0%, 100% { opacity: 0.85; }
    50% { opacity: 0.4; }
}

/* ─── Targeting Selector (vertical in left sidebar) ────────────────────── */

.targeting-box {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.targeting-box .sidebar-box-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.targeting-box .sidebar-box-label kbd {
    font-size: 0.5rem;
    padding: 0.05rem 0.25rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    color: var(--text-muted);
    font-family: inherit;
    line-height: 1.3;
}

.targeting-btn {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.35rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    width: 100%;
    text-align: left;
}

.targeting-btn:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.04);
}

.targeting-btn kbd {
    font-size: 0.6rem;
    min-width: 1rem;
    text-align: center;
    padding: 0.05rem 0.2rem;
    border: 1px solid var(--border-color);
    border-radius: 2px;
    color: var(--text-muted);
    font-family: inherit;
    line-height: 1.3;
}

.targeting-btn.active {
    border-color: var(--accent-primary);
    background: rgba(0, 188, 212, 0.1);
    color: var(--accent-primary);
}

.targeting-btn.active kbd {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* ─── In-Game: Fade nav, show ticker ───────────────────────────────────── */

body.ingame .navbar .nav-menu,
body.ingame .navbar .nav-toggle {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

body.ingame .navbar {
    background: transparent;
    border-bottom-color: transparent;
    pointer-events: none;
}

body.ingame .navbar .nav-brand {
    pointer-events: auto;
    position: relative;
    z-index: 2;
}

/* ─── Game Ticker (sticky top bar) ─────────────────────────────────────── */

.game-ticker {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: calc(var(--z-navbar) - 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    height: 56px;
    padding: 0 1rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
}

.ticker-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.ticker-label {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ticker-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #fff;
}

#aliveDisplay .ticker-value { color: var(--accent-primary); }
#badgeDisplay .ticker-value { color: #FFD700; }
#koDisplay .ticker-value { color: #ff4444; }
#attackerDisplay .ticker-value { color: #ff8c00; }


/* Badge glow at high levels */
.badge-level-1 #badgeDisplay { filter: brightness(1.1); }
.badge-level-2 #badgeDisplay { filter: brightness(1.2); text-shadow: 0 0 6px rgba(255, 215, 0, 0.3); }
.badge-level-3 #badgeDisplay { filter: brightness(1.3); text-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
.badge-level-4 #badgeDisplay { filter: brightness(1.5); text-shadow: 0 0 16px rgba(255, 215, 0, 0.7); animation: badge-glow 1.5s ease-in-out infinite alternate; }

@keyframes badge-glow {
    from { filter: brightness(1.3); }
    to { filter: brightness(1.7); }
}

/* ─── KO Feed ────────────────────────────────────────────────────────────── */

.ko-feed {
    position: absolute;
    top: 60px;
    right: -160px;
    width: 150px;
    z-index: 10;
    pointer-events: none;
}

.ko-feed-item {
    padding: 0.25rem 0.4rem;
    margin-bottom: 0.2rem;
    background: rgba(0, 0, 0, 0.7);
    border-left: 2px solid #ff4444;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.8);
    animation: ko-feed-in 0.3s ease-out, ko-feed-out 0.3s ease-in 4s forwards;
}

.ko-feed-item .ko-killer { color: var(--accent-primary); font-weight: 700; }
.ko-feed-item .ko-victim { color: #ff6666; }

@keyframes ko-feed-in {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes ko-feed-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ─── Escalation Phases ──────────────────────────────────────────────────── */

.escalation-tense .board {
    box-shadow: inset 0 0 20px rgba(255, 165, 0, 0.1);
}

.escalation-intense .board {
    box-shadow: inset 0 0 30px rgba(255, 69, 0, 0.15);
}

.escalation-final .board {
    box-shadow: inset 0 0 40px rgba(255, 0, 0, 0.2);
    animation: final-pulse 2s ease-in-out infinite alternate;
}

@keyframes final-pulse {
    from { box-shadow: inset 0 0 30px rgba(255, 0, 0, 0.15); }
    to { box-shadow: inset 0 0 50px rgba(255, 0, 0, 0.25); }
}

/* ─── Fatigue Warning ────────────────────────────────────────────────────── */

.fatigue-warning {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 0, 0, 0.15);
    border: 1px solid rgba(255, 0, 0, 0.4);
    color: #ff6666;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    z-index: 20;
    animation: fatigue-flash 0.5s ease-out;
    pointer-events: none;
}

@keyframes fatigue-flash {
    from { opacity: 0; transform: translate(-50%, -50%) scale(1.3); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* ─── Room Chat ──────────────────────────────────────────────────────────── */

.chat-messages {
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    max-height: 280px;
    padding: 0.5rem;
    font-size: 0.8rem;
    scrollbar-width: thin;
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
}

.chat-msg {
    margin-bottom: 0.2rem;
    line-height: 1.3;
    word-break: break-word;
}

.chat-msg-user {
    font-weight: 700;
    color: var(--accent-primary);
}

.chat-msg-text {
    color: rgba(255, 255, 255, 0.8);
}

.chat-msg-system {
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

.chat-input-row {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.chat-input-row #chatSendBtn {
    display: none;
}

.chat-input {
    flex: 1;
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    .chat-input-row #chatSendBtn {
        display: inline-flex;
    }
}

/* ─── Quick Chat Bubble ──────────────────────────────────────────────────── */

.quick-chat-bubble {
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 188, 212, 0.9);
    color: #fff;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.65rem;
    font-weight: 600;
    white-space: nowrap;
    z-index: 15;
    animation: qc-pop 0.3s ease-out, qc-fade 0.3s ease-in 2s forwards;
    pointer-events: none;
}

@keyframes qc-pop {
    from { opacity: 0; transform: translateX(-50%) scale(0.5) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}

@keyframes qc-fade {
    to { opacity: 0; }
}

/* ─── Room Actions Sticky ────────────────────────────────────────────────── */

.room-actions {
    position: sticky;
    bottom: 0;
    background: var(--bg-primary);
    padding: 0.75rem 0;
    z-index: 10;
}

/* ─── Game Overlays ──────────────────────────────────────────────────────── */
.game-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(10, 10, 20, 0.9);
    z-index: 10;
}

.overlay-content {
    text-align: center;
    color: #ffffff;
    padding: 1.5rem;
}

.overlay-content h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.overlay-hint {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.95rem;
}

/* ─── Opponents Zone ─────────────────────────────────────────────────────── */
.opponents-zone {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-self: stretch;
    overflow: hidden;
}

/* ─── BR Fixed Wrapper (same size as duel board, never changes) ─────────── */
.br-wrapper {
    line-height: normal;
    /* width + height set inline to COLS*cellSize × ROWS*cellSize */
}

/* ─── BR Compact Leaderboard ────────────────────────────────────────────── */
.br-leaderboard {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.br-lb-header {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
}

.br-lb-alive {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--accent-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.br-lb-alive-total {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.br-lb-alive-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

.br-lb-entry {
    display: grid;
    grid-template-columns: 2rem 1fr auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem;
    height: 80px;
    min-height: 80px;
    max-height: 80px;
    border-left: 3px solid transparent;
    position: relative;
    overflow: hidden;
    will-change: transform;
    transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), background 0.2s;
    box-sizing: border-box;
}

.br-lb-entry:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.br-lb-entry.self {
    border-left-color: var(--accent-primary);
    background: rgba(0, 229, 255, 0.08);
}

.br-lb-entry.lb-hidden {
    display: none;
}

.br-lb-sep {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.25rem 0;
    letter-spacing: 0.3em;
    flex-shrink: 0;
}

.br-lb-rank {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-muted);
    text-align: center;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.br-lb-entry[data-rank="1"] .br-lb-rank { color: #ffd700; font-size: 1.1rem; }
.br-lb-entry[data-rank="2"] .br-lb-rank { color: #c0c0c0; }
.br-lb-entry[data-rank="3"] .br-lb-rank { color: #cd7f32; }

.br-lb-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.br-lb-score {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-primary);
    font-variant-numeric: tabular-nums;
    text-align: right;
    transition: transform 0.2s;
}

/* Elimination — flash red at current position, slide out */
.br-lb-entry.lb-eliminating {
    animation: lb-eliminate 0.8s ease forwards;
    pointer-events: none;
}

@keyframes lb-eliminate {
    0%   { opacity: 1; background: transparent; }
    15%  { opacity: 1; background: rgba(244, 67, 54, 0.35); border-left-color: var(--danger); }
    40%  { opacity: 1; background: rgba(244, 67, 54, 0.2); }
    100% { opacity: 0; transform: translateX(100%); }
}

/* Score bump */
.br-lb-score.score-bumped {
    animation: score-bump 0.35s ease;
}

@keyframes score-bump {
    0% { transform: scale(1); color: var(--accent-primary); }
    40% { transform: scale(1.2); color: #fff; }
    100% { transform: scale(1); color: var(--accent-primary); }
}

/* Fade-out before board transition */
.br-leaderboard.fading-out {
    transition: opacity 0.35s ease;
    opacity: 0;
}

/* ─── BR Board Grid (inside fixed wrapper) ──────────────────────────────── */
.br-board-grid {
    display: grid;
    width: 100%;
    height: 100%;
    gap: 4px;
    padding: 4px;
    box-sizing: border-box;
    align-content: stretch;
}

/* Grid columns + rows set dynamically by _applyBoardGridLayout() */

.br-board-grid .opponent-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.5s ease;
    min-width: 0;
    min-height: 0;
}

.br-board-grid .opponent-mini .board {
    border: none;
    overflow: hidden;
    /* width + height set by JS to maintain 1:2 aspect */
}

.br-board-grid .opponent-mini canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.br-board-grid .opponent-name {
    font-size: 0.6rem;
    max-width: none;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    padding: 1px 2px;
}

.br-board-grid .opponent-score {
    font-size: 0.55rem;
}

/* Board appearing animation */
.br-board-grid .opponent-mini.board-appearing {
    animation: board-appear 0.5s ease forwards;
}

@keyframes board-appear {
    0% { opacity: 0; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1); }
}

/* Board dead — stays in grid, dimmed red, until grid rescales */
.br-board-grid .opponent-mini.board-dead {
    animation: board-die 0.5s ease forwards;
    pointer-events: none;
}

@keyframes board-die {
    0% { opacity: 1; }
    30% { border-color: var(--danger); box-shadow: 0 0 15px rgba(244, 67, 54, 0.4); }
    100% { opacity: 0.25; border-color: var(--danger); }
}

/* Batch remove — all dead boards fade out together before rescale */
.br-board-grid .opponent-mini.board-removing {
    animation: board-remove 0.3s ease forwards;
    pointer-events: none;
}

@keyframes board-remove {
    0% { opacity: 0.25; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.8); }
}

/* ─── Variant: COMPACT (Top N + You) ───────────────────────────────────── */
.br-compact {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.br-compact-list {
    flex: 1;
    overflow: hidden;
}

.br-compact-self {
    flex-shrink: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: auto;
}

.br-compact-header {
    display: flex;
    align-items: baseline;
    gap: 0.3rem;
    padding: 0.25rem 0.75rem 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 0.25rem;
}

.br-compact-alive {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--accent-primary);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.br-compact-alive-of {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.br-compact-alive-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

.br-compact-entry {
    display: grid;
    grid-template-columns: 2rem 1fr auto;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem;
    height: 50px;
    min-height: 50px;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    will-change: transform;
    border-left: 3px solid transparent;
    box-sizing: border-box;
}

.br-compact-entry.self {
    border-left-color: var(--accent-primary);
    background: rgba(0, 229, 255, 0.08);
}

.br-compact-rank {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-muted);
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.br-compact-entry[data-rank="1"] .br-compact-rank { color: #ffd700; }
.br-compact-entry[data-rank="2"] .br-compact-rank { color: #c0c0c0; }
.br-compact-entry[data-rank="3"] .br-compact-rank { color: #cd7f32; }

.br-compact-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.br-compact-score {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-primary);
    font-variant-numeric: tabular-nums;
}

/* Slot: someone was eliminated from this position */
.br-compact-entry.slot-eliminated {
    animation: slot-elim 0.6s ease;
}

@keyframes slot-elim {
    0% { background: transparent; }
    15% { background: rgba(244, 67, 54, 0.35); }
    40% { background: rgba(244, 67, 54, 0.15); }
    100% { background: transparent; }
}

/* Slot: different player slid into this position */
.br-compact-entry.slot-swap {
    animation: slot-swap 0.4s ease;
}

@keyframes slot-swap {
    0% { background: transparent; }
    30% { background: rgba(0, 229, 255, 0.1); }
    100% { background: transparent; }
}

/* --- Duel: Single large opponent board --- */
.duel-opponent {
    display: flex;
    flex-direction: column;
    align-items: center;
}


/* --- Duel Scoreboard (top bar for 1v1) --- */
.duel-scoreboard {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: calc(var(--z-navbar) - 1);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 56px;
    padding: 0 1rem;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.duel-player {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 200px;
}

.duel-player--self {
    justify-content: flex-end;
    text-align: right;
}

.duel-player--opp {
    justify-content: flex-start;
    text-align: left;
}

.duel-player-name {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-primary);
}

.duel-player--self .duel-player-name {
    color: var(--accent-primary);
}

.duel-player-stats {
    display: flex;
    gap: 0.75rem;
}

.duel-stat {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

.duel-stat-label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.duel-stat-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.duel-scoreboard-vs {
    font-size: 1rem;
    font-weight: 900;
    color: var(--accent-primary);
    text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
    padding: 0 1.5rem;
    letter-spacing: 0.1em;
}


/* --- Arena: 2-column opponent grid --- */
.opp-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

/* --- Opponent mini card (Arena + Colosseum featured) --- */
.opponent-mini {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--card-shadow);
    transition: border-color var(--transition-fast), opacity var(--transition-base);
    position: relative;
}

.opponent-mini.targeted {
    border-color: var(--warning);
    box-shadow: 0 0 8px rgba(255, 152, 0, 0.3);
}

.opponent-mini.attacker {
    border-color: #ff4444;
    box-shadow: 0 0 6px rgba(255, 68, 68, 0.25);
}

.opponent-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-primary);
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}


/* Team indicators on boards */
.board[data-team="1"] { border-color: var(--team-1); }
.board[data-team="2"] { border-color: var(--team-2); }
.board[data-team="3"] { border-color: var(--team-3); }
.board[data-team="4"] { border-color: var(--team-4); }

.opponent-team-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.opponent-team-label.ally { color: var(--team-1); }
.opponent-team-label.enemy { color: var(--team-2); }

.opponent-score {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.opponent-placement {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--danger);
    display: none;
}

/* Eliminated opponent card */
.opponent-mini.eliminated {
    opacity: 0.4;
}

.opponent-mini.eliminated .board {
    filter: grayscale(1);
}

.opponent-mini.eliminated .opponent-placement {
    display: block;
}

/* --- Colosseum: Featured opponents (2-col mini grid) --- */
.opp-featured {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
}



/* ─── Results Overlay ────────────────────────────────────────────────────── */
.results-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    padding: 1.5rem;
}

.results-content {
    width: 100%;
    max-width: 500px;
    padding: 2rem;
    animation: modal-in 0.3s ease forwards;
}

.results-content h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* Team Results Groups */
.results-team-group {
    margin-bottom: 1.25rem;
}

.results-team-group:last-child {
    margin-bottom: 0;
}

.results-team-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.results-team-name {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--team-color, var(--text-primary));
    letter-spacing: 0.04em;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}


.trophy-icon {
    vertical-align: middle;
    color: inherit;
}

.results-team-total {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.results-team-group .results-table {
    margin-bottom: 0;
}

.badge-mvp {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 0.15rem 0.5rem;
    margin-left: 0.5rem;
    background: var(--accent-primary);
    color: var(--bg-primary);
    clip-path: polygon(4px 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px);
    vertical-align: text-bottom;
    line-height: 1.3;
}

/* Results Table */
.results-table {
    width: 100%;
    margin-bottom: 1.5rem;
}

.results-table thead {
    background: rgba(255, 255, 255, 0.04);
}

.results-table th {
    padding: 0.6rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    text-align: left;
}

.results-table td {
    padding: 0.6rem 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 1rem;
}

.results-table tr.result-self {
    background: var(--accent-primary-light);
}

.result-placement {
    font-weight: 800;
    font-size: 1rem;
}

/* Results dialog header: title left, button right */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 1rem;
}

.results-title {
    font-size: var(--font-xl);
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-primary);
    margin: 0;
}

.dialog-results .db-buttons {
    display: none;
}

.result-placement-1 { color: #ffd700; }
.result-placement-2 { color: #c0c0c0; }
.result-placement-3 { color: #cd7f32; }

.rating-up { color: #4caf50; font-size: 0.8em; font-weight: 600; }
.rating-down { color: #f44336; font-size: 0.8em; font-weight: 600; }
.xp-gain { color: var(--accent-primary); font-size: 0.75em; font-weight: 600; }

.results-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

/* ─── Victory Dialog ─────────────────────────────────────────────────────── */
.dialog-results .db-buttons,
.dialog-results-top3 .db-buttons { display: none; }

/* Radial glow behind hero for top 3 */
.dialog-results-top3 .db-body::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 180px;
    background: radial-gradient(ellipse 60% 80% at 50% 0%, rgba(255,200,50,0.12) 0%, transparent 70%);
    pointer-events: none;
}

.dialog-results .db-body,
.dialog-results-top3 .db-body { position: relative; overflow: hidden; }

/* Hero */
.vr-hero {
    text-align: center;
    position: relative;
    z-index: 1;
    margin-bottom: 1.5rem;
}

.vr-rank {
    font-size: 4rem;
    font-weight: 700;
    letter-spacing: -2px;
    line-height: 1;
    color: #6b7280;
}
.vr-rank-gold {
    background: linear-gradient(135deg, #ffd54f, #ffab00, #ffd54f);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: vr-shimmer 3s linear infinite;
}
@keyframes vr-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.vr-victory-label {
    font-size: 1.1rem;
    letter-spacing: 5px;
    text-transform: uppercase;
    color: #ffab00;
    margin: 4px 0 8px;
    font-weight: 600;
}

.vr-player-name {
    font-size: 2.2rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.5px;
}

.vr-mode-tag {
    display: inline-block;
    font-size: 0.65rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #6b7280;
    margin-top: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 4px 14px;
}

/* Stats grid — score column wider */
.vr-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}
.vr-stat {
    background: #1a1e24;
    border-radius: 10px;
    padding: 12px 10px;
    text-align: center;
    border: 1px solid #2a2e35;
    flex: 1;
    min-width: 80px;
    max-width: 140px;
}
.vr-stat-primary {
    border-color: rgba(255, 171, 0, 0.27);
    background: linear-gradient(180deg, #1f1c14 0%, #1a1e24 100%);
}
.vr-stat-val {
    font-size: 1.35rem;
    font-weight: 600;
    color: #fff;
}
.vr-stat-primary .vr-stat-val {
    color: #ffd54f;
    font-size: 1.6rem;
}
.vr-stat-label {
    font-size: 0.6rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #6b7280;
    margin-top: 2px;
}

/* Leaderboard */
.vr-lb { position: relative; z-index: 1; }
.vr-lb-title {
    font-size: 0.6rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.2);
    margin-bottom: 0.5rem;
}
.vr-lb-row {
    display: grid;
    grid-template-columns: 28px 1fr auto auto;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 4px;
    background: #1a1e24;
    position: relative;
    overflow: hidden;
    animation: vr-fade-up 0.4s ease both;
}
/* Score bar behind row — gradient from left (bright) to right (fade) */
.vr-lb-row::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: linear-gradient(90deg, var(--bar-color, #2a2e35), transparent);
    width: var(--bar-w, 0%);
    opacity: 0.2;
    border-radius: 8px;
    transition: width 0.8s ease;
}
.vr-lb-me {
    border: 1px solid rgba(255, 171, 0, 0.2);
}
.vr-lb-me::before { opacity: 0.2; }

.vr-lb-pos {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--pos-color, #4b5563);
    z-index: 1;
}
.vr-lb-name {
    font-size: 0.85rem;
    color: #c8cdd4;
    z-index: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vr-lb-me .vr-lb-name { color: #fff; font-weight: 500; }
.vr-lb-score {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--score-color, #00e5ff);
    z-index: 1;
    text-align: right;
}
.vr-lb-lines {
    font-size: 0.75rem;
    color: #6b7280;
    z-index: 1;
    min-width: 24px;
    text-align: right;
}

/* Stagger rows */
.vr-lb-row:nth-child(2) { animation-delay: 0.05s; }
.vr-lb-row:nth-child(3) { animation-delay: 0.10s; }
.vr-lb-row:nth-child(4) { animation-delay: 0.15s; }
.vr-lb-row:nth-child(5) { animation-delay: 0.20s; }
.vr-lb-row:nth-child(6) { animation-delay: 0.25s; }
.vr-lb-row:nth-child(7) { animation-delay: 0.30s; }
.vr-lb-row:nth-child(8) { animation-delay: 0.35s; }
.vr-lb-row:nth-child(9) { animation-delay: 0.40s; }
.vr-lb-row:nth-child(10) { animation-delay: 0.45s; }
.vr-lb-row:nth-child(11) { animation-delay: 0.50s; }

@keyframes vr-fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── 1v1 Head-to-Head ── */
.vr-h2h {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.vr-h2h-player { text-align: center; }

.vr-h2h-crown {
    font-size: 0.6rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #ffab00;
    min-height: 1em;
}

.vr-h2h-loser-crown { color: #f87171; opacity: 0.6; }

.vr-h2h-name {
    font-size: clamp(0.85rem, 4vw, 1.35rem);
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vr-h2h-p2 .vr-h2h-name { color: #6b7280; }

.vr-h2h-vs {
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffd54f, #ffab00, #ffd54f);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: vr-shimmer 3s linear infinite;
}

.vr-h2h-sub {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
    font-size: 0.75rem;
    color: #6b7280;
}

.vr-rc-pos { color: #6ee7b7; font-weight: 600; }
.vr-rc-neg { color: #f87171; font-weight: 600; }
.vr-h2h-xp { color: #6b7280; font-weight: 500; }

/* ── Stat comparison rows (FIFA-style) ── */
.vr-vs-stats { position: relative; z-index: 1; }

.vr-stat-row {
    display: grid;
    grid-template-columns: 70px 1fr auto 1fr 70px;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.vr-sr-val {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    font-variant-numeric: tabular-nums;
}
.vr-sr-left { text-align: right; }
.vr-sr-right { text-align: left; }
.vr-sr-winner { color: #ffd54f; }
.vr-sr-loser { color: #6b7280; }

.vr-sr-label {
    font-size: 0.6rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #6b7280;
    text-align: center;
    padding: 0 8px;
    min-width: 60px;
}

.vr-sr-bar-wrap {
    height: 6px;
    border-radius: 3px;
    background: #1a1e24;
    overflow: hidden;
    display: flex;
}

/* Left bars align to the right (grow towards center) */
.vr-sr-bar-wrap.vr-sr-bar-left {
    justify-content: flex-end;
}

.vr-sr-bar {
    height: 100%;
    border-radius: 3px;
    animation: vr-bar-grow 0.8s ease both;
}

/* Left bar: grows from right edge towards left (towards center) */
.vr-sr-bar-wrap.vr-sr-bar-left .vr-sr-bar {
    transform-origin: right center;
}

/* Right bar: grows from left edge towards right (away from center) */
.vr-sr-bar-wrap:not(.vr-sr-bar-left) .vr-sr-bar {
    transform-origin: left center;
}

/* Left (winner): bright near the number, dark towards center */
.vr-sr-bar-wrap.vr-sr-bar-left .vr-sr-gold { background: linear-gradient(90deg, #ffab00, #ffd54f); }
/* Right (loser): dark near center, dim towards the number */
.vr-sr-dim { background: linear-gradient(90deg, rgba(248,113,113,0.35), rgba(248,113,113,0.15)); }
.vr-sr-bar-wrap.vr-sr-bar-left .vr-sr-dim { background: linear-gradient(90deg, rgba(248,113,113,0.15), rgba(248,113,113,0.35)); }

@keyframes vr-bar-grow {
    from { transform: scaleX(0); }
    to { transform: scaleX(1); }
}

/* ── WIN / LOSS footer ── */
.vr-vs-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, #2a2e35, transparent);
    margin: 16px 0;
}

.vr-vs-result {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    text-align: center;
    gap: 12px;
    padding: 6px 0;
}

.vr-vs-result-tag {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}
.vr-vs-win-tag { color: #ffd54f; }
.vr-vs-loss-tag { color: #f87171; opacity: 0.6; }
.vr-vs-result-dash { color: #2a2e35; font-size: 1.25rem; }

/* ── Section label ── */
.vr-section-label {
    font-size: 0.6rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #4b5563;
    margin: 12px 0 8px;
}

/* ── Player cards grid (2v2 / 4v4) ── */
.vr-players-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.vr-pc {
    background: #1a1e24;
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid #2a2e35;
}

.vr-pc-winner { border-color: rgba(255,171,0,0.15); }

.vr-pc-mvp {
    border-color: rgba(255,171,0,0.35);
    background: linear-gradient(180deg, #1f1c14 0%, #1a1e24 100%);
}

.vr-pc-loser .vr-pc-name { color: #9ca3af; }
.vr-pc-loser .vr-pc-stat-val { color: #9ca3af; }

.vr-pc-lose-mvp { border-color: rgba(248,113,113,0.2); }

.vr-pc-badge-lose {
    background: rgba(248,113,113,0.12);
    color: #f87171;
}

.vr-pc-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.vr-pc-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vr-pc-badge {
    font-size: 0.55rem;
    padding: 2px 6px;
    border-radius: 8px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    background: rgba(255,171,0,0.15);
    color: #ffd54f;
    flex-shrink: 0;
}

.vr-pc-sub {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.65rem;
    color: #6b7280;
    margin-bottom: 6px;
}

.vr-pc-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.vr-pc-stats-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.vr-pc-stat { text-align: center; }

.vr-pc-stat-val {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
}

.vr-pc-stat-lbl {
    font-size: 0.55rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #6b7280;
}

/* Back bar — sticky bottom with fade gradient */
.vr-back-bar {
    position: sticky;
    bottom: -32px;
    margin: 0 -32px -32px;
    padding: 48px 32px 16px;
    background: linear-gradient(transparent, var(--card-bg) 35%);
    text-align: center;
    z-index: 2;
}

.vr-back-link {
    min-width: 200px;
}

/* ─── Touch Controls ─────────────────────────────────────────────────────── */
.touch-controls {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 1rem 1rem;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.touch-row {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.touch-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.touch-btn:active {
    background: var(--accent-primary-light);
    border-color: var(--accent-primary);
}

.touch-btn-wide {
    width: 100px;
}

/* ─── Responsive: Tablet (768px - 1023px) ────────────────────────────────── */
@media (max-width: 1023px) {
    .multiplayer-game-container[data-layout] {
        grid-template-columns: auto auto auto;
        grid-template-rows: 1fr auto;
        grid-template-areas:
            "sidebar-l center sidebar-r"
            "opponents opponents opponents";
    }


    .opponents-zone {
        max-height: none;
        overflow-y: visible;
    }

    .opp-grid, .opp-featured {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
        justify-content: center;
    }

}

/* ─── Responsive: Mobile (768px) ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .room-grid {
        grid-template-columns: 1fr;
    }

    .room-grid-right {
        border-left: none;
        padding-left: 0;
        border-top: 1px solid var(--border-color);
        padding-top: 1rem;
    }

    .player-list.player-list-compact {
        grid-template-columns: repeat(2, 1fr);
    }

    .player-list-panel {
        max-height: 35vh;
    }

    .room-header {
        gap: 0.5rem;
    }

    .mode-cards {
        grid-template-columns: 1fr 1fr;
    }

    .multiplayer-game-container[data-layout] {
        gap: 0.5rem;
    }

    .game-sidebar {
        min-width: 70px;
    }

    .stats-panel {
        min-width: 70px;
    }

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

    .stat-value {
        font-size: 0.9rem;
    }

    .panel {
        padding: 0.5rem;
    }

    .panel-title {
        font-size: 0.7rem;
    }

    .opponents-zone {
        display: none;
    }


    /* Show touch controls on mobile */
    .touch-controls {
        display: flex;
    }

    .results-content {
        padding: 1.25rem;
    }

    .results-actions {
        flex-direction: column;
    }
}

/* ─── Responsive: Small Mobile (480px) ───────────────────────────────────── */
@media (max-width: 480px) {
    .mode-cards {
        grid-template-columns: 1fr;
    }

    .game-sidebar-left {
        display: none;
    }

    .game-sidebar-right .next-panel canvas {
        width: 80px;
        height: 320px;
    }

    .game-sidebar {
        min-width: 50px;
    }

    .multiplayer-game-container {
        padding: 0 0.5rem;
    }

    .touch-btn {
        width: 48px;
        height: 48px;
    }

    .touch-btn-wide {
        width: 80px;
    }

    .countdown-number {
        font-size: 3.5rem;
    }
}

/* ─── Print ──────────────────────────────────────────────────────────────── */
@media print {
    .multiplayer-wrapper {
        display: none;
    }
}

/* ─── Reduced Motion ─────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .connection-status-connecting .connection-dot,
    .garbage-indicator.garbage-danger,
    .countdown-number,
    .line-clear-notify span {
        animation: none;
    }

    .garbage-indicator {
        transition: none;
    }

    .modal-content {
        animation: none;
    }
}
