@font-face {
  font-family: 'Geist';
  src: url('../assets/fonts/Geist-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Mono';
  src: url('../assets/fonts/GeistMono-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --naranja: #FF8A00;
  --tinta: #09090B;
  --blanco: #F4F4F5;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--tinta);
  color: var(--blanco);
  font-family: 'Geist', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

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

.volver {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  color: rgba(244, 244, 245, 0.7);
  font-size: 14px;
  text-decoration: none;
  letter-spacing: 0.02em;
  z-index: 5;
}
.volver:hover { color: var(--naranja); }

/* ---------- HUD ---------- */
.hud {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(18px, env(safe-area-inset-right));
  display: flex;
  gap: 22px;
  align-items: center;
  z-index: 4;
  pointer-events: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}
.hud[hidden] { display: none; }
.hud__dato { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.hud__dato span { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; opacity: 0.6; }
.hud__dato b { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hud__escudo { display: flex; gap: 5px; }
.hud__escudo i {
  width: 22px; height: 10px; border-radius: 3px;
  background: var(--naranja);
  box-shadow: 0 0 12px rgba(255, 138, 0, 0.7);
  transition: background 0.2s, box-shadow 0.2s;
}
.hud__escudo i.off { background: rgba(255, 255, 255, 0.14); box-shadow: none; }

/* ---------- Burbuja del robot ---------- */
.burbuja {
  position: fixed;
  left: 0; top: 0;
  margin: 0;
  max-width: 260px;
  padding: 10px 14px;
  border-radius: 14px 14px 14px 4px;
  background: rgba(9, 9, 11, 0.82);
  border: 1px solid rgba(255, 138, 0, 0.55);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4), 0 0 18px rgba(255, 138, 0, 0.18);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -100%) scale(0.9);
  transition: opacity 0.18s, transform 0.18s;
  z-index: 4;
  white-space: nowrap;
}
.burbuja.visible { opacity: 1; transform: translate(-50%, -100%) scale(1); }

.cuenta {
  position: fixed;
  inset: 0;
  margin: 0;
  display: grid;
  place-items: center;
  font-size: clamp(80px, 18vw, 180px);
  font-weight: 700;
  color: var(--naranja);
  text-shadow: 0 0 40px rgba(255, 138, 0, 0.6);
  pointer-events: none;
  z-index: 4;
}

.flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(255, 40, 20, 0) 30%, rgba(255, 40, 20, 0.55) 100%);
  opacity: 0;
  z-index: 3;
}

/* ---------- Paneles ---------- */
.panel {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100% - 32px));
  padding: 34px 32px 28px;
  border-radius: 22px;
  background: rgba(9, 9, 11, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  text-align: center;
  z-index: 6;
}
.panel[hidden] { display: none; }
.panel__kicker { margin: 0 0 6px; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--naranja); }
.panel__titulo { margin: 0; font-size: clamp(44px, 9vw, 64px); font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.panel__texto { margin: 12px 0 0; font-size: 17px; opacity: 0.85; }
.panel__puntos { margin: 4px 0 0; font-size: clamp(56px, 12vw, 84px); font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.panel__botones { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }
.panel__nota { margin: 18px 0 0; font-size: 13px; opacity: 0.55; }
.panel__record { margin: 10px 0 0; font-size: 14px; opacity: 0.75; min-height: 1em; }

.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.06);
  color: var(--blanco);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 12px 24px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s, background 0.15s, border-color 0.15s;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(255, 255, 255, 0.4); }
.btn:focus-visible { outline: 2px solid var(--naranja); outline-offset: 3px; }
.btn--naranja { background: var(--naranja); border-color: var(--naranja); color: var(--tinta); }
.btn--naranja:hover { background: #ff9c2e; border-color: #ff9c2e; }

/* ---------- Carga ---------- */
.carga {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  background: var(--tinta);
  font-size: 14px;
  letter-spacing: 0.06em;
  opacity: 0.9;
  z-index: 8;
  transition: opacity 0.4s;
}
.carga span {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255, 138, 0, 0.25);
  border-top-color: var(--naranja);
  animation: girar 0.9s linear infinite;
}
.carga.lista { opacity: 0; pointer-events: none; }
@keyframes girar { to { transform: rotate(360deg); } }

@media (max-width: 600px) {
  .hud { gap: 14px; }
  .hud__dato b { font-size: 18px; }
  .burbuja { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .carga span { animation-duration: 3s; }
}
