/* Void Arcade: the one "turn your phone" prompt.
 *
 * Used by every game page (mobile-controls.js mounts #va-portrait-overlay)
 * and by the shell (ship.html's #portraitLockOverlay). Markup comes from
 * shared-rotate-prompt.js (VaRotatePrompt.render). Visibility is owned by
 * the caller: this sheet never sets `display` on .va-rotate, so a page's own
 * trigger (an inline style or a media query) keeps working unchanged.
 *
 * Type follows the end screen: Chakra Petch 700 for the title, Outfit for
 * everything read. Panel follows the shell. No backdrop-filter: blur on a
 * full-viewport layer is a known phone compositor cost.
 */

.va-rotate {
  position: fixed;
  inset: 0;
  z-index: 999999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding:
    max(16px, env(safe-area-inset-top, 0px))
    max(16px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px));
  background-color: #05080f;
  background-image:
    radial-gradient(70% 55% at 50% 38%, rgba(86, 150, 255, 0.10), transparent 70%),
    radial-gradient(60% 50% at 70% 85%, rgba(140, 100, 255, 0.07), transparent 70%);
  color: #e8eef8;
  font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', sans-serif;
  text-align: center;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.4;
  touch-action: none;
  overscroll-behavior: contain;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: auto;
}

.va-rotate *,
.va-rotate *::before,
.va-rotate *::after {
  box-sizing: border-box;
}

