:root {
  --ink: #f7ffff;
  --muted: rgba(230, 255, 255, 0.72);
  --panel: rgba(2, 18, 24, 0.78);
  --panel-strong: rgba(2, 22, 29, 0.94);
  --cyan: #00e5ff;
  --teal: #008b93;
  --orange: #ff7a3d;
  --gold: #ffd36a;
  --pink: #ff4f8b;
  --line: rgba(0, 229, 255, 0.22);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background: #020b10;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.portal-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 35%, rgba(0, 229, 255, 0.16), transparent 34rem),
    radial-gradient(circle at 76% 18%, rgba(255, 122, 61, 0.18), transparent 28rem),
    #020b10;
}

#portalCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.portal-topbar,
.hero-panel,
.stand-panel,
.stand-dock,
.mission-ribbon,
.immersive-hint,
.immersive-video,
.walk-pad,
.xr-lenses {
  position: absolute;
  z-index: 4;
}

.portal-topbar {
  top: 18px;
  left: 18px;
  right: 18px;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(2, 22, 29, 0.92), rgba(2, 22, 29, 0.54));
  box-shadow: 0 20px 90px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}

.brand strong {
  display: block;
  font-size: 18px;
  line-height: 1;
}

.brand small,
.hero-panel p,
.stand-kicker,
.mission-ribbon {
  color: var(--cyan);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand small {
  display: block;
  margin-top: 4px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.top-actions a,
.top-actions button,
.stand-panel a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid rgba(0, 229, 255, 0.14);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  text-transform: uppercase;
  cursor: pointer;
}

.top-actions a:hover,
.top-actions button:hover,
.stand-panel a:hover {
  color: #031217;
  background: var(--cyan);
}

#enterPortal {
  color: #031217;
  background: var(--cyan);
  box-shadow: 0 0 28px rgba(0, 229, 255, 0.28);
}

#exitPortal {
  color: #fff3dd;
  background: rgba(255, 122, 61, 0.22);
}

.hero-panel {
  left: 24px;
  bottom: 104px;
  width: min(560px, calc(100vw - 48px));
  padding: 24px;
  border: 1px solid rgba(0, 229, 255, 0.26);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(1, 19, 26, 0.92), rgba(0, 72, 80, 0.46));
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(16px);
}

.hero-panel p,
.stand-kicker {
  margin: 0 0 8px;
}

.hero-panel h1 {
  margin: 0 0 12px;
  max-width: 520px;
  font-size: clamp(42px, 6vw, 78px);
  line-height: 0.9;
}

.hero-panel span,
.stand-panel p {
  display: block;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.38;
}

.stand-panel {
  top: 108px;
  right: 24px;
  width: min(430px, calc(100vw - 48px));
  max-height: calc(100vh - 220px);
  overflow: hidden;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 28px 100px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(16px);
}

.stand-panel h2 {
  margin: 0 0 8px;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 0.94;
}

