/* Power House v0.4.0: unobstructed orbital instrument layout. */

:root {
  --v040-top: 64px;
  --v040-dock: 146px;
  --v040-cyan: #45ddd2;
  --v040-acid: #bdff3b;
  --v040-gold: #ffc561;
  --v040-paper: #eff9f5;
}

#app {
  isolation: isolate;
  background:
    radial-gradient(circle at 75% 48%, rgba(69, 221, 210, 0.045), transparent 38%),
    radial-gradient(circle at 28% 72%, rgba(255, 197, 97, 0.035), transparent 30%),
    #010506;
}

#orbital-canvas {
  left: 34vw;
  width: 66vw;
}

.lattice-field {
  opacity: 0.055;
  mix-blend-mode: screen;
}

.scan-grid {
  opacity: 0.045;
}

.edge-vignette {
  background:
    linear-gradient(90deg, #010506 0, rgba(1, 5, 6, 0.94) 21%, transparent 48%),
    linear-gradient(180deg, rgba(1, 5, 6, 0.72), transparent 24%, transparent 72%, rgba(1, 5, 6, 0.86));
}

.topbar {
  z-index: 120;
  border-bottom-color: rgba(220, 239, 232, 0.12);
  background: rgba(1, 6, 7, 0.93);
}

.brand img {
  border-color: rgba(255, 197, 97, 0.36);
  box-shadow:
    0 0 0 1px rgba(69, 221, 210, 0.1),
    0 0 28px rgba(255, 197, 97, 0.08);
}

.network-ribbon {
  right: 18px;
  z-index: 50;
  border-color: rgba(220, 239, 232, 0.13);
  background: rgba(2, 9, 10, 0.78);
}

.center-stage {
  pointer-events: none;
}

.proof-monument {
  left: clamp(42px, 5vw, 86px);
  bottom: clamp(270px, 29vh, 350px);
  width: min(520px, 38vw);
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: auto;
}

.proof-monument::before {
  display: none;
}

.monument-thesis {
  width: fit-content;
  padding-bottom: 11px;
  border-bottom: 1px solid rgba(255, 197, 97, 0.45);
}

.monument-thesis b {
  color: var(--v040-gold);
}

.proof-monument h1 {
  max-width: 100%;
  color: var(--v040-paper);
  font-size: clamp(48px, 5vw, 74px);
  line-height: 0.9;
  text-wrap: balance;
}

.domain-equation {
  justify-content: flex-start;
  gap: 22px;
}

.domain-equation strong {
  color: var(--mode-color);
  text-shadow: 0 0 34px color-mix(in srgb, var(--mode-color) 18%, transparent);
}

.proof-monument p {
  max-width: 48ch;
  color: #afbfba;
  font-size: 13px;
  line-height: 1.55;
}

.mode-metrics {
  border-color: rgba(220, 239, 232, 0.14);
}

.hero-actions {
  grid-template-columns: minmax(180px, 0.9fr) minmax(210px, 1.1fr);
}

.proof-rail {
  top: auto;
  bottom: calc(var(--v040-dock) + 54px);
  left: clamp(42px, 5vw, 86px);
  z-index: 42;
  width: min(590px, 43vw);
}

.proof-modes {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.proof-mode {
  grid-template-columns: 22px 1fr 6px;
  min-height: 45px;
  background: rgba(3, 11, 12, 0.74);
  backdrop-filter: blur(12px);
}

.proof-mode.active {
  background:
    linear-gradient(105deg, color-mix(in srgb, var(--mode-color) 13%, transparent), transparent 64%),
    rgba(3, 12, 13, 0.92);
}

.rail-heading,
.install-command,
.rail-status,
.release-links {
  display: none;
}

.stage-label {
  left: 74%;
}

.target-reticle {
  left: 72%;
}

.scene-controls {
  right: 66px;
  bottom: calc(var(--v040-dock) + 58px);
}

.sfcs-orbit-dock {
  top: 142px;
  right: 18px;
  min-height: 188px;
}

.sfcs-orbit-toggle {
  min-height: 188px;
  border-color: rgba(255, 197, 97, 0.4);
  background:
    linear-gradient(180deg, rgba(255, 197, 97, 0.12), rgba(69, 221, 210, 0.1) 48%, rgba(1, 7, 8, 0.92)),
    rgba(1, 7, 8, 0.92);
}

.sfcs-orbit-toggle b {
  color: var(--v040-gold);
}

.sfcs-orbit-panel {
  right: 58px;
  width: min(440px, calc(100vw - 100px));
  max-height: calc(100dvh - var(--v040-top) - var(--v040-dock) - 42px);
  border-color: rgba(255, 197, 97, 0.28);
  background:
    linear-gradient(145deg, rgba(255, 197, 97, 0.06), transparent 30%),
    linear-gradient(315deg, rgba(69, 221, 210, 0.1), transparent 38%),
    rgba(2, 9, 10, 0.97);
}

.sfcs-orbit-dock .zk-cockpit {
  border-color: rgba(255, 197, 97, 0.28);
}

.sfcs-orbit-dock .zk-cockpit::after {
  border-color: rgba(255, 197, 97, 0.16);
  box-shadow:
    inset 0 0 0 10px rgba(255, 197, 97, 0.025),
    inset 0 0 0 22px rgba(69, 221, 210, 0.018);
}

.verification-dock {
  z-index: 100;
  border-top-color: rgba(220, 239, 232, 0.14);
  background: rgba(1, 7, 8, 0.94);
}

.luminous-explorer {
  z-index: 99;
  border-top-color: rgba(69, 221, 210, 0.2);
  background: rgba(2, 9, 10, 0.94);
}

.portal-drawer,
.instrument-drawer {
  z-index: 150;
}

.instrument-drawer {
  position: fixed;
  top: var(--v040-top);
  right: 0;
  bottom: 0;
}

body.observatory-open #observatory-rail,
body.evaluation-open #evaluation-panel {
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateX(0) !important;
}

.drawer-heading button {
  flex: 0 0 32px;
}

.portal-drawer-shell {
  border-color: rgba(255, 197, 97, 0.2);
}

.proof-event {
  right: 80px;
}

/*
 * Desktop observatory frame. Keep the narrative inside the stage's upper
 * boundary, let the top bar size from its actual contents, and constrain the
 * scene toolbar to its visible controls instead of stretching its hit area
 * across the globe.
 */
@media (min-width: 901px) {
  .topbar {
    grid-template-columns: max-content minmax(0, 1fr) max-content;
    column-gap: 12px;
  }

  .mission-clock {
    justify-self: center;
  }

  .top-actions {
    min-width: 0;
  }

  .proof-monument {
    top: clamp(22px, 3.5vh, 40px);
    bottom: auto;
  }

  .scene-controls {
    top: calc(var(--v040-top) + 70px);
    bottom: auto;
    width: max-content;
    height: 36px;
    grid-auto-rows: 36px;
  }
}

@media (min-width: 901px) and (max-width: 1080px) {
  .brand small,
  .mission-clock #utc-date,
  .mission-clock > span:last-child {
    display: none;
  }

  .topbar {
    column-gap: 8px;
  }
}

@media (max-width: 1180px) {
  #orbital-canvas {
    left: 30vw;
    width: 70vw;
  }

  .proof-monument {
    left: 30px;
    bottom: auto;
    width: 48vw;
  }

  .proof-rail {
    left: 30px;
    width: 52vw;
  }

  .proof-monument h1 {
    font-size: 50px;
  }
}

