/* App shell topbar: queue pill, quick match, round buttons, user chip and menu, bell popup. */
.app-topbar-right { margin-left: auto; }
/* Shell-level so it survives navigating off Battlefield. Shrinks before the right-hand
   cluster: the label goes first, the counter last. */
.app-topbar-queue {
  display: inline-flex; align-items: center; gap: 9px;
  flex: 0 1 auto; min-width: 0;
  padding: 6px 14px;
  border: 1px solid color-mix(in srgb, var(--bronze) 45%, transparent);
  border-radius: 100px;
  background: color-mix(in srgb, var(--bronze) 12%, transparent);
  overflow: hidden;
}
/* The pill needs ~96px for the counter and the bar cannot spare it below this, so it clips
   rather than shrinks. The counter moves into the button instead: "x 50s" — the icon stands
   in for the LABEL, never beside it. */
/* 700: the queue chip plus the quick-match label plus the live chip stop fitting beside the
   brand — below it the label goes and the icon stands in for it. */
@media (max-width: 700px) {
  .app-topbar-queue { display: none; }
  .app-topbar-quickmatch.is-queued .app-topbar-quickmatch-label { display: none; }
  .app-topbar-quickmatch.is-queued .app-topbar-quickmatch-ico { display: inline-flex; }
  .app-topbar-quickmatch.is-queued .app-topbar-quickmatch-elapsed { display: inline; }
}
/* Under ~100px left for the words; the counter is the part worth keeping. */
@media (max-width: 1024px) {
  .app-topbar-queue { padding: 5px 11px; gap: 7px; }
  .app-topbar-queue-label { display: none; }
  .app-topbar-quickmatch.is-queued { min-width: 0; padding-left: 14px; padding-right: 14px; }
}
.app-topbar-queue-spinner {
  width: 13px; height: 13px;
  flex: 0 0 auto;
  border: 2px solid color-mix(in srgb, var(--bronze) 30%, transparent);
  border-top-color: var(--bronze-2);
  border-radius: 50%;
  animation: app-topbar-queue-spin 0.9s linear infinite;
}
.app-topbar-queue-label {
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink-2); font-size: 0.85rem; font-weight: 500;
}
/* Not --bronze-2: 2.35:1 on this tinted pill in light. Weight carries the emphasis. */
.app-topbar-queue-elapsed {
  flex: 0 0 auto;
  color: var(--ink); font-size: 0.88rem; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
/* Laurel = your room is open, bronze = still looking, so the 60s hand-off reads as a change. */
.app-topbar-queue.is-host {
  border-color: color-mix(in srgb, var(--laurel) 50%, transparent);
  background: color-mix(in srgb, var(--laurel) 14%, transparent);
}
.app-topbar-queue.is-host .app-topbar-queue-spinner {
  border-color: color-mix(in srgb, var(--laurel) 30%, transparent);
  border-top-color: var(--laurel-2);
}
@keyframes app-topbar-queue-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .app-topbar-queue-spinner { animation: none; }
}

.app-topbar-right {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  flex: 0 0 auto;
}

.app-topbar-quickmatch {
  white-space: nowrap;
  min-width: 140px;
  padding-left: 22px;
  padding-right: 22px;
  border-radius: var(--radius-m);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
/* Scoped so the queued state inherits THE destructive treatment (buttons.css) untouched. The
   fill is THE commit-green surface (buttons.css) — restating it here would put the dark ink over
   the darker gradient, which measures 3.34:1. */
.app-topbar-quickmatch:not(.is-queued) {
  border: 1px solid var(--laurel-deep);
  font-weight: 700;
  box-shadow: var(--shadow-1), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
/* Hidden while the label shows; mobile swaps to icon-only below. */
.app-topbar-quickmatch-ico {
  display: none; align-items: center; justify-content: center;
  width: 15px; height: 15px; flex: 0 0 auto;
}
.app-topbar-quickmatch-ico svg { width: 100%; height: 100%; display: block; }
/* Shown only where the pill is gone — see the 700px block. */
.app-topbar-quickmatch-elapsed { display: none; font-variant-numeric: tabular-nums; }
.app-topbar-quickmatch:not(.is-queued):hover:not(:disabled) {
  background: var(--laurel-gradient-hover);
  border-color: var(--laurel-deep);
}


.app-topbar-donate,
.app-topbar-focus,
.app-topbar-theme,
.app-topbar-bell {
  width: 36px; height: 36px;
  padding: 0;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-2);
  border: 1px solid var(--border-strong);
  flex: 0 0 auto;
}
.app-topbar-donate {
  color: var(--accent-red);
  font-size: 1.05rem;
}
.app-topbar-donate:hover {
  background: color-mix(in srgb, var(--porphyry) 12%, transparent);
  border-color: var(--accent-red);
  color: var(--accent-red);
}
.app-topbar-focus,
.app-topbar-theme {
  color: var(--ink);
}
.app-topbar-focus:hover,
.app-topbar-theme:hover {
  background: var(--bg-hover);
  border-color: var(--bronze);
  color: var(--ink);
}
.app-topbar-theme-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  flex: 0 0 auto;
}
.app-topbar-theme-icon svg {
  width: 100%; height: 100%; display: block;
}
.app-topbar-focus.is-active {
  background: color-mix(in srgb, var(--accent-gold) 12%, transparent);
  border-color: var(--accent-gold);
  color: var(--accent-gold);
}
.app-topbar-focus-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px;
  flex: 0 0 auto;
}
.app-topbar-focus-icon svg {
  width: 100%; height: 100%; display: block;
}
.app-user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 5px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  font: inherit;
  color: var(--text-primary);
  transition: background 0.12s ease, border-color 0.12s ease;
}
.app-user-chip:hover {
  background: var(--bg-hover);
  border-color: color-mix(in srgb, var(--accent-gold) 40%, transparent);
}
.app-user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--bronze-gradient);
  color: var(--on-bronze);
  font-family: var(--font-display);
  font-weight: 600;
  border: 1px solid var(--bronze-deep);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.92rem;
  flex: 0 0 auto;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}
