@font-face {
  font-family: 'DSEG7';
  src: url('https://cdn.jsdelivr.net/npm/dseg@0.46.0/fonts/DSEG7-Classic/DSEG7Classic-Bold.woff2') format('woff2');
  font-display: block;
}

:root {
  --preto: #000000;
  --led: #ff3a21;
  --led-brilho: rgba(255, 58, 33, 0.55);
  --ambar: #ffae1a;
  --ambar-brilho: rgba(255, 174, 26, 0.5);
  --madeira: #c98a4b;
  --texto: #ffffff;
  --texto-suave: rgba(255, 255, 255, 0.72);
  --digital: 'DSEG7', 'Courier New', monospace;
  --ui: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --topo: env(safe-area-inset-top, 0px);
  --base: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--preto);
  color: var(--texto);
  font-family: var(--ui);
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

#ar { position: fixed; inset: 0; overflow: hidden; }
#ar video { object-fit: cover; }

#toque { position: fixed; inset: 0; z-index: 5; touch-action: none; }

[hidden] { display: none !important; }

/* ---------------- LED ---------------- */
.led, .relogio { position: relative; font-family: var(--digital); line-height: 1; }
.fantasma, .digitos { display: block; text-align: right; }
.fantasma { position: absolute; right: inherit; opacity: 0.09; }
.relogio .fantasma, .led .fantasma { top: 0; right: 0; left: 0; }

/* relógio de 24 s — o elemento principal */
.relogio {
  background: var(--preto);
  color: var(--led);
  font-size: 44px;
  padding: 12px 12px 10px 14px;
  border-radius: 3px;
  box-shadow: 0 0 0 2px #1d1d1d, 0 6px 18px rgba(0, 0, 0, 0.45);
}
.relogio .fantasma { padding: 12px 12px 10px 14px; color: var(--led); }
.relogio .digitos { text-shadow: 0 0 10px var(--led-brilho), 0 0 2px var(--led); }
.relogio.zerado .digitos { animation: pisca-zero 0.5s steps(2) 4; }
@keyframes pisca-zero { 50% { opacity: 0.15; } }

#hud .relogio {
  position: fixed;
  top: calc(var(--topo) + 14px);
  right: 14px;
  z-index: 6;
}

/* placar */
.placar {
  position: fixed;
  top: calc(var(--topo) + 14px);
  left: 14px;
  z-index: 6;
  display: flex; flex-direction: column; gap: 4px;
}
.placar .rotulo {
  font-size: 15px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--texto); text-shadow: 0 1px 4px rgba(0, 0, 0, 0.7);
}
.led.ambar {
  background: var(--preto);
  color: var(--ambar);
  font-size: 26px;
  padding: 8px 10px 7px 12px;
  border-radius: 3px;
  box-shadow: 0 0 0 2px #1d1d1d;
}
.led.ambar .fantasma { padding: 8px 10px 7px 12px; }
.led.ambar .digitos { text-shadow: 0 0 8px var(--ambar-brilho); }
.placar.pulsa .led { animation: pulsa 0.45s ease-out; }
@keyframes pulsa { 30% { transform: scale(1.15); } }

#hud.atras { opacity: 0.25; }

/* texto "+3" */
#popup {
  position: fixed; left: 0; right: 0; top: 30%;
  text-align: center; z-index: 6; pointer-events: none;
  font-weight: 800; font-size: 64px; letter-spacing: 0.01em;
  color: var(--ambar);
  text-shadow: 0 3px 0 #000, 0 0 24px var(--ambar-brilho);
  opacity: 0;
}
#popup.mostra { animation: sobe 1.1s ease-out forwards; }
@keyframes sobe {
  0% { opacity: 0; transform: translateY(20px) scale(0.7); }
  15% { opacity: 1; transform: translateY(0) scale(1.08); }
  30% { transform: scale(1); }
  100% { opacity: 0; transform: translateY(-50px); }
}

/* dica de gesto */
#dica {
  position: fixed; left: 0; right: 0;
  bottom: calc(var(--base) + 30vmin);
  text-align: center; z-index: 6; pointer-events: none;
  font-size: 20px; font-weight: 600;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8);
  transition: opacity 0.4s;
}
#dica::after {
  content: ''; display: block; margin: 10px auto 0;
  width: 2px; height: 34px; background: currentColor;
  animation: seta 1.4s ease-in-out infinite;
}
@keyframes seta { 0% { transform: translateY(20px); opacity: 0; } 50% { opacity: 1; } 100% { transform: translateY(-10px); opacity: 0; } }
#dica.some { opacity: 0; }

