/* İ.Z.A.N. shared UI: the top bar that /ui/topbar.js mounts (brand, page links, the page's own items,
   live dot, theme toggle, the person with the profile menu). Fixed at the top, one line on every width:
   on a phone (< 760 px) the labels drop and the icons stay. */
#top {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--topbar-h);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: var(--space-m);
  padding: 0 var(--space-l);
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--hairline);
}
#brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  letter-spacing: 0.2px;
}
/* A product name after the brand (İZAN Server: "Server"). */
#brand small {
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
}
a#brand {
  color: inherit;
  text-decoration: none;
}
#brand .logo {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  flex: none;
  background: var(--primary-fill);
  box-shadow: var(--primary-glow);
  display: grid;
  place-content: center;
  color: var(--on-sea);
}
#brand .logo svg {
  width: 17px;
  height: 17px;
  display: block;
}
#user {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 16px;
}
#user:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#user .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: none;
  background: linear-gradient(145deg, color-mix(in srgb, var(--slate), var(--white) 40%), var(--slate));
  color: var(--on-sea);
  display: grid;
  place-content: center;
  font-size: 11px;
  font-weight: 600;
}
#user .name {
  font-size: 12px;
  line-height: 1.2;
}
#user .name small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
/* ——— Profile menu: opens under the avatar, same on desktop and phone ——— */
#profile-menu {
  position: fixed;
  z-index: 8;
  width: 220px;
  max-width: calc(100vw - 20px);
  background: var(--solid);
  border: 1px solid var(--line);
  border-radius: var(--r-pop);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  color: var(--text);
}
#profile-menu[hidden] {
  display: none;
}
#profile-menu .group {
  padding: 6px 10px 3px;
  font-size: 11px;
  color: var(--muted);
}
#profile-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
#profile-menu button:hover,
#profile-menu button:focus-visible {
  background: var(--accentsoft);
  outline: none;
}
#profile-menu button .check {
  margin-left: auto;
  color: var(--accent);
}
#profile-menu hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 6px 4px;
}
#light {
  font-size: 13px;
  padding: 0 9px;
  min-width: 32px;
  justify-content: center;
}
/* The live badge holds the live status bar when the page passes figures (liveMarkup `stats`). */
#live.badge:has(.live-strip) {
  padding: 0 12px;
}
/* An action's label sits beside its icon; on a phone only the icon stays. */
#top button.badge > .text {
  margin-left: 5px;
}
@media (max-width: 760px) {
  /* At 390 px the campus bar overflowed by 25 px (gear cut off, user pushed out): the "Live" label and
     time drop (the dot stays), the name drops (the avatar stays), the gap and side padding get smaller. */
  #user .name,
  #live .text,
  #live > b,
  #live .live-strip .w,
  #live .live-strip .sep,
  #live .live-strip .rate,
  #top button.badge > .text {
    display: none;
  }
  #top {
    gap: var(--space-s);
    padding: 0 8px;
  }
}

/* The live strip as pills (2026-10-29): each figure in its own soft pill, no slashes and no clock (the device has
   one). A phone keeps the two bare numbers above. */
@media (min-width: 761px) {
  #live.badge:has(.live-strip) {
    padding: 0 4px;
  }
  #live .live-strip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font);
    font-size: 12px;
  }
  #live .live-strip > span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 26px;
    padding: 0 10px;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    color: var(--text-1);
  }
  #live .live-strip > span.sep,
  #live .live-strip > span.w {
    display: none;
  }
}