.app-user-identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.1;
}
.app-user-name {
  font-size: 0.9rem;
  line-height: 1;
}
.app-user-elo {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-gold);
  letter-spacing: 0.3px;
}
.app-user-elo-loading {
  visibility: hidden;
}
.app-user-elo .elo-stars,
.app-user-elo .elo-stars-full,
.app-user-elo .elo-stars-compact {
  font-size: 0.7rem;
  line-height: 1;
}
.app-user-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 300px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  z-index: 1000;
}
.app-user-menu-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--divider);
  text-align: left;
}
.app-user-menu-headname {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app-user-menu-headname .app-user-menu-dot { color: var(--ink-3); }
.app-user-menu-list {
  display: flex;
  flex-direction: column;
  padding: 6px;
}
.app-user-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 4px;
  background: transparent;
  border: 0;
  color: var(--ink-2);
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  transition: background 0.1s ease, color 0.1s ease;
}
.app-user-menu-item:hover {
  background: var(--bg-2);
  color: var(--ink);
}
.app-user-menu-ico {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  color: var(--ink-3);
  transition: color 0.1s ease;
}
.app-user-menu-ico svg { width: 100%; height: 100%; display: block; }
.app-user-menu-item:hover .app-user-menu-ico { color: var(--bronze); }
.app-user-menu-sep {
  height: 1px;
  background: var(--divider);
  margin: 4px 0;
}
.app-user-menu-confirm { padding: 8px 10px 6px; }
.app-user-menu-confirm-q {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 8px;
}
.app-user-menu-confirm-btns {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.app-user-menu-confirm-btns .btn { justify-content: center; }

/* position:relative anchors dropdown under the bell, not user-chip. */
.app-topbar-bell-wrap {
  position: relative;
  display: inline-flex;
}
/* No `color` anywhere on this button: its only glyph is 🔔, drawn from a colour font, which
   ignores it. The border and the badge are what carry the has-notif state. */
.app-topbar-bell {
  position: relative;
  font-size: 1rem;
}
.app-topbar-bell:hover {
  background: var(--bg-hover);
}
.app-topbar-bell.has-notif {
  border-color: var(--accent-gold);
}
.app-topbar-bell-badge {
  position: absolute;
  top: -3px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--porphyry-2, #a94747);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--bg-1);
}
/* Tier-1 tokens only: .app-topbar re-pins --text-* to the chrome inks, so a popup built on
   the aliases drifts from every other card. */
.app-notif-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 340px;
  max-width: 400px;
  background: var(--bg-0);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  z-index: 1000;
}
/* Pin to viewport: fixed is viewport-relative here (no transformed ancestor). */
@media (max-width: 640px) {
  .app-notif-menu {
    position: fixed;
    top: 64px;
    left: 8px;
    right: 8px;
    min-width: 0;
    max-width: none;
    width: auto;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
  }
}
.app-notif-empty {
  padding: 22px 14px;
  color: var(--ink-3);
  font-size: 0.88rem;
  text-align: center;
}
.app-notif-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--divider);
}
.app-notif-tabs { display: flex; gap: 4px; }
/* Sizing only — the SELECTED treatment comes from THE page-tab list in layout.css, which
   .app-notif-tab.is-active joins. Do not restate the active fill here. */
