/* ===========================================
   VIP Arcade — Games Hub & In-Game Styles
   Ocean-themed, glassmorphism, modern & playful
   =========================================== */

/* ============ Bubbles Decoration ============ */
.arcade-bubbles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.arcade-bubbles .bubble {
    position: absolute;
    bottom: -60px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(6, 182, 212, 0.18), rgba(139, 92, 246, 0.08));
    animation: bubble-rise linear infinite;
}

.bubble:nth-child(1) { width: 30px; height: 30px; left: 8%;  animation-duration: 14s; animation-delay: 0s; }
.bubble:nth-child(2) { width: 20px; height: 20px; left: 25%; animation-duration: 18s; animation-delay: 2s; }
.bubble:nth-child(3) { width: 40px; height: 40px; left: 50%; animation-duration: 12s; animation-delay: 4s; }
.bubble:nth-child(4) { width: 15px; height: 15px; left: 65%; animation-duration: 20s; animation-delay: 1s; }
.bubble:nth-child(5) { width: 25px; height: 25px; left: 80%; animation-duration: 16s; animation-delay: 3s; }
.bubble:nth-child(6) { width: 35px; height: 35px; left: 40%; animation-duration: 22s; animation-delay: 5s; }

@keyframes bubble-rise {
    0%   { transform: translateY(0) scale(1);   opacity: 0; }
    10%  { opacity: 0.6; }
    90%  { opacity: 0.3; }
    100% { transform: translateY(-110vh) scale(0.4); opacity: 0; }
}

/* ============ Arcade Main ============ */
.arcade-main {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: calc(var(--navbar-height) + var(--spacing-xl)) var(--spacing-lg) var(--spacing-3xl);
}

/* ============ Hero ============ */
.arcade-hero {
    text-align: center;
    padding: var(--spacing-2xl) 0 var(--spacing-xl);
}

.arcade-title {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.title-icon {
    font-size: 1.2em;
    animation: bounce-gentle 2s ease-in-out infinite;
}

@keyframes bounce-gentle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.gradient-text {
    background: linear-gradient(135deg, #06b6d4, #8b5cf6, #f472b6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% 200%;
    animation: gradient-shift 4s ease-in-out infinite;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.arcade-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 520px;
    margin: 0 auto;
}

/* ============ Auth Notice ============ */
.arcade-auth-notice {
    text-align: center;
    padding: var(--spacing-md) var(--spacing-lg);
    margin-bottom: var(--spacing-xl);
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.arcade-auth-notice a {
    color: var(--accent-warning);
    font-weight: 600;
}

/* ============ Game Cards Grid ============ */
.arcade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-2xl);
}

.game-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.game-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 60px rgba(var(--accent-primary-rgb), 0.15);
}

.game-card.coming-soon {
    opacity: 0.65;
    pointer-events: none;
}

