:root {
  --flight-ink: #030504;
  --flight-surface: rgb(10 13 10 / 86%);
  --flight-line: rgb(224 229 216 / 13%);
  --flight-line-hot: rgb(247 147 26 / 48%);
  --flight-glow: rgb(247 147 26 / 16%);
  --flight-rail: 112px;
  --flight-top: 48px;
  --flight-ease: cubic-bezier(.16, 1, .3, 1);
}

html { background: var(--flight-ink); }
body {
  background:
    radial-gradient(circle at 73% 18%, rgb(247 147 26 / 4%), transparent 31rem),
    linear-gradient(115deg, #030504, #070907 52%, #030504);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    linear-gradient(rgb(226 232 218 / 2.3%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(226 232 218 / 2.3%) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(90deg, transparent, #000 18%, #000 88%, transparent);
}

.protocol-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: .72;
}

.app-shell { min-height: 100vh; padding-left: var(--flight-rail); }

.app-header {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 110;
  width: var(--flight-rail);
  height: 100vh;
  display: grid;
  grid-template: 112px 1fr / 1fr;
  align-items: stretch;
  border: 0;
  border-right: 1px solid var(--flight-line);
  background: rgb(3 5 4 / 91%);
  /* A filtered ancestor becomes the containing block of fixed descendants.
     Keep the wallet/network deck fixed to the viewport, not trapped in the rail. */
  backdrop-filter: none;
}

.brand {
  align-self: auto;
  width: 100%;
  display: grid;
  place-items: center;
  gap: 5px;
  padding: 15px 0 12px;
  border: 0;
  border-bottom: 1px solid var(--flight-line);
}

.brand svg { width: 35px; height: 35px; filter: drop-shadow(0 0 12px var(--flight-glow)); }
.brand span { display: grid; justify-items: center; gap: 5px; }
.brand strong { font: 760 10px/1 var(--mono); letter-spacing: .17em; }
.brand small { font-size: 6px; letter-spacing: .24em; }

.primary-nav {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 24px 0;
}

.primary-nav a {
  width: 100%;
  height: 88px;
  display: grid;
  place-items: end center;
  padding: 0 5px 19px;
  border-bottom: 1px solid rgb(224 229 216 / 6%);
  font-size: 8px;
  letter-spacing: .15em;
  transition: color 220ms ease, background 220ms ease;
}

.primary-nav a::before {
  top: 19px;
  left: 50%;
  translate: -50% 0;
  font-size: 13px;
  color: rgb(240 238 231 / 20%);
}

.primary-nav a::after { display: none; }
.primary-nav a:hover, .primary-nav a[aria-current="page"] {
  background: linear-gradient(90deg, rgb(247 147 26 / 1%), rgb(247 147 26 / 10%));
}
.primary-nav a[aria-current="page"]::before { color: var(--orange); text-shadow: 0 0 18px var(--orange); }
.primary-nav a[aria-current="page"] { box-shadow: inset 2px 0 var(--orange); }
.primary-nav .operator-nav { margin-top: auto; border-top: 1px solid var(--flight-line); }

.header-status {
  position: fixed;
  top: 0;
  right: auto;
  left: calc(100vw - 366px);
  z-index: 120;
  width: 366px;
  height: var(--flight-top);
}

