:root {
  color-scheme: light;
  --bg: #e0e5ec;
  --ink: #25231f;
  --muted: rgba(37, 35, 31, 0.58);
  --accent: #6f6148;
  --ink-rgb: 37, 35, 31;
  --accent-rgb: 111, 97, 72;
  --highlight-rgb: 255, 255, 255;
  --shadow-rgb: 39, 55, 73;
  --slate-rgb: 77, 96, 121;
  --bg-start: #f0f5fc;
  --bg-end: #cacfd6;
  --theme-transition: 360ms ease;
  font-family:
    MiSans, "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", system-ui,
    sans-serif;
}

html.dark {
  color-scheme: dark;
  --bg: #1a1d24;
  --ink: #d4d0c8;
  --muted: rgba(212, 208, 200, 0.52);
  --accent: #a09880;
  --ink-rgb: 212, 208, 200;
  --accent-rgb: 160, 152, 128;
  --highlight-rgb: 200, 210, 230;
  --shadow-rgb: 0, 0, 0;
  --slate-rgb: 130, 150, 180;
  --bg-start: #1c2029;
  --bg-end: #11141b;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background:
    linear-gradient(145deg, var(--bg-start), var(--bg-end)),
    var(--bg);
}

body {
  position: fixed;
  inset: 0;
  color: var(--ink);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition:
    color var(--theme-transition),
    background var(--theme-transition);
}

/* ── Theme toggle ────────────────────────────────────────────── */

.theme-toggle {
  position: fixed;
  top: max(22px, env(safe-area-inset-top));
  left: max(22px, env(safe-area-inset-left));
  z-index: 3;
  width: 20px;
  height: 20px;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(var(--ink-rgb), 0.72);
  padding: 0;
  transition: color var(--theme-transition);
}

.theme-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* ── Hero ────────────────────────────────────────────────────── */

.hero {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}

.hero-title {
  margin: 0;
  font-size: clamp(2.8rem, 8vw, 6.4rem);
  font-weight: 520;
  letter-spacing: 0.04em;
  transition: color var(--theme-transition);
}

.char {
  display: inline-block;
  transform: translate(
    calc(var(--ox, 0px)),
    calc(var(--oy, 0px) + var(--wobble-y, 0px))
  ) rotate(var(--wobble-r, 0deg));
  text-shadow:
    0 0 calc(10px + var(--glow, 0.3) * 36px) rgba(var(--accent-rgb), calc(0.28 + var(--glow, 0.3) * 0.5)),
    0 2px calc(6px + var(--glow, 0.3) * 16px) rgba(var(--shadow-rgb), 0.1);
}

.hero-sub {
  margin: 4px 0 0;
  font-size: clamp(1rem, 2.6vw, 1.6rem);
  font-weight: 380;
  letter-spacing: 0.12em;
  color: var(--muted);
  transform: translate(
    calc(var(--sub-ox, 0px)),
    calc(var(--sub-oy, 0px))
  );
  text-shadow:
    0 0 calc(6px + var(--glow, 0.3) * 18px) rgba(var(--accent-rgb), calc(0.16 + var(--glow, 0.3) * 0.32));
  transition: color var(--theme-transition);
}

.hero-label {
  position: fixed;
  left: max(28px, env(safe-area-inset-left));
  bottom: max(26px, env(safe-area-inset-bottom));
  margin: 0;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  text-decoration: none;
  pointer-events: auto;
  transition: color var(--theme-transition);
}

.hero-label:hover,
.hero-label:focus-visible {
  opacity: 0.78;
}

.hero-label:focus-visible {
  border-radius: 1px;
  outline: 1px solid rgba(var(--slate-rgb), 0.38);
  outline-offset: 6px;
}

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 620px) {
  .theme-toggle {
    top: 16px;
    left: 16px;
  }

  .hero-title {
    font-size: clamp(2.2rem, 12vw, 4rem);
  }

  .hero-sub {
    font-size: clamp(0.9rem, 4vw, 1.2rem);
  }

  .hero-label {
    left: 20px;
    bottom: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .char,
  .hero-sub {
    transform: none;
    text-shadow: none;
  }
}
