:root {
  --bg: #050507;
  --fg: #f2f2f5;
  --blue: #4d7cff;
  --dim: rgba(255, 255, 255, 0.55);
  --font-display: "Unbounded", sans-serif;
  --font-body: "Inter", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { background: var(--bg); color: var(--fg); font-family: var(--font-body); overscroll-behavior: none; }
body { overflow: hidden; } /* ScrollSmoother 接管 */

a { color: inherit; text-decoration: none; }
button { background: none; border: none; color: inherit; cursor: pointer; font: inherit; }

/* ===== Preloader ===== */
#preloader { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; }
.pre-curtain { position: absolute; inset: 0; background: #0a0a0d; }
.pre-curtain.c2 { background: #050507; }
.pre-inner { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 24px; }
.pre-mark .pre-circle { stroke-dasharray: 214; stroke-dashoffset: 214; opacity: 0.9; }
.pre-n { font-family: var(--font-display); font-weight: 900; font-size: 34px; fill: var(--fg); opacity: 0; }
.pre-percent { font-family: var(--font-display); font-weight: 300; font-size: 15px; letter-spacing: 0.35em; color: var(--dim); }

/* ===== Canvas & grain ===== */
#webgl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
#grain { position: fixed; inset: -50%; z-index: 1; pointer-events: none; opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 0.9s steps(4) infinite; }
@keyframes grainShift { 0%{transform:translate(0,0)} 25%{transform:translate(-2%,3%)} 50%{transform:translate(3%,-2%)} 75%{transform:translate(-3%,-3%)} 100%{transform:translate(2%,2%)} }

/* ===== Header ===== */
#siteHeader { position: fixed; top: 0; left: 0; width: 100%; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px 40px; transform: translateY(-110%);
  transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1); }
#siteHeader.show { transform: translateY(0); }
.logo-text { font-family: var(--font-display); font-weight: 900; font-size: 26px; fill: var(--fg); letter-spacing: 0.06em; }
.top-links { display: flex; gap: 34px; }
.top-links a { font-size: 13px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--dim); transition: color 0.3s; }
.top-links a:hover { color: var(--blue); }
.header-right { display: flex; align-items: center; gap: 26px; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; color: var(--fg); opacity: 0.85; transition: opacity 0.3s; }
.icon-btn:hover { opacity: 1; }

.mail-link { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600;
  letter-spacing: 0.06em; text-transform: uppercase; }
.mail-link .arrow-stack { position: relative; width: 16px; height: 16px; overflow: hidden; display: inline-block; }
.mail-link .arrow-1, .mail-link .arrow-2 { position: absolute; inset: 0; transition: transform 0.35s cubic-bezier(0.65, 0, 0.35, 1); }
.mail-link .arrow-2 { transform: translate(-160%, 160%); }
.mail-link:hover { color: var(--blue); }
.mail-link:hover .arrow-1 { transform: translate(160%, -160%); }
.mail-link:hover .arrow-2 { transform: translate(0, 0); }
.mail-link.big { font-size: 16px; border: 1px solid rgba(255,255,255,0.25); border-radius: 999px; padding: 14px 28px; margin-top: 26px; transition: border-color .3s, color .3s; }
.mail-link.big:hover { border-color: var(--blue); }

/* 菜单九宫格（复刻 cube 菜单动画） */
.menu-cubes { display: grid; grid-template-columns: repeat(3, 6px); grid-auto-rows: 6px; gap: 4px; padding: 6px; }
.menu-cubes .cube { width: 6px; height: 6px; background: var(--fg); border-radius: 1px;
  transition: transform 0.45s cubic-bezier(0.65, 0, 0.35, 1), background 0.3s; }
.menu-cubes:hover .cube { background: var(--blue); }
.menu-cubes:hover .c2 { transform: translate(100%, 100%); }
.menu-cubes:hover .c4 { transform: translate(100%, -100%); }
.menu-cubes:hover .c6 { transform: translate(-100%, 100%); }
.menu-cubes:hover .c8 { transform: translate(-100%, -100%); }

/* ===== Captions ===== */
#captions { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.caption { position: absolute; left: 8vw; bottom: 12vh; max-width: 560px; opacity: 0; visibility: hidden; }
.caption.right { left: auto; right: 8vw; text-align: right; }
.caption.center { left: 50%; right: auto; bottom: 50%; transform: translate(-50%, 50%); text-align: center; }
.caption .display { font-family: var(--font-display); font-weight: 900; font-size: clamp(44px, 7.5vw, 110px);
  line-height: 0.98; letter-spacing: -0.01em; }
.caption .display.sm { font-size: clamp(34px, 5.5vw, 76px); }
.caption .sub { margin-top: 20px; font-size: 15px; line-height: 1.7; color: var(--dim); max-width: 420px; }
.caption.right .sub { margin-left: auto; }
.caption.center .sub { margin-left: auto; margin-right: auto; }
.caption a { pointer-events: auto; }
.get-started { margin-top: 34px; display: inline-flex; align-items: center; gap: 10px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--fg); }
.get-started svg { animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(7px)} }

/* ===== HUD ===== */
#hud { position: fixed; z-index: 40; left: 24px; right: 24px; bottom: 20px;
  display: flex; align-items: center; gap: 18px; opacity: 0; transition: opacity .6s; }
#hud.show { opacity: 1; }
#fpsMeter { font-size: 11px; letter-spacing: 0.12em; color: var(--dim); font-variant-numeric: tabular-nums; min-width: 58px; }
#progressBar { flex: 1; height: 1px; background: rgba(255,255,255,0.14); }
#progressBar i { display: block; height: 100%; width: 0%; background: var(--blue); transition: width 0.1s linear; }
#debugToggle { font-size: 16px; opacity: 0.7; transition: opacity .3s, transform .3s; }
#debugToggle:hover { opacity: 1; transform: rotate(40deg); }

/* ===== Debug panel ===== */
#debugPanel { position: fixed; right: 18px; bottom: 60px; z-index: 60; width: 260px;
  background: rgba(12, 12, 16, 0.92); backdrop-filter: blur(14px);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 12px;
  font-size: 12px; transform: translateY(12px); opacity: 0; visibility: hidden;
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
#debugPanel.open { transform: translateY(0); opacity: 1; visibility: visible; }
.dp-head { display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid rgba(255,255,255,0.08);
  font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; font-size: 11px; }
.dp-head button { font-size: 16px; opacity: 0.6; }
.dp-head button:hover { opacity: 1; }
.dp-body { padding: 12px 14px 16px; max-height: 56vh; overflow-y: auto; }
.dp-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; color: var(--dim); }
.dp-row.col { flex-direction: column; align-items: stretch; gap: 5px; }
.dp-row span { color: var(--fg); font-variant-numeric: tabular-nums; }
.dp-sep { margin: 12px 0 6px; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--blue); }
.dp-row select { background: #1a1a22; color: var(--fg); border: 1px solid rgba(255,255,255,0.12); border-radius: 6px; padding: 4px 6px; font-size: 12px; }
.dp-row input[type="range"] { width: 100%; accent-color: var(--blue); }
.dp-row input[type="checkbox"] { accent-color: var(--blue); width: 14px; height: 14px; }

/* ===== Scroll space（1700vh，同原站） ===== */
#smooth-wrapper { position: relative; z-index: 5; }
.scroll-space { height: 1700vh; }

@media (max-width: 720px) {
  #siteHeader { padding: 18px 20px; }
  .top-links { display: none; }
  .caption, .caption.right { left: 6vw; right: 6vw; text-align: left; }
  .caption .sub { font-size: 14px; }
  #debugPanel { width: calc(100vw - 36px); }
}