/* mira do marcador */
#mira {
  position: fixed; inset: 0; z-index: 4; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
}
#mira .moldura { position: relative; width: 62vmin; height: 62vmin; }
#mira .moldura i {
  position: absolute; width: 38px; height: 38px;
  border: 4px solid rgba(255, 255, 255, 0.9);
}
#mira .moldura i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
#mira .moldura i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
#mira .moldura i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
#mira .moldura i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }
#mira .moldura { animation: respira 1.8s ease-in-out infinite; }
@keyframes respira { 50% { transform: scale(0.94); } }
#mira p { font-size: 20px; font-weight: 600; text-shadow: 0 1px 6px rgba(0, 0, 0, 0.8); }
#mira.pisca p { animation: alerta 0.6s ease-out; }
@keyframes alerta { 30% { color: var(--led); transform: scale(1.1); } }

/* ---------------- Telas ---------------- */
.tela {
  position: fixed; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(var(--topo) + 24px) 28px calc(var(--base) + 24px);
  text-align: center;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 64px),
    linear-gradient(180deg, #1a0f07 0%, #3a2413 55%, #6b4323 100%);
}
.tela.vidro { background: rgba(0, 0, 0, 0.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

.relogio.grande { font-size: 118px; padding: 22px 22px 18px 26px; margin-bottom: 28px; }
.relogio.grande .fantasma { padding: 22px 22px 18px 26px; }

h1 {
  font-size: 58px; font-weight: 800; line-height: 0.95; letter-spacing: -0.01em;
  margin-bottom: 12px;
}
h2 { font-size: 36px; font-weight: 800; margin-bottom: 12px; }
.sub { font-size: 19px; font-weight: 500; line-height: 1.3; color: var(--texto-suave); max-width: 30ch; }
.sub a { color: var(--ambar); }

.passos {
  list-style: none; counter-reset: p;
  margin: 26px 0 30px; max-width: 32ch; text-align: left;
  display: flex; flex-direction: column; gap: 10px;
}
.passos li {
  counter-increment: p;
  font-size: 18px; font-weight: 500; line-height: 1.25;
  display: grid; grid-template-columns: 30px 1fr; align-items: baseline;
}
.passos li::before {
  content: counter(p);
  font-family: var(--digital); font-size: 16px; color: var(--led);
}

.btn {
  font-family: var(--ui); font-weight: 800; font-size: 26px; letter-spacing: 0.02em;
  color: #1a0f07; background: var(--ambar);
  border: 0; border-radius: 999px;
  padding: 14px 56px 13px;
  box-shadow: 0 4px 0 #9a5f00, 0 10px 24px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #9a5f00; }
.btn:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }

.link-marcador { margin-top: 18px; font-size: 17px; color: var(--texto-suave); }

.fim-titulo { font-size: 30px; font-weight: 800; margin-bottom: 18px; }
.grande-placar { font-size: 96px !important; padding: 20px 24px 16px 26px !important; margin-bottom: 18px; }
.grande-placar .fantasma { padding: 20px 24px 16px 26px !important; }
#fim .sub { margin-bottom: 28px; }

/* bola girando no carregamento */
.bola-carregando {
  width: 70px; height: 70px; border-radius: 50%; margin-bottom: 18px;
  background:
    linear-gradient(90deg, transparent 47%, #1c0e06 47% 53%, transparent 53%),
    linear-gradient(0deg, transparent 47%, #1c0e06 47% 53%, transparent 53%),
    radial-gradient(circle at 35% 30%, #f08a3c, #c9561a 60%, #8f3a10);
  animation: gira 1s linear infinite;
}
@keyframes gira { to { transform: rotate(360deg); } }
#carregando p { font-size: 20px; font-weight: 600; }

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

@media (max-height: 640px) {
  .relogio.grande { font-size: 80px; margin-bottom: 16px; }
  h1 { font-size: 44px; }
  .passos { margin: 16px 0 20px; }
}