.stand-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.stand-tags span {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(0, 229, 255, 0.18);
  border-radius: 999px;
  color: #dff;
  background: rgba(0, 229, 255, 0.08);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.video-frame {
  overflow: hidden;
  margin: 12px 0;
  border: 1px solid rgba(0, 229, 255, 0.18);
  border-radius: 9px;
  background: #000;
  aspect-ratio: 16 / 8.2;
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

.stand-panel a {
  width: 100%;
  color: #031217;
  background: var(--cyan);
}

.stand-dock {
  right: 24px;
  bottom: 24px;
  display: grid;
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 8px;
  width: min(680px, calc(100vw - 48px));
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-strong);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(16px);
}

.stand-dock button {
  min-height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.07);
  font-size: 12px;
  font-weight: 950;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

.stand-dock button span {
  display: block;
  margin-bottom: 3px;
  color: var(--cyan);
  font-size: 10px;
}

.stand-dock button.is-active {
  color: #021217;
  background: var(--cyan);
}

.stand-dock button.is-active span {
  color: #005c66;
}

.mission-ribbon {
  left: 24px;
  bottom: 24px;
  width: min(620px, calc(100vw - 48px));
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border: 1px solid rgba(0, 229, 255, 0.16);
  border-radius: 10px;
  background: rgba(2, 22, 29, 0.78);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(16px);
}

.mission-ribbon i {
  width: 28px;
  height: 1px;
  background: rgba(255, 122, 61, 0.74);
}

.immersive-hint {
  display: none;
  left: 24px;
  bottom: 24px;
  width: min(390px, calc(100vw - 48px));
  padding: 16px 18px;
  border: 1px solid rgba(0, 229, 255, 0.22);
  border-radius: 10px;
  color: var(--ink);
  background: linear-gradient(135deg, rgba(1, 19, 26, 0.92), rgba(0, 62, 70, 0.56));
  box-shadow: 0 22px 80px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(16px);
}

.immersive-hint strong {
  display: block;
  margin-bottom: 5px;
  color: var(--cyan);
  font-size: 12px;
  text-transform: uppercase;
}

.immersive-hint span {
  display: block;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.xr-lenses {
  display: none;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.immersive-video,
.walk-pad {
  display: none;
}

.immersive-video {
  right: 12px;
  bottom: 72px;
  width: min(430px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid rgba(0, 229, 255, 0.28);
  border-radius: 10px;
  background: rgba(2, 18, 24, 0.88);
  box-shadow: 0 22px 72px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(16px);
}

.immersive-video[hidden] {
  display: none !important;
}

.immersive-video strong {
  display: block;
  margin: 0 74px 8px 0;
  font-size: 13px;
  line-height: 1.1;
  text-transform: uppercase;
}

.immersive-video button {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(0, 229, 255, 0.22);
  border-radius: 7px;
  color: #031217;
  background: var(--cyan);
  font-size: 10px;
  font-weight: 950;
  text-transform: uppercase;
}

.immersive-video iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: 0;
  border-radius: 7px;
  background: #000;
}

.walk-pad {
  left: 12px;
  bottom: 72px;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(3, 38px);
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(0, 229, 255, 0.22);
  border-radius: 10px;
  background: rgba(2, 18, 24, 0.56);
  backdrop-filter: blur(12px);
}

.walk-pad button {
  min-width: 44px;
  min-height: 38px;
  border: 1px solid rgba(0, 229, 255, 0.18);
  border-radius: 8px;
  color: #eaffff;
  background: rgba(0, 229, 255, 0.12);
  font-size: 0;
  font-weight: 950;
  cursor: pointer;
}

.walk-pad button::before {
  font-size: 16px;
}

.walk-pad [data-move="forward"] {
  grid-column: 2;
  grid-row: 1;
}

.walk-pad [data-move="left"] {
  grid-column: 1;
  grid-row: 2;
}

.walk-pad [data-move="back"] {
  grid-column: 2;
  grid-row: 2;
}

.walk-pad [data-move="right"] {
  grid-column: 3;
  grid-row: 2;
}

.walk-pad #openImmersiveVideo {
  grid-column: 1 / 4;
  grid-row: 3;
  width: auto;
  font-size: 10px;
  text-transform: uppercase;
}

.walk-pad [data-move="forward"]::before {
  content: "▲";
}

.walk-pad [data-move="left"]::before {
  content: "◀";
}

.walk-pad [data-move="back"]::before {
  content: "▼";
}

.walk-pad [data-move="right"]::before {
  content: "▶";
}

.xr-lenses::before,
.xr-lenses::after {
  content: "";
  position: absolute;
  top: 10%;
  bottom: 11%;
  width: 46%;
  border: 2px solid rgba(0, 229, 255, 0.26);
  box-shadow:
    inset 0 0 34px rgba(0, 229, 255, 0.12),
    0 0 26px rgba(0, 229, 255, 0.16);
  background:
    radial-gradient(circle at 50% 50%, transparent 45%, rgba(0, 8, 12, 0.12) 73%, rgba(0, 0, 0, 0.32) 100%);
}

.xr-lenses::before {
  left: -4%;
  border-radius: 48% 42% 46% 50%;
}

.xr-lenses::after {
  right: -4%;
  border-radius: 42% 48% 50% 46%;
}

.xr-lenses i {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 46%, rgba(0, 0, 0, 0.16) 72%, rgba(0, 0, 0, 0.58) 100%),
    linear-gradient(90deg, rgba(0, 229, 255, 0.055), transparent 22%, transparent 78%, rgba(255, 122, 61, 0.055));
}

body.is-immersive {
  cursor: crosshair;
}

body.is-immersive .hero-panel,
body.is-immersive .mission-ribbon,
body.is-immersive .stand-panel,
body.is-immersive .stand-dock {
  display: none;
}

body.is-immersive .immersive-hint {
  display: block;
}

body.is-immersive .walk-pad {
  display: grid;
}

body.is-immersive .immersive-video:not([hidden]) {
  display: block;
}

body.is-immersive .xr-lenses {
  display: block;
}

@media (max-width: 1020px) {
  body {
    overflow: auto;
  }

  .portal-shell {
    min-height: 1180px;
    height: auto;
  }

  #portalCanvas {
    height: 720px;
  }

  .portal-topbar,
  .hero-panel,
  .stand-panel,
  .stand-dock,
  .mission-ribbon {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;
    top: auto;
    margin: 16px;
    width: calc(100% - 32px);
  }

  .portal-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .stand-panel {
    max-height: none;
  }

  .stand-dock {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .top-actions,
  .mission-ribbon {
    align-items: flex-start;
    flex-direction: column;
  }

  .stand-dock {
    grid-template-columns: 1fr;
  }
}

body.is-immersive,
body.is-immersive .portal-shell {
  width: 100vw;
  height: 100svh;
  min-height: 100svh;
  overflow: hidden;
}

body.is-immersive #portalCanvas {
  height: 100svh;
}

