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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3a 100%);
    color: #ffffff;
    min-height: 100vh;
    padding: 20px;
}

#app-container {
    max-width: 1400px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    border-radius: 15px;
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
}

.title {
    font-size: 3.5em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 5px;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
}

.tagline {
    font-size: 1.2em;
    opacity: 0.9;
    font-style: italic;
}

#model-selection {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 20px;
    margin-bottom: 30px;
    align-items: center;
}

.player-select {
    background: rgba(255, 255, 255, 0.05);
    padding: 25px;
    border-radius: 15px;
    border: 3px solid;
    transition: all 0.3s;
}

.player-1 {
    border-color: #3b82f6;
}

.player-2 {
    border-color: #f97316;
}

.player-select h2 {
    font-size: 1.4em;
    margin-bottom: 15px;
    text-align: center;
}

.model-select {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 15px;
}

.model-display {
    text-align: center;
    padding: 20px;
    border: 2px solid transparent;
    border-radius: 10px;
    transition: all 0.3s;
}

.model-avatar {
    font-size: 4em;
    margin-bottom: 10px;
}

.model-name {
    font-size: 1.3em;
    font-weight: bold;
}

.vs-indicator {
    font-size: 3em;
    font-weight: bold;
    text-align: center;
    color: #ec4899;
    text-shadow: 0 0 20px rgba(236, 72, 153, 0.8);
}

#game-area {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 20px;
    margin-bottom: 30px;
}

#game-container {
    position: relative;
}

#score-display {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    font-size: 3em;
    font-weight: bold;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
}

.score {
    display: inline-block;
    min-width: 60px;
    text-align: center;
}

.score-separator {
    margin: 0 20px;
    opacity: 0.5;
}

#pong-canvas {
    display: block;
    width: 100%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.3);
}

#ai-chat-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid rgba(236, 72, 153, 0.3);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 400px;
    max-height: 600px;
}

#ai-chat-box h3 {
    margin-bottom: 15px;
    color: #ec4899;
    text-align: center;
    flex-shrink: 0;
}

#ai-chat-feed {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-right: 10px;
    scroll-behavior: smooth;
}

.chat-message {
    display: flex;
    gap: 10px;
    animation: slideIn 0.3s ease-out;
}

.chat-left {
    align-items: flex-start;
}

.chat-right {
    align-items: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    font-size: 2em;
    flex-shrink: 0;
}

.chat-bubble {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 15px;
    border-radius: 12px;
    border-left: 3px solid;
    max-width: 85%;
}

.chat-right .chat-bubble {
    border-left: none;
    border-right: 3px solid;
}

.chat-name {
    font-weight: bold;
    font-size: 0.85em;
    margin-bottom: 4px;
    opacity: 0.9;
}

.chat-text {
    font-size: 0.95em;
    line-height: 1.4;
}

#controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    align-items: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 20px;
}

.control-btn {
    padding: 12px 30px;
    font-size: 1.1em;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.control-btn.primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.control-btn.primary:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

.control-btn:not(.primary) {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.control-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
}

.control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.control-btn.small {
    padding: 8px 16px;
    font-size: 0.9em;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.control-group label {
    font-size: 0.95em;
    opacity: 0.9;
}

.control-group input[type="range"] {
    width: 150px;
}

.control-group select {
    padding: 8px 15px;
    font-size: 1em;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    cursor: pointer;
}

#commentary-box {
    background: rgba(0, 0, 0, 0.3);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid rgba(236, 72, 153, 0.3);
    margin-bottom: 20px;
    max-height: 250px;
    overflow-y: auto;
}

#commentary-box h3 {
    margin-bottom: 15px;
    color: #ec4899;
}

#commentary-feed {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.commentary-entry {
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border-left: 3px solid #ec4899;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

#stats-sidebar {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 10px;
    border: 2px solid rgba(99, 102, 241, 0.3);
}

#stats-sidebar h3 {
    margin-bottom: 15px;
    color: #6366f1;
}

#leaderboard {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.leaderboard-entry {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    border-left: 3px solid #6366f1;
}

.rank {
    font-size: 1.2em;
    font-weight: bold;
    color: #fbbf24;
    min-width: 40px;
}

.model-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.model-info .avatar {
    font-size: 1.5em;
}

.model-info .name {
    font-weight: bold;
}

.stats {
    text-align: right;
}

.win-rate {
    color: #10b981;
    font-weight: bold;
}

.no-stats {
    text-align: center;
    opacity: 0.6;
    padding: 20px;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    opacity: 0.7;
}

footer a {
    color: #ec4899;
    text-decoration: none;
    font-weight: bold;
}

footer a:hover {
    text-decoration: underline;
}

/* Mobile responsiveness */
@media (max-width: 1024px) {
    #game-area {
        grid-template-columns: 1fr;
    }
    
    #ai-chat-box {
        min-height: 300px;
    }
}

@media (max-width: 768px) {
    .title {
        font-size: 2em;
        letter-spacing: 2px;
    }
    
    .tagline {
        font-size: 1em;
    }
    
    #model-selection {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .vs-indicator {
        order: 2;
        font-size: 2em;
    }
    
    .player-1 {
        order: 1;
    }
    
    .player-2 {
        order: 3;
    }
    
    #score-display {
        font-size: 2em;
    }
    
    #controls {
        flex-direction: column;
    }
    
    .control-btn {
        width: 100%;
    }
}

/* Scrollbar styling for chat feed */
#ai-chat-feed::-webkit-scrollbar {
    width: 8px;
}

#ai-chat-feed::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

#ai-chat-feed::-webkit-scrollbar-thumb {
    background: rgba(236, 72, 153, 0.5);
    border-radius: 4px;
}

#ai-chat-feed::-webkit-scrollbar-thumb:hover {
    background: rgba(236, 72, 153, 0.7);
}

/* Scrollbar styling for commentary */
#commentary-box::-webkit-scrollbar {
    width: 8px;
}

#commentary-box::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

#commentary-box::-webkit-scrollbar-thumb {
    background: rgba(236, 72, 153, 0.5);
    border-radius: 4px;
}

#commentary-box::-webkit-scrollbar-thumb:hover {
    background: rgba(236, 72, 153, 0.7);
}