/* ─── Reset & base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--ink);
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  padding: 0 !important;
}

/* ─── Site header ───────────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  min-height: 48px;
  flex-shrink: 0;
}

.hamburger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink-2);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
}
.hamburger:hover { background: var(--bg-2); }

.site-name {
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--ink-2);
  text-decoration: none;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.site-name:hover { color: var(--ink); }

.game-title-label {
  font-size: var(--text-sm);
  color: var(--dim);
  margin-left: auto;
}
.game-title-label:empty { display: none; }

@media (min-width: 900px) {
  .hamburger { display: none; }
}

/* ─── Main layout ───────────────────────────────────────────────────────── */
.site-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ─── Sidebar ───────────────────────────────────────────────────────────── */
.site-sidebar {
  width: 180px;
  flex-shrink: 0;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px 8px;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--dim);
  text-transform: lowercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-close {
  display: none;
  border: none;
  background: none;
  color: var(--dim);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
}
.sidebar-close:hover { color: var(--ink); }

.game-list {
  list-style: none;
  padding: 6px 0;
  margin: 0;
}

.game-list a {
  display: block;
  padding: 7px 14px;
  font-size: var(--text-sm);
  color: var(--ink-2);
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.game-list a:hover {
  background: var(--panel);
  color: var(--ink);
}
.game-list a[aria-current="page"] {
  color: var(--p1);
  font-weight: 700;
  background: var(--panel);
}

/* Mobile: hidden drawer */
@media (max-width: 899px) {
  .site-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    width: 240px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
  }
  .site-sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
}

/* ─── Overlay (mobile) ──────────────────────────────────────────────────── */
.site-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 190;
  background: rgba(0, 0, 0, 0.3);
}
.site-overlay.active { display: block; }

/* ─── Game main ─────────────────────────────────────────────────────────── */
.game-main {
  flex: 1;
  min-width: 0;
  overflow: auto;
}

/* game-content: scoped target for each game's body styles (rewritten by build.js) */
.game-content {
  min-height: calc(100vh - 48px);
}

/* ─── Ad slot ───────────────────────────────────────────────────────────── */
.ad-slot {
  width: 160px;
  flex-shrink: 0;
  border-left: 1px solid var(--border);
  background: var(--bg-2);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px 8px;
}

.ad-placeholder {
  width: 140px;
  min-height: 280px;
  border: 1.5px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  color: var(--dim);
  text-transform: lowercase;
  letter-spacing: 0.06em;
}

@media (max-width: 899px) {
  .ad-slot { display: none; }
}

/* ─── Footer ────────────────────────────────────────────────────────────── */
.site-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--panel);
  display: flex;
  gap: 20px;
  font-size: var(--text-xs);
  flex-shrink: 0;
}

.site-footer a {
  color: var(--dim);
  text-decoration: none;
}
.site-footer a:hover { color: var(--ink-2); }
