.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  background: rgba(4, 8, 15, 0.65);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-bar,
.header-inner {
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.875rem;
  min-width: 0;
}

.brand__mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  font-weight: 900;
  font-size: 1.2rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow-glow);
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand__text strong {
  font-size: var(--text-md);
  letter-spacing: 0.02em;
}

.brand__text small {
  color: var(--muted);
  font-size: var(--text-xs);
  margin-top: 0.25rem;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.header-actions,
.header-aside {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

/* Header nav buttons — glass style (not dropdown items) */
.site-header .main-nav > a.btn,
.site-header .main-nav > .btn,
.site-header .header-actions a,
.site-header .header-aside > a,
.site-header .prizrak-games-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0 1.125rem;
  border-radius: 14px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg-ghost);
  color: var(--muted-strong);
  font-weight: 700;
  font-size: var(--text-sm);
  text-decoration: none;
  box-shadow: var(--btn-shadow);
  white-space: nowrap;
  transition:
    transform var(--ease),
    box-shadow var(--ease),
    background var(--ease),
    border-color var(--ease),
    color var(--ease);
}

.site-header .main-nav .btn--small,
.site-header .header-actions .btn--small {
  min-height: 38px;
  padding: 0.35rem 0.85rem;
  font-size: var(--text-xs);
  border-radius: 12px;
}

.site-header .main-nav > a.btn:hover,
.site-header .main-nav > .btn:hover,
.site-header .header-actions a:hover,
.site-header .header-aside > a:hover,
.site-header .prizrak-games-link:hover {
  transform: translateY(-1px);
  border-color: var(--btn-border-hover);
  color: #ecfdf5;
  background: var(--btn-bg-hover);
  box-shadow: var(--btn-shadow-hover);
}

.site-header .main-nav > a.btn.is-active,
.site-header .main-nav > .btn.is-active,
.site-header .main-nav .main-nav__cabinet.is-active {
  color: #a7f3d0;
  border-color: var(--btn-border-hover);
  background: var(--btn-bg);
  box-shadow: var(--btn-shadow-hover);
}

.site-header .btn--small,
.site-header .header-logout {
  min-height: 38px;
  padding: 0.35rem 0.9rem;
  font-size: var(--text-xs);
  border-radius: 12px;
}

.prizrak-games-link__text {
  display: grid;
  gap: 0.1rem;
  line-height: 1.15;
  min-width: 0;
}

.prizrak-games-link__text strong {
  font-size: var(--text-sm);
  white-space: nowrap;
}

.prizrak-games-link__text small {
  color: var(--muted);
  font-size: var(--text-xs);
}

.prizrak-games-link--compact {
  max-width: 190px;
}

@media (max-width: 1180px) {
  .header-bar,
  .header-inner {
    flex-wrap: wrap;
    padding: 0.875rem 0;
  }

  .main-nav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.25rem;
  }
}

@media (max-width: 760px) {
  .header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .site-header .main-nav > a.btn,
  .site-header .header-actions a {
    min-height: 42px;
  }
}

/* ——— Projects dropdown (subdomains + mobile main) ——— */
.projects-dropdown {
  position: relative;
  flex-shrink: 0;
}

.projects-dropdown__toggle {
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.projects-dropdown__toggle::-webkit-details-marker {
  display: none;
}

.projects-dropdown__toggle::marker {
  content: "";
}

.projects-dropdown__chevron {
  flex-shrink: 0;
  opacity: 0.75;
  transition: transform var(--ease);
}

.projects-dropdown[open] .projects-dropdown__chevron {
  transform: rotate(180deg);
}

.projects-dropdown__panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 60;
  width: min(26rem, calc(100vw - 2rem));
  padding: var(--space-4);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card), 0 24px 48px rgba(0, 0, 0, 0.45);
  animation: projects-dropdown-in 0.22s var(--ease);
  overflow: visible;
}

.projects-dropdown__panel.surface,
.projects-dropdown__panel.surface::before {
  pointer-events: none;
}

.projects-dropdown__panel.surface > * {
  position: relative;
  z-index: 1;
  pointer-events: auto;
}

