/* ===========================================================================
   Tribuna — sistema visual Modernist
   Archivo, grade modular, réguas de 2px, canto zero.
   Vermelho é ação e erro; o acerto é preenchido em tinta cheia, o que evita
   o vermelho dizer duas coisas ao mesmo tempo.
   =========================================================================== */

:root {
    --ink: #201e1d;
    --bg: #f3f2f2;
    --surf: #eae9e9;
    --red: #ec3013;
    --red-hover: #dd2b0f;
    --red-dark: #ae1800;
    --red-soft: #fff2ef;
    --mut: #605d5d;
    --faint: #9b9797;
    --pale: #bab6b6;
    --bar: #d7d3d3;
    --div: rgba(32, 30, 29, .25);
    --div2: rgba(32, 30, 29, .4);
    --ink-shadow: rgba(45, 43, 43, .22);
}

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

html,
body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: Archivo, system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--red);
    text-underline-offset: 3px;
}

a:hover {
    color: var(--red-dark);
}

:focus-visible {
    outline: 2px solid var(--red);
    outline-offset: 2px;
}

button {
    font-family: inherit;
    border-radius: 0;
}

/* --- Animações ----------------------------------------------------------- */

@keyframes sweepfill {
    from { background-size: 0% 100%; }
    to { background-size: 100% 100%; }
}

@keyframes pop {
    0% { transform: scale(.4); opacity: 0; }
    60% { transform: scale(1.15); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes nudge {
    0%, 100% { transform: translateX(0); }
    30% { transform: translateX(-5px); }
    60% { transform: translateX(4px); }
}

@keyframes rise {
    from { transform: translateY(12px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: .25; }
}

@keyframes stamp {
    0% { transform: scale(1.6) rotate(-6deg); opacity: 0; }
    55% { transform: scale(.97) rotate(1deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
    }
}

/* --- Tipografia utilitária ----------------------------------------------- */

.mono {
    font: 400 11px/1.4 ui-monospace, Menlo, Consolas, monospace;
    letter-spacing: .02em;
}

.tq-eyebrow {
    margin: 0;
    font: 800 11px/1 Archivo, sans-serif;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--mut);
}

.tq-eyebrow--red {
    color: var(--red);
}

.tq-display {
    margin: 14px 0 0;
    font: 800 30px/1.08 Archivo, sans-serif;
    letter-spacing: -.02em;
}

.tq-lead {
    margin: 12px 0 0;
    font: 400 14px/1.6 Archivo, sans-serif;
    color: var(--mut);
}

.tq-rule {
    height: 2px;
    border: 0;
    margin: 22px 0;
    background: var(--div2);
}

/* --- Botões --------------------------------------------------------------- */

.tq-btn {
    display: block;
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border: 0;
    text-align: left;
    font: 800 14px/1.2 Archivo, sans-serif;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.tq-btn:disabled {
    cursor: default;
}

.tq-btn--red {
    background: var(--red);
    color: var(--bg);
}

.tq-btn--red:hover:not(:disabled) {
    background: var(--red-hover);
}

.tq-btn--ink {
    background: var(--ink);
    color: var(--bg);
}

.tq-btn--outline {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--div2);
}

.tq-btn--outline:hover:not(:disabled) {
    background: rgba(32, 30, 29, .07);
}

.tq-btn--idle {
    background: var(--surf);
    color: var(--faint);
}

.tq-btn--locked {
    background: transparent;
    color: var(--mut);
    border: 1px solid var(--div2);
}

.tq-btn--compact {
    min-height: 40px;
    font: 800 13px/1.2 Archivo, sans-serif;
    padding: 0 14px;
}

.tq-btn--inline {
    display: inline-flex;
    align-items: center;
    width: auto;
    min-height: 34px;
    padding: 0 12px;
    font: 800 12px/1.2 Archivo, sans-serif;
}

/* --- Campo de texto ------------------------------------------------------- */

.tq-input {
    width: 100%;
    min-height: 50px;
    padding: 0 14px;
    border: 1px solid var(--div2);
    border-radius: 0;
    background: var(--bg);
    color: var(--ink);
    font: 400 16px/1.3 Archivo, sans-serif;
}

.tq-input::placeholder {
    color: var(--faint);
}

/* ===========================================================================
   Celular do aluno
   =========================================================================== */

.tq-mobile {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 440px;
    min-height: 100dvh;
    margin: 0 auto;
    background: var(--bg);
}

@media (min-width: 520px) {
    .tq-mobile {
        min-height: 100dvh;
        border-left: 1px solid var(--div);
        border-right: 1px solid var(--div);
    }
}

.tq-mobile__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 18px;
    border-bottom: 2px solid var(--div2);
}

.tq-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tq-brand__mark {
    width: 22px;
    height: 22px;
    background: var(--ink);
    color: var(--bg);
    font: 800 12px/22px Archivo, sans-serif;
    text-align: center;
}

.tq-brand__mark--red {
    background: var(--red);
}

.tq-brand__name {
    font: 800 12px/1 Archivo, sans-serif;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.tq-live {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--mut);
}

.tq-live__dot {
    width: 7px;
    height: 7px;
    background: var(--red);
    animation: blink 1.6s ease-in-out infinite;
}

.tq-live__dot--off {
    background: var(--faint);
    animation: none;
}

.tq-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.tq-pad {
    padding: 26px 18px 34px;
}

.tq-spacer {
    flex: 1;
}

/* --- Entrada na sala ------------------------------------------------------ */

.tq-join {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 24px;
}

.tq-join__label {
    font: 800 11px/1 Archivo, sans-serif;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--mut);
}

.tq-error {
    padding: 12px 14px;
    background: var(--red-soft);
    color: var(--red-dark);
    border-left: 2px solid var(--red);
    font: 400 13px/1.45 Archivo, sans-serif;
    animation: nudge .38s ease both;
}

/* --- Sala de espera ------------------------------------------------------- */

.tq-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border: 1px solid var(--div);
}

