.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  height: var(--topbar-h);
  background: rgb(6 5 8 / 62%);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

.topbar.is-stuck {
  background: rgb(6 5 8 / 88%);
  border-bottom-color: var(--line);
  box-shadow: 0 10px 40px rgb(0 0 0 / 55%);
}

.topbar-inner {
  width: min(100% - 40px, var(--shell-w));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topbar-scanline {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 1px;
  width: 100%;
  background: linear-gradient(90deg, transparent, var(--red), transparent);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.topbar.is-stuck .topbar-scanline {
  opacity: 0.65;
  animation: scan 4.5s linear infinite;
}

@keyframes scan {
  0% { transform: translateX(-60%); }
  100% { transform: translateX(60%); }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 40% 30%, #2a0810, #0a0509);
  border: 1px solid var(--line-red);
  box-shadow: 0 0 0 3px rgb(255 34 49 / 6%), 0 0 22px rgb(255 34 49 / 22%);
  overflow: hidden;
  transition: transform 0.5s var(--spring), box-shadow 0.4s ease;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand:hover .brand-mark {
  transform: rotate(-8deg) scale(1.08);
  box-shadow: 0 0 0 3px rgb(255 34 49 / 12%), 0 0 30px rgb(255 34 49 / 45%);
}

.brand-text strong {
  display: block;
  font-size: 14px;
  letter-spacing: 0.2em;
  line-height: 1.2;
}

.brand-text small {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.gooey-nav-container {
  position: relative;
}

.gooey-nav-container nav {
  display: flex;
  position: relative;
  transform: translate3d(0, 0, 0.01px);
}

.gooey-nav-container nav ul {
  display: flex;
  gap: 0.6em;
  padding: 0;
  margin: 0;
  position: relative;
  z-index: 3;
  color: #fff;
  text-shadow: 0 1px 1px rgb(10 4 6 / 40%);
}

.gooey-nav-container nav ul li {
  border-radius: 100vw;
  position: relative;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: color 0.3s ease, box-shadow 0.3s ease;
  box-shadow: 0 0 0.5px 1.5px transparent;
  color: var(--text-2);
}

.gooey-nav-container nav ul li a {
  display: inline-block;
  padding: 0.55em 1.15em;
}

.gooey-nav-container nav ul li:hover {
  color: #fff;
}

.gooey-nav-container nav ul li:focus-within:has(:focus-visible) {
  box-shadow: 0 0 0.5px 1.5px var(--red-hot);
}

.gooey-nav-container nav ul li::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 100vw;
  background: linear-gradient(180deg, #ff5a68, #ff2231 45%, #a30c17);
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s ease;
  z-index: -1;
  box-shadow: 0 4px 18px rgb(255 34 49 / 35%);
}

.gooey-nav-container nav ul li.active {
  color: #fff;
  text-shadow: 0 1px 2px rgb(60 0 6 / 60%);
}

.gooey-nav-container nav ul li.active::after {
  opacity: 1;
  transform: scale(1);
}

.gooey-nav-container .effect {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  opacity: 1;
  pointer-events: none;
  display: grid;
  place-items: center;
  z-index: 1;
}

.gooey-nav-container .effect.text {
  color: #fff;
  transition: color 0.3s ease;
}

.gooey-nav-container .effect.filter {
  filter: blur(7px) contrast(100) blur(0);
  mix-blend-mode: lighten;
}

.gooey-nav-container .effect.filter::before {
  content: "";
  position: absolute;
  inset: -75px;
  z-index: -2;
  background: #000;
}

.gooey-nav-container .effect.filter::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #ff2231;
  transform: scale(0);
  opacity: 0;
  z-index: -1;
  border-radius: 100vw;
}

.gooey-nav-container .effect.active::after {
  animation: pill 0.3s ease both;
}

@keyframes pill {
  to { transform: scale(1); opacity: 1; }
}

.particle,
.point {
  display: block;
  opacity: 0;
  width: 20px;
  height: 20px;
  border-radius: 100%;
  transform-origin: center;
}

.particle {
  --time: 5s;
  position: absolute;
  top: calc(50% - 8px);
  left: calc(50% - 8px);
  animation: particle calc(var(--time)) ease 1 -350ms;
}

.point {
  background: var(--color);
  opacity: 1;
  animation: point calc(var(--time)) ease 1 -350ms;
}

@keyframes particle {
  0% {
    transform: rotate(0deg) translate(var(--start-x), var(--start-y));
    opacity: 1;
    animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45);
  }
  70% {
    transform: rotate(calc(var(--rotate) * 0.5)) translate(calc(var(--end-x) * 1.2), calc(var(--end-y) * 1.2));
    opacity: 1;
    animation-timing-function: ease;
  }
  85% {
    transform: rotate(calc(var(--rotate) * 0.66)) translate(var(--end-x), var(--end-y));
    opacity: 1;
  }
  100% {
    transform: rotate(calc(var(--rotate) * 1.2)) translate(calc(var(--end-x) * 0.5), calc(var(--end-y) * 0.5));
    opacity: 1;
  }
}

@keyframes point {
  0% { transform: scale(0); opacity: 0; animation-timing-function: cubic-bezier(0.55, 0, 1, 0.45); }
  25% { transform: scale(calc(var(--scale) * 0.25)); }
  38% { opacity: 1; }
  65% { transform: scale(var(--scale)); opacity: 1; animation-timing-function: ease; }
  85% { transform: scale(var(--scale)); opacity: 1; }
  100% { transform: scale(0); opacity: 0; }
}

.topbar-status {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: rgb(255 255 255 / 3%);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 0 rgb(255 176 32 / 50%);
  animation: pulse-ring 2s infinite;
}

.pulse-dot[data-state="online"] {
  background: var(--ok);
  box-shadow: 0 0 0 0 rgb(56 215 138 / 50%);
}

.pulse-dot[data-state="offline"] {
  background: var(--bad);
  animation: none;
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
  70% { box-shadow: 0 0 0 8px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.status-ping {
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .brand-text { display: none; }
  .topbar-status .status-label { display: none; }
}

@media (max-width: 620px) {
  .gooey-nav-container nav ul { gap: 0.2em; }
  .gooey-nav-container nav ul li { font-size: 12px; }
  .gooey-nav-container nav ul li a { padding: 0.5em 0.8em; }
}
