/* Garagem do Leandro: garagem noturna, só em tema escuro. */

:root {
  color-scheme: dark;
  --fundo: #0b0d12;
  --superficie: rgba(16, 19, 26, 0.84);
  --superficie-solida: #12151c;
  --borda: rgba(255, 255, 255, 0.1);
  --texto: #eef1f6;
  --texto-suave: #a3abb9;
  --texto-claro: #d4dae3;
  --destaque: #6bd11f;
  --verde: #39d353;
  --amarelo: #ffc531;
  --vermelho: #ff3b3b;
  --raio: 16px;
  --margem: 16px;
  --topo-seguro: max(12px, env(safe-area-inset-top));
  --base-segura: max(16px, env(safe-area-inset-bottom));
  --fonte-titulo: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --fonte-texto: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
}

body {
  background: var(--fundo);
  color: var(--texto);
  font-family: var(--fonte-texto);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font: inherit;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
}

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

.botao-principal,
.botao-secundario {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0 28px;
  border-radius: 14px;
  font-family: var(--fonte-titulo);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

.botao-principal {
  border: none;
  background: var(--destaque);
  color: #0b0d12;
}

.botao-principal:disabled {
  background: #2a2f38;
  color: var(--texto-suave);
  cursor: progress;
}

.botao-secundario {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  color: var(--texto);
}

.botao-leve {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--borda);
  border-radius: 999px;
  background: var(--superficie);
  color: var(--texto);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.botao-leve:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.botao-leve.destaque {
  border-color: transparent;
  background: var(--destaque);
  color: #0b0d12;
  box-shadow: 0 0 18px rgba(107, 209, 31, 0.45);
}

.botao-icone {
  width: 40px;
  padding: 0;
  justify-content: center;
}

.botao-icone svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}

#botao-som[aria-pressed='true'] .icone-som-ligado,
#botao-som[aria-pressed='false'] .icone-som-desligado {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Garagem */

.pagina-garagem {
  position: fixed;
  inset: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

#cena {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.topo {
  position: fixed;
  top: var(--topo-seguro);
  left: var(--margem);
  right: var(--margem);
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  pointer-events: none;
}

.topo > * {
  pointer-events: auto;
}

