/* ==========================================================================
   NEON NEXUS - CORE DESIGN SYSTEM (CYBERPUNK GLASSMORPHISM)
   ========================================================================== */

:root {
    /* Cyberpunk Neon Theme Colors */
    --neon-pink: #ff007f;
    --neon-pink-glow: rgba(255, 0, 127, 0.4);
    --neon-cyan: #00f0ff;
    --neon-cyan-glow: rgba(0, 240, 255, 0.4);
    --neon-yellow: #ffeb3b;
    --neon-yellow-glow: rgba(255, 235, 59, 0.4);
    --neon-green: #39ff14;
    --neon-green-glow: rgba(57, 255, 20, 0.4);
    --neon-purple: #9d00ff;
    --neon-purple-glow: rgba(157, 0, 255, 0.4);
    
    /* Dark Theme Palette */
    --bg-darker: #05050d;
    --bg-dark: #0a0a16;
    --bg-card: rgba(13, 13, 33, 0.6);
    --bg-card-hover: rgba(20, 20, 48, 0.8);
    --border-color: rgba(0, 240, 255, 0.15);
    
    /* Typography */
    --font-header: 'Orbitron', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-body: 'Rajdhani', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    
    /* Shadows & Glows */
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --glass-blur: 12px;
}

/* User-specific dynamic colors based on configuration */
.theme-pink {
    --player-theme: var(--neon-pink);
    --player-theme-glow: var(--neon-pink-glow);
}
.theme-cyan {
    --player-theme: var(--neon-cyan);
    --player-theme-glow: var(--neon-cyan-glow);
}
.theme-yellow {
    --player-theme: var(--neon-yellow);
    --player-theme-glow: var(--neon-yellow-glow);
}
.theme-green {
    --player-theme: var(--neon-green);
    --player-theme-glow: var(--neon-green-glow);
}
.theme-purple {
    --player-theme: var(--neon-purple);
    --player-theme-glow: var(--neon-purple-glow);
}

/* ==========================================================================
   BASE & RESET STYLES
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-darker);
    color: #f0f0ff;
    font-family: var(--font-body);
    font-size: 1.15rem;
    font-weight: 500;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(10, 10, 25, 0.5);
}
::-webkit-scrollbar-thumb {
    background: var(--neon-cyan);
    border-radius: 3px;
    box-shadow: 0 0 10px var(--neon-cyan);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--neon-pink);
    box-shadow: 0 0 10px var(--neon-pink);
}

/* Ambient Background Lights */
.bg-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -2;
    pointer-events: none;
    opacity: 0.45;
}

.bg-glow-1 {
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--neon-pink) 0%, transparent 70%);
    top: -20vw;
    left: -20vw;
    animation: floatGlow 18s ease-in-out infinite alternate;
}

.bg-glow-2 {
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, var(--neon-cyan) 0%, transparent 70%);
    bottom: -25vw;
    right: -20vw;
    animation: floatGlow 24s ease-in-out infinite alternate-reverse;
}

.grid-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        linear-gradient(rgba(18, 18, 48, 0.07) 1px, transparent 1px),
        linear-gradient(90deg, rgba(18, 18, 48, 0.07) 1px, transparent 1px);
    background-size: 40px 40px;
    z-index: -1;
    pointer-events: none;
}

/* Animations */
@keyframes floatGlow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(80px, 50px) scale(1.15); }
}

/* ==========================================================================
   LAYOUT CONTAINERS
   ========================================================================== */

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 30px;
}

.app-header {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 5px;
}

.glitch-text {
    font-family: var(--font-header);
    font-weight: 900;
    font-size: 3.5rem;
    line-height: 1.1;
    letter-spacing: 4px;
    color: #fff;
    text-shadow: 
        0 0 10px rgba(255, 255, 255, 0.8),
        0 0 20px var(--neon-pink),
        0 0 30px var(--neon-pink);
    position: relative;
    display: inline-block;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}