.app-notif-tab {
  all: unset; cursor: pointer;
  padding: 4px 10px; border-radius: var(--radius-s);
  border: 1px solid transparent;
  font-size: 0.8rem; font-weight: 600; color: var(--ink-2);
}
.app-notif-tab:hover { color: var(--ink); background: var(--bg-3); }
.app-notif-markall {
  all: unset; cursor: pointer;
  font-size: 0.78rem; color: var(--ink-2); white-space: nowrap;
}
.app-notif-markall:hover { color: var(--ink); text-decoration: underline; }

.app-notif-list { max-height: 62vh; overflow-y: auto; }
.app-notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--divider);
}
.app-notif-item:last-child { border-bottom: 0; }
.app-notif-item-link { cursor: pointer; }
.app-notif-item-link:hover { background: var(--bg-3); }
/* Left rule, not tint alone: a 6% bronze tint over --bg-2 is under a JND in both themes. */
.app-notif-item.is-unread {
  background: color-mix(in srgb, var(--bronze) 10%, transparent);
  box-shadow: inset 3px 0 0 var(--bronze);
}
.app-notif-main { flex: 1 1 auto; min-width: 0; }
.app-notif-title { color: var(--ink); font-size: 0.9rem; font-weight: 600; line-height: 1.3; }
.app-notif-item.is-unread .app-notif-title { font-weight: 700; }
.app-notif-sub {
  color: var(--ink-2); font-size: 0.82rem; line-height: 1.4; margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
/* Lifting the clamp needs display:block too — line-clamp:none alone stays a -webkit-box. */
.app-notif-item.is-expanded .app-notif-sub {
  display: block; -webkit-line-clamp: none; overflow: visible;
}
/* Filled, not a ghost chip: --bronze-2 as text is 2.85:1 on the cream popup, while --ivory
   on --bronze-deep is 5.06:1 dark / 7.70:1 light. */
.app-notif-open {
  all: unset; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 9px;
  padding: 5px 12px; border-radius: var(--radius-s);
  border: 1px solid var(--bronze);
  background: var(--bronze-deep);
  color: var(--ivory); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.01em;
}
.app-notif-open:hover { background: var(--bronze); border-color: var(--bronze-2); }
.app-notif-open:focus-visible { outline: 2px solid var(--bronze-2); outline-offset: 2px; }
.app-notif-open-chev { font-size: 0.9em; line-height: 1; }
/* Not --ink-3: 3.65:1 on the tinted unread row in dark. Size carries the de-emphasis. */
.app-notif-time {
  flex: 0 0 auto; color: var(--ink-2); font-size: 0.72rem; padding-top: 3px;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.app-notif-actions {
  display: flex;
  gap: 6px;
  flex: 0 0 auto;
}
/* --bg-3 reads as raised on the --bg-2 popup; --bg-1 would read as a hole in it. */
.app-notif-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--bg-3);
  color: var(--ink);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.app-notif-btn:hover { background: var(--bg-hover); border-color: var(--bronze); }
.app-notif-btn-accept:hover {
  background: color-mix(in srgb, var(--accent-green) 18%, transparent);
  border-color: var(--accent-green);
  color: var(--accent-green);
}
/* --porphyry-2 is the red that clears AA as TEXT in both themes; --accent-red is 2.58:1. */
.app-notif-btn-decline:hover {
  background: color-mix(in srgb, var(--porphyry) 18%, transparent);
  border-color: var(--porphyry-2);
  color: var(--porphyry-2);
}
/* Fixed FOOTPRINT so mixed emoji / text-presentation glyphs line up; no fill of its own, so the
   glyph sits on the row. --bg-3 is #ffffff under the light theme, which made it a white tile. */
/* One ink for every row mark. `color` only reaches a TEXT-presentation glyph — an emoji is drawn
   from a colour font and ignores it, which is why the icons in notif-render.js are all legacy
   symbols. Put a 🏆 back and that one row paints itself. */
.app-notif-ico {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  color: var(--gold);
  font-size: 1.05rem; line-height: 1;
}
/* Light --gold is 3.13:1 on a read row and 2.80:1 on the unread tint — under the 3:1 non-text
   floor on exactly the rows a reader scans first. --bronze clears it at 3.56:1 worst. */
[data-theme="light"] .app-notif-ico { color: var(--bronze); }
/* Tablet: only the topbar tightens; rail is default via _isCollapsed()'s ≤1023. */
@media (max-width: 900px) {
  .app-topbar { padding: 10px 16px; }
}
/* Below ~350px a long counter ("12m 34s") tips the bar into overflow; the red x alone still
   says searching. 360px and up keeps the seconds. */
@media (max-width: 350px) {
  .app-topbar-quickmatch.is-queued .app-topbar-quickmatch-elapsed { display: none; }
}
