:root {
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ============ dark (default) ============ */
body[data-theme="dark"] {
  --bg: #0e0e14;
  --bg-soft: #16161f;
  --bg-card: #1b1b26;
  --text: #e8e8f0;
  --text-dim: #9a9aac;
  --accent: #c4b5fd;
  --accent-strong: #a78bfa;
  --border: #2a2a38;
}
/* ============ light ============ */
body[data-theme="light"] {
  --bg: #f7f6fb;
  --bg-soft: #efedf5;
  --bg-card: #ffffff;
  --text: #232336;
  --text-dim: #6d6c85;
  --accent: #7c5cf0;
  --accent-strong: #6d48e8;
  --border: #dcd9e8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background .25s ease, color .25s ease;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-size: 1.05rem;
  color: var(--text);
}
.nav { display: flex; gap: .75rem; align-items: center; }

main { flex: 1; width: 100%; max-width: 860px; margin: 0 auto; padding: 3rem 1.5rem; }

.hero { text-align: center; padding: 2.5rem 0 3rem; }
.hero h1 {
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  margin: 0 0 .4rem;
  letter-spacing: .02em;
  color: var(--text);
}
.tagline { color: var(--text-dim); font-size: 1.15rem; margin-bottom: 2rem; }
.cta { display: flex; justify-content: center; }

.placeholder {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.6rem 1.8rem;
  margin-top: 1rem;
}
.placeholder h2 { margin: 0 0 .4rem; font-size: 1.2rem; }
.placeholder p { margin: 0; color: var(--text-dim); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  cursor: pointer;
  font-family: inherit;
  transition: background .18s ease, border-color .18s ease, transform .12s ease;
}
.btn:hover { background: var(--bg-soft); border-color: var(--accent); }
.btn.primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.big { padding: .8rem 1.7rem; font-size: 1.1rem; }

footer {
  text-align: center;
  padding: 1.6rem;
  color: var(--text-dim);
  font-size: .85rem;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
}

@media (max-width: 560px) {
  .topbar { padding: .8rem 1rem; }
  main { padding: 2rem 1rem; }
}

/* ============ game page ============ */
body.gamepage main.game-wrap {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.frame-box {
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  box-shadow: 0 10px 40px rgb(0 0 0 / .35);
}
.frame-box iframe {
  display: block;
  width: 100%;
  aspect-ratio: 816 / 624;
  border: 0;
  background: #000;
}
.hint {
  text-align: center;
  color: var(--text-dim);
  font-size: .9rem;
  margin: 0;
}
.crumb { color: var(--text-dim); font-size: .95rem; padding-right: .5rem; }
.brand a { color: inherit; text-decoration: none; }

/* ============ hamburger + drawer ============ */
.tb-left { display: flex; align-items: center; gap: .8rem; }
.hamburger {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 38px;
  height: 38px;
  padding: 8px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: background .18s ease, border-color .18s ease;
}
.hamburger:hover { background: var(--bg-soft); border-color: var(--accent); }
.hamburger span {
  display: block;
  height: 2px;
  width: 100%;
  border-radius: 2px;
  background: var(--text);
  transition: transform .22s ease, opacity .18s ease;
}
.hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.drawer {
  position: fixed;
  top: 0; left: 0;
  width: 280px;
  height: 100vh;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
  padding: 4.5rem 1.2rem 1.5rem;
  transform: translateX(-105%);
  transition: transform .25s ease;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: .15rem;
}
.drawer.open { transform: translateX(0); }
.drawer-title {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .8rem;
  color: var(--text-dim);
  padding: 0 .6rem .5rem;
}
.drawer a {
  color: var(--text);
  text-decoration: none;
  padding: .55rem .6rem;
  border-radius: 8px;
  font-weight: 550;
}
.drawer a:hover { background: var(--bg-card); color: var(--accent-strong); }
.drawer-sep { height: 1px; background: var(--border); margin: .55rem .4rem; }

.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / .45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
  z-index: 50;
}
.drawer-scrim.show { opacity: 1; pointer-events: all; }

/* ============ docs page (zensical-style placeholder) ============ */
body.docspage main.docs-wrap {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 2.2rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 2.5rem;
}
.docs-toc {
  position: sticky;
  top: 76px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: .1rem;
  border-left: 2px solid var(--border);
  padding-left: .9rem;
}
.toc-title {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-size: .75rem;
  color: var(--text-dim);
  margin-bottom: .55rem;
}
.toc-link {
  color: var(--text-dim);
  text-decoration: none;
  font-size: .92rem;
  padding: .28rem 0;
}
.toc-link:hover { color: var(--accent-strong); }
.toc-link.active { color: var(--accent); font-weight: 650; }
.docs-article { min-width: 0; }
.docs-article h1 { font-size: 2rem; }
.docs-article h2 { font-size: 1.35rem; margin-top: 2rem; }
.docs-article code {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .1em .35em;
}
.badge {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .12rem .55rem;
  vertical-align: middle;
  margin-left: .4rem;
}
.note {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: .8rem 1rem;
  margin: 1rem 0;
}
.docs-article table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
}
.docs-article th, .docs-article td {
  border: 1px solid var(--border);
  padding: .45rem .7rem;
  text-align: left;
  font-size: .95rem;
}
.docs-article th { background: var(--bg-card); color: var(--text); }
.docs-article ol li, .docs-article ul li { margin: .3rem 0; }

@media (max-width: 760px) {
  body.docspage main.docs-wrap { grid-template-columns: 1fr; }
  .docs-toc { position: static; border-left: 0; }
}
.brand-plain a { color: inherit; text-decoration: none; }
.crumb-sep { color: var(--text-dim); margin: 0 .35rem; }
.brand a { color: inherit; text-decoration: none; }