:root {
  color-scheme: dark;
  --bg: #020306;
  --ink: #fbf1df;
  --muted: #aeb8bd;
  --dim: #64727c;
  --line: rgba(251, 241, 223, 0.16);
  --active: #7ef8e8;
  --active-rgb: 126, 248, 232;
  --amber: #ffc86b;
  --mint: #8dffb3;
  --rose: #ff7aa8;
  --violet: #a78bfa;
  --blue: #82b6ff;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 52% 44%, rgba(var(--active-rgb), 0.12), transparent 34%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 116px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.014) 0 1px, transparent 1px 116px),
    var(--bg);
  overflow-x: hidden;
}

button,
a {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
}

.boot-scan {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(2, 3, 6, 0.9), rgba(2, 3, 6, 0.42)),
    radial-gradient(circle, rgba(var(--active-rgb), 0.16), transparent 34%);
  pointer-events: none;
}

.boot-scan::before {
  position: absolute;
  inset: 50% 0 auto;
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, var(--active), transparent);
  box-shadow: 0 0 32px rgba(var(--active-rgb), 0.72);
}

.boot-scan span {
  color: var(--active);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.18em;
}

.hud {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 28px;
  align-items: center;
  width: min(1460px, calc(100% - 28px));
  height: 78px;
  margin: 0 auto;
  pointer-events: none;
}

.hud > * {
  pointer-events: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 780;
  white-space: nowrap;
}

.brand-orbit {
  position: relative;
  width: 31px;
  aspect-ratio: 1;
  border: 1px solid rgba(var(--active-rgb), 0.66);
  border-radius: 50%;
  box-shadow:
    inset 0 0 18px rgba(var(--active-rgb), 0.34),
    0 0 22px rgba(var(--active-rgb), 0.28);
}

.brand-orbit::before,
.brand-orbit::after {
  position: absolute;
  content: "";
  border-radius: 999px;
}

.brand-orbit::before {
  inset: 8px;
  background: var(--amber);
  box-shadow: 0 0 16px rgba(255, 200, 107, 0.78);
}

.brand-orbit::after {
  top: 50%;
  left: -5px;
  width: 40px;
  height: 9px;
  border-top: 1px solid rgba(251, 241, 223, 0.58);
  transform: rotate(-18deg);
}

.navline {
  justify-self: center;
  display: flex;
  gap: 32px;
  color: var(--muted);
  font-size: 13px;
}

.navline a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
}

.navline a::after {
  position: absolute;
  right: 0;
  bottom: 2px;
  left: 0;
  height: 1px;
  content: "";
  background: var(--active);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.navline a:hover,
.navline a:focus-visible {
  color: var(--ink);
  outline: 0;
}

.navline a:hover::after,
.navline a:focus-visible::after {
  opacity: 1;
  transform: scaleX(1);
}

.scan-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 84px;
  min-height: 40px;
  border: 1px solid rgba(var(--active-rgb), 0.52);
  border-radius: 999px;
  background: rgba(2, 3, 6, 0.4);
  box-shadow: 0 0 26px rgba(var(--active-rgb), 0.18);
  cursor: pointer;
  backdrop-filter: blur(18px);
}

.scan-trigger .scan-dot {
  width: 8px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 14px rgba(141, 255, 179, 0.82);
}

.language-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  min-width: 76px;
  min-height: 38px;
  padding: 3px;
  border: 1px solid rgba(var(--active-rgb), 0.34);
  border-radius: 999px;
  background: rgba(2, 3, 6, 0.36);
  box-shadow: 0 0 24px rgba(var(--active-rgb), 0.12);
  backdrop-filter: blur(18px);
}

.language-switch button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.language-switch button[aria-pressed="true"] {
  background: rgba(var(--active-rgb), 0.18);
  color: var(--ink);
  box-shadow: inset 0 0 12px rgba(var(--active-rgb), 0.22);
}

.thought-field {
  position: relative;
  z-index: 1;
  min-height: 100svh;
  overflow: hidden;
}

.thought-field::before {
  position: absolute;
  inset: 78px max(14px, calc((100vw - 1460px) / 2)) 40px;
  content: "";
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  pointer-events: none;
}

.thesis {
  position: absolute;
  z-index: 7;
  top: clamp(118px, 17vh, 166px);
  left: max(18px, calc((100vw - 1460px) / 2 + 18px));
  width: min(36vw, 520px);
  pointer-events: none;
}