.topo__titulo {
  margin: 0;
  font-family: var(--fonte-titulo);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

.topo__progresso {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 14px 4px 8px;
  border: 1px solid var(--borda);
  border-radius: 999px;
  background: var(--superficie);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.topo__contagem {
  margin: 0;
  color: var(--texto-suave);
  font-size: 0.92rem;
  white-space: nowrap;
}

#contagem {
  color: var(--texto);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.topo__acoes {
  display: flex;
  gap: 8px;
}

/* Luzes de progresso no estilo shift light: verde, amarelo e vermelho. */
.luzes {
  display: flex;
}

.luz {
  --cor-luz: var(--verde);
  display: grid;
  place-items: center;
  width: 28px;
  height: 32px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

.luz:nth-child(n + 6) {
  --cor-luz: var(--amarelo);
}

.luz:nth-child(n + 9) {
  --cor-luz: var(--vermelho);
}

.luz::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: #1b1f27;
  transition:
    background 0.25s,
    box-shadow 0.25s;
}

.luz.acesa::after {
  border-color: transparent;
  background: var(--cor-luz);
  box-shadow:
    0 0 12px var(--cor-luz),
    inset 0 0 3px rgba(255, 255, 255, 0.9);
}

.luz[aria-current='true']::after {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.luz:focus-visible {
  outline: none;
}

.luz:focus-visible::after {
  outline: 2px dashed #ffffff;
  outline-offset: 3px;
}

.luzes.piscando .luz::after {
  animation: piscar 0.25s steps(2) infinite;
}

@keyframes piscar {
  50% {
    background: #1b1f27;
    box-shadow: none;
  }
}

/* Painel da moto escolhida */
.painel {
  --cor-marca: #8a93a3;
  --cor-marca-texto: #0b0d12;
  position: fixed;
  left: var(--margem);
  bottom: var(--base-segura);
  z-index: 2;
  width: min(400px, calc(100% - 2 * var(--margem)));
  padding: 16px 18px 18px;
  border: 1px solid var(--borda);
  border-top: 3px solid var(--cor-marca);
  border-radius: var(--raio);
  background: var(--superficie);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.painel__marca {
  margin: 0;
  color: var(--cor-marca);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.painel__modelo {
  margin: 2px 0 10px;
  font-family: var(--fonte-titulo);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.painel__ficha {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: start;
  gap: 2px 18px;
  margin: 0 0 10px;
}

.painel:not(.com-moto) .painel__ficha {
  display: none;
}

.painel__ficha dt {
  color: var(--texto-suave);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.painel__ficha dd {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
}

.painel__destaque {
  margin: 0 0 14px;
  color: var(--texto-claro);
  font-size: 0.95rem;
}

.painel__acoes {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  gap: 8px;
}

.botao-seta {
  height: 52px;
  border: 1px solid var(--borda);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--texto);
  font-size: 1.9rem;
  line-height: 1;
  cursor: pointer;
}

.botao-seta.chamando {
  border-color: var(--cor-marca);
  animation: chamar 1.2s ease-in-out infinite;
}

@keyframes chamar {
  50% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--cor-marca) 40%, transparent);
  }
}

.botao-partida {
  height: 52px;
  border: none;
  border-radius: 12px;
  background: var(--cor-marca);
  color: var(--cor-marca-texto);
  font-family: var(--fonte-titulo);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

.botao-partida:disabled {
  opacity: 0.55;
  cursor: default;
}

/* Aviso curto no alto da tela */
.aviso {
  position: fixed;
  top: calc(var(--topo-seguro) + 64px);
  left: 50%;
  z-index: 3;
  max-width: calc(100% - 2 * var(--margem));
  margin: 0;
  padding: 10px 16px;
  border: 1px solid var(--borda);
  border-radius: 12px;
  background: var(--superficie-solida);
  font-weight: 500;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition:
    opacity 0.25s,
    transform 0.25s;
}

.aviso.visivel {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Abertura */
.abertura {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: var(--margem);
  background: radial-gradient(ellipse at center, rgba(11, 13, 18, 0.5), rgba(11, 13, 18, 0.93) 70%);
  transition: opacity 0.45s;
}

.abertura.saindo {
  opacity: 0;
  pointer-events: none;
}

.abertura__caixa {
  max-width: 540px;
  text-align: center;
}

.abertura__sobretitulo {
  margin: 0 0 10px;
  color: var(--destaque);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.abertura__titulo {
  margin: 0 0 16px;
  font-family: var(--fonte-titulo);
  font-size: clamp(2.5rem, 9vw, 4.2rem);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.abertura__texto {
  max-width: 42ch;
  margin: 0 auto 24px;
  color: var(--texto-claro);
  font-size: 1.1rem;
}

.abertura__dica {
  margin: 16px 0 0;
  color: var(--texto-suave);
  font-size: 0.92rem;
}

.abertura__alerta {
  max-width: 46ch;
  margin: 14px auto 0;
  padding: 10px 14px;
  border: 1px solid rgba(255, 197, 49, 0.35);
  border-radius: 10px;
  background: rgba(255, 197, 49, 0.12);
  color: #ffe3a1;
  font-size: 0.92rem;
}

/* Janela do presente */
.janela {
  width: min(440px, calc(100% - 2 * var(--margem)));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--borda);
  border-radius: 20px;
  background: var(--superficie-solida);
  color: var(--texto);
  text-align: center;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

.janela::backdrop {
  background: rgba(5, 6, 9, 0.72);
  backdrop-filter: blur(4px);
}

.janela__sobretitulo {
  margin: 0;
  color: var(--destaque);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.janela__titulo {
  margin: 4px 0 16px;
  font-family: var(--fonte-titulo);
  font-size: 2rem;
  line-height: 1.05;
  text-transform: uppercase;
}

.qr {
  width: min(280px, 70vw);
  margin: 0 auto 14px;
  overflow: hidden;
  border-radius: 12px;
  background: #ffffff;
}

.qr svg {
  display: block;
  width: 100%;
  height: auto;
}

.janela__texto {
  margin: 0 0 10px;
  color: var(--texto-claro);
}

.janela__link {
  display: inline-block;
  margin-bottom: 8px;
  color: #8fd3ff;
}

.janela__mensagem {
  margin: 12px 0 18px;
  padding-top: 14px;
  border-top: 1px solid var(--borda);
  color: var(--texto-claro);
  font-style: italic;
}

.janela form {
  margin: 0;
}

/* Sem WebGL: o painel fica no centro e a cena some. */
.sem-3d {
  background: radial-gradient(circle at 50% 25%, #1a2130, var(--fundo) 70%);
}

.sem-3d #cena {
  display: none;
}

.sem-3d .painel {
  top: 50%;
  bottom: auto;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Celular */
@media (max-width: 640px) {
  .topo__titulo,
  .topo__rotulo {
    display: none;
  }

  .topo__progresso {
    flex: 1 1 100%;
    justify-content: space-between;
    padding: 2px 12px 2px 4px;
  }

  .topo__acoes {
    flex: 1 1 100%;
    justify-content: flex-end;
  }

  .luz {
    width: 27px;
  }

  .painel {
    right: var(--margem);
    width: auto;
    padding: 12px 14px 14px;
  }

  .painel__modelo {
    margin-bottom: 8px;
    font-size: 1.8rem;
  }

  .painel__destaque {
    margin-bottom: 12px;
    font-size: 0.88rem;
  }

  .aviso {
    top: calc(var(--topo-seguro) + 96px);
  }

  .sem-3d .painel {
    left: var(--margem);
    transform: translateY(-50%);
  }
}

/* ------------------------------------------------------------------ */
/* Página do presente (aberta pelo QR) */

.pagina-presente {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--margem);
  background: radial-gradient(circle at 50% 0%, #1a2433, var(--fundo) 65%);
}

.presente {
  width: min(460px, 100%);
  padding: 24px 0 32px;
  text-align: center;
}

.presente__sobretitulo {
  margin: 0;
  color: var(--destaque);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.presente__titulo {
  margin: 6px 0 24px;
  font-family: var(--fonte-titulo);
  font-size: clamp(2.3rem, 10vw, 3.3rem);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.presente__rotulo {
  margin: 0 0 6px;
  color: var(--texto-suave);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.presente__codigo {
  margin: 0 0 18px;
  padding: 16px 12px;
  border-radius: 14px;
  background: #ffffff;
  color: #0b0d12;
  font-family: ui-monospace, 'SFMono-Regular', Consolas, 'Liberation Mono', monospace;
  font-size: clamp(1.1rem, 5.4vw, 1.6rem);
  font-weight: 700;
  letter-spacing: 0.06em;
  overflow-wrap: anywhere;
  user-select: all;
  -webkit-user-select: all;
}

.presente__acoes {
  display: grid;
  gap: 10px;
}

.presente__status {
  min-height: 1.45em;
  margin: 12px 0 4px;
  color: #b9f28c;
  font-size: 0.95rem;
}

.presente__passos {
  max-width: 36ch;
  margin: 8px auto 22px;
  padding-left: 1.3em;
  color: var(--texto-claro);
  text-align: left;
}

.presente__passos li {
  margin: 4px 0;
}

.presente__mensagem {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--borda);
  color: var(--texto-claro);
  font-style: italic;
}

.presente__texto {
  color: var(--texto-claro);
}

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