* {
    box-sizing: border-box;
}

:root {
    --bg: #090b10;
    --card: #11151d;
    --card-light: #181d27;
    --text: #f5f7fa;
    --muted: #8d96a5;
    --accent: #e30613;
    --accent-2: #ffb400;
    --success: #22c55e;
    --danger: #ef4444;
    --border: #29313d;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body {
    min-height: 100vh;
}

button,
input,
textarea,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.app {
    min-height: 100vh;
}


/* =========================================================
   COMMON
========================================================= */

.screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.35);
}

.hero-card,
.center-card,
.final-card {
    width: min(520px, 100%);
    padding: 40px;
}

.logo {
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 0.3em;
    color: var(--accent-2);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: 42px;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--muted);
    margin-bottom: 35px;
}

.muted {
    color: var(--muted);
}

.small-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.15em;
}

.error {
    color: #ff6b6b;
    margin-top: 15px;
}

label {
    display: block;
    margin: 18px 0 8px;
    font-size: 14px;
    font-weight: 700;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #0c1016;
    color: var(--text);
    padding: 14px 16px;
    outline: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--accent-2);
}

textarea {
    min-height: 100px;
    resize: vertical;
}


/* =========================================================
   BUTTONS
========================================================= */

.primary-button,
.secondary-button,
.warning-button,
.danger-button {
    border: 0;
    border-radius: 12px;
    padding: 13px 18px;
    font-weight: 800;
    transition:
        transform 0.15s,
        opacity 0.15s;
}

.primary-button:hover,
.secondary-button:hover,
.warning-button:hover,
.danger-button:hover {
    transform: translateY(-1px);
}

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

.secondary-button {
    background: #242b36;
    color: white;
}

.warning-button {
    background: var(--accent-2);
    color: #111;
}

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

.hero-card form {
    display: flex;
    flex-direction: column;
}

.hero-card .primary-button {
    margin-top: 25px;
    padding: 17px;
}


/* =========================================================
   WAITING
========================================================= */

.center-card {
    text-align: center;
}

.waiting-icon,
.trophy {
    font-size: 60px;
    margin-bottom: 20px;
}

.team-badge {
    display: inline-block;
    margin: 20px 0;
    padding: 10px 20px;
    border-radius: 999px;
    background: var(--accent);
    font-weight: 900;
}

.loader {
    width: 35px;
    height: 35px;
    margin: 30px auto;
    border: 3px solid #303744;
    border-top-color: var(--accent-2);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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


/* =========================================================
   PARTICIPANT QUIZ
========================================================= */

.quiz-container {
    width: min(800px, 100%);
}

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

.quiz-header strong {
    display: block;
    font-size: 22px;
    margin-top: 5px;
}

.team-pill {
    background: var(--accent);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
}

.score-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.score-bar div {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    color: var(--muted);
}

.score-bar strong {
    display: block;
    color: var(--text);
    font-size: 25px;
}

.question-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 30px;
}

.question-text {
    font-size: 30px;
    line-height: 1.25;
    font-weight: 800;
    margin-bottom: 25px;
}

.options {
    display: grid;
    gap: 12px;
}

.answer-button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 15px;
    text-align: left;
    border: 1px solid var(--border);
    background: var(--card-light);
    color: var(--text);
    padding: 18px;
    border-radius: 14px;
    transition:
        background 0.15s,
        transform 0.15s;
}

.answer-button:hover:not(:disabled) {
    background: #222936;
    transform: translateY(-2px);
}

.answer-button.selected {
    border-color: var(--accent-2);
    background: #29271d;
}

.answer-button:disabled {
    cursor: default;
    opacity: 0.8;
}

.answer-letter {
    width: 35px;
    height: 35px;
    min-width: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #303744;
    font-weight: 900;
}

.answer-status {
    margin-top: 20px;
    text-align: center;
    color: var(--muted);
}

.answer-status.success {
    color: var(--success);
    font-weight: 700;
}


/* =========================================================
   REVEAL
========================================================= */

.reveal-icon {
    font-size: 70px;
    margin-bottom: 15px;
}

.reveal-points {
    font-size: 32px;
    font-weight: 900;
    margin: 25px 0;
}

.score-summary {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 15px;
    align-items: center;
    margin: 30px 0;
}

.big-score {
    background: var(--card-light);
    border-radius: 15px;
    padding: 20px;
}

.big-score span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.big-score strong {
    font-size: 40px;
}

.vs {
    color: var(--muted);
    font-weight: 900;
}


/* =========================================================
   FINAL
========================================================= */

.final-scores {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin: 30px 0;
}

.final-scores div {
    background: var(--card-light);
    padding: 20px;
    border-radius: 15px;
}

.final-scores span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.final-scores strong {
    display: block;
    font-size: 42px;
}

