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

:root {
    --bg: #ffffff;
    --text: #000000;
    --text-muted: #525252;
    --card-bg: #f5f5f5;
    --border: #e5e5e5;
    --accent: #000000;
    --shadow: rgba(0, 0, 0, 0.1);
    --success: #4caf50;
    --danger: #f44336;
    --warning: #ff9800;
}

[data-theme="dark"] {
    --bg: #000000;
    --text: #ffffff;
    --text-muted: #a3a3a3;
    --card-bg: #0a0a0a;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #ffffff;
    --shadow: rgba(0, 0, 0, 0.9);
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 1000;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--text);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.theme-toggle:hover {
    background: var(--text);
    color: var(--bg);
}

.theme-icon {
    transition: transform 0.3s ease;
}

.theme-toggle:hover .theme-icon {
    transform: rotate(180deg);
}

/* Back Home Button */
.back-home {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 200;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--text);
    border-radius: 50px;
    transition: all 0.3s ease;
    background: transparent;
    text-transform: lowercase;
}

.back-home:hover {
    background: var(--text);
    color: var(--bg);
}

/* Screens */
.screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.screen.hidden {
    display: none;
}

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

/* Typography */
.title {
    font-size: 3rem;
    font-weight: 200;
    text-align: center;
    margin-bottom: 0.5rem;
    text-transform: lowercase;
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    font-weight: 200;
    margin-bottom: 3rem;
    font-size: 0.9rem;
}

/* Card */
.card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 2rem;
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

/* Input */
.input {
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 200;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.input:focus {
    outline: none;
    border-color: var(--text);
}

.input::placeholder {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    width: 100%;
    padding: 1rem 2rem;
    border: 2px solid var(--text);
    border-radius: 10px;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 200;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: lowercase;
    background: transparent;
    color: var(--text);
}

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

.btn-primary {
    background: var(--text);
    color: var(--bg);
}

.btn-primary:hover:not(:disabled) {
    opacity: 0.8;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--text);
    color: var(--bg);
}

.btn-danger {
    border-color: var(--danger);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

.btn-small {
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    margin-top: 1rem;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.divider {
    text-align: center;
    color: var(--text-muted);
    font-weight: 200;
    font-size: 0.9rem;
}

/* Info Text */
.info-text {
    margin-top: 2rem;
    text-align: center;
}

.info-text p {
    color: var(--text-muted);
    font-weight: 200;
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

/* Room Header */
.room-header {
    text-align: center;
    margin-bottom: 2rem;
}

.room-code-label {
    font-size: 0.9rem;
    font-weight: 200;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: lowercase;
}

.room-code {
    font-size: 3rem;
    font-weight: 200;
    letter-spacing: 0.5rem;
    color: var(--text);
    margin-bottom: 1rem;
}

.btn-copy {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-weight: 200;
    transition: all 0.3s ease;
    text-transform: lowercase;
}

.btn-copy:hover {
    border-color: var(--text);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: var(--text);
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    text-align: center;
    color: var(--text-muted);
    font-weight: 200;
    font-size: 0.9rem;
}

/* Player List */
.player-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 1rem;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}

.player-name {
    font-weight: 200;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.player-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.player-status.offline {
    background: var(--text-muted);
}

.player-streak {
    font-weight: 300;
    color: var(--text);
}

/* Game Layout */
.game-layout {
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    gap: 2rem;
    padding: 2rem;
    min-height: 100vh;
}

.sidebar {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    height: fit-content;
    position: sticky;
    top: 2rem;
}

.sidebar h3 {
    font-size: 1.1rem;
    font-weight: 300;
    margin-bottom: 1rem;
    color: var(--text);
    text-transform: lowercase;
}

/* Leaderboard */
.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.leaderboard-item.you {
    border-color: var(--text);
}

.rank {
    font-size: 1.2rem;
    font-weight: 300;
    min-width: 30px;
}

.leaderboard-name {
    font-weight: 200;
    font-size: 0.9rem;
}

.leaderboard-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.leaderboard-stats {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 200;
}

.leaderboard-streak {
    font-weight: 300;
    color: var(--text);
    font-size: 1.1rem;
}

/* Game Main */
.game-main {
    display: flex;
    flex-direction: column;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border-radius: 10px;
    border: 1px solid var(--border);
}

.room-info {
    font-weight: 200;
    color: var(--text-muted);
    text-transform: lowercase;
}

.your-streak {
    font-weight: 200;
    color: var(--text-muted);
    text-transform: lowercase;
}

.streak-number {
    font-size: 2rem;
    font-weight: 300;
    color: var(--text);
    margin-left: 0.5rem;
}

/* Question Card */
.question-card {
    background: var(--card-bg);
    border-radius: 10px;
    padding: 3rem;
    border: 1px solid var(--border);
}

.question-number {
    font-size: 0.9rem;
    font-weight: 200;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: lowercase;
}

.question-timer {
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.question-timer.urgent {
    color: var(--danger);
    font-weight: 400;
}

.timer-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-bottom: 2rem;
    overflow: hidden;
}

.timer-fill {
    height: 100%;
    width: 100%;
    background: var(--text);
    transition: width 1s linear;
    border-radius: 2px;
}

.timer-fill.urgent {
    background: var(--danger);
}

.question-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.difficulty-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 200;
    margin-bottom: 2rem;
    text-transform: lowercase;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
}

.question-text {
    font-size: 1.5rem;
    font-weight: 200;
    line-height: 1.6;
    margin-bottom: 2rem;
    color: var(--text);
}

/* Answer Options */
.answer-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.answer-btn {
    padding: 1.5rem;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 200;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.answer-btn:hover:not(:disabled) {
    border-color: var(--text);
}

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

.answer-btn.selected {
    border-color: var(--text);
}

.answer-btn.correct {
    border-color: var(--success);
    background: rgba(76, 175, 80, 0.1);
}

.answer-btn.incorrect {
    border-color: var(--danger);
    background: rgba(244, 67, 54, 0.1);
}

/* Question Footer */
.question-footer {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.answer-result {
    font-size: 1.2rem;
    font-weight: 200;
    margin-bottom: 1rem;
    text-align: center;
}

.answer-result.correct {
    color: var(--success);
}

.answer-result.incorrect {
    color: var(--danger);
}

/* Game Complete */
.game-complete {
    text-align: center;
    padding: 2rem 0;
}

.game-complete h2 {
    font-size: 2rem;
    font-weight: 200;
    margin-bottom: 1rem;
    text-transform: lowercase;
}

.game-complete p {
    color: var(--text-muted);
    font-weight: 200;
    margin-bottom: 2rem;
}

.final-stats {
    display: flex;
    gap: 2rem;
    justify-content: center;
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-value {
    font-size: 3rem;
    font-weight: 200;
    color: var(--text);
}

.stat-label {
    font-size: 0.9rem;
    font-weight: 200;
    color: var(--text-muted);
    text-transform: lowercase;
}

/* Player List Game */
.player-list-game {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 500px;
    overflow-y: auto;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    margin-top: 1rem;
    color: var(--text-muted);
    font-weight: 200;
}

/* Responsive */
@media (max-width: 1024px) {
    .game-layout {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .sidebar {
        position: static;
    }

    .answer-options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }

    .room-code {
        font-size: 2rem;
        letter-spacing: 0.3rem;
    }

    .question-card {
        padding: 2rem;
    }

    .question-text {
        font-size: 1.2rem;
    }
}

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