:root {
    --bg: #08111f;
    --bg-2: #101b2f;
    --panel: rgba(17, 24, 39, 0.95);
    --panel-2: #182338;
    --text: #f8fafc;
    --muted: #cbd5e1;
    --border: rgba(255,255,255,0.08);
    --primary: #22c55e;
    --primary-hover: #16a34a;
    --danger: #ef4444;
    --warning: #f59e0b;
    --blue: #2563eb;
    --blue-hover: #1d4ed8;
    --cyan: #22d3ee;
    --shadow: 0 20px 40px rgba(0,0,0,0.28);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background:
        radial-gradient(circle at top, rgba(34, 211, 238, 0.14), transparent 30%),
        radial-gradient(circle at bottom, rgba(37, 99, 235, 0.16), transparent 35%),
        linear-gradient(180deg, var(--bg-2), var(--bg));
    color: var(--text);
    min-height: 100vh;
}

a { color: #93c5fd; text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    width: min(100%, 1000px);
    margin: 0 auto;
    padding: 24px 16px 40px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow);
}

.home-card {
    max-width: 520px;
    margin: 40px auto;
    text-align: center;
}

.subtitle, .hint { color: var(--muted); }

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: left;
}

label { font-weight: bold; }

input[type="text"], input[type="password"], textarea, select {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--panel-2);
    color: var(--text);
}

textarea { resize: vertical; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    border-radius: 12px;
    border: 0;
    background: #334155;
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    font-weight: bold;
}

.btn:hover { text-decoration: none; opacity: 0.95; }
.btn-primary { background: var(--primary); color: #052e16; }
.btn-primary:hover { background: var(--primary-hover); }

.home-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 16px;
}

.flash {
    margin-bottom: 16px;
    padding: 14px 16px;
    border-radius: 12px;
    font-weight: bold;
}

.flash-success { background: rgba(34,197,94,0.18); border: 1px solid rgba(34,197,94,0.4); }
.flash-error { background: rgba(239,68,68,0.18); border: 1px solid rgba(239,68,68,0.4); }

.arcade-title-wrap { text-align: center; margin-bottom: 20px; }

.arcade-title {
    margin: 0 0 8px;
    font-size: clamp(2rem, 5vw, 3.2rem);
    letter-spacing: 2px;
    color: #ffffff;
    text-shadow:
        0 0 10px rgba(34, 211, 238, 0.45),
        0 0 22px rgba(37, 99, 235, 0.35);
}

.arcade-subtitle { margin: 0; color: var(--muted); }

.status-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 20px;
}

.status-box {
    background: rgba(17, 24, 39, 0.95);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-align: center;
    box-shadow: var(--shadow);
}

.status-box strong { color: var(--muted); font-size: 0.9rem; }
.status-box span { font-size: 1.2rem; font-weight: bold; }

.question-card h2 {
    margin-top: 0;
    line-height: 1.45;
    text-align: center;
    font-size: clamp(1.3rem, 3vw, 2rem);
}

.question-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    margin-bottom: 20px;
    flex-wrap: wrap;
    font-weight: bold;
}

.answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.answer-btn {
    min-height: 82px;
    border: 0;
    border-radius: 18px;
    padding: 16px 18px;
    background: linear-gradient(180deg, var(--blue), var(--blue-hover));
    color: white;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.22);
    transition: transform 0.15s ease, filter 0.15s ease;
}

.answer-btn:hover { transform: translateY(-2px); filter: brightness(1.06); }
.answer-btn:disabled { cursor: not-allowed; opacity: 0.75; }
.answer-btn-selected { outline: 2px solid rgba(250, 204, 21, 0.85); }

