@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;700;800;900&display=swap');

:root {
    --bg-darker: #050505;
    --bg-dark: #0a0a0a;
    --bg-card: rgba(255, 255, 255, 0.03);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(255, 255, 255, 0.05);
    
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    
    /* Modern Premium Palette */
    --brand-primary: #6366f1; /* Indigo */
    --brand-secondary: #ec4899; /* Pink */
    --accent-cyan: #0ea5e9;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-yellow: #f59e0b;
    --accent-red: #ef4444;

    /* Legacy support for index.html variables (mapping to new premium colors) */
    --neon-cyan: var(--accent-cyan);
    --neon-purple: var(--brand-primary);
    --neon-pink: var(--brand-secondary);
    --neon-green: var(--accent-green);
    --neon-yellow: var(--accent-yellow);
    --neon-red: var(--accent-red);
    
    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

body, button, input, select, textarea, p, a, span {
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-darker);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    /* Soft ambient mesh gradient background */
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08), transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(236, 72, 153, 0.08), transparent 40%),
        radial-gradient(circle at 50% 100%, rgba(14, 165, 233, 0.05), transparent 50%);
    background-attachment: fixed;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

:focus-visible {
    outline: 2px solid var(--brand-primary);
    outline-offset: 2px;
}

/* Premium Glassmorphism Utilities */
.glass-panel {
    background: rgba(15, 15, 15, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.glass-card {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.glass-card:hover {
    border-color: rgba(99, 102, 241, 0.3);
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.02) 100%);
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.glass-card:active {
    transform: scale(0.98) translateY(0px);
}

/* Typography styles */
h1, h2, h3, .brand-font {
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

/* Gradient Text Utilities (Replacing Neon Glows) */
.text-gradient-primary {
    background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.text-gradient-purple {
    background: linear-gradient(135deg, #c4b5fd 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.text-gradient-cyan {
    background: linear-gradient(135deg, #7dd3fc 0%, #0ea5e9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
/* Legacy class mapping for drop-in replacement */
.text-glow-cyan { @extend .text-gradient-cyan; background: linear-gradient(135deg, #7dd3fc 0%, #0ea5e9 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.text-glow-purple { @extend .text-gradient-primary; background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.text-glow-pink { background: linear-gradient(135deg, #f9a8d4 0%, #ec4899 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }

/* Custom layout for play.html */
.console-layout {
    display: grid;
    grid-template-rows: auto 1fr;
    height: 100vh;
    overflow: hidden;
}

.console-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(5, 5, 5, 0.7);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--border-color);
    z-index: 50;
}

.console-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 1.25rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

.console-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.btn-icon:active {
    transform: scale(0.95) translateY(0);
}

.btn-primary {
    background: var(--text-primary);
    color: var(--bg-darker);
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 255, 255, 0.15);
    background: #e4e4e7;
}

.btn-primary:active {
    transform: scale(0.98) translateY(0);
}

.console-body {
    display: grid;
    grid-template-columns: 1fr 340px;
    height: 100%;
    overflow: hidden;
}

@media (max-width: 1024px) {
    .console-body {
        grid-template-columns: 1fr;
    }
    .console-sidebar {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .console-header {
        padding: 0.8rem 1rem;
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .console-brand span {
        display: none; /* Save space on mobile */
    }

    #gameTitleDisplay {
        font-size: 1.1rem !important;
        order: 3;
        width: 100%;
        text-align: center;
    }

    .btn-primary span {
        display: none; /* Hide 'Lobby' text on small screens */
    }
}

.console-viewport {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #000;
    position: relative;
    padding: 20px;
    overflow: hidden;
}

@media (max-width: 768px) {
    .console-viewport {
        padding: 5px; /* Maximize screen space on mobile */
    }
}

.game-frame-container {
    width: 100%;
    flex: 1; /* Take remaining space, don't force 100% height which overflows */
    min-height: 0; /* Prevent flex overflow */
    max-width: 100%;
    max-height: 100%;
    background: #050505;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-frame-container.portrait {
    aspect-ratio: auto;
}
.game-frame-container.square {
    aspect-ratio: auto;
}

#gameIframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: #000;
}

/* Virtual Mobile Gamepads styling */
.gamepad-container {
    width: 100%;
    max-width: 600px;
    padding: 15px;
    margin-top: 15px;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 40;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
}

@media (max-height: 700px) {
    .game-frame-container {
        /* No longer needed as flex: 1 handles available height, but can keep a min-height if desired. */
    }
}

/* Sidebar styling */
.console-sidebar {
    background: rgba(10, 10, 10, 0.8);
    border-left: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-title {
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
}
.sidebar-title::before {
    content: '';
    display: block;
    width: 4px;
    height: 14px;
    background: var(--brand-primary);
    border-radius: 4px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition-fast);
}

.stat-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.stat-value {
    font-weight: 700;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
}

/* Virtual Control Pads */
.control-pad {
    display: none;
    width: 100%;
    justify-content: center;
    align-items: center;
    animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.control-pad.active {
    display: flex;
}

/* Modern D-Pad */
.dpad {
    display: grid;
    grid-template-columns: repeat(3, 70px);
    grid-template-rows: repeat(3, 70px);
    gap: 8px;
    background: rgba(20, 20, 20, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 40px;
    padding: 12px;
}

.pad-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.05);
    color: var(--text-primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    touch-action: none;
    transition: all 0.15s;
}

.pad-btn:active, .pad-btn.active {
    background: var(--text-primary);
    color: var(--bg-darker);
    transform: scale(0.92);
}

.pad-up { grid-column: 2; grid-row: 1; border-radius: 20px 20px 8px 8px; }
.pad-left { grid-column: 1; grid-row: 2; border-radius: 20px 8px 8px 20px; }
.pad-right { grid-column: 3; grid-row: 2; border-radius: 8px 20px 20px 8px; }
.pad-down { grid-column: 2; grid-row: 3; border-radius: 8px 8px 20px 20px; }
.pad-center { 
    grid-column: 2; grid-row: 2; 
    border-radius: 50%; 
    background: rgba(255,255,255,0.02); 
    border: none; 
    pointer-events: none;
}

/* Dual/Split Controllers */
.split-controls {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0 10px;
    gap: 40px;
}

.action-cluster {
    display: flex;
    gap: 16px;
}

.control-circle-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(20, 20, 20, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: none;
    font-size: 1.6rem;
    transition: all 0.15s;
}

.control-circle-btn span {
    font-size: 0.7rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    margin-top: 4px;
    color: var(--text-secondary);
}

.control-circle-btn:active, .control-circle-btn.active {
    background: var(--text-primary);
    color: var(--bg-darker);
    transform: scale(0.92);
}
.control-circle-btn:active span, .control-circle-btn.active span {
    color: var(--bg-darker);
}

/* Horizontal Paddles */
.horizontal-paddles {
    display: flex;
    width: 100%;
    justify-content: center;
    gap: 20px;
}

.paddle-btn {
    flex: 1;
    max-width: 180px;
    height: 64px;
    border-radius: 20px;
    background: rgba(20, 20, 20, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.08);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    touch-action: none;
    transition: all 0.15s;
}

.paddle-btn:active, .paddle-btn.active {
    background: var(--text-primary);
    color: var(--bg-darker);
    transform: scale(0.96);
}

/* Tap zone */
.tap-zone {
    width: 100%;
    height: 80px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(12px);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Outfit', sans-serif;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    touch-action: none;
    transition: all 0.15s;
}

.tap-zone:active, .tap-zone.active {
    background: rgba(255, 255, 255, 0.1);
    border-style: solid;
    transform: scale(0.98);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

a {
    text-decoration: none !important;
    transition: var(--transition-fast);
}

#floatingScoreboard {
    display: none;
}

@media (max-width: 1024px) {
    #floatingScoreboard {
        display: flex !important;
    }
}

.game-frame-container.is-fullscreen #floatingScoreboard {
    display: flex !important;
}

