/* Phone controller: portrait backdrop and PS2-era text menu. */
.phone-viewport {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
.phone-join {
  color-scheme: dark;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: pinch-zoom;
  background: #030403;
  color: #d4d4c5;
  font-family: Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  isolation: isolate;
}
.phone-join > header { display: none; }
.storm-scene {
  position: fixed;
  top: var(--viewport-top, 0px);
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 480px);
  height: var(--scene-height, 100svh);
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
  background: #030403;
}
.storm-portrait, .emblem-glow {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 45% top;
  transform: translateY(-18%) scale(1.08);
  opacity: .24;
  filter: saturate(.65) contrast(1.12);
}
.emblem-glow {
  position: absolute;
  inset: 0;
  opacity: .8;
  filter: brightness(1.8) saturate(.85);
  -webkit-mask-image: radial-gradient(ellipse 23% 19% at 49% 74%, #000 20%, #000c 50%, transparent 100%);
  mask-image: radial-gradient(ellipse 23% 19% at 49% 74%, #000 20%, #000c 50%, transparent 100%);
}
.lightning-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 10% 2%, #c6d6d7a8, transparent 68%);
  opacity: 0;
}
.storm-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,#03040300 14%,#03040326 35%,#030403b8 58%,#030403f2 83%,#030403 100%);
  box-shadow: inset 0 0 75px 15px #0007;
}
.phone-join::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url('/grain.svg') repeat, repeating-linear-gradient(0deg, transparent 0 3px, #000 3px 4px);
  opacity: .09;
}
.storm-ready .storm-portrait { animation: portrait-lightning 11s linear infinite; will-change: opacity; }
.storm-ready .lightning-glow { animation: sky-lightning 11s linear infinite; will-change: opacity; }
/* Two brief reveals, then a long dark interval. No rapid strobing. */
@keyframes portrait-lightning {
  0%, 8% { opacity: .24; }
  9% { opacity: .95; }
  11% { opacity: .38; }
  13% { opacity: .76; }
  16%, 68% { opacity: .24; }
  69% { opacity: .86; }
  73%, 100% { opacity: .24; }
}
@keyframes sky-lightning {
  0%, 8% { opacity: 0; }
  9% { opacity: .17; }
  11% { opacity: 0; }
  13% { opacity: .1; }
  16%, 68% { opacity: 0; }
  69% { opacity: .12; }
  73%, 100% { opacity: 0; }
}
.storm-paused .storm-portrait, .storm-paused .lightning-glow,
.phone-join:has(input:focus) .storm-portrait, .phone-join:has(input:focus) .lightning-glow {
  animation-play-state: paused;
}
.phone-join main {
  position: absolute;
  top: var(--viewport-top, 0px);
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  height: var(--visible-height, 100%);
  margin: 0;
  padding: 0 34px;
  overflow: hidden;
}
.phone-start {
  width: 100%;
  transform: translateY(var(--form-top, 42svh));
}
.viewport-ready .phone-start { transition: transform 220ms cubic-bezier(.2,.75,.25,1); }
.phone-form label {
  display: block;
  color: #d2d3c6;
  font-size: 16px;
  font-weight: 400;
  margin: 0;
  letter-spacing: 1px;
  text-shadow: 1px 2px 2px #000, 0 0 5px #000;
}
.phone-form input {
  display: block;
  width: 100%;
  min-width: 0;
  height: 53px;
  border: 0;
  border-bottom: 1px solid #777b685e;
  border-radius: 0;
  color: #e6e6cf;
  background: linear-gradient(90deg, transparent, #090d0799 25%, #090d0799 75%, transparent);
  padding: 10px 1px;
  font-family: 'Courier New', monospace;
  font-size: 23px;
  box-shadow: none;
  margin: 3px 0 26px;
  text-shadow: 0 0 5px #b9c59455, 1px 2px 1px #000;
  caret-color: #d1d6b8;
}
.phone-form input::placeholder { color: #abae94; opacity: 1; }
.phone-form #code {
  font-family: 'Courier New', monospace;
  font-weight: 400;
  font-size: 27px;
  text-transform: uppercase;
  letter-spacing: 8px;
  padding-left: 1px;
}
.phone-form #code::placeholder { letter-spacing: 0; font-size: 25px; }
.phone-form input:focus { outline: none; border-bottom-color: #c0c5a5; box-shadow: 0 1px 0 #c0c5a51c; }
.phone-play {
  display: block;
  position: relative;
  width: 100%;
  min-height: 64px;
  margin: 10px 0 0;
  padding: 15px 20px;
  border: 0;
  border-radius: 0;
  background: none;
  color: #e0e3c6;
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 25px;
  font-weight: 400;
  letter-spacing: 4px;
  text-transform: uppercase;
  text-shadow: 0 0 3px #eef4bc99, 0 0 12px #d1dfa04d, 1px 2px 2px #000;
  box-shadow: none;
  touch-action: manipulation;
  isolation: isolate;
}
.phone-play::before {
  content: '';
  position: absolute;
  left: 7%; right: 7%; top: 24%; bottom: 24%;
  z-index: -1;
  background: radial-gradient(ellipse,#bfcda22b 0%,#7a886116 38%,transparent 73%);
}
.phone-play::after {
  content: '';
  position: absolute;
  left: calc(50% - 67px);
  top: calc(50% - 5px);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid #d7dcc0;
  filter: drop-shadow(0 0 4px #b5c18a);
}
.phone-play[aria-busy]::after { display: none; }
.phone-play:hover, .phone-play:focus-visible { color:#fffde5; text-shadow:0 0 4px #e8f6b8,0 0 14px #d1dfa077; }
.phone-play:active:not(:disabled) { transform: translateY(1px); }
.phone-play:disabled { opacity: .55; }
.phone-play:focus-visible { outline: 1px dotted #c7c5aa; outline-offset: 1px; }
.phone-join #notice {
  position: static;
  transform: none;
  width: 100%;
  max-width: none;
  color: #e2b3a2;
  background: #110b09d9;
  border: 0;
  border-left: 2px solid #795245;
  border-radius: 0;
  box-shadow: none;
  padding: 10px 12px;
  margin-top: 16px;
  font-family: Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
}
.phone-compact .phone-form input { margin-bottom: 19px; height: 49px; }
.phone-compact .phone-play { min-height: 58px; }
.phone-tight .phone-form input { margin-bottom: 12px; height: 44px; }
.phone-tight .phone-play { min-height: 48px; padding-block: 10px; margin-top: 4px; }
.phone-tight #notice { font-size: 13px; padding: 6px 10px; margin-top: 6px; }
.phone-confirmation {
  position: absolute;
  left: 34px;
  right: 34px;
  top: 59%;
  text-align: center;
  color: #d7d8c8;
  text-shadow: 0 2px 4px #000, 0 0 15px #000;
}
.phone-confirmation-title { margin: 0 0 20px; font: 400 34px/1.15 Georgia, 'Times New Roman', serif; letter-spacing: .025em; }
.phone-confirmation-name { margin: 0 0 16px; color: #e2e3cc; font: 400 25px/1.25 Georgia, 'Times New Roman', serif; overflow-wrap: anywhere; text-shadow: 0 0 8px #d5e2aa35, 0 2px 4px #000; }
.phone-confirmation-copy { margin: 0 auto; max-width: 250px; color: #a8ad99; font: 400 16px/1.6 Arial, sans-serif; letter-spacing: .025em; }
.phone-confirmation-room { position: absolute; bottom: max(24px, env(safe-area-inset-bottom)); left: 24px; right: 24px; margin: 0; text-align: center; color: #767e6c; font: 12px/1.4 'Courier New', monospace; letter-spacing: .17em; }
.phone-confirmed #notice { text-align: left; font-size: 13px; }
@media (max-height: 670px) {
  .phone-confirmation { top: 52%; left: 28px; right: 28px; }
  .phone-confirmation-title { font-size: 30px; margin-bottom: 14px; }
  .phone-confirmation-name { font-size: 23px; margin-bottom: 12px; }
  .phone-confirmation-copy { font-size: 15px; line-height: 1.45; }
  .phone-confirmation-room { bottom: 18px; }
}
@media (max-height: 420px) {
  .phone-confirmation { top: 23%; }
  .phone-confirmation-title { margin-bottom: 9px; }
  .phone-confirmation-name { margin-bottom: 8px; }
}
@media(prefers-reduced-motion:reduce) {
  .viewport-ready .phone-start { transition: none; }
  .storm-ready .storm-portrait { animation: none; opacity:.52; will-change:auto; }
  .storm-ready .lightning-glow { animation: none; opacity:0; will-change:auto; }
}
.phone-join.phone-look .storm-scene { opacity: 1; }
.phone-look .phone-confirmation-title, .phone-look-message { font: 30px/1.35 Georgia, serif; color: #d7d8c8; text-align: center; text-shadow: 0 2px 8px #000, 0 0 20px #000; }
.phone-look-message { position: absolute; left: 28px; right: 28px; top: 59%; margin: 0; }
@media (max-height: 670px) { .phone-look-message { top: 55%; font-size: 27px; } }
