/* Keep the gate controls inside the visible area when a software keyboard opens. */
.gate.gate-mascot-stage-active {
  inset: auto;
  top: var(--gate-view-top, 0);
  left: var(--gate-view-left, 0);
  width: var(--gate-view-width, 100%);
  height: var(--gate-view-height, 100dvh);
  box-sizing: border-box;
  padding-block: clamp(4px, calc(var(--gate-view-height, 100dvh) / 8 - 20px), 24px);
  align-items: safe center;
  overflow: auto;
  overscroll-behavior: contain;
}
.gate-mascot-stage-active > .gate-card { position: relative; z-index: 1; }
#gate-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  direction: ltr;
}
.gate .gate-mascot {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--mascot-size);
  height: var(--mascot-size);
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  appearance: none;
  user-select: none;
  pointer-events: auto;
  touch-action: manipulation;
  cursor: pointer;
}
.gate-mascot[hidden] { display: none !important; }
.gate .gate-mascot:focus-visible {
  outline: 2px dashed var(--accent);
  outline-offset: -4px;
  border-radius: 18%;
}
.gate-mascot-turn, .gate-mascot-art {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.gate-mascot-turn { transition: transform 180ms ease-in-out; }
.gate-mascot[data-facing="left"] .gate-mascot-turn { transform: scaleX(-1); }
.gate-mascot-art > :is(img, canvas, svg) {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
@media (prefers-reduced-motion: reduce) {
  .gate-mascot-turn { transition: none; }
}
