/* Monkey King · Whitepaper — Light Document Theme */
:root {
  --bg: #ffffff;
  --bg-subtle: #f8f9fb;
  --surface: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --text-muted: #6b7280;
  --accent: #9a7b2f;
  --accent-dark: #7a6020;
  --accent-soft: #f7f3e8;
  --accent-border: #e8dcc0;
  --navy: #1e293b;
  --green: #047857;
  --green-soft: #ecfdf5;
  --purple: #6d28d9;
  --red-soft: #fef2f2;
  --red-border: #fecaca;
  --sidebar-w: 260px;
  --header-h: 60px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.06);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-primary);
  font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(154, 123, 47, 0.18);
  color: var(--text-primary);
}

a {
  color: var(--accent-dark);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.bg-grid,
.bg-glow {
  display: none;
}

/* ── Header ── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  object-fit: cover;
  display: block;
  flex-shrink: 0;
}

.brand-text strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.01em;
}

.brand-text span {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 12px;
  color: var(--text-muted);
}

.lang-link {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
}

.lang-link:hover {
  border-color: var(--border-strong);
  background: var(--bg-subtle);
  text-decoration: none;
}

.version-badge {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
  font-size: 11px;
}

.menu-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-primary);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* ── Layout ── */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  max-width: 1200px;
  margin: 0 auto;
  padding-top: var(--header-h);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 32px 20px 48px 32px;
  border-right: 1px solid var(--border);
  background: var(--bg-subtle);
}

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.toc {
  list-style: none;
}

.toc li {
  margin-bottom: 1px;
}

.toc a {
  display: block;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  border-left: 2px solid transparent;
  text-decoration: none;
  transition: all 0.15s;
}

.toc a:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.03);
}

.toc a.active {
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-left-color: var(--accent);
  font-weight: 500;
}

.toc .toc-sub a {
  padding-left: 20px;
  font-size: 12px;
}

.main {
  padding: 48px 56px 96px;
  max-width: 760px;
}

/* ── Hero ── */
.hero {
  margin-bottom: 56px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
}

.doc-type {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.hero h1 {
  font-family: "Libre Baskerville", Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4.5vw, 2.75rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--navy);
  margin-bottom: 12px;
}

.hero-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  max-width: 560px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 28px;
  font-size: 12px;
  color: var(--text-muted);
}

.hero-meta span b {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.tag {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
}

.hero-summary {
  padding: 22px 26px;
  border-radius: 8px;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  font-size: 15px;
  color: var(--text-primary);
  line-height: 1.8;
}

.hero-summary strong {
  color: var(--accent-dark);
}

/* ── Sections ── */
section {
  margin-bottom: 52px;
  scroll-margin-top: calc(var(--header-h) + 24px);
}

.section-num {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

h2 {
  font-family: "Libre Baskerville", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 18px;
  color: var(--navy);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 28px 0 10px;
  color: var(--navy);
  scroll-margin-top: calc(var(--header-h) + 24px);
}

h4 {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 18px 0 8px;
  color: var(--accent-dark);
}

p {
  margin-bottom: 14px;
  color: var(--text-secondary);
}

ul, ol {
  margin: 0 0 16px 20px;
  color: var(--text-secondary);
}

li {
  margin-bottom: 6px;
}

/* ── Panels ── */
.panel {
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: 22px 26px;
  margin: 20px 0;
  box-shadow: var(--shadow-sm);
}

.panel--accent {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.panel--warn {
  border-color: var(--red-border);
  background: var(--red-soft);
}

/* ── Tables ── */
.table-wrap {
  overflow-x: auto;
  margin: 16px 0 24px;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: var(--bg-subtle);
}

th {
  text-align: left;
  padding: 11px 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: top;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: #fafbfc;
}

.tier-star {
  color: var(--accent-dark);
  letter-spacing: 1px;
}

/* ── Architecture ── */
.arch-diagram {
  display: grid;
  gap: 10px;
  margin: 22px 0;
}

.arch-row {
  display: grid;
  gap: 10px;
}

.arch-row--3 { grid-template-columns: repeat(3, 1fr); }
.arch-row--2 { grid-template-columns: repeat(2, 1fr); }

.arch-box {
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.arch-box strong {
  display: block;
  font-size: 12px;
  margin-bottom: 3px;
  color: var(--navy);
}

.arch-box span {
  font-size: 11px;
  color: var(--text-muted);
}

.arch-box--highlight {
  border-color: var(--accent-border);
  background: var(--accent-soft);
}

.arch-box--game {
  border-color: #a7f3d0;
  background: var(--green-soft);
}

.arch-arrow {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 2px 0;
}

/* ── Flow ── */
.flow-steps {
  margin: 22px 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.flow-step {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  align-items: start;
}

.flow-step:last-child { border-bottom: none; }
.flow-step:nth-child(even) { background: var(--bg-subtle); }

.flow-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-dark);
}

.flow-step strong {
  display: block;
  font-size: 13px;
  margin-bottom: 3px;
  color: var(--navy);
}

.flow-step p {
  margin: 0;
  font-size: 13px;
}

/* ── Roadmap ── */
.roadmap {
  position: relative;
  padding-left: 28px;
  margin: 22px 0;
}

.roadmap::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}

.roadmap-item {
  position: relative;
  margin-bottom: 26px;
}

.roadmap-item::before {
  content: "";
  position: absolute;
  left: -25px;
  top: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: var(--bg);
}

.roadmap-item--current::before {
  background: var(--accent);
}

.roadmap-item--milestone::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(184, 134, 11, 0.2);
}

.roadmap-item--milestone {
  padding: 14px 16px;
  margin-left: -16px;
  padding-left: 16px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(184, 134, 11, 0.08), transparent);
  border-left: 3px solid var(--accent);
}

