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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 1400px;
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.3s ease-in;
}

.screen.active {
    display: block;
}

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

/* Cards */
.card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    margin: 0 auto;
}

/* Logo */
.logo-container {
    text-align: center;
    margin-bottom: 20px;
}

.game-logo {
    max-width: 300px;
    width: 80%;
    height: auto;
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

h1 {
    font-size: 2.5rem;
    color: #667eea;
    text-align: center;
    margin-bottom: 10px;
}

h2 {
    font-size: 2rem;
    color: #667eea;
    text-align: center;
    margin-bottom: 20px;
}

h3 {
    font-size: 1.3rem;
    color: #333;
    margin-bottom: 15px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

/* Input Groups */
.input-group {
    margin-bottom: 20px;
}

input[type="text"] {
    width: 100%;
    padding: 15px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: all 0.3s;
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Buttons */
.button-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.btn {
    flex: 1;
    padding: 15px 30px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

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

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
}

/* Room Code Display */
.room-code-display {
    background: #f5f5f5;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.room-code {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
    letter-spacing: 5px;
}

.room-code.hidden {
    filter: blur(10px);
    user-select: none;
}

/* Players List */
.players-section {
    margin-bottom: 30px;
}

.players-list {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 15px;
    min-height: 100px;
}

.player-item {
    background: white;
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.player-item.host {
    border-left: 4px solid #667eea;
}

.player-item.disconnected {
    opacity: 0.5;
    background: #f0f0f0;
}

.player-badge {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Lobby Actions */
.lobby-actions {
    display: flex;
    gap: 10px;
}

.status-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
}

/* Game Screen */
.game-logo-top {
    margin-bottom: 15px;
    padding-left: 5px;
}

.game-logo-top img {
    height: 120px;
    width: auto;
}

.game-header {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.game-info {
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    font-size: 1.1rem;
}

.word-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.word-display {
    color: #667eea;
    font-size: 1.5rem;
}

.word-display.hidden {
    filter: blur(8px);
    user-select: none;
}

.timer-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 30px;
    border-radius: 15px;
    font-size: 2.5rem;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    min-width: 100px;
    text-align: center;
}

.timer-display strong {
    color: white;
}

/* Difficulty Badge */
.difficulty-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
}

.difficulty-badge:hover {
    transform: translateY(-2px);
}

.difficulty-easy {
    background: linear-gradient(135deg, #56CCF2, #2F80ED);
    color: white;
}

.difficulty-medium {
    background: linear-gradient(135deg, #F2C94C, #F2994A);
    color: white;
}

.difficulty-hard {
    background: linear-gradient(135deg, #EB5757, #C92A2A);
    color: white;
}

.difficulty-very-hard {
    background: linear-gradient(135deg, #9B51E0, #6B1B9A);
    color: white;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 3px 10px rgba(155, 81, 224, 0.4);
    }
    50% {
        box-shadow: 0 3px 20px rgba(155, 81, 224, 0.8);
    }
}

.word-section {
    margin-top: 20px;
    padding: 20px;
    background: #f8f9fa;
    border: 2px solid #6c757d;
    border-radius: 10px;
    text-align: center;
}

.word-display-container {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 5px;
    padding: 20px;
}

.word-display {
    color: #667eea;
    font-size: 3rem;
    font-weight: bold;
}

.word-display.hidden {
    filter: blur(15px);
    user-select: none;
}

.game-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

/* Canvas Section */
.canvas-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    position: relative;
}

#drawingCanvas {
    width: 100%;
    height: auto;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: crosshair;
    background: white;
}

.canvas-controls {
    margin-top: 15px;
}

.color-picker {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.color-btn {
    width: 40px;
    height: 40px;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-color: #333;
    box-shadow: 0 0 0 2px white, 0 0 0 4px #333;
}

.tool-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.tool-controls label {
    display: flex;
    align-items: center;
    gap: 10px;
}

#brushSize {
    width: 120px;
}

/* Overlays */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
    border-radius: 15px;
}

.overlay.hidden {
    display: none;
}

.overlay-content {
    text-align: center;
    color: white;
}

.overlay-content h2 {
    color: white;
    font-size: 2.5rem;
    margin-bottom: 15px;
}

.overlay-content p {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.countdown {
    font-size: 5rem;
    font-weight: bold;
    color: #667eea;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.celebration {
    animation: celebration 0.5s ease-out;
}

@keyframes celebration {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); opacity: 1; }
}

.word-reveal {
    font-size: 1.5rem;
    margin-top: 15px;
}

/* Status Section */
.status-section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.chat-log {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 15px;
    height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-family: 'Consolas', 'Monaco', monospace;
}

.chat-message {
    padding: 8px;
    margin-bottom: 5px;
    border-radius: 5px;
    background: white;
    word-wrap: break-word;
}

.chat-message .username {
    font-weight: bold;
    color: #667eea;
    margin-right: 5px;
}

.chat-message .guess {
    color: #333;
}

.chat-message.correct {
    background: #d4edda;
    border-left: 4px solid #28a745;
}

.chat-message.correct .username {
    color: #155724;
}

.chat-message.system {
    background: #e7f3ff;
    color: #004085;
    font-style: italic;
    text-align: center;
}

.instructions {
    background: #fff9e6;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #ffc107;
}

.instructions h4 {
    margin-bottom: 10px;
    color: #856404;
}

.instructions ul {
    margin-left: 20px;
}

.instructions li {
    margin-bottom: 5px;
    color: #856404;
}

/* Intermission Screen */
.intermission-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.intermission-container h2 {
    text-align: center;
    color: white;
    margin-bottom: 20px;
}

.intermission-info {
    background: white;
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.intermission-info h3 {
    color: #667eea;
    margin-bottom: 10px;
}

.intermission-scoreboard {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.intermission-scoreboard h3 {
    text-align: center;
    color: #667eea;
    margin-bottom: 15px;
}

.score-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.score-item {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 4px solid #667eea;
}

.score-item.leading {
    background: linear-gradient(135deg, #fff3cd 0%, #ffe69c 100%);
    border-left-color: #ffc107;
    font-weight: 600;
}

.score-name {
    font-size: 1.1rem;
}

.score-points {
    font-size: 1.3rem;
    font-weight: bold;
    color: #667eea;
}

.round-points {
    color: #2196F3;
    font-weight: bold;
    margin-right: 5px;
}

.drawings-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.intermission-chat-section {
    background: white;
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.intermission-chat-section h3 {
    text-align: center;
    color: #667eea;
    margin-bottom: 15px;
}

.intermission-chat-log {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 15px;
    height: 300px;
    overflow-y: auto;
    font-size: 0.9rem;
    font-family: 'Consolas', 'Monaco', monospace;
}

.unified-chat-message {
    padding: 8px;
    margin-bottom: 5px;
    border-radius: 5px;
    background: white;
    word-wrap: break-word;
}

.unified-chat-message .streamer-tag {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    margin-right: 5px;
    font-weight: bold;
}

.unified-chat-message .username {
    font-weight: bold;
    color: #764ba2;
    margin-right: 5px;
}

.unified-chat-message .message-text {
    color: #333;
}

.drawing-card {
    background: white;
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.drawing-card h4 {
    margin-bottom: 10px;
    color: #667eea;
}

.drawing-card canvas {
    width: 100%;
    height: auto;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    background: white;
}

.ready-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.ready-status {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.ready-status p {
    margin: 10px 0;
}

.ready-player {
    display: inline-block;
    background: #d4edda;
    color: #155724;
    padding: 5px 15px;
    border-radius: 20px;
    margin: 5px;
    font-weight: 600;
}

.btn-large {
    font-size: 1.2rem;
    padding: 20px 40px;
}

.btn-large:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

/* Leaderboard */
.leaderboard {
    margin: 30px 0;
}

#leaderboardList {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 15px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.leaderboard-item:first-child {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    font-size: 1.2rem;
    font-weight: bold;
}

.leaderboard-item:nth-child(2) {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
}

.leaderboard-item:nth-child(3) {
    background: linear-gradient(135deg, #cd7f32 0%, #e8a87c 100%);
}

.rank {
    font-weight: bold;
    font-size: 1.5rem;
    margin-right: 15px;
}

/* Reconnecting Overlay */
.reconnecting-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.reconnecting-overlay.hidden {
    display: none;
}

.reconnecting-content {
    text-align: center;
    color: white;
}

.reconnecting-content h2 {
    color: white;
    margin-bottom: 15px;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 20px auto;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: #f44336;
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.toast.hidden {
    display: none;
}

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

/* Utility */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 1200px) {
    .game-content {
        grid-template-columns: 1fr;
    }

    #drawingCanvas {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .card {
        padding: 20px;
    }

    h1 {
        font-size: 2rem;
    }

    .game-info {
        font-size: 0.9rem;
    }

    .color-picker {
        flex-wrap: wrap;
    }
}
