/* =========================================================================
   Urna eletrônica simulada — voto.pensedireita.com.br
   Mobile-first. A urna é uma foto frontal; o visor e a tecla CONFIRMA são
   camadas HTML posicionadas em % sobre ela — o texto sai nítido em qualquer
   tela e o visor troca de estado. As % vieram do bounding box medido na
   própria foto (ver README): trocar a foto exige remedir.
   ========================================================================= */

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

/* As regras de classe abaixo definem `display`, o que venceria o
   `[hidden]` do user-agent — sem isto os estados escondidos aparecem. */
[hidden] { display: none !important; }

:root {
    --ink: #0d1117;
    --green: #22c55e;
    --lcd: #d9e6f2;          /* visor aceso: azul-claro, como o real */
    --lcd-ink: #10151c;
    --lcd-line: #6b7f95;
}

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

body.urna-page {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: max(0.9rem, env(safe-area-inset-top)) 0.5rem max(0.9rem, env(safe-area-inset-bottom));
    background: radial-gradient(120% 80% at 50% 0%, #1b2230 0%, var(--ink) 55%, #07090d 100%);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #e8eaf0;
    -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------- selo */

.sim-badge {
    flex: none;
    padding: 0.3rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    color: rgba(255, 255, 255, 0.62);
    text-transform: uppercase;
}

/* --------------------------------------------------------------- palco */

.stage {
    flex: 0 1 auto;
    width: 100%;
    max-width: 620px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    min-height: 0;
}

.urna {
    position: relative;
    margin: 0;
    /* A figura PRECISA manter 1772/880 exatos: as camadas do visor e da
       tecla são posicionadas em % dela. Por isso o tamanho sai só da
       largura — a altura entra como teto via max-width. */
    width: 100%;
    min-width: 0;
    max-width: min(620px, calc(52vh * 1772 / 880));
    aspect-ratio: 1772 / 880;
    container-type: inline-size;
    filter: drop-shadow(0 22px 40px rgba(0, 0, 0, 0.55));
}

.urna__body {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 2%;
}

/* ------------------------------------------------------------- o visor */

.urna__screen {
    position: absolute;
    left: 8.63%;
    top: 16.70%;
    width: 51.35%;
    height: 59.89%;
    border-radius: 1%;
    overflow: hidden;
    background: var(--lcd);
    color: var(--lcd-ink);
    container-type: inline-size;
}

/* --- estado 1: voto montado */

.vote {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 2.6cqw 3cqw;
}

.vote__main {
    flex: 1;
    min-height: 0;
    display: flex;
    align-items: stretch;
    gap: 2.5cqw;
}

.vote__col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.8cqw;
}

.vote__eyebrow {
    margin: 0;
    font-size: 3.9cqw;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: 0.02em;
}

.vote__office {
    margin: 0 0 0.9cqw;
    /* Calibrado para "DEPUTADO FEDERAL" caber em uma linha na coluna.
       Sem nowrap de propósito: texto maior digitado no admin quebra
       em vez de ser cortado pelo overflow do visor. */
    font-size: 5.8cqw;
    font-weight: 800;
    line-height: 1.02;
    letter-spacing: -0.02em;
}

.vote__line {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 1.4cqw;
    font-size: 4.4cqw;
    line-height: 1.15;
    min-width: 0;
}

.vote__k { flex: none; }
.vote__line strong { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* dígitos em caixas, como no visor real */
.vote__digits { display: inline-flex; gap: 0.6cqw; }

.vote__digits b {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 4.6cqw;
    padding: 0.2cqw 0.7cqw;
    border: 0.35cqw solid var(--lcd-ink);
    font-size: 5.2cqw;
    font-weight: 800;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    background: rgba(255, 255, 255, 0.55);
}

.vote__photo {
    flex: none;
    align-self: center;
    /* Largura fixa (não altura): sobra coluna para "DEPUTADO FEDERAL"
       caber em uma linha só, como no visor real. */
    width: 28%;
    height: auto;
    max-height: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    object-position: top center;
    border: 0.4cqw solid rgba(0, 0, 0, 0.45);
    background: #fff;
}

.vote__hint {
    flex: none;
    margin: 1.4cqw 0 0;
    padding-top: 1.4cqw;
    border-top: 0.35cqw solid var(--lcd-line);
    text-align: center;
    line-height: 1.15;
}

.vote__hint b { display: block; font-size: 3.6cqw; font-weight: 800; letter-spacing: 0.02em; }
.vote__hint span { display: block; font-size: 3.2cqw; font-weight: 500; }

/* --- estado 2: confirmado */

.done {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1cqw;
    text-align: center;
}

.done__title {
    margin: 0;
    font-size: 7cqw;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: #15803d;
}

.done__fim {
    margin: 0;
    font-size: 17cqw;
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: 0.1em;
}

/* -------------------------------------------- tecla CONFIRMA (destaque)
   keyzone = retângulo exato da tecla na foto (só o anel pulsante).
   O botão de toque é maior: a tecla real tem ~34px no celular, abaixo do
   mínimo confortável, então a área clicável é ampliada sem cobrir CORRIGE. */

.urna__keyzone {
    position: absolute;
    left: 84.54%;
    top: 68.75%;
    width: 8.80%;
    height: 10.34%;
    pointer-events: none;
}

.urna__ring {
    position: absolute;
    inset: 0;
    border-radius: 14%;
    animation: keyPulse 1.7s ease-out infinite;
}

@keyframes keyPulse {
    0%   { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.9), 0 0 12px 2px rgba(34, 197, 94, 0.5); }
    70%  { box-shadow: 0 0 0 3.5cqw rgba(34, 197, 94, 0), 0 0 20px 6px rgba(34, 197, 94, 0.16); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0), 0 0 12px 2px rgba(34, 197, 94, 0); }
}