.glitch-text::before {
    left: 2px;
    text-shadow: -2px 0 var(--neon-cyan);
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: -2px 0 var(--neon-yellow);
    clip: rect(85px, 450px, 140px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% { clip: rect(31px, 9999px, 94px, 0); }
    10% { clip: rect(112px, 9999px, 76px, 0); }
    20% { clip: rect(85px, 9999px, 5px, 0); }
    30% { clip: rect(27px, 9999px, 115px, 0); }
    40% { clip: rect(73px, 9999px, 29px, 0); }
    50% { clip: rect(44px, 9999px, 102px, 0); }
    60% { clip: rect(99px, 9999px, 14px, 0); }
    70% { clip: rect(15px, 9999px, 83px, 0); }
    80% { clip: rect(58px, 9999px, 120px, 0); }
    90% { clip: rect(3px, 9999px, 60px, 0); }
    100% { clip: rect(88px, 9999px, 91px, 0); }
}

@keyframes glitch-anim2 {
    0% { clip: rect(76px, 9999px, 116px, 0); }
    11% { clip: rect(22px, 9999px, 98px, 0); }
    22% { clip: rect(5px, 9999px, 15px, 0); }
    33% { clip: rect(104px, 9999px, 44px, 0); }
    44% { clip: rect(88px, 9999px, 69px, 0); }
    55% { clip: rect(19px, 9999px, 123px, 0); }
    66% { clip: rect(61px, 9999px, 3px, 0); }
    77% { clip: rect(122px, 9999px, 85px, 0); }
    88% { clip: rect(9px, 9999px, 50px, 0); }
    100% { clip: rect(35px, 9999px, 108px, 0); }
}

.subtitle {
    font-family: var(--font-header);
    font-size: 1rem;
    font-weight: 600;
    color: var(--neon-cyan);
    letter-spacing: 6px;
    margin-top: 5px;
    text-shadow: 0 0 10px var(--neon-cyan-glow);
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ==========================================================================
   GLASSMORPHISM PANELS & UI ELEMENTS
   ========================================================================== */

.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--glass-shadow);
    padding: 24px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
}

.glass-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
    opacity: 0.7;
}

.glass-panel:hover {
    background: var(--bg-card-hover);
    box-shadow: 0 12px 40px 0 rgba(0, 240, 255, 0.05);
}

.panel-header {
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 12px;
}

.panel-header h2 {
    font-family: var(--font-header);
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel-header h2 .icon {
    font-size: 1.6rem;
}

/* Form Groups & Inputs */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.input-group label, 
.avatar-selector-section label, 
.color-picker-section label,
.game-mode-selection label,
.team-format-selection label {
    font-family: var(--font-header);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--neon-cyan);
    text-transform: uppercase;
}

input[type="text"] {
    background: rgba(5, 5, 15, 0.8);
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 8px;
    color: #fff;
    font-family: var(--font-body);
    font-size: 1.2rem;
    padding: 12px 16px;
    width: 100%;
    outline: none;
    transition: all 0.25s ease;
}

input[type="text"]:focus {
    border-color: var(--neon-pink);
    box-shadow: 0 0 12px var(--neon-pink-glow);
}

input[readonly] {
    background: rgba(5, 5, 10, 0.9);
    border-color: rgba(255, 255, 255, 0.1);
    color: #a0a0c0;
    cursor: default;
}

