:root {
  --ink: #10151f;
  --panel: #172033;
  --panel-2: #22304a;
  --text: #f7f1d7;
  --muted: #b6c2d8;
  --accent: #7fffd4;
  --accent-dark: #06261f;
  --line: #55627c;
  --green: #b7ff6a;
  --rose: #ff6f91;
  --gold: #ffd45a;
  --shadow: 0 18px 0 #080b11;
  --pixel: 4px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    radial-gradient(circle at 74% 12%, rgba(127, 255, 212, 0.2), transparent 24rem),
    radial-gradient(circle at 18% 80%, rgba(255, 212, 90, 0.12), transparent 22rem),
    linear-gradient(135deg, #07111d 0%, #12283a 46%, #09101a 100%);
  background-size: 28px 28px, 28px 28px, auto, auto;
  font-family: "Courier New", "Microsoft YaHei", monospace;
  letter-spacing: 0;
}

.site-backdrop {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(to bottom, rgba(5, 12, 20, 0.3), rgba(5, 12, 20, 0.82)),
    linear-gradient(90deg, rgba(5, 12, 20, 0.46), rgba(5, 12, 20, 0.08) 46%, rgba(5, 12, 20, 0.72)),
    url("assets/world-tree.jpg") center top / cover no-repeat fixed;
}

.site-backdrop::after {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 12px 12px;
  content: "";
  mix-blend-mode: overlay;
  opacity: 0.28;
}

a {
  color: inherit;
}

.scanline {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0.04) 1px,
    transparent 1px,
    transparent 5px
  );
  mix-blend-mode: soft-light;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1180px;
  margin: 0 auto;
  padding: 1rem clamp(1rem, 4vw, 2rem);
  background: rgba(13, 19, 32, 0.88);
  border: var(--pixel) solid var(--line);
  border-top: 0;
  box-shadow: 0 8px 0 #080b11;
  backdrop-filter: blur(12px);
}

.brand,
.nav,
.hero-actions,
.contact-links,
.quest-top,
.site-footer {
  display: flex;
  align-items: center;
}

.brand {
  gap: 0.75rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 900;
}

.brand-mark {
  width: 18px;
  height: 18px;
  background: var(--accent);
  box-shadow:
    6px 0 0 var(--green),
    0 6px 0 var(--gold),
    6px 6px 0 var(--text);
}

.nav {
  gap: 0.5rem;
}

.nav a {
  padding: 0.75rem 0.9rem;
  color: var(--muted);
  text-decoration: none;
  border: 2px solid transparent;
}

.nav a:hover,
.nav a:focus-visible {
  color: var(--ink);
  background: var(--accent);
  border-color: var(--text);
  outline: none;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 3px solid var(--line);
  background: var(--panel);
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 3px;
  margin: 5px auto;
  background: var(--accent);
}

.section {
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(4rem, 8vw, 7rem) clamp(1rem, 4vw, 2rem);
}

.hero {
  display: grid;
  min-height: calc(100dvh - 88px);
  align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.82fr);
  gap: clamp(2rem, 6vw, 5rem);
}

.eyebrow {
  margin: 0 0 1rem;
  color: var(--green);
  font-size: 0.85rem;
  font-weight: 900;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 12ch;
  margin-bottom: 1.25rem;
  font-size: clamp(2.8rem, 7vw, 5.8rem);
  line-height: 1.05;
  text-shadow: 5px 5px 0 #000;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.05;
}

h3 {
  margin-bottom: 0.7rem;
  color: var(--accent);
  font-size: 1.35rem;
}

.hero-text {
  max-width: 54ch;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.8;
}

.hero-actions,
.contact-links {
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 2rem;
}

