:root {
  --ink: #14181c;
  --ink-soft: #4a5360;
  --paper: #f4f7f8;
  --cinnabar: #c23b2e;
  --cinnabar-deep: #9a2a20;
  --brass-soft: #e0c37a;
  --max: 1100px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Outfit", "Segoe UI", sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  background:
    radial-gradient(1000px 520px at 90% -5%, rgba(201, 164, 90, 0.18), transparent 55%),
    radial-gradient(800px 480px at -5% 35%, rgba(47, 90, 74, 0.12), transparent 50%),
    linear-gradient(180deg, #d9e4ea 0%, var(--paper) 30%, #eef3f5 100%);
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

/* —— Nav —— */
.site-nav {
  position: fixed;
  inset: 0 0 auto;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem clamp(1rem, 4vw, 2.5rem);
  background: linear-gradient(180deg, rgba(244, 247, 248, 0.92), rgba(244, 247, 248, 0.5) 70%, transparent);
  backdrop-filter: blur(8px);
  transition: background 0.35s var(--ease);
}

.site-nav.is-solid {
  background: rgba(244, 247, 248, 0.95);
  border-bottom: 1px solid rgba(20, 24, 28, 0.06);
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.nav-brand img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  font-size: 0.92rem;
  font-weight: 500;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.25rem);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem;
  border: 1px solid rgba(20, 24, 28, 0.12);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.55);
}

.lang-switch button {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0.35rem 0.55rem;
  border-radius: 3px;
  background: transparent;
  color: var(--ink-soft);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.lang-switch button.is-active,
.lang-switch button[aria-pressed="true"] {
  background: var(--ink);
  color: #fff;
}

.lang-switch button:hover:not(.is-active):not([aria-pressed="true"]) {
  color: var(--cinnabar);
}

html[data-lang="zh"] body {
  font-family: "Noto Sans SC", "Outfit", "PingFang SC", "Microsoft YaHei", sans-serif;
}

html[data-lang="zh"] .brand,
html[data-lang="zh"] .nav-brand,
html[data-lang="zh"] .section-head h2,
html[data-lang="zh"] .play-points strong,
html[data-lang="zh"] .foot-brand,
html[data-lang="zh"] .legal-doc h1,
html[data-lang="zh"] .legal-doc h2,
html[data-lang="zh"] .hero-copy h1,
html[data-lang="zh"] .finale-copy h2,
html[data-lang="zh"] .hero-rail figcaption,
html[data-lang="zh"] .btn-game span {
  font-family: "Noto Sans SC", "Fraunces", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0.04em;
}

.chapter-track em {
  font-style: normal;
  font-weight: 500;
}

.nav-links a {
  color: var(--ink-soft);
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--cinnabar);
}

.nav-cta {
  padding: 0.45rem 0.95rem;
  background: var(--cinnabar);
  color: #fff !important;
  border-radius: 4px;
}

.nav-cta:hover {
  background: var(--cinnabar-deep);
  color: #fff !important;
}

/* —— Hero —— */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: end;
  overflow: hidden;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 18%;
  transform: scale(1.08);
  animation: hero-drift 22s ease-in-out infinite alternate;
}

@keyframes hero-drift {
  from { transform: scale(1.08) translate3d(0, 0, 0); }
  to { transform: scale(1.14) translate3d(-2%, 1.5%, 0); }
}

.hero-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(10, 16, 20, 0.76) 0%, rgba(10, 16, 20, 0.38) 44%, rgba(10, 16, 20, 0.08) 72%, transparent 100%),
    linear-gradient(0deg, rgba(10, 16, 20, 0.8) 0%, rgba(10, 16, 20, 0.22) 42%, transparent 66%);
  pointer-events: none;
}

.hero-copy {
  position: relative;
  z-index: 2;
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 7rem clamp(1.25rem, 5vw, 3rem) clamp(3rem, 8vh, 5rem);
  color: #f5f7fa;
}

.brand {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 7.5vw, 4.8rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(28px);
  animation: rise-in 0.9s var(--ease) 0.15s forwards;
}

.hero-copy h1 {
  margin: 0 0 0.85rem;
  max-width: 14em;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2.8vw, 1.85rem);
  font-weight: 600;
  color: var(--brass-soft);
  opacity: 0;
  transform: translateY(24px);
  animation: rise-in 0.9s var(--ease) 0.32s forwards;
}

.lead {
  margin: 0 0 1.75rem;
  max-width: 30rem;
  font-size: clamp(0.98rem, 1.7vw, 1.1rem);
  color: rgba(245, 247, 250, 0.88);
  opacity: 0;
  transform: translateY(20px);
  animation: rise-in 0.9s var(--ease) 0.48s forwards;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  opacity: 0;
  transform: translateY(16px);
  animation: rise-in 0.9s var(--ease) 0.62s forwards;
}