/* Buttons */
.btn {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 1px;
    padding: 14px 28px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background: var(--neon-pink);
    color: #fff;
    box-shadow: 0 4px 15px var(--neon-pink-glow);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn-primary:hover:not(.disabled):not(:disabled) {
    background: #ff2295;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 0, 127, 0.6);
}

.btn-secondary {
    background: transparent;
    color: var(--neon-cyan);
    border: 2px solid var(--neon-cyan);
    box-shadow: 0 0 10px rgba(0, 240, 255, 0.1);
}

.btn-secondary:hover:not(.disabled):not(:disabled) {
    background: var(--neon-cyan);
    color: var(--bg-darker);
    box-shadow: 0 0 20px var(--neon-cyan-glow);
    transform: translateY(-2px);
}

.btn-danger {
    background: rgba(255, 30, 80, 0.2);
    color: #ff3c69;
    border: 1px solid #ff1e50;
}

.btn-danger:hover:not(.disabled):not(:disabled) {
    background: #ff1e50;
    color: #fff;
    box-shadow: 0 0 15px rgba(255, 30, 80, 0.5);
    transform: translateY(-2px);
}

.btn:active:not(.disabled):not(:disabled) {
    transform: translateY(1px);
}

.btn.disabled, .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Glow styles */
.btn-glow-pink {
    animation: glowPulsePink 2s infinite alternate;
}

.btn-glow-cyan {
    animation: glowPulseCyan 2s infinite alternate;
}

@keyframes glowPulsePink {
    0% { box-shadow: 0 0 8px var(--neon-pink-glow); }
    100% { box-shadow: 0 0 20px rgba(255, 0, 127, 0.7); }
}

@keyframes glowPulseCyan {
    0% { box-shadow: 0 0 8px var(--neon-cyan-glow); }
    100% { box-shadow: 0 0 20px rgba(0, 240, 255, 0.7); }
}


/* Utility Classes */
.hidden:not(.toast) {
    display: none !important;
}

/* ==========================================================================
   VIEW 1: LOBBY SPECIFIC STYLES
   ========================================================================== */

.view-section {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.view-section.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.lobby-grid {
    display: grid;
    grid-template-columns: 1fr 1.1fr;
    gap: 30px;
    max-width: 1000px;
    margin: 0 auto;
}

/* Avatar Grid */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 8px;
}

.avatar-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 2rem;
    padding: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.avatar-item:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.08);
}

.avatar-item.active {
    background: rgba(0, 240, 255, 0.15);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan-glow);
    transform: scale(1.08);
}

/* Color Picker */
.color-picker-section {
    margin-top: 20px;
}

.color-options {
    display: flex;
    gap: 15px;
    margin-top: 8px;
}

.color-option {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
}

.color-option:hover {
    transform: scale(1.15);
}

.color-option.active {
    border-color: #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    transform: scale(1.15);
}

/* Mode Buttons */
.mode-options, .format-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}

.format-options {
    grid-template-columns: repeat(3, 1fr);
}

.mode-btn, .format-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    color: #c0c0d0;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mode-btn:hover, .format-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.mode-btn.active {
    background: rgba(255, 0, 127, 0.08);
    border-color: var(--neon-pink);
    box-shadow: 0 0 15px rgba(255, 0, 127, 0.2);
    color: #fff;
}

.format-btn.active {
    background: rgba(0, 240, 255, 0.08);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 15px rgba(0, 240, 255, 0.2);
    color: #fff;
}

.mode-btn.active .mode-title { color: var(--neon-pink); }
.format-btn.active .format-title { color: var(--neon-cyan); }

.mode-title, .format-title {
    font-family: var(--font-header);
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
}

.mode-desc, .format-desc {
    font-size: 0.75rem;
    color: #8c8ca3;
}

.neon-divider {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.2), transparent);
    margin: 20px 0;
}

.or-separator {
    text-align: center;
    font-family: var(--font-header);
    font-size: 0.8rem;
    letter-spacing: 2px;
    color: #8c8ca3;
    margin: 15px 0;
    position: relative;
}

.or-separator::before,
.or-separator::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 20%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.or-separator::before { left: 0; }
.or-separator::after { right: 0; }

.join-room-box .input-with-btn {
    display: flex;
    gap: 10px;
}

.join-room-box input {
    flex-grow: 1;
}

.lobby-action-box .btn {
    width: 100%;
}

/* ==========================================================================
   VIEW 2: WAITING ROOM & ROSTER (PHÒNG CHỜ CHIA ĐỘI)
   ========================================================================== */

.waiting-room-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 1100px;
    margin: 0 auto;
}

.waiting-info-panel {
    padding: 20px;
}

.waiting-header-flex {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
}

.waiting-header-flex h2 {
    font-family: var(--font-header);
    font-size: 1.4rem;
    color: var(--neon-cyan);
    text-shadow: 0 0 10px var(--neon-cyan-glow);
}

.pulse-loader {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--neon-cyan);
    box-shadow: 0 0 15px var(--neon-cyan);
    animation: pulseGlow 1.5s infinite ease-in-out;
}

@keyframes pulseGlow {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 1; box-shadow: 0 0 25px var(--neon-cyan); }
    100% { transform: scale(0.8); opacity: 0.5; }
}

