:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #ecf8f4;
  color: #37251f;
}

* {
  box-sizing: border-box;
}

html,
body,
.experience,
#scene {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
}

.experience {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 16% 22%, #fafcfe 0 13%, transparent 80%),
    radial-gradient(ellipse at 82% 16%, #fcffff 0 10%, transparent 84%),
    radial-gradient(ellipse at 68% 76%, #fbfdfe 0 14%, transparent 82%),
    radial-gradient(ellipse at 25% 84%, #fafcfd 0 8%, transparent 86%),
    linear-gradient(135deg, #f1f9f7 0%, #f4f4f7 47%, #f5f4ff 100%);
}

.experience::before {
  position: absolute;
  z-index: 0;
  inset: -12%;
  pointer-events: none;
  content: "";
  background:
    conic-gradient(from 32deg at 26% 42%, transparent, rgba(237, 251, 255, 0.9), transparent 24%, rgba(249, 255, 255, 0.9), transparent 55%),
    conic-gradient(from 210deg at 76% 58%, rgba(213, 231, 241, 0.9), transparent 21%, rgba(230, 243, 253, 0.9) transparent 48%),
    radial-gradient(ellipse at 48% 52%, rgba(214, 233, 239, 0.9), transparent 48%),
    repeating-radial-gradient(circle at 40% 30%, rgba(208, 236, 255, 0.9) 0 1px, transparent 1px 7px);
  filter: blur(26px) saturate(0.82);
  mix-blend-mode: multiply;
  opacity: 0.74;
  transform: rotate(-3deg) scale(1.12);
}

.experience::after {
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  content: "";
  background: radial-gradient(circle at center, transparent 50%, rgba(91, 50, 38, 0.16) 130%);
  box-shadow: inset 0 0 12vmax rgba(111, 68, 50, 0.12);
  mix-blend-mode: multiply;
}

#scene {
  position: absolute;
  z-index: 1;
  inset: 0;
  opacity: 0;
}

#scene.is-ready {
  opacity: 1;
}

#scene canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.brand {
  position: absolute;
  z-index: 3;
  top: clamp(20px, 4vw, 48px);
  left: clamp(20px, 5vw, 72px);
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(55, 37, 31, 0.72);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.32em;
}

.brand__mark {
  width: 8px;
  height: 8px;
  border: 1px solid #7a4b3c;
  border-radius: 50%;
  box-shadow: 0 0 12px rgba(122, 75, 60, 0.42);
}

.loading {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(ellipse at 16% 22%, #fef4f1 0 13%, transparent 80%),
    radial-gradient(ellipse at 82% 16%, #fefcf3 0 10%, transparent 84%),
    radial-gradient(ellipse at 68% 76%, #f9efec 0 14%, transparent 82%),
    radial-gradient(ellipse at 25% 84%, #f8eccd 0 8%, transparent 86%),
    linear-gradient(135deg, #ffebe6 0%, #e8dfd9 47%, #fff4da 100%);
  transition: visibility 600ms ease, opacity 600ms ease;
}

.loading.is-hidden {
  visibility: hidden;
  opacity: 0;
}

.loading__content {
  width: min(54vw, 460px);
  transform: translateY(-2vh);
}

.loading__track {
  height: 5px;
  overflow: hidden;
  border: 1px solid rgba(47, 31, 25, 0.8);
  border-radius: 999px;
  background: rgba(255, 243, 214, 0.34);
  box-shadow: 0 2px 0 rgba(255, 241, 214, 0.35);
}

.loading__bar {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #30211c;
  transition: width 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.loading__label {
  margin: 12px 0 0;
  color: #30211c;
  font-family: "Comic Sans MS", "Bradley Hand", cursive;
  font-size: clamp(18px, 2.4vw, 27px);
  letter-spacing: 0.02em;
  text-align: center;
}

.status {
  position: absolute;
  z-index: 3;
  bottom: clamp(22px, 4vw, 48px);
  left: 50%;
  margin: 0;
  transform: translateX(-50%);
  color: rgba(55, 37, 31, 0.52);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.34em;
  text-align: center;
  transition: opacity 600ms ease;
}

.status.is-done {
  opacity: 0;
}

.status.is-start-prompt {
  top: 50%;
  bottom: auto;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 20px;
  font-variant-ligatures: none;
  animation: start-prompt-flash 1s steps(1, end) infinite;
}

@keyframes start-prompt-flash {
  50% {
    opacity: 0;
  }
}

[hidden] {
  display: none !important;
}

noscript {
  position: absolute;
  z-index: 5;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -50%);
}

@media (max-width: 640px) {
  .brand {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .status {
    transition: none;
  }

  .status.is-start-prompt {
    animation: none;
  }
}

/* Typography overlays inspired by KPR's mono loader and compact frame UI. */
:root {
  --font-display: "ABC Whyte Plus", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --ui-line: rgba(48, 33, 28, 0.24);
}

.loading {
  color: #000;
  background: #fff;
  font-family: var(--font-mono);
}

.loading__content {
  width: min(76vw, 620px);
}

.loading__track {
  height: 1px;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.2);
  box-shadow: none;
}

.loading__bar {
  border-radius: 0;
  background: #000;
}

.loading__meta {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: 11px;
}

.loading__label,
.loading__file {
  margin: 0;
  color: #000;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  text-transform: uppercase;
}

.loading__label {
  display: flex;
  gap: 9px;
  text-align: left;
}

.loading__signal {
  letter-spacing: -0.24em;
  animation: signal-shift 420ms steps(3, end) infinite;
}

.loading__file {
  max-width: 48%;
  overflow: hidden;
  color: rgba(0, 0, 0, 0.48);
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.loading__continue {
  display: block;
  margin: 24px auto 0;
  padding: 6px 10px;
  border: 1px solid #000;
  background: transparent;
  color: #000;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  animation: start-prompt-flash 1s steps(1, end) infinite;
}

.loading__continue:focus-visible {
  outline: 2px solid #000;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .loading__continue {
    animation: none;
  }
}

.site-header {
  position: absolute;
  z-index: 6;
  top: 20px;
  right: 20px;
  left: 20px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 52px;
  padding: 0 18px;
  border: 1px solid var(--ui-line);
  border-radius: 9px;
  background: rgba(241, 242, 244, 0.94);
  backdrop-filter: blur(14px);
  font-family: var(--font-mono);
}

.site-header a {
  color: inherit;
  text-decoration: none;
}

.site-header .brand {
  position: static;
  width: fit-content;
  color: rgba(55, 37, 31, 0.8);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 48px);
  font-size: 9px;
}

.site-nav > a,
.contact-menu__toggle {
  position: relative;
}

.site-nav > a::after,
.contact-menu__toggle::after {
  position: absolute;
  right: 0;
  bottom: -8px;
  left: 0;
  height: 1px;
  content: "";
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 240ms ease;
}

.site-nav > a:hover::after,
.site-nav > a:focus-visible::after,
.site-nav > a.is-active::after,
.contact-menu__toggle:hover::after,
.contact-menu__toggle:focus-visible::after,
.contact-menu__toggle[aria-expanded="true"]::after {
  transform: scaleX(1);
  transform-origin: left;
}

.contact-menu {
  position: relative;
}

.contact-menu__toggle {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.contact-popover {
  position: absolute;
  top: calc(100% + 18px);
  right: 0;
  width: 250px;
  padding: 7px;
  border: 1px solid var(--ui-line);
  border-radius: 7px;
  background: rgba(241, 242, 244, 0.98);
  box-shadow: 0 12px 30px rgba(48, 33, 28, 0.14);
  backdrop-filter: blur(14px);
}

.contact-option {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 4px;
  color: rgba(55, 37, 31, 0.58);
  font-size: 8px;
  letter-spacing: 0.06em;
}

.contact-option + .contact-option {
  border-top: 1px solid var(--ui-line);
  border-radius: 0 0 4px 4px;
}

.contact-option strong {
  color: #37251f;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0;
}

.contact-option:hover,
.contact-option:focus-visible {
  background: rgba(55, 37, 31, 0.07);
  outline: none;
}

.header-tools {
  display: flex;
  justify-self: end;
  align-items: center;
  gap: 18px;
}

.language-switch {
  display: flex;
  align-items: center;
  gap: 5px;
  color: rgba(55, 37, 31, 0.4);
  font-size: 8px;
}

.language-switch button {
  padding: 4px 0;
  border: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.language-switch button.is-active,
.language-switch button:hover,
.language-switch button:focus-visible {
  color: #37251f;
}

.header-coordinate {
  justify-self: end;
  margin: 0;
  color: rgba(55, 37, 31, 0.5);
  font-size: 8px;
}

.menu-toggle {
  display: none;
}

.type-overlay {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: clamp(20px, 5vw, 72px);
  width: min(68vw, 980px);
  color: #30211c;
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(-50% + 14px));
  transition: opacity 300ms ease, transform 300ms ease;
}

.type-overlay.is-pair-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%);
}

.type-overlay--right {
  left: auto;
  right: clamp(20px, 5vw, 72px);
  text-align: right;
}

.type-overlay--right .type-overlay__eyebrow {
  flex-direction: row-reverse;
}

.type-overlay--right .type-overlay__intro {
  margin-left: auto;
}

.type-overlay--right .enter-link {
  margin-left: auto;
  flex-direction: row-reverse;
}

#scene.is-glitching canvas {
  filter: saturate(1.8) contrast(1.12);
}

.type-overlay__eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 clamp(22px, 4vh, 48px);
  font-family: var(--font-mono);
  font-size: 9px;
}

.type-overlay__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 4px rgba(48, 33, 28, 0.08);
  animation: type-status-pulse 1.8s ease infinite;
}

.type-overlay__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(48px, 7.8vw, 138px);
  font-stretch: condensed;
  font-weight: 700;
  letter-spacing: -0.075em;
  line-height: 0.98;
  text-transform: uppercase;
}