.game-card-banner {
    position: relative;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.snake-banner {
    background: linear-gradient(135deg, #0d3b4f 0%, #0a5c36 50%, #134e6f 100%);
}

.match-banner {
    background: linear-gradient(135deg, #1a1040 0%, #3b1a7e 50%, #0d3b4f 100%);
}

.crush-banner {
    background: linear-gradient(135deg, #4a1942 0%, #2d1b4e 50%, #1a3a4f 100%);
}

.soon-banner {
    background: linear-gradient(135deg, #2d1b0e 0%, #1a3a1a 50%, #0d2a3b 100%);
}

.game-card-emoji {
    font-size: 3.5rem;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
    animation: float-card 3s ease-in-out infinite;
}

@keyframes float-card {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-8px) rotate(3deg); }
}

.game-card-badge {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    padding: 0.25rem 0.75rem;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.game-card-body {
    padding: var(--spacing-lg);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.game-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.game-card-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--spacing-md);
    flex: 1;
}

.game-card-meta {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-md);
}

.meta-tag {
    padding: 0.3rem 0.6rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ============ Play & Game Buttons ============ */
.game-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition-base);
    font-family: inherit;
}

.game-btn-play {
    background: var(--gradient-primary);
    color: white;
    width: 100%;
}

.game-btn-play:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.game-btn-start {
    background: linear-gradient(135deg, #06b6d4, #8b5cf6);
    color: white;
    padding: 0.8rem 2rem;
}

.game-btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(6, 182, 212, 0.4);
}

.game-btn-pause {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.game-btn-pause:hover {
    background: rgba(255, 255, 255, 0.15);
}

.game-btn-soon {
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
    width: 100%;
    cursor: not-allowed;
}

/* ============ Game Arena ============ */
.game-arena {
    animation: fade-in 0.3s ease-out;
}

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

.arena-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.arena-back {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.arena-back:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.arena-title {
    font-size: 1.4rem;
    font-weight: 700;
}

.arena-container {
    position: relative;
}

/* ============ Shared Game HUD ============ */
.game-hud {
    display: flex;
    gap: var(--spacing-lg);
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.hud-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: 2px;
}

.hud-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--accent-secondary);
    font-family: var(--font-mono);
}

.hud-best {
    color: var(--accent-warning);
}

.hud-streak.on-fire {
    color: #f97316;
    animation: pulse-streak 0.4s ease-in-out;
}

@keyframes pulse-streak {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* ============ Game Controls Row ============ */
.game-controls {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-top: var(--spacing-lg);
}

/* ============ Snake Canvas ============ */
.snake-canvas {
    display: block;
    margin: 0 auto;
    border-radius: var(--radius-lg);
    border: 2px solid var(--glass-border);
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.3);
}

/* ============ Snake Mobile D-Pad ============ */
.snake-mobile-controls {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0;
    margin-top: var(--spacing-md);
}

@media (max-width: 768px) {
    .snake-mobile-controls { display: flex; }
}

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

.dpad-btn {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
}

.dpad-btn:active {
    background: rgba(6, 182, 212, 0.3);
    transform: scale(0.92);
}

.dpad-up { margin-bottom: 4px; }

/* ============ Match Game ============ */
.match-game-wrapper {
    position: relative;
}

.match-settings {
    display: flex;
    gap: var(--spacing-xl);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-lg);
    padding: var(--spacing-md) var(--spacing-lg);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.setting-group {
    flex: 1;
    min-width: 200px;
}

.setting-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-sm);
}

.setting-pills {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pill {
    padding: 0.4rem 0.8rem;
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.pill:hover {
    border-color: var(--glass-border);
    color: var(--text-primary);
}

.pill.active {
    background: rgba(var(--accent-primary-rgb), 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* ============ Match Grid ============ */
.match-grid {
    display: grid;
    gap: 10px;
    max-width: 540px;
    margin: 0 auto;
    padding: var(--spacing-md);
}

.match-tile {
    position: relative;
    aspect-ratio: 1;
    perspective: 600px;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.match-tile .tile-back,
.match-tile .tile-front {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    backface-visibility: hidden;
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: clamp(1.2rem, 3vw, 2rem);
}

.match-tile .tile-back {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.3), rgba(6, 182, 212, 0.3));
    border: 2px solid rgba(255, 255, 255, 0.1);
    color: var(--text-tertiary);
    font-weight: 700;
    font-size: 1.4rem;
}

.match-tile .tile-front {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(6, 182, 212, 0.4);
    transform: rotateY(180deg);
}

.match-tile.flipped .tile-back  { transform: rotateY(180deg); }
.match-tile.flipped .tile-front { transform: rotateY(0deg); }

.match-tile.matched .tile-front {
    border-color: var(--accent-success);
    background: rgba(16, 185, 129, 0.15);
    animation: tile-match-pop 0.4s ease-out;
}

@keyframes tile-match-pop {
    0%   { transform: rotateY(0deg) scale(1); }
    50%  { transform: rotateY(0deg) scale(1.12); }
    100% { transform: rotateY(0deg) scale(1); }
}

/* ============ Match Particles ============ */
.match-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-secondary);
    pointer-events: none;
    animation: particle-burst 0.7s ease-out forwards;
}

@keyframes particle-burst {
    0%   { opacity: 1; transform: translate(0, 0) scale(1); }
    100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0); }
}

/* ============ Match Summary Overlay ============ */
.match-summary-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    border-radius: var(--radius-lg);
    animation: fade-in 0.3s ease-out;
}

