/* ─────────────────────────────────────────────────────────────
   gyou.in shared foundation
   Design tokens + sitewide topbar. Loaded by every page after
   its own <style> block. Page-specific styles stay in the page.
   ───────────────────────────────────────────────────────────── */

:root {
  /* Core palette */
  --ink: #1a1a1a;
  --paper: #f5f5f3;
  --card: #fff;
  --border: #e0e0e0;
  --hairline: #f0f0f0;
  --text: #1a1a1a;
  --text-2: #666;
  --text-3: #999;

  /* Money */
  --pos: #2e7d32;
  --neg: #c62828;

  /* Accents */
  --gold: #f9a825;
  --blue: #1565c0;
  --green: #15803d;
  --orange: #e65100;
  --purple: #7b1fa2;

  /* Shape & type */
  --radius: 12px;
  --radius-sm: 8px;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sitebar-h: 48px;
}

/* ── Topbar ──────────────────────────────────────────────────
   Markup contract:
   <header class="sitebar">
     <a class="sb-home" href="index.html">🏠</a>   (subpages only)
     <div class="sb-title" [id="tb-title"]>Page name</div>
     <div class="sb-actions"> ...page buttons... </div>
   </header>
   site.js appends the ☰ menu button + dropdown to .sb-actions. */

.sitebar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #141414;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--sitebar-h);
  padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
  font-family: var(--font);
}
.sitebar .sb-home {
  color: #999;
  text-decoration: none;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  padding: 6px 2px;
}
.sitebar .sb-title {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
  color: #fff;
}
.sitebar .sb-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}
.sitebar .sb-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 9px;
  border-radius: 16px;
  border: 1px solid #3a3a3a;
  color: #bbb;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
  white-space: nowrap;
}
.sitebar .sb-btn:hover { border-color: #555; color: #ddd; }
.sitebar .sb-btn.active { background: var(--gold); border-color: var(--gold); color: var(--ink); }

/* ── Site menu (injected by site.js) ── */
.sitebar .sb-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 10px;
  background: var(--card);
  color: var(--text);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.18);
  min-width: min(232px, calc(100vw - 20px));
  max-width: calc(100vw - 20px);
  padding: 6px;
  display: none;
}
.sitebar .sb-menu.open { display: block; }
.sitebar .sb-menu a {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.sitebar .sb-menu a:hover { background: var(--paper); }
.sitebar .sb-menu a.current { background: var(--hairline); }
.sitebar .sb-menu a.current::after { content: '✓'; margin-left: auto; color: var(--text-3); font-size: 12px; }
.sitebar .sb-group {
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--text-3);
  font-weight: 700;
  text-transform: uppercase;
  padding: 8px 12px 2px;
}

/* ── Shared utilities ── */
.money-pos { color: var(--pos); }
.money-neg { color: var(--neg); }