.btn {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.1rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 900;
  border: 3px solid var(--text);
  box-shadow: 6px 6px 0 #000;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.btn:hover,
.btn:focus-visible {
  transform: translate(-2px, -2px);
  box-shadow: 8px 8px 0 #000;
  outline: none;
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

.btn-primary {
  color: var(--accent-dark);
  background: var(--accent);
}

.btn-ghost {
  background: var(--panel);
}

.pixel-stage,
.panel,
.quest-card,
.save-point {
  border: var(--pixel) solid var(--line);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.pixel-stage {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  image-rendering: pixelated;
  background:
    linear-gradient(to bottom, rgba(7, 17, 29, 0.12), rgba(7, 17, 29, 0.78)),
    rgba(7, 17, 29, 0.28);
  isolation: isolate;
}

.pixel-stage::before,
.pixel-stage::after {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  content: "";
}

.pixel-stage::before {
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 10px 10px;
  mix-blend-mode: overlay;
  opacity: 0.34;
}

.pixel-stage::after {
  background:
    linear-gradient(to bottom, rgba(5, 11, 19, 0.08), rgba(5, 11, 19, 0.62)),
    repeating-linear-gradient(
      to bottom,
      rgba(255, 255, 255, 0.08),
      rgba(255, 255, 255, 0.08) 1px,
      transparent 1px,
      transparent 8px
    );
}

.tree-aura {
  position: absolute;
  top: 28%;
  left: 50%;
  z-index: 1;
  width: 190px;
  height: 190px;
  background:
    radial-gradient(circle, rgba(127, 255, 212, 0.58), transparent 58%),
    conic-gradient(from 45deg, transparent, rgba(183, 255, 106, 0.28), transparent);
  filter: blur(1px);
  transform: translate(-50%, -50%);
  animation: pulseAura 2.4s steps(4) infinite;
}

.moon {
  position: absolute;
  z-index: 3;
  top: 56px;
  right: 60px;
  width: 58px;
  height: 58px;
  background: var(--gold);
  box-shadow:
    -14px 14px 0 rgba(255, 255, 255, 0.62),
    0 0 0 8px rgba(255, 212, 90, 0.16);
}

.stars,
.stars::before,
.stars::after {
  position: absolute;
  width: 5px;
  height: 5px;
  background: var(--text);
  box-shadow:
    42px 74px 0 var(--green),
    120px 36px 0 var(--text),
    210px 92px 0 var(--rose),
    300px 44px 0 var(--accent);
  content: "";
}

.stars {
  z-index: 3;
  top: 72px;
  left: 42px;
  animation: floatStars 6s steps(4) infinite;
}

.runes {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.runes span {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 3px solid var(--accent);
  box-shadow: 0 0 18px rgba(127, 255, 212, 0.62);
  animation: runeFloat 4s steps(4) infinite;
}

.runes span:nth-child(1) {
  top: 28%;
  left: 17%;
}

.runes span:nth-child(2) {
  top: 44%;
  right: 17%;
  animation-delay: 0.9s;
}

.runes span:nth-child(3) {
  top: 17%;
  left: 48%;
  animation-delay: 1.7s;
}

.city {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 88px;
  left: 0;
  display: grid;
  align-items: end;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 28px;
}

.city span {
  display: block;
  background:
    linear-gradient(90deg, transparent 42%, rgba(127, 255, 212, 0.7) 42% 54%, transparent 54%),
    rgba(10, 14, 24, 0.72);
  border: 3px solid rgba(127, 255, 212, 0.42);
}

.city span:nth-child(1) {
  height: 150px;
}

.city span:nth-child(2) {
  height: 215px;
}

.city span:nth-child(3) {
  height: 120px;
}

.city span:nth-child(4) {
  height: 180px;
}

.cloud-floor {
  position: absolute;
  right: -20px;
  bottom: 70px;
  left: -20px;
  z-index: 4;
  height: 76px;
  background:
    linear-gradient(90deg, transparent 0 8%, rgba(247, 241, 215, 0.86) 8% 18%, transparent 18% 24%, rgba(127, 255, 212, 0.72) 24% 37%, transparent 37% 44%, rgba(247, 241, 215, 0.78) 44% 62%, transparent 62% 68%, rgba(183, 255, 106, 0.58) 68% 82%, transparent 82%),
    linear-gradient(to top, rgba(7, 17, 29, 0.95), transparent);
  filter: blur(0.4px);
}

.avatar {
  position: absolute;
  z-index: 5;
  bottom: 86px;
  left: 54px;
  width: 86px;
  height: 146px;
  animation: idle 1.3s steps(2) infinite;
}

.avatar span {
  position: absolute;
  display: block;
}

.head {
  top: 0;
  left: 22px;
  width: 42px;
  height: 42px;
  background: var(--gold);
  box-shadow:
    12px 12px 0 #121721,
    22px 12px 0 #121721;
}

.body {
  top: 46px;
  left: 12px;
  width: 62px;
  height: 58px;
  background: var(--green);
  box-shadow: inset 0 -14px 0 #159b70;
}

.leg {
  bottom: 0;
  width: 24px;
  height: 42px;
  background: var(--rose);
}

.leg.left {
  left: 14px;
}

.leg.right {
  right: 14px;
}

.dialogue {
  position: absolute;
  z-index: 6;
  right: 26px;
  bottom: 22px;
  left: 26px;
  min-height: 54px;
  padding: 1rem;
  color: var(--green);
  background: rgba(7, 10, 16, 0.9);
  border: 3px solid var(--text);
  font-weight: 900;
}

.prompt {
  color: var(--gold);
}

.mini-map {
  position: absolute;
  top: 22px;
  left: 22px;
  z-index: 6;
  display: grid;
  width: 104px;
  height: 104px;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px;
  background: rgba(7, 10, 16, 0.78);
  border: 3px solid var(--text);
  box-shadow: 5px 5px 0 #000;
}

.mini-map span {
  display: block;
  background: rgba(127, 255, 212, 0.32);
  border: 2px solid rgba(247, 241, 215, 0.32);
}

.mini-map span:nth-child(2),
.mini-map span:nth-child(4) {
  background: var(--green);
}

.mini-map span:nth-child(3) {
  background: var(--gold);
}

.section-heading {
  max-width: 760px;
  margin-bottom: 2rem;
}

.status-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 1rem;
}

.panel {
  padding: clamp(1rem, 3vw, 1.5rem);
  background:
    linear-gradient(135deg, rgba(127, 255, 212, 0.08), rgba(23, 32, 51, 0.72)),
    rgba(23, 32, 51, 0.76);
  backdrop-filter: blur(8px);
}

.panel-title {
  margin-bottom: 1rem;
  color: var(--accent);
  font-weight: 900;
}

.profile-card p,
.quest-card p,
.save-point p {
  color: var(--muted);
  line-height: 1.75;
}

.inventory {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 1.2rem;
}

.inventory span {
  min-height: 54px;
  display: grid;
  place-items: center;
  color: var(--accent-dark);
  background: var(--accent);
  border: 3px solid var(--text);
  box-shadow: 4px 4px 0 #000;
  font-size: 0.82rem;
  font-weight: 900;
}

.stat-card {
  min-height: 170px;
}

.stat-card span,
.stat-card small {
  display: block;
  color: var(--muted);
}

.stat-card strong {
  display: block;
  margin: 1.2rem 0 0.45rem;
  color: var(--accent);
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.quest-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.quest-card {
  min-height: 280px;
  padding: 1.4rem;
  background:
    linear-gradient(135deg, rgba(127, 255, 212, 0.09), transparent 42%),
    rgba(23, 32, 51, 0.78);
  backdrop-filter: blur(8px);
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease;
}

.quest-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.quest-top {
  justify-content: space-between;
  margin-bottom: 2rem;
}

.quest-icon,
.quest-tag {
  display: inline-grid;
  min-width: 44px;
  min-height: 34px;
  place-items: center;
  color: var(--ink);
  background: var(--gold);
  border: 3px solid var(--text);
  font-weight: 900;
}

.quest-tag {
  color: var(--text);
  background: var(--panel-2);
}

.quest-card a {
  display: inline-block;
  margin-top: 1rem;
  color: var(--green);
  font-weight: 900;
}

.skill-tree {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.skill-node {
  min-height: 76px;
  padding: 1.25rem 1rem;
  color: var(--muted);
  background: #0a0e18;
  border: 3px solid var(--line);
  text-align: center;
  font-weight: 900;
  box-shadow: 5px 5px 0 #000;
}

.skill-node.active {
  color: var(--accent-dark);
  background: var(--accent);
  border-color: var(--text);
}

.contact {
  padding-bottom: 5rem;
}

.save-point {
  max-width: 780px;
  padding: clamp(1.5rem, 5vw, 3rem);
  background:
    linear-gradient(135deg, rgba(127, 255, 212, 0.1), rgba(23, 32, 51, 0.72)),
    rgba(23, 32, 51, 0.78);
  backdrop-filter: blur(8px);
}

.site-footer {
  justify-content: space-between;
  gap: 1rem;
  max-width: 1180px;
  margin: 0 auto 2rem;
  padding: 1rem clamp(1rem, 4vw, 2rem);
  color: var(--muted);
  border-top: 3px solid var(--line);
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 520ms ease, transform 520ms ease;
}

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

@keyframes floatStars {
  50% {
    transform: translateY(8px);
  }
}

@keyframes idle {
  50% {
    transform: translateY(-4px);
  }
}

@keyframes pulseAura {
  50% {
    opacity: 0.68;
    transform: translate(-50%, -50%) scale(1.08);
  }
}

@keyframes runeFloat {
  50% {
    transform: translateY(-12px) rotate(45deg);
  }
}

@media (max-width: 860px) {
  .site-header {
    margin: 0;
    border-right: 0;
    border-left: 0;
  }

  .nav-toggle {
    display: block;
  }

  .nav {
    position: absolute;
    top: calc(100% + 4px);
    right: 1rem;
    left: 1rem;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem;
    background: var(--panel);
    border: 3px solid var(--line);
    box-shadow: 6px 6px 0 #000;
  }

  .nav.is-open {
    display: flex;
  }

  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    padding-top: 3rem;
  }

  h1 {
    max-width: 11ch;
    font-size: clamp(2.4rem, 13vw, 4.2rem);
  }

  .pixel-stage {
    min-height: 430px;
  }

  .status-grid,
  .quest-grid,
  .skill-tree {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: 130px;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 520px) {
  .section {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .pixel-stage {
    min-height: 390px;
  }

  .moon {
    top: 38px;
    right: 34px;
  }

  .avatar {
    left: 34px;
    transform: scale(0.82);
    transform-origin: bottom left;
  }

  .dialogue {
    right: 14px;
    left: 14px;
    font-size: 0.86rem;
  }

  .mini-map {
    width: 82px;
    height: 82px;
  }

  .inventory {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
