.ahumado-body {
  min-height: 100svh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at top, rgba(255, 155, 66, 0.06) 0%, transparent 55%),
    var(--c-bg);
  overflow: hidden;
}

.ahumado-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-4) var(--gutter);
  padding-top: max(var(--s-4), env(safe-area-inset-top));
  flex-shrink: 0;
  z-index: 5;
}

.ahumado-top__logo {
  display: inline-flex;
  align-items: center;
  height: 44px;
  flex-shrink: 0;
}

/* Menú hamburguesa: SOLO portrait (móvil/tablet/totem vertical).
   En landscape el header clásico (logo izq + botones der) se conserva. */
.menu-toggle,
.menu-backdrop,
.game-menu {
  display: none;
}

.menu-toggle {
  position: absolute;
  right: var(--gutter);
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: var(--r-md);
}

.menu-toggle__bar {
  display: block;
  width: 22px;
  height: 2.5px;
  border-radius: 2px;
  background: var(--c-fg);
  transition: transform var(--dur-fast) var(--ease-out), opacity var(--dur-fast) var(--ease-out);
}

.menu-toggle.is-open .menu-toggle__bar:nth-child(1) {
  transform: translateY(7.5px) rotate(45deg);
}

.menu-toggle.is-open .menu-toggle__bar:nth-child(2) {
  opacity: 0;
}

.menu-toggle.is-open .menu-toggle__bar:nth-child(3) {
  transform: translateY(-7.5px) rotate(-45deg);
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(26, 18, 10, 0.45);
}

.game-menu {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 104px);
  right: var(--gutter);
  z-index: 90;
  width: min(100% - 2 * var(--gutter), 360px);
  background: var(--c-bg-soft);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  box-shadow: 0 18px 48px rgba(26, 18, 10, 0.35);
  padding: var(--s-2);
  display: flex;
  flex-direction: column;
  gap: 2px;
  animation: menu-drop 240ms var(--ease-out) both;
}

.game-menu[hidden],
.menu-backdrop[hidden] {
  display: none;
}

@keyframes menu-drop {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

.game-menu__row {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4);
  background: transparent;
  border: none;
  border-radius: var(--r-md);
  color: var(--c-fg);
  font-size: var(--fs-md);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out);
}

.game-menu__row:hover {
  background: rgba(26, 18, 10, 0.06);
}

.game-menu__icon {
  font-size: var(--fs-xl);
  width: 28px;
  text-align: center;
}

.ahumado-top__logo img {
  height: 100%;
  width: auto;
}

.ahumado-top__actions {
  display: flex;
  gap: var(--s-2);
}

.audio-button,
.operator-button {
  width: 48px;
  height: 48px;
  border-radius: var(--r-pill);
  background: rgba(26, 18, 10, 0.06);
  color: var(--c-fg);
  border: 1px solid var(--c-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-lg);
  transition: background var(--dur-fast) var(--ease-out);
}

.audio-button:hover,
.operator-button:hover {
  background: rgba(26, 18, 10, 0.12);
}

.ahumado-main {
  flex: 1;
  display: flex;
  align-items: stretch;
  justify-content: center;
  position: relative;
  min-height: 0;
}

.screen {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-4) var(--gutter) clamp(12px, 2.5vh, 48px);
  padding-bottom: clamp(12px, 2.5dvh, 48px);
  animation: screen-in var(--dur-base) var(--ease-out);
}

.screen--lead {
  overflow-y: auto;
  align-items: flex-start;
}

.screen--lead .screen__inner {
  margin: auto;
}

/* Red de seguridad para el resultado: si el contenido no cupiera en algún
   viewport exótico, aparece scroll en vez de cortar los botones. */
.screen--result {
  overflow-y: auto;
  align-items: flex-start;
}

.screen--result .screen__inner--result {
  margin: auto;
}

.screen__inner {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.6vh, 24px);
  gap: clamp(8px, 1.6dvh, 24px);
}

.screen__inner--game,
.screen__inner--result {
  max-width: none;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* Red de seguridad: si el contenido no cupiera en algún viewport exótico,
   aparece scroll en vez de cortar el horno. */
.screen--game {
  overflow-y: auto;
  overscroll-behavior: contain;
  align-items: flex-start;
}

.screen--game .screen__inner--game {
  margin: auto;
}

.screen__title {
  font-family: var(--font-display);
  font-size: clamp(var(--fs-3xl), min(7vw, 7dvh), var(--fs-4xl));
  letter-spacing: var(--letter-spacing-display);
  text-transform: uppercase;
  line-height: 0.95;
  color: var(--c-fg);
  text-shadow: var(--text-shadow-hero);
}

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

.screen__subtitle strong {
  color: var(--c-accent-ink);
  font-weight: 600;
}

.screen__inner--lead .lead-form__alt {
  align-self: center;
  font-size: var(--fs-sm);
  color: var(--c-fg-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.screen__inner--lead .lead-form__alt:hover {
  color: var(--c-fg);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
}

@media (orientation: portrait) {
  .ahumado-top {
    justify-content: center;
    position: relative;
    /* El logo baja un poco: +12px de aire bajo el notch/safe-area */
    padding-top: max(28px, env(safe-area-inset-top, 0px));
  }
  /* Logo protagonista en portrait: ~84px en iPhone XR, piso 64px en
     pantallas chicas y techo 96px en el totem — sin activar el scroll */
  .ahumado-top__logo { height: clamp(64px, 10dvh, 96px); }
  .ahumado-main { min-height: 0; }
  .screen { padding-bottom: var(--s-4); }
  .ahumado-top__actions { display: none; }
  .menu-toggle { display: flex; }
}

/* Compactación para viewports bajos (landscape incluido): el contenido de
   esta pantalla es más alto que el de /ruleta (título de 3 líneas), así que
   sin este bloque el botón COMENZAR nace cortado en 1366x768 / 1080p@125%. */
@media (max-height: 780px) {
  .screen {
    padding-top: var(--s-2);
    padding-bottom: var(--s-3);
  }
  .screen__title {
    font-size: clamp(var(--fs-2xl), min(6vw, 5dvh), var(--fs-3xl));
  }
  .screen__subtitle {
    font-size: var(--fs-sm);
  }
  .screen--lead .screen__inner {
    gap: var(--s-3);
  }
  .lead-form {
    gap: var(--s-3);
  }
  .lead-form__field input {
    height: 52px;
    font-size: var(--fs-md);
  }
  .lead-form__submit {
    height: 56px;
    font-size: var(--fs-xl);
    margin-top: var(--s-2);
  }
}

/* El menú hamburguesa es exclusivo del portrait: en landscape el header
   clásico (logo izquierda + botones derecha) queda operativo. */
@media (orientation: landscape) {
  .menu-toggle,
  .menu-backdrop,
  .game-menu {
    display: none !important;
  }
}