.tq-stat {
    padding: 14px;
}

.tq-stat + .tq-stat {
    border-left: 1px solid var(--div);
}

.tq-stat__label {
    color: var(--mut);
}

.tq-stat__value {
    margin-top: 4px;
    font: 800 28px/1.1 Archivo, sans-serif;
}

.tq-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--surf);
    border-left: 2px solid var(--red);
    font: 400 13px/1.45 Archivo, sans-serif;
}

.tq-notice__dot {
    flex: none;
    width: 9px;
    height: 9px;
    background: var(--red);
    animation: blink 1.4s ease-in-out infinite;
}

/* --- Pergunta ------------------------------------------------------------- */

.tq-qhead {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid var(--div);
}

.tq-qhead__num {
    min-width: 96px;
    padding: 12px 18px;
    border-right: 1px solid var(--div);
}

.tq-qhead__value {
    margin-top: 3px;
    font: 800 20px/1.1 Archivo, sans-serif;
}

.tq-qhead__meta {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 12px 18px;
}

.tq-qhead__timer {
    margin-top: 3px;
    font: 800 14px/1.2 Archivo, sans-serif;
}

.tq-qhead__timer--urgent {
    color: var(--red);
}

.tq-progress {
    height: 3px;
    background: var(--surf);
}

.tq-progress__fill {
    height: 3px;
    background: var(--red);
    transition: width .9s linear;
}

.tq-qtext {
    margin: 0;
    padding: 22px 18px 10px;
    font: 800 22px/1.24 Archivo, sans-serif;
    letter-spacing: -.015em;
    text-wrap: pretty;
}

.tq-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 18px 0;
}

.tq-option {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 62px;
    padding: 12px 14px;
    text-align: left;
    background: var(--bg);
    border: 1px solid var(--div2);
    font: 400 15px/1.35 Archivo, sans-serif;
    color: var(--ink);
    cursor: pointer;
    transition: background .2s ease, color .25s ease .2s, border-color .2s ease, opacity .3s ease;
}

.tq-option:disabled {
    cursor: default;
}

.tq-option__letter {
    flex: none;
    width: 20px;
    font: 800 13px/1 Archivo, sans-serif;
    color: var(--mut);
    transition: color .25s ease .2s;
}

.tq-option__text {
    flex: 1;
    text-align: left;
}