.network-pill, .wallet-trigger { height: var(--flight-top); border-left: 1px solid var(--flight-line); }
.network-pill { min-width: 160px; background: rgb(3 5 4 / 88%); }
.wallet-trigger { min-width: 206px; background: #ebe9e1; }
.wallet-trigger:hover { background: var(--orange); }

.truth-bar {
  position: fixed;
  top: 0;
  right: 366px;
  left: var(--flight-rail);
  z-index: 105;
  min-height: var(--flight-top);
  height: var(--flight-top);
  padding: 0 22px;
  border-top: 0;
  border-color: var(--flight-line);
  background: rgb(3 5 4 / 88%);
  backdrop-filter: blur(20px);
}

#workspace { min-height: 100vh; overflow: clip; }
.page { min-height: 100vh; padding: 96px clamp(22px, 3.4vw, 62px) 100px; }
.page::before { top: 68px; right: clamp(22px, 3.4vw, 62px); color: rgb(247 147 26 / 54%); }

.route-transit {
  position: fixed;
  inset: 0;
  z-index: 470;
  display: grid;
  grid-template-columns: 21vw 1fr;
  align-items: center;
  visibility: hidden;
  overflow: hidden;
  pointer-events: none;
  background: #030504;
  clip-path: inset(0 100% 0 0);
}

.route-transit.is-routing {
  visibility: visible;
  animation: route-aperture 860ms var(--flight-ease) both;
}

.route-transit > span {
  justify-self: end;
  color: var(--orange);
  font: 200 clamp(70px, 13vw, 210px)/.8 var(--mono);
  letter-spacing: -.12em;
}

.route-transit > div { padding-left: 7vw; }
.route-transit small { display: block; color: var(--muted); font: 8px/1 var(--mono); letter-spacing: .2em; }
.route-transit strong { display: block; margin-top: 18px; font: 420 clamp(30px, 6vw, 90px)/.9 var(--sans); letter-spacing: -.065em; }
.route-transit > i { position: absolute; top: 0; bottom: 0; left: 21vw; width: 1px; background: var(--orange); box-shadow: 0 0 42px var(--orange); }

.boot-screen {
  place-content: stretch;
  grid-template: 52px 1fr auto 52px / 1fr;
  gap: 0;
  padding: 28px 38px;
  background: #020403;
}

.boot-coordinate { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--flight-line); color: var(--muted); font: 8px/1 var(--mono); letter-spacing: .2em; }
.boot-coordinate b { color: var(--orange); font-size: 13px; }
.boot-reactor { position: relative; align-self: center; justify-self: center; width: min(54vw, 550px); aspect-ratio: 1; display: grid; place-items: center; }
.boot-reactor i { position: absolute; inset: 9%; border: 1px solid rgb(247 147 26 / 45%); border-radius: 50%; animation: boot-orbit 5s linear infinite; }
.boot-reactor i:nth-child(2) { inset: 20%; border-style: dashed; animation-duration: 9s; animation-direction: reverse; }
.boot-reactor i:nth-child(3) { inset: 36%; border-color: rgb(240 238 231 / 22%); animation-duration: 3s; }
.boot-reactor i::after { content: ""; position: absolute; top: 50%; left: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 18px var(--orange); }
.boot-reactor b { width: 13%; aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--orange); color: var(--orange); font: 700 clamp(22px, 4vw, 48px)/1 var(--mono); clip-path: polygon(50% 0,100% 100%,0 100%); padding-top: 3%; }
.boot-sequence { display: grid; grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--flight-line); }
.boot-sequence span { position: relative; padding: 17px 10px; border-right: 1px solid var(--flight-line); color: var(--dim); font: 700 8px/1 var(--mono); letter-spacing: .16em; }
.boot-sequence span::before { content: ""; position: absolute; top: -2px; left: 0; width: 0; height: 2px; background: var(--orange); transition: width 420ms ease; }
.boot-sequence span.is-current { color: var(--orange); }
.boot-sequence span.is-current::before, .boot-sequence span.is-complete::before { width: 100%; }
.boot-sequence span.is-complete { color: var(--paper); }
.boot-screen > p { align-self: end; text-align: right; }

/* CHAIN ATLAS */
.page[data-page="market"] { padding-top: 78px; }
.market-header {
  min-height: 312px;
  grid-template-columns: minmax(340px, 1fr) minmax(330px, 510px);
  align-items: center;
  gap: clamp(40px, 6vw, 100px);
  margin-bottom: 18px;
}