.answer-letter {
    min-width: 44px;
    height: 38px;
    border-radius: 999px;
    background: rgba(255,255,255,0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
}

.answer-text { display: block; line-height: 1.35; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; }
th { color: var(--muted); }

.result-card { max-width: 620px; margin: 30px auto; text-align: center; }
.result-highlight { font-size: 1.2rem; font-weight: bold; color: #facc15; }

.admin-topbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form {
    margin: 18px 0 22px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
}

/* Timer visual */
.timer-panel {
    margin: 0 0 22px;
    padding: 18px;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.92);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 18px 35px rgba(0,0,0,0.25);
}

.timer-panel-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.timer-panel-top span { color: var(--muted); font-weight: bold; }

.timer-panel-top strong {
    font-size: 1.7rem;
    color: #22c55e;
    text-shadow: 0 0 12px rgba(34, 197, 94, 0.35);
}

.timer-track {
    height: 18px;
    width: 100%;
    background: rgba(255,255,255,0.08);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}

.timer-fill {
    height: 100%;
    width: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #22c55e, #84cc16);
    transition: width 1s linear, background 0.25s ease;
    box-shadow: 0 0 18px rgba(34, 197, 94, 0.45);
}

.timer-warning-text {
    margin-top: 10px;
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: bold;
    text-align: center;
}

.timer-panel.timer-warning { border-color: rgba(250, 204, 21, 0.5); }
.timer-panel.timer-warning .timer-panel-top strong { color: #facc15; text-shadow: 0 0 14px rgba(250, 204, 21, 0.45); }
.timer-panel.timer-warning .timer-fill { background: linear-gradient(90deg, #facc15, #f97316); box-shadow: 0 0 18px rgba(250, 204, 21, 0.45); }

.timer-panel.timer-danger {
    border-color: rgba(239, 68, 68, 0.65);
    animation: timerDangerPulse 0.55s infinite alternate;
}

.timer-panel.timer-danger .timer-panel-top strong { color: #ef4444; text-shadow: 0 0 16px rgba(239, 68, 68, 0.65); }
.timer-panel.timer-danger .timer-fill { background: linear-gradient(90deg, #ef4444, #f97316); box-shadow: 0 0 22px rgba(239, 68, 68, 0.65); }
.timer-panel.timer-danger .timer-warning-text { color: #fecaca; }

@keyframes timerDangerPulse {
    from { transform: scale(1); box-shadow: 0 18px 35px rgba(0,0,0,0.25); }
    to { transform: scale(1.01); box-shadow: 0 0 28px rgba(239, 68, 68, 0.25); }
}

/* Modal de feedback certo/errado */
.feedback-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.78);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.feedback-modal {
    width: min(520px, 100%);
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 26px;
    padding: 32px 26px;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0,0,0,0.45);
    animation: feedbackPop 0.22s ease-out;
}

.feedback-modal-success {
    border-color: rgba(34, 197, 94, 0.65);
    box-shadow:
        0 30px 80px rgba(0,0,0,0.45),
        0 0 35px rgba(34, 197, 94, 0.22);
}

.feedback-modal-danger {
    border-color: rgba(239, 68, 68, 0.65);
    box-shadow:
        0 30px 80px rgba(0,0,0,0.45),
        0 0 35px rgba(239, 68, 68, 0.22);
}

.feedback-icon { font-size: 4rem; margin-bottom: 8px; }

.feedback-modal h2 {
    margin: 0 0 12px;
    font-size: clamp(2rem, 7vw, 3.4rem);
    letter-spacing: 2px;
}

.feedback-modal-success h2 { color: #22c55e; text-shadow: 0 0 18px rgba(34, 197, 94, 0.45); }
.feedback-modal-danger h2 { color: #ef4444; text-shadow: 0 0 18px rgba(239, 68, 68, 0.45); }

.feedback-main-message {
    color: var(--muted);
    font-weight: bold;
    margin: 8px 0 18px;
}

.feedback-correct-answer {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    padding: 16px;
    margin: 18px 0;
}

.feedback-correct-answer span {
    display: block;
    color: var(--muted);
    margin-bottom: 6px;
    font-weight: bold;
}

.feedback-correct-answer strong {
    font-size: 1.25rem;
    color: #facc15;
}

.feedback-points {
    font-size: 2.2rem;
    font-weight: bold;
    color: #facc15;
    margin: 14px 0;
    text-shadow: 0 0 18px rgba(250, 204, 21, 0.4);
}

.feedback-next { margin: 16px 0 22px; color: var(--text); }
.feedback-next strong { color: #93c5fd; }
.feedback-close-btn { width: 100%; font-size: 1rem; }

@keyframes feedbackPop {
    from { opacity: 0; transform: scale(0.92) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Game over e ranking */
.arcade-result { max-width: 720px; margin: 30px auto; }

.game-over-title {
    color: #f87171;
    text-shadow:
        0 0 10px rgba(239, 68, 68, 0.65),
        0 0 28px rgba(239, 68, 68, 0.45);
}

.final-score-box {
    background: linear-gradient(180deg, rgba(250, 204, 21, 0.18), rgba(245, 158, 11, 0.12));
    border: 1px solid rgba(250, 204, 21, 0.45);
    border-radius: 22px;
    padding: 24px;
    text-align: center;
    margin: 24px 0;
}

.final-score-box span {
    display: block;
    color: var(--muted);
    font-weight: bold;
    margin-bottom: 8px;
}

.final-score-box strong {
    display: block;
    font-size: clamp(3rem, 9vw, 5rem);
    color: #facc15;
    line-height: 1;
    text-shadow: 0 0 20px rgba(250, 204, 21, 0.35);
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin: 20px 0;
}

.result-stat {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    text-align: center;
}

.result-stat strong {
    display: block;
    color: var(--muted);
    margin-bottom: 6px;
}

.result-stat span {
    font-weight: bold;
    font-size: 1.15rem;
}

.ranking-message {
    margin-top: 20px;
    border-radius: 18px;
    padding: 18px;
    text-align: center;
    line-height: 1.5;
}

.ranking-success { background: rgba(34, 197, 94, 0.14); border: 1px solid rgba(34, 197, 94, 0.45); }
.ranking-fail { background: rgba(239, 68, 68, 0.14); border: 1px solid rgba(239, 68, 68, 0.45); }

.ranking-card { max-width: 850px; margin: 30px auto; }
.ranking-list { display: flex; flex-direction: column; gap: 12px; }

.ranking-row {
    display: grid;
    grid-template-columns: 70px 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
}

.ranking-row-podium {
    background: linear-gradient(90deg, rgba(250, 204, 21, 0.13), rgba(255,255,255,0.05));
    border-color: rgba(250, 204, 21, 0.25);
}

.ranking-position { font-size: 1.5rem; font-weight: bold; text-align: center; }
.ranking-player strong { display: block; font-size: 1.05rem; }
.ranking-player span { display: block; color: var(--muted); font-size: 0.9rem; margin-top: 4px; }

.ranking-score {
    font-size: 1.8rem;
    font-weight: bold;
    color: #facc15;
    text-align: right;
}

.ranking-score small { font-size: 0.8rem; color: var(--muted); }
.empty-ranking { text-align: center; padding: 30px; color: var(--muted); }

@media (max-width: 768px) {
    .status-grid, .answers-grid { grid-template-columns: 1fr; }

    .question-meta, .admin-topbar, .home-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .container { padding: 16px 12px 30px; }
    .answer-btn { min-height: 74px; }

    .result-stats { grid-template-columns: 1fr; }

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

    .ranking-score {
        grid-column: 1 / -1;
        text-align: left;
        padding-left: 64px;
    }
}
.gameover-modal-page {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 0;
}

.gameover-modal {
    width: min(720px, 100%);
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(239, 68, 68, 0.55);
    border-radius: 28px;
    padding: 34px 28px;
    text-align: center;
    box-shadow:
        0 30px 80px rgba(0,0,0,0.50),
        0 0 40px rgba(239, 68, 68, 0.20);
    animation: feedbackPop 0.25s ease-out;
}

.gameover-modal h1 {
    margin: 0;
    font-size: clamp(2.4rem, 8vw, 4.5rem);
    letter-spacing: 3px;
    color: #ef4444;
    text-shadow:
        0 0 14px rgba(239, 68, 68, 0.65),
        0 0 32px rgba(239, 68, 68, 0.35);
}

.gameover-subtitle {
    margin: 12px 0 22px;
    color: var(--muted);
    font-weight: bold;
}
.btn-danger {
    background: #ef4444;
    color: #fff;
}

.btn-danger:hover {
    background: #dc2626;
}