html[lang="zh-CN"] .type-overlay__title {
  font-size: clamp(24px, 3.9vw, 69px);
  letter-spacing: 1em;
  text-transform: none;
}

.stream-line {
  display: block;
  min-height: 0.88em;
}

.stream-line--muted {
  opacity: 1;
  color: rgb(255, 167, 226);
}

.stream-line--outline {
  color: #fff;
  -webkit-text-stroke: 1.5px #f6a9e0;
}

.type-overlay__intro {
  width: fit-content;
  font-family: var(--font-display);
  font-size: clamp(14px, 1.25vw, 20px);
  letter-spacing: -0.03em;
  line-height: 1.2;
  background: rgba(255, 255, 255, 0.6);
}

html[lang="zh-CN"] .type-overlay__intro {
  font-family: "PingFang SC", "PingFang TC", "Microsoft YaHei", sans-serif;
  font-size: clamp(9.33px, 0.83vw, 13.33px);
  font-weight: 100;
  letter-spacing: 0;
  word-spacing: 1em;
}

.enter-link {
  display: flex;
  justify-content: space-between;
  width: min(100%, 290px);
  margin-top: 25px;
  padding: 11px 0;
  border-top: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  color: inherit;
  font-family: var(--font-mono);
  font-size: 9px;
  text-decoration: none;
  transition: padding 220ms ease;
}