.market-watermark { inset: -20px -4vw -8px; }
.market-watermark::before { left: 54%; opacity: .45; }
.market-watermark::after { right: 13%; width: 136px; height: 136px; opacity: .65; }
.market-watermark span { right: 3vw; bottom: -1vw; font-size: clamp(100px, 15vw, 270px); opacity: .48; }
.market-header h1 { font-size: clamp(52px, 6.6vw, 110px); line-height: .82; }
.market-header h1 em { color: rgb(238 238 230 / 40%); }

.market-command {
  border-color: var(--flight-line-hot);
  background: linear-gradient(145deg, rgb(15 17 13 / 94%), rgb(5 7 5 / 88%));
  box-shadow: 18px 18px 0 rgb(247 147 26 / 3%);
  transform: perspective(900px) rotateY(-2deg);
}

.chain-stream { border-color: var(--flight-line-hot); background: rgb(5 7 5 / 92%); }
.metric-rail { grid-template-columns: repeat(5, 1fr); border-color: var(--flight-line); background: rgb(4 6 4 / 62%); backdrop-filter: blur(12px); }
.metric-rail > div { min-height: 94px; padding: 16px 19px; }
.metric-rail strong { font-size: clamp(18px, 2vw, 30px); }

.market-decoder, .visual-language, .market-pulse { display: none; }
.market-toolbar { margin: 42px 0 14px; padding-left: 60px; }
.market-toolbar::before { content: "ATLAS / MODE"; position: absolute; left: clamp(22px, 3.4vw, 62px); color: var(--orange); font: 7px/1 var(--mono); letter-spacing: .14em; writing-mode: vertical-rl; }