.roadmap-item--milestone .roadmap-phase {
  color: #8b6914;
}

.roadmap-phase {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}

.roadmap-item h4 {
  margin: 0 0 6px;
  font-size: 0.95rem;
  color: var(--navy);
}

.roadmap-item p {
  margin: 0;
  font-size: 13px;
}

/* ── Tier cards ── */
.tier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.tier-card {
  padding: 16px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.tier-card__stars {
  font-size: 13px;
  letter-spacing: 2px;
  margin-bottom: 6px;
}

.tier-card__name {
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 3px;
}

.tier-card__supply {
  font-size: 11px;
  color: var(--text-muted);
}

.tier-card--1 { --tc: #6b7280; }
.tier-card--2 { --tc: #047857; }
.tier-card--3 { --tc: #2563eb; }
.tier-card--4 { --tc: #7c3aed; }
.tier-card--5 { --tc: #9a7b2f; border-color: var(--accent-border); background: var(--accent-soft); }
.tier-card__stars { color: var(--tc, var(--accent)); }

/* ── Whitelist ── */
.whitelist-levels {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.wl-level {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 14px;
  padding: 14px 18px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
  align-items: start;
}

.wl-badge {
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

.wl-badge--l1 { background: #f3f4f6; color: #4b5563; }
.wl-badge--l2 { background: #ede9fe; color: var(--purple); }
.wl-badge--l3 { background: var(--accent-soft); color: var(--accent-dark); }

.wl-level strong {
  display: block;
  font-size: 13px;
  margin-bottom: 3px;
  color: var(--navy);
}

.wl-level p {
  margin: 0;
  font-size: 12px;
}

/* ── Studio & Team ── */
.studio-card {
  margin: 22px 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.studio-card__header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.studio-logo {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--accent-dark);
}

.studio-card__header strong {
  display: block;
  font-size: 15px;
  color: var(--navy);
}

.studio-card__header span {
  font-size: 11px;
  color: var(--text-muted);
}

.studio-card__body {
  padding: 22px 24px;
}

.studio-highlights {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.studio-stat {
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  text-align: center;
}

.studio-stat b {
  display: block;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--accent-dark);
}

.studio-stat span {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.35;
}

.team-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 22px 0;
}

.team-member {
  padding: 18px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}

.team-member__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 12px;
}

.team-member__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 2px;
}

.team-member__role {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}

.team-member__bio {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

.team-member__prev {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-secondary);
  font-style: italic;
}

/* ── Footer ── */
.site-footer {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.disclaimer p {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.7;
}

.footer-bar {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

#printBtn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 12px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 11px;
}

#printBtn:hover {
  background: var(--bg-subtle);
}

.sidebar-overlay {
  display: none;
}

/* ── Responsive ── */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: min(280px, 85vw);
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    background: var(--bg);
    box-shadow: var(--shadow-md);
  }

  .sidebar.open { transform: translateX(0); }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    top: var(--header-h);
    z-index: 80;
    background: rgba(0, 0, 0, 0.3);
  }

  .sidebar-overlay.open { display: block; }

  .menu-toggle { display: flex; }

  .header-meta span:not(.version-badge):not(.lang-link) { display: none; }

  .main { padding: 32px 24px 64px; }

  .arch-row--3, .arch-row--2 { grid-template-columns: 1fr; }

  .team-grid { grid-template-columns: 1fr; }

  .wl-level { grid-template-columns: 1fr; gap: 8px; }

  .studio-highlights { grid-template-columns: 1fr; }
}

@media print {
  .site-header, .sidebar, .menu-toggle, .lang-link { display: none !important; }
  .layout { display: block; padding-top: 0; }
  .main { max-width: 100%; padding: 0; }
  body { background: white; }
}