@keyframes projects-dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.projects-dropdown__lead {
  margin: 0 0 var(--space-3);
  padding: 0 var(--space-2);
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.projects-dropdown__list {
  display: grid;
  gap: 0.35rem;
  overflow: visible;
}

.projects-dropdown__item {
  display: grid !important;
  gap: 0.35rem;
  min-width: 0;
  min-height: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  box-shadow: none;
  text-decoration: none;
  white-space: normal;
  text-align: left;
  align-items: stretch;
  justify-content: flex-start;
  font-weight: 400;
  transition:
    background var(--ease),
    border-color var(--ease),
    transform var(--ease);
}

.site-header .projects-dropdown__item {
  display: grid !important;
  min-height: 0;
  padding: var(--space-3) var(--space-4);
  white-space: normal;
  font-weight: 400;
}

.projects-dropdown__item:hover {
  transform: translateY(-1px);
  border-color: var(--btn-border);
  background: var(--btn-bg-ghost);
}

.projects-dropdown__item.is-current {
  border-color: var(--btn-border-hover);
  background: var(--btn-bg);
}

.projects-dropdown__item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-width: 0;
  width: 100%;
}

.projects-dropdown__item-head strong {
  display: block;
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 700;
  min-width: 0;
  line-height: 1.3;
}

.projects-dropdown__tag {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-strong);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.projects-dropdown__desc {
  display: block;
  color: var(--muted);
  font-size: var(--text-xs);
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.projects-dropdown__footer {
  display: block;
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4) 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: #a7f3d0;
  font-size: var(--text-xs);
  font-weight: 700;
  text-decoration: none;
  white-space: normal;
  min-height: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.site-header .projects-dropdown__footer {
  display: block;
  min-height: 0;
  padding: var(--space-3) var(--space-4) 0;
  white-space: normal;
  font-weight: 700;
}

.projects-dropdown__footer:hover {
  color: #ecfdf5;
}

.site-header .projects-dropdown__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 48px;
  padding: 0 1.125rem;
  border-radius: 14px;
  border: 1px solid var(--btn-border);
  background: var(--btn-bg-ghost);
  color: var(--muted-strong);
  font-weight: 700;
  font-size: var(--text-sm);
  box-shadow: var(--btn-shadow);
  transition:
    transform var(--ease),
    box-shadow var(--ease),
    background var(--ease),
    border-color var(--ease),
    color var(--ease);
}

.site-header .projects-dropdown__toggle:hover,
.projects-dropdown[open] > .projects-dropdown__toggle {
  transform: translateY(-1px);
  border-color: var(--btn-border-hover);
  color: #ecfdf5;
  background: var(--btn-bg-hover);
  box-shadow: var(--btn-shadow-hover);
}

.site-header .projects-dropdown--compact .projects-dropdown__toggle,
.site-header .projects-dropdown__toggle.btn--small {
  min-height: 38px;
  padding: 0.35rem 0.85rem;
  font-size: var(--text-xs);
  border-radius: 12px;
}

.main-nav--ecosystem {
  flex: 1;
  justify-content: center;
}

.main-nav--ecosystem .main-nav__projects {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.main-nav--project {
  flex: 1;
  justify-content: flex-end;
}

.main-nav__divider {
  width: 1px;
  height: 28px;
  margin: 0 0.15rem;
  background: rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.header-bar__right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

@media (max-width: 1180px) {
  .main-nav--ecosystem .main-nav__projects .btn {
    display: none;
  }

  .main-nav--ecosystem .projects-dropdown {
    display: block;
  }

  .projects-dropdown__panel {
    right: auto;
    left: 0;
  }
}

@media (min-width: 1181px) {
  .main-nav--ecosystem .projects-dropdown--mobile-only {
    display: none;
  }
}

@media (max-width: 760px) {
  .main-nav--project {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.25rem;
  }

  .main-nav__divider {
    display: none;
  }

  .projects-dropdown__panel {
    position: fixed;
    top: calc(var(--header-height, 80px) + 8px);
    left: 16px;
    right: 16px;
    width: auto;
    max-height: none;
    overflow: visible;
  }
}
