/* AOY University hub — paper/charcoal, mirrors NH/SB/AOY design tokens. */

:root {
  --bg: #fdfcf8;
  --paper: #ffffff;
  --text: #2a2824;
  --text-muted: rgba(42, 40, 36, 0.62);
  --text-subtle: rgba(42, 40, 36, 0.38);
  --border: rgba(42, 40, 36, 0.12);
  --hover: rgba(42, 40, 36, 0.05);
  --card-bg: #ffffff;
  --card-shadow: rgba(15, 15, 15, 0.07) 0 0 0 1px, rgba(15, 15, 15, 0.08) 0 3px 8px;
  --card-shadow-hover: rgba(15, 15, 15, 0.1) 0 0 0 1px, rgba(15, 15, 15, 0.14) 0 10px 24px;
  --accent: #d4a017;
  --accent-soft: rgba(212, 160, 23, 0.12);
  --blue: #2383e2;
  --radius: 14px;

  --mode-icon-light-display: inline;
  --mode-icon-dark-display: none;
}

html[data-mode="dark"] {
  --bg: #1c1a16;
  --paper: #24211c;
  --text: #ece6d6;
  --text-muted: rgba(236, 230, 214, 0.65);
  --text-subtle: rgba(236, 230, 214, 0.4);
  --border: rgba(236, 230, 214, 0.14);
  --hover: rgba(236, 230, 214, 0.06);
  --card-bg: #2a2620;
  --card-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 4px 12px rgba(0, 0, 0, 0.4);
  --card-shadow-hover: 0 0 0 1px rgba(236, 230, 214, 0.2), 0 14px 30px rgba(0, 0, 0, 0.5);
  --accent: #f0c252;
  --accent-soft: rgba(240, 194, 82, 0.14);
  --blue: #7ab5ff;

  --mode-icon-light-display: none;
  --mode-icon-dark-display: inline;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
a:visited { color: inherit; }

/* ---------- Hub header ---------- */

.hub-header {
  max-width: 1280px;
  margin: 0 auto;
  padding: 36px 64px 22px 64px;
}

.hub-brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.hub-mark {
  font-size: 44px;
  line-height: 1;
}

.hub-titles h1 {
  font-size: 36px;
  font-weight: 700;
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
}

.hub-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

/* ---------- Sub-header (used on /mcp-setup) ---------- */

.hub-subheader {
  max-width: 920px;
  margin: 0 auto;
  padding: 32px 32px 0 32px;
}

.back-link {
  color: var(--text-muted);
  font-size: 14px;
  display: inline-block;
  padding: 6px 0;
}
.back-link:hover { color: var(--text); }

/* ---------- Tip of the day (between hub-header and hub-grid) ----------
   Three swappable visual variants. Outer .tip-of-day[data-variant="A|B|C"]
   selects which look applies. Inner DOM is identical across variants —
   only CSS + label/icon (set by JS) change. */

.tip-of-day {
  position: relative;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 64px 28px 64px;
}
@media (max-width: 980px) { .tip-of-day { padding: 0 32px 22px 32px; } }

/* Shared structure */
.tip-of-day-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 18px 22px;
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}
.tip-of-day-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 84px;
  flex: 0 0 auto;
}
.tip-of-day-icon { font-size: 28px; line-height: 1; }
.tip-of-day-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tip-of-day-body {
  flex: 1 1 auto;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  font-weight: 500;
  transition: opacity 0.18s ease, transform 0.18s ease;
  will-change: transform, opacity;
}
/* Swipe-out: old tip slides ~40px to the left while fading. */
.tip-of-day-body.tip-swiping-out {
  opacity: 0;
  transform: translateX(-40px);
}
/* Swipe-in starting state: new tip is parked +40px to the right, invisible.
   JS removes this class on the next frame, so the transition lands on the
   default (translateX 0, opacity 1) — the new tip slides in from the right. */
.tip-of-day-body.tip-swiping-in {
  opacity: 0;
  transform: translateX(40px);
  transition: none;  /* snap to start, animate only on the removal */
}
.tip-of-day-attrib { display: none; }
.tip-of-day-next {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease, transform 0.3s ease;
}
.tip-of-day-next:hover { background: var(--hover); color: var(--text); transform: translateX(2px); }
.tip-of-day-next:active { transform: translateX(4px); }
/* Inline SVGs render exactly centered (viewBox geometry, not glyph baseline).
   16px size leaves 5px breathing room inside the 36px button. */
