* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #8b5cf6;
    --accent: #f59e0b;
    --chaos: #ef4444;
    --bg-dark: #0a0a0a;
    --bg-card: rgba(20, 20, 30, 0.8);
    --text: #ffffff;
    --text-muted: #9ca3af;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Animated Starfield Background */
.stars, .stars2, .stars3 {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.stars {
    background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAE0lEQVQIW2NkYGD4z8DAwMgABQASAQIBZhLRWgAAAABJRU5ErkJggg==') repeat;
    animation: starsMove 200s linear infinite;
    opacity: 0.3;
}

.stars2 {
    background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAE0lEQVQIW2NkYGD4z8DAwMgABQASAQIBZhLRWgAAAABJRU5ErkJggg==') repeat;
    animation: starsMove 150s linear infinite;
    opacity: 0.2;
}

.stars3 {
    background: transparent url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAE0lEQVQIW2NkYGD4z8DAwMgABQASAQIBZhLRWgAAAABJRU5ErkJggg==') repeat;
    animation: starsMove 100s linear infinite;
    opacity: 0.15;
}

@keyframes starsMove {
    from { transform: translateY(0); }
    to { transform: translateY(-2000px); }
}

/* Container */
.container {
    position: relative;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 40px 20px;
}

/* Back Button */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
    margin-bottom: 30px;
}

.back-btn:hover {
    color: var(--primary);
    transform: translateX(-5px);
}

/* Header */
.lobby-header {
    text-align: center;
    margin-bottom: 60px;
}

.logo-small {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.chess-piece {
    font-size: 48px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.lobby-header h1 {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: 2px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 20px;
    color: var(--accent);
    font-weight: 600;
    margin-top: 10px;
}

/* Lobby Content */
.lobby-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 40px;
    align-items: center;
    margin-bottom: 60px;
    max-width: 1000px;
    margin-left: auto;
    margin-right: auto;
}

/* Match Cards */
.match-card {
    background: var(--bg-card);
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    backdrop-filter: blur(10px);
    transition: all 0.3s;
}

.match-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary);
    box-shadow: 0 20px 60px rgba(59, 130, 246, 0.3);
}

.card-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.match-card h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 15px;
    color: var(--text);
}

.match-card p {
    color: var(--text-muted);
    margin-bottom: 30px;
    line-height: 1.6;
    font-size: 15px;
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 18px;
}

.divider span {
    padding: 15px 20px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 50%;
    border: 2px solid rgba(59, 130, 246, 0.3);
}

/* Room Input */
.room-input-group {
    margin-bottom: 25px;
}

.room-input-group input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(10, 10, 10, 0.6);
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    color: var(--text);
    font-size: 16px;
    font-family: 'Segoe UI', system-ui, sans-serif;
    transition: all 0.3s;
}

.room-input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.room-input-group input::placeholder {
    color: var(--text-muted);
}

.input-hint {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
    text-align: left;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 32px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s;
    border: 2px solid transparent;
    cursor: pointer;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: transparent;
    border-color: var(--primary);
    color: var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-3px);
}

.btn-icon {
    font-size: 20px;
}

.btn-small {
    padding: 10px 24px;
    font-size: 14px;
}

.btn-cancel {
    background: transparent;
    border: 2px solid var(--chaos);
    color: var(--chaos);
    padding: 12px 28px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-cancel:hover {
    background: var(--chaos);
    color: white;
}

/* Status Display */
.status-display {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.status-display.hidden {
    display: none;
}

.status-content {
    background: var(--bg-card);
    border: 2px solid rgba(59, 130, 246, 0.5);
    border-radius: 20px;
    padding: 50px;
    text-align: center;
    max-width: 500px;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#status-message {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 30px;
}

/* Error Display */
.error-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border: 2px solid var(--chaos);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    z-index: 1001;
    box-shadow: 0 20px 60px rgba(239, 68, 68, 0.3);
}

.error-display.hidden {
    display: none;
}

.error-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

#error-message {
    font-size: 18px;
    color: var(--text);
    margin-bottom: 25px;
    line-height: 1.6;
}

/* Info Section */
.info-section {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 15px;
    padding: 30px;
    max-width: 900px;
    margin: 0 auto;
}

.info-section h4 {
    font-size: 20px;
    color: var(--primary);
    margin-bottom: 20px;
    text-align: center;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.info-item {
    background: rgba(10, 10, 10, 0.4);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.info-item strong {
    color: var(--accent);
    display: block;
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 968px) {
    .lobby-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .divider {
        transform: rotate(90deg);
    }

    .match-card {
        max-width: 500px;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .lobby-header h1 {
        font-size: 24px;
    }

    .subtitle {
        font-size: 16px;
    }

    .match-card {
        padding: 30px 20px;
    }

    .card-icon {
        font-size: 48px;
    }

    .match-card h3 {
        font-size: 24px;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }
}