@keyframes rise-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.85rem;
  padding: 0.65rem 1.4rem;
  border-radius: 4px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform 0.2s var(--ease), background 0.2s, border-color 0.2s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--cinnabar);
  color: #fff;
}

.btn-primary:hover {
  background: var(--cinnabar-deep);
}

.btn-ghost {
  border: 1px solid rgba(245, 247, 250, 0.55);
  color: #f5f7fa;
  background: rgba(10, 16, 20, 0.22);
}

.btn-ghost:hover {
  border-color: #f5f7fa;
  background: rgba(10, 16, 20, 0.4);
}

/* —— Sections —— */
.section {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: clamp(3.5rem, 9vh, 6rem) clamp(1.25rem, 5vw, 2rem);
}

.section-head {
  max-width: 36rem;
  margin-bottom: 2.25rem;
}

.section-head h2 {
  margin: 0 0 0.6rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.8vw, 2.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.section-head p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.section-head.on-dark h2 {
  color: #f5f7fa;
}

.section-head.on-dark p {
  color: rgba(245, 247, 250, 0.78);
}

/* —— Play —— */
.play-stage {
  position: relative;
  margin-bottom: 1.75rem;
  overflow: hidden;
  border-radius: 8px;
  background: #1a2430;
  box-shadow: 0 18px 40px rgba(20, 24, 28, 0.12);
}

.play-map {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: center 40%;
  transition: opacity 0.7s var(--ease);
}

.play-map.is-swapping {
  opacity: 0.35;
}

.play-tower {
  position: absolute;
  right: 6%;
  bottom: 4%;
  width: clamp(72px, 14vw, 140px);
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.35));
  animation: tower-bob 3.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes tower-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.play-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(3, 1fr);
}

.play-points li {
  padding-top: 0.85rem;
  border-top: 2px solid rgba(194, 59, 46, 0.55);
}

.play-points strong {
  display: block;
  margin-bottom: 0.35rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.play-points span {
  color: var(--ink-soft);
  font-size: 0.95rem;
}

/* —— Heroes —— */
.heroes {
  width: 100%;
  max-width: none;
  padding-left: 0;
  padding-right: 0;
  background:
    linear-gradient(180deg, transparent, rgba(20, 24, 28, 0.04)),
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 18px,
      rgba(47, 90, 74, 0.03) 18px,
      rgba(47, 90, 74, 0.03) 19px
    );
}

.heroes .section-head {
  width: min(100%, var(--max));
  margin-left: auto;
  margin-right: auto;
  padding: 0 clamp(1.25rem, 5vw, 2rem);
}

.hero-rail {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding: 0.5rem clamp(1.25rem, 5vw, calc((100vw - var(--max)) / 2 + 2rem)) 1.25rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.hero-rail figure {
  flex: 0 0 auto;
  width: min(200px, 58vw);
  margin: 0;
  scroll-snap-align: start;
  background:
    radial-gradient(circle at 50% 30%, rgba(184, 137, 58, 0.22), transparent 55%),
    linear-gradient(180deg, #2a3140 0%, #12151c 100%);
  border-radius: 6px;
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px);
  transition: transform 0.35s var(--ease);
}

.hero-rail figure.is-in {
  opacity: 1;
  transform: translateY(0);
}

.hero-rail figure:hover {
  transform: translateY(-6px);
}

.hero-rail img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center top;
}

.hero-rail figcaption {
  padding: 0.7rem 0.75rem 0.9rem;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--brass-soft);
  font-size: 0.95rem;
}

/* —— World —— */
.world {
  position: relative;
  width: 100%;
  max-width: none;
  padding: 0;
  overflow: hidden;
}

.world-bg {
  position: absolute;
  inset: 0;
}

.world-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 35%;
  filter: saturate(0.92) brightness(0.5);
  transform: scale(1.04);
}

.world-inner {
  position: relative;
  z-index: 1;
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: clamp(3.5rem, 9vh, 6rem) clamp(1.25rem, 5vw, 2rem);
}

.chapter-track {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
}

.chapter-track li {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1.1rem 1rem;
  background: rgba(12, 18, 22, 0.55);
  border: 1px solid rgba(224, 195, 122, 0.28);
  border-radius: 6px;
  font-weight: 500;
  color: rgba(245, 247, 250, 0.82);
  backdrop-filter: blur(4px);
}

.chapter-track span {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--brass-soft);
  letter-spacing: 0.04em;
}

/* —— Finale —— */
.finale {
  padding-bottom: 4rem;
}

