:root {
  --page-bg-top: #0e1016;
  --page-bg-mid: #141822;
  --page-bg-bottom: #0d1016;
  --page-haze-1: rgba(224, 164, 88, 0.10);
  --page-haze-2: rgba(138, 136, 255, 0.10);
  --page-haze-3: rgba(255, 255, 255, 0.04);
  --surface: #1c1e26;
  --glass: rgba(20, 21, 26, 0.62);
  --glass-strong: rgba(20, 21, 26, 0.84);
  --border: oklch(1 0 0 / 12%);
  --border-strong: oklch(1 0 0 / 22%);
  --text: #e8e9ee;
  --text-muted: #9498a8;
  --accent: #e0a458;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --ui-bg-1: rgba(24, 25, 31, 0.84);
  --ui-bg-2: rgba(20, 21, 26, 0.58);
  --stage-bg-1: rgba(10, 11, 14, 0.74);
  --stage-bg-2: rgba(6, 7, 9, 0.96);
  --stage-line: rgba(255, 255, 255, 0.025);
  --stage-glow-1: rgba(224, 164, 88, 0.12);
  --stage-glow-2: rgba(176, 160, 255, 0.10);
  --stage-glow-3: rgba(255, 255, 255, 0.03);
  --home-haze-opacity: 0.95;
  --home-grid-opacity: 0.22;
  --stage-haze-opacity: 0.82;
  --canvas-filter: saturate(0.98) contrast(1.03);
  --ease: cubic-bezier(0.2, 0, 0, 1);
}

html[data-theme="light"] {
  --page-bg-top: #f3f6fb;
  --page-bg-mid: #e5ebf3;
  --page-bg-bottom: #f7f9fc;
  --page-haze-1: rgba(148, 171, 206, 0.14);
  --page-haze-2: rgba(255, 255, 255, 0.54);
  --page-haze-3: rgba(160, 184, 220, 0.08);
  --surface: #f7f9fd;
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --border: rgba(18, 28, 44, 0.08);
  --border-strong: rgba(18, 28, 44, 0.14);
  --text: #16202c;
  --text-muted: #667489;
  --accent: #7d91b4;
  --shadow: 0 26px 80px rgba(74, 92, 120, 0.14);
  --ui-bg-1: rgba(255, 255, 255, 0.88);
  --ui-bg-2: rgba(245, 249, 255, 0.76);
  --stage-bg-1: rgba(247, 249, 252, 0.94);
  --stage-bg-2: rgba(227, 234, 243, 0.98);
  --stage-line: rgba(40, 52, 72, 0.05);
  --stage-glow-1: rgba(145, 175, 220, 0.08);
  --stage-glow-2: rgba(255, 255, 255, 0.18);
  --stage-glow-3: rgba(195, 220, 255, 0.08);
  --home-haze-opacity: 0.44;
  --home-grid-opacity: 0.08;
  --stage-haze-opacity: 0.26;
  --canvas-filter: saturate(0.9) contrast(1.05) brightness(0.9);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(circle at 18% 16%, var(--page-haze-1), transparent 26%),
    radial-gradient(circle at 84% 12%, var(--page-haze-2), transparent 24%),
    radial-gradient(circle at 50% 50%, var(--page-haze-3), transparent 40%),
    linear-gradient(180deg, var(--page-bg-top) 0%, var(--page-bg-mid) 32%, var(--page-bg-bottom) 100%);
  color: var(--text);
  font-family: "Zen Kaku Gothic New", "Hiragino Sans", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  height: 100%;
  overflow: hidden;
}

body {
  min-height: 100vh;
}

.home {
  height: 100vh;
  height: 100dvh;
  display: block;
  position: relative;
  isolation: isolate;
  padding: 0;
  overflow: hidden;
}

.home::before,
.home::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.home::before {
  background:
    radial-gradient(circle at 18% 20%, var(--page-haze-1), transparent 24%),
    radial-gradient(circle at 82% 76%, var(--page-haze-2), transparent 24%),
    radial-gradient(circle at 50% 56%, var(--page-haze-3), transparent 38%);
  filter: blur(14px);
  opacity: var(--home-haze-opacity);
}

.home::after {
  background:
    linear-gradient(transparent 0 94%, rgba(255, 255, 255, 0.02) 94% 100%),
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.025) 0,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px,
      transparent 9px
    );
  opacity: var(--home-grid-opacity);
  mix-blend-mode: soft-light;
}

