/* ── Topbar ─────────────────────────────────────────────────────────────────── */
#topbar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 10px 20px;
  background: var(--surface-1);
  border-bottom: 1px solid color-mix(in srgb, var(--text-strong) 6%, transparent);
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 52px;
}

#tb-logo {
  height: 40px;
  width: 40px;
  flex-shrink: 0;
  margin-right: 4px;
}

/* The wordmark beside the logo (spec §7): "French" white, "Neuron" lilac, in the rounded face. */
#tb-wordmark { font-size: 19px; font-weight: 900; letter-spacing: -0.01em; color: var(--text-strong); margin-right: 10px; white-space: nowrap; }
#tb-wordmark span { color: var(--action-lilac); }
@media (max-width: 960px) { #tb-wordmark { display: none; } }

/* Toolbar buttons (left of the bar): 🗺️ focus chip, 📊 Stats, ⚙️ Settings — at rest: the card
   holds the light (spec §5). The focus chip is the one tinted violet: it is "what you play". */
.mb-btn {
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface-3);
  color: var(--text-soft);
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.mb-btn:hover  { border-color: var(--action-line); color: var(--text-strong); }
.mb-btn.active { background: var(--action); color: var(--text-strong); border-color: var(--action); }
.mb-btn.mb-focus { background: var(--action-tint-2); color: var(--text-strong); border-color: var(--action-line); }
.mb-focus { min-width: 0; }
#mb-focus-label { overflow: hidden; text-overflow: ellipsis; }
/* Everything after ⚙️ (combo chip, account) sits on the right. */
.settings-wrap { margin-right: auto; }

/* Combo: the player's own streak, so violet at every tier (spec §4.1); data-level (1–5, from
   config.js COMBO_TIERS) raises saturation and halo. It rests at every level: a halo shows only
   for a moment when a tier is reached (.combo-tier-up), and the top tier pulses three times. */
#combo-widget {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 13px;
  border-radius: 999px;
  font-weight: 800;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s, color 0.3s;
}
#combo-widget.combo-up { background: var(--surface-3); border-color: var(--action-line); color: var(--action-lilac); }
#combo-widget[data-level="2"] { background: var(--action-tint-1); }
#combo-widget[data-level="3"] { background: var(--action-tint-3); border-color: var(--action); color: var(--text-strong); }
#combo-widget[data-level="4"] { background: var(--action-deep); border-color: var(--action-lilac); color: var(--text-strong); }
#combo-widget[data-level="5"] { background: var(--action); border-color: var(--text-strong); color: var(--text-strong); }
/* Reaching a tier: a brief halo (ui.js adds .combo-tier-up when the level rises), never a resting glow. */
#combo-widget.combo-tier-up { animation: combo-tier 0.9s ease-out 2; }
@keyframes combo-tier { 0%, 100% { box-shadow: 0 0 0 0 transparent; } 40% { box-shadow: var(--halo-action); } }
@media (prefers-reduced-motion: reduce) { #combo-widget.combo-tier-up { animation: none; } }
#combo-widget:empty { display: none; }

#combo-widget .c-n { font-size: 17px; line-height: 1; }
#combo-widget .c-mult { font-size: 19px; line-height: 1; }
#combo-widget .c-word { font-size: 10px; letter-spacing: 0.3px; opacity: 0.75; align-self: center; }
/* Wrong run: calm, not alarming — it only puts brain links at risk, never coins. */
#combo-widget.combo-down { border-color: var(--line); background: var(--surface-3); color: var(--text-soft); }

.combo-pulse { animation: cpulse 0.9s ease-in-out 3; }

/* The brain's numbers, repeated from the brain column (index.html #tb-hud). At rest; the coin
   amount glows gold during the reward beat (light.js data-reward), after the brain lights up. */
#tb-hud { display: flex; align-items: center; gap: 8px; }
.tb-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-3);
  font-weight: 800;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: border-color .25s ease .35s, box-shadow .25s ease .35s;
}
#tb-coins { color: var(--coin); }
#tb-influx { color: var(--energy-pale); }
:root[data-reward="full"] #tb-coins { border-color: color-mix(in srgb, var(--coin) 60%, transparent); box-shadow: 0 0 20px -5px var(--coin); }
@media (prefers-reduced-motion: reduce) { .tb-chip { transition: none; } }
/* Phones: room for the focus chip — the influx stays under the brain, the coins stay here. */
@media (max-width: 720px) {
  #tb-influx { display: none; }
  #tb-hud { gap: 0; }
  .tb-chip { padding: 2px 2px; gap: 3px; font-size: 13px; border-color: transparent; background: transparent; }
  :root[data-reward="full"] #tb-coins { border-color: transparent; box-shadow: none; text-shadow: 0 0 14px var(--coin); }
}
@media (prefers-reduced-motion: reduce) { .combo-pulse { animation: none; } }
@keyframes cpulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.06); }
}
