.topbar {
  width: 100%;
  margin: 0;
  padding: 12px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-top: 0;
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.topbar--app {
  position: relative;
  z-index: 12;
  overflow: visible;
  margin: 0 0 4px;
  padding: 12px 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  gap: 16px;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-left: 84px;
  color: var(--ink);
  cursor: default;
  outline: none;
}

.brand--app {
  margin-left: 0;
}

.brand__mark-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.brand__mark {
  width: 46px;
  height: 46px;
  display: block;
  transition: transform 180ms ease, filter 180ms ease;
  transform-origin: center;
  filter: drop-shadow(0 0 0 rgba(153, 27, 27, 0));
}

.brand__mark-wrap:hover .brand__mark,
.brand:focus-visible .brand__mark {
  transform: translateY(-2px);
  filter: drop-shadow(0 0 8px rgba(153, 27, 27, 0.35));
}

.brand__easter-egg {
  position: absolute;
  left: 50%;
  top: calc(100% + 7px);
  transform: translateX(-50%) translateY(7px) scale(0.97);
  min-width: 134px;
  max-width: 176px;
  padding: 6px 8px 7px;
  border: 1px solid rgba(132, 101, 65, 0.38);
  border-radius: 10px;
  background: linear-gradient(180deg, #eadbc3 0%, #d9c09b 100%);
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.26),
    inset 0 1px 0 rgba(255, 255, 255, 0.34);
  font-size: 0.6rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: #2e2314;
  opacity: 0;
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.18);
  transform-origin: top center;
  transition:
    opacity 150ms ease 110ms,
    transform 180ms cubic-bezier(0.22, 1, 0.36, 1) 110ms;
  pointer-events: none;
  z-index: 5;
}

.brand__easter-egg::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 7px;
  height: 7px;
  background: #e4ceb0;
  border-top: 1px solid rgba(145, 116, 77, 0.32);
  border-left: 1px solid rgba(145, 116, 77, 0.32);
  transform: translateX(-50%) rotate(45deg);
}

.brand__mark-wrap:hover .brand__easter-egg,
.brand:focus-visible .brand__easter-egg {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.brand__easter-text {
  display: block;
}

.brand__easter-egg--refresh .brand__easter-text {
  animation: brand-hint-settle 260ms ease;
}

.brand__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand__name {
  font-family: "Marcellus", Georgia, serif;
  font-weight: 400;
  letter-spacing: 0.04em;
}

.brand__sub {
  color: var(--muted);
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar__nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.02);
}

.topbar__nav-item {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #cfd4dc;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-decoration: none;
  background: transparent;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.topbar__nav-item:hover {
  border-color: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.03);
}

.topbar__nav-item--active {
  border-color: rgba(153, 27, 27, 0.2);
  color: #f6e8e8;
  background: rgba(127, 29, 29, 0.14);
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar__game-context {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
}

.topbar__game-title {
  color: #eef2f7;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.topbar__game-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.08);
}

.topbar__game-id {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar__search {
  margin: 0 auto;
  width: min(460px, 100%);
}

.topbar__friends-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 1 auto;
  width: min(1480px, calc(100% - 80px));
  max-width: none;
  min-width: 0;
}

.topbar__friends-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 760px;
  width: 100%;
  min-width: min(760px, 100%);
}

.topbar__search-input {
  width: 100%;
  margin: 0;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(10, 11, 13, 0.88), rgba(10, 11, 13, 0.78));
}

.topbar__search-input--friends {
  min-width: 0;
  min-height: 50px;
  padding-right: 20px;
  font-size: 0.95rem;
}

.topbar__friends-search-results {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 120;
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 16px;
  background: rgba(19, 22, 26, 0.98);
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.28);
}

.topbar__friends-search-results[hidden] {
  display: none !important;
}

.topbar__friends-search-empty {
  margin: 0;
  color: rgba(220, 225, 233, 0.62);
  font-size: 0.76rem;
  line-height: 1.5;
}

.topbar__friends-search-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.018);
}

.topbar__friends-search-select {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 0;
  border: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.topbar__friends-search-avatar,
.topbar__friends-search-avatar-image {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  flex: 0 0 auto;
}

.topbar__friends-search-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, rgba(137, 31, 31, 0.28), rgba(38, 43, 50, 0.92));
  color: #f1f4f8;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.topbar__friends-search-avatar-image {
  display: block;
  object-fit: cover;
}