.kicker {
  margin: 0 0 14px;
  color: var(--active);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 560px;
  margin: 0 0 22px;
  font-size: clamp(66px, 8.2vw, 124px);
  line-height: 0.86;
  letter-spacing: 0;
  text-wrap: balance;
}

:root[data-lang="en"] h1 {
  font-size: clamp(54px, 5.9vw, 86px);
  line-height: 0.95;
}

:root[data-lang="en"] .mind-node span {
  min-width: 116px;
}

:root[data-lang="en"] .readout h2 {
  font-size: clamp(34px, 3.6vw, 58px);
  line-height: 1;
}

:root[data-lang="en"] #fragmentRay {
  width: min(43vw, 620px);
  font-size: clamp(21px, 2vw, 30px);
  line-height: 1.18;
}

.thesis p:not(.kicker) {
  max-width: 420px;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.86;
}

.cosmic-stage {
  position: absolute;
  z-index: 4;
  top: 52%;
  left: 50%;
  width: min(61vw, 780px);
  aspect-ratio: 1;
  overflow: hidden;
  transform: translate(-50%, -50%);
}

.warp-grid,
.gravity-lens,
.link-map,
.node-layer,
.signal-core {
  position: absolute;
}

.warp-grid {
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.034) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.034) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, black 0 50%, transparent 74%);
  opacity: 0.55;
}

