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

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

.container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    max-width: 800px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

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

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

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

.screen {
    display: none;
}

.screen.active {
    display: block;
}

.home-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

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

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

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

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

.btn-secondary:hover {
    background: #e0e0e0;
    transform: translateY(-2px);
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.9em;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    background: #667eea;
    color: white;
    transition: all 0.3s;
    margin-left: 10px;
}

.btn-small:hover {
    background: #5568d3;
}

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

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

.status-banner {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.status-banner.enabled {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-banner.disabled {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.room-code-display {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 1.2em;
}

.room-code-display strong {
    color: #667eea;
    font-size: 1.3em;
    letter-spacing: 2px;
}

.room-header {
    margin-bottom: 20px;
}

.game-header {
    margin-bottom: 20px;
}

.player-list {
    margin: 20px 0;
}

.player-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-item.ready {
    background: #d4edda;
    border-left: 4px solid #28a745;
}

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

.player-item.disconnected {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
}

.player-name {
    font-weight: 600;
}

.player-badge {
    background: #667eea;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8em;
    margin-left: 10px;
}

.waiting-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.hint-text {
    text-align: center;
    color: #666;
    margin-top: 20px;
    font-style: italic;
}

.current-turn {
    text-align: center;
    padding: 15px;
    background: #667eea;
    color: white;
    border-radius: 10px;
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: 20px;
}

.current-turn.my-turn {
    background: #28a745;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.game-history {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
}

.history-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
}

.history-item .player-name {
    color: #667eea;
    font-weight: 600;
}

.history-item .chain {
    margin-top: 5px;
    color: #333;
}

.turn-form {
    margin: 20px 0;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.input-hint {
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

.autocomplete-wrapper {
    position: relative;
}

.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #667eea;
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.autocomplete-results.active {
    display: block;
}

.autocomplete-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #e0e0e0;
}

.autocomplete-item:hover {
    background: #f0f0f0;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.scores-display {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.scores-display h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    background: white;
    border-radius: 8px;
    margin-bottom: 8px;
}

.score-item.leader {
    background: #ffd700;
    font-weight: 600;
}

.final-scores {
    margin: 20px 0;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 10px;
    margin: 10px 0;
    border: 1px solid #f5c6cb;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 10px;
    margin: 10px 0;
    border: 1px solid #c3e6cb;
}

.info-message {
    background: #d1ecf1;
    color: #0c5460;
    padding: 15px;
    border-radius: 10px;
    margin: 10px 0;
    border: 1px solid #bee5eb;
}

.loading {
    text-align: center;
    color: #666;
    padding: 20px;
}

.lobby-list {
    margin: 20px 0;
    max-height: 400px;
    overflow-y: auto;
}

.lobby-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
    border-left: 4px solid #667eea;
}

.lobby-item.in-progress {
    border-left: 4px solid #ffc107;
    background: #fff3cd;
}

.lobby-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.lobby-item-title {
    font-weight: 600;
    font-size: 1.1em;
    color: #333;
}

.lobby-item-status {
    font-size: 0.9em;
    color: #666;
}

.lobby-item-info {
    display: flex;
    gap: 15px;
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #666;
}

.lobby-item-players {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
}

.lobby-item-actions {
    display: flex;
    gap: 10px;
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    h1 {
        font-size: 2em;
    }

    h2 {
        font-size: 1.5em;
    }

    .btn {
        padding: 12px 20px;
        font-size: 1em;
    }

    .form-actions {
        flex-direction: column;
    }

    .waiting-actions {
        flex-direction: column;
    }

    .lobby-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .lobby-item-actions {
        flex-direction: column;
        width: 100%;
    }

    .lobby-item-actions button {
        width: 100%;
    }
}