.home-header {
  position: absolute;
  inset: 14px 14px auto;
  z-index: 4;
  width: auto;
  margin: 0;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(18, 28, 44, 0.08);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.46)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.58), rgba(235, 241, 248, 0.22));
  backdrop-filter: blur(24px) saturate(150%);
  box-shadow: 0 18px 42px rgba(74, 92, 120, 0.07);
  overflow: hidden;
}

.home-header::before,
.ghost-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.28) 18%, transparent 35%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.22), transparent 42%, rgba(124, 145, 180, 0.08));
  mix-blend-mode: screen;
  opacity: 0.8;
}

.home-brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  position: relative;
  z-index: 1;
}

.home-brand-main {
  font-size: 18px;
  letter-spacing: -0.05em;
  background: linear-gradient(180deg, #101a2a 0%, #4d5f75 58%, #7d8fa4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 8px 14px rgba(120, 145, 176, 0.12));
}

.shuffle-char {
  display: inline-block;
  will-change: transform, opacity;
  transition: transform 180ms var(--ease), opacity 180ms var(--ease);
}

@keyframes text-reveal {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
    filter: blur(4px);
  }
  55% {
    opacity: 1;
    transform: translateY(-1px) scale(1.02);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes text-glow {
  0% {
    opacity: 0;
    transform: translateX(-12%);
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(12%);
  }
}

.face-title.is-revealing .shuffle-char,
.face-meta.is-revealing .shuffle-char,
.face-action.is-revealing .shuffle-char {
  animation: text-reveal 720ms var(--ease) both;
  animation-delay: var(--char-delay, 0ms);
}

.face-title.is-revealing::after,
.face-meta.is-revealing::after,
.face-action.is-revealing::after {
  content: "";
  position: absolute;
  inset: -0.1em -0.2em;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.68), transparent);
  mix-blend-mode: screen;
  opacity: 0;
  animation: text-glow 720ms var(--ease) both;
}

.face-title .shuffle-char,
.ghost-btn .shuffle-char {
  transform: translateY(0);
}

.face-title .shuffle-char {
  min-width: 0.52em;
}

.ghost-btn .shuffle-char {
  min-width: 0.42em;
}

.home-brand-sub {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.lang-switch {
  display: inline-flex;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  margin-left: auto;
  gap: 4px;
  position: relative;
  z-index: 1;
}

.lang-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 8px 6px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 160ms var(--ease), transform 160ms var(--ease), opacity 160ms var(--ease);
}

.lang-btn[aria-pressed="true"] {
  color: var(--text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

.lang-btn:hover {
  transform: translateY(-1px);
  color: var(--text);
}

.menu-stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  border: none;
  border-radius: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.28), transparent 35%),
    linear-gradient(180deg, var(--stage-bg-1), var(--stage-bg-2));
  box-shadow: none;
}

.data-particles {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  overflow: hidden;
  opacity: 1;
  mix-blend-mode: normal;
}

.data-particle {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  border-radius: 999px;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 1) 0%, rgba(255, 255, 255, 0.72) 16%, transparent 40%),
    radial-gradient(circle at 50% 58%, var(--particle-color), transparent 72%);
  box-shadow:
    0 0 18px var(--particle-glow),
    0 0 42px color-mix(in oklab, var(--particle-color) 68%, transparent);
  transform: translate3d(0, 0, 0);
  mix-blend-mode: normal;
  opacity: var(--opacity);
  will-change: transform, opacity;
  filter: drop-shadow(0 0 10px color-mix(in oklab, var(--particle-color) 40%, transparent));
}

.data-particle-0 {
  --particle-color: rgba(103, 173, 255, 0.98);
  --particle-glow: rgba(103, 173, 255, 0.42);
}

.data-particle-1 {
  --particle-color: rgba(255, 143, 193, 0.98);
  --particle-glow: rgba(255, 143, 193, 0.38);
}

.data-particle-2 {
  --particle-color: rgba(138, 244, 224, 0.98);
  --particle-glow: rgba(138, 244, 224, 0.36);
}

.data-particle-3 {
  --particle-color: rgba(255, 221, 124, 0.98);
  --particle-glow: rgba(255, 221, 124, 0.36);
}

.menu-stage::before,
.menu-stage::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.menu-stage::before {
  inset: 0;
  background:
    linear-gradient(90deg, var(--stage-line), transparent 12%, transparent 88%, var(--stage-line)),
    linear-gradient(180deg, var(--stage-line), transparent 18%, transparent 82%, var(--stage-line));
  opacity: 0.12;
}

