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

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

.container {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 30px;
    max-width: 600px;
    width: 100%;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.header-controls {
    position: absolute;
    top: 20px;
    right: 20px;
}

.settings-icon {
    background: #667eea;
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5em;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.settings-icon:hover {
    background: #5a67d8;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 0;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px 15px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5em;
}

.close {
    color: white;
    font-size: 2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.modal-body {
    padding: 25px;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.settings-row:last-child {
    margin-bottom: 0;
}

.settings-row label {
    font-weight: bold;
    color: #555;
    flex: 1;
    font-size: 1.1em;
}

.settings-row select {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    max-width: 180px;
}

.settings-row select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.modal-footer {
    padding: 20px 25px;
    border-top: 2px solid #f0f0f0;
    text-align: center;
    background: #f8f9fa;
    border-radius: 0 0 15px 15px;
}

.modal-footer button {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-footer button:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

/* Multiplayer Styles */
.phase-header {
    text-align: center;
    margin-bottom: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.phase-header h3 {
    color: #333;
    margin-bottom: 10px;
}

.phase-header p {
    color: #666;
    margin: 0;
}

.current-player-info {
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 20px;
    padding: 15px;
    background: #e8f4fd;
    border-radius: 8px;
}

.setup-form {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px solid #e9ecef;
}

.input-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 15px;
}

.input-row label {
    font-weight: bold;
    color: #555;
    min-width: 120px;
    text-align: right;
}

.input-row input {
    flex: 1;
}

.multiplayer-board {
    margin: 20px 0;
}

.player-columns {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.player-column {
    flex: 1;
    min-width: 200px;
    max-width: 250px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 10px;
    padding: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.player-column.eliminated {
    background: #f8d7da;
    border-color: #f5c6cb;
    opacity: 0.7;
}

.player-column.winner {
    background: #d4edda;
    border-color: #c3e6cb;
    box-shadow: 0 6px 12px rgba(40, 167, 69, 0.3);
}

.player-header {
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 15px;
    padding: 10px;
    border-radius: 5px;
}

.player-header.active {
    background: #667eea;
    color: white;
}

.player-header.eliminated {
    background: #dc3545;
    color: white;
}

.player-header.winner {
    background: #28a745;
    color: white;
}

.player-guesses {
    max-height: 200px;
    overflow-y: auto;
}

.guess-entry-multi {
    padding: 8px;
    margin: 5px 0;
    background: #f8f9fa;
    border-radius: 5px;
    font-size: 0.9em;
}

.guess-entry-multi.correct {
    background: #d4edda;
    color: #155724;
    font-weight: bold;
}

.guess-controls {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.target-selection {
    display: flex;
    align-items: center;
    gap: 10px;
}

.target-selection label {
    font-weight: bold;
    color: #555;
}

.target-selection select {
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.target-selection select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

.results-header {
    text-align: center;
    padding: 30px;
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border-radius: 15px;
    margin: 20px 0;
}

.results-header h3 {
    font-size: 2em;
    margin-bottom: 15px;
}

#winner-announcement {
    font-size: 1.3em;
    font-weight: bold;
}

.game-info {
    text-align: center;
    margin-bottom: 30px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.game-info p {
    margin: 5px 0;
    color: #555;
}

#attempts-left, #digit-display {
    font-weight: bold;
    color: #e74c3c;
    font-size: 1.2em;
}

.input-section {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

#guess-input, #player-number-input, #multi-guess-input, #player-name-input {
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1.1em;
    width: 200px;
    text-align: center;
    transition: border-color 0.3s ease;
}

#guess-input:focus, #player-number-input:focus, #multi-guess-input:focus, #player-name-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

button {
    padding: 12px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background: #5a67d8;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.feedback-section {
    margin: 20px 0;
    text-align: center;
}

#current-guess {
    font-size: 1.3em;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

#feedback {
    font-size: 1.1em;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
}

.feedback-correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.feedback-incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.history-section {
    margin: 30px 0;
}

.history-section h3 {
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

#guess-history {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
    background: #f8f9fa;
}

.guess-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    margin: 5px 0;
    background: white;
    border-radius: 5px;
    border-left: 3px solid #667eea;
}

.guess-number {
    font-weight: bold;
    font-size: 1.1em;
}

.guess-result {
    font-size: 0.9em;
    color: #666;
}

.game-controls {
    text-align: center;
    margin: 20px 0;
}

#new-game {
    background: #28a745;
    padding: 15px 30px;
    font-size: 1.2em;
}

#new-game:hover {
    background: #218838;
}

.rules {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    border-left: 4px solid #28a745;
}

.rules h3 {
    color: #333;
    margin-bottom: 15px;
}

.rules ul {
    list-style-position: inside;
    color: #555;
}

.rules li {
    margin: 8px 0;
    line-height: 1.5;
}

.win-message {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    margin: 20px 0;
}

.lose-message {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    font-size: 1.2em;
    font-weight: bold;
    margin: 20px 0;
}

@media (max-width: 600px) {
    .container {
        margin: 10px;
        padding: 20px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .settings-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .settings-row select {
        max-width: none;
    }
    
    .input-section {
        flex-direction: column;
        align-items: center;
    }
    
    #guess-input, #player-number-input, #multi-guess-input, #player-name-input {
        width: 100%;
        max-width: 250px;
        margin-bottom: 10px;
    }
    
    .setup-form {
        padding: 15px;
    }
    
    .input-row {
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
        margin-bottom: 20px;
    }
    
    .input-row label {
        text-align: left;
        min-width: auto;
    }
}