/* ============================================================
   字宙 ZIYU — a small universe for your words.
   Type: Instrument Serif / Space Grotesk, locally hosted.
   ============================================================ */

@font-face {
  font-family: "Instrument Serif";
  src: url("assets/fonts/instrument-serif.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("assets/fonts/instrument-serif-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("assets/fonts/space-grotesk.woff2") format("woff2");
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --ink: #04060a;
  --ink-soft: #0a0d14;
  --paper: #f4efe4;
  --paper-dim: rgba(244, 239, 228, 0.58);
  --paper-faint: rgba(244, 239, 228, 0.34);
  --line: rgba(244, 239, 228, 0.13);
  --line-soft: rgba(244, 239, 228, 0.07);
  --accent: #f2c66d;
  --accent-rgb: 242, 198, 109;
  --glow: rgba(242, 198, 109, 0.16);
  --font-display: "Instrument Serif", "Songti SC", "STSong", "SimSun", serif;
  --font-ui: "Space Grotesk", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --font-mono: "SFMono-Regular", "Cascadia Mono", "Consolas", "Liberation Mono", monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dock-h: 72px;
}

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

html {
  background: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  padding: 0;
  background: none;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: 4px;
}

::selection {
  color: var(--ink);
  background: var(--accent);
}

svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 24px;
  z-index: 100;
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 12px;
  text-decoration: none;
  transition: top 0.25s var(--ease-out);
}

.skip-link:focus {
  top: 18px;
}

/* ---------- backdrop ---------- */

.cosmos {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #04060a;
  pointer-events: none;
}

.nebula {
  position: absolute;
  inset: -5%;
  background: url("assets/nebula.jpg") center / cover no-repeat;
  opacity: 0.92;
  transform: scale(1.04);
  animation: nebula-drift 48s ease-in-out infinite alternate;
  will-change: transform;
}

.glow {
  position: absolute;
  top: 42%;
  left: 50%;
  width: min(88vw, 1080px);
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--glow) 0%, rgba(var(--accent-rgb), 0.045) 38%, transparent 68%);
  filter: blur(22px);
  animation: glow-breathe 9s ease-in-out infinite;
  transition: background 0.9s ease;
  will-change: transform, opacity;
}

.vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 40%, transparent 30%, rgba(2, 3, 6, 0.32) 74%, rgba(2, 3, 6, 0.76) 100%),
    linear-gradient(to bottom, rgba(2, 3, 6, 0.35), transparent 22%, transparent 70%, rgba(2, 3, 6, 0.5));
}

.grain {
  position: absolute;
  inset: 0;
  background-image: url("assets/grain.png");
  background-size: 160px 160px;
  opacity: 0.055;
  mix-blend-mode: soft-light;
}

@keyframes nebula-drift {
  from { transform: scale(1.04) translate3d(-0.6%, -0.4%, 0); }
  to { transform: scale(1.1) translate3d(0.8%, 0.6%, 0); }
}

@keyframes glow-breathe {
  0%, 100% { opacity: 0.7; transform: translate(-50%, -50%) scale(0.96); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.06); }
}

/* ---------- structure ---------- */

.frame {
  position: fixed;
  inset: 16px;
  z-index: 25;
  border: 1px solid var(--line-soft);
  pointer-events: none;
}

.corner {
  position: absolute;
  width: 13px;
  height: 13px;
  border-color: rgba(244, 239, 228, 0.28);
  border-style: solid;
}

.corner--tl { top: -1px; left: -1px; border-width: 1px 0 0 1px; }
.corner--tr { top: -1px; right: -1px; border-width: 1px 1px 0 0; }
.corner--bl { bottom: -1px; left: -1px; border-width: 0 0 1px 1px; }
.corner--br { bottom: -1px; right: -1px; border-width: 0 1px 1px 0; }

.orbit {
  position: fixed;
  top: 42%;
  left: 50%;
  z-index: 1;
  width: min(76vw, 1060px);
  height: min(29vw, 405px);
  border: 1px solid rgba(244, 239, 228, 0.1);
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(-8deg);
  pointer-events: none;
  animation: orbit-float 16s ease-in-out infinite alternate;
}

.orbit::before {
  content: "";
  position: absolute;
  inset: 8%;
  border: 1px dashed rgba(244, 239, 228, 0.06);
  border-radius: 50%;
}

.orbit__dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 14px rgba(var(--accent-rgb), 0.8);
  transform: translate(-50%, -50%);
}

.orbit__tick {
  position: absolute;
  background: rgba(244, 239, 228, 0.2);
}

