*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #050b18;
  --ink: #e3f1ff;
  --dim: #5f7f9e;
  --acc: #a6dcff;
  --gold: #e8cf8f;
  --rule: rgba(120, 190, 255, .15);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Segoe UI", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", Menlo, Consolas, "Roboto Mono", "Noto Sans SC", "PingFang SC", monospace;
}

html { scroll-behavior: auto; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
html:lang(en) body { font-family: var(--sans); }

/* ── fixed layers ── */
#gl, #aurora2d { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }
#aurora2d[hidden] { display: none; }

.brand {
  position: fixed; left: 28px; bottom: 24px; z-index: 5;
  font-family: var(--mono); font-size: 11px; letter-spacing: .28em; text-transform: uppercase;
  color: rgba(227, 241, 255, .28);
}
#langBtn {
  position: fixed; top: 22px; right: 24px; z-index: 6;
  font: 500 12px/1 var(--mono); letter-spacing: .12em;
  color: var(--dim); background: rgba(5, 11, 24, .4);
  border: 1px solid var(--rule); border-radius: 999px; padding: 8px 14px;
  cursor: pointer; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: color .3s, border-color .3s;
}
#langBtn:hover { color: var(--ink); border-color: rgba(166, 220, 255, .45); }

/* ── scrolling copy ── */
main { position: relative; z-index: 2; }
/* two screens per section with a one-screen sticky copy: each stage stays pinned for a full
   screen of scrolling before it moves on */
section { position: relative; min-height: 200svh; }
section.s-layers { min-height: 300svh; }
/* chapters: 1.5 screens — the copy holds half a screen, then scrolls out while the camera flies on */
section.s-chapter { min-height: 150svh; }
/* the hero is one screen and never pinned: the first scroll already moves the title */
section.s-hero { min-height: 100svh; }

.copy {
  position: sticky; top: 0;
  height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  max-width: 720px;
  padding: 0 24px 0 8vw;
  opacity: 0; transform: translateY(28px);
  transition: opacity .9s cubic-bezier(.2, .7, .2, 1), transform .9s cubic-bezier(.2, .7, .2, 1);
}
section.on .copy { opacity: 1; transform: none; }

.label {
  font-family: var(--mono); font-size: 11px; letter-spacing: .28em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 18px;
}
h1 {
  font-size: clamp(1.9rem, 4.4vw, 3.2rem); font-weight: 300; letter-spacing: .02em; line-height: 1.35;
  color: var(--ink);
}
h2 {
  font-size: clamp(1.45rem, 2.8vw, 2.1rem); font-weight: 400; letter-spacing: .01em; line-height: 1.4;
  color: var(--ink); margin-bottom: 18px;
}
/* Chinese section titles stay on one line on desktop: a touch smaller, no wrapping */
@media (min-width: 900px) {
  html:lang(zh-CN) .copy h2 { font-size: clamp(1.4rem, 2.15vw, 1.9rem); white-space: nowrap; }
}
.copy p {
  font-size: clamp(.95rem, 1.15vw, 1.05rem); line-height: 1.9; letter-spacing: .02em;
  color: #9fb4cb; max-width: 46ch;
}
.copy p strong { color: var(--acc); font-weight: 500; }

.demo-btn {
  margin-top: 26px; align-self: flex-start;
  font: 500 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--acc); background: rgba(166, 220, 255, .06); border: 1px solid rgba(166, 220, 255, .35); border-radius: 999px;
  padding: 11px 18px; cursor: pointer; transition: background .3s, border-color .3s;
}
.demo-btn:hover { background: rgba(166, 220, 255, .14); border-color: var(--acc); }
.demo-btn[disabled] { color: var(--dim); border-color: var(--rule); background: transparent; cursor: default; }
body.demo-open { overflow: hidden; }

.s-hero .copy { max-width: 760px; }
.hint {
  margin-top: 56px; font-family: var(--mono); font-size: 11px; letter-spacing: .3em; text-transform: uppercase;
  color: rgba(227, 241, 255, .35);
  animation: hint 3.6s ease-in-out infinite;
}
.hint::after { content: ""; display: block; width: 1px; height: 36px; margin-top: 14px; background: linear-gradient(rgba(227,241,255,.5), transparent); }
@keyframes hint { 0%, 100% { opacity: .35; } 50% { opacity: .9; } }