.tq-option__mark {
    flex: none;
    font: 800 11px/1 Archivo, sans-serif;
    letter-spacing: .08em;
}

.tq-option__mark--dot {
    font: 800 13px/1 Archivo, sans-serif;
    animation: pop .28s ease both;
}

/* marcada, ainda sem gabarito */
.tq-option--picked {
    border: 2px solid var(--ink);
    background: var(--surf);
}

.tq-option--picked .tq-option__letter {
    color: var(--ink);
}

/* gabarito: preenchimento em tinta cheia */
.tq-option--correct {
    border: 2px solid var(--ink);
    color: var(--bg);
    background: linear-gradient(var(--ink), var(--ink)) left center / 100% 100% no-repeat;
    animation: sweepfill .55s cubic-bezier(.25, .8, .25, 1) both;
}

.tq-option--correct .tq-option__letter {
    color: var(--pale);
}

.tq-option--correct .tq-option__mark {
    animation: pop .4s cubic-bezier(.2, .9, .25, 1) .3s both;
}

/* marca do aluno que errou */
.tq-option--wrong {
    border: 2px solid var(--red);
    background: var(--red-soft);
    color: var(--red-dark);
    animation: nudge .38s ease both;
}

.tq-option--wrong .tq-option__letter,
.tq-option--wrong .tq-option__mark {
    color: var(--red-dark);
}

/* alternativas descartadas após o gabarito */
.tq-option--dim {
    opacity: .55;
}

.tq-qfoot {
    padding: 16px 18px 30px;
    border-top: 2px solid var(--div2);
    background: var(--bg);
}

.tq-verdict {
    padding: 14px;
    margin-bottom: 12px;
    border-left: 2px solid var(--red);
    animation: rise .35s ease both;
}

.tq-verdict--ok {
    background: var(--ink);
    color: var(--bg);
}

.tq-verdict--bad {
    background: var(--red-soft);
    color: var(--red-dark);
}

.tq-verdict__title {
    font: 800 15px/1.2 Archivo, sans-serif;
    letter-spacing: .02em;
}

.tq-verdict__note {
    margin-top: 5px;
    font: 400 13px/1.5 Archivo, sans-serif;
}

.tq-qmeta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    color: var(--mut);
}

/* --- Placar --------------------------------------------------------------- */

.tq-rank__row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 12px;
    border-bottom: 1px solid var(--div);
    animation: rise .35s ease both;
}

.tq-rank__row--me {
    background: var(--ink);
    color: var(--bg);
}

.tq-rank__pos {
    width: 26px;
    font: 800 14px/1 Archivo, sans-serif;
    color: var(--mut);
}

.tq-rank__row--me .tq-rank__pos {
    color: var(--pale);
}

.tq-rank__name {
    flex: 1;
    font: 400 15px/1.3 Archivo, sans-serif;
}

.tq-rank__score {
    font: 800 15px/1 Archivo, sans-serif;
}

/* --- Resultado final ------------------------------------------------------ */

.tq-final {
    animation: rise .4s ease both;
}

.tq-score {
    margin-top: 22px;
    padding: 22px;
    background: var(--ink);
    color: var(--bg);
    animation: stamp .55s cubic-bezier(.2, .9, .25, 1) both;
}

.tq-score__label {
    color: var(--pale);
}

.tq-score__line {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 6px;
}

.tq-score__value {
    font: 800 66px/1 Archivo, sans-serif;
    letter-spacing: -.04em;
}

.tq-score__total {
    font: 800 22px/1 Archivo, sans-serif;
    color: var(--pale);
}

.tq-score__note {
    margin-top: 10px;
    font: 400 14px/1.5 Archivo, sans-serif;
    color: var(--surf);
}

.tq-review {
    margin-top: 18px;
    border: 1px solid var(--div);
}

.tq-review__row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--div);
}

.tq-review__row:last-child {
    border-bottom: 0;
}

.tq-review__num {
    width: 22px;
    font: 800 12px/1 Archivo, sans-serif;
    color: var(--mut);
}

.tq-review__area {
    flex: 1;
    font: 400 13px/1.4 Archivo, sans-serif;
}