.winner-box {
    padding: 18px;
    background: var(--accent);
    border-radius: 15px;
    font-weight: 900;
}


/* =========================================================
   ADMIN
========================================================= */

.admin-body {
    background:
        radial-gradient(
            circle at top,
            #171d29 0,
            var(--bg) 50%
        );
}

.admin-login {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-card {
    width: min(450px, 100%);
    padding: 40px;
}

.login-card .primary-button {
    width: 100%;
    margin-top: 20px;
}

.admin-app {
    width: min(1400px, 100%);
    margin: auto;
    padding: 30px;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 30px;
}

.admin-header h1 {
    margin: 4px 0 0;
    font-size: 32px;
}

.admin-header-actions {
    display: flex;
    gap: 10px;
}

.admin-section {
    background: rgba(17, 21, 29, 0.95);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 20px;
}

.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.admin-section-header h2 {
    margin: 5px 0 0;
}

.big-counter {
    font-size: 28px;
    font-weight: 900;
}

.control-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 25px;
}

.score-dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.team-score {
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    border: 1px solid var(--border);
}

.team-score span {
    font-size: 14px;
    font-weight: 900;
}

.team-score strong {
    display: block;
    font-size: 70px;
    line-height: 1;
    margin-top: 10px;
}

.team-a {
    background:
        linear-gradient(
            135deg,
            rgba(227, 6, 19, 0.22),
            rgba(17, 21, 29, 0.9)
        );
}

.team-b {
    background:
        linear-gradient(
            135deg,
            rgba(255, 180, 0, 0.18),
            rgba(17, 21, 29, 0.9)
        );
}

.admin-question h2 {
    font-size: 34px;
    margin: 15px 0 25px;
}

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

.admin-option {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px;
    border-radius: 14px;
    background: var(--card-light);
    border: 1px solid var(--border);
    font-size: 18px;
}

.admin-option.correct {
    background: rgba(34, 197, 94, 0.2);
    border-color: var(--success);
}

.answer-info {
    text-align: center;
    margin-top: 20px;
    color: var(--muted);
}

.teams-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.team-list {
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 20px;
}

.team-list h3 {
    margin-bottom: 15px;
}

.participant-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 0;
    border-bottom: 1px solid #202631;
}

.participant-row:last-child {
    border-bottom: 0;
}

.answered {
    color: var(--success);
    font-weight: 900;
}

.empty-list {
    color: var(--muted);
    padding: 15px 0;
}

.ranking-row {
    display: grid;
    grid-template-columns: 50px 1fr 150px 100px;
    gap: 15px;
    align-items: center;
    padding: 15px;
    background: #0d1117;
    border-bottom: 1px solid var(--border);
}

.ranking-row:first-child {
    border-radius: 12px 12px 0 0;
}

.ranking-row:last-child {
    border-radius: 0 0 12px 12px;
    border-bottom: 0;
}

.ranking-position {
    font-size: 24px;
    font-weight: 900;
}

.ranking-name {
    font-weight: 800;
}

.ranking-team {
    color: var(--muted);
    font-size: 13px;
}

.question-manager {
    display: grid;
    gap: 10px;
}

.managed-question {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    padding: 18px;
    border-radius: 14px;
    background: #0d1117;
    border: 1px solid var(--border);
}

.managed-question-main {
    flex: 1;
}

.managed-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 13px;
}

.correct-mini {
    color: var(--success);
    font-weight: 800;
}

.managed-actions {
    display: flex;
    gap: 8px;
}

.small-button {
    padding: 8px 11px;
    font-size: 12px;
}


/* =========================================================
   MODAL
========================================================= */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
    overflow-y: auto;
}

.modal-content {
    width: min(650px, 100%);
    max-height: 95vh;
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 30px;
}

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

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 25px;
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 700px) {

    h1 {
        font-size: 32px;
    }

    .hero-card,
    .center-card,
    .final-card {
        padding: 25px;
    }

    .question-card {
        padding: 20px;
    }

    .question-text {
        font-size: 24px;
    }

    .admin-app {
        padding: 15px;
    }

    .admin-header {
        align-items: flex-start;
    }

    .admin-header h1 {
        font-size: 24px;
    }

    .score-dashboard,
    .teams-grid,
    .admin-options {
        grid-template-columns: 1fr;
    }

    .team-score strong {
        font-size: 55px;
    }

    .admin-question h2 {
        font-size: 26px;
    }

    .ranking-row {
        grid-template-columns: 35px 1fr 80px;
    }

    .ranking-team {
        display: none;
    }

    .managed-question {
        flex-direction: column;
        align-items: stretch;
    }

    .managed-actions {
        justify-content: flex-end;
    }

    .final-scores {
        grid-template-columns: 1fr;
    }
}