.finale-card {
  display: grid;
  grid-template-columns: minmax(120px, 200px) 1fr;
  gap: 1.5rem 2rem;
  align-items: center;
  padding: clamp(1.5rem, 4vw, 2.25rem);
  background:
    linear-gradient(135deg, rgba(194, 59, 46, 0.08), transparent 40%),
    linear-gradient(180deg, #fff, #edf2f6);
  border: 1px solid rgba(20, 24, 28, 0.08);
  border-radius: 8px;
}

.finale-art {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(20, 24, 28, 0.18));
}

.finale-copy h2 {
  margin: 0 0 0.55rem;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 3vw, 2rem);
  font-weight: 700;
}

.finale-copy p {
  margin: 0 0 1.1rem;
  color: var(--ink-soft);
}

.btn-game {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 240px);
  margin-bottom: 0.75rem;
  transition: transform 0.2s var(--ease);
}

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

.btn-game img {
  width: 100%;
  height: auto;
}

.btn-game span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
  letter-spacing: 0.03em;
}

.hint {
  margin: 0 !important;
  font-size: 0.85rem !important;
}

.hint code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.9em;
  padding: 0.1em 0.35em;
  background: rgba(20, 24, 28, 0.06);
  border-radius: 3px;
}

/* —— Footer —— */
.site-foot {
  padding: 2rem clamp(1.25rem, 5vw, 2rem) 2.5rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.88rem;
  border-top: 1px solid rgba(20, 24, 28, 0.06);
}

.site-foot p {
  margin: 0.25rem 0;
}

.foot-brand {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 700;
}

.foot-note {
  opacity: 0.75;
  font-size: 0.8rem;
}

.foot-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem 1.25rem;
  margin: 0 0 0.85rem;
}

.foot-links a {
  color: var(--ink-soft);
  font-weight: 500;
  transition: color 0.2s;
}

.foot-links a:hover,
.foot-links a[aria-current="page"] {
  color: var(--cinnabar);
}

/* —— Legal pages —— */
.legal-body .site-nav {
  background: rgba(244, 247, 248, 0.95);
  border-bottom: 1px solid rgba(20, 24, 28, 0.06);
}

.legal-main {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 6.5rem clamp(1.25rem, 5vw, 2rem) 3.5rem;
}

.legal-doc .legal-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cinnabar);
}

.legal-doc h1 {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.legal-meta {
  margin: 0 0 1.75rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.legal-doc h2 {
  margin: 2rem 0 0.65rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
}

.legal-doc h3 {
  margin: 1.25rem 0 0.45rem;
  font-size: 1.02rem;
  font-weight: 600;
}

.legal-doc p,
.legal-doc li {
  color: var(--ink-soft);
}

.legal-doc p {
  margin: 0 0 0.9rem;
}

.legal-doc ul,
.legal-doc ol {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.legal-doc li {
  margin-bottom: 0.4rem;
}

.legal-doc a {
  color: var(--cinnabar);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-doc a.btn {
  text-decoration: none;
  color: #fff;
}

.legal-note {
  padding: 0.85rem 1rem;
  background: rgba(194, 59, 46, 0.08);
  border-left: 3px solid var(--cinnabar);
  border-radius: 0 4px 4px 0;
}

.legal-cta {
  margin: 0.5rem 0 1rem;
}

.legal-doc code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.9em;
  padding: 0.1em 0.35em;
  background: rgba(20, 24, 28, 0.06);
  border-radius: 3px;
}

/* —— Reveal —— */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.reveal.is-in {
  opacity: 1;
  transform: translateY(0);
}

/* —— Responsive —— */
@media (max-width: 900px) {
  .play-points {
    grid-template-columns: 1fr;
  }

  .chapter-track {
    grid-template-columns: 1fr 1fr;
  }

  .chapter-track li:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .nav-links a:not(.nav-cta) {
    display: none;
  }

  .lang-switch {
    flex-shrink: 0;
  }

  .lang-switch {
    flex-shrink: 0;
  }

  .hero-copy {
    padding-top: 6rem;
  }

  .hero-bg {
    object-position: 70% 15%;
  }

  .chapter-track {
    grid-template-columns: 1fr;
  }

  .chapter-track li:last-child {
    grid-column: auto;
  }

  .finale-card {
    grid-template-columns: 1fr;
    text-align: center;
    justify-items: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-bg,
  .play-tower,
  .brand,
  .hero-copy h1,
  .lead,
  .cta-row {
    animation: none !important;
    opacity: 1;
    transform: none;
  }

  .reveal,
  .hero-rail figure {
    opacity: 1;
    transform: none;
    transition: none;
  }

  html {
    scroll-behavior: auto;
  }
}
