/**
 * Floating pill header — PegasusXI theme.
 * Center logo, left/right nav, About & Tools dropdowns.
 */

:root {
  --site-header-height: 4.75rem;
  --site-header-pill-h: 3.15rem;
  --site-header-logo: 4.35rem;
  --site-footer-height: 3.75rem;
}

body:has(#header.header) {
  padding-top: calc(var(--site-header-height) + 0.35rem);
}

body:has(#footer.footer--status) {
  padding-bottom: calc(var(--site-footer-height) + 0.35rem);
}

#header.header {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  z-index: 200 !important;
  min-height: var(--site-header-height);
  box-sizing: border-box;
  background: transparent !important;
  border-bottom: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  pointer-events: none;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 0.85rem 1rem 0;
}

#header.header .header__pill {
  pointer-events: auto;
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(1120px, calc(100vw - 1.5rem));
  min-height: var(--site-header-pill-h);
  margin: 0 auto;
  padding: 0 1.35rem;
  box-sizing: border-box;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(22, 28, 48, 0.94) 0%, rgba(10, 14, 26, 0.96) 100%);
  border: 1px solid rgba(140, 170, 220, 0.16);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 10px 36px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(200, 220, 255, 0.08);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.header__side {
  display: flex;
  align-items: center;
  align-self: stretch;
  gap: 1.15rem;
  min-width: 0;
  z-index: 2;
}

.header__side--left {
  justify-content: flex-start;
  justify-self: start;
  padding-right: calc(var(--site-header-logo) * 0.55);
}

.header__side--right {
  justify-content: flex-end;
  justify-self: end;
  gap: 1rem;
  padding-left: calc(var(--site-header-logo) * 0.55);
}

/* Center emblem — overlaps the pill */
.header__logo-center {
  position: relative;
  z-index: 3;
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--site-header-logo);
  height: var(--site-header-logo);
  margin-top: calc(var(--site-header-logo) * -0.18);
  margin-bottom: calc(var(--site-header-logo) * -0.18);
  border-radius: 50%;
  text-decoration: none;
  flex-shrink: 0;
  box-shadow:
    0 0 0 3px rgba(12, 16, 32, 0.95),
    0 0 0 4px rgba(201, 160, 50, 0.35),
    0 8px 24px rgba(0, 0, 0, 0.5);
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 180ms;
}

.header__logo-center:hover {
  transform: translateY(-1px) scale(1.03);
  box-shadow:
    0 0 0 3px rgba(12, 16, 32, 0.95),
    0 0 0 4px rgba(201, 160, 50, 0.55),
    0 10px 28px rgba(201, 160, 50, 0.2);
}

.header__logo-center img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.header__link,
.header-dd__toggle,
.header-auth-links a {
  font-family: var(--font-body, 'Satoshi', sans-serif);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-text, #e4e8f0);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  padding: 0;
  margin: 0;
  line-height: 1;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  transition: color 160ms ease;
}

.header__link:hover,
.header-dd__toggle:hover {
  color: var(--color-crystal, #7cc5e8);
}

.header__link--play {
  color: var(--color-crystal, #7cc5e8) !important;
  font-weight: 800;
}

.header__link--play:hover {
  color: #a8dff5 !important;
  text-shadow: 0 0 18px var(--color-crystal-glow, rgba(124, 197, 232, 0.35));
}

/* Dropdowns — fill the pill height so hover is not lost in the gap under the label */
.header-dd {
  position: relative;
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  height: auto;
}

.header-dd__toggle {
  gap: 0.3rem;
}

.header-dd__chevron {
  width: 0.55rem;
  height: 0.55rem;
  flex-shrink: 0;
  opacity: 0.75;
  display: block;
  transition: transform 180ms ease;
}

.header-dd.is-open .header-dd__chevron,
.header-dd:hover .header-dd__chevron {
  transform: rotate(180deg);
}

.header-dd__menu {
  position: absolute;
  top: calc(100% - 2px);
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  min-width: 13.5rem;
  max-height: min(70vh, 28rem);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0.55rem 0;
  border-radius: 0.65rem;
  background: rgba(8, 10, 18, 0.94);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(140, 170, 220, 0.14);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 120ms ease, transform 120ms ease, visibility 0s linear 80ms;
  z-index: 30;
}

.header-dd__menu::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -0.75rem;
  height: 0.85rem;
}

.header__side--right .header-dd__menu {
  left: auto;
  right: 0;
  transform: translateY(-4px);
}

.header-dd.is-open .header-dd__menu,
.header-dd:hover .header-dd__menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  transition-delay: 0s;
}

.header__side--right .header-dd.is-open .header-dd__menu,
.header__side--right .header-dd:hover .header-dd__menu {
  transform: translateY(0);
}

