:root {
  --reef-top-header-height: 68px;
}

.top-header,
.top-header * {
  box-sizing: border-box;
}

.top-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--reef-top-header-height);
  border-bottom: 1px solid var(--reef-border, #222);
  background: rgba(10, 10, 10, 0.96);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.top-header__inner {
  position: relative;
  width: min(1120px, calc(100% - 2.5rem));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.top-header__brand {
  flex: 0 0 auto;
  color: var(--reef-red, #e63232) !important;
  font: 800 1.35rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-decoration: none !important;
  text-shadow: 0 0 20px rgba(230, 50, 50, 0.3);
}

.top-header__actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1.35rem;
}

.top-header-public,
.top-header-public__links {
  display: flex;
  align-items: center;
}

.top-header-public {
  position: relative;
}

.top-header-public__links {
  gap: 1.35rem;
}

.top-header-public__toggle {
  width: 2.625rem;
  height: 2.625rem;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #333;
  border-radius: 999px;
  background: transparent;
  color: #aaa;
  cursor: pointer;
}

.top-header-public__toggle:hover,
.top-header-public.is-open .top-header-public__toggle {
  border-color: #555;
  background: #1b1b1b;
  color: #eee;
}

.top-header-public__icon {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

.top-header__link {
  position: relative;
  min-height: 2.625rem;
  display: inline-flex;
  align-items: center;
  border-radius: 0.45rem;
  color: #b8b8b8 !important;
  font: 500 0.92rem/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-decoration: none !important;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.top-header__link:hover,
.top-header-dashboard:hover {
  background: rgba(230, 50, 50, 0.1);
  box-shadow: 0 0 18px rgba(230, 50, 50, 0.14);
  color: #ff8080 !important;
  text-decoration: none !important;
}

.top-header__link.active {
  color: #ff6262 !important;
  text-decoration: none !important;
}

.top-header-dashboard {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  background: transparent;
  color: #b8b8b8 !important;
  font: 600 0.92rem/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  text-decoration: none !important;
  transition: background-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.top-header-dashboard.active {
  color: #ff8080 !important;
}

.top-header__dashboard-link {
  height: 2.625rem;
  padding: 0.42rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 999px;
}

.top-header__session-slot {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
}

.top-header__session-placeholder {
  visibility: hidden;
  pointer-events: none;
}

.top-header__session-slot > a {
  position: absolute;
  inset: 0;
}

[data-auth-hydrate] {
  visibility: hidden;
  pointer-events: none;
}

.top-header__link[aria-current="page"]::after,
.top-header-dashboard[aria-current="page"]::after {
  content: '';
  position: absolute;
  right: 0.1rem;
  bottom: 0;
  left: 0.1rem;
  height: 2px;
  border-radius: 999px;
  background: var(--reef-red, #e63232);
}

.top-header-account {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1.35rem;
}

.top-header-account[hidden] {
  display: none;
}

.top-header-account__actions {
  display: flex;
  align-items: center;
  gap: 1.35rem;
}

.top-header-account__toggle {
  width: 2.625rem;
  height: 2.625rem;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid #333;
  border-radius: 999px;
  background: transparent;
  color: #aaa;
  cursor: pointer;
}

.top-header-account__toggle:hover,
.top-header-account.is-open .top-header-account__toggle {
  border-color: #555;
  background: #1b1b1b;
  color: #eee !important;
  text-decoration: none !important;
}

.top-header-account__menu-icon {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

.top-header-account__action {
  display: inline-flex;
  align-items: center;
}

.top-header-account__form {
  display: flex;
  margin: 0;
  padding: 0;
}

.top-header-account__signout {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.top-header__brand:focus-visible,
.top-header__link:focus-visible,
.top-header-dashboard:focus-visible,
.top-header-public__toggle:focus-visible,
.top-header-account__toggle:focus-visible,
.top-header-account__action:focus-visible {
  outline: 2px solid var(--reef-accent, #2dd4bf);
  outline-offset: 3px;
}

@media (max-width: 760px) {
  .top-header__actions {
    gap: 0.45rem;
  }

  .top-header__actions > .top-header-public {
    order: 2;
  }

  .top-header__actions > .top-header__session-slot {
    order: 1;
  }

  .top-header__actions > .top-header__session-slot--anonymous,
  .top-header__actions > .top-header__session-slot--hydrating {
    display: none;
  }

  .top-header-public__toggle {
    display: inline-flex;
  }

  .top-header-public--section-active .top-header-public__toggle {
    border-color: var(--reef-red, #e63232);
    color: #ff6262;
  }

  .top-header-public__links {
    position: fixed;
    top: calc(var(--reef-top-header-height) + 0.75rem);
    right: 1rem;
    z-index: 110;
    width: min(15rem, calc(100vw - 2rem));
    display: none;
    align-items: stretch;
    gap: 0;
    padding: 0.45rem;
    border: 1px solid #333;
    border-radius: 0.65rem;
    background: #111;
    box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.48);
  }

  .top-header-public.is-open .top-header-public__links {
    display: flex;
    flex-direction: column;
  }

  .top-header-public__links .top-header__link {
    width: 100%;
    min-height: 2.5rem;
    padding: 0.55rem 0.7rem;
    border-left: 2px solid transparent;
    border-radius: 0.4rem;
    font-size: 0.88rem;
  }

  .top-header-public__links .top-header__link[aria-current="page"]::after {
    display: none;
  }

  .top-header-public__links .top-header__link.active {
    border-left-color: var(--reef-red, #e63232);
  }
}

@media (max-width: 560px) {
  .top-header__inner {
    width: min(1120px, calc(100% - 2rem));
    gap: 0.5rem;
  }

  .top-header__brand {
    font-size: 1.25rem;
  }

  .top-header__actions {
    gap: 0.35rem;
  }

  .top-header__link {
    font-size: 0.82rem;
  }

  .top-header__dashboard-link {
    padding: 0.35rem 0.4rem;
  }

  .top-header-dashboard {
    font-size: 0.82rem;
  }

  .top-header-account {
    gap: 0.35rem;
  }

  .top-header-account__toggle {
    display: inline-flex;
  }

  .top-header-account--section-active .top-header-account__toggle {
    border-color: var(--reef-red, #e63232);
    color: #ff6262;
  }

  .top-header-account__actions {
    position: absolute;
    top: calc(100% + 0.75rem);
    right: 0;
    z-index: 110;
    width: min(12rem, calc(100vw - 2rem));
    display: none;
    align-items: stretch;
    gap: 0;
    padding: 0.45rem;
    border: 1px solid #333;
    border-radius: 0.65rem;
    background: #111;
    box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.48);
  }

  .top-header-account.is-open .top-header-account__actions {
    display: flex;
    flex-direction: column;
  }

  .top-header-account__action {
    width: 100%;
    min-height: 2.5rem;
    padding: 0.55rem 0.7rem;
    border-left: 2px solid transparent;
    border-radius: 0.4rem;
    font-size: 0.88rem;
  }

  .top-header-account__action[aria-current="page"]::after {
    display: none;
  }

  .top-header-account__action:hover,
  .top-header-account__action.active {
    background: #1d1d1d;
    color: #fff !important;
  }

  .top-header-account__action.active {
    border-left-color: var(--reef-red, #e63232);
  }

  .top-header-account__form {
    width: 100%;
  }

  .top-header-account__signout {
    border-top: 1px solid #292929;
    border-radius: 0 0 0.4rem 0.4rem;
    color: #aaa !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .top-header__link,
  .top-header-dashboard {
    transition: none;
  }
}
