/* RBFighter2 Web Styles */

:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --accent-blue: #3b82f6;
    --accent-red: #ef4444;
    --accent-gold: #f59e0b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 1rem;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 1280px;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.1),
        0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    gap: 1.5rem;
    transition: opacity 0.3s ease;
}

#loading.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-text {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress {
    height: 100%;
    width: 30%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-gold));
    border-radius: 2px;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(200%); }
    100% { transform: translateX(-100%); }
}

#controls-info {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
}

#controls-info h3 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.player-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.player h4 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.player:first-child h4 {
    color: var(--accent-blue);
}

.player:last-child h4 {
    color: var(--accent-red);
}

.player ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.player li {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
}

/* Menu overlay */
#menu-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
}

#menu-overlay.hidden {
    display: none;
}

.menu-panel {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 2rem;
    min-width: 320px;
    text-align: center;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1),
                0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.menu-panel h2 {
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.menu-buttons button,
#online-options button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

#btn-local {
    background: var(--accent-blue);
    color: white;
}

#btn-online {
    background: var(--accent-gold);
    color: black;
}

#btn-join {
    background: var(--accent-blue);
    color: white;
    width: 100%;
    margin-top: 0.5rem;
}

.menu-buttons button:hover,
#online-options button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#online-options {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

#online-options.hidden {
    display: none;
}

#online-options input {
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 1rem;
}

#online-options input::placeholder {
    color: var(--text-secondary);
}

#connection-status {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

#connection-status.connected {
    color: #22c55e;
}

#connection-status.error {
    color: #ef4444;
}

/* Stats overlay */
#stats-overlay {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.75rem;
    z-index: 1000;
    min-width: 140px;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.15rem 0;
    gap: 1rem;
}

.stats-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.stats-value {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
}

/* Color coding for values */
.stats-value.good {
    color: #22c55e;
}

.stats-value.warning {
    color: var(--accent-gold);
}

.stats-value.bad {
    color: var(--accent-red);
}

/* Online-only stats hidden in local mode */
.stats-online-only {
    display: none;
}

.stats-online-only.visible {
    display: flex;
}

/* Rollback flash indicator */
.rollback-indicator {
    background: rgba(239, 68, 68, 0.2);
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    margin-top: 0.25rem;
    animation: rollback-flash 0.3s ease-out;
}

.rollback-indicator.hidden {
    display: none !important;
}

@keyframes rollback-flash {
    0% {
        background: rgba(239, 68, 68, 0.6);
        transform: scale(1.05);
    }
    100% {
        background: rgba(239, 68, 68, 0.2);
        transform: scale(1);
    }
}

.rollback-indicator .stats-label {
    color: var(--accent-red);
}

.rollback-indicator .stats-value {
    color: var(--accent-red);
}

/* Responsive */
@media (max-width: 640px) {
    .player-controls {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    #controls-info {
        padding: 1rem;
    }

    #stats-overlay {
        top: 0.5rem;
        right: 0.5rem;
        font-size: 0.65rem;
        padding: 0.5rem 0.75rem;
        min-width: 120px;
    }
}