/* --- Etiquetas ------------------------------------------------------------ */

.tq-tag {
    flex: none;
    padding: 4px 6px;
    white-space: nowrap;
    font: 800 10px/1 Archivo, sans-serif;
    letter-spacing: .08em;
    border: 1px solid var(--div);
    background: transparent;
    color: var(--mut);
}

.tq-tag--ok {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
}

.tq-tag--bad {
    background: var(--red-soft);
    color: var(--red-dark);
    border-color: var(--red);
}

.tq-tag--live {
    background: var(--red);
    color: var(--bg);
    border-color: var(--red);
}

.tq-tag--onink {
    border-color: var(--pale);
    color: var(--pale);
}

/* ===========================================================================
   Painel do mediador
   =========================================================================== */

.tq-console-page {
    min-height: 100dvh;
    padding: 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.tq-console {
    width: 100%;
    max-width: 1100px;
    background: var(--bg);
    border: 2px solid var(--ink);
    box-shadow: 0 12px 32px var(--ink-shadow);
}

.tq-console__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 2px solid var(--div2);
    flex-wrap: wrap;
}

.tq-console__id {
    display: flex;
    align-items: center;
    gap: 14px;
}

.tq-console__mark {
    width: 24px;
    height: 24px;
    background: var(--red);
    color: var(--bg);
    font: 800 13px/24px Archivo, sans-serif;
    text-align: center;
}

.tq-console__title {
    font: 800 13px/1 Archivo, sans-serif;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.tq-console__tools {
    display: flex;
    align-items: center;
    gap: 18px;
}

.tq-console__body {
    display: flex;
    align-items: stretch;
    min-height: 430px;
}

@media (max-width: 860px) {
    .tq-console__body {
        flex-direction: column;
    }
}

.tq-script {
    width: 318px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--div);
}

@media (max-width: 860px) {
    .tq-script {
        width: 100%;
        border-right: 0;
        border-bottom: 1px solid var(--div);
    }
}

.tq-script__head {
    padding: 12px 18px;
    border-bottom: 1px solid var(--div);
    color: var(--mut);
}

.tq-script__row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    padding: 12px 18px;
    border: 0;
    border-bottom: 1px solid var(--div);
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}

.tq-script__row:hover {
    background: rgba(32, 30, 29, .06);
}

.tq-script__row--active {
    background: var(--ink);
    color: var(--bg);
}

.tq-script__row--active:hover {
    background: var(--ink);
}

.tq-script__num {
    width: 20px;
    font: 800 12px/1 Archivo, sans-serif;
    color: var(--mut);
}

.tq-script__row--active .tq-script__num,
.tq-script__row--active .tq-script__area {
    color: var(--pale);
}

.tq-script__body {
    flex: 1;
    text-align: left;
}

.tq-script__text {
    display: block;
    font: 400 13px/1.35 Archivo, sans-serif;
}

.tq-script__area {
    display: block;
    margin-top: 3px;
    font: 400 11px/1.2 ui-monospace, Menlo, Consolas, monospace;
    color: var(--mut);
}