.tip-of-day-next svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Arrow-style picker — small letter pills under or beside the section.
   Six options A–F. Once user picks the winner, drop this picker + lock
   the choice in JS like we did for tip-of-day variant A3. */
.tip-arrow-picker {
  position: absolute;
  top: -6px;
  right: 64px;
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--card-bg);
  border-radius: 999px;
  box-shadow: var(--card-shadow);
  z-index: 2;
}
@media (max-width: 980px) { .tip-arrow-picker { right: 32px; } }
.tip-arrow-picker button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.tip-arrow-picker button:hover { color: var(--text); }
.tip-arrow-picker button.active { background: var(--accent-soft); color: var(--accent); }

/* Picker pill — small, top-right of section, doesn't compete with content. */
.tip-picker {
  position: absolute;
  top: -6px;
  right: 64px;
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: var(--card-bg);
  border-radius: 999px;
  box-shadow: var(--card-shadow);
  z-index: 2;
}
@media (max-width: 980px) { .tip-picker { right: 32px; } }
.tip-picker button {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.tip-picker button:hover { color: var(--text); }
.tip-picker button.active { background: var(--accent-soft); color: var(--accent); }

/* ---------- A1 — Original: dotted gold top + gold left wash ---------- */
[data-variant="A1"] .tip-of-day-inner {
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
  border-top: 2px dotted var(--accent);
}
[data-variant="A1"] .tip-of-day-inner::before {
  content: '';
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--accent), transparent);
  opacity: 0.45;
}
[data-variant="A1"] .tip-of-day-label { color: var(--accent); }

/* ---------- A2 — Bold solid left bar + circular icon badge ----------
   No top dotted; instead a thick (5px) solid gold bar on the left edge.
   Icon stacked ABOVE the label inside a circular accent-soft badge —
   matches A1's layout, just with a louder framing. */
[data-variant="A2"] .tip-of-day-inner {
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
  border-left: 5px solid var(--accent);
  padding-left: 22px;
}
/* Keep the default column layout for .tip-of-day-side (icon stacked above
   label) — only the icon styling changes. */
[data-variant="A2"] .tip-of-day-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-soft);
  font-size: 22px;
  flex: 0 0 44px;
  margin-bottom: 2px;
}
[data-variant="A2"] .tip-of-day-label {
  color: var(--accent);
  font-size: 11px;
}

/* ---------- A3 — Hairline frame + soft radial gold glow ----------
   No top dotted, no left bar. A 1px gold-tinted border outlines the card,
   and a faint radial glow blooms behind the icon. Quietest of the three —
   feels premium, less "callout" more "spotlight". */
[data-variant="A3"] .tip-of-day-inner {
  background: var(--card-bg);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--accent-soft);
}
[data-variant="A3"] .tip-of-day-side {
  position: relative;
  z-index: 1;
}
[data-variant="A3"] .tip-of-day-side::before {
  content: '';
  position: absolute;
  top: 50%; left: 42px;
  width: 110px; height: 110px;
  background: radial-gradient(circle, var(--accent-soft) 0%, transparent 65%);
  transform: translate(-50%, -50%);
  z-index: -1;
  pointer-events: none;
}
[data-variant="A3"] .tip-of-day-icon {
  font-size: 32px;
  filter: drop-shadow(0 0 8px var(--accent-soft));
}
[data-variant="A3"] .tip-of-day-label { color: var(--accent); }

@media (max-width: 720px) {
  .tip-of-day-inner { gap: 14px; padding: 16px; flex-wrap: wrap; }
  .tip-of-day-side { flex-direction: row; min-width: 0; }
  .tip-of-day-body { font-size: 14px; flex-basis: 100%; }
  .tip-picker { right: 32px; top: -10px; }
  [data-variant="A2"] .tip-of-day-icon { width: 38px; height: 38px; flex-basis: 38px; font-size: 18px; }
  [data-variant="A3"] .tip-of-day-side::before { display: none; }
}

/* ---------- 6-card grid ---------- */

.hub-grid {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 64px 40px 64px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 980px) {
  .hub-grid { grid-template-columns: repeat(2, 1fr); padding: 0 32px 32px 32px; }
  .hub-header { padding: 28px 32px 18px 32px; }
}
@media (max-width: 620px) {
  .hub-grid { grid-template-columns: 1fr; }
}