.room-share-grid {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.share-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.share-label {
    font-family: var(--font-header);
    font-size: 0.75rem;
    letter-spacing: 1px;
    color: var(--neon-yellow);
    text-transform: uppercase;
}

.copy-input-container {
    display: flex;
    gap: 8px;
}

.copy-input-container input {
    font-family: monospace;
    font-size: 0.95rem;
    padding: 8px 12px;
}

.btn-copy {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--neon-cyan);
    border-radius: 8px;
    width: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-copy:hover {
    background: var(--neon-cyan);
    color: var(--bg-darker);
    box-shadow: 0 0 10px var(--neon-cyan-glow);
}

/* Roster grid columns for Pink vs Cyan */
.lobby-roster-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
}

.team-panel {
    min-height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
}

.team-panel-x {
    border-color: rgba(255, 0, 127, 0.25);
    background: rgba(255, 0, 127, 0.02);
}
.team-panel-x::before {
    background: linear-gradient(90deg, transparent, var(--neon-pink), transparent);
}
.team-panel-x:hover {
    border-color: var(--neon-pink);
    box-shadow: 0 8px 30px rgba(255, 0, 127, 0.1);
}

.team-panel-o {
    border-color: rgba(0, 240, 255, 0.25);
    background: rgba(0, 240, 255, 0.02);
}
.team-panel-o::before {
    background: linear-gradient(90deg, transparent, var(--neon-cyan), transparent);
}
.team-panel-o:hover {
    border-color: var(--neon-cyan);
    box-shadow: 0 8px 30px rgba(0, 240, 255, 0.1);
}

.team-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.team-header h3 {
    font-family: var(--font-header);
    font-size: 1.15rem;
    letter-spacing: 1px;
}

.color-pink h3 { color: var(--neon-pink); text-shadow: 0 0 10px var(--neon-pink-glow); }
.color-cyan h3 { color: var(--neon-cyan); text-shadow: 0 0 10px var(--neon-cyan-glow); }

.team-count {
    font-family: var(--font-header);
    font-size: 0.95rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 10px;
    border-radius: 12px;
}

.player-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-grow: 1;
    margin-bottom: 20px;
}

/* Player Item in Lobby list */
.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 10px 15px;
    animation: playerJoinFade 0.3s ease-out;
}

@keyframes playerJoinFade {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.player-item-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-item-avatar {
    font-size: 1.6rem;
}

.player-item-name {
    font-family: var(--font-header);
    font-weight: 700;
    color: #fff;
}

/* Pulse color tag based on user theme selection */
.player-item.host-player {
    border-color: var(--neon-yellow);
    box-shadow: inset 0 0 5px rgba(255, 235, 59, 0.1);
}

.badge-host {
    background: var(--neon-yellow);
    color: var(--bg-darker);
    font-family: var(--font-header);
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 5px;
    text-transform: uppercase;
}

.badge-self {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-family: var(--font-header);
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 5px;
    text-transform: uppercase;
}

.player-item-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-indicator {
    font-size: 0.8rem;
    font-family: var(--font-header);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-indicator.ready {
    color: var(--neon-green);
    text-shadow: 0 0 5px var(--neon-green-glow);
}

.status-indicator.not-ready {
    color: #8c8ca3;
}

.join-team-action-btn {
    width: 100%;
    padding: 10px;
    font-size: 0.9rem;
}

/* Bottom elements waiting room */
.lobby-footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 25px;
}

.lobby-chat-panel {
    display: flex;
    flex-direction: column;
    height: 250px;
}

.lobby-chat-panel .chat-messages-container {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 12px;
}

.lobby-action-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 250px;
}

.lobby-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 320px;
}

.lobby-buttons .btn {
    width: 100%;
    padding: 14px;
}

/* ==========================================================================
   VIEW 3: GAMEPLAY ARENA SPECIFIC STYLES
   ========================================================================== */

.game-arena-grid {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
}

/* Scoreboard Panel */
.scoreboard-panel {
    margin-bottom: 20px;
    padding: 14px 20px;
}

.scoreboard-panel::before {
    background: linear-gradient(90deg, var(--neon-pink), var(--neon-cyan));
}

