/* =====================================================
   TEAM BUILDER GAMIFICADO (index.html)
   Console portátil retrô: paisagem no desktop, vertical no celular
   ===================================================== */
:root {
    --px: 'Handjet', 'Courier New', monospace;
    --px-title: 'Handjet', 'Courier New', monospace;
    --shell: #3d3590;
    --shell-dark: #2a2468;
    --shell-light: #5248b5;
    --bezel: #22222c;
    --ink: #20202a;
    --paper: #f8f8f0;
}

.builder-section .section-lead a {
    color: var(--accent-text);
}

/* ---------- Console ---------- */
.console {
    display: grid;
    grid-template-columns: 1fr minmax(0, 760px) 1fr;
    align-items: center;
    gap: 18px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 30px 22px;
    border-radius: 34px 34px 90px 90px / 34px 34px 60px 60px;
    background: linear-gradient(170deg, var(--shell-light) 0%, var(--shell) 45%, var(--shell-dark) 100%);
    box-shadow:
        inset 0 3px 0 rgba(255, 255, 255, .18),
        inset 0 -6px 0 rgba(0, 0, 0, .25),
        0 24px 50px rgba(0, 0, 0, .55);
    user-select: none;
}

.console-center {
    min-width: 0;
}

.bezel {
    background: var(--bezel);
    padding: 18px 22px 12px;
    border-radius: 14px 14px 36px 14px;
    box-shadow: inset 0 0 0 2px #15151b;
}

.bezel-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-family: var(--px);
    font-size: 11px;
    color: #9a9ab0;
    letter-spacing: .08em;
}

.power-led {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff3b3b;
    box-shadow: 0 0 8px #ff3b3b;
}