.hub-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 28px 26px 24px 26px;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.hub-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--card-shadow-hover);
}

.hub-card-icon {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 6px;
}
.hub-card-icon svg { display: block; } /* SVG icons carry their own gradient fills to match the 2D emoji aesthetic */

.hub-card h2 {
  font-size: 19px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
}

.hub-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  flex-grow: 1;
}

.hub-card-meta {
  font-size: 12px;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-top: 8px;
}

.hub-card-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- Newly-added ticker (variant C — polaroid drift) ----------
   Sits between .hub-grid and .hub-footer. The stage is a real horizontal
   scroll container — user can drag, wheel, or swipe. Auto-drift is driven
   by JS (rAF loop nudging scrollLeft) and pauses while the user is
   interacting; resumes after ~1.5s of idle. Track is duplicated so wrap
   is invisible (JS resets scrollLeft when it crosses contentWidth/2). */

.ticker-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 64px 56px 64px;
}
@media (max-width: 980px) { .ticker-section { padding: 0 32px 40px 32px; } }

.ticker-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 14px 0;
}
.ticker-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ticker-sub {
  font-weight: 500;
  color: var(--text-subtle);
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  margin-left: 4px;
}

.ticker-stage {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  scrollbar-width: none;          /* Firefox */
  -ms-overflow-style: none;       /* old Edge */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 95%, transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 5%, #000 95%, transparent 100%);
  cursor: grab;
}
.ticker-stage::-webkit-scrollbar { display: none; }     /* Chromium/WebKit */
.ticker-stage.is-dragging { cursor: grabbing; }
.ticker-loading {
  padding: 22px 24px;
  color: var(--text-subtle);
  font-size: 13px;
}

.ticker-track {
  display: flex;
  width: max-content;
  align-items: center;
  user-select: none;
}

.ticker-item {
  flex: 0 0 auto;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease;
}

/* ---------- Variant C — polaroid drift, bigger cards, full-card gaps ----- */

/* Stage is taller than the polaroid so the rotation tilt + drop shadow +
   bottom caption line never clip. Card actual height ≈ 195 + ~14 from
   ±1.6° rotation = ~210; padding 28 top/bot = 56 → 270 minimum. 280 leaves
   a few px of breathing room. */
[data-variant="C"] .ticker-stage { height: 280px; background: transparent; }
/* Card width = 240; gap = 90px — user's preferred spacing. */
[data-variant="C"] .ticker-track { gap: 90px; padding: 28px 32px; }
[data-variant="C"] .ticker-item {
  width: 240px;
  background: var(--paper);
  padding: 12px 12px 16px 12px;
  border-radius: 18px;
  box-shadow: 0 0 0 1px var(--border), 0 10px 24px rgba(0,0,0,0.22);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
[data-variant="C"] .ticker-item:nth-child(odd)  { transform: rotate(-1.4deg); }
[data-variant="C"] .ticker-item:nth-child(even) { transform: rotate(1.6deg); }
[data-variant="C"] .ticker-item:hover { transform: rotate(0) translateY(-3px); z-index: 2; }
/* Counter-rotate caption + sub-caption so type renders horizontally even
   though the polaroid frame is tilted. Cumulative transform = 0deg → crisp. */
[data-variant="C"] .ticker-item:nth-child(odd)  .ticker-cap,
[data-variant="C"] .ticker-item:nth-child(odd)  .ticker-cap-sub { transform: rotate(1.4deg); }
[data-variant="C"] .ticker-item:nth-child(even) .ticker-cap,
[data-variant="C"] .ticker-item:nth-child(even) .ticker-cap-sub { transform: rotate(-1.6deg); }
[data-variant="C"] .ticker-item:hover .ticker-cap,
[data-variant="C"] .ticker-item:hover .ticker-cap-sub { transform: none; }
[data-variant="C"] .ticker-img {
  width: 100%;
  height: 135px;
  object-fit: cover;
  object-position: left center;
  border-radius: 12px;
  background: var(--hover);
  pointer-events: none;            /* let drag pass through to the stage */
}
[data-variant="C"] .ticker-cap {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
}
[data-variant="C"] .ticker-cap-sub {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
  color: var(--text-subtle);
}

/* Like badge — absolute-positioned bottom-right of the polaroid so the
   niche label stays cleanly centered above. 2× the original size per
   user spec. Counter-rotated to match the polaroid tilt so the heart +
   count render flat. */
[data-variant="C"] .ticker-item { position: relative; }   /* anchor for the absolute heart */
[data-variant="C"] .ticker-like {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;          /* 2× of 11px (rounded for visual balance with icon) */
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.15s ease, color 0.15s ease, transform 0.18s ease;
  line-height: 1;
}
[data-variant="C"] .ticker-like:hover { background: var(--hover); color: var(--text); }
[data-variant="C"] .ticker-like[data-liked="1"] {
  color: #c75050;     /* red when this user has liked it */
}
[data-variant="C"] .ticker-like-icon { font-size: 22px; line-height: 1; }   /* 2× of 13px */
[data-variant="C"] .ticker-like-count { font-variant-numeric: tabular-nums; font-size: 14px; }

/* Counter-rotate so the heart + count render flat against the tilted card. */
[data-variant="C"] .ticker-item:nth-child(odd)  .ticker-like { transform: rotate(1.4deg); }
[data-variant="C"] .ticker-item:nth-child(even) .ticker-like { transform: rotate(-1.6deg); }
[data-variant="C"] .ticker-item:hover .ticker-like { transform: none; }

/* Hide markup left over from variants A/B (kept in template for symmetry). */
.ticker-item .ticker-avatar,
.ticker-item .ticker-name,
.ticker-item .ticker-pill,
.ticker-item .ticker-arrow { display: none; }

/* ---------- Card peek overlay (ticker → niche detail iframe) ---------- */

.card-peek-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
}
.card-peek-overlay.hidden { display: none; }