.team-score-hud {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.team-hud {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.hud-x {
    justify-content: flex-start;
}

.hud-o {
    justify-content: flex-end;
    flex-direction: row; /* Flex layout uniform for players display */
    text-align: right;
}

.team-symbol-indicator {
    font-family: var(--font-header);
    font-weight: 900;
    font-size: 2.2rem;
    line-height: 1;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid transparent;
    border-radius: 8px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    user-select: none;
}

.color-pink .team-symbol-indicator, 
.hud-x .team-symbol-indicator {
    border-color: var(--neon-pink);
    color: var(--neon-pink);
    text-shadow: 0 0 10px var(--neon-pink);
    box-shadow: 0 0 10px var(--neon-pink-glow);
}

.color-cyan .team-symbol-indicator, 
.hud-o .team-symbol-indicator {
    border-color: var(--neon-cyan);
    color: var(--neon-cyan);
    text-shadow: 0 0 10px var(--neon-cyan);
    box-shadow: 0 0 10px var(--neon-cyan-glow);
}

.team-hud-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.hud-team-name {
    font-family: var(--font-header);
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.hud-x .hud-team-name { color: var(--neon-pink); }
.hud-o .hud-team-name { color: var(--neon-cyan); }

.team-players-inline {
    display: flex;
    gap: 6px;
    margin-left: 15px;
    margin-right: 15px;
    flex-wrap: wrap;
    max-width: 220px;
}

.hud-o .team-players-inline {
    justify-content: flex-end;
}

/* In game player mini item */
.mini-player-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 3px 8px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: all 0.25s ease;
}

.mini-player-badge.active-turn {
    background: rgba(255, 235, 59, 0.1);
    border-color: var(--neon-yellow);
    box-shadow: 0 0 8px var(--neon-yellow-glow);
    animation: activePlayerBlink 1.2s infinite alternate;
}

@keyframes activePlayerBlink {
    0% { filter: brightness(0.9); transform: scale(1); }
    100% { filter: brightness(1.25); transform: scale(1.05); }
}

.mini-player-name {
    font-family: var(--font-header);
    font-weight: 700;
    max-width: 60px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vs-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--neon-yellow);
    font-family: var(--font-header);
    font-weight: 800;
    font-size: 1rem;
    padding: 5px 10px;
    border-radius: 8px;
    box-shadow: 0 0 8px rgba(255, 235, 59, 0.1);
    margin: 0 15px;
    user-select: none;
}

.turn-status-container {
    margin-top: 12px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.turn-status-container span {
    font-family: var(--font-header);
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--neon-yellow);
    text-shadow: 0 0 5px var(--neon-yellow-glow);
}

.turn-timer {
    display: inline-block;
    margin-left: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--font-header);
    font-weight: 800;
    font-size: 1rem;
    transition: all 0.3s ease;
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    background: rgba(0, 240, 255, 0.05);
    text-shadow: 0 0 8px var(--neon-cyan-glow);
    box-shadow: 0 0 8px rgba(0, 240, 255, 0.1);
    vertical-align: middle;
}

.turn-timer.warning {
    border-color: var(--neon-yellow);
    color: var(--neon-yellow);
    background: rgba(255, 235, 59, 0.05);
    text-shadow: 0 0 8px var(--neon-yellow-glow);
    box-shadow: 0 0 8px rgba(255, 235, 59, 0.1);
}

.turn-timer.danger {
    border-color: var(--neon-pink);
    color: var(--neon-pink);
    background: rgba(255, 0, 127, 0.08);
    text-shadow: 0 0 12px var(--neon-pink);
    box-shadow: 0 0 12px var(--neon-pink-glow);
    animation: timerPulse 0.5s infinite alternate;
}

.turn-timer.hidden {
    display: none !important;
}

@keyframes timerPulse {
    0% { transform: scale(1); filter: brightness(0.9); }
    100% { transform: scale(1.08); filter: brightness(1.2); }
}

/* ==========================================================================
   GAME BOARD SPECIFICS
   ========================================================================== */

.board-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 480px;
    padding: 20px;
}

/* 3x3 Tic Tac Toe Grid */
#game-board.board-3x3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 15px;
    width: 380px;
    height: 380px;
    margin: 0 auto;
}

#game-board.board-3x3 .cell {
    font-size: 4rem;
    border-radius: 12px;
}