.match-summary {
    padding: var(--spacing-xl);
    max-width: 380px;
    width: 90%;
    text-align: center;
}

.summary-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: var(--spacing-lg);
}

.summary-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.summary-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.summary-label {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.summary-value.bonus {
    color: var(--accent-success);
}

.summary-rank {
    font-size: 0.9rem;
    color: var(--accent-warning);
    margin-bottom: var(--spacing-md);
}

.summary-close {
    margin-top: var(--spacing-sm);
}

/* ============ Shared Scoreboard ============ */
.game-scoreboard {
    margin-top: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.scoreboard-empty {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.9rem;
    padding: var(--spacing-md);
}

.scoreboard-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin-bottom: var(--spacing-md);
}

.scoreboard-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.scoreboard-entry {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-sm) var(--spacing-md);
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
}

.entry-medal {
    font-size: 1.2rem;
    width: 28px;
    text-align: center;
}

.entry-score {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
    flex: 1;
}

.entry-date {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

/* ============ Puzzle (Match-3) Game ============ */
.puzzle-game-wrapper {
    position: relative;
}

.puzzle-grid {
    display: grid;
    gap: 4px;
    max-width: 480px;
    margin: 0 auto;
    padding: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
}

.puzzle-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.1rem, 2.5vw, 1.8rem);
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
    font-family: inherit;
    user-select: none;
}

.puzzle-cell:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(139, 92, 246, 0.4);
    transform: scale(1.06);
    z-index: 1;
}

.puzzle-cell.puzzle-selected {
    border-color: var(--accent-secondary);
    background: rgba(6, 182, 212, 0.2);
    transform: scale(1.1);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.4);
    z-index: 2;
}

.puzzle-cell.puzzle-pop {
    animation: puzzle-pop-out 0.35s ease-out forwards;
}

@keyframes puzzle-pop-out {
    0%   { transform: scale(1); opacity: 1; }
    50%  { transform: scale(1.3); opacity: 0.7; }
    100% { transform: scale(0); opacity: 0; }
}

.puzzle-cell.puzzle-swap {
    animation: puzzle-swap-bounce 0.25s ease-out;
}

@keyframes puzzle-swap-bounce {
    0%   { transform: scale(0.85); }
    60%  { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.puzzle-float-score {
    position: absolute;
    pointer-events: none;
    font-size: 1rem;
    font-weight: 800;
    color: var(--accent-secondary);
    text-shadow: 0 1px 6px rgba(0,0,0,0.5);
    animation: float-score-up 0.9s ease-out forwards;
    z-index: 10;
    font-family: var(--font-mono);
}

.puzzle-float-score.cascade {
    color: #f472b6;
    font-size: 1.15rem;
}

@keyframes float-score-up {
    0%   { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-50px) scale(0.7); }
}

.hud-value.hud-low {
    color: var(--accent-danger);
    animation: pulse-streak 0.5s ease-in-out infinite;
}

/* ============ Leaderboard Button ============ */
.arena-leaderboard-btn {
    margin-left: auto;
    padding: 0.5rem 1.1rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(239, 68, 68, 0.10));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: var(--radius-md);
    color: #fbbf24;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s;
}

.arena-leaderboard-btn:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(239, 68, 68, 0.18));
    border-color: rgba(245, 158, 11, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.15);
}

/* ============ Leaderboard Overlay ============ */
.leaderboard-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    animation: lb-fade-in 0.2s ease-out;
}

.leaderboard-overlay.hidden { display: none; }

@keyframes lb-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.leaderboard-panel {
    width: 90%;
    max-width: 480px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-xl);
    overflow: hidden;
    animation: lb-slide-up 0.25s ease-out;
}

@keyframes lb-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.leaderboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.5rem;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(168, 85, 247, 0.08));
    border-bottom: 1px solid var(--glass-border);
}

.leaderboard-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

.leaderboard-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.leaderboard-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

.leaderboard-body {
    padding: 0.75rem 1rem;
    overflow-y: auto;
    max-height: 60vh;
}

.leaderboard-loading,
.leaderboard-empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}

.leaderboard-empty-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 0.5rem;
}

/* Leaderboard rows */
.lb-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md);
    transition: background 0.15s;
}

