/*
 * guards.css
 * Orientation and small-screen warning layers.
 *
 * These guards must not alter game state. They only cover the UI temporarily.
 */

.guard-layer {
  position: fixed;
  inset: 0;
  z-index: var(--z-guard);
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 320px;
  min-height: 100dvh;
  padding:
    calc(var(--space-5) + var(--safe-top))
    calc(var(--screen-padding-x) + var(--safe-right))
    calc(var(--space-5) + var(--safe-bottom))
    calc(var(--screen-padding-x) + var(--safe-left));
  overflow-x: hidden;
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 218, 155, 0.12), transparent 32%),
    rgba(3, 1, 1, 0.86);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity var(--duration-base) var(--ease-standard),
    visibility var(--duration-base) var(--ease-standard);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.guard-layer.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.guard-card {
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  width: min(460px, 100%);
  max-width: 100%;
  padding: clamp(20px, 6vw, 34px);
  border: var(--border-strong);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 218, 155, 0.14), transparent 36%),
    rgba(12, 5, 5, 0.84);
  color: var(--color-text);
  text-align: center;
  box-shadow: var(--shadow-strong), var(--shadow-glow);
  overflow-x: hidden;
}

.guard-icon {
  display: grid;
  place-items: center;
  width: clamp(52px, 17vw, 74px);
  height: clamp(52px, 17vw, 74px);
  border: 1px solid rgba(255, 218, 155, 0.48);
  border-radius: 50%;
  background: rgba(255, 244, 226, 0.08);
  color: var(--color-gold);
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0 26px rgba(255, 174, 83, 0.16);
}

.orientation-guard .guard-icon {
  animation: rotateHint 1.6s var(--ease-standard) infinite alternate;
}

.guard-card h1 {
  font-size: clamp(1.55rem, 7vw, 2.35rem);
  line-height: var(--line-height-title);
}

.guard-card p {
  max-width: 28em;
  color: var(--color-text-soft);
  font-size: var(--font-size-md);
}

.guard-continue-button {
  width: min(360px, 100%);
  margin-top: var(--space-2);
}

.small-screen-guard.is-dismissed {
  display: none;
}

body.is-orientation-blocked .game-app,
body.is-orientation-blocked .modal-layer,
body.is-orientation-blocked .cursor-magic-layer {
  pointer-events: none;
}

body.is-small-screen-warning-active .game-app,
body.is-small-screen-warning-active .modal-layer,
body.is-small-screen-warning-active .cursor-magic-layer {
  pointer-events: none;
}

body.is-small-screen-warning-active .small-screen-guard {
  pointer-events: auto;
}

@keyframes rotateHint {
  0% {
    transform: rotate(-8deg) scale(0.98);
  }

  100% {
    transform: rotate(12deg) scale(1.04);
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .orientation-guard {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
}

@media (max-width: 360px) {
  .guard-layer {
    padding-left: calc(12px + var(--safe-left));
    padding-right: calc(12px + var(--safe-right));
  }

  .guard-card {
    padding: 18px 14px;
    border-radius: var(--radius-lg);
  }
}

@supports not (height: 100dvh) {
  .guard-layer {
    min-height: 100vh;
  }
}