.surface-frame {
  min-height: min(780px, calc(100vh - 98px));
  border-color: var(--flight-line-hot);
  background-color: rgb(3 6 4 / 88%);
  background-image:
    radial-gradient(circle at 78% 24%, rgb(247 147 26 / 8%), transparent 30%),
    linear-gradient(rgb(223 229 216 / 4%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(223 229 216 / 4%) 1px, transparent 1px);
  background-size: auto, 48px 48px, 48px 48px;
  box-shadow: 0 34px 120px rgb(0 0 0 / 52%), inset 0 0 80px rgb(0 0 0 / 40%);
}

.surface-frame::before { background: radial-gradient(ellipse at 72% 30%, transparent 0 96px, rgb(247 147 26 / 16%) 97px, transparent 98px 151px, rgb(238 238 230 / 7%) 152px, transparent 153px); }
.surface-frame::after { animation-duration: 5.4s; }
.surface-head { background: rgb(3 5 4 / 84%); backdrop-filter: blur(18px); }
.time-surface { perspective: 1100px; transform-style: preserve-3d; }
.surface-intelligence { background: rgb(4 7 5 / 92%); border-color: var(--flight-line-hot); box-shadow: 0 20px 70px rgb(0 0 0 / 60%), 0 0 80px rgb(247 147 26 / 5%); }
.block-orbit { background: rgb(3 5 4 / 94%); backdrop-filter: blur(16px); }
.chain-tape > * { transition: background 220ms ease, transform 220ms var(--flight-ease); }
.chain-tape > *:hover { transform: translateY(-5px); background: rgb(247 147 26 / 7%); }

/* POSITION COMMAND */
.page-header { min-height: 220px; align-items: center; border-bottom: 1px solid var(--flight-line); }
.page-header h1 { font-size: clamp(48px, 6vw, 96px); }
.page-header > p { justify-self: end; max-width: 510px; }
.portfolio-lock { min-height: calc(100vh - 420px); background: radial-gradient(circle, rgb(247 147 26 / 5%), transparent 42%); }
.portfolio-lock::before { content: ""; position: absolute; width: 290px; aspect-ratio: 1; border: 1px solid rgb(247 147 26 / 20%); border-radius: 50%; box-shadow: 0 0 0 42px rgb(241 238 229 / 3%), 0 0 0 88px rgb(241 238 229 / 2%); animation: command-breathe 4s ease-in-out infinite; }
.portfolio-lock > * { position: relative; z-index: 1; }
.portfolio-command { border-color: var(--flight-line-hot); background: rgb(4 7 5 / 80%); box-shadow: 0 40px 110px rgb(0 0 0 / 40%); }
.portfolio-total strong { color: var(--paper); text-shadow: 0 0 40px rgb(247 147 26 / 18%); }
.owned-list > * { transition: transform 300ms var(--flight-ease), border-color 300ms ease, background 300ms ease; }
.owned-list > *:hover { transform: translateX(7px); border-color: var(--flight-line-hot); background: rgb(247 147 26 / 3%); }

/* GENESIS FORGE */
.mint-balance-line { border-color: var(--flight-line-hot); background: rgb(4 7 5 / 82%); }
.mint-campaigns { position: relative; }
.mint-campaigns::before { content: "GENESIS / COMMITMENT FIELD"; display: block; margin: 36px 0 16px; color: var(--orange); font: 8px/1 var(--mono); letter-spacing: .17em; }
.mint-campaigns > * { background: linear-gradient(100deg, rgb(5 8 6 / 92%), rgb(247 147 26 / 2%)); border-color: var(--flight-line); transition: transform 340ms var(--flight-ease), border-color 340ms ease; }
.mint-campaigns > *:hover { transform: translateY(-4px); border-color: var(--flight-line-hot); }

/* FULL-SCREEN EXECUTION CHAMBER */
.operation-chamber {
  position: fixed;
  inset: 0;
  z-index: 600;
  overflow: hidden;
  color: var(--paper);
  background:
    radial-gradient(circle at 37% 50%, rgb(247 147 26 / 11%), transparent 24rem),
    #020403;
  opacity: 0;
  transform: scale(1.018);
  transition: opacity 320ms ease, transform 650ms var(--flight-ease);
}
.operation-chamber.is-visible { opacity: 1; transform: scale(1); }
.operation-chamber > canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .72; }
.operation-chamber > header, .operation-chamber > footer { position: relative; z-index: 2; min-height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 30px; border-bottom: 1px solid var(--flight-line); font: 8px/1 var(--mono); letter-spacing: .18em; }
.operation-chamber > header div { display: flex; align-items: center; gap: 22px; }
.operation-chamber > header b { color: var(--orange); }
.operation-chamber > header button { height: 32px; padding: 0 10px; border: 1px solid var(--flight-line); background: transparent; color: var(--muted); font: inherit; letter-spacing: .1em; }
.operation-body { position: relative; z-index: 2; min-height: calc(100vh - 116px); display: grid; grid-template-columns: 130px minmax(320px, .82fr) minmax(390px, 1.18fr); align-items: center; gap: clamp(30px, 5vw, 96px); padding: 5vh 6vw; }
.operation-telemetry { align-self: stretch; display: grid; align-content: center; gap: 10px; border-right: 1px solid var(--flight-line); }
.operation-telemetry span { margin-top: 25px; color: var(--dim); font: 7px/1 var(--mono); letter-spacing: .15em; }
.operation-telemetry strong { color: var(--muted); font: 10px/1.2 var(--mono); }
.operation-core { position: relative; justify-self: center; width: min(38vw, 450px); aspect-ratio: 1; display: grid; place-items: center; }
.operation-core i { position: absolute; inset: 7%; border: 1px solid rgb(247 147 26 / 48%); border-radius: 50%; animation: operation-orbit 5s linear infinite; }
.operation-core i:nth-child(2) { inset: 20%; border-color: rgb(238 240 232 / 14%); border-style: dashed; animation-duration: 11s; animation-direction: reverse; }
.operation-core i:nth-child(3) { inset: 34%; border-color: rgb(247 147 26 / 25%); animation-duration: 3s; }
.operation-core i::after { content: ""; position: absolute; top: 50%; left: -4px; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 24px var(--orange); }
.operation-core b { display: grid; place-items: center; width: 22%; aspect-ratio: 1; border: 1px solid var(--orange); border-radius: 50%; color: var(--orange); font: 300 clamp(32px, 5vw, 65px)/1 var(--sans); box-shadow: inset 0 0 35px rgb(247 147 26 / 8%), 0 0 50px rgb(247 147 26 / 10%); }
.operation-core > span { position: absolute; bottom: 2%; color: var(--orange); font: 8px/1 var(--mono); letter-spacing: .22em; }
.operation-core[data-state="complete"] i { border-color: rgb(86 214 154 / 42%); animation-duration: 1.8s; }
.operation-core[data-state="complete"] b, .operation-core[data-state="complete"] > span { color: var(--green); border-color: var(--green); }
.operation-core[data-state="error"] { filter: saturate(.4); }
.operation-core[data-state="error"] i { animation-play-state: paused; border-color: rgb(255 107 95 / 40%); }
.operation-body article { max-width: 680px; }
.operation-body article h2 { max-width: 650px; margin: 14px 0 18px; font-size: clamp(42px, 5vw, 78px); font-weight: 420; line-height: .91; letter-spacing: -.065em; }
.operation-body article > p:not(.eyebrow) { max-width: 620px; margin: 0 0 34px; color: var(--muted); font-size: 16px; }
.operation-steps { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--flight-line); }
.operation-steps li { min-height: 54px; display: grid; grid-template-columns: 50px 1fr; align-items: center; border-bottom: 1px solid var(--flight-line); opacity: .3; }
.operation-steps li > span { color: var(--dim); font: 8px/1 var(--mono); }
.operation-steps li div { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.operation-steps strong, .operation-steps small { font: 700 8px/1 var(--mono); letter-spacing: .12em; }
.operation-steps small { color: var(--dim); }
.operation-steps li[data-status="active"] { opacity: 1; color: var(--orange); }
.operation-steps li[data-status="active"] > span::before { content: "● "; text-shadow: 0 0 12px var(--orange); }
.operation-steps li[data-status="complete"] { opacity: .72; color: var(--green); }
.operation-steps li[data-status="complete"] > span::before { content: "✓ "; }
.operation-proof { margin-top: 24px; display: grid; gap: 9px; }
.operation-proof span { color: var(--dim); font: 7px/1 var(--mono); letter-spacing: .14em; }
.operation-proof code { overflow: hidden; color: var(--orange-soft); font: 9px/1.4 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.operation-chamber > footer { position: absolute; right: 0; bottom: 0; left: 0; border-top: 1px solid var(--flight-line); border-bottom: 0; color: var(--muted); }
.operation-chamber > footer b { color: var(--orange); }
.operation-chamber[data-status="complete"] > footer b { color: var(--green); }
.operation-chamber[data-status="error"] > footer b { color: var(--red); }

/* DIALOGS BECOME COMMAND APERTURES */
dialog { max-height: calc(100vh - 34px); border-color: var(--flight-line-hot) !important; background: rgb(3 6 4 / 97%) !important; box-shadow: 0 45px 140px rgb(0 0 0 / 78%), 0 0 80px rgb(247 147 26 / 5%); backdrop-filter: blur(24px); }
dialog::backdrop { background: rgb(0 2 1 / 78%); backdrop-filter: blur(8px); }
dialog[open] { animation: aperture-in 520ms var(--flight-ease) both; }
.primary-action { background: #ebe9e1; color: #050705; transition: background 180ms ease, color 180ms ease, transform 180ms ease; }
.primary-action:hover { background: var(--orange); transform: translateY(-2px); }
.secondary-action { border-color: var(--flight-line-hot); background: transparent; }

.app-footer { border-color: var(--flight-line); background: rgb(3 5 4 / 76%); }

@keyframes route-aperture {
  0% { clip-path: inset(0 100% 0 0); }
  42% { clip-path: inset(0 0 0 0); }
  61% { clip-path: inset(0 0 0 0); }
  100% { clip-path: inset(0 0 0 100%); }
}
@keyframes boot-orbit { to { transform: rotate(1turn); } }
@keyframes operation-orbit { to { transform: rotate(1turn); } }
@keyframes command-breathe { 50% { transform: scale(1.045); opacity: .72; } }
@keyframes aperture-in { from { opacity: 0; transform: translateY(28px) scale(.985); } to { opacity: 1; transform: none; } }

@media (max-width: 1050px) {
  :root { --flight-rail: 84px; }
  .app-header { grid-template-rows: 90px 1fr; }
  .brand strong { font-size: 8px; }
  .primary-nav a { height: 72px; font-size: 7px; }
  .network-pill { min-width: 136px; }
  .wallet-trigger { min-width: 174px; }
  .header-status { left: calc(100vw - 310px); width: 310px; }
  .truth-bar { right: 310px; }
  .operation-body { grid-template-columns: 82px minmax(260px, .8fr) minmax(340px, 1.2fr); gap: 30px; padding-inline: 3vw; }
  .market-header { grid-template-columns: 1fr 400px; }
}

@media (max-width: 780px) {
  :root { --flight-rail: 0px; --flight-top: 62px; }
  .app-shell { padding-left: 0; }
  .app-header { inset: 0 0 auto; width: 100%; height: var(--flight-top); display: grid; grid-template: 1fr / 1fr auto; border-right: 0; border-bottom: 1px solid var(--flight-line); }
  .brand { width: auto; display: flex; justify-content: flex-start; padding: 0 16px; border: 0; }
  .brand svg { width: 28px; height: 28px; }
  .brand span { display: flex; }
  .brand strong { font-size: 10px; }
  .primary-nav { top: var(--flight-top); right: 0; bottom: auto; left: 0; display: none; height: calc(100svh - var(--flight-top)); padding: 0; background: #030504; }
  .primary-nav.open { display: grid; grid-template-columns: repeat(2, 1fr); }
  .primary-nav a { height: 70px; place-items: center; padding: 0; }
  .primary-nav a::before { display: none; }
  .header-status { position: static; left: auto; width: auto; }
  .network-pill { display: none; }
  .wallet-trigger { min-width: 128px; height: var(--flight-top); padding: 0 14px; font-size: 8px; }
  .mobile-menu { display: block; height: var(--flight-top); border-color: var(--flight-line); }
  .truth-bar { position: relative; top: var(--flight-top); right: auto; left: auto; height: auto; min-height: 40px; padding-right: 14px; padding-left: 14px; }
  #workspace { padding-top: var(--flight-top); }
  .page { padding: 72px 15px 72px; }
  .page::before { top: 52px; right: 15px; }
  .market-header { min-height: 440px; grid-template-columns: 1fr; gap: 24px; }
  .market-header h1 { font-size: clamp(48px, 16vw, 72px); }
  .market-command { transform: none; }
  .metric-rail { grid-template-columns: repeat(2, 1fr); }
  .metric-rail > div:last-child { grid-column: 1 / -1; }
  .market-toolbar { padding-left: 0; }
  .market-toolbar::before { display: none; }
  .surface-frame { min-height: 690px; }
  .operation-body { min-height: calc(100vh - 116px); grid-template-columns: 1fr; align-content: center; gap: 12px; padding: 70px 20px 80px; overflow-y: auto; }
  .operation-telemetry { display: none; }
  .operation-core { width: min(55vw, 240px); }
  .operation-body article h2 { font-size: clamp(36px, 12vw, 56px); }
  .operation-body article > p:not(.eyebrow) { margin-bottom: 20px; font-size: 13px; }
  .operation-steps li { min-height: 46px; }
  .route-transit { grid-template-columns: 30vw 1fr; }
  .route-transit > i { left: 30vw; }
  .route-transit > span { font-size: 68px; }
  .boot-screen { padding: 18px; }
  .boot-reactor { width: min(88vw, 430px); }
  .boot-sequence span { overflow: hidden; padding-inline: 5px; font-size: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .boot-reactor i, .operation-core i, .portfolio-lock::before { animation: none !important; }
  .operation-chamber, dialog[open] { transition: none; animation: none; }
}
