/* =========================================================
   Buehne und Spielrahmen
   ========================================================= */

.stage {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100dvh;
  display: grid;
  place-items: center;
  padding:
    max(10px, env(safe-area-inset-top))
    max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom))
    max(10px, env(safe-area-inset-left));
}

.game-shell {
  position: relative;
  /* Das Feld ist 8:5. Es darf weder breiter als der Schirm noch hoeher als
     der sichtbare Bereich werden - sonst laeuft es auf dem quer gehaltenen
     iPhone unten heraus. --frame ist der Platz fuer Rand und Rahmen. */
  --frame: 26px;
  width: min(96vw, 1180px, calc((100vh - var(--frame)) * 1.6));
  width: min(96vw, 1180px, calc((100dvh - var(--frame)) * 1.6));
  aspect-ratio: 8 / 5;
  /* Alle Menuegroessen rechnen in Prozent dieses Rahmens (cqh/cqw). */
  container-type: size;
  container-name: shell;
  border-radius: var(--r-xl);
  overflow: hidden;
  background: #7fc6ee;
  box-shadow: var(--shadow-3);
  isolation: isolate;
}

/* Ein feiner heller Rand innen ersetzt den frueheren schwarzen Balken:
   Das Bild wirkt dadurch erhaben statt aufgeklebt. */
.game-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 30;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.5),
    inset 0 0 0 4px rgba(27, 42, 20, 0.16);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #7fc6ee;
}

.is-hidden {
  display: none !important;
}

/* ---------- Hinweis quer halten ---------- */

.rotate-hint {
  display: none;
}

@media (orientation: portrait) and (max-width: 620px) {
  .rotate-hint {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: grid;
    place-items: center;
    padding: 32px;
    text-align: center;
    background: var(--panel-solid);
  }

  .rotate-hint .rotate-art {
    font-size: 64px;
    animation: tilt 2.4s var(--ease-out) infinite;
  }

  .rotate-hint p {
    max-width: 22ch;
    margin: 18px auto 0;
    font-family: var(--font-display);
    font-size: 21px;
    line-height: 1.45;
  }

  .stage {
    filter: blur(2px);
  }
}

@keyframes tilt {
  0%,
  100% {
    transform: rotate(0deg);
  }
  40% {
    transform: rotate(-90deg);
  }
  70% {
    transform: rotate(-90deg);
  }
}