.tq-script__foot {
    padding: 14px 18px;
    border-top: 1px solid var(--div);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tq-stage {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.tq-stage--idle {
    justify-content: center;
    padding: 34px;
}

.tq-stage__title {
    margin: 0;
    font: 800 24px/1.15 Archivo, sans-serif;
    letter-spacing: -.02em;
}

.tq-stage__hint {
    margin: 10px 0 0;
    max-width: 44ch;
    font: 400 14px/1.6 Archivo, sans-serif;
    color: var(--mut);
}

.tq-stage__head {
    padding: 18px 24px 14px;
    border-bottom: 1px solid var(--div);
}

.tq-stage__badges {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tq-stage__question {
    margin: 12px 0 0;
    font: 800 21px/1.22 Archivo, sans-serif;
    letter-spacing: -.015em;
    text-wrap: pretty;
}

.tq-metrics {
    display: flex;
    border-bottom: 1px solid var(--div);
}

.tq-metric {
    flex: 1;
    min-width: 0;
    padding: 12px 24px;
}

.tq-metric + .tq-metric {
    border-left: 1px solid var(--div);
}

.tq-metric__label {
    color: var(--mut);
}

.tq-metric__value {
    margin-top: 3px;
    font: 800 24px/1.1 Archivo, sans-serif;
    overflow-wrap: anywhere;
}

.tq-metric__value--urgent {
    color: var(--red);
}

.tq-metric__of {
    font: 800 14px/1 Archivo, sans-serif;
    color: var(--mut);
}

.tq-tally {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 24px;
}

.tq-tally__row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.tq-tally__head {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.tq-tally__letter {
    width: 16px;
    font: 800 13px/1 Archivo, sans-serif;
    color: var(--mut);
}

.tq-tally__text {
    flex: 1;
    font: 400 13px/1.35 Archivo, sans-serif;
    color: var(--mut);
}

.tq-tally__pct {
    font: 800 13px/1 Archivo, sans-serif;
    color: var(--mut);
}

.tq-tally__row--hot .tq-tally__letter,
.tq-tally__row--hot .tq-tally__text,
.tq-tally__row--hot .tq-tally__pct {
    color: var(--ink);
}

.tq-tally__bar {
    height: 10px;
    background: var(--surf);
}

.tq-tally__fill {
    height: 10px;
    background: var(--red);
    transition: width .6s cubic-bezier(.25, .8, .25, 1), background .3s ease;
}

.tq-tally__fill--hot {
    background: var(--ink);
}

.tq-tally__fill--dim {
    background: var(--bar);
}

.tq-actions {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 2px solid var(--div2);
}

.tq-actions .tq-btn {
    min-height: 46px;
}

.tq-actions .tq-btn--outline {
    width: auto;
    flex: none;
}

.tq-hint {
    width: 100%;
    max-width: 1100px;
    color: var(--mut);
}

/* --- Aviso de conexão ----------------------------------------------------- */

.tq-offline {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 18px;
    background: var(--ink);
    color: var(--bg);
    font: 800 11px/1.3 Archivo, sans-serif;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* --- Auxiliares ----------------------------------------------------------- */

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

.tq-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    padding: 26px 18px;
}

/* ===========================================================================
   Porta de entrada do painel
   =========================================================================== */

.tq-gate {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 28px 18px;
}

.tq-gate__card {
    width: 100%;
    max-width: 440px;
    padding: 28px;
    background: var(--bg);
    border: 2px solid var(--ink);
    box-shadow: 0 12px 32px var(--ink-shadow);
}

.tq-gate__brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.tq-gate__foot {
    margin-top: 26px;
    padding-top: 16px;
    border-top: 1px solid var(--div);
    color: var(--mut);
}

.tq-gate .tq-display {
    font-size: 28px;
}

/* Mensagens de validação do formulário, no mesmo vocabulário do erro de login. */
.validation-message {
    display: block;
    margin-top: -6px;
    font: 400 12px/1.4 Archivo, sans-serif;
    color: var(--red-dark);
}

/* O link de saída precisa parecer botão sem herdar o sublinhado de link. */
a.tq-btn {
    text-decoration: none;
}

/* --- Placar da turma, exclusivo do painel --------------------------------- */

.tq-board {
    display: flex;
    flex-direction: column;
}

.tq-board__row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 24px;
    border-bottom: 1px solid var(--div);
    animation: rise .3s ease both;
}

.tq-board__row--leader {
    background: var(--ink);
    color: var(--bg);
}

.tq-board__pos {
    width: 28px;
    font: 800 14px/1 Archivo, sans-serif;
    color: var(--mut);
}

.tq-board__row--leader .tq-board__pos {
    color: var(--pale);
}

.tq-board__name {
    flex: 1;
    font: 400 15px/1.3 Archivo, sans-serif;
}

.tq-board__score {
    font: 800 18px/1 Archivo, sans-serif;
    min-width: 28px;
    text-align: right;
}

/* Roteiro longo: a lista rola dentro da coluna e o rodapé de comandos fica fixo. */
.tq-script__rows {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    max-height: 62dvh;
}

@media (max-width: 860px) {
    .tq-script__rows {
        max-height: none;
    }
}