.enter-link:hover,
.enter-link:focus-visible {
  padding-right: 8px;
  padding-left: 8px;
}

.memory-stream {
  position: absolute;
  z-index: 3;
  bottom: 28px;
  left: clamp(20px, 5vw, 72px);
  width: min(280px, 28vw);
  border: 1px solid var(--ui-line);
  color: rgba(55, 37, 31, 0.78);
  background: rgba(241, 242, 244, 0.94);
  backdrop-filter: blur(10px);
  font-family: var(--font-mono);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 600ms ease 500ms, transform 600ms ease 500ms;
}

#scene.is-ready ~ .memory-stream {
  opacity: 1;
  transform: none;
}

.memory-stream p {
  margin: 0;
  padding: 9px 11px;
}

.memory-stream__title,
.memory-stream__index {
  font-size: 8px;
}

.memory-stream__title {
  border-bottom: 1px solid var(--ui-line);
}

.memory-stream__output {
  min-height: 58px;
  font-size: 10px;
  line-height: 1.35;
}

.memory-stream__index {
  border-top: 1px solid var(--ui-line);
  color: rgba(55, 37, 31, 0.48);
}

.type-footer {
  position: absolute;
  z-index: 3;
  right: clamp(20px, 5vw, 72px);
  bottom: 12px;
  left: clamp(20px, 5vw, 72px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  color: rgba(55, 37, 31, 0.62);
  font-family: var(--font-mono);
  font-size: 8px;
  opacity: 0;
  transition: opacity 600ms ease 500ms;
}

#scene.is-ready ~ .type-footer {
  opacity: 1;
}