.lb-row:hover { background: rgba(255, 255, 255, 0.04); }

.lb-row-me {
    background: rgba(6, 182, 212, 0.08);
    border: 1px solid rgba(6, 182, 212, 0.2);
}

.lb-row-top3 .lb-rank { font-size: 1.3rem; }

.lb-rank {
    width: 2rem;
    text-align: center;
    flex-shrink: 0;
    font-weight: 700;
}

.lb-rank-num {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.lb-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.lb-avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.06);
    font-size: 1rem;
}

.lb-name {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lb-you-badge {
    display: inline-block;
    padding: 0.1em 0.45em;
    margin-left: 0.35rem;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: #fff;
    border-radius: 4px;
    vertical-align: middle;
}

.lb-score {
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: #fbbf24;
    flex-shrink: 0;
}

/* ============ Theme Toggle ============ */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.12);
}

.theme-toggle .theme-icon {
    font-size: 1.2rem;
    color: var(--text-secondary);
    line-height: 1;
}

html[data-theme="light"] .theme-toggle {
    background: #f1f5f9;
    border-color: #e2e8f0;
}
html[data-theme="light"] .theme-toggle:hover {
    background: #e2e8f0;
}
html[data-theme="light"] .theme-toggle .theme-icon {
    color: #334155;
}

/* ===========================================================
   Light Theme Overrides for Arcade
   =========================================================== */

/* Background animation — soften in light mode */
html[data-theme="light"] .bg-animation { opacity: 0.2; }

/* Bubbles — switch to a softer palette */
html[data-theme="light"] .arcade-bubbles .bubble {
    background: radial-gradient(circle at 30% 30%, rgba(139, 92, 246, 0.12), rgba(6, 182, 212, 0.06));
}

/* Navbar overrides for arcade (matches main.css pattern) */
html[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.85) !important;
    border-bottom: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06) !important;
    backdrop-filter: blur(12px) !important;
}

html[data-theme="light"] .nav-logo { color: #0f172a !important; }
html[data-theme="light"] .logo-text { color: #1e293b !important; }

html[data-theme="light"] .nav-btn-outline {
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}
html[data-theme="light"] .nav-btn-outline:hover {
    background: #f1f5f9 !important;
    border-color: var(--accent-primary) !important;
}

html[data-theme="light"] .nav-btn-icon {
    color: #334155;
}
html[data-theme="light"] .nav-btn-icon:hover {
    color: #0f172a;
    background: #f1f5f9;
}

/* User dropdown */
html[data-theme="light"] .user-dropdown {
    background: #ffffff !important;
    border-color: #e2e8f0 !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12) !important;
}
html[data-theme="light"] .dropdown-item { color: #334155 !important; }
html[data-theme="light"] .dropdown-item:hover { background: #f1f5f9 !important; }
html[data-theme="light"] .dropdown-divider { background: #e2e8f0 !important; }
html[data-theme="light"] .dropdown-header { border-color: #e2e8f0 !important; }

/* Auth notice */
html[data-theme="light"] .arcade-auth-notice {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.2);
}

/* Game cards */
html[data-theme="light"] .game-card {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

html[data-theme="light"] .game-card:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1), 0 0 40px rgba(var(--accent-primary-rgb), 0.08);
}

html[data-theme="light"] .game-card-badge {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    color: var(--accent-primary);
}

html[data-theme="light"] .meta-tag {
    background: #f1f5f9;
    color: #475569;
}

html[data-theme="light"] .game-btn-soon {
    background: #f1f5f9;
    color: #94a3b8;
}

/* Arena header */
html[data-theme="light"] .arena-back {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #475569;
}
html[data-theme="light"] .arena-back:hover {
    background: #e2e8f0;
    color: #0f172a;
}

/* Leaderboard button */
html[data-theme="light"] .arena-leaderboard-btn {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(239, 68, 68, 0.06));
    border-color: rgba(245, 158, 11, 0.25);
    color: #b45309;
}
html[data-theme="light"] .arena-leaderboard-btn:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(239, 68, 68, 0.1));
    border-color: rgba(245, 158, 11, 0.4);
}

/* Game HUD */
html[data-theme="light"] .game-hud {
    background: rgba(0, 0, 0, 0.03);
    border-color: #e2e8f0;
}

/* Snake canvas */
html[data-theme="light"] .snake-canvas {
    border-color: #cbd5e1;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.06);
}

/* D-pad buttons */
html[data-theme="light"] .dpad-btn {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #334155;
}
html[data-theme="light"] .dpad-btn:active {
    background: rgba(6, 182, 212, 0.15);
}

/* Match game settings */
html[data-theme="light"] .match-settings {
    background: rgba(0, 0, 0, 0.02);
    border-color: #e2e8f0;
}

/* Match tile */
html[data-theme="light"] .match-tile .tile-back {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15), rgba(6, 182, 212, 0.15));
    border-color: #cbd5e1;
}
html[data-theme="light"] .match-tile .tile-front {
    background: #f8fafc;
    border-color: rgba(6, 182, 212, 0.3);
}
html[data-theme="light"] .match-tile.matched .tile-front {
    background: rgba(16, 185, 129, 0.08);
}