.va-rotate-card {
  position: relative;
  width: min(340px, 100%);
  display: grid;
  justify-items: center;
  padding: 26px 24px 22px;
  border-radius: 14px;
  border: 1px solid rgba(148, 184, 255, 0.34);
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(86, 198, 255, 0.13), transparent 58%),
    radial-gradient(120% 80% at 100% 100%, rgba(150, 110, 255, 0.13), transparent 58%),
    rgba(16, 24, 45, 0.76);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(10, 16, 32, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.va-rotate-glyph {
  width: 104px;
  height: 104px;
  margin: 0 0 16px;
  display: block;
  overflow: visible;
}

.va-rotate-copy {
  display: grid;
  justify-items: center;
  min-width: 0;
}

.va-rotate-kicker {
  margin: 0 0 8px;
  font: 700 11px/1.2 'Outfit', system-ui, sans-serif;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8fa6c8;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.va-rotate-title {
  margin: 0 0 8px;
  font-family: var(--va-disp, 'Chakra Petch', 'Outfit', system-ui, sans-serif);
  font-weight: 700;
  font-size: 23px;
  line-height: 1.15;
  letter-spacing: 0.01em;
  color: #e8eef8;
}

.va-rotate-body {
  margin: 0;
  max-width: 30ch;
  font: 500 14px/1.45 'Outfit', system-ui, sans-serif;
  color: #93a5c2;
  text-wrap: balance;
}

.va-rotate-note {
  margin: 16px 0 0;
  padding: 12px 0 0;
  width: 100%;
  border-top: 1px solid rgba(148, 184, 255, 0.16);
  font: 500 12px/1.4 'Outfit', system-ui, sans-serif;
  color: rgba(147, 165, 194, 0.78);
  text-wrap: balance;
}

/* ── Glyph ─────────────────────────────────────────────────────────────
 * The phone starts in the orientation the player is holding and turns to
 * the one the page needs; the arc draws on with it and the screen lights
 * once it lands. data-to="landscape" turns anticlockwise, "portrait"
 * turns back clockwise (the arc is mirrored).
 */
.va-rotate-track {
  fill: none;
  stroke: rgba(148, 184, 255, 0.14);
  stroke-width: 1.5;
  stroke-dasharray: 2 5;
  stroke-linecap: round;
}

.va-rotate-arc,
.va-rotate-arrow {
  fill: none;
  stroke: url(#va-rotate-accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.va-rotate-arc {
  stroke-dasharray: 100;
  stroke-dashoffset: 0;
}

.va-rotate-dir,
.va-rotate-phone {
  transform-box: view-box;
  transform-origin: 50px 50px;
}

.va-rotate[data-to="portrait"] .va-rotate-dir {
  transform: scaleX(-1);
}

.va-rotate-body-shape {
  fill: rgba(10, 16, 28, 0.92);
  stroke: #e8eef8;
  stroke-width: 2.4;
}

.va-rotate-screen {
  fill: url(#va-rotate-screen);
  stroke: rgba(148, 184, 255, 0.28);
  stroke-width: 1;
}

.va-rotate-lit {
  fill: url(#va-rotate-accent);
  opacity: 0.22;
}

.va-rotate-speaker {
  stroke: rgba(232, 238, 248, 0.7);
  stroke-width: 2;
  stroke-linecap: round;
}

/* Static state (and the reduced-motion state): the phone as the player
 * holds it, with the full arrow showing which way to turn. */
.va-rotate[data-to="portrait"] .va-rotate-phone {
  transform: rotate(-90deg);
}

@media (prefers-reduced-motion: no-preference) {
  .va-rotate-phone {
    animation: va-rotate-to-landscape 3.4s cubic-bezier(0.65, 0, 0.35, 1) infinite;
  }
  .va-rotate[data-to="portrait"] .va-rotate-phone {
    animation-name: va-rotate-to-portrait;
  }
  .va-rotate-arc {
    animation: va-rotate-arc 3.4s cubic-bezier(0.65, 0, 0.35, 1) infinite;
  }
  .va-rotate-arrow {
    animation: va-rotate-arrow 3.4s linear infinite;
  }
  .va-rotate-lit {
    animation: va-rotate-lit 3.4s linear infinite;
  }
}

@keyframes va-rotate-to-landscape {
  0%, 16% { transform: rotate(0deg); opacity: 1; }
  46%, 84% { transform: rotate(-90deg); opacity: 1; }
  93% { transform: rotate(-90deg); opacity: 0; }
  94% { transform: rotate(0deg); opacity: 0; }
  100% { transform: rotate(0deg); opacity: 1; }
}

@keyframes va-rotate-to-portrait {
  0%, 16% { transform: rotate(-90deg); opacity: 1; }
  46%, 84% { transform: rotate(0deg); opacity: 1; }
  93% { transform: rotate(0deg); opacity: 0; }
  94% { transform: rotate(-90deg); opacity: 0; }
  100% { transform: rotate(-90deg); opacity: 1; }
}

@keyframes va-rotate-arc {
  0%, 16% { stroke-dashoffset: 100; opacity: 1; }
  46%, 82% { stroke-dashoffset: 0; opacity: 1; }
  92%, 100% { stroke-dashoffset: 0; opacity: 0; }
}

@keyframes va-rotate-arrow {
  0%, 42% { opacity: 0; }
  47%, 82% { opacity: 1; }
  92%, 100% { opacity: 0; }
}

@keyframes va-rotate-lit {
  0%, 44% { opacity: 0.22; }
  54%, 84% { opacity: 0.78; }
  93%, 100% { opacity: 0.22; }
}

/* Short landscape screens: glyph beside the copy so nothing crowds. */
@media (orientation: landscape) and (max-height: 480px) {
  .va-rotate-card {
    width: auto;
    max-width: min(520px, 100%);
    grid-template-columns: auto minmax(0, 1fr);
    justify-items: stretch;
    align-items: center;
    column-gap: 22px;
    padding: 20px 24px;
    text-align: left;
  }
  .va-rotate-glyph {
    width: 92px;
    height: 92px;
    margin: 0;
  }
  .va-rotate-copy {
    justify-items: start;
  }
  .va-rotate-note {
    margin-top: 12px;
    padding-top: 10px;
  }
}

@media (max-width: 340px) {
  .va-rotate-card {
    padding: 22px 18px 18px;
  }
  .va-rotate-title {
    font-size: 21px;
  }
}