.type-footer span:nth-child(2) {
  justify-self: center;
}

.type-footer a {
  justify-self: end;
  color: inherit;
  text-decoration: none;
}

.text-stream {
  font-variant-ligatures: none;
}

@keyframes signal-shift {
  50% { transform: translateX(2px); }
}

@keyframes type-status-pulse {
  50% { opacity: 0.35; }
}

@media (max-width: 640px) {
  .site-header {
    top: 0;
    right: 0;
    left: 0;
    grid-template-columns: 1fr auto;
    min-height: 52px;
    border-width: 0 0 1px;
    border-radius: 0;
  }

  .header-coordinate {
    display: none;
  }

  .header-tools {
    position: absolute;
    right: 62px;
  }

  .menu-toggle {
    position: relative;
    z-index: 2;
    display: block;
    padding: 8px 0;
    border: 0;
    background: transparent;
    font-size: 9px;
    cursor: pointer;
    pointer-events: auto;
    touch-action: manipulation;
  }

  .site-nav {
    position: absolute;
    z-index: 1;
    top: 52px;
    right: 0;
    left: 0;
    display: grid;
    gap: 0;
    padding: 8px 18px 16px;
    border-bottom: 1px solid var(--ui-line);
    background: rgba(240, 242, 245, 0.96);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 220ms ease, transform 220ms ease;
  }

  .site-nav.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .site-nav > a,
  .contact-menu__toggle {
    display: block;
    width: 100%;
    padding: 12px 0;
    border-bottom: 1px solid var(--ui-line);
    text-align: left;
  }

  .site-nav > a::after,
  .contact-menu__toggle::after {
    display: none;
  }

  .contact-popover {
    position: static;
    width: 100%;
    margin-top: 8px;
    box-shadow: none;
  }

  .contact-option {
    min-height: 44px;
  }

  .memory-stream {
    display: none;
  }

  .type-overlay {
    top: 48%;
    width: calc(100% - 40px);
  }

  .type-overlay--right {
    left: 20px;
    right: 20px;
    text-align: right;
  }

  .type-overlay--right .type-overlay__eyebrow {
    flex-direction: row-reverse;
  }

  .type-overlay--right .enter-link {
    margin-left: auto;
    flex-direction: row-reverse;
  }

  .type-overlay__title {
    font-size: clamp(45px, 15.5vw, 74px);
    line-height: 0.82;
  }

  .type-footer {
    right: 20px;
    left: 20px;
    grid-template-columns: 1fr 1fr;
  }

  .type-footer span:nth-child(2) {
    display: none;
  }

  .loading__content {
    width: 82vw;
  }

  html[lang="zh-CN"] .type-overlay__title {
    font-size: clamp(19px, calc((100vw - 40px) * 0.07), 34px);
    letter-spacing: clamp(0.3em, 2vw, 0.72em);
    white-space: nowrap;
  }

  html[lang="zh-CN"] .type-overlay__eyebrow {
    gap: clamp(4px, 1.4vw, 10px);
    margin-bottom: clamp(14px, 4vw, 28px);
    font-size: clamp(7px, calc((100vw - 40px) * 0.024), 9px);
    white-space: nowrap;
    word-spacing: clamp(0.16em, 1.4vw, 0.7em);
  }

  .type-overlay__intro {
    font-size: clamp(9.33px, 0.83vw, 13.33px);
  }

  .stream-line--outline {
    -webkit-text-stroke: 0;
    color: #fff;
  }
}