.bezel-top .stripes {
    flex: 1;
    height: 4px;
    background: linear-gradient(to bottom, #b0306a 0 2px, #3266b0 2px 4px);
    border-radius: 2px;
    opacity: .8;
}

.console-brand {
    text-align: center;
    margin-top: 10px;
    font-family: var(--px-title);
    font-weight: 700;
    font-size: 11px;
    letter-spacing: .12em;
    color: rgba(255, 255, 255, .55);
}

.console-brand b {
    color: var(--accent-text);
    font-weight: 400;
}

/* ---------- Tela ---------- */
.screen {
    /* --u: unidade de tamanho do conteúdo da tela (substitui cqw).
       No desktop a tela é mais larga, então --u encolhe na mesma proporção
       e cada elemento mantém o tamanho real; sobra mais espaço para distribuir.
       --k é o mesmo fator, usado em larguras em % e no JS. */
    --u: 1cqw;
    --k: 1;
    position: relative;
    aspect-ratio: 3 / 2;
    width: 100%;
    overflow: hidden;
    border-radius: 4px;
    background: #000;
    container-type: inline-size;
    font-family: var(--px);
    color: var(--ink);
    image-rendering: pixelated;
}

.scene {
    position: absolute;
    inset: 0 0 auto 0;
    height: 58%;
    overflow: hidden;
    transition: background .4s;
}

/* Cenários */
.scene[data-scene="team_pose"] {
    background:
        radial-gradient(ellipse 34% 9% at 67% 86%, rgba(0, 0, 0, .14) 0 98%, transparent 100%),
        radial-gradient(ellipse 22% 8% at 16% 100%, rgba(0, 0, 0, .14) 0 98%, transparent 100%),
        linear-gradient(to bottom, #b8e6ef 0 56%, #d8efc0 56% 100%);
}

.scene[data-scene="nature_scenario"] {
    background:
        radial-gradient(circle at 86% 18%, #fff7b0 0 5%, transparent 5.5%),
        radial-gradient(ellipse 18% 6% at 22% 20%, #fff 0 98%, transparent 100%),
        radial-gradient(ellipse 12% 5% at 30% 16%, #fff 0 98%, transparent 100%),
        radial-gradient(ellipse 14% 5% at 62% 26%, #fff 0 98%, transparent 100%),
        radial-gradient(ellipse 45% 30% at 15% 72%, #5fae4a 0 98%, transparent 100%),
        radial-gradient(ellipse 55% 34% at 80% 70%, #4d9a3e 0 98%, transparent 100%),
        linear-gradient(to bottom, #7fcbff 0 58%, #7cc25a 58% 100%);
}

.scene[data-scene="narrative_emotional"] {
    background:
        radial-gradient(circle at 80% 22%, #fff3d0 0 6%, transparent 6.5%),
        radial-gradient(circle at 12% 12%, #fff 0 .5%, transparent .8%),
        radial-gradient(circle at 30% 8%, #fff 0 .5%, transparent .8%),
        radial-gradient(circle at 52% 16%, #fff 0 .4%, transparent .7%),
        radial-gradient(circle at 66% 6%, #fff 0 .5%, transparent .8%),
        radial-gradient(ellipse 60% 26% at 50% 100%, #2b1f3a 0 98%, transparent 100%),
        linear-gradient(to bottom, #2b1a4a 0%, #7b2f6b 38%, #e0704a 60%, #f6b45a 70%, #3a2440 70% 100%);
}

.scene[data-scene="battle"] {
    background:
        radial-gradient(ellipse 34% 10% at 67% 84%, #b9a46a 0 92%, #8c7a4a 93% 98%, transparent 100%),
        radial-gradient(ellipse 24% 9% at 16% 100%, #b9a46a 0 92%, #8c7a4a 93% 98%, transparent 100%),
        repeating-linear-gradient(-12deg, rgba(255, 255, 255, .0) 0 18px, rgba(255, 255, 255, .35) 18px 20px),
        linear-gradient(to bottom, #f6e9b8 0 55%, #e3cf8d 55% 100%);
}

.scene[data-scene="battle"]::after,
.scene[data-vs]::after {
    content: 'VS';
    position: absolute;
    left: 28%;
    top: 42%;
    z-index: 25;
    font-family: var(--px-title);
    font-weight: 700;
    font-size: calc(5.88 * var(--u));
    color: #e0403a;
    text-shadow: calc(.3 * var(--u)) calc(.3 * var(--u)) 0 #5a1010;
    animation: vsPulse 1.2s steps(2) infinite;
}

.scene[data-vs]::before {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(-12deg, rgba(255, 255, 255, 0) 0 18px, rgba(255, 255, 255, .25) 18px 20px);
    pointer-events: none;
}

@keyframes vsPulse {
    50% {
        transform: scale(1.12);
    }
}

/* HUD de preço (estilo barra de HP) */
.hud {
    position: absolute;
    top: 5%;
    left: 3%;
    width: 36%;
    z-index: 30;
    background: var(--paper);
    border: calc(.45 * var(--u)) solid var(--ink);
    border-radius: calc(1.2 * var(--u)) calc(1.2 * var(--u)) calc(1.2 * var(--u)) calc(.2 * var(--u));
    padding: calc(1 * var(--u)) calc(1.4 * var(--u)) calc(1.1 * var(--u));
    box-shadow: calc(.5 * var(--u)) calc(.5 * var(--u)) 0 rgba(0, 0, 0, .25);
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: clamp(12.6px, calc(2.8 * var(--u)), 21px);
    font-weight: 700;
    text-transform: uppercase;
}

.hud-lv {
    font-weight: 400;
}

.hud-bar {
    display: flex;
    height: calc(1.5 * var(--u));
    min-height: 6px;
    margin: calc(.7 * var(--u)) 0 calc(.5 * var(--u));
    background: #3a3a3a;
    border: calc(.3 * var(--u)) solid var(--ink);
    border-radius: calc(1 * var(--u));
    overflow: hidden;
}

.hud-bar i {
    display: block;
    height: 100%;
    transition: width .35s steps(6);
}

.hud-bar [data-seg="trainers"] {
    background: #00CCC7;
}

.hud-bar [data-seg="pokemon"] {
    background: #58d858;
}

.hud-bar [data-seg="pets"] {
    background: #f8b030;
}

.hud-bar [data-seg="scene"] {
    background: #d068e8;
}

.hud-total {
    font-family: var(--px-title);
    font-weight: 700;
    font-size: clamp(15.4px, calc(3.78 * var(--u)), 30.8px);
    text-align: right;
    line-height: 1.1;
}

.hud-total.bump {
    animation: hudBump .3s steps(3);
}

@keyframes hudBump {
    50% {
        transform: scale(1.15);
        color: #0a7f7c;
    }
}

.sound-toggle {
    position: absolute;
    top: 1.8%;
    right: 2.1%;
    z-index: 30;
    font-family: var(--px-title);
    font-weight: 700;
    font-size: clamp(14px, calc(2.9 * var(--u)), 24px);
    line-height: 1;
    background: #fffdde;
    color: #1f1f1f;
    border: calc(.45 * var(--u)) solid #141313;
    border-radius: calc(1.6 * var(--u)) calc(.6 * var(--u));
    box-shadow: calc(.5 * var(--u)) calc(.6 * var(--u)) 0 #566a54;
    padding: calc(.6 * var(--u)) calc(.9 * var(--u));
    cursor: pointer;
}

.sound-toggle svg {
    display: block;
    width: clamp(18px, calc(4 * var(--u)), 30px);
    height: clamp(18px, calc(4 * var(--u)), 30px);
    fill: #1f1f1f;
}

.sound-toggle[aria-pressed="true"] {
    background: #c8f5cf;
}

.sound-toggle:hover {
    background: #fff;
}

.sound-toggle:active {
    transform: translate(calc(.3 * var(--u)), calc(.3 * var(--u)));
    box-shadow: calc(.2 * var(--u)) calc(.3 * var(--u)) 0 #566a54;
}

/* Treinadores, equipe e pets */
.trainers,
.team-field,
.pets {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.trainer {
    position: absolute;
    bottom: -20%;
    animation: breathe 2.4s steps(2) infinite;
    filter: drop-shadow(calc(.4 * var(--u)) calc(.4 * var(--u)) 0 rgba(0, 0, 0, .25));
}

.trainer svg,
.mon-sprite svg,
.pet svg {
    display: block;
    width: 100%;
    height: auto;
}

@keyframes breathe {
    50% {
        transform: translateY(calc(.4 * var(--u)));
    }
}

.mon {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: auto;
}

.mon::after {
    content: '';
    order: 1;
    width: 80%;
    height: calc(.9 * var(--u));
    margin-top: calc(-.3 * var(--u));
    border-radius: 50%;
    background: rgba(0, 0, 0, .22);
}

.mon-sprite {
    width: 100%;
    animation: idle 1.6s steps(2) infinite;
}

.mon--float .mon-sprite {
    animation: float 2.2s ease-in-out infinite;
}

.mon--float::after {
    width: 55%;
    margin-top: calc(1.2 * var(--u));
}

@keyframes idle {
    50% {
        transform: translateY(calc(-.3 * var(--u)));
    }
}

@keyframes float {
    50% {
        transform: translateY(calc(-1.4 * var(--u)));
    }
}

.mon.pop {
    animation: pop .45s steps(5);
}

@keyframes pop {
    0% {
        transform: scale(0);
        filter: brightness(4);
    }

    70% {
        transform: scale(1.2);
        filter: brightness(2);
    }

    100% {
        transform: scale(1);
    }
}

.mon-tier {
    order: 2;
    margin-top: calc(.3 * var(--u));
    font-size: clamp(9.8px, calc(1.96 * var(--u)), 16.8px);
    line-height: 1;
    letter-spacing: -.05em;
    text-shadow: 0 0 2px #fff, 0 0 2px #fff;
}

.tier-e {
    color: #2f8f2f;
}

.tier-m {
    color: #c07a00;
}

.tier-c {
    color: #c0302a;
}

.pet {
    position: absolute;
    bottom: 3%;
    width: calc(6% * var(--k));
    z-index: 15;
    animation: idle 1.2s steps(2) infinite;
}

/* ---------- Caixa de diálogo ---------- */
.dialog {
    position: absolute;
    inset: auto 0 0 0;
    height: 42%;
    background: var(--paper);
    border: calc(.7 * var(--u)) solid var(--ink);
    outline: calc(.4 * var(--u)) solid #fff;
    outline-offset: calc(-1.4 * var(--u));
    border-radius: calc(1 * var(--u));
    padding: calc(2.2 * var(--u)) calc(3 * var(--u)) calc(1.8 * var(--u));
    display: flex;
    flex-direction: column;
    gap: calc(1.2 * var(--u));
    font-size: clamp(15.4px, calc(3.15 * var(--u)), 23.8px);
    line-height: 1.35;
}

.dialog-head {
    display: flex;
    gap: calc(2 * var(--u));
    align-items: flex-start;
}

.dialog-text {
    flex: 1;
    min-height: 2.7em;
    cursor: pointer;
}

.dialog-step {
    font-family: var(--px-title);
    font-weight: 700;
    font-size: clamp(9.8px, calc(1.82 * var(--u)), 15.4px);
    color: #777;
    white-space: nowrap;
}

.dialog-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: calc(1 * var(--u));
}

/* Menus */
.menu {
    display: flex;
    flex-wrap: wrap;
    gap: calc(.6 * var(--u)) calc(2.4 * var(--u));
}

/* Intro menu: START em destaque */
.menu--intro {
    column-gap: 50px;
    align-items: baseline;
}

.menu--intro .menu-item:first-child,
.menu--intro .menu-item:first-child.is-active {
    color: #d62828;
    font-size: 1.4em;
}

.menu--col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(.4 * var(--u)) calc(2 * var(--u));
}

.menu-item {
    display: inline-flex;
    align-items: baseline;
    gap: calc(.8 * var(--u));
    background: none;
    border: none;
    padding: calc(.3 * var(--u)) calc(.6 * var(--u)) calc(.3 * var(--u)) 0;
    font: inherit;
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
    text-align: left;
}

.menu-item .cursor {
    visibility: hidden;
    color: var(--ink);
    font-size: .8em;
}

.menu-item.is-active .cursor {
    visibility: visible;
    animation: blink .8s steps(1) infinite;
}

.menu-item.is-active {
    color: #b42323;
}

.menu-item:focus-visible {
    outline: calc(.3 * var(--u)) dashed #b42323;
    outline-offset: calc(.2 * var(--u));
}

.menu-item:disabled {
    color: #aaa;
    cursor: not-allowed;
}

.menu-sub {
    font-weight: 500;
    font-size: .82em;
    color: #666;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* Etapa da equipe: campo de busca na mesma linha da pergunta */
.team-row {
    display: flex;
    align-items: center;
    gap: calc(1.5 * var(--u));
    flex: 1;
    min-width: 0;
}

[data-step="team"] .dialog-text {
    flex: 1;
}

/* campo + contador ocupam metade da área azul-clara, alinhados à direita */
[data-step="team"] .team-row {
    flex: 0 0 50%;
}

.combo {
    position: relative;
    flex: 1;
    min-width: 0;
}

.combo input {
    width: 100%;
    font: inherit;
    font-weight: 600;
    color: var(--ink);
    background: #fff;
    border: calc(.4 * var(--u)) solid var(--ink);
    border-radius: calc(.8 * var(--u));
    padding: 0 calc(1.2 * var(--u));
    line-height: 1.3;
}

/* equipe vazia: a borda pisca em vermelho chamando o visitante para digitar */
.combo input.is-empty {
    animation: blink-border 1s ease-in-out infinite;
}

@keyframes blink-border {

    0%,
    100% {
        border-color: var(--ink);
    }

    50% {
        border-color: #d53434;
    }
}

@media (prefers-reduced-motion: reduce) {
    .combo input.is-empty {
        animation: none;
        border-color: #d53434;
    }
}

.combo input:focus {
    outline: none;
    border-color: #d53434;
    box-shadow: 0 0 0 calc(.4 * var(--u)) rgba(213, 52, 52, .35);
}

.team-count {
    font-family: var(--px-title);
    font-weight: 700;
    font-size: clamp(11.2px, calc(1.96 * var(--u)), 16.8px);
    white-space: nowrap;
}

.suggest {
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(100% + calc(.6 * var(--u)));
    z-index: 50;
    list-style: none;
    background: var(--paper);
    border: calc(.45 * var(--u)) solid var(--ink);
    border-radius: calc(.8 * var(--u));
    box-shadow: calc(.5 * var(--u)) calc(.5 * var(--u)) 0 rgba(0, 0, 0, .3);
    max-height: calc(22 * var(--u));
    overflow-y: auto;
}

.suggest li {
    display: flex;
    align-items: center;
    gap: calc(1 * var(--u));
    padding: calc(.5 * var(--u)) calc(1.2 * var(--u));
    cursor: pointer;
}

.suggest li.is-active,
.suggest li:hover {
    background: #fbe0e0;
}

.sug-name {
    flex: 1;
}

.type-dot {
    width: calc(1.4 * var(--u));
    height: calc(1.4 * var(--u));
    min-width: 7px;
    min-height: 7px;
    border: calc(.2 * var(--u)) solid rgba(0, 0, 0, .5);
    flex-shrink: 0;
}

.chips {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    gap: calc(.7 * var(--u)) calc(.8 * var(--u));
    min-height: 1.1em;
}

.chips li.is-off {
    display: none;
}

/* bolinhas de paginação dos chips (uma por bloco de 2 linhas) */
.chip-dots {
    display: flex;
    justify-content: center;
    margin-top: calc(.6 * var(--u));
    gap: calc(1 * var(--u));
    min-height: calc(1.6 * var(--u));
}

.chip-dots button {
    width: calc(1.6 * var(--u));
    height: calc(1.6 * var(--u));
    padding: 0;
    border: calc(.3 * var(--u)) solid var(--ink);
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
}

.chip-dots button:hover {
    background: #fbe0e0;
}

.chip-dots button[aria-current="true"] {
    background: #d53434;
}

.chips:empty::before {
    content: 'No Pokémon yet…';
    color: #999;
    font-size: .85em;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: calc(.6 * var(--u));
    white-space: nowrap;
    font: inherit;
    font-size: .85em;
    background: #fff;
    border: calc(.3 * var(--u)) solid var(--ink);
    border-radius: calc(2 * var(--u));
    padding: calc(.1 * var(--u)) calc(1 * var(--u));
    cursor: pointer;
    color: var(--ink);
}

.chip:hover,
.chip:focus-visible {
    background: #ffe0e0;
}

.chip-x {
    font-weight: 700;
    color: #c0302a;
}

/* ---------- Controles ---------- */
.console-side {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

.dpad {
    position: relative;
    width: 120px;
    height: 120px;
}

.dpad button {
    position: absolute;
    width: 40px;
    height: 40px;
    background: #23232b;
    border: none;
    color: #555;
    font-size: 14px;
    cursor: pointer;
    box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .4);
}

.dpad::before {
    content: '';
    position: absolute;
    left: 40px;
    top: 40px;
    width: 40px;
    height: 40px;
    background: #23232b;
}

.dpad [data-key="up"] {
    left: 40px;
    top: 0;
    border-radius: 6px 6px 0 0;
}

.dpad [data-key="down"] {
    left: 40px;
    bottom: 0;
    border-radius: 0 0 6px 6px;
}

.dpad [data-key="left"] {
    left: 0;
    top: 40px;
    border-radius: 6px 0 0 6px;
}

.dpad [data-key="right"] {
    right: 0;
    top: 40px;
    border-radius: 0 6px 6px 0;
}

.ab {
    display: flex;
    gap: 14px;
    transform: rotate(-22deg);
}

.ab button {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: none;
    background: radial-gradient(circle at 35% 30%, #ff8a8a 0%, #d53434 45%, #8f1c1c 100%);
    color: #ffffff;
    font-family: var(--px-title);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 5px 0 #6e1414, 0 8px 12px rgba(0, 0, 0, .35);
    transform: rotate(22deg);
}

.ab [data-key="b"] {
    margin-top: 26px;
}

.start-select {
    display: flex;
    gap: 14px;
}

.start-select button {
    font-family: var(--px);
    font-size: 11px;
    letter-spacing: .1em;
    color: rgba(255, 255, 255, .65);
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.start-select button::before {
    content: '';
    width: 38px;
    height: 10px;
    border-radius: 6px;
    background: #23232b;
    transform: rotate(-22deg);
}

.console button[data-key].is-pressed,
.console button[data-key]:active {
    transform: translateY(2px) scale(.96);
    filter: brightness(.85);
}

.ab button.is-pressed,
.ab button:active {
    transform: rotate(22deg) translateY(3px);
    box-shadow: 0 2px 0 #6e1414;
}

.controls-hint {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px 32px;
    margin-top: 22px;
    font-family: var(--font-head);
    font-size: 16px;
    font-weight: 600;
    color: #f1f1f1;
}

.hint-item {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.hint-keys {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.hint-keys i {
    font-style: normal;
    font-weight: 400;
    font-size: 13px;
    color: #9a9aa3;
    margin: 0 4px;
}

.controls-hint kbd {
    font-family: var(--font-head);
    font-size: 14px;
    font-weight: 700;
    min-width: 28px;
    text-align: center;
    background: #ffd23f;
    color: #2a2100;
    border-radius: 6px;
    padding: 3px 8px;
    box-shadow: 0 3px 0 #b8901a;
}

/* ---------- Trainer Card (formulário) ---------- */
.trainer-card {
    max-width: 1000px;
    margin: 30px auto 0;
    background: var(--paper);
    color: var(--ink);
    border: 5px solid var(--ink);
    outline: 3px solid #fff;
    outline-offset: -11px;
    border-radius: 12px;
    padding: 28px 30px 30px;
    font-family: var(--font-body);
    animation: cardIn .35s steps(4);
}

@keyframes cardIn {
    from {
        transform: translateY(16px);
        opacity: 0;
    }
}

.tc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border-bottom: 3px dashed #c8c8b8;
    padding-bottom: 14px;
    margin-bottom: 20px;
}

.tc-header h3 {
    font-family: var(--font-head);
    font-size: 18px;
    color: var(--ink);
}

.tc-total {
    font-family: var(--font-head);
    font-size: 20px;
    color: #b42323;
}

.tc-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 30px;
}

.tc-summary h4,
.tc-fields legend {
    font-family: var(--font-body);
    font-size: 15px;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 8px;
}

.tc-breakdown {
    list-style: none;
    font-size: 17px;
    margin-bottom: 14px;
}

.tc-breakdown li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 5px 0;
    border-bottom: 2px dotted #d8d8c8;
}

.tc-breakdown li.sub {
    font-size: 14px;
    color: #666;
    padding-left: 14px;
}

.tc-breakdown li.tc-discount {
    color: #0a7f3c;
}

.tc-team {
    font-size: 15px;
    color: #444;
    line-height: 1.5;
}

.tc-note {
    margin-top: 14px;
    font-size: 13px;
    color: #777;
    line-height: 1.4;
}

.tc-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.trainer-card .form-group label {
    font-family: var(--font-body);
    color: #555;
    font-size: 14px;
    text-transform: uppercase;
}

.trainer-card .form-group input,
.trainer-card .form-group textarea {
    background: #fff;
    color: var(--ink);
    border: 3px solid var(--ink);
    border-radius: 6px;
    font-family: var(--font-body);
}

.trainer-card .form-group input:focus,
.trainer-card .form-group textarea:focus {
    border-color: #d53434;
    background: #fff;
}

.trainer-card .choice {
    color: #333;
    font-size: 15px;
}

.trainer-card .choice input[type="checkbox"] {
    background: #fff;
    border-color: var(--ink);
}

.trainer-card .btn-text-link {
    color: #b42323;
}

.btn-pixel {
    font-family: var(--font-head);
    font-size: 15px;
    padding: 16px;
    background: #d53434;
    color: #ffffff;
    border: 4px solid var(--ink);
    border-radius: 8px;
    box-shadow: 0 5px 0 var(--ink);
    cursor: pointer;
}

.btn-pixel:hover {
    background: #e65050;
}

.btn-pixel:active {
    transform: translateY(4px);
    box-shadow: 0 1px 0 var(--ink);
}

.btn-pixel[disabled] {
    opacity: .7;
    cursor: wait;
}

.trainer-card .form-success,
.trainer-card .form-error {
    font-family: var(--font-body);
}

/* ---------- Responsivo: vira console vertical no celular ---------- */
@media (max-width: 860px) {
    .console {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "screen screen"
            "left right";
        padding: 14px 12px 24px;
        border-radius: 26px 26px 64px 26px;
        gap: 14px 10px;
        /* vermelho do GBA, com contorno preto como no desktop */
        --shell: #d53434;
        --shell-dark: #b02626;
        --shell-light: #e24848;
        border: 4px solid #000;
    }

    .console-center {
        grid-area: screen;
    }

    .console-side.left {
        grid-area: left;
    }

    .console-side.right {
        grid-area: right;
    }

    .start-select {
        grid-area: sel;
        justify-content: center;
    }

    .console-side.right .start-select {
        display: none;
    }

    .start-select.mobile-only,
    .console .console-brand {
        display: none !important;
    }

    .bezel {
        padding: 12px 12px 8px;
        border-radius: 10px 10px 28px 10px;
    }

    .screen {
        aspect-ratio: 10 / 11;
    }

    .scene {
        height: 52%;
    }

    .dialog {
        height: 48%;
        padding: calc(3 * var(--u)) calc(3.6 * var(--u));
        font-size: clamp(16.8px, calc(5.46 * var(--u)), 22.4px);
    }

    .hud {
        width: 48%;
    }

    .console-brand {
        font-size: 9px;
        letter-spacing: .06em;
    }

    .menu--col {
        grid-template-columns: 1fr;
    }

    .suggest {
        max-height: calc(42 * var(--u));
    }

    .dpad {
        width: 112px;
        height: 112px;
    }

    .dpad::before {
        display: none;
    }

    .m-art {
        display: block;
        width: 100%;
        height: 100%;
        pointer-events: none;
    }

    .m-dpad {
        position: absolute;
        inset: 0;
    }

    /* botões do direcional: áreas transparentes sobre os braços da cruz */
    .dpad button {
        width: 38.5%;
        height: 30.8%;
        background: transparent;
        box-shadow: none;
        color: transparent;
        font-size: 0;
        border-radius: 0;
        z-index: 1;
    }

    .dpad [data-key="up"]    { left: 30.7%; top: 0; }
    .dpad [data-key="down"]  { left: 30.7%; top: 69.2%; bottom: auto; }
    .dpad [data-key="left"]  { left: 0; top: 30.8%; width: 30.7%; height: 38.5%; }
    .dpad [data-key="right"] { left: 69.2%; right: auto; top: 30.8%; width: 30.7%; height: 38.5%; }

    .console:has(.dpad [data-key="up"]:is(:active, .is-pressed)) .m-ar-up,
    .console:has(.dpad [data-key="down"]:is(:active, .is-pressed)) .m-ar-down,
    .console:has(.dpad [data-key="left"]:is(:active, .is-pressed)) .m-ar-left,
    .console:has(.dpad [data-key="right"]:is(:active, .is-pressed)) .m-ar-right {
        fill: #d53434;
    }

    .ab button {
        width: 58px;
        height: 61px;
        padding: 0;
        background: none;
        border-radius: 50%;
        box-shadow: none;
        filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .3));
    }

    .ab button.is-pressed,
    .ab button:active {
        box-shadow: none;
        filter: none;
    }

    .tc-grid {
        grid-template-columns: 1fr;
    }

    .trainer-card {
        padding: 22px 18px 24px;
    }

    .controls-hint {
        display: none;
    }
}

@media (min-width: 861px) {
    .start-select.mobile-only,
    .m-art {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {

    .mon-sprite,
    .trainer,
    .pet,
    .mon.pop,
    .menu-item.is-active .cursor,
    .scene[data-scene="battle"]::after,
.scene[data-vs]::after {
        animation: none !important;
    }
}

/* ---------- Regras novas: contador, marcação, +N, extras ---------- */
.hud-bar [data-seg="extras"] {
    background: #ff6b6b;
}

.tier-q {
    color: #6a6a6a;
}

.counter {
    display: flex;
    align-items: center;
    gap: calc(2 * var(--u));
}

.counter-btn {
    width: calc(5.4 * var(--u));
    height: calc(5.4 * var(--u));
    min-width: 30px;
    min-height: 30px;
    font: inherit;
    font-size: .9em;
    background: #fff;
    color: var(--ink);
    border: calc(.4 * var(--u)) solid var(--ink);
    border-radius: calc(.8 * var(--u));
    cursor: pointer;
}

.counter-btn:hover {
    background: #fbe0e0;
}

.counter-value {
    min-width: 3ch;
    text-align: center;
    font-family: var(--px-title);
    font-weight: 700;
    font-size: clamp(19.6px, calc(4.76 * var(--u)), 36.4px);
}

.counter-unit {
    color: #666;
    font-size: .9em;
}

.menu-item .check {
    font-size: .9em;
    color: #b42323;
}

.more-badge {
    position: absolute;
    z-index: 26;
    font-family: var(--px-title);
    font-weight: 700;
    font-size: clamp(11.2px, calc(2.24 * var(--u)), 18.2px);
    background: var(--paper);
    color: var(--ink);
    border: calc(.35 * var(--u)) solid var(--ink);
    border-radius: calc(1 * var(--u));
    padding: calc(.4 * var(--u)) calc(.8 * var(--u));
}

.tc-breakdown li.subtotal {
    font-weight: 700;
    border-bottom-style: solid;
}

.tc-breakdown li.tc-wise {
    color: #0a7f3c;
    font-weight: 700;
    border-bottom: none;
    margin-top: 6px;
}

/* ---------- Carcaça GBA em SVG (desktop) ----------
   SVG gerado de _fonte/gba.figcraft. Os botões HTML continuam
   sendo os controles reais: ficam transparentes por cima do
   desenho e acendem os estados de hover do SVG via :has(). */
.gba-shell {
    display: none;
}

@media (min-width: 861px) {
    .console {
        position: relative;
        display: block;
        aspect-ratio: 1800 / 907;
        max-width: 1320px;
        padding: 0;
        border-radius: 0;
        background: none;
        box-shadow: none;
        filter: drop-shadow(0 24px 40px rgba(0, 0, 0, .5));
    }

    .gba-shell {
        display: block;
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
    }

    .console-center {
        position: absolute;
        left: 17.43%;
        top: 12.41%;
        width: 65.34%;
        height: 71.86%;
    }

    .console .bezel {
        height: 100%;
        padding: 0;
        background: none;
        border-radius: 0;
        box-shadow: none;
    }

    .console .bezel-top,
    .console .console-brand,
    .console .start-select [data-key="select"] {
        display: none;
    }

    .console .screen {
        /* tela larga (1176 x 652 no SVG) contra 906 x 552 do desenho original */
        --k: .77043;
        --u: calc(1cqw * .77043);
        aspect-ratio: auto;
        height: 100%;
        border-radius: .8%/1.2%;
    }

    /* controles: áreas clicáveis transparentes sobre o desenho */
    .console .console-side,
    .console .dpad,
    .console .ab,
    .console .start-select {
        position: static;
        display: contents;
    }

    .console .start-select.mobile-only {
        display: none;
    }

    .console .dpad::before {
        display: none;
    }

    .console .dpad button,
    .console .ab button,
    .console .start-select button {
        position: absolute;
        margin: 0;
        padding: 0;
        transform: none;
        border: 0;
        background: transparent;
        box-shadow: none;
        color: transparent;
        font-size: 0;
        cursor: pointer;
        z-index: 2;
    }

    .console .start-select button::before {
        display: none;
    }

    .console .dpad button:focus-visible,
    .console .ab button:focus-visible,
    .console .start-select button:focus-visible {
        outline: 3px solid #fff;
        outline-offset: 2px;
    }

    .console .ab button,
    .console .ab button:focus-visible {
        border-radius: 50%;
    }

    .console .start-select button {
        border-radius: 999px;
    }

    .console [data-key="up"]    { left: 6.01%;  top: 32.77%; width: 3.98%; height: 6.31%; }
    .console [data-key="down"]  { left: 6.01%;  top: 46.96%; width: 3.98%; height: 6.31%; }
    .console [data-key="left"]  { left: 2.83%;  top: 39.07%; width: 3.17%; height: 7.90%; }
    .console [data-key="right"] { left: 9.98%;  top: 39.07%; width: 3.17%; height: 7.90%; }
    .console [data-key="b"]     { left: 86.77%; top: 40.30%; width: 4.89%; height: 10.21%; }
    .console [data-key="a"]     { left: 91.56%; top: 32.47%; width: 4.89%; height: 10.21%; }
    .console .console-side [data-key="start"] { left: 87.93%; top: 71.06%; width: 9.41%; height: 12.05%; }

    /* estados de hover do SVG */
    .gba-hv {
        opacity: 0;
    }

    /* direcional: hover só pinta a seta; o clique deforma o botão */
    .console:has([data-key="up"]:is(:hover, :focus-visible)) .gba-ar-up,
    .console:has([data-key="down"]:is(:hover, :focus-visible)) .gba-ar-down,
    .console:has([data-key="left"]:is(:hover, :focus-visible)) .gba-ar-left,
    .console:has([data-key="right"]:is(:hover, :focus-visible)) .gba-ar-right {
        fill: #d53434;
    }

    .console:has([data-key="up"]:is(:active, .is-pressed)) .gba-hv-up,
    .console:has([data-key="down"]:is(:active, .is-pressed)) .gba-hv-down,
    .console:has([data-key="left"]:is(:active, .is-pressed)) .gba-hv-left,
    .console:has([data-key="right"]:is(:active, .is-pressed)) .gba-hv-right,
    .console:has([data-key="a"]:is(:hover, :focus-visible)) .gba-hv-a,
    .console:has([data-key="b"]:is(:hover, :focus-visible)) .gba-hv-b,
    .console:has(.console-side [data-key="start"]:is(:hover, :focus-visible)) .gba-hv-start {
        opacity: 1;
    }

    /* pressionado: mostra a arte "pressionado" no lugar do hover */
    .gba-pr {
        opacity: 0;
    }

    .console:has([data-key="a"]:is(:active, .is-pressed)) .gba-pr-a,
    .console:has([data-key="b"]:is(:active, .is-pressed)) .gba-pr-b,
    .console:has(.console-side [data-key="start"]:is(:active, .is-pressed)) .gba-pr-start {
        opacity: 1;
    }

    .console:has([data-key="a"]:is(:active, .is-pressed)) .gba-hv-a,
    .console:has([data-key="b"]:is(:active, .is-pressed)) .gba-hv-b,
    .console:has(.console-side [data-key="start"]:is(:active, .is-pressed)) .gba-hv-start {
        opacity: 0;
    }

    /* esconde o desenho normal enquanto hover/pressionado está ativo
       (sem transição, para as imagens não se sobreporem) */
    .console:has(:is([data-key="up"], [data-key="down"], [data-key="left"], [data-key="right"]):is(:active, .is-pressed)) .gba-nm-dpad,
    .console:has([data-key="a"]:is(:hover, :focus-visible, :active, .is-pressed)) .gba-nm-a,
    .console:has([data-key="b"]:is(:hover, :focus-visible, :active, .is-pressed)) .gba-nm-b,
    .console:has(.console-side [data-key="start"]:is(:hover, :focus-visible, :active, .is-pressed)) .gba-nm-start {
        opacity: 0;
    }
}

/* ---------- Tela no visual do gba.figcraft ---------- */
.screen {
    background: #fff;
}

.hud {
    top: 1.8%;
    left: 2.1%;
    width: calc(35.5% * var(--k));
    padding: calc(.6 * var(--u)) calc(2.4 * var(--u)) calc(1.2 * var(--u)) calc(2.6 * var(--u));
    background: #fffdde;
    border: calc(.45 * var(--u)) solid #141313;
    border-radius: calc(2.2 * var(--u)) calc(.8 * var(--u));
    box-shadow: calc(.7 * var(--u)) calc(.8 * var(--u)) 0 #566a54;
}

.hud-top {
    align-items: center;
    gap: calc(1 * var(--u));
    font-family: var(--px-title);
    font-weight: 700;
    font-size: clamp(16px, calc(4.6 * var(--u)), 42px);
    text-transform: none;
    color: #1f1f1f;
    line-height: 1;
}

.hud-top > span:first-child {
    margin-right: auto;
}

.hud-lv {
    display: none;
}

.hud-total {
    font-size: inherit;
    line-height: 1;
}

.hud-bar {
    height: calc(1.8 * var(--u));
    margin: calc(.6 * var(--u)) 0 0;
    background: #fff;
    border: calc(.33 * var(--u)) solid #312c2c;
    border-radius: calc(2 * var(--u));
}

.hud-bar [data-seg="trainers"] { background: #00bb79; }
.hud-bar [data-seg="pokemon"]  { background: #02ff00; }
.hud-bar [data-seg="pets"]     { background: #c7ff00; }
.hud-bar [data-seg="extras"]   { background: #24eb96; }
.hud-bar [data-seg="scene"]    { background: #00bb02; }

/* pokébolas de etapa (6 etapas; as futuras ficam a 50%) */
.hud-steps {
    position: absolute;
    z-index: 30;
    top: calc(100% + calc(1.2 * var(--u)));
    right: 0;
    display: flex;
    gap: calc(.58 * var(--u));
    pointer-events: none;
}

.hud-steps svg {
    width: calc(2.23 * var(--u));
    height: auto;
    opacity: .5;
    transition: opacity .2s;
}

.hud-steps svg.is-done {
    opacity: 1;
}

.dialog {
    inset: auto calc(2.1% * var(--k)) 2% calc(2.1% * var(--k));
    height: 40%;
    background: #626ba3;
    border: none;
    outline: none;
    border-radius: calc(2.2 * var(--u));
    /* padding generoso: o conteúdo nunca encosta na borda do miolo ciano */
    padding: calc(2.6 * var(--u)) calc(5.4 * var(--u)) calc(2.8 * var(--u));
    gap: 0;
    color: #201b1b;
    font-size: clamp(15px, calc(3.5 * var(--u)), 32px);
    line-height: 1.2;
}

/* sem reserva de 2 linhas vazias entre o texto e os controles */
.dialog-text {
    min-height: 0;
}

.dialog-body {
    justify-content: space-evenly;
    gap: calc(.4 * var(--u));
    padding-top: calc(.4 * var(--u));
}

/* todos os menus em linha: opções (OK / BACK etc.) afastadas 50px */
.dialog .menu:not(.menu--col) {
    column-gap: 50px;
}

.dialog .menu-item {
    font-size: 1.2em;
    padding-top: calc(.5 * var(--u));
    padding-bottom: calc(.5 * var(--u));
}

.dialog-step {
    display: none;
}

/* Handjet em peso 400 fica fino/"arranhado"; 600 mantém o traço sólido como no design */
.screen {
    font-weight: 600;
}

/* miolo ciano com cantos arredondados (como o dialog-hud do design) */
.dialog::before {
    content: '';
    position: absolute;
    inset: calc(.63 * var(--u)) calc(2.48 * var(--u));
    background: #d2f9f9;
    border-radius: calc(2.2 * var(--u));
}

.dialog > * {
    position: relative;
}
