:root {
  --bg: #0b1117;
  --bg-alt: #111923;
  --surface: #16202c;
  --surface-hover: #1c2938;
  --border: rgba(148, 163, 184, 0.16);
  --text: #e6edf3;
  --muted: #94a3b8;
  --accent: #22c55e;
  --accent-strong: #16a34a;
  --gold: #f59e0b;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
}

html[data-theme="light"] {
  --bg: #f8fafc;
  --bg-alt: #eef2f6;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --border: rgba(15, 23, 42, 0.1);
  --text: #0f172a;
  --muted: #475569;
  --accent: #16a34a;
  --accent-strong: #15803d;
  --gold: #d97706;
  --shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(148, 163, 184, 0.14);
}

.container {
  width: min(1160px, 92%);
  margin: 0 auto;
}

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-badge {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #10b981);
  color: #04130a;
  font-weight: 800;
}

.version-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.14);
  color: var(--accent);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.nav-links {
  display: flex;
  gap: 22px;
  color: var(--muted);
  font-size: 0.94rem;
}

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

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Buttons */
.btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.93rem;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  border: 1px solid transparent;
}

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

.btn {
  padding: 10px 18px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 8px;
}

.btn-primary {
  background: var(--accent);
  color: #052e16;
}

.btn-primary:hover {
  background: var(--accent-strong);
  color: #ffffff;
}

.btn-secondary {
  background: rgba(245, 158, 11, 0.15);
  color: var(--gold);
  border-color: rgba(245, 158, 11, 0.35);
}

.btn-outline,
.icon-btn {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}

.icon-btn {
  height: 34px;
  min-width: 36px;
  padding: 0 10px;
  font-size: 0.82rem;
}

/* Hero */
.hero {
  padding: 64px 0 72px;
  background:
    radial-gradient(600px circle at 12% 10%, rgba(34, 197, 94, 0.12), transparent 60%),
    radial-gradient(500px circle at 88% 20%, rgba(245, 158, 11, 0.08), transparent 60%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 42px;
  align-items: center;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.pill {
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.pill.accent {
  color: var(--accent);
  border-color: rgba(34, 197, 94, 0.32);
}

.pill.gold {
  color: var(--gold);
  border-color: rgba(245, 158, 11, 0.32);
}

.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(2.1rem, 4vw, 3.1rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.hero-subtitle {
  margin: 0 0 26px;
  color: var(--muted);
  font-size: 1.05rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.platform-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.84rem;
}

.platform-badges span {
  padding: 3px 10px;
  border-radius: 6px;
  border: 1px dashed var(--border);
}

.preview-card {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: zoom-in;
}

.preview-card img {
  display: block;
  width: 100%;
  height: auto;
}

.preview-hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #f8fafc;
}

/* Sections & Cards */
.section {
  padding: 68px 0;
}

.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-head {
  max-width: 720px;
  margin-bottom: 34px;
}

.section-head h2 {
  margin: 0 0 8px;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  letter-spacing: -0.02em;
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.card:hover {
  border-color: rgba(34, 197, 94, 0.45);
}

.muted {
  color: var(--muted);
  font-size: 0.93rem;
}

/* Wiki Grid */
.wiki-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.wiki-card h3 {
  margin: 10px 0 6px;
  font-size: 1.15rem;
}

.wiki-tag {
  display: inline-block;
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(34, 197, 94, 0.14);
  color: var(--accent);
}

.wiki-tag.calamity {
  background: rgba(239, 68, 68, 0.14);
  color: #f87171;
}

.wiki-tag.fargo {
  background: rgba(245, 158, 11, 0.14);
  color: var(--gold);
}

.wiki-tag.thorium {
  background: rgba(56, 189, 248, 0.14);
  color: #38bdf8;
}

.code-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}

/* Bento Features */
.bento-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.feat-icon {
  font-size: 1.5rem;
  margin-bottom: 10px;
}

.bento-card h3 {
  margin: 0 0 8px;
  font-size: 1.08rem;
}

.bento-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.gallery-item {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: zoom-in;
  text-align: left;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.gallery-item:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  display: block;
}

.gallery-item span {
  padding: 10px 12px;
  font-size: 0.88rem;
  font-weight: 600;
}

/* Platforms */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.platform-card h3 {
  margin: 0 0 6px;
}

.req {
  margin: 0 0 10px;
  font-size: 0.86rem;
  color: var(--accent);
  font-weight: 600;
}

/* Quickstart */
.qs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.qs-card h3 {
  margin: 0 0 16px;
}

.pkg-links {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pkg-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
}

.pkg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

.copy-btn {
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.78rem;
  cursor: pointer;
}

.steps-list {
  margin: 0 0 16px;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--muted);
}

.steps-list strong {
  color: var(--text);
}

.tip-box {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.25);
  font-size: 0.88rem;
  color: var(--muted);
}

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

.footer a:hover {
  color: var(--accent);
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(5, 10, 16, 0.88);
}

.lightbox[hidden] {
  display: none;
}

.lightbox img {
  max-width: min(1100px, 94vw);
  max-height: 82vh;
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.8);
  color: #ffffff;
  font-size: 1.5rem;
  cursor: pointer;
}

.lightbox-caption {
  margin: 12px 0 0;
  color: #e2e8f0;
  font-size: 0.94rem;
}

@media (max-width: 980px) {
  .hero-grid,
  .qs-grid {
    grid-template-columns: 1fr;
  }
  .wiki-grid,
  .platform-grid,
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .bento-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .nav-links {
    display: none;
  }
}

@media (max-width: 600px) {
  .wiki-grid,
  .platform-grid,
  .gallery-grid,
  .bento-grid {
    grid-template-columns: 1fr;
  }
}
