* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --primary: #FF6B6B;
    --primary-dark: #EE5A52;
    --secondary: #4ECDC4;
    --bg: #1a1a1a;
    --bg-light: #2a2a2a;
    --bg-lighter: #333;
    --text: #eee;
    --text-muted: #888;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    text-align: center;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

h1 {
    margin-bottom: 15px;
    color: var(--primary);
    animation: slideDown 0.6s ease-out;
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat {
    background: var(--bg-light);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    transition: transform 0.2s ease;
}

.stat:hover {
    transform: scale(1.05);
}

.app-container {
    display: flex;
    gap: 20px;
    max-width: 1400px;
    margin: 0 auto;
    justify-content: center;
    flex-wrap: wrap;
    flex: 1;
}

.game-section {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.canvas-wrapper {
    position: relative;
    width: 500px;
    height: 500px;
}

#pixel-canvas, #effects-canvas {
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 5px;
}

#pixel-canvas {
    background: #2a2a2a;
    border: 2px solid #444;
    cursor: crosshair;
    image-rendering: pixelated;
}

#effects-canvas {
    pointer-events: none;
}

#target {
    position: absolute;
    font-size: 40px;
    cursor: pointer;
    transition: all 0.1s ease;
    animation: pulse 0.5s infinite;
    z-index: 10;
}

#target:hover {
    transform: scale(1.2);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.toolbar {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.team-selector {
    display: flex;
    gap: 5px;
}

.team-btn {
    width: 60px;
    height: 35px;
    border: 3px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
    color: #000;
    transition: all 0.2s ease;
}

.team-btn.active {
    border-color: #fff;
    box-shadow: 0 0 15px currentColor;
    transform: scale(1.1);
}

.toolbar button {
    padding: 8px 16px;
    font-size: 14px;
    background-color: #555;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toolbar button:hover {
    background-color: #666;
    transform: translateY(-2px);
}

.leaderboard {
    margin-top: 15px;
    background: var(--bg-lighter);
    padding: 12px;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.leaderboard h3 {
    margin-bottom: 10px;
    color: var(--primary);
}

#leaderboard-list {
    list-style: none;
    text-align: left;
}

#leaderboard-list li {
    padding: 6px 10px;
    margin: 4px 0;
    background: var(--bg);
    border-radius: 4px;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
    from { transform: translateX(-20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.chat-section {
    width: 350px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.user-list,.chat-container {
    background: var(--bg-light);
    padding: 15px;
    border-radius: 10px;
}

.user-list h3 {
    margin-bottom: 10px;
    color: var(--primary);
}

#user-list {
    list-style: none;
    text-align: left;
    max-height: 150px;
    overflow-y: auto;
}

#user-list li {
    padding: 6px 10px;
    background: var(--bg-lighter);
    margin: 4px 0;
    border-radius: 4px;
    font-size: 14px;
}

.emoji-bar {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.emoji-btn {
    font-size: 24px;
    padding: 8px;
    background: var(--bg-lighter);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.emoji-btn:hover {
    transform: scale(1.3) rotate(10deg);
    background: var(--primary);
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-log {
    flex: 1;
    min-height: 250px;
    max-height: 300px;
    overflow-y: auto;
    background: var(--bg);
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 10px;
}

#chat-log-list {
    list-style: none;
    text-align: left;
}

#chat-log-list li {
    padding: 6px 8px;
    margin: 4px 0;
    border-radius: 4px;
    word-wrap: break-word;
    font-size: 14px;
    animation: fadeInMsg 0.3s ease;
}

@keyframes fadeInMsg {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#chat-log-list li.system {
    color: var(--text-muted);
    font-style: italic;
}

.chat-input-area {
    display: flex;
    gap: 8px;
}

#chat-input {
    flex: 1;
    padding: 10px;
    font-size: 14px;
    background: var(--bg-lighter);
    border: 1px solid #444;
    border-radius: 5px;
    color: var(--text);
}

#send-button {
    padding: 10px 20px;
    font-size: 14px;
    background-color: var(--primary);
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-light);
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

#username-input {
    padding: 10px;
    font-size: 16px;
    background: var(--bg-lighter);
    border: 1px solid #444;
    border-radius: 5px;
    color: var(--text);
    margin: 15px 0;
    width: 250px;
}

#join-btn {
    padding: 10px 30px;
    font-size: 16px;
    background-color: var(--primary);
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

#game-overlay {
    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: 2000;
}

.game-result {
    background: var(--bg-light);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    animation: bounceIn 0.5s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.hidden {
    display: none!important;
}

footer {
    margin-top: 30px;
    padding: 20px;
    color: var(--text-muted);
    font-size: 14px;
    border-top: 1px solid #333;
}

@media (max-width: 950px) {
   .app-container {
        flex-direction: column;
        align-items: center;
    }
   .chat-section {
        width: 100%;
        max-width: 500px;
    }
}

@media (max-width: 550px) {
   .canvas-wrapper {
        width: 100%;
        max-width: 350px;
        height: 350px;
    }
    #pixel-canvas, #effects-canvas {
        width: 100%;
        height: 100%;
    }
}