:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #0f3460;
    --accent: #e94560;
    --accent-hover: #ff6b81;
    --gold: #f5c518;
    --silver: #c0c0c0;
    --bronze: #cd7f32;
    --text: #eee;
    --text-muted: #aaa;
    --success: #2ecc71;
    --error: #e74c3c;
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Screens */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    flex: 1;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header / Logo */
.logo {
    text-align: center;
    margin: 2rem 0;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo p {
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

/* Forms */
.form-group {
    width: 100%;
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
}

input, select {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 2px solid transparent;
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    border-color: var(--accent);
}

input::placeholder {
    color: var(--text-muted);
}

select option {
    background: var(--bg-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1.8rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: 100%;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

@media (hover: hover) {
    .btn-primary:hover {
        background: var(--accent-hover);
        transform: translateY(-1px);
    }
    .btn-secondary:hover {
        background: #1a4a8a;
        transform: translateY(-1px);
    }
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn + .btn {
    margin-top: 0.8rem;
}

/* Menu buttons */
.menu-buttons {
    width: 100%;
    margin-top: 1.5rem;
}

/* Room / Lobby */
.room-code {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    width: 100%;
    margin: 1rem 0;
}

.room-code .code {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 8px;
    color: var(--gold);
}

.room-code p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.player-list {
    width: 100%;
    list-style: none;
    margin: 1rem 0;
}

.player-list li {
    background: var(--bg-secondary);
    padding: 0.8rem 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.player-list .host-badge {
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
}

/* Question */
.question-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.question-number {
    font-weight: 700;
    color: var(--accent);
}

.question-category {
    background: var(--bg-card);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.timer {
    width: 100%;
    margin-bottom: 1.5rem;
}

.timer-bar {
    height: 6px;
    background: var(--bg-secondary);
    border-radius: 3px;
    overflow: hidden;
}

.timer-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 1s linear;
    width: 100%;
}

.timer-bar-fill.warning {
    background: var(--gold);
}

.timer-bar-fill.danger {
    background: var(--error);
}

.timer-text {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 0.4rem;
}

.question-text {
    width: 100%;
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1.5rem;
    line-height: 1.4;
    min-height: 3.5rem;
}

.options {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.option-btn {
    width: 100%;
    padding: 1rem;
    border: 2px solid var(--bg-card);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 1rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

@media (hover: hover) {
    .option-btn:hover:not(:disabled) {
        border-color: var(--accent);
        background: var(--bg-card);
    }
}

.option-btn .option-letter {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.option-btn.selected {
    border-color: var(--accent);
    background: rgba(233, 69, 96, 0.15);
}

.option-btn.correct {
    border-color: var(--success);
    background: rgba(46, 204, 113, 0.15);
}

.option-btn.correct .option-letter {
    background: var(--success);
    color: white;
}

.option-btn.incorrect {
    border-color: var(--error);
    background: rgba(231, 76, 60, 0.15);
}

.option-btn:disabled {
    cursor: not-allowed;
}

/* Feedback after answer */
.answer-feedback {
    text-align: center;
    margin-top: 1rem;
    font-size: 1.1rem;
    font-weight: 700;
    min-height: 2rem;
}

.answer-feedback.correct {
    color: var(--success);
}

.answer-feedback.incorrect {
    color: var(--error);
}

/* Scoreboard */
.scoreboard {
    width: 100%;
    margin: 1rem 0;
}

.scoreboard h3 {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-entry {
    display: flex;
    align-items: center;
    padding: 0.7rem 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.score-position {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    margin-right: 0.8rem;
    background: var(--bg-card);
}

.score-entry:nth-child(2) .score-position { background: var(--gold); color: #1a1a2e; }
.score-entry:nth-child(3) .score-position { background: var(--silver); color: #1a1a2e; }
.score-entry:nth-child(4) .score-position { background: var(--bronze); color: #1a1a2e; }

.score-name {
    flex: 1;
    font-weight: 600;
}

.score-points {
    font-weight: 700;
    color: var(--gold);
}

/* Game Over */
.winner-section {
    text-align: center;
    margin: 2rem 0;
    width: 100%;
}

.winner-crown {
    font-size: 4rem;
    margin-bottom: 0.5rem;
}

.winner-name {
    font-size: 2rem;
    font-weight: 800;
    color: var(--gold);
}

.winner-score {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* Waiting overlay */
.waiting {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.waiting .dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
}

/* Countdown */
.countdown {
    font-size: 5rem;
    font-weight: 800;
    color: var(--accent);
    text-align: center;
    margin: auto;
    animation: pulse 1s ease infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.2); opacity: 0.8; }
}

/* Error toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--error);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    z-index: 1000;
    animation: slideUp 0.3s ease;
    max-width: 90%;
    text-align: center;
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* Responsive */
@media (max-width: 400px) {
    .logo h1 { font-size: 2rem; }
    .room-code .code { font-size: 2rem; letter-spacing: 5px; }
    .question-text { font-size: 1.05rem; }
}