.gravity-lens {
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.gravity-lens span {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1px solid rgba(var(--active-rgb), 0.26);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.gravity-lens span:nth-child(1) {
  width: 28%;
  aspect-ratio: 1;
}

.gravity-lens span:nth-child(2) {
  width: 54%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%) rotate(18deg) scaleY(0.72);
}

.gravity-lens span:nth-child(3) {
  width: 88%;
  aspect-ratio: 1;
  border-style: dashed;
  transform: translate(-50%, -50%) rotate(-18deg) scaleY(0.58);
}

.link-map {
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.link-map path {
  fill: none;
  stroke: rgba(251, 241, 223, 0.16);
  stroke-width: 0.34;
  stroke-dasharray: 2.5 5;
  vector-effect: non-scaling-stroke;
}

.link-map path.is-active {
  stroke: color-mix(in srgb, var(--active), var(--amber) 22%);
  stroke-width: 0.78;
}

.node-layer {
  inset: 0;
  z-index: 3;
}

.mind-node {
  position: absolute;
  display: grid;
  place-items: center;
  width: var(--size);
  aspect-ratio: 1;
  border: 1px solid rgba(var(--node-rgb), 0.72);
  border-radius: 50%;
  background:
    radial-gradient(circle at 42% 34%, rgba(255, 255, 255, 0.98) 0 2px, transparent 3px),
    radial-gradient(circle, rgba(var(--node-rgb), 0.78), rgba(var(--node-rgb), 0) 68%);
  box-shadow:
    0 0 calc(var(--size) * 0.82) rgba(var(--node-rgb), 0.52),
    inset 0 0 calc(var(--size) * 0.28) rgba(var(--node-rgb), 0.76);
  cursor: pointer;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

.mind-node::before,
.mind-node::after {
  position: absolute;
  content: "";
  border-radius: 50%;
  pointer-events: none;
}

.mind-node::before {
  inset: -12px;
  border: 1px solid rgba(var(--node-rgb), 0.28);
}

.mind-node::after {
  inset: -26px;
  border: 1px solid rgba(var(--node-rgb), 0.12);
}

.mind-node span {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  min-width: 86px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  text-shadow: 0 2px 12px #000;
  transform: translateX(-50%);
}

.mind-node:hover,
.mind-node:focus-visible,
.mind-node.is-active {
  z-index: 4;
  outline: 0;
}

.mind-node.is-active span {
  color: var(--ink);
}

.signal-core {
  z-index: 4;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: min(25vw, 270px);
  min-width: 180px;
  aspect-ratio: 1;
  border: 1px solid rgba(var(--active-rgb), 0.48);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(var(--active-rgb), 0.2), transparent 64%),
    rgba(2, 3, 6, 0.12);
  box-shadow:
    inset 0 0 34px rgba(var(--active-rgb), 0.24),
    0 0 64px rgba(var(--active-rgb), 0.3);
  text-align: center;
  transform: translate(-50%, -50%);
}

.signal-core span,
.signal-core small {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.signal-core strong {
  font-size: clamp(52px, 6vw, 92px);
  line-height: 0.9;
}

.readout {
  position: absolute;
  z-index: 7;
  right: max(18px, calc((100vw - 1460px) / 2 + 18px));
  bottom: clamp(72px, 11vh, 132px);
  width: min(32vw, 390px);
  pointer-events: none;
}

.readout > p:first-child {
  margin-bottom: 18px;
  color: var(--active);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.readout h2 {
  margin-bottom: 18px;
  font-size: clamp(40px, 4.4vw, 70px);
  line-height: 0.96;
  letter-spacing: 0;
  text-wrap: balance;
}

.readout > p:not(:first-child) {
  color: var(--muted);
  line-height: 1.82;
}

.readout dl {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 30px 0 0;
}

.readout div {
  min-width: 0;
  padding-top: 12px;
  border-top: 1px solid rgba(var(--active-rgb), 0.5);
}

.readout dt {
  color: var(--dim);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.readout dd {
  margin: 6px 0 0;
  font-weight: 780;
}

.echo-plane {
  position: absolute;
  z-index: 7;
  right: max(18px, calc((100vw - 1460px) / 2 + 18px));
  top: clamp(110px, 15vh, 154px);
  width: min(32vw, 380px);
  pointer-events: none;
}

.echo-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.echo-item span {
  color: var(--amber);
  font-size: 12px;
  font-weight: 780;
}

.echo-item p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.56;
}

.debris-plane {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

#fragmentRay {
  position: absolute;
  bottom: clamp(48px, 7vh, 76px);
  left: max(18px, calc((100vw - 1460px) / 2 + 300px));
  width: min(50vw, 720px);
  margin: 0;
  color: color-mix(in srgb, var(--active), var(--ink) 48%);
  font-size: clamp(24px, 2.4vw, 36px);
  line-height: 1.16;
  text-wrap: balance;
}

.debris {
  position: absolute;
  z-index: 1;
  left: var(--x);
  top: var(--y);
  max-width: min(320px, 26vw);
  color: rgba(174, 184, 189, 0.5);
  font-size: 14px;
  line-height: 1.56;
  transform: translate(-50%, -50%) rotate(var(--r));
  will-change: transform, opacity;
}

.debris.is-active {
  color: color-mix(in srgb, var(--debris-color), var(--ink) 32%);
}

@media (max-width: 980px) {
  .hud {
    grid-template-columns: 1fr auto auto;
    height: 120px;
    gap: 10px;
  }

  .navline {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-self: stretch;
    justify-content: space-between;
    gap: 12px;
  }

  .thought-field {
    min-height: auto;
    overflow: visible;
    padding: 138px 10px 76px;
  }

  .thought-field::before {
    display: none;
  }

  .thesis,
  .cosmic-stage,
  .readout,
  .echo-plane,
  .debris-plane,
  #fragmentRay {
    position: relative;
    inset: auto;
    width: auto;
    transform: none;
  }

  .thesis,
  .readout,
  .echo-plane,
  #fragmentRay {
    max-width: none;
    margin: 0 14px 24px;
    pointer-events: auto;
  }

  .cosmic-stage {
    width: min(100%, 720px);
    margin: 20px auto 34px;
  }

  .debris-plane {
    display: contents;
  }

  #debrisCloud {
    position: relative;
    min-height: 420px;
    margin: 24px 14px 0;
  }

  .debris {
    max-width: min(340px, 72vw);
  }
}

@media (max-width: 640px) {
  .hud {
    width: min(100% - 20px, 1460px);
  }

  .brand {
    font-size: 16px;
  }

  .navline {
    font-size: 12px;
  }

  .scan-trigger {
    min-width: 74px;
    min-height: 38px;
    font-size: 13px;
  }

  .language-switch {
    min-width: 70px;
  }

  h1 {
    font-size: clamp(56px, 18vw, 92px);
  }

  :root[data-lang="en"] h1 {
    font-size: clamp(44px, 13vw, 68px);
  }

  :root[data-lang="en"] .readout h2 {
    font-size: clamp(34px, 9.8vw, 52px);
  }

  .signal-core {
    width: 168px;
    min-width: 168px;
  }

  .signal-core span {
    display: none;
  }

  .mind-node {
    width: calc(var(--size) * 0.82);
  }

  .mind-node span {
    min-width: 66px;
    font-size: 11px;
  }

  .mind-node[data-id="structure"] span {
    top: auto;
    bottom: calc(100% + 8px);
  }

  .readout h2 {
    font-size: clamp(38px, 12vw, 60px);
  }

  .readout dl {
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