/* Match summary overlay */
html[data-theme="light"] .match-summary-overlay {
    background: rgba(255, 255, 255, 0.7);
}

/* Game scoreboard */
html[data-theme="light"] .game-scoreboard {
    background: rgba(0, 0, 0, 0.02);
    border-color: #e2e8f0;
}
html[data-theme="light"] .scoreboard-entry {
    background: #f8fafc;
}

/* Puzzle grid */
html[data-theme="light"] .puzzle-grid {
    background: rgba(0, 0, 0, 0.02);
    border-color: #e2e8f0;
}

/* Puzzle cells */
html[data-theme="light"] .puzzle-cell {
    background: #f8fafc;
    border-color: #e2e8f0;
}
html[data-theme="light"] .puzzle-cell:hover {
    background: #f1f5f9;
    border-color: rgba(139, 92, 246, 0.3);
}
html[data-theme="light"] .puzzle-cell.puzzle-selected {
    background: rgba(6, 182, 212, 0.1);
    border-color: var(--accent-secondary);
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.2);
}

/* Puzzle floating score */
html[data-theme="light"] .puzzle-float-score {
    text-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* Leaderboard overlay */
html[data-theme="light"] .leaderboard-overlay {
    background: rgba(0, 0, 0, 0.3);
}

html[data-theme="light"] .leaderboard-panel {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
}

html[data-theme="light"] .leaderboard-header {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.06), rgba(168, 85, 247, 0.04));
    border-color: #e2e8f0;
}

html[data-theme="light"] .leaderboard-close {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #64748b;
}
html[data-theme="light"] .leaderboard-close:hover {
    background: #e2e8f0;
    color: #0f172a;
}

html[data-theme="light"] .lb-row:hover {
    background: #f8fafc;
}
html[data-theme="light"] .lb-row-me {
    background: rgba(6, 182, 212, 0.05);
    border-color: rgba(6, 182, 212, 0.15);
}

html[data-theme="light"] .lb-avatar-placeholder {
    background: #f1f5f9;
}

html[data-theme="light"] .lb-score {
    color: #b45309;
}

/* Toast container */
html[data-theme="light"] .toast {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
    color: #0f172a !important;
}

/* Pause button */
html[data-theme="light"] .game-btn-pause {
    background: #f1f5f9;
    border-color: #e2e8f0;
    color: #334155;
}
html[data-theme="light"] .game-btn-pause:hover {
    background: #e2e8f0;
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
    .arcade-main {
        padding-left: var(--spacing-md);
        padding-right: var(--spacing-md);
    }

    .arcade-grid {
        grid-template-columns: 1fr;
    }

    .game-hud {
        gap: var(--spacing-md);
        padding: var(--spacing-sm) var(--spacing-md);
    }

    .hud-value {
        font-size: 1.1rem;
    }

    .match-settings {
        flex-direction: column;
        gap: var(--spacing-md);
    }

    .match-grid {
        gap: 8px;
        padding: var(--spacing-sm);
    }

    .arena-header {
        flex-wrap: wrap;
    }

    .arena-leaderboard-btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    .leaderboard-panel {
        width: 95%;
        max-height: 85vh;
    }
}

@media (max-width: 480px) {
    .arcade-title {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
}
