* {
    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 {
    max-width: 800px;
    width: 100%;
}

.screen {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

h1, h2 { text-align: center; color: #333; margin-bottom: 30px; }
h1 { font-size: 2.5em; }
h3 { color: #555; margin-bottom: 15px; }
h4 { color: #666; margin-bottom: 10px; font-size: 0.95em; }

.mode-selection { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 40px; }

.mode-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; border: none; padding: 40px 20px; border-radius: 15px;
    font-size: 1.2em; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
    display: flex; flex-direction: column; align-items: center; gap: 10px;
}

.mode-btn:hover { transform: translateY(-5px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); }

/* Leaderboard Section */
.leaderboard-section {
    margin-top: 40px;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.leaderboard-header h3 {
    margin: 0;
    color: #333;
}

.leaderboard-header select {
    padding: 8px 12px;
    border: 2px solid #667eea;
    border-radius: 8px;
    background: white;
    color: #333;
    font-size: 0.9em;
    cursor: pointer;
    outline: none;
}

.leaderboard-header select:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: white;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    transition: all 0.2s;
}

.leaderboard-row:hover {
    border-color: #667eea;
    transform: translateX(5px);
}

.leaderboard-row.current-user {
    background: linear-gradient(135deg, #f0f0ff 0%, #e8e0ff 100%);
    border-color: #667eea;
}

.leaderboard-rank {
    font-size: 1.2em;
    font-weight: bold;
    min-width: 45px;
    text-align: center;
}

.leaderboard-name {
    flex: 1;
    font-weight: 600;
    color: #333;
    margin-left: 10px;
}

.leaderboard-stat {
    font-weight: 600;
    color: #667eea;
    text-align: right;
}

.leaderboard-loading,
.leaderboard-empty {
    text-align: center;
    padding: 30px;
    color: #666;
}

.mode-btn .icon { font-size: 3em; }

.setup-section { margin-bottom: 20px; }

.categories-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

.category-checkbox {
    display: flex; align-items: center; gap: 8px; padding: 10px;
    border: 2px solid #ddd; border-radius: 10px; cursor: pointer; transition: all 0.3s;
}

.category-checkbox:hover { border-color: #667eea; background: #f0f0ff; }
.category-checkbox input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }
.category-checkbox label { cursor: pointer; user-select: none; text-transform: capitalize; }

.setup-hint { font-size: 0.85em; color: #666; font-style: italic; margin-top: 10px; }

#question-count, #player-name-input, #mp-player-name-input, #mp-lobby-password-input, #mp-question-count {
    width: 100%; padding: 12px; border: 2px solid #ddd; border-radius: 10px; font-size: 1em;
}

.button-group { display: flex; gap: 15px; margin-top: 30px; }

.primary-btn, .secondary-btn {
    flex: 1; padding: 15px; border: none; border-radius: 10px; font-size: 1.1em; cursor: pointer; transition: all 0.3s;
}

.primary-btn { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; }
.primary-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4); }
.primary-btn:disabled { background: #ccc; cursor: not-allowed; transform: none; box-shadow: none; }
.secondary-btn { background: #f0f0f0; color: #333; }
.secondary-btn:hover { background: #e0e0e0; }

/* Multiplayer Screen - Create Lobby Section */
.create-lobby-section {
    background: #f8f9fa;
    border-radius: 15px;
    margin-bottom: 25px;
    overflow: hidden;
}

.create-lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.create-lobby-header:hover {
    background: #e9ecef;
}

.create-lobby-header h3 {
    margin: 0;
    color: #333;
}

.toggle-arrow {
    font-size: 1.2em;
    color: #667eea;
    transition: transform 0.3s;
}

.create-lobby-form {
    padding: 0 20px 20px 20px;
    border-top: 1px solid #e9ecef;
}

.create-lobby-form .setup-section {
    margin-bottom: 15px;
}

.create-lobby-form .primary-btn {
    width: 100%;
    margin-top: 10px;
}

/* Lobbies Section */
.lobbies-section {
    margin-bottom: 20px;
}

.lobbies-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.lobbies-header h3 {
    margin: 0;
    color: #333;
}

.icon-btn {
    background: none;
    border: 2px solid #667eea;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.2s;
}

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

/* Lobby */
.lobby-header { text-align: center; margin-bottom: 30px; }

.lobby-game-code {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; padding: 20px; border-radius: 15px; margin-bottom: 20px;
}
.lobby-game-code p { font-size: 0.9em; margin-bottom: 10px; opacity: 0.9; }
.lobby-game-code .game-id { font-size: 2.5em; font-weight: bold; letter-spacing: 5px; font-family: monospace; }

.lobby-player-count { color: #666; font-size: 0.95em; margin-top: 10px; }
.lobby-players { margin-bottom: 30px; }
.lobby-players h3 { margin-bottom: 15px; color: #333; }

.players-list { display: flex; flex-direction: column; gap: 10px; max-height: 300px; overflow-y: auto; }

.player-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 20px; background: #f8f9fa; border-radius: 10px;
    border: 2px solid #e9ecef; transition: all 0.3s;
}
.player-item.ready { border-color: #28a745; background: #e8f5e9; }

.player-info { display: flex; flex-direction: column; gap: 5px; }
.player-name { font-weight: 600; color: #333; }

.player-badge {
    font-size: 0.75em; padding: 3px 8px; border-radius: 12px;
    font-weight: 600; display: inline-block; margin-left: 8px;
}
.owner-badge { background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%); color: #856404; }

.player-h2h { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.h2h-record { font-size: 0.75em; padding: 2px 8px; background: #e9ecef; border-radius: 10px; color: #555; }

.player-status { display: flex; align-items: center; gap: 6px; font-size: 0.9em; padding: 5px 12px; border-radius: 20px; }
.status-ready { background: #28a745; color: white; }
.status-waiting { background: #ffc107; color: #856404; }

.lobby-status { text-align: center; margin-bottom: 20px; }
#ready-status { font-size: 1em; color: #666; padding: 10px; background: #f8f9fa; border-radius: 8px; }
#ready-status.all-ready { background: #d4edda; color: #155724; font-weight: 600; }

.lobby-actions { display: flex; gap: 15px; flex-wrap: wrap; }
.lobby-actions button { flex: 1; min-width: 120px; }

#ready-btn {
    background: #28a745; color: white; border: none; padding: 15px 30px;
    border-radius: 10px; font-size: 1.1em; cursor: pointer; transition: all 0.3s;
}
#ready-btn:hover { background: #218838; transform: translateY(-2px); }
#ready-btn.is-ready { background: #dc3545; }
#ready-btn.is-ready:hover { background: #c82333; }

#leave-lobby-btn {
    background: #6c757d; color: white; border: none; padding: 15px 30px;
    border-radius: 10px; font-size: 1.1em; cursor: pointer; transition: all 0.3s;
}
#leave-lobby-btn:hover { background: #5a6268; }

/* Invite Section */
.invite-section {
    margin-bottom: 30px;
    padding: 20px;
    background: #f0f7ff;
    border-radius: 12px;
    border: 2px solid #b8d4ff;
}

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

.invite-players-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.invite-player-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.invite-player-name {
    flex: 1;
    font-weight: 600;
    color: #333;
}

.invite-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85em;
    cursor: pointer;
    transition: all 0.2s;
}

.invite-btn:hover {
    transform: scale(1.05);
}

.invite-btn:disabled,
.invite-btn.invited {
    background: #28a745;
    cursor: default;
    transform: none;
}

.no-invitable-players {
    text-align: center;
    padding: 20px;
    color: #666;
}

/* Game */
.game-header { margin-bottom: 30px; }
.progress-bar { width: 100%; height: 10px; background: #e0e0e0; border-radius: 5px; overflow: hidden; margin-bottom: 15px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #667eea 0%, #764ba2 100%); transition: width 0.3s ease; }
.game-info { display: flex; justify-content: space-between; color: #666; font-size: 0.9em; }

#versus-scores {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px;
    margin-top: 15px; padding: 15px; background: #f8f8f8; border-radius: 10px;
}

.player-score-item {
    text-align: center; padding: 8px 12px; background: white; border-radius: 8px;
    font-weight: 600; font-size: 0.9em; border: 2px solid #e0e0e0;
}
.player-score-item.current-player { border-color: #667eea; background: #f0f0ff; color: #667eea; }

.question-text { font-size: 1.3em; color: #333; margin-bottom: 30px; line-height: 1.6; }
.media-container { margin: 20px 0; }
.media-container audio, .media-container video { width: 100%; border-radius: 10px; }
#answer-container { margin: 20px 0; }

.options-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }

.option-btn {
    padding: 20px; border: 2px solid #ddd; background: white; border-radius: 10px;
    cursor: pointer; transition: all 0.3s; font-size: 1em; text-align: left;
}
.option-btn:hover { border-color: #667eea; background: #f0f0ff; }
.option-btn.correct { border-color: #4caf50; background: #e8f5e9; }
.option-btn.incorrect { border-color: #f44336; background: #ffebee; }
.option-btn:disabled { cursor: not-allowed; }

.text-input-container { display: flex; flex-direction: column; gap: 15px; }
.text-input-container input { padding: 15px; border: 2px solid #ddd; border-radius: 10px; font-size: 1.1em; }
.text-input-container button {
    padding: 15px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; border: none; border-radius: 10px; font-size: 1.1em; cursor: pointer;
}

.feedback { margin-top: 20px; padding: 15px; border-radius: 10px; font-size: 1.1em; text-align: center; display: none; }
.feedback.correct { background: #e8f5e9; color: #2e7d32; border: 2px solid #4caf50; display: block; }
.feedback.incorrect { background: #ffebee; color: #c62828; border: 2px solid #f44336; display: block; }

.feedback-text { margin-bottom: 12px; }

.vote-correct-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; border: none; padding: 10px 20px; border-radius: 8px;
    font-size: 0.9em; cursor: pointer; transition: all 0.2s;
    margin-top: 5px;
}
.vote-correct-btn:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4); }
.vote-correct-btn.voted {
    background: #28a745; cursor: default; transform: none;
    box-shadow: none;
}
.vote-correct-btn:disabled { opacity: 0.9; cursor: default; }

/* Results */
#results-content { text-align: center; margin: 30px 0; }
.results-score { font-size: 3em; color: #667eea; font-weight: bold; margin: 20px 0; }
.results-message { font-size: 1.5em; color: #333; margin: 20px 0; }

.results-leaderboard { display: flex; flex-direction: column; gap: 10px; margin: 30px 0; text-align: left; }

.leaderboard-item {
    display: flex; align-items: center; padding: 15px 20px; background: #f8f9fa;
    border-radius: 10px; border: 2px solid #e9ecef;
}
.leaderboard-item.winner { background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%); border-color: #ffc107; }
.leaderboard-position { font-size: 1.5em; font-weight: bold; width: 50px; text-align: center; }
.leaderboard-player { flex: 1; font-size: 1.1em; font-weight: 600; color: #333; }
.leaderboard-score { font-size: 1.2em; font-weight: bold; color: #667eea; }

/* Answer Review */
.answers-review { margin-top: 30px; text-align: left; }
.answers-review h3 { text-align: center; margin-bottom: 10px; color: #333; }
.answers-hint { text-align: center; color: #666; font-size: 0.9em; margin-bottom: 20px; font-style: italic; }

.question-review {
    background: #f8f9fa; border-radius: 12px; padding: 15px;
    margin-bottom: 15px; border: 1px solid #e9ecef;
}
.question-review.reported { background: #fff3cd; border-color: #ffc107; opacity: 0.8; }

.question-review-header { display: flex; gap: 10px; margin-bottom: 8px; align-items: flex-start; }
.question-number { font-weight: bold; color: #667eea; white-space: nowrap; }
.question-text-review { color: #333; font-weight: 500; flex: 1; }
.question-review-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.reported-badge {
    font-size: 0.75em; padding: 3px 8px; background: #ffc107;
    color: #856404; border-radius: 10px; font-weight: 600;
}

.correct-answer-display {
    background: #d4edda; color: #155724; padding: 8px 12px;
    border-radius: 8px; margin-bottom: 10px; font-size: 0.95em;
}
.question-review.reported .correct-answer-display { background: #fff3cd; color: #856404; }

.player-answers { display: flex; flex-direction: column; gap: 6px; }

.player-answer-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    border-radius: 8px; font-size: 0.9em; transition: all 0.2s;
}
.player-answer-item.correct { background: #e8f5e9; border: 1px solid #a5d6a7; }
.player-answer-item.incorrect { background: #ffebee; border: 1px solid #ef9a9a; }
.player-answer-item.pending-votes { background: #fff8e1; border: 1px solid #ffcc02; }
.player-answer-item.voted { background: #fff3cd; border: 1px solid #ffc107; opacity: 0.8; }
.player-answer-item.clickable { cursor: pointer; }
.player-answer-item.clickable:hover {
    transform: translateX(5px); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); border-color: #667eea;
}
.player-answer-item.clickable:hover::after {
    content: " (click to vote correct)"; font-size: 0.8em; color: #667eea; font-style: italic;
}

.player-answer-name { font-weight: 600; color: #555; min-width: 80px; }
.player-answer-text { flex: 1; color: #333; }
.player-answer-status { font-size: 1.1em; font-weight: bold; }
.player-answer-item.correct .player-answer-status { color: #2e7d32; }
.player-answer-item.incorrect .player-answer-status { color: #c62828; }
.player-answer-item.pending-votes .player-answer-status { color: #f57c00; font-weight: bold; }
.vote-count { font-size: 0.8em; color: #f57c00; font-weight: 600; margin-left: auto; }

/* Modal */
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6); z-index: 1000; justify-content: center; align-items: center; padding: 20px;
}
.modal.active { display: flex; }

.modal-content {
    background: white; border-radius: 15px; max-width: 500px; width: 100%;
    max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px; border-bottom: 1px solid #e9ecef;
}
.modal-header h3 { margin: 0; color: #333; }
.modal-close { background: none; border: none; font-size: 1.5em; cursor: pointer; color: #666; padding: 0; line-height: 1; }
.modal-close:hover { color: #333; }
.modal-body { padding: 20px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; padding: 20px; border-top: 1px solid #e9ecef; }
.modal-footer button { min-width: 100px; }

/* Report Form */
.report-question-info { background: #f8f9fa; padding: 15px; border-radius: 10px; margin-bottom: 20px; }
.report-question-info p { margin: 5px 0; color: #333; }
.report-form .form-group { margin-bottom: 20px; }
.report-form label { display: block; margin-bottom: 8px; font-weight: 600; color: #333; }
.report-form input[type="text"] { width: 100%; padding: 12px; border: 2px solid #ddd; border-radius: 8px; font-size: 1em; }
.report-form input[type="text"]:focus { border-color: #667eea; outline: none; }

.report-type-options { display: flex; flex-direction: column; gap: 10px; }
.report-type-option { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.report-type-option input[type="radio"] { margin-top: 5px; }
.report-type-label {
    display: flex; flex-direction: column; padding: 12px 15px;
    border: 2px solid #ddd; border-radius: 8px; flex: 1; transition: all 0.2s;
}
.report-type-option input[type="radio"]:checked + .report-type-label.confirmed { border-color: #dc3545; background: #fff5f5; }
.report-type-option input[type="radio"]:checked + .report-type-label.think { border-color: #ffc107; background: #fffdf5; }
.report-type-label strong { color: #333; }
.report-type-label small { color: #666; margin-top: 4px; }

.report-btn {
    background: none; border: none; color: #999; font-size: 0.8em;
    cursor: pointer; padding: 2px 6px; border-radius: 4px; transition: all 0.2s;
}
.report-btn:hover { background: #ffebee; color: #dc3545; }

/* User Bar */
.user-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; padding: 10px 15px; border-radius: 10px; margin-bottom: 20px;
    display: flex; justify-content: space-between; align-items: center; font-size: 0.9em;
}
.small-btn {
    background: rgba(255, 255, 255, 0.2); color: white;
    border: 1px solid rgba(255, 255, 255, 0.3); padding: 5px 12px;
    border-radius: 5px; cursor: pointer; font-size: 0.85em; transition: all 0.2s;
}
.small-btn:hover { background: rgba(255, 255, 255, 0.3); }

/* Stats */
.stats-button-container { margin-top: 30px; text-align: center; }
.stats-btn {
    background: white; color: #667eea; border: 2px solid #667eea;
    padding: 15px 40px; border-radius: 25px; font-size: 1.1em; cursor: pointer; transition: all 0.3s;
}
.stats-btn:hover { background: #667eea; color: white; transform: translateY(-2px); }

.stats-overview {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 15px; margin-bottom: 30px;
}
.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; padding: 20px; border-radius: 12px; text-align: center;
}
.stat-card .stat-value { font-size: 2em; font-weight: bold; }
.stat-card .stat-label { font-size: 0.85em; opacity: 0.9; margin-top: 5px; }

/* Head-to-Head Stats */
.h2h-stats-section { margin-bottom: 30px; }
.h2h-stats-section h3 { margin-bottom: 15px; color: #333; }
.h2h-stats-list { display: flex; flex-direction: column; gap: 10px; }

.h2h-stat-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 15px; background: #f8f9fa; border-radius: 10px; border: 1px solid #e9ecef;
}
.h2h-opponent { font-weight: 600; color: #333; flex: 1; }
.h2h-record-detail { display: flex; gap: 10px; margin-right: 15px; }
.h2h-wins { color: #28a745; font-weight: 600; }
.h2h-losses { color: #dc3545; font-weight: 600; }
.h2h-ties { color: #ffc107; font-weight: 600; }
.h2h-winrate { color: #667eea; font-weight: 600; min-width: 100px; text-align: right; }

/* Radar Chart */
.radar-chart-container { background: #f8f9fa; border-radius: 15px; padding: 20px; margin-bottom: 30px; }
.radar-chart-container h3 { text-align: center; margin-bottom: 15px; color: #333; }
#radar-chart { max-width: 400px; margin: 0 auto; }

/* Category Stats */
.category-stats-list { margin-bottom: 30px; }
.category-stats-list h3 { margin-bottom: 15px; color: #333; }

.category-stat-item {
    display: flex; align-items: center; padding: 12px 15px;
    background: #f8f9fa; border-radius: 8px; margin-bottom: 10px;
}
.category-stat-item .category-name { flex: 1; font-weight: 600; color: #333; text-transform: capitalize; }
.category-stat-item .category-score { margin-right: 15px; color: #666; }
.category-stat-item .category-bar { width: 100px; height: 8px; background: #e0e0e0; border-radius: 4px; overflow: hidden; }
.category-stat-item .category-bar-fill {
    height: 100%; background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 4px; transition: width 0.3s;
}

/* Recent Games */
.recent-games { margin-bottom: 30px; }
.recent-games h3 { margin-bottom: 15px; color: #333; }
.recent-game-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 15px; background: #f8f9fa; border-radius: 8px; margin-bottom: 8px;
}
.recent-game-item .game-info { color: #666; font-size: 0.9em; }
.recent-game-item .game-score { font-weight: bold; color: #667eea; }

/* Reset Stats */
.reset-stats-section { margin-top: 40px; padding-top: 20px; border-top: 1px solid #e9ecef; text-align: center; }
.reset-stats-btn {
    background: #fff; color: #dc3545; border: 2px solid #dc3545;
    padding: 12px 25px; border-radius: 8px; font-size: 1em; cursor: pointer; transition: all 0.3s;
}
.reset-stats-btn:hover { background: #dc3545; color: white; }

/* Login Modal */
.login-info { color: #666; margin-bottom: 20px; font-size: 0.95em; }

/* Form Groups */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #333; }
.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%; padding: 12px; border: 2px solid #ddd; border-radius: 8px; font-size: 1em;
}
.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
    border-color: #667eea; outline: none;
}

/* No Stats */
.no-stats { text-align: center; padding: 40px 20px; color: #666; }
.no-stats h3 { color: #333; margin-bottom: 10px; }

/* Lobby Browser */
.lobby-browser-actions {
    display: flex; gap: 15px; margin-bottom: 25px; justify-content: center;
}

.lobbies-list {
    display: flex; flex-direction: column; gap: 12px;
    max-height: 400px; overflow-y: auto; margin-bottom: 20px;
}

.lobby-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 15px 20px; background: #f8f9fa; border-radius: 12px;
    border: 2px solid #e9ecef; transition: all 0.3s; cursor: pointer;
}
.lobby-item:hover {
    border-color: #667eea; background: #f0f0ff; transform: translateX(5px);
}

.lobby-info { flex: 1; }
.lobby-name { font-weight: 600; color: #333; font-size: 1.1em; margin-bottom: 5px; }
.lobby-details { font-size: 0.85em; color: #666; display: flex; gap: 15px; flex-wrap: wrap; }
.lobby-details span { display: flex; align-items: center; gap: 4px; }

.lobby-join-section { display: flex; align-items: center; gap: 10px; }
.lobby-password-icon { font-size: 1.2em; color: #ffc107; }
.lobby-join-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white; border: none; padding: 10px 20px; border-radius: 8px;
    font-size: 0.95em; cursor: pointer; transition: all 0.2s;
}
.lobby-join-btn:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4); }

.no-lobbies {
    text-align: center; padding: 40px 20px; color: #666;
    background: #f8f9fa; border-radius: 12px;
}
.no-lobbies h3 { color: #333; margin-bottom: 10px; }

.lobby-owner-name {
    color: #667eea; font-size: 1.1em; margin-bottom: 10px;
}

/* Notification Container */
.notification-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 400px;
    width: 90%;
}

.notification-toast {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease;
    border-left: 4px solid #667eea;
}

.notification-toast.success {
    border-left-color: #28a745;
}

.notification-toast.error {
    border-left-color: #dc3545;
}

.notification-toast.challenge {
    border-left-color: #ffc107;
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast-message {
    flex: 1;
    font-weight: 500;
    color: #333;
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.3em;
    cursor: pointer;
    color: #999;
    padding: 0;
    margin-left: 10px;
    line-height: 1;
}

.toast-close:hover {
    color: #333;
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    color: white;
    font-size: 0.7em;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

/* Online Players Sidebar */
.online-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 100;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.online-sidebar.open {
    transform: translateX(0);
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.sidebar-header h3 {
    margin: 0;
    color: white;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.sidebar-open-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    z-index: 99;
    transition: all 0.3s;
}

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

.sidebar-open-btn.hidden {
    display: none;
}

.online-players-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.online-player-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.online-player-item:hover {
    border-color: #667eea;
    transform: translateX(-5px);
}

.online-player-item.current-user {
    background: linear-gradient(135deg, #f0f0ff 0%, #e8e0ff 100%);
    border-color: #667eea;
}

.online-indicator {
    color: #28a745;
    font-size: 0.8em;
    margin-right: 10px;
}

.online-player-name {
    flex: 1;
    font-weight: 600;
    color: #333;
}

.online-player-games {
    font-size: 0.85em;
    color: #666;
}

.no-online-players {
    text-align: center;
    padding: 30px;
    color: #666;
}

/* Clickable leaderboard rows */
.leaderboard-row.clickable {
    cursor: pointer;
}

/* Player Profile Modal Styles */
.profile-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.profile-stat-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
}

.profile-stat-value {
    font-size: 1.5em;
    font-weight: bold;
}

.profile-stat-label {
    font-size: 0.8em;
    opacity: 0.9;
    margin-top: 5px;
}

.profile-h2h-section,
.profile-categories-section {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
}

.profile-h2h-section h4,
.profile-categories-section h4 {
    margin: 0 0 15px 0;
    color: #333;
}

.profile-h2h-record {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

.profile-h2h-record span {
    padding: 8px 15px;
    border-radius: 8px;
    font-weight: 600;
}

.profile-h2h-record .h2h-wins {
    background: #d4edda;
    color: #155724;
}

.profile-h2h-record .h2h-losses {
    background: #f8d7da;
    color: #721c24;
}

.profile-h2h-record .h2h-ties {
    background: #fff3cd;
    color: #856404;
}

.profile-categories-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-category-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 15px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.profile-category-item .category-name {
    font-weight: 600;
    color: #333;
    text-transform: capitalize;
}

.profile-category-item .category-accuracy {
    color: #667eea;
    font-weight: 600;
}

.profile-no-stats,
.profile-error {
    text-align: center;
    padding: 30px;
    color: #666;
}

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

/* Responsive */
@media (max-width: 600px) {
    body {
        padding: 10px;
        align-items: flex-start;
    }

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

    .mode-selection { grid-template-columns: 1fr; }
    .options-grid { grid-template-columns: 1fr; }
    .screen { padding: 20px; }
    .lobby-actions { flex-direction: column; }
    .lobby-actions button { width: 100%; }
    #versus-scores { grid-template-columns: 1fr 1fr; }
    .player-answer-item { flex-wrap: wrap; }
    .player-answer-name { min-width: 60px; }
    .player-answer-item.clickable:hover::after { display: block; width: 100%; margin-top: 5px; }
    .h2h-stat-item { flex-direction: column; align-items: flex-start; gap: 8px; }
    .h2h-record-detail { margin-right: 0; }
    .h2h-winrate { text-align: left; }
    .lobby-item { flex-direction: column; align-items: flex-start; gap: 15px; }
    .lobby-join-section { width: 100%; justify-content: space-between; }
    .lobby-browser-actions { flex-direction: column; }
    .leaderboard-header { flex-direction: column; align-items: stretch; }
    .leaderboard-header select { width: 100%; }

    /* Keep sidebar as slide-out overlay on mobile */
    .online-sidebar {
        width: 85%;
        max-width: 300px;
    }

    /* Keep the open button visible and properly positioned on mobile */
    .sidebar-open-btn {
        top: 10px;
        right: 10px;
        width: 45px;
        height: 45px;
        font-size: 1.2em;
        z-index: 99;
    }

    .profile-stats-grid { grid-template-columns: 1fr; }
    .notification-container {
        top: 10px;
        left: 10px;
        right: 10px;
        width: auto;
    }

    h1 { font-size: 1.8em; }
    h2 { font-size: 1.4em; }

    .mode-btn {
        padding: 25px 15px;
        font-size: 1em;
    }

    .primary-btn, .secondary-btn {
        padding: 12px;
        font-size: 1em;
    }

    .categories-grid {
        grid-template-columns: 1fr 1fr;
    }

    .button-group {
        flex-direction: column;
    }

    .button-group button {
        width: 100%;
    }
}
/* Experience Badge Styles */
.profile-experience-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    font-weight: 600;
    font-size: 0.9em;
    margin-bottom: 15px;
    text-align: center;
    letter-spacing: 1px;
}

/* Question History Section */
.profile-question-history {
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 10px;
    color: white;
}

.profile-question-history h4 {
    margin: 0 0 15px 0;
    color: white;
}

.profile-stats-grid.small {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 0;
}

.profile-stats-grid.small .profile-stat-item {
    background: rgba(255, 255, 255, 0.2);
    padding: 12px;
}

.profile-stats-grid.small .profile-stat-value {
    font-size: 1.3em;
}

.profile-stats-grid.small .profile-stat-label {
    font-size: 0.75em;
}