.urna__key {
    position: absolute;
    /* Cresce para a DIREITA (carcaça livre) em vez de para a esquerda,
       que invadiria a tecla CORRIGE. Garante ~45px no celular pequeno. */
    left: 84%;
    top: 59%;
    width: 13%;
    height: 30%;
    padding: 0;
    border: 0;
    border-radius: 8%;
    background: transparent;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.urna__key:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.urna__key:active { transform: translateY(1px); }

/* seta animada apontando para cima, logo abaixo da tecla */

.pointer {
    position: absolute;
    left: 88.9%;
    top: 84.5%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 0.8cqw;
    padding: 0.9cqw 1.6cqw;
    border-radius: 999px;
    background: rgba(9, 12, 18, 0.88);
    color: #6ee7a0;
    font-size: 2.2cqw;
    font-weight: 800;
    letter-spacing: 0.1em;
    white-space: nowrap;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
    animation: nudge 1.2s ease-in-out infinite;
    pointer-events: none;
}

.pointer svg { width: 2.8cqw; height: 2.8cqw; }

@keyframes nudge {
    0%, 100% { transform: translate(-50%, 0); }
    50%      { transform: translate(-50%, -22%); }
}

/* ---------------------------------------------------- depois do voto */

.after {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.7rem;
    width: min(100%, 420px);
    text-align: center;
    animation: rise 0.45s ease-out both;
}

.after__note { margin: 0; font-size: 0.86rem; line-height: 1.45; color: rgba(232, 234, 240, 0.82); }

.after__share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.85rem 1.2rem;
    border-radius: 12px;
    background: #25d366;
    color: #06240f;
    font-size: 0.95rem;
    font-weight: 800;
    text-decoration: none;
}

.after__share:active { transform: translateY(1px); }

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

/* ---------------------------------------------------------------- pé */

.foot {
    flex: none;
    width: min(100%, 560px);
    text-align: center;
    color: rgba(232, 234, 240, 0.42);
}

.foot__sim { margin: 0; font-size: 0.66rem; line-height: 1.5; }
.foot__legal { margin: 0.5rem 0 0; font-size: 0.62rem; line-height: 1.5; }

/* ----------------------------------------------------------- telinhas */

@media (max-height: 700px) {
    body.urna-page { gap: 0.6rem; }
    .sim-badge { font-size: 0.56rem; }
    .foot__sim { font-size: 0.6rem; }
}

@media (prefers-reduced-motion: reduce) {
    .urna__ring, .pointer, .after { animation: none; }
    .pointer { transform: translateX(-50%); }
}