@media (max-width: 900px) {
  :root {
    --v040-top: 56px;
    --v040-dock: 146px;
  }

  #orbital-canvas {
    left: 0;
    width: 100%;
  }

  .edge-vignette {
    background:
      linear-gradient(180deg, rgba(1, 5, 6, 0.52), transparent 24%, transparent 66%, rgba(1, 5, 6, 0.94));
  }

  .network-ribbon {
    display: none;
  }

  .stage-label,
  .target-reticle {
    left: 50%;
  }

  .proof-monument {
    left: 14px;
    bottom: 184px;
    width: min(620px, calc(100% - 28px));
  }

  .proof-monument h1 {
    font-size: clamp(42px, 12vw, 64px);
  }

  .proof-monument p,
  .mode-metrics {
    display: none;
  }

  .proof-rail {
    bottom: calc(var(--v040-dock) + 38px);
    left: 0;
    width: 100%;
  }

  .proof-modes {
    display: flex;
    gap: 4px;
    padding: 5px 7px;
    overflow-x: auto;
    scrollbar-width: none;
    background: rgba(1, 7, 8, 0.92);
  }

  .proof-modes::-webkit-scrollbar {
    display: none;
  }

  .proof-mode {
    flex: 0 0 118px;
    grid-template-columns: minmax(0, 1fr);
    min-height: 45px;
  }

  .mode-copy {
    min-width: 0;
    width: 100%;
  }

  .scene-controls {
    display: none;
  }

  .sfcs-orbit-dock {
    top: 66px;
    right: 8px;
    min-height: 0;
  }

  .sfcs-orbit-toggle {
    min-height: 36px;
  }

  .sfcs-orbit-toggle b {
    writing-mode: initial;
  }

  .sfcs-orbit-panel {
    top: 48px;
    right: 0;
    left: auto;
    width: min(430px, calc(100vw - 16px));
    max-height: calc(100dvh - var(--v040-top) - 72px);
  }

  body.sfcs-popout-open .proof-monument,
  body.sfcs-popout-open .proof-rail,
  body.observatory-open .proof-monument,
  body.observatory-open .proof-rail,
  body.evaluation-open .proof-monument,
  body.evaluation-open .proof-rail {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

@media (max-width: 560px) {
  .proof-monument {
    bottom: 198px;
  }

  .monument-thesis {
    font-size: 7px;
  }

  .proof-monument h1 {
    font-size: clamp(38px, 12vw, 50px);
  }

  .domain-equation strong {
    font-size: 31px;
  }

  .hero-actions {
    grid-template-columns: 1fr 1.22fr;
  }

  .hero-actions button {
    min-width: 0;
  }

  .hero-actions b {
    font-size: 8px;
  }
}

@media (orientation: landscape) and (max-height: 560px) and (max-width: 950px) {
  .proof-monument {
    left: 76px;
    bottom: 58px;
    width: 48vw;
  }

  .proof-rail,
  .verification-dock,
  .luminous-explorer {
    display: none;
  }

  .sfcs-orbit-panel {
    top: 0;
    max-height: calc(100dvh - 16px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sfcs-orbit-panel,
  .proof-mode,
  .proof-monument {
    transition-duration: 0.01ms !important;
  }
}

/* Touch command deck: one visual hierarchy for navigation, modes, and actions. */
@media (max-width: 900px) {
  :root {
    --v040-dock: 146px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    padding-inline: 10px;
    border-bottom-color: rgba(220, 239, 232, 0.16);
  }

  .brand {
    min-width: 0;
    gap: 9px;
  }

  .brand img {
    width: 36px;
    height: 36px;
  }

  .brand strong {
    font-size: 17px;
  }

  .top-actions {
    gap: 5px;
  }

  .top-actions a,
  .top-actions button,
  .top-actions .evaluation-toggle {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
    border-color: rgba(220, 239, 232, 0.14);
    background: rgba(4, 13, 14, 0.78);
  }

  .top-actions #portal-top-toggle {
    border-color: var(--v040-acid);
    background: var(--v040-acid);
  }

  .proof-monument {
    right: 13px;
    bottom: 205px;
    left: 13px;
    width: auto;
  }

  .monument-thesis {
    max-width: calc(100% - 84px);
    margin-bottom: 8px;
    padding-bottom: 8px;
  }

  .proof-monument h1 {
    max-width: 7ch;
    font-size: clamp(40px, 12vw, 48px);
    line-height: 0.91;
  }

  .domain-equation {
    gap: 12px;
    margin-top: 8px;
    padding-top: 7px;
  }

  .domain-equation small {
    font-size: 7px;
  }

  .domain-equation strong {
    font-size: 30px;
  }

  .hero-actions {
    grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
    gap: 7px;
    margin-top: 10px;
  }

  .hero-actions button {
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 8px;
    min-width: 0;
    min-height: 50px;
    padding: 0 11px;
    border-radius: 4px;
  }

  .hero-actions svg {
    width: 19px;
    height: 19px;
  }

  .hero-actions button > span:last-child {
    min-width: 0;
  }

  .hero-actions b {
    overflow: hidden;
    font-size: 9px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero-actions small {
    display: block;
    margin-bottom: 3px;
    overflow: hidden;
    color: currentColor;
    font-size: 6px;
    opacity: 0.58;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hero-trust-meter {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    margin-top: 8px;
    border-top: 1px solid rgba(220, 239, 232, 0.13);
  }

  .hero-trust-meter div {
    min-width: 0;
    padding: 7px 8px 0;
    border-right: 1px solid rgba(220, 239, 232, 0.11);
  }

  .hero-trust-meter div:first-child {
    padding-left: 0;
  }

  .hero-trust-meter div:last-child {
    padding-right: 0;
    border-right: 0;
  }

  .hero-trust-meter dt {
    margin-bottom: 3px;
    font-size: 6px;
  }

  .hero-trust-meter dd {
    overflow: hidden;
    font-size: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .proof-rail {
    bottom: calc(var(--v040-dock) + 34px);
    padding: 0;
    border-top: 1px solid rgba(69, 221, 210, 0.18);
    border-bottom: 1px solid rgba(220, 239, 232, 0.1);
    background: rgba(1, 7, 8, 0.96);
    box-shadow: 0 -18px 42px rgba(0, 0, 0, 0.3);
  }

  .proof-modes {
    display: flex;
    gap: 0;
    padding: 6px 12px;
    overflow-x: auto;
    scroll-padding-inline: 12px;
    scroll-snap-type: x proximity;
    background: transparent;
  }

  .proof-mode {
    position: relative;
    flex: 0 0 116px;
    grid-template-columns: minmax(0, 1fr);
    min-width: 116px;
    min-height: 54px;
    padding: 8px 31px 8px 10px;
    border: 0;
    border-right: 1px solid rgba(220, 239, 232, 0.1);
    border-radius: 0;
    color: #9cada7;
    background: transparent;
    box-shadow: none;
    scroll-snap-align: start;
  }

  .proof-mode:first-child {
    border-left: 1px solid rgba(220, 239, 232, 0.1);
  }

  .proof-mode::after {
    position: absolute;
    right: 10px;
    bottom: 4px;
    left: 10px;
    height: 2px;
    content: "";
    background: transparent;
    transform: scaleX(0.25);
    transition:
      background-color 160ms ease,
      transform 180ms ease;
  }

  .proof-mode .mode-index {
    position: absolute;
    top: 8px;
    right: 8px;
    display: grid;
    width: 18px;
    height: 18px;
    place-items: center;
    color: #72817d;
    border: 1px solid rgba(220, 239, 232, 0.13);
    border-radius: 50%;
    font-size: 7px;
  }

  .proof-mode .mode-copy {
    align-self: center;
    min-width: 0;
  }

  .proof-mode .mode-copy b {
    color: inherit;
    font-size: 9px;
    line-height: 1.15;
  }

  .proof-mode .mode-copy small,
  .proof-mode i {
    display: none;
  }

  .proof-mode.active {
    color: var(--v040-paper);
    background: linear-gradient(180deg, rgba(69, 221, 210, 0.1), transparent);
    box-shadow: none;
  }

  .proof-mode.active::after {
    background: var(--mode-color);
    transform: scaleX(1);
  }

  .proof-mode.active .mode-index {
    color: #010506;
    border-color: var(--mode-color);
    background: var(--mode-color);
  }

  .sfcs-orbit-dock {
    top: 65px;
    right: 8px;
    width: auto;
  }

  .sfcs-orbit-toggle {
    grid-template-columns: 18px auto;
    grid-template-rows: 1fr;
    gap: 7px;
    width: auto;
    min-width: 72px;
    min-height: 38px;
    padding: 0 10px;
    border-radius: 4px;
    background: rgba(3, 12, 13, 0.9);
  }

  .sfcs-orbit-toggle [data-icon] {
    width: 17px;
    height: 17px;
  }

  .sfcs-orbit-toggle b {
    font-size: 9px;
    writing-mode: initial;
  }

  .sfcs-orbit-toggle small {
    display: none;
  }

  .verification-dock {
    border-top-color: rgba(69, 221, 210, 0.2);
    box-shadow: 0 -22px 58px rgba(0, 0, 0, 0.34);
  }

  .trace-header {
    padding-inline: 12px;
  }

  .trace-header b {
    font-size: 12px;
    line-height: 1.25;
  }

  .verify-button {
    min-width: 102px;
    border-radius: 4px;
  }

  .telemetry > div {
    min-width: 0;
  }
}

@media (max-width: 370px) {
  .proof-monument {
    bottom: 202px;
  }

  .proof-monument h1 {
    font-size: 38px;
  }

  .hero-actions button {
    padding-inline: 8px;
  }

  .hero-actions small {
    display: none;
  }

  .proof-mode {
    flex-basis: 108px;
    min-width: 108px;
  }
}

/*
 * Portrait world focus: reserve the center for the globe. Descriptive proof
 * copy remains available through the proof rail and drawers instead of being
 * painted over the world.
 */
@media (orientation: portrait) and (max-width: 900px) {
  :root {
    --dock: 112px;
    --v040-dock: 112px;
    --explorer-closed: 28px;
    --mobile-command-band: 62px;
  }

  body {
    --scene-bottom: calc(
      var(--dock) + var(--proof-stack) + var(--explorer-closed) +
        var(--mobile-command-band)
    );
  }

  body.luminous-mode {
    --scene-bottom: calc(
      var(--dock) + var(--proof-stack) + var(--explorer-closed) +
        var(--mobile-command-band)
    );
  }

  body.luminous-mode.luminous-expanded {
    --scene-bottom: calc(
      var(--dock) + var(--proof-stack) + var(--explorer-open) +
        var(--mobile-command-band)
    );
  }

  .edge-vignette {
    background:
      linear-gradient(180deg, rgba(1, 5, 6, 0.58), transparent 18%, transparent 78%, rgba(1, 5, 6, 0.82));
  }

  .proof-monument {
    right: 12px;
    bottom: -48px;
    left: 12px;
    width: auto;
    height: 48px;
  }

  .proof-monument::before,
  .monument-thesis,
  .proof-monument > span,
  .monument-title,
  .domain-equation,
  .proof-monument > p,
  .mode-metrics,
  .hero-trust-meter {
    display: none;
  }

  .hero-actions {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 7px;
    margin: 0;
  }

  .hero-actions button {
    min-height: 48px;
    background: #020a0b;
    backdrop-filter: none;
  }

  .hero-run-button {
    box-shadow: 0 10px 30px rgba(189, 255, 59, 0.08);
  }

  .hero-portal-button {
    border-color: rgba(220, 239, 232, 0.22);
  }

  .orbital-label-layer,
  .target-reticle,
  .proof-event {
    display: none;
  }

  .scene-controls {
    top: 116px;
    right: auto;
    bottom: auto;
    left: 8px;
    z-index: 46;
    display: grid;
    grid-template-columns: 34px;
    grid-auto-rows: 34px;
    align-content: start;
    justify-content: start;
    gap: 5px;
    height: auto;
  }

  .scene-controls .icon-button {
    width: 34px;
    height: 34px;
    color: #a8b9b3;
    border-color: rgba(220, 239, 232, 0.2);
    border-radius: 4px;
    background: rgba(2, 10, 11, 0.88);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
  }

  .scene-controls .icon-button:hover,
  .scene-controls .icon-button:focus-visible,
  .scene-controls .icon-button.active {
    color: #010506;
    border-color: var(--mode-color);
    background: var(--mode-color);
    box-shadow: 0 0 22px color-mix(in srgb, var(--mode-color) 22%, transparent);
  }

  #sound-toggle,
  #motion-toggle {
    display: none;
  }

  .stage-label {
    top: 10px;
  }

  .stage-label span,
  .stage-label small {
    opacity: 0.62;
  }

  .proof-rail {
    bottom: calc(var(--v040-dock) + var(--explorer-closed));
    box-shadow: none;
  }

  .proof-modes {
    padding-block: 5px;
  }

  .proof-mode {
    min-height: 48px;
  }

  .proof-mode.active {
    color: var(--v040-paper);
    border-color: color-mix(in srgb, var(--mode-color) 44%, transparent);
    background:
      linear-gradient(
        180deg,
        color-mix(in srgb, var(--mode-color) 24%, #02090a),
        color-mix(in srgb, var(--mode-color) 7%, #02090a)
      );
    box-shadow:
      inset 0 -2px 0 var(--mode-color),
      0 0 22px color-mix(in srgb, var(--mode-color) 9%, transparent);
  }

  .proof-mode.active .mode-index {
    box-shadow: 0 0 14px color-mix(in srgb, var(--mode-color) 30%, transparent);
  }

  .verification-dock {
    grid-template-rows: 70px 42px;
    height: var(--dock);
    box-shadow: 0 -16px 38px rgba(0, 0, 0, 0.28);
  }

  .trace-header {
    padding-block: 8px;
  }

  .trace-header > span {
    font-size: 7px;
  }

  .trace-header b {
    max-height: 30px;
    font-size: 11px;
  }

  .verification-actions {
    padding-block: 7px;
  }

  .verify-button {
    min-height: 44px;
  }

  .telemetry {
    height: 42px;
    min-height: 42px;
  }

  .status-seal {
    width: 36px;
    height: 36px;
  }

  .luminous-heading {
    min-height: var(--explorer-closed);
    height: var(--explorer-closed);
  }

  body.luminous-expanded .proof-monument,
  body.portal-open .scene-controls,
  body.sfcs-popout-open .scene-controls,
  body.observatory-open .scene-controls,
  body.evaluation-open .scene-controls {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

@media (orientation: portrait) and (max-width: 370px) {
  .proof-monument {
    bottom: -46px;
    height: 46px;
  }

  .hero-actions button {
    min-height: 46px;
  }

  .proof-mode {
    min-height: 46px;
  }

  .scene-controls {
    top: 110px;
    grid-template-columns: 32px;
    grid-auto-rows: 32px;
  }

  .scene-controls .icon-button {
    width: 32px;
    height: 32px;
  }
}