.orbit__tick--a {
  top: -3px;
  left: 50%;
  width: 1px;
  height: 6px;
}

.orbit__tick--b {
  top: 50%;
  right: -3px;
  width: 6px;
  height: 1px;
}

.orbit__label {
  position: absolute;
  right: 7%;
  bottom: -22px;
  color: var(--paper-faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.18em;
  transform: rotate(8deg);
  white-space: nowrap;
}

@keyframes orbit-float {
  from { transform: translate(-50%, -50%) rotate(-9.5deg) scale(0.985); }
  to { transform: translate(-50%, -50%) rotate(-6.5deg) scale(1.015); }
}

#sky {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: manipulation;
}

@media (pointer: fine) {
  #sky { cursor: none; }
}

/* ---------- top bar ---------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 42px;
  pointer-events: none;
}

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--paper);
  text-decoration: none;
}

.brand__mark {
  width: 29px;
  height: 29px;
  color: var(--accent);
  transition: transform 0.8s var(--ease-out);
}

.brand:hover .brand__mark {
  transform: rotate(22deg);
}

.brand__name {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.16em;
}

.brand__meta {
  margin-left: 3px;
  padding-left: 13px;
  border-left: 1px solid var(--line);
  color: var(--paper-faint);
  font-family: var(--font-mono);
  font-size: 7px;
  line-height: 1.55;
  letter-spacing: 0.18em;
}

.topbar__note {
  position: absolute;
  left: 50%;
  margin: 0;
  color: var(--paper-faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.2em;
  transform: translateX(-50%);
}

.topbar__note span {
  margin: 0 8px;
  color: rgba(var(--accent-rgb), 0.6);
}

.topbar__tools {
  display: flex;
  align-items: center;
  gap: 21px;
}

.icon-btn {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--paper-dim);
  transition: color 0.25s, border-color 0.25s, background 0.25s;
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

.icon-btn:hover {
  border-color: var(--line);
  color: var(--paper);
  background: rgba(255, 255, 255, 0.03);
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--paper-dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  transition: color 0.25s;
}

.text-btn:hover {
  color: var(--paper);
}

.text-btn__label {
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.text-btn__state {
  color: var(--paper-faint);
  font-size: 8px;
  transition: color 0.25s;
}

.text-btn__index {
  color: var(--paper-faint);
  font-size: 8px;
}

body.sound-on .text-btn__state {
  color: var(--accent);
}

.eq {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 11px;
}

.eq i {
  display: block;
  width: 1.5px;
  height: 3px;
  border-radius: 2px;
  background: currentColor;
  transition: height 0.3s var(--ease-out);
}

.eq i:nth-child(2) { height: 7px; }
.eq i:nth-child(3) { height: 4px; }
.eq i:nth-child(4) { height: 9px; }

body.sound-on .eq i {
  animation: eq-dance 0.85s ease-in-out infinite alternate;
}

body.sound-on .eq i:nth-child(2) { animation-delay: -0.3s; }
body.sound-on .eq i:nth-child(3) { animation-delay: -0.55s; }
body.sound-on .eq i:nth-child(4) { animation-delay: -0.15s; }

@keyframes eq-dance {
  from { height: 2px; }
  to { height: 11px; }
}

/* ---------- side rails ---------- */

.rail {
  position: fixed;
  top: 50%;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  pointer-events: none;
}

.rail--left {
  left: 39px;
  transform: translateY(-50%);
}