.header-dd__menu a {
  display: block;
  padding: 0.55rem 1.1rem;
  font-family: var(--font-body, 'Satoshi', sans-serif);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-text-muted, #8a92a8);
  white-space: nowrap;
  transition: color 140ms ease, background 140ms ease;
}

.header-dd__menu a:hover {
  color: var(--color-text, #e4e8f0);
  background: rgba(74, 126, 194, 0.12);
}

.header-auth-links {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.header-auth-links__login {
  color: var(--color-text, #e4e8f0) !important;
}

.header-auth-links__login:hover {
  color: var(--color-crystal, #7cc5e8) !important;
}

.header-auth-links__register {
  color: var(--color-gold, #c9a032) !important;
}

.header-auth-links__register:hover {
  color: #e0c04e !important;
}

.header-auth-links--user {
  gap: 0;
  /* Must fit portraits + full login — do not clamp so the name gets ellipsized */
  max-width: none;
  min-width: 0;
  flex-shrink: 0;
}

.header-user-chip {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
  min-width: auto;
  max-width: none;
  padding: 0;
  font-weight: 700;
}

/* Stacked portraits: coin-stack at REST, fan open only on HOVER */
.header-char-stack {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0.1rem 0.1rem 0.1rem 0;
  isolation: isolate;
}

.header-char-stack__link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.9rem;
  height: 1.9rem;
  margin-left: 0;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  text-decoration: none !important;
  background: var(--color-surface-3, #161c32);
  box-shadow: 0 0 0 1.5px rgba(8, 10, 18, 0.98);
  transition:
    margin-left 420ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 260ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms ease;
}

/* REST — pull each face under the one to its left (~50% overlap) */
.header-char-stack__link + .header-char-stack__link {
  margin-left: -0.95rem;
}

/* Leftmost stays in front */
.header-char-stack__link:nth-child(1) { z-index: 16; }
.header-char-stack__link:nth-child(2) { z-index: 15; }
.header-char-stack__link:nth-child(3) { z-index: 14; }
.header-char-stack__link:nth-child(4) { z-index: 13; }
.header-char-stack__link:nth-child(5) { z-index: 12; }
.header-char-stack__link:nth-child(6) { z-index: 11; }
.header-char-stack__link:nth-child(7) { z-index: 10; }
.header-char-stack__link:nth-child(8) { z-index: 9; }
.header-char-stack__link:nth-child(9) { z-index: 8; }
.header-char-stack__link:nth-child(10) { z-index: 7; }
.header-char-stack__link:nth-child(11) { z-index: 6; }
.header-char-stack__link:nth-child(12) { z-index: 5; }
.header-char-stack__link:nth-child(13) { z-index: 4; }
.header-char-stack__link:nth-child(14) { z-index: 3; }
.header-char-stack__link:nth-child(15) { z-index: 2; }
.header-char-stack__link:nth-child(16) { z-index: 1; }

/* HOVER only (not focus-within — that was leaving the stack stuck open) */
.header-char-stack:hover .header-char-stack__link + .header-char-stack__link {
  margin-left: 0.16rem;
}

.header-char-stack__link:hover {
  transform: translateY(-2px) scale(1.08);
  box-shadow: 0 0 0 1.5px rgba(8, 10, 18, 0.98), 0 0 0 3px rgba(201, 160, 50, 0.55);
  z-index: 20 !important;
}

@media (prefers-reduced-motion: reduce) {
  .header-char-stack__link {
    transition: none;
  }
}

.header-char-stack__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.header-char-stack__fallback {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--color-text-muted, #8a92a8);
  line-height: 1;
}

.header-user-chip__name {
  flex: 0 0 auto;
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  min-width: max-content;
  max-width: none;
  text-decoration: none !important;
  color: var(--color-text, #e4e8f0) !important;
  line-height: 1;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
}

.header-user-chip__name:hover {
  color: var(--color-crystal, #7cc5e8) !important;
}

/* Legacy single-avatar classes kept harmless if referenced elsewhere */
.header-user-chip__avatar,
.header-user-chip__img,
.header-user-chip__fallback {
  display: none;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted, #8a92a8);
  white-space: nowrap;
}

.header-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4caf7d;
  box-shadow: 0 0 0 2px rgba(76, 175, 125, 0.25), 0 0 10px rgba(76, 175, 125, 0.45);
  flex-shrink: 0;
}

.header-status--offline .header-status__dot {
  background: var(--color-text-faint, #4a5270);
  box-shadow: none;
}

.header-status__count {
  font-weight: 800;
  color: var(--color-text, #e4e8f0);
  font-variant-numeric: tabular-nums;
}

.header-status__label {
  font-weight: 700;
  color: var(--color-text-muted, #8a92a8);
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 0.4rem;
  cursor: pointer;
  background: none;
  border: none;
  z-index: 5;
}

.hamburger span {
  width: 22px;
  height: 2px;
  background: var(--color-text, #e4e8f0);
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1), opacity 200ms;
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* Legacy hooks kept harmless for older markup/scripts */
.header-mascot-spacer,
.header-status__divider,
.header__nav-end {
  display: none !important;
}

@media (max-width: 960px) {
  :root {
    --site-header-height: 4.25rem;
    --site-header-logo: 3.5rem;
  }

  #header.header {
    padding: 0.55rem 0.65rem 0;
  }

  #header.header .header__pill {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.35rem 0.75rem;
    border-radius: 1.25rem;
  }

  .hamburger {
    display: flex;
    order: 1;
  }

  .header__logo-center {
    order: 2;
    margin: 0;
  }

  .header__side--right {
    order: 3;
    padding: 0;
    gap: 0.65rem;
    margin-left: auto;
  }

  .header__side--left {
    display: none;
  }

  #header.header .header__pill.is-open,
  #header.header .header__pill.open {
    border-radius: 1.25rem;
  }

  #header.header .header__pill.is-open .header__side--left,
  #header.header .header__pill.open .header__side--left {
    display: flex;
    order: 4;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.1rem;
    padding: 0.75rem 0 0.15rem;
    border-top: 1px solid rgba(140, 170, 220, 0.1);
    margin-top: 0.35rem;
  }

  #header.header .header__pill.is-open .header__side--right,
  #header.header .header__pill.open .header__side--right {
    order: 5;
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-left: 0;
    padding-bottom: 0.35rem;
  }

  #header.header .header__pill.is-open .header-auth-links,
  #header.header .header__pill.open .header-auth-links,
  #header.header .header__pill.is-open .header-status,
  #header.header .header__pill.open .header-status {
    display: none;
  }

  .header-dd__menu {
    position: static;
    transform: none !important;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    display: none;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0.15rem 0 0.35rem 0.75rem;
    min-width: 0;
  }

  .header-dd:hover .header-dd__menu {
    display: none;
  }

  .header-dd.is-open .header-dd__menu,
  .header-dd.is-open:hover .header-dd__menu {
    display: block;
  }

  .header__link,
  .header-dd__toggle {
    width: 100%;
    justify-content: flex-start;
    padding: 0.65rem 0.2rem;
  }

  .header-status__label {
    display: none;
  }

  .header-auth-links--user {
    max-width: none;
  }

  .header-user-chip__name {
    max-width: none;
  }

  .header-char-stack__link {
    width: 1.65rem;
    height: 1.65rem;
  }

  .header-char-stack__link + .header-char-stack__link {
    margin-left: -0.82rem;
  }

  .header-char-stack:hover .header-char-stack__link + .header-char-stack__link {
    margin-left: 0.12rem;
  }
}

/* ===== FLOATING STATUS FOOTER (simple dock) ===== */
#footer.footer.footer--status {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 190;
  margin: 0;
  padding: 0 1rem 0.85rem;
  background: transparent;
  border: none;
  pointer-events: none;
  display: flex;
  justify-content: center;
}

#footer.footer.footer--status .footer__status {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.35rem 2rem;
  width: min(720px, calc(100vw - 1.5rem));
  min-height: 2.75rem;
  padding: 0.65rem 1.5rem;
  box-sizing: border-box;
  border-radius: 999px;
  background: rgba(10, 14, 26, 0.82);
  border: 1px solid rgba(140, 170, 220, 0.12);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.footer__status-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-body, 'Satoshi', sans-serif);
  white-space: nowrap;
}

.footer__status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4caf7d;
  box-shadow: 0 0 0 2px rgba(76, 175, 125, 0.22), 0 0 10px rgba(76, 175, 125, 0.4);
  flex-shrink: 0;
}

.footer__status--offline .footer__status-dot {
  background: var(--color-text-faint, #4a5270);
  box-shadow: none;
}

.footer__status-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-faint, #4a5270);
}

.footer__status-value {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text, #e4e8f0);
  letter-spacing: 0.02em;
}

@media (max-width: 640px) {
  :root {
    --site-footer-height: 4.25rem;
  }

  #footer.footer.footer--status {
    padding: 0 0.65rem 0.55rem;
  }

  #footer.footer.footer--status .footer__status {
    gap: 0.55rem 1rem;
    padding: 0.55rem 1rem;
    justify-content: space-evenly;
  }

  .footer__status-label {
    font-size: 0.62rem;
  }

  .footer__status-value {
    font-size: 0.72rem;
  }
}