.s-end .copy { max-width: 860px; }
section.s-end { min-height: 300svh; }   /* pinned two screens: the tail panel slides over the second */
.answer { font-size: clamp(1.8rem, 3.6vw, 2.8rem); font-weight: 300; }
.answer em { font-style: normal; font-weight: 500; color: var(--gold); }
.result { font-size: clamp(1.05rem, 1.6vw, 1.3rem) !important; color: var(--acc) !important; margin-bottom: 22px; letter-spacing: .02em; }
.answer-sub { margin-top: 18px; color: #b9cde3 !important; }
.contact { margin-top: 28px; font-family: var(--mono); font-size: 13px; letter-spacing: .06em; color: var(--dim) !important; }
.contact a { color: var(--acc); text-decoration: none; border-bottom: 1px solid rgba(166, 220, 255, .3); transition: border-color .3s; }
.contact a:hover { border-color: var(--acc); }

/* ── stage 2: exploded UI layers ── */
#layers {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  display: grid; place-items: center;
  perspective: 1600px; perspective-origin: 50% 40%;
  opacity: 0; transition: opacity .4s;
}
#layers.show { opacity: 1; }
#layers .stage {
  position: relative; width: 1040px; height: 620px;
  transform-style: preserve-3d;
  transform: translateX(19vw) translateY(-4vh) scale(.9) rotateX(58deg) rotateZ(-45deg);
}
.layer {
  position: absolute; will-change: transform, opacity; opacity: 0;
  background: rgba(10, 20, 36, .88);
  border: 1px solid rgba(166, 220, 255, .16);
  border-top-color: rgba(166, 220, 255, .32);
  border-radius: 14px;
  box-shadow: 0 60px 90px rgba(0, 0, 0, .55), 0 0 0 1px rgba(0, 0, 0, .3);
  color: #b9cde3; font-size: 12px; line-height: 1.5;
  overflow: hidden;
  backface-visibility: hidden;
}
.layer.nav { left: 0; top: 30px; width: 168px; height: 560px; padding: 18px 12px; }
.layer.list { left: 220px; top: 60px; width: 300px; height: 520px; padding: 16px; }
.layer.main { left: 560px; top: 90px; width: 470px; height: 470px; padding: 18px 20px; }