body.is-immersive .portal-topbar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  width: auto;
  min-height: 48px;
  margin: 0;
  padding: 8px;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(1, 12, 16, 0.56), rgba(1, 12, 16, 0.18));
  box-shadow: none;
}

body.is-immersive .brand img {
  width: 34px;
  height: 34px;
}

body.is-immersive .brand strong {
  font-size: 15px;
}

body.is-immersive .brand small,
body.is-immersive .top-actions a,
body.is-immersive #enterPortal {
  display: none;
}

body.is-immersive #exitPortal {
  min-height: 34px;
  padding: 0 10px;
  border-color: rgba(255, 255, 255, 0.12);
  font-size: 11px;
  background: rgba(0, 0, 0, 0.32);
}

body.is-immersive .immersive-hint {
  position: absolute;
  left: auto;
  right: 12px;
  bottom: 12px;
  width: min(430px, calc(100vw - 24px));
  margin: 0;
  padding: 11px 12px;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(1, 18, 24, 0.62), rgba(0, 64, 72, 0.28));
}

body.is-immersive .immersive-hint strong {
  margin: 0 0 4px;
  font-size: 11px;
}

body.is-immersive .immersive-hint span {
  font-size: 12px;
}

@media (orientation: portrait) {
  body.is-immersive .xr-lenses::before,
  body.is-immersive .xr-lenses::after {
    top: 15%;
    bottom: 15%;
    width: 58%;
  }

  body.is-immersive .xr-lenses::before {
    left: -30%;
  }

  body.is-immersive .xr-lenses::after {
    right: -30%;
  }

  body.is-immersive .portal-topbar {
    top: 8px;
    left: 8px;
    right: 8px;
  }

  body.is-immersive .immersive-hint {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
  }

  body.is-immersive .walk-pad {
    left: 8px;
    bottom: 76px;
  }

  body.is-immersive .immersive-video {
    left: 8px;
    right: 8px;
    bottom: 218px;
    width: auto;
  }
}