.card-peek-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 15, 0.55);
  backdrop-filter: blur(4px);
}

.card-peek-frame-wrap {
  position: relative;
  width: min(960px, 100%);
  height: min(900px, calc(100vh - 80px));
  background: var(--paper);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.45);
  overflow: hidden;
}
.card-peek-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--paper);
}

.card-peek-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
  transition: background 0.15s ease;
}
.card-peek-close:hover { background: rgba(0, 0, 0, 0.75); }

/* Lock background scroll while overlay is open. */
body.peek-open { overflow: hidden; }

/* ---------- Footer ---------- */

.hub-footer {
  text-align: center;
  padding: 24px 32px 48px 32px;
  color: var(--text-subtle);
  font-size: 12px;
}

/* ---------- MCP setup card ---------- */

.setup-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 32px 64px 32px;
}

.setup-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 36px 36px 32px 36px;
}

.setup-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.setup-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--accent);
  color: #1c1a16;
  font-weight: 800;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.setup-brand h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-recommended {
  background: var(--blue);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.setup-brand-sub {
  margin: 2px 0 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.setup-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 8px;
}

.setup-steps li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  align-items: start;
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.step-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
}
.step-text a { color: var(--blue); }
.step-text a:hover { text-decoration: underline; }

.setup-code {
  grid-column: 2 / -1;
  margin-top: 8px;
  background: var(--hover);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  position: relative;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.setup-code pre {
  margin: 0;
  white-space: pre-wrap;
  color: var(--text);
}
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--paper);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.copy-btn:hover { color: var(--text); border-color: var(--text-muted); }
.copy-btn.copied { color: var(--blue); border-color: var(--blue); }

.setup-note {
  margin-top: 24px;
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.setup-cta {
  display: block;
  text-align: center;
  margin-top: 22px;
  background: #2c4f8a;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  padding: 14px 18px;
  border-radius: 10px;
  transition: background 0.15s;
}
.setup-cta:hover { background: #355faa; }

/* ---------- Databases shell (Claude-style sidebar) ---------- */

body.db-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
  margin: 0;
  overflow: hidden;
}

.db-sidebar {
  background: var(--paper);
  border-right: 1px solid var(--border);
  padding: 28px 18px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.db-back {
  font-size: 13px;
  color: var(--text-muted);
  padding: 6px 8px;
}
.db-back:hover { color: var(--text); }

.db-sidebar-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-subtle);
  margin: 14px 8px 4px 8px;
}

.db-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.db-nav-item {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.12s;
  text-decoration: none;
}

.db-nav-item:hover { background: var(--hover); }

