/* Pantalla de juego — "El punto del ahumado": el escenario es el AHUMADOR
   del arte del GD (horno-etapa.webp, sin banda de título). Fases por clases:
   - phase-inicio  → título + bajada + hint de la perilla (sin registro)
   - phase-playing → indicador °C subiendo + instrucción + DETENER
   Overlays animables: .glass-fx (victoria), .oven-product, .smoke-canvas
   (derrota), .knob-shockwave (inicio), .knob-button (control único). */

.screen__inner--game {
  gap: clamp(8px, 1.5dvh, 18px);
}

/* Bloques de texto sobre el fondo arena (fuera del horno) */
.intro-block,
.play-block {
  width: 100%;
  max-width: 480px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.intro-block[hidden],
.play-block[hidden] {
  display: none;
}

.inicio-title {
  font-family: var(--font-display);
  font-size: clamp(var(--fs-3xl), min(6vw, 6dvh), var(--fs-4xl));
  letter-spacing: var(--letter-spacing-display);
  text-transform: uppercase;
  line-height: 0.95;
  color: var(--c-fg);
  margin: 0;
}

.inicio-sub {
  font-size: var(--fs-md);
  color: var(--c-fg-muted);
  margin: 0;
}

.game-title-overlay {
  font-family: var(--font-display);
  font-size: clamp(var(--fs-2xl), min(5vw, 5dvh), var(--fs-3xl));
  letter-spacing: var(--letter-spacing-display);
  text-transform: uppercase;
  color: var(--c-accent-ink);
  margin: 0;
}

.instruction {
  font-size: var(--fs-md);
  color: var(--c-fg-muted);
  margin: 0;
}

.game-stage {
  position: relative;
  width: min(100%, calc((100vh - 270px) * 0.9084));
  width: min(100%, calc((100dvh - 270px) * 0.9084));
  aspect-ratio: 2250 / 2477;
  container-type: inline-size;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(26, 18, 10, 0.35);
}

.game-stage,
.game-stage * {
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.stage-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  user-select: none;
}

/* Indicador de temperatura vivo sobre el display del arte (coords medidas
   sobre la imagen recortada: el LED horneado va de 8.84% a 18.86%) */
/* El atributo hidden manda sobre el display: grid de la clase. */
.temp-live[hidden] {
  display: none !important;
}

.temp-live {
  position: absolute;
  left: 7.2%;
  top: 8.6%;
  width: 37%;
  height: 10.6%;
  background: #141414;
  border-radius: 1cqi;
  display: grid;
  place-items: center;
  box-shadow:
    inset 0 0 1.2cqi rgba(0, 0, 0, 0.9),
    0 0 0 0.3cqi rgba(230, 230, 232, 0.85);
  z-index: 2;
}

.temp-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 4.6vmin;
  font-size: min(5.5vmin, 4.2cqi);
  line-height: 1;
  color: #e8502e;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 1.4cqi rgba(232, 80, 46, 0.8);
}

.temp-unit {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 2.4vmin;
  font-size: min(2.8vmin, 2.2cqi);
  color: #e8502e;
  margin-left: 0.6cqi;
  opacity: 0.85;
  text-shadow: 0 0 1cqi rgba(232, 80, 46, 0.6);
}

.temp-live.is-flash {
  animation: led-flash 220ms var(--ease-out) both;
}

@keyframes led-flash {
  0% { box-shadow: inset 0 0 1.2cqi rgba(0, 0, 0, 0.9), 0 0 0 0.3cqi rgba(230, 230, 232, 0.85); }
  35% {
    box-shadow:
      inset 0 0 2cqi rgba(232, 80, 46, 0.9),
      0 0 0 0.3cqi rgba(255, 200, 160, 1),
      0 0 4cqi rgba(255, 155, 66, 0.9);
  }
  100% { box-shadow: inset 0 0 1.2cqi rgba(0, 0, 0, 0.9), 0 0 0 0.3cqi rgba(230, 230, 232, 0.85); }
}

/* Fases: qué se ve en inicio vs en el reto */
.game-stage.phase-inicio .attempts {
  display: none;
}

.game-stage.phase-playing .knob-hint {
  display: none;
}

/* Hint junto a la perilla (fase inicio) */
.knob-hint {
  position: absolute;
  left: 58.72%;
  top: 20.5%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 42cqi;
  text-align: center;
  font-size: max(1.9cqi, 11px);
  font-weight: 600;
  color: #f6efdd;
  background: rgba(26, 18, 10, 0.72);
  border-radius: 999px;
  padding: 0.7cqi 2.2cqi;
  z-index: 7;
}


/* Producto al ganar (sobre el vidrio, donde está la carne del arte) */
.oven-product {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.7);
  font-size: 11vmin;
  font-size: min(12vmin, 11cqi);
  line-height: 1;
  opacity: 0;
  filter: drop-shadow(0 1cqi 2cqi rgba(0, 0, 0, 0.6));
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  z-index: 4;
}

.game-stage.is-open .oven-product {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* Flash cálido de victoria sobre el vidrio */
.glass-fx {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 20%;
  bottom: 14%;
  background: radial-gradient(
    60% 50% at 50% 50%,
    rgba(255, 214, 150, 0.95),
    rgba(255, 170, 80, 0.3) 70%,
    transparent
  );
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out);
  z-index: 3;
}

.game-stage.is-open .glass-fx {
  opacity: 1;
}

.smoke-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
}