.rail__index {
  color: var(--paper-faint);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.rail__line {
  width: 1px;
  height: 56px;
  background: linear-gradient(to bottom, var(--line), transparent);
}

.rail__text {
  color: var(--paper-faint);
  font-size: 9px;
  letter-spacing: 0.48em;
  writing-mode: vertical-rl;
  text-orientation: upright;
}

.spectrum {
  position: fixed;
  top: 50%;
  right: 40px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  transform: translateY(-50%);
}

.spectrum__label,
.spectrum__name {
  color: var(--paper-faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.22em;
  writing-mode: vertical-rl;
}

.spectrum__name {
  color: rgba(var(--accent-rgb), 0.75);
  letter-spacing: 0.16em;
}

.swatches {
  display: flex;
  align-items: center;
  gap: 9px;
}

.spectrum .swatches {
  flex-direction: column;
  gap: 11px;
  padding: 12px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.swatch {
  position: relative;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
}

.swatch span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s;
}

.swatch:hover span {
  transform: scale(1.35);
}

.swatch.is-active span {
  transform: scale(1.22);
  box-shadow: 0 0 0 1px rgba(244, 239, 228, 0.5), 0 0 12px rgba(255, 255, 255, 0.18);
}

.swatch--mobile {
  display: none;
}

/* ---------- hero caption ---------- */

.hero {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
}

.hero__caption {
  position: absolute;
  top: 69%;
  right: 0;
  left: 0;
  width: min(92vw, 900px);
  margin: 0 auto;
  text-align: center;
}

.hero__line {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(26px, 2.75vw, 40px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.hero__line em {
  color: var(--accent);
  font-style: italic;
  transition: color 0.8s ease;
}

.hero__cn {
  margin: 14px 0 0;
  padding-left: 0.52em;
  color: var(--paper-dim);
  font-size: 10px;
  letter-spacing: 0.52em;
}

.try {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-top: 21px;
  color: rgba(244, 239, 228, 0.5);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.try__label {
  color: rgba(244, 239, 228, 0.36);
  font-size: 8px;
  letter-spacing: 0.22em;
}

.try button {
  position: relative;
  padding: 2px 0;
  color: var(--paper-dim);
  font-size: 10px;
  letter-spacing: 0.06em;
  pointer-events: auto;
  transition: color 0.25s;
}

.try button::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -2px;
  left: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.4s var(--ease-out);
}

.try button:hover {
  color: var(--paper);
}

.try button:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

.telemetry {
  position: absolute;
  bottom: 35px;
  left: 42px;
  display: flex;
  gap: 32px;
  margin: 0;
}

.telemetry div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.telemetry dt {
  color: var(--paper-faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.16em;
}

.telemetry dd {
  margin: 0;
  color: var(--paper-dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.hint {
  position: fixed;
  right: 0;
  bottom: 111px;
  left: 0;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 0;
  color: rgba(244, 239, 228, 0.38);
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 0.16em;
  pointer-events: none;
}

.hint__sep {
  width: 18px;
  height: 1px;
  background: var(--line);
}

/* ---------- dock ---------- */

.dock-wrap {
  position: fixed;
  right: 0;
  bottom: max(30px, env(safe-area-inset-bottom));
  left: 0;
  z-index: 45;
  display: flex;
  justify-content: center;
  padding: 0 24px;
  pointer-events: none;
}

.dock {
  display: flex;
  align-items: center;
  width: min(760px, 100%);
  min-height: 64px;
  padding: 8px;
  border: 1px solid rgba(244, 239, 228, 0.14);
  border-radius: 999px;
  background: rgba(9, 11, 17, 0.64);
  box-shadow:
    0 25px 80px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(22px) saturate(1.15);
  -webkit-backdrop-filter: blur(22px) saturate(1.15);
  pointer-events: auto;
}

.field {
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
  padding: 3px 4px 3px 16px;
  border-radius: 999px;
  transition: background 0.3s, box-shadow 0.3s;
}

.field:focus-within {
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.2);
}

.field.is-shaking {
  animation: field-shake 0.4s ease both;
}

@keyframes field-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

[hidden] {
  display: none !important;
}

.field__spark {
  flex: 0 0 auto;
  margin-right: 11px;
  color: var(--accent);
  font-size: 11px;
  animation: spark-pulse 3.6s ease-in-out infinite;
}

@keyframes spark-pulse {
  0%, 100% { opacity: 0.5; transform: scale(0.85) rotate(0deg); }
  50% { opacity: 1; transform: scale(1.05) rotate(45deg); }
}

.field input {
  width: 100%;
  min-width: 0;
  padding: 11px 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.045em;
  caret-color: var(--accent);
}

.field input::placeholder {
  color: rgba(244, 239, 228, 0.3);
  letter-spacing: 0.03em;
}

.field__submit {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #130f08;
  transition: transform 0.4s var(--ease-out), background 0.6s;
}

.field__submit svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.7;
}

.field__submit:hover {
  transform: scale(1.07) rotate(-4deg);
}

.field__submit:active {
  transform: scale(0.94);
}

.dock__divider {
  flex: 0 0 auto;
  width: 1px;
  height: 26px;
  margin: 0 12px;
  background: var(--line);
}

.dock__tools {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 3px;
  padding-right: 3px;
}

.tool {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 11px;
  border-radius: 999px;
  color: var(--paper-dim);
  font-family: var(--font-ui);
  font-size: 11px;
  letter-spacing: 0.03em;
  transition: color 0.25s, background 0.25s;
}

.tool svg {
  width: 15px;
  height: 15px;
}

.tool:hover {
  color: var(--paper);
  background: rgba(255, 255, 255, 0.045);
}

.swatches--dock {
  display: none;
  margin-right: 8px;
}

.swatches--dock .swatch {
  width: 18px;
  height: 18px;
}

.swatches--dock .swatch span {
  width: 8px;
  height: 8px;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  top: 88px;
  left: 50%;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100vw - 40px);
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 12, 18, 0.82);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  color: var(--paper-dim);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition: opacity 0.35s, transform 0.35s var(--ease-out);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.toast::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(var(--accent-rgb), 0.8);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  width: min(610px, calc(100vw - 36px));
  max-height: min(88svh, 780px);
  margin: auto;
  padding: 0;
  border: 1px solid rgba(244, 239, 228, 0.14);
  border-radius: 24px;
  background: rgba(9, 11, 17, 0.9);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.65);
  color: var(--paper);
  overflow: auto;
  overscroll-behavior: contain;
  backdrop-filter: blur(30px) saturate(1.1);
  -webkit-backdrop-filter: blur(30px) saturate(1.1);
}

.modal[open] {
  animation: modal-in 0.45s var(--ease-out) both;
}

.modal::backdrop {
  background: rgba(2, 3, 6, 0.68);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.modal[open]::backdrop {
  animation: backdrop-in 0.4s ease both;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal__inner {
  position: relative;
  padding: 44px 46px 34px;
}

.modal__close {
  position: absolute;
  top: 20px;
  right: 20px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--paper-dim);
  transition: color 0.25s, border-color 0.25s, transform 0.35s var(--ease-out);
}

.modal__close:hover {
  border-color: rgba(244, 239, 228, 0.34);
  color: var(--paper);
  transform: rotate(90deg);
}

.modal__close svg {
  width: 14px;
  height: 14px;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.22em;
}

.modal h2 {
  margin: 0 0 22px;
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 50px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
}

.modal h2 em {
  color: var(--accent);
  font-style: italic;
}

.modal__body {
  display: grid;
  gap: 13px;
  max-width: 47ch;
}

.modal__body p {
  margin: 0;
  color: var(--paper-dim);
  font-size: 13px;
  line-height: 1.85;
  letter-spacing: 0.015em;
}

.modal__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 26px 0;
  padding: 18px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.modal__stats div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.modal__stats span {
  color: var(--paper-faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.16em;
}

.modal__stats b {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-decoration: none;
  transition: transform 0.3s var(--ease-out), background 0.25s, border-color 0.25s;
}

.button svg {
  width: 15px;
  height: 15px;
}

.button:hover {
  transform: translateY(-2px);
}

.button--light {
  background: var(--paper);
  color: var(--ink);
}

.button--light:hover {
  background: #fffaf0;
}

.button--ghost {
  border: 1px solid var(--line);
  color: var(--paper-dim);
}

.button--ghost:hover {
  border-color: rgba(244, 239, 228, 0.3);
  color: var(--paper);
}

.modal__credit {
  margin: 30px 0 0;
  color: var(--paper-faint);
  font-family: var(--font-mono);
  font-size: 7px;
  letter-spacing: 0.16em;
}

/* ---------- noscript ---------- */

.noscript {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 30px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  line-height: 1.8;
  text-align: center;
}

/* ---------- intro states ---------- */

body:not(.is-ready) .topbar,
body:not(.is-ready) .rail,
body:not(.is-ready) .spectrum,
body:not(.is-ready) .hero__caption,
body:not(.is-ready) .telemetry,
body:not(.is-ready) .hint,
body:not(.is-ready) .dock-wrap,
body:not(.is-ready) .orbit {
  opacity: 0;
}

body.is-ready .topbar { animation: fade-in 1s 0.15s both; }
body.is-ready .orbit { animation: fade-in 1.6s 0.05s both, orbit-float 16s ease-in-out infinite alternate; }
body.is-ready .rail { animation: fade-in 1.2s 0.45s both; }
body.is-ready .spectrum { animation: fade-in 1.2s 0.55s both; }
body.is-ready .hero__caption { animation: fade-up 1.2s 0.75s both; }
body.is-ready .telemetry { animation: fade-in 1.2s 1s both; }
body.is-ready .hint { animation: fade-in 1s 1.25s both; }
body.is-ready .dock-wrap { animation: fade-up 1.1s 0.55s both; }

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- responsive ---------- */

@media (max-width: 1280px) {
  .telemetry { display: none; }
  .topbar__note { display: none; }
}

@media (max-width: 1040px) {
  .rail { display: none; }
  .spectrum { display: none; }
  .swatches--dock { display: flex; }
  .topbar { padding: 28px 30px; }
  .dock { max-width: 690px; }
}

@media (max-width: 720px) {
  .frame { inset: 10px; }
  .corner { width: 10px; height: 10px; }
  .topbar {
    padding: max(18px, env(safe-area-inset-top)) 18px 0;
  }
  .brand { gap: 8px; }
  .brand__mark { width: 24px; height: 24px; }
  .brand__name { font-size: 15px; }
  .brand__meta { display: none; }
  .topbar__tools { gap: 13px; }
  #fullscreenBtn { display: none; }
  .text-btn__state { font-size: 9px; }
  .text-btn { gap: 6px; }
  .text-btn__index { display: none; }
  .orbit {
    top: 37%;
    width: 132vw;
    height: 52vw;
    opacity: 0.8;
  }
  .orbit__label { display: none; }
  .hero__caption {
    top: 59.5%;
    width: calc(100vw - 40px);
  }
  .hero__line {
    font-size: clamp(25px, 7.2vw, 34px);
    line-height: 1.04;
  }
  .hero__cn {
    margin-top: 11px;
    font-size: 9px;
    letter-spacing: 0.42em;
  }
  .try {
    gap: 12px;
    margin-top: 17px;
    font-size: 8px;
  }
  .try__label { display: none; }
  .try button { font-size: 10px; }
  .hint {
    bottom: 143px;
    gap: 10px;
    font-size: 7px;
    letter-spacing: 0.1em;
  }
  .hint__sep { width: 12px; }
  .dock-wrap {
    bottom: max(14px, env(safe-area-inset-bottom));
    padding: 0 12px;
  }
  .dock {
    flex-wrap: wrap;
    width: 100%;
    min-height: 0;
    padding: 7px;
    border-radius: 25px;
    background: rgba(9, 11, 17, 0.76);
  }
  .field {
    order: 1;
    flex: 0 0 100%;
    width: 100%;
    padding: 2px 3px 2px 14px;
    border-radius: 19px;
    background: rgba(255, 255, 255, 0.035);
  }
  .field input {
    padding: 13px 0;
    font-size: 16px;
  }
  .field__submit {
    width: 38px;
    height: 38px;
  }
  .dock__divider { display: none; }
  .dock__tools {
    order: 2;
    justify-content: space-between;
    width: 100%;
    padding: 5px 2px 0;
  }
  .swatches--dock {
    display: flex;
    gap: 7px;
    margin: 0 auto 0 6px;
    order: 0;
  }
  .swatches--dock .swatch { width: 22px; height: 22px; }
  .swatches--dock .swatch span { width: 9px; height: 9px; }
  .tool {
    padding: 9px 11px;
    font-size: 10px;
  }
  .toast {
    top: 72px;
    font-size: 8px;
    max-width: calc(100vw - 28px);
    white-space: normal;
    text-align: center;
  }
  .modal {
    width: calc(100vw - 24px);
    max-height: 90svh;
    border-radius: 20px;
  }
  .modal__inner { padding: 34px 24px 26px; }
  .modal__close { top: 14px; right: 14px; }
  .modal h2 { margin-bottom: 18px; }
  .modal__body p { font-size: 12.5px; line-height: 1.8; }
  .modal__stats { gap: 10px; margin: 22px 0; }
  .modal__stats b { font-size: 21px; }
  .button { padding: 11px 15px; font-size: 9px; }
  .modal__credit { margin-top: 22px; font-size: 6.5px; }
}

@media (max-width: 390px) {
  .hero__caption { top: 58.5%; }
  .hero__line { font-size: 24px; }
  .hero__cn { letter-spacing: 0.32em; }
  .try { gap: 10px; }
  .dock-wrap { padding: 0 9px; }
  .tool { padding: 8px 8px; }
  .swatches--dock { gap: 4px; }
}

@media (max-height: 700px) and (min-width: 721px) {
  .topbar { padding-top: 24px; }
  .hero__caption { top: 66%; }
  .hero__line { font-size: 30px; }
  .hero__cn { margin-top: 8px; }
  .try { margin-top: 12px; }
  .hint { bottom: 101px; }
  .dock-wrap { bottom: 22px; }
  .orbit { top: 41%; }
}

@media (max-height: 620px) and (max-width: 900px) {
  .hero__caption { display: none; }
  .hint { bottom: 128px; }
  .orbit { top: 38%; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
  .nebula,
  .glow,
  .orbit {
    animation: none !important;
  }
  body.is-ready .topbar,
  body.is-ready .rail,
  body.is-ready .spectrum,
  body.is-ready .hero__caption,
  body.is-ready .telemetry,
  body.is-ready .hint,
  body.is-ready .dock-wrap,
  body.is-ready .orbit {
    animation: none !important;
    opacity: 1;
  }
}
