*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-light: #f8fafc;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-dark: #0f172a;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --success: #22c55e;
    --danger: #ef4444;
    --border: #334155;
    --radius: 12px;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
}

body.page-landing,
body.page-team {
    background: var(--bg-light);
    color: var(--text-dark);
}

body.page-presentation {
    background: var(--bg-dark);
    color: var(--text-primary);
}

.loading {
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

/* Buttons */

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

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

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

/* Landing */

.landing {
    max-width: 480px;
    margin: 0 auto;
    padding: 4rem 1.5rem;
    text-align: center;
}

.landing h1 {
    font-size: 2.5rem;
    margin: 0 0 0.5rem;
}

.landing-subtitle {
    color: #64748b;
    margin-bottom: 2.5rem;
}

.landing-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form {
    text-align: left;
}

.login-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-form input[type="password"] {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.login-form input[type="password"]:focus {
    outline: none;
    border-color: var(--accent);
}

.login-error {
    color: var(--danger);
    margin: 0 0 1rem;
    font-size: 0.95rem;
}

/* Team journey */

.team-app {
    max-width: 640px;
    margin: 0 auto;
    padding: 1.5rem 1rem 6rem;
}

.team-register,
.team-question,
.team-complete {
    background: white;
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    box-shadow: var(--shadow);
}

.team-register h1,
.team-complete h1 {
    margin-top: 0;
}

.register-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.register-form input[type="text"] {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.register-form input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
}

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

.team-name-badge {
    background: var(--accent);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.progress {
    color: #64748b;
    font-size: 0.875rem;
}

.round-label {
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 1rem;
}

.question-text {
    font-size: 1.25rem;
    margin: 0 0 1.5rem;
}

.question-image {
    display: block;
    max-width: 100%;
    max-height: 240px;
    margin: 0 auto 1.5rem;
    border-radius: var(--radius);
    object-fit: contain;
}

.options {
    border: none;
    padding: 0;
    margin: 0 0 1.5rem;
}

.option-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.option-label:has(input:checked) {
    border-color: var(--accent);
    background: #eef2ff;
}

.option-label input {
    margin-top: 0.25rem;
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.option-text {
    font-size: 1rem;
}

.team-complete {
    text-align: center;
}

.complete-team {
    font-size: 1.25rem;
    font-weight: 600;
}

.complete-score {
    font-size: 1.5rem;
}

.complete-score strong {
    color: var(--accent);
    font-size: 2rem;
}

.complete-message {
    color: #64748b;
}

.error-message {
    color: var(--danger);
    font-size: 0.875rem;
    margin: 0.5rem 0;
}

/* Presentation */

.presentation-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 2rem;
}

.slide {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
}

.slide-label {
    color: var(--accent);
    font-size: 1.25rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.slide-round-intro h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    margin: 0;
}

.difficulty {
    color: var(--text-secondary);
    font-size: 1.25rem;
}

.slide-question .question-text {
    font-size: clamp(1.75rem, 4vw, 3rem);
    line-height: 1.3;
    margin-bottom: 2rem;
}

.slide-question .question-image {
    max-height: 320px;
}

.options-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.options-list li {
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    padding: 1rem 1.5rem;
    margin-bottom: 0.75rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.slide-answers h1 {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    margin-bottom: 1.5rem;
}

.answers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    max-height: 70vh;
    overflow-y: auto;
}

.answer-item {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem;
    border: 1px solid var(--border);
}

.answer-number {
    color: var(--accent);
    font-weight: 600;
    margin: 0 0 0.5rem;
}

.answer-question {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
}

.options-list-compact li {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.35rem;
}

.options-list-compact li.correct {
    background: rgba(34, 197, 94, 0.2);
    border-color: var(--success);
    font-weight: 600;
}

.slide-standings h1,
.slide-winner h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    margin-bottom: 2rem;
}

.standings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(1.125rem, 2vw, 1.5rem);
}

.standings-table th,
.standings-table td {
    padding: 1rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.standings-table th {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

.standings-table tr.winner-row {
    background: rgba(99, 102, 241, 0.2);
}

.standings-table tr.winner-row td {
    font-weight: 700;
    color: var(--accent);
}

.winner-label {
    color: var(--accent);
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.winner-name {
    font-size: clamp(3rem, 8vw, 5rem);
    margin: 0 0 2rem;
    color: var(--success);
}

.no-teams {
    color: var(--text-secondary);
    font-size: 1.25rem;
}

.presentation-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 1.5rem 0;
    margin-top: auto;
    flex-wrap: wrap;
}

.slide-counter {
    color: var(--text-secondary);
    font-size: 0.875rem;
    min-width: 80px;
    text-align: center;
}

@media (max-width: 600px) {
    .presentation-app {
        padding: 1rem;
    }

    .presentation-controls {
        gap: 0.75rem;
    }

    .standings-table th,
    .standings-table td {
        padding: 0.75rem;
    }
}