/* Caro 15x15 Grid style */
#game-board.board-caro {
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    gap: 3px;
    width: 100%;
    max-width: 580px;
    aspect-ratio: 1;
    margin: 0 auto;
    background: rgba(0, 0, 0, 0.2);
    padding: 5px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#game-board.board-caro .cell {
    font-size: 1.25rem;
    border-radius: 3px;
}

/* Cell Style */
.cell {
    background: rgba(5, 5, 20, 0.75);
    border: 1px solid rgba(0, 240, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-header);
    font-weight: 900;
    user-select: none;
    transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cell:hover:not(.filled) {
    background: rgba(0, 240, 255, 0.06);
    border-color: var(--neon-cyan);
    box-shadow: inset 0 0 8px var(--neon-cyan-glow);
    transform: scale(1.02);
}

.cell.filled {
    cursor: not-allowed;
}

.cell.filled-x {
    color: var(--neon-pink);
    text-shadow: 0 0 10px var(--neon-pink), 0 0 20px var(--neon-pink);
    animation: placeCellAnim 0.25s ease-out;
}

.cell.filled-o {
    color: var(--neon-cyan);
    text-shadow: 0 0 10px var(--neon-cyan), 0 0 20px var(--neon-cyan);
    animation: placeCellAnim 0.25s ease-out;
}

/* Winning cell animation */
.cell.win-cell {
    background: rgba(255, 235, 59, 0.25) !important;
    border-color: var(--neon-yellow) !important;
    color: var(--neon-yellow) !important;
    text-shadow: 0 0 15px var(--neon-yellow), 0 0 30px var(--neon-yellow) !important;
    animation: winPulseCell 0.8s infinite alternate;
}

/* Last move indicator */
.cell.last-move {
    border: 2px solid var(--neon-purple) !important;
    box-shadow: 0 0 12px var(--neon-purple-glow), inset 0 0 8px var(--neon-purple-glow) !important;
    animation: lastMovePulse 1s infinite alternate !important;
    z-index: 5;
}

@keyframes lastMovePulse {
    0% {
        border-color: rgba(157, 0, 255, 0.6);
        box-shadow: 0 0 6px rgba(157, 0, 255, 0.4), inset 0 0 4px rgba(157, 0, 255, 0.3);
    }
    100% {
        border-color: rgba(157, 0, 255, 1);
        box-shadow: 0 0 15px rgba(157, 0, 255, 0.9), inset 0 0 10px rgba(157, 0, 255, 0.7);
    }
}


@keyframes placeCellAnim {
    0% { transform: scale(0.6); opacity: 0; }
    85% { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes winPulseCell {
    0% { transform: scale(1); filter: brightness(1); }
    100% { transform: scale(1.04); filter: brightness(1.25); }
}

/* Screen Shake effect for big Caro match wins or moves */
.screen-shake {
    animation: shakeEffect 0.35s ease-in-out;
}

@keyframes shakeEffect {
    0%, 100% { transform: translate(0, 0); }
    10%, 30%, 50%, 70%, 90% { transform: translate(-3px, 2px); }
    20%, 40%, 60%, 80% { transform: translate(3px, -2px); }
}

/* ==========================================================================
   CHAT & CONTROLS SPECIFICS
   ========================================================================== */

.chat-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.chat-panel {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 480px;
    padding: 20px;
}

.chat-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    border-bottom: none;
    padding-bottom: 0;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon-toggle {
    background: transparent;
    border: none;
    color: #8c8ca3;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.btn-icon-toggle:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
}

.btn-icon-toggle.active {
    color: var(--neon-pink);
    filter: drop-shadow(0 0 5px var(--neon-pink-glow));
}

.btn-icon-toggle.active .sound-waves {
    display: block;
}

.btn-icon-toggle:not(.active) .sound-waves {
    display: none;
}

/* Chat scope tab tabs */
.chat-scope-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.scope-btn {
    background: transparent;
    border: none;
    color: #8c8ca3;
    font-family: var(--font-header);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.scope-btn.active {
    background: rgba(0, 240, 255, 0.12);
    color: var(--neon-cyan);
    text-shadow: 0 0 5px var(--neon-cyan-glow);
}

#btn-chat-scope-team.active {
    background: rgba(255, 0, 127, 0.12);
    color: var(--neon-pink);
    text-shadow: 0 0 5px var(--neon-pink-glow);
}

/* Messages container */
.chat-messages-container {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 5px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.chat-bubble {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 0.95rem;
    line-height: 1.3;
    word-break: break-word;
    animation: chatMessageFade 0.25s ease-out;
}

@keyframes chatMessageFade {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-bubble-self {
    align-self: flex-end;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-right-radius: 2px;
}

.chat-bubble-opponent {
    align-self: flex-start;
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.18);
    border-bottom-left-radius: 2px;
}

/* Distinctive Team borders for chat bubbles */
.chat-bubble.bubble-team-x {
    border-color: rgba(255, 0, 127, 0.4);
    box-shadow: 0 0 5px rgba(255, 0, 127, 0.1);
}
.chat-bubble.bubble-team-o {
    border-color: rgba(0, 240, 255, 0.4);
    box-shadow: 0 0 5px rgba(0, 240, 255, 0.1);
}

.chat-msg-sender {
    font-family: var(--font-header);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 3px;
    text-transform: uppercase;
}

/* Chat bubble labels */
.chat-bubble-self .chat-msg-sender { color: var(--neon-yellow); }
.chat-bubble-opponent .chat-msg-sender { color: var(--neon-cyan); }

.chat-scope-badge {
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 3px;
    padding: 1px 4px;
    margin-left: 5px;
}
.scope-badge-team {
    background: rgba(255, 0, 127, 0.2);
    color: var(--neon-pink);
}
.scope-badge-all {
    background: rgba(255, 255, 255, 0.1);
    color: #c0c0d0;
}

.chat-msg-text {
    color: #e2e2f0;
}

.chat-msg-time {
    align-self: flex-end;
    font-size: 0.65rem;
    color: #6a6a85;
    margin-top: 4px;
}

.chat-system-msg {
    align-self: center;
    background: rgba(255, 255, 255, 0.04);
    color: var(--neon-yellow);
    border-radius: 15px;
    padding: 4px 12px;
    font-size: 0.8rem;
    text-align: center;
    border: 1px solid rgba(255, 235, 59, 0.1);
    letter-spacing: 0.5px;
}

/* Quick Chat panel */
.quick-chat-panel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 12px;
}

.quick-chat-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #a0a0c0;
    font-family: var(--font-body);
    font-size: 0.85rem;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-chat-btn:hover {
    background: rgba(0, 240, 255, 0.08);
    border-color: var(--neon-cyan);
    color: #fff;
    transform: translateY(-1px);
}

.chat-input-area {
    display: flex;
    gap: 8px;
}

.chat-input-area input {
    flex-grow: 1;
    font-size: 1rem;
    padding: 10px 14px;
}

.chat-input-area .btn {
    padding: 10px 20px;
}

/* Action panels */
.actions-panel {
    padding: 15px 24px;
}

.actions-panel::before {
    display: none;
}

.action-buttons-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 15px;
}

.action-buttons-grid .btn {
    width: 100%;
    padding: 12px 10px;
    font-size: 0.95rem;
}

/* ==========================================================================
   TOAST NOTIFICATION STYLES
   ========================================================================== */

.toast {
    position: fixed;
    top: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: rgba(10, 10, 25, 0.95);
    color: #fff;
    border: 1px solid var(--neon-pink);
    border-radius: 8px;
    padding: 12px 28px;
    font-family: var(--font-header);
    font-size: 1rem;
    letter-spacing: 0.5px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px var(--neon-pink-glow);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

.toast.toast-cyan {
    border-color: var(--neon-cyan);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px var(--neon-cyan-glow);
}

.toast.toast-yellow {
    border-color: var(--neon-yellow);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px var(--neon-yellow-glow);
}

.toast.hidden {
    opacity: 0;
    transform: translateX(-50%) translateY(-50px);
    pointer-events: none;
}

/* ==========================================================================
   FOOTER STYLES
   ========================================================================== */

.app-footer {
    text-align: center;
    padding: 15px 0;
    font-size: 0.8rem;
    color: #6a6a85;
    letter-spacing: 1px;
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    margin-top: 20px;
}

/* ==========================================================================
   RESPONSIVE DESIGN (BREAKPOINTS)
   ========================================================================== */

@media (max-width: 1024px) {
    .game-arena-grid {
        grid-template-columns: 1fr;
    }
    
    .chat-panel {
        height: 380px;
    }
}

@media (max-width: 768px) {
    .lobby-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .glitch-text {
        font-size: 2.5rem;
    }
    
    .mode-options, .format-options {
        grid-template-columns: 1fr;
    }
    
    .lobby-roster-grid {
        grid-template-columns: 1fr;
    }
    
    .lobby-footer-grid {
        grid-template-columns: 1fr;
    }
    
    .board-container {
        padding: 10px;
        min-height: auto;
    }
    
    #game-board.board-3x3 {
        width: 290px;
        height: 290px;
    }
    
    #game-board.board-3x3 .cell {
        font-size: 3rem;
    }
    
    #game-board.board-caro .cell {
        font-size: 0.95rem;
    }
    
    .team-score-hud {
        flex-direction: column;
        gap: 15px;
    }
    
    .hud-o {
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
    }
    
    .vs-badge {
        margin: 5px 0;
        transform: rotate(90deg);
    }
}

