* {
    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;
}

.container {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    min-width: 700px;
    max-width: 800px;
}

h1 {
    color: #667eea;
    margin-bottom: 30px;
}

.subtitle {
    font-size: 18px;
    color: #666;
    margin-bottom: 30px;
}

.mode-selection, .single-player-modes {
    text-align: center;
}

.mode-btn {
    display: block;
    width: 100%;
    margin: 15px 0;
    padding: 20px;
    font-size: 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.mode-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.multiplayer-options {
    text-align: center;
}

.game-type-btn {
    display: block;
    width: 100%;
    margin: 15px 0;
    padding: 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
    text-align: left;
}

.game-type-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.game-type-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 5px;
}

.game-type-desc {
    font-size: 14px;
    opacity: 0.9;
}

/* Multiplayer Setup Styles */
.multiplayer-setup {
    text-align: center;
}

.multiplayer-setup input[type="text"] {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    border: 2px solid #667eea;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
}

.room-options {
    margin: 30px 0;
}

.divider {
    margin: 20px 0;
    color: #999;
    font-size: 16px;
    font-weight: bold;
}

#roomCodeInput {
    text-transform: uppercase;
    margin-bottom: 10px;
}

/* Multiplayer Lobby Styles */
.multiplayer-lobby {
    text-align: center;
}

#roomCodeDisplay {
    color: #764ba2;
    font-weight: bold;
    letter-spacing: 2px;
}

.players-list {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    min-height: 150px;
}

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

.player-item.ready {
    border-left-color: #2ecc71;
}

.player-item.host {
    border-left-color: #f39c12;
}

.player-name {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.player-status {
    font-size: 14px;
    color: #666;
}

.player-status.ready {
    color: #2ecc71;
    font-weight: bold;
}

.player-badge {
    background: #f39c12;
    color: white;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-left: 10px;
}

.lobby-controls {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.lobby-controls button {
    flex: 1;
}

/* Multiplayer Game Scores */
.multiplayer-scores {
    background: #f5f5f5;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin: 5px 0;
    background: white;
    border-radius: 5px;
}

.score-item.current-player {
    border: 2px solid #667eea;
    background: #e8ecff;
}

.score-name {
    font-weight: bold;
    color: #333;
}

.score-value {
    font-size: 20px;
    font-weight: bold;
    color: #667eea;
}

/* Final Scoreboard */
#finalScoreboard {
    margin: 20px 0;
}

.final-score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin: 10px 0;
    background: #f5f5f5;
    border-radius: 8px;
}

.final-score-item:first-child {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    font-size: 20px;
}

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

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

.rank {
    font-weight: bold;
    margin-right: 10px;
    font-size: 24px;
}

.time-setting {
    margin: 20px auto 30px;
    text-align: center;
}

.time-setting label {
    display: block;
    margin-bottom: 10px;
    font-size: 18px;
    color: #333;
}

.time-setting input {
    width: 200px;
    padding: 10px;
    font-size: 18px;
    border: 2px solid #667eea;
    border-radius: 8px;
}

.operations-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 20px 0;
}

.operations-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.operation-row {
    background: #f5f5f5;
    padding: 15px;
    border-radius: 8px;
    text-align: left;
}

.checkbox-label {
    display: block;
    margin-bottom: 10px;
    font-size: 16px;
    color: #333;
    cursor: pointer;
    font-weight: bold;
}

.checkbox-label input {
    margin-right: 10px;
    width: auto;
    cursor: pointer;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 28px;
}

.range-inputs input {
    width: 70px;
    padding: 5px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.range-inputs span {
    color: #666;
    font-size: 14px;
}

.range-inputs-double {
    margin-left: 28px;
}

.range-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 5px 0;
}

.range-label {
    font-size: 13px;
    color: #666;
    min-width: 110px;
}

.range-group input {
    width: 60px;
    padding: 5px;
    font-size: 14px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.range-group span {
    color: #666;
    font-size: 14px;
}

button {
    background: #667eea;
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #5568d3;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.back-btn {
    margin-top: 20px;
    background: #95a5a6;
    font-size: 16px;
    padding: 12px 30px;
}

.back-btn:hover {
    background: #7f8c8d;
}

.timer {
    font-size: 48px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 20px;
}

.score {
    font-size: 24px;
    margin-bottom: 30px;
    color: #333;
}

.problem {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 30px;
    color: #333;
}

#answer {
    width: 100%;
    padding: 15px;
    font-size: 24px;
    border: 2px solid #667eea;
    border-radius: 8px;
    text-align: center;
}

#answer:focus {
    outline: none;
    border-color: #764ba2;
}

.results h2 {
    color: #667eea;
    margin-bottom: 20px;
}

.results p {
    font-size: 32px;
    margin-bottom: 30px;
    color: #333;
}

.reset-btn {
    margin-top: 20px;
    background: #e74c3c;
    font-size: 14px;
    padding: 10px 20px;
}

.reset-btn:hover {
    background: #c0392b;
}

