/* ===========================================================
   Navigation bar (every page): back, forward, home, and a menu
   of all pages. Fixed at the top, clear of the iPhone notch.
   =========================================================== */
:root { --nav-h: 48px; }

.tb-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  height: calc(var(--nav-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(0.6rem, env(safe-area-inset-right)) 0 max(0.6rem, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 0.35rem;
  background: rgba(13, 17, 23, 0.92);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid #1c2128;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-user-select: none; user-select: none;
}
.tb-nav button, .tb-nav a.tb-btn {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border: none; border-radius: 11px; background: transparent; color: #c9d1d9;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  text-decoration: none; padding: 0;
}
.tb-nav button:active, .tb-nav a.tb-btn:active { background: #21262d; }
.tb-nav button:disabled { color: #3a414a; cursor: default; background: transparent; }
.tb-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tb-nav .tb-title {
  flex: 1; min-width: 0; text-align: center;
  font-size: 0.95rem; font-weight: 650; color: #e6edf3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-nav .tb-here { color: #3fb950; }

/* the page list */
.tb-menu {
  position: fixed; z-index: 41;
  top: calc(var(--nav-h) + env(safe-area-inset-top) + 6px);
  right: max(0.6rem, env(safe-area-inset-right));
  width: min(300px, calc(100vw - 1.2rem));
  max-height: calc(100dvh - var(--nav-h) - env(safe-area-inset-top) - 24px); overflow: auto;
  background: #161b22; border: 1px solid #30363d; border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55); padding: 6px;
  display: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.tb-menu.open { display: block; }
.tb-menu a {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px;
  color: #e6edf3; text-decoration: none; font-size: 1rem; font-weight: 550;
  -webkit-tap-highlight-color: transparent;
}
.tb-menu a:active, .tb-menu a:hover { background: #21262d; }
.tb-menu a.current { color: #3fb950; }
.tb-menu a .nm { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-menu a .tick { font-size: 0.75rem; color: #3fb950; }
.tb-menu .sep { height: 1px; background: #21262d; margin: 4px 6px; }
.tb-menu .ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.tb-menu .ic svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tb-menu .ic.talk { background: rgba(46,160,67,.14); color: #3fb950; }
.tb-menu .ic.btns { background: rgba(88,166,255,.12); color: #58a6ff; }
.tb-menu .ic.home { background: #21262d; color: #c9d1d9; }

/* make room for the bar on every page */
body.has-nav .app { padding-top: calc(var(--nav-h) + env(safe-area-inset-top) + 0.6rem); }
body.has-nav .mix-panel { top: calc(var(--nav-h) + env(safe-area-inset-top)); padding-top: 0.6rem; }
body.has-nav main.landing { padding-top: calc(var(--nav-h) + env(safe-area-inset-top) + 18px); }

/* the big logo goes home too */
.brand-logo.tb-home-link { cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* Watch-sized screens: no room for a bar. */
@media (max-width: 300px) {
  .tb-nav, .tb-menu { display: none !important; }
  body.has-nav .app { padding-top: max(0.5rem, env(safe-area-inset-top)); }
}