/* Kick Player Button */
.btn-kick {
    background: rgba(255, 30, 80, 0.15);
    color: #ff3c69;
    border: 1px solid #ff1e50;
    border-radius: 4px;
    padding: 3px 8px;
    font-size: 0.75rem;
    font-family: var(--font-header);
    font-weight: 700;
    cursor: pointer;
    margin-left: 10px;
    transition: all 0.2s ease;
}

.btn-kick:hover {
    background: #ff1e50;
    color: #fff;
    box-shadow: 0 0 8px rgba(255, 30, 80, 0.6);
}

/* ==========================================================================
   GUEST WAITING SCREEN & NEON ANIMATIONS
   ========================================================================== */

.guest-waiting-card {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px 30px;
    min-height: 250px;
    text-align: center;
    border: 1px solid rgba(0, 240, 255, 0.3) !important;
    box-shadow: 0 0 25px rgba(0, 240, 255, 0.15) !important;
    background: rgba(10, 10, 30, 0.75) !important;
    border-radius: 12px;
}

.waiting-status-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    max-width: 500px;
}

/* Neon pulsing ring animation */
.neon-pulse-ring {
    position: relative;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(0, 240, 255, 0.05);
    border: 2px solid var(--neon-cyan);
    box-shadow: 0 0 15px var(--neon-cyan-glow);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 10px;
    animation: neonRingPulse 2s infinite ease-in-out;
}