.menu-stage::after {
  inset: -14% -10%;
  background:
    radial-gradient(circle at 20% 30%, var(--stage-glow-1), transparent 22%),
    radial-gradient(circle at 80% 22%, var(--stage-glow-2), transparent 18%),
    radial-gradient(circle at 56% 68%, var(--stage-glow-3), transparent 24%),
    radial-gradient(circle at 48% 48%, rgba(255, 255, 255, 0.09), transparent 42%);
  filter: blur(28px);
  opacity: calc(var(--stage-haze-opacity) + 0.08);
}

#infinite-menu-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  outline: none;
  touch-action: none;
  position: relative;
  z-index: 0;
  filter: var(--canvas-filter);
}

#infinite-menu-canvas:active {
  cursor: grabbing;
}

.face-title {
  position: absolute;
  left: 5.2%;
  top: 50%;
  margin: 0;
  max-width: min(28vw, 28rem);
  font-family: "Space Grotesk", "Zen Kaku Gothic New", sans-serif;
  font-weight: 700;
  font-size: clamp(1.35rem, 2.8vw, 2.4rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: transparent;
  background: linear-gradient(180deg, #132033 0%, #516276 55%, #72839a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 10px 18px rgba(120, 145, 176, 0.16));
  pointer-events: none;
  user-select: none;
  opacity: 0;
  overflow-wrap: anywhere;
  text-wrap: balance;
  overflow: visible;
  transform: translateY(-50%) translateX(-14px);
  transition: opacity 380ms var(--ease), transform 380ms var(--ease);
  z-index: 3;
  opacity: 0.95;
}

.face-title.visible {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.face-meta {
  position: absolute;
  right: 4.5%;
  top: 50%;
  margin: 0;
  max-width: 24ch;
  text-align: right;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-shadow: 0 12px 24px rgba(125, 145, 180, 0.16);
  pointer-events: none;
  user-select: none;
  opacity: 0;
  transform: translateY(-50%) translateX(14px);
  transition: opacity 380ms var(--ease) 60ms, transform 380ms var(--ease) 60ms;
  z-index: 3;
  overflow: visible;
}

.face-meta.visible {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.face-action {
  position: absolute;
  left: 50%;
  bottom: 9%;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(180deg, #fdfefe, #e5ebf3);
  color: #304055;
  font-size: 20px;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) scale(0.6);
  box-shadow: 0 14px 28px rgba(125, 145, 180, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.78);
  transition: opacity 260ms var(--ease), transform 260ms var(--ease), background 160ms var(--ease), box-shadow 160ms var(--ease);
  z-index: 3;
  overflow: visible;
}

.face-action.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) scale(1);
}

.face-action:hover {
  background: linear-gradient(180deg, #ffffff, #dfe7f1);
  transform: translateX(-50%) scale(1.08);
}

@media (max-width: 760px) {
  .home-header {
    inset: 10px 10px auto;
    width: auto;
    padding: 10px 12px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-radius: 18px;
  }

  .home-brand {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    gap: 6px;
  }

  .lang-switch {
    flex: 0 0 auto;
    margin-left: auto;
    margin-top: 0;
    gap: 2px;
  }

  .lang-btn {
    font-size: 10px;
    padding: 5px 6px;
  }

  .home-brand-main {
    font-size: 15px;
    letter-spacing: -0.04em;
    line-height: 1.05;
  }

  .home-brand-sub {
    font-size: 9px;
    letter-spacing: 0.12em;
    white-space: nowrap;
  }

  .face-title,
  .face-meta {
    display: none;
  }

  .home {
    padding: 0;
  }

  .menu-stage {
    width: 100%;
    border-radius: 0;
  }
}

.enter-list {
  display: flex;
  justify-content: center;
  padding: 0;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 20px;
  z-index: 4;
  pointer-events: none;
}

.ghost-btn {
  appearance: none;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.2)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(235, 241, 248, 0.22));
  border: 1px solid rgba(18, 28, 44, 0.08);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  backdrop-filter: blur(18px) saturate(130%);
  box-shadow: 0 16px 36px rgba(74, 92, 120, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: color 160ms var(--ease), transform 160ms var(--ease), opacity 160ms var(--ease), text-decoration-color 160ms var(--ease), box-shadow 160ms var(--ease);
  position: relative;
  overflow: hidden;
}

.ghost-btn:hover {
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(74, 92, 120, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.enter-list .ghost-btn {
  pointer-events: auto;
}

.ghost-btn::before {
  opacity: 0.72;
}

.ghost-btn:active {
  transform: translateY(0);
}

.ghost-btn:focus-visible {
  outline: none;
  color: var(--text);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent);
}