/* Chip de intento (fase reto) */
.attempts {
  position: absolute;
  top: 1.6%;
  right: 3%;
  font-family: var(--font-display);
  font-size: max(2.4cqi, 11px);
  letter-spacing: var(--letter-spacing-display);
  text-transform: uppercase;
  color: var(--c-fg);
  background: rgba(26, 18, 10, 0.1);
  border-radius: 999px;
  padding: 0.8cqi 2.6cqi;
  min-height: 0;
  z-index: 7;
}

.game-msg {
  position: absolute;
  top: 1.6%;
  left: 4%;
  max-width: 52%;
  font-size: max(2.2cqi, 11px);
  color: var(--c-danger);
  background: rgba(255, 255, 255, 0.6);
  border-radius: 0.8cqi;
  padding: 0.6cqi 1.6cqi;
  text-align: left;
  z-index: 7;
}

/* Perilla-bótón: rostro superpuesto 1:1 sobre la perilla del arte;
   press = giro -120° (inicio) / +35° (detener). Centro medido en la
   imagen recortada: (58.72%, 13.60%). */
.knob-button {
  position: absolute;
  left: 58.72%;
  top: 13.60%;
  width: 13vmin;
  height: 13vmin;
  width: 13cqi;
  height: 13cqi;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 7;
  transition: box-shadow var(--dur-fast) var(--ease-out);
}

.knob-button img {
  width: 37.7%;
  height: 37.7%;
  border-radius: 50%;
  display: block;
  transition: transform 450ms var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}

.knob-button img.is-turned {
  animation: knob-turn 600ms cubic-bezier(0.34, 1.4, 0.5, 1) both;
}

@keyframes knob-turn {
  0% { transform: rotate(0deg); }
  55% { transform: rotate(-120deg); }
  78% { transform: rotate(-108deg); }
  100% { transform: rotate(-116deg); }
}

.knob-button img.is-snapped {
  animation: knob-snap 300ms var(--ease-out) both;
}

@keyframes knob-snap {
  0% { transform: rotate(0deg); }
  60% { transform: rotate(38deg); }
  100% { transform: rotate(32deg); }
}

.knob-button:hover:not(:disabled) img,
.knob-button:focus-visible:not(:disabled) img {
  box-shadow: 0 0 0 0.45cqi rgba(255, 155, 66, 0.6), 0 0 2.2cqi rgba(255, 155, 66, 0.4);
}

.knob-button:focus-visible {
  outline: none;
}

.knob-button:disabled {
  cursor: default;
}

/* Ronda activa: la perilla DETIENE — brillo pulsante */
.knob-button.is-live img {
  box-shadow: 0 0 0 0.45cqi rgba(255, 155, 66, 0.75), 0 0 3cqi rgba(255, 155, 66, 0.55);
  animation: knob-pulse 1.6s ease-in-out infinite;
}

@keyframes knob-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0.45cqi rgba(255, 155, 66, 0.75), 0 0 3cqi rgba(255, 155, 66, 0.55);
  }
  50% {
    box-shadow: 0 0 0 0.45cqi rgba(255, 155, 66, 0.45), 0 0 4.5cqi rgba(255, 155, 66, 0.85);
  }
}

/* Onda expansiva desde la perilla al iniciar */
.knob-shockwave {
  position: absolute;
  left: 58.72%;
  top: 13.60%;
  width: 11vmin;
  height: 11vmin;
  width: 11cqi;
  height: 11cqi;
  transform: translate(-50%, -50%) scale(0.6);
  border-radius: 50%;
  border: 0.5cqi solid rgba(255, 155, 66, 0.9);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
}

.knob-shockwave.is-fired {
  animation: shockwave 650ms var(--ease-out) both;
}

@keyframes shockwave {
  0% { transform: translate(-50%, -50%) scale(0.6); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(2.6); opacity: 0; }
}

.game-stage.shake {
  animation: stage-shake 340ms var(--ease-in-out) both;
}

@keyframes stage-shake {
  0% { transform: scale(1) translate(0, 0); }
  20% { transform: scale(1.012) translate(-2.5px, 1.5px); }
  40% { transform: scale(1.01) translate(2px, -1.5px); }
  60% { transform: scale(1.008) translate(-1.5px, -1px); }
  80% { transform: scale(1.004) translate(1px, 1px); }
  100% { transform: scale(1) translate(0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .glass-fx { transition: none; }
  .knob-button img.is-turned,
  .knob-button img.is-snapped,
  .knob-button.is-live img,
  .knob-shockwave.is-fired,
  .temp-live.is-flash,
  .game-stage.shake { animation: none; }
}

/* Landscape compacto (móvil/tablet acostadas): el escenario reserva menos
   chrome y los textos se compactan para que el horno siga siendo grande. */
@media (orientation: landscape) and (max-height: 540px) {
  .intro-block,
  .play-block {
    gap: 4px;
  }
  .inicio-title {
    font-size: clamp(var(--fs-lg), min(3.5vw, 8dvh), var(--fs-xl));
  }
  .inicio-sub,
  .instruction {
    font-size: var(--fs-xs);
  }
  .game-title-overlay {
    font-size: var(--fs-lg);
  }
  .game-stage {
    width: min(100%, calc((100vh - 190px) * 0.9084));
    width: min(100%, calc((100dvh - 190px) * 0.9084));
  }
  .knob-hint {
    font-size: max(1.6cqi, 10px);
  }
  .attempts {
    font-size: max(2cqi, 10px);
  }
}