.pulse-core {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--neon-cyan);
    box-shadow: 0 0 20px var(--neon-cyan);
    animation: neonCorePulse 2s infinite ease-in-out;
}

.glow-text-cyan {
    color: var(--neon-cyan);
    font-family: var(--font-header);
    font-size: 1.6rem;
    letter-spacing: 2px;
    text-shadow: 0 0 10px var(--neon-cyan-glow);
}

.waiting-subtext {
    font-size: 1.15rem;
    color: #a0a0c0;
    line-height: 1.5;
}

.waiting-tip-box {
    margin-top: 10px;
    padding: 12px 18px;
    background: rgba(255, 235, 59, 0.05);
    border: 1px solid rgba(255, 235, 59, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 450px;
}

.tip-icon {
    font-size: 1.3rem;
}

.waiting-tip {
    font-size: 0.95rem;
    color: rgba(255, 235, 59, 0.85);
    text-align: left;
    margin: 0;
    line-height: 1.4;
}

@keyframes neonRingPulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
        border-color: rgba(0, 240, 255, 0.6);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 25px rgba(0, 240, 255, 0.7);
        border-color: rgba(0, 240, 255, 1);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
        border-color: rgba(0, 240, 255, 0.6);
    }
}

@keyframes neonCorePulse {
    0% {
        transform: scale(0.85);
        opacity: 0.7;
    }
    50% {
        transform: scale(1.15);
        opacity: 1;
        background: var(--neon-pink);
        box-shadow: 0 0 25px var(--neon-pink);
    }
    100% {
        transform: scale(0.85);
        opacity: 0.7;
    }
}
