/* Local-only visual study. Existing site tokens and gate layout remain authoritative. */
[hidden] { display: none !important; }
body { isolation: isolate; overflow-x: clip; }
/* Only the password page replaces the engineering grid. The first matched
   storm frame is declarative HTML, including when JavaScript is unavailable. */
body.password-landing { background-color: #050912; background-image: none; }
body.password-landing::before { display: none; }
.site-header, .site-footer, main { position: relative; z-index: 3; }
.site-header, .site-footer { background: rgba(11, 16, 23, .42); }
#gate { position: relative; }
.demo-note { color: var(--muted); font-size: .8rem; margin: .9rem 0 0; letter-spacing: .02em; }
.demo-note code { color: var(--accent-strong); font-family: inherit; font-weight: 600; }
.atmosphere-controls { display: flex; justify-content: center; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; }
.atmosphere-controls button { display: inline-flex; align-items: center; gap: .5rem; padding: .55rem .75rem; min-height: 40px; background: rgba(11,16,23,.7); color: var(--muted); border: 1px solid #34485d; border-radius: 2px; font: inherit; font-size: .78rem; letter-spacing: .035em; cursor: pointer; }
.atmosphere-controls button:hover { border-color: var(--accent); color: var(--text); }
.atmosphere-controls button:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 4px; }
.atmosphere-controls button:disabled { cursor: default; opacity: .72; }
.control-icon { width: 14px; height: 14px; display: inline-block; }
.sound-dot { width: 5px; height: 5px; border-radius: 50%; background: #6f8495; box-shadow: 0 0 0 3px #6f849510; }
[aria-pressed="true"] .sound-dot { background: #a9cfe9; box-shadow: 0 0 0 3px #a9cfe915; }
/* V14 (unchanged in V16): the main feather spans 54% of the ellipse radius (V10: 37%). At 760 × 455 this adds about 98 horizontal / 57 vertical CSS pixels of transition. */
#gate-atmosphere { position: fixed; pointer-events: none; z-index: 1; right: -2vw; bottom: 43px; width: min(760px, 54vw); height: min(455px, 56vh); overflow: hidden; -webkit-mask-image: radial-gradient(ellipse 76% 74% at 73% 66%, #000 14%, rgba(0,0,0,.96) 30%, rgba(0,0,0,.52) 53%, rgba(0,0,0,.12) 72%, transparent 84%); mask-image: radial-gradient(ellipse 76% 74% at 73% 66%, #000 14%, rgba(0,0,0,.96) 30%, rgba(0,0,0,.52) 53%, rgba(0,0,0,.12) 72%, transparent 84%); }
.sea-scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.weather-canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .7; }
.aircraft { position: absolute; width: 69%; height: auto; right: 5%; top: 27%; transform-origin: 48% 58%; will-change: transform; filter: drop-shadow(0 12px 14px #02070baa); }
#storm-glow { pointer-events: none; position: fixed; inset: 0; z-index: 0; opacity: 1; overflow: hidden; background: transparent; }
#storm-glow canvas { display: block; width: 100%; height: 100%; pointer-events: none; }
.scene-flash { opacity: 0; }
.scene-caption { position: absolute; right: 13%; bottom: 11%; color: #7591a3; font: 500 10px var(--font-display); letter-spacing: .25em; opacity: .72; }
.preview-unavailable { display: flex; align-items: center; justify-content: center; min-height: 140px; color: var(--muted); font: .75rem var(--font-body); letter-spacing: .07em; background: linear-gradient(140deg,#182536,#0d141e); }
.local-demo-banner { font-size: .8rem; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.local-demo-banner button { background: transparent; color: var(--accent-strong); border: 1px solid var(--edge-strong); padding: .4rem .7rem; cursor: pointer; font: inherit; }
.local-demo-banner button:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }
@media (max-width: 700px) {
  body { position: relative; }
  main { padding: 0 1.35rem; }
  .gate { padding: 3rem 0 14rem; }
  #gate-atmosphere { position: absolute; width: 100%; max-width: none; height: 300px; right: 0; bottom: 46px; -webkit-mask-image: radial-gradient(ellipse 82% 64% at 67% 69%, #000 14%, rgba(0,0,0,.96) 30%, rgba(0,0,0,.52) 53%, rgba(0,0,0,.12) 72%, transparent 84%); mask-image: radial-gradient(ellipse 82% 64% at 67% 69%, #000 14%, rgba(0,0,0,.96) 30%, rgba(0,0,0,.52) 53%, rgba(0,0,0,.12) 72%, transparent 84%); }
  .aircraft { width: 100%; right: -2%; top: 29%; }
  .scene-caption { right: 27%; bottom: 10%; }
  .tagline { margin-bottom: 2rem; }
  .site-header, .site-footer { padding-left: 1.35rem; padding-right: 1.35rem; }
  .header-note { letter-spacing: .08em; }
}
@media (max-width: 380px) {
  .site-header { gap: .5rem; font-size: .68rem; }
  .panel { padding: 1.3rem 1rem 1rem; }
}
@media (max-height: 640px) and (min-width: 701px) {
  .gate { padding: 2rem 0; }
  #gate-atmosphere { opacity: .65; width: 50vw; height: 70vh; }
}
@media (prefers-reduced-motion: reduce) {
  .aircraft { will-change: auto; transform: none !important; }
  #storm-glow, .scene-flash, .weather-canvas { display: none; }
}

/* Revisions 14-15: sharp storm within the corner; matte lightning behind the page. */
#scene-renderer, .scene-poster { position: absolute; inset: 0; width: 100%; height: 100%; }
#scene-renderer canvas { display: block; width: 100%; height: 100%; }
.scene-poster { display: block; }
.scene-poster img { display: block; width: 100%; height: 100%; object-fit: cover; }
.opening-strike { position: absolute; inset: 0; pointer-events: none; }
.opening-strike img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.opening-flash { opacity: 0; will-change: opacity; }
#gate-atmosphere[data-fallback="false"] .scene-poster { visibility: hidden; }
#gate-atmosphere[data-fallback="true"] #scene-renderer { visibility: hidden; }
.quality-control { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .6rem; min-height: 40px; color: var(--muted); font-size: .78rem; }
.quality-control select { color: var(--text); background: #111c27; border: 1px solid #34485d; padding: .3rem; border-radius: 2px; font: inherit; max-width: 130px; }
.quality-control select:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 3px; }
.study-link { margin-top: .65rem; color: #91a9ba; font-size: .72rem; text-decoration: none; letter-spacing: .025em; }
.study-link:hover { color: #d1e1eb; }
.study-link:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 4px; }
@media (max-width: 700px) {
  #gate-atmosphere { height: 320px; bottom: 46px; }
  .atmosphere-controls { max-width: 340px; column-gap: .3rem; row-gap: 0; }
  .quality-control { min-height: 34px; }
}

/* V16: continuous low-resolution world; only the original corner is sharp. */
#storm-world { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: #050912; }
#storm-world canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.wide-poster, .wide-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#storm-world[data-ready="true"] .wide-poster { visibility: hidden; }
#storm-world[data-ready="false"] canvas { visibility: hidden; }
#storm-glow { z-index: 1; }
#storm-glow { -webkit-mask-image: radial-gradient(ellipse var(--focus-rx,580px) var(--focus-ry,337px) at var(--focus-cx,80vw) var(--focus-cy,75vh), transparent 14%, rgba(0,0,0,.04) 30%, rgba(0,0,0,.48) 53%, rgba(0,0,0,.88) 72%, #000 84%); mask-image: radial-gradient(ellipse var(--focus-rx,580px) var(--focus-ry,337px) at var(--focus-cx,80vw) var(--focus-cy,75vh), transparent 14%, rgba(0,0,0,.04) 30%, rgba(0,0,0,.48) 53%, rgba(0,0,0,.88) 72%, #000 84%); }
#gate-atmosphere { z-index: 2; }
/* The main form is the only prominent control surface. Secondary controls keep
   full keyboard focus and touch hit areas without a surrounding box. */
.atmosphere-controls { position: fixed; left: 1.6rem; bottom: 3.7rem; margin: 0; gap: .08rem; align-items: center; z-index: 4; }
.atmosphere-controls button { border-color: transparent; background: transparent; padding: .3rem .45rem; min-height: 32px; font-size: .67rem; gap: .35rem; }
.atmosphere-controls button:hover { border-color: transparent; background: rgba(11,16,23,.55); }
.quality-control { min-height: 32px; padding: .2rem .35rem; gap: .3rem; font-size: .67rem; }
.quality-control select { border-color: transparent; background: transparent; padding: .1rem; font-size: .67rem; max-width: 90px; }
.sound-dot { width: 4px; height: 4px; }
.study-link { display: none; }
.demo-note { font-size: .68rem; margin-top: .7rem; }
.tagline { text-shadow: 0 1px 12px #02070b; }
@media (max-width:700px) {
  #gate-atmosphere { position: fixed; }
  .atmosphere-controls { position: static; margin-top: .65rem; max-width: 330px; gap: .03rem; }
  .atmosphere-controls button { min-height: 44px; padding: .2rem .35rem; }
  .quality-control { min-height: 44px; padding: .15rem .2rem; }
  .quality-control select { max-width: 85px; }
}

/* Landing controls and the sharp scene share the footer's viewport-aware
   reserve. Keeping controls out of the gate flow prevents them from pushing
   the password panel or footer downward on phones and browser chrome changes. */
body.password-landing #gate-atmosphere {
  bottom: var(--landing-footer-size, 44px);
  height: min(455px, 56vh);
  height: min(455px, 56dvh);
}

body.password-landing .atmosphere-controls {
  position: fixed;
  left: max(1.35rem, env(safe-area-inset-left, 0px));
  right: auto;
  bottom: calc(var(--landing-footer-size, 44px) + 6px);
  margin: 0;
  max-width: none;
}

@media (max-width: 700px) {
  body.password-landing #gate-atmosphere {
    height: min(320px, 48vh);
    height: min(320px, 48dvh);
  }

  body.password-landing .atmosphere-controls {
    left: max(.75rem, env(safe-area-inset-left, 0px));
    right: max(.75rem, env(safe-area-inset-right, 0px));
    justify-content: center;
    flex-wrap: nowrap;
    gap: 0;
  }
}

@media (max-height: 520px) {
  body.password-landing .atmosphere-controls button,
  body.password-landing .quality-control {
    min-height: 32px;
  }
}