.brandrow { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--ink); margin: 2px 6px 18px; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: var(--acc); color: #06101f; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.layer.nav ul { list-style: none; }
.layer.nav li { padding: 7px 10px; border-radius: 7px; color: #8fa6c2; display: flex; align-items: center; gap: 9px; }
.layer.nav li::before { content: ""; width: 10px; height: 10px; border-radius: 3px; border: 1px solid #4b6684; }
.layer.nav li.cur { background: rgba(166, 220, 255, .12); color: var(--ink); }
.layer.nav li.cur::before { background: var(--acc); border-color: var(--acc); }
.layer.nav li.grp { margin-top: 10px; font-size: 10px; letter-spacing: .2em; color: #4f6784; }
.layer.nav li.grp::before { display: none; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs span { padding: 5px 10px; border-radius: 999px; font-size: 11px; color: #8fa6c2; background: rgba(255,255,255,.04); }
.tabs span.cur { background: rgba(166, 220, 255, .14); color: var(--ink); }
.search { padding: 7px 10px; border-radius: 8px; border: 1px solid rgba(166,220,255,.14); color: #4f6784; font-size: 11px; margin-bottom: 10px; }
.rows .row { padding: 9px 8px; border-radius: 8px; border-bottom: 1px solid rgba(166,220,255,.07); }
.rows .row b { display: block; font-weight: 500; color: var(--ink); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .row span { display: block; color: #6f88a5; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rows .row.cur { background: rgba(166, 220, 255, .09); }

.layer.main .head { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); padding-bottom: 12px; border-bottom: 1px solid rgba(166,220,255,.1); margin-bottom: 14px; }
.layer.main .dot { width: 8px; height: 8px; border-radius: 50%; background: #63d9a0; box-shadow: 0 0 10px #63d9a0; }
.msg { margin-bottom: 12px; max-width: 88%; }
.msg.bot p { color: #b9cde3; }
.msg.me { margin-left: auto; text-align: right; }
.msg.me span { display: inline-block; background: rgba(166, 220, 255, .16); color: var(--ink); padding: 7px 14px; border-radius: 14px 14px 4px 14px; }
.card { border: 1px solid rgba(232, 207, 143, .35); border-left: 3px solid var(--gold); border-radius: 10px; padding: 10px 12px; background: rgba(232, 207, 143, .05); }
.card b { display: block; color: var(--gold); font-weight: 500; margin-bottom: 4px; }
.card p { margin-top: 4px; }
.card .sug { color: var(--ink); }

/* ── top-right Blog link: visible only at the very top ── */
#blogLink {
  position: fixed; top: 22px; right: 96px; z-index: 6;
  font: 500 12px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; text-decoration: none;
  color: var(--dim); background: rgba(5, 11, 24, .4); border: 1px solid var(--rule); border-radius: 999px; padding: 8px 14px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: color .3s, border-color .3s, opacity .35s;
}
#blogLink:hover { color: var(--ink); border-color: rgba(166, 220, 255, .45); }
#blogLink.hide { opacity: 0; pointer-events: none; }

/* ── tail: slides up over the pinned finale ── */
section.s-tail { min-height: 100svh; margin-top: -100svh; z-index: 3; display: flex; align-items: flex-end; pointer-events: none; }
.tail-panel {
  pointer-events: auto; width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 28px 36px;
  background: rgba(5, 11, 24, .82); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(166, 220, 255, .16); border-bottom: 0; border-radius: 22px 22px 0 0;
  box-shadow: 0 -30px 80px rgba(0, 0, 0, .45);
}
.tail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.tail-head .label { margin: 0; }
.tail-head::after { content: ""; flex: 1; height: 1px; background: var(--rule); }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.tile { display: flex; flex-direction: row; align-items: stretch; gap: 16px; padding: 16px; border: 1px solid var(--rule); border-radius: 16px; background: rgba(10, 32, 56, .45); color: inherit; text-decoration: none; transition: border-color .2s, transform .2s; }
.tile-text { display: flex; flex-direction: column; gap: 8px; min-width: 0; flex: 1; }
.tile:hover { border-color: var(--acc); transform: translateY(-2px); }
.tile .eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--dim); }
.tile .meta { display: flex; align-items: center; gap: 10px; }
.tile .chip { font-family: var(--mono); font-size: 10px; letter-spacing: .2em; text-transform: uppercase; padding: 3px 9px; border: 1px solid rgba(232, 207, 143, .45); border-radius: 999px; color: var(--gold); }
.tile .chip:empty { display: none; }
.tile time { font-family: var(--mono); font-size: 11px; letter-spacing: .12em; color: var(--dim); }
.tile h3 { font-size: clamp(1.1rem, 1.6vw, 1.35rem); font-weight: 400; line-height: 1.4; color: var(--ink); }
.tile p { color: #9fb4cb; font-size: .92rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .go { margin-top: auto; font-family: var(--mono); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--acc); }
.tile .pv { position: relative; width: 200px; flex: none; align-self: center; aspect-ratio: 16 / 10; border-radius: 10px; overflow: hidden; background: linear-gradient(135deg, #0a1a33, #071226 60%, #0c2240); border: 1px solid rgba(120, 190, 255, .12); }
.tile .pv::before { content: attr(data-letter); position: absolute; inset: 0; display: grid; place-items: center; font-size: 56px; font-weight: 200; color: rgba(166, 220, 255, .18); }
.tile .pv iframe { position: absolute; left: 0; top: 0; width: 1280px; height: 800px; border: 0; transform-origin: 0 0; pointer-events: none; opacity: 0; transition: opacity .6s; background: var(--bg); }
.tile .pv iframe.in { opacity: 1; }

/* ── mobile ── */
@media (max-width: 767px), (pointer: coarse) and (max-width: 1024px) {
  .copy {
    max-width: none; justify-content: flex-end;
    padding: 0 20px 14svh;
    /* fade out at the bottom too: the panel is exactly one screen tall, so a solid bottom edge
       shows up as a hard line sliding over the next section while scrolling */
    background: linear-gradient(transparent 35%, rgba(5, 11, 24, .82) 62%, rgba(5, 11, 24, .92) 86%, transparent 100%);
  }
  .s-hero .copy { justify-content: center; background: none; text-shadow: 0 2px 24px rgba(5, 11, 24, .9), 0 0 6px rgba(5, 11, 24, .8); }
  .copy p { max-width: none; }
  .hint { margin-top: 40px; }
  .brand { left: 20px; bottom: 16px; }
  #langBtn { top: 14px; right: 14px; }
  #blogLink { top: 14px; right: 84px; }
  .tiles { grid-template-columns: 1fr; gap: 12px; }
  .tail-panel { padding: 16px 16px 24px; border-radius: 18px 18px 0 0; }
  .tile .pv { display: none; }
  /* the panel takes the bottom third, so the finale copy sits above it */
  .s-end .copy { justify-content: center; padding-bottom: 36svh; }
  #layers { perspective: 1100px; perspective-origin: 50% 30%; }
  /* phones: pull the three layers closer together, scale the stage by viewport width and
     keep it centred above the copy (the copy takes the bottom ~45% of the screen) */
  /* more upright on phones (48° instead of 58°) so the panels read taller and clearer */
  #layers .stage { transform: translate(var(--stage-dx, -18vw), var(--stage-dy, -22svh)) scale(var(--stage-scale, .45)) rotateX(48deg) rotateZ(-45deg); }
  .layer.list { left: 150px; top: 40px; }
  .layer.main { left: 380px; top: 70px; width: 440px; }
}

@media (prefers-reduced-motion: reduce) {
  .copy, #layers, .layer { transition: none; }
  .hint { animation: none; }
}