.db-nav-item.active {
  background: var(--accent-soft);
  border-color: var(--border);
}

.db-nav-icon {
  font-size: 18px;
  line-height: 1;
}

.db-nav-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.db-nav-name {
  font-size: 14px;
  font-weight: 600;
}

.db-nav-meta {
  font-size: 11.5px;
  color: var(--text-subtle);
  letter-spacing: 0.02em;
}

.db-sidebar-foot {
  margin-top: auto;
  padding: 10px 8px;
  font-size: 12px;
  color: var(--text-subtle);
}
.db-sidebar-foot p { margin: 0; }

.db-main {
  height: 100vh;
  background: var(--bg);
  overflow: hidden;
}

.db-main iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--bg);
  display: block;
}

.db-preview-pane {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.db-welcome {
  text-align: center;
  max-width: 480px;
  color: var(--text-muted);
}
.db-welcome-icon {
  font-size: 60px;
  line-height: 1;
  margin-bottom: 16px;
  opacity: 0.85;
}
.db-welcome h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 12px 0;
  color: var(--text);
  letter-spacing: -0.02em;
}
.db-welcome p {
  font-size: 14.5px;
  line-height: 1.55;
  margin: 0;
}

@media (max-width: 720px) {
  body.db-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .db-sidebar { border-right: 0; border-bottom: 1px solid var(--border); padding: 14px; }
  .db-nav { flex-direction: row; flex-wrap: wrap; }
}

/* ---------- Mode toggle (shared with NH/SB/AOY) ---------- */

.mode-toggle {
  position: fixed;
  bottom: 22px;
  left: 22px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--card-bg);
  border: 1px solid var(--border);
  box-shadow: var(--card-shadow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text);
  transition: transform 0.15s, box-shadow 0.15s;
  z-index: 50;
}
.mode-toggle:hover { transform: scale(1.06); box-shadow: var(--card-shadow-hover); }
.mode-icon-light { display: var(--mode-icon-light-display); }
.mode-icon-dark  { display: var(--mode-icon-dark-display); }

/* ─── Ask Tim widget ─────────────────────────────────────────────── */
/* Floating launcher (bottom-right) → expanding chat panel.           */
/* Self-contained: every selector is prefixed `at-` to avoid clashes  */
/* with the rest of the hub / NH / SB / AOY styles.                   */

.at-root { position: fixed; right: 22px; bottom: 22px; z-index: 100; font-size: 14px; }

.at-launcher {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px 8px 8px;
  background: var(--paper); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  box-shadow: var(--card-shadow); cursor: pointer;
  font: inherit; font-weight: 500;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  position: relative; /* anchor for the unread badge */
}
.at-launcher:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.at-launcher-label { padding-right: 4px; letter-spacing: 0.01em; }

.at-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; overflow: hidden; flex: 0 0 auto;
}
.at-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.at-avatar-sm { width: 28px; height: 28px; font-size: 13px; }

.at-panel {
  position: absolute; right: 0; bottom: 56px;
  width: min(380px, calc(100vw - 44px));
  height: min(560px, calc(100vh - 100px));
  background: var(--paper); color: var(--text);
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--card-shadow-hover);
  display: none; flex-direction: column; overflow: hidden;
  transform-origin: bottom right;
}
.at-root[data-open="true"] .at-panel { display: flex; animation: at-pop 0.22s ease-out; }
.at-root[data-open="true"] .at-launcher { opacity: 0.4; }

