:root {
    --primary: #6366f1;
    --secondary: #a855f7;
    --bg-dark: #0f172a;
    --glass: rgba(15, 23, 42, 0.7);
    --text: #f8fafc;
    --accent: #22d3ee;
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
}

canvas {
    display: block;
    background-color: #1e293b;
    background-image: radial-gradient(#334155 1px, transparent 1px);
    background-size: 40px 40px;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem;
}

#header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.3));
}

#player-count {
    background: var(--glass);
    backdrop-filter: blur(12px);
    padding: 0.5rem 1rem;
    border-radius: 99px;
    border: 1px solid rgba(255,255,255,0.1);
    font-size: 0.875rem;
}

#chat-container {
    pointer-events: auto;
    width: 350px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    border-radius: 1rem;
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    max-height: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.chat-msg {
    font-size: 0.9rem;
    animation: slideIn 0.2s ease-out;
}

.chat-msg b {
    color: var(--accent);
    margin-right: 0.5rem;
}

#chat-input-row {
    padding: 1rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    gap: 0.5rem;
}

input {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0.75rem;
    border-radius: 0.5rem;
    color: white;
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--primary);
}

#chatInput {
    flex: 1;
}

button {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s, opacity 0.2s;
}

button:hover {
    opacity: 0.9;
}

button:active {
    transform: scale(0.95);
}

#controls-hint {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass);
    backdrop-filter: blur(8px);
    padding: 0.5rem 1.5rem;
    border-radius: 99px;
    font-size: 0.75rem;
    opacity: 0.6;
    color: #94a3b8;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-dark);
    padding: 3rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(255,255,255,0.1);
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 0 50px rgba(99, 102, 241, 0.2);
}

.modal-content h2 {
    margin-bottom: 1rem;
    font-size: 2rem;
}

.modal-content p {
    margin-bottom: 2rem;
    color: #94a3b8;
}

.modal-content input {
    width: 100%;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    text-align: center;
}

.modal-content button {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}