.topbar__friends-search-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.topbar__friends-search-name,
.topbar__friends-search-handle {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__friends-search-name {
  color: #eef2f7;
  font-size: 0.8rem;
  font-weight: 700;
}

.topbar__friends-search-handle {
  color: rgba(220, 225, 233, 0.62);
  font-size: 0.72rem;
}

.topbar__friends-search-action {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.topbar__friends-search-action:hover,
.topbar__friends-search-action:focus-visible {
  border-color: rgba(153, 27, 27, 0.18);
  background: rgba(127, 29, 29, 0.1);
  transform: translateY(-1px);
  outline: none;
}

.topbar__friends-search-action img {
  width: 14px;
  height: 14px;
  display: block;
}

.topbar__friends-search-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.topbar__friends-search-state--friends {
  background: rgba(74, 160, 106, 0.08);
  color: #d6f0df;
}

.topbar__friends-search-state--pending,
.topbar__friends-search-state--incoming {
  background: rgba(184, 140, 52, 0.1);
  color: #f4e4b8;
}

.topbar__friends-requests {
  position: relative;
  flex: 0 0 auto;
}

.topbar__friends-requests > summary {
  list-style: none;
}

.topbar__friends-requests > summary::-webkit-details-marker {
  display: none;
}

.topbar__friends-requests-toggle {
  position: relative;
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(10, 11, 13, 0.88), rgba(10, 11, 13, 0.78));
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.topbar__friends-requests-toggle:hover,
.topbar__friends-requests[open] .topbar__friends-requests-toggle {
  border-color: rgba(153, 27, 27, 0.18);
  background: rgba(127, 29, 29, 0.12);
  transform: translateY(-1px);
}

.topbar__friends-requests-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.topbar__friends-requests-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border-radius: 999px;
  background: #8f2323;
  color: #f7ecec;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.topbar__friends-requests-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 80;
  width: min(420px, calc(100vw - 72px));
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 16px;
  background: rgba(19, 22, 26, 0.98);
  box-shadow: 0 24px 44px rgba(0, 0, 0, 0.28);
}

.topbar__friends-requests-head h2,
.topbar__friends-requests-head p,
.topbar__friends-requests-label,
.topbar__friends-requests-empty,
.topbar__friends-request-name,
.topbar__friends-request-handle {
  margin: 0;
}

.topbar__friends-requests-head h2 {
  margin-top: 4px;
  font-size: 0.94rem;
}

.topbar__friends-requests-list,
.topbar__friends-requests-outgoing {
  display: grid;
  gap: 10px;
}

.topbar__friends-requests-list {
  margin-top: 12px;
}

.topbar__friends-requests-outgoing {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.topbar__friends-requests-label,
.topbar__friends-requests-empty,
.topbar__friends-request-handle {
  color: rgba(220, 225, 233, 0.62);
  font-size: 0.74rem;
  line-height: 1.5;
}

.topbar__friends-request {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.045);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.018);
}

.topbar__friends-request--outgoing {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.topbar__friends-request-name {
  color: #eef2f7;
  font-size: 0.8rem;
  font-weight: 700;
}

.topbar__friends-request-handle {
  margin-top: 3px;
}

.topbar__friends-request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topbar__friends-request-button {
  min-height: 34px;
  padding: 0 11px;
  border-radius: 10px;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
}

.topbar__search-input::-webkit-search-cancel-button {
  filter: invert(1) opacity(0.5);
}

.topbar__meta {
  color: var(--muted);
  font-size: 0.82rem;
}

@keyframes brand-hint-settle {
  0% {
    opacity: 0.7;
    transform: translateY(2px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 720px) {
  .topbar {
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 16px;
  }

  .brand {
    margin-left: 0;
  }

  .topbar__nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .topbar__actions {
    margin-left: auto;
  }

  .topbar__game-context {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }

  .topbar__search {
    order: 3;
    width: 100%;
    margin-left: 0;
  }

  .topbar__friends-tools {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }

  .topbar__friends-search {
    width: 100%;
  }

  .topbar__friends-search-results {
    right: 0;
  }

  .topbar__friends-requests-panel {
    right: -6px;
    width: min(420px, calc(100vw - 36px));
  }
}