@keyframes at-pop { from { transform: scale(0.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.at-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
}
.at-header-brand { display: flex; align-items: center; gap: 10px; }
.at-header-titles { display: flex; flex-direction: column; line-height: 1.15; }
.at-header-titles strong { font-size: 14px; }
.at-header-sub { font-size: 11px; color: var(--text-muted); }

.at-close {
  background: transparent; border: 0; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--text-muted);
  padding: 4px 8px; border-radius: 8px;
}
.at-close:hover { background: var(--hover); color: var(--text); }

.at-messages {
  flex: 1 1 auto; overflow-y: auto; padding: 14px 12px;
  display: flex; flex-direction: column; gap: 8px;
  scrollbar-width: thin;
}
.at-messages::-webkit-scrollbar { width: 8px; }
.at-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.at-msg {
  max-width: 86%;
  padding: 9px 12px; border-radius: 14px;
  line-height: 1.45; white-space: pre-wrap; word-wrap: break-word;
}
.at-msg-user {
  align-self: flex-end;
  background: var(--accent); color: #1a1a1a;
  border-bottom-right-radius: 4px;
}
.at-msg-tim {
  align-self: flex-start;
  background: var(--hover); color: var(--text);
  border-bottom-left-radius: 4px;
}
.at-typing { font-style: italic; color: var(--text-muted); animation: at-blink 1.2s infinite; }
@keyframes at-blink { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }

.at-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px; border-top: 1px solid var(--border);
}
.at-input {
  flex: 1 1 auto; resize: none;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 9px 12px; font: inherit; line-height: 1.4; max-height: 140px;
  outline: none; transition: border-color 0.15s ease;
}
.at-input:focus { border-color: var(--accent); }
.at-send {
  flex: 0 0 auto;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent); color: #1a1a1a; border: 0;
  font-size: 18px; font-weight: 700; cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease;
}
.at-send:hover:not(:disabled) { transform: scale(1.06); }
.at-send:disabled { opacity: 0.4; cursor: wait; }

@media (max-width: 480px) {
  .at-root { right: 12px; bottom: 12px; }
  .at-launcher-label { display: none; }
  .at-launcher { padding: 6px; }
  .at-panel { width: calc(100vw - 24px); height: calc(100vh - 90px); }
}

/* ─── iMessage-style tease bubble ──────────────────────────────────── */
/* Pops up after a delay on the home page to invite users to ask Tim.   */
/* One-shot per session via sessionStorage('ask-tim-teased').           */

/* Discord-style identity row, avatar AFTER the text (option 3) */
.at-tease {
  position: absolute;
  right: 0;
  bottom: 64px;
  display: none;
  align-items: flex-end;
  flex-direction: row;
  gap: 10px;
  pointer-events: auto;
  transform-origin: bottom right;
}
.at-tease[data-on="true"] {
  display: flex;
  animation:
    at-tease-pop 0.46s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
    at-tease-wiggle 0.55s 0.46s ease-in-out;
}
.at-tease-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  width: 260px;            /* fixed — was max-width, which let it collapse to ~100px */
}
.at-tease-name {
  font-weight: 700;
  color: #ffffff;
  font-size: 13px;
  margin-bottom: 4px;
  padding-right: 4px;
}
.at-tease-bubble {
  position: relative;
  background: #ffffff;
  color: #1c1a16;
  padding: 10px 32px 10px 14px;
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.40), 0 1px 2px rgba(0,0,0,0.18);
  font-size: 14.5px;
  line-height: 1.35;
  width: 100%;             /* fill the 260px stack so text wraps to 2-3 lines */
}
.at-tease-ava {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #524757 url('tim-avatar.png') center/cover no-repeat;
  flex: 0 0 36px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}
.at-tease-close {
  position: absolute;
  top: 50%; right: 8px;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  background: transparent; border: 0; cursor: pointer;
  color: #bbb; font-size: 14px; line-height: 1;
  padding: 0;
}
.at-tease-close:hover { color: #1c1a16; }

/* Red "unread" dot on the launcher avatar */
.at-badge {
  position: absolute;
  top: 0; right: 4px;
  width: 12px; height: 12px;
  background: #ff3b30;
  border: 2px solid var(--paper);
  border-radius: 50%;
  pointer-events: none;
  display: none;
  animation: at-badge-pulse 1.6s ease-in-out infinite;
}
.at-launcher[data-tease="true"] .at-badge { display: block; }

@keyframes at-tease-pop {
  /* Bubble emerges UP from the launcher */
  0%   { opacity: 0; transform: scale(0.5) translateY(20px); }
  70%  { opacity: 1; transform: scale(1.05) translateY(-3px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes at-tease-wiggle {
  0%, 100% { transform: scale(1) rotate(0); }
  25%      { transform: scale(1) rotate(-1.5deg); }
  50%      { transform: scale(1) rotate(1.5deg); }
  75%      { transform: scale(1) rotate(-0.8deg); }
}
@keyframes at-badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.55); }
  50%      { box-shadow: 0 0 0 6px rgba(255, 59, 48, 0); }
}

/* Hide tease bubble on tiny screens to avoid covering the launcher */
@media (max-width: 480px) {
  .at-tease { display: none !important; }
}
