.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  max-width: 100vw;
  border-bottom: 1px solid var(--border-soft, var(--surface-border, #36291e));
  background: #000;
  backdrop-filter: blur(14px);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  width: min(100%, 1280px);
  min-width: 0;
  min-height: 75px;
  margin: 0 auto;
  padding: 0 24px;
  gap: 24px;
}

.brand-link {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 1rem;
  color: var(--text, var(--on-surface-primary, #f5f2f0));
  font-family: var(--qn-font-heading, "Space Grotesk", Inter, sans-serif);
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.brand-logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand-wordmark {
  white-space: nowrap;
}

.site-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 12px;
  min-width: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 12px;
  color: var(--muted-warm, var(--on-surface-variant, #dbc2b0));
  font-size: 14px;
  font-weight: 500;
}

.site-nav a {
  color: inherit;
  text-decoration: none;
}

.site-nav-overflow {
  display: contents;
}

.site-nav-overflow-menu {
  display: contents;
}

.site-nav-overflow-menu .header-button,
.site-nav-overflow-menu .account-menu-button {
  order: 3;
}

.site-nav-overflow-menu .buy-me-coffee-link {
  order: 2;
}

.site-nav-overflow-menu .site-nav-submit-link {
  order: 1;
}

.site-nav-more-button {
  position: relative;
  overflow: hidden;
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border, var(--surface-border, #554336));
  border-radius: 8px;
  background: rgba(50, 40, 32, 0.72);
  color: var(--muted-warm, var(--on-surface-variant, #dbc2b0));
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.site-nav-more-button svg {
  position: relative;
  z-index: 1;
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.site-nav-more-button:hover,
.site-nav-more-button:focus-visible,
.site-gradient-cta:hover,
.site-gradient-cta:focus-visible,
.header-button:hover,
.header-button:focus-visible,
.account-menu-button:hover,
.account-menu-button:focus-visible {
  transform: translateY(-1px);
}

.buy-me-coffee-link {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid #ffdd00;
  border-radius: 8px;
  padding: 0 14px;
  background: transparent;
  color: #ffdd00;
  font-family: var(--qn-font-body, Inter, Arial, sans-serif);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.buy-me-coffee-link img {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 26px;
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 0 4px rgba(255, 221, 0, 0.36));
}

.buy-me-coffee-link span {
  position: relative;
  z-index: 1;
}

.buy-me-coffee-link::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(
    110deg,
    transparent 0%,
    transparent 30%,
    rgba(255, 221, 0, 0.34) 48%,
    rgba(255, 129, 63, 0.22) 56%,
    transparent 74%,
    transparent 100%
  );
  opacity: 0;
  transform: translateX(-125%);
}

.buy-me-coffee-link:hover,
.buy-me-coffee-link:focus-visible {
  border-color: #ffdd00;
  background: rgba(255, 221, 0, 0.06);
  color: #ffdd00;
  box-shadow: 0 0 0 1px rgba(255, 221, 0, 0.18), 0 8px 20px rgba(255, 129, 63, 0.18);
  transform: translateY(-1px);
}

.buy-me-coffee-link:hover::after,
.buy-me-coffee-link:focus-visible::after {
  opacity: 1;
  animation: siteCtaShinePass 900ms ease-out 1;
}

.buy-me-coffee-widget-loader {
  display: none;
}

#bmc-wbtn {
  display: none !important;
}

#bmc-iframe {
  border-radius: 8px !important;
}

.site-gradient-cta {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font-family: var(--qn-font-body, Inter, Arial, sans-serif);
  font-size: 14px;
  line-height: 1;
  letter-spacing: 0.01em;
  font-weight: 700;
  text-decoration: none;
  transition:
    box-shadow 180ms ease,
    transform 180ms ease;
}

.site-gradient-cta-attention::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(
    110deg,
    transparent 0%,
    transparent 34%,
    rgba(255, 255, 255, 0.92) 48%,
    rgba(255, 255, 255, 0.38) 54%,
    transparent 68%,
    transparent 100%
  );
  transform: translateX(-125%);
  animation: siteCtaShinePass 1500ms ease-out 220ms 1;
}

@keyframes siteCtaShinePass {
  to {
    transform: translateX(125%);
  }
}

.site-gradient-cta-orange {
  border: 1px solid #dc7b13;
  background: linear-gradient(135deg, #ffd2ad 0%, #f0a35a 52%, #dc7b13 100%);
  color: #000 !important;
  box-shadow: 0 8px 20px rgba(220, 123, 19, 0.28);
}

.site-gradient-cta-blue {
  border: 1px solid #75b9be;
  background: linear-gradient(135deg, #bfe7ea 0%, #9ad4d9 52%, #75b9be 100%);
  color: #000 !important;
  box-shadow: 0 8px 20px rgba(117, 185, 190, 0.26);
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current="page"] {
  color: var(--text, var(--on-surface-primary, #f5f2f0));
}

.site-nav .site-nav-webapp-link:hover,
.site-nav .site-nav-webapp-link:focus-visible {
  color: #000 !important;
  box-shadow: 0 8px 20px rgba(220, 123, 19, 0.28);
}

.site-nav .site-nav-submit-link:hover,
.site-nav .site-nav-submit-link:focus-visible {
  color: #000 !important;
  box-shadow: 0 8px 20px rgba(117, 185, 190, 0.26);
}

.site-nav .site-gradient-cta[aria-current="page"] {
  color: #000 !important;
}

.header-button {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--border, var(--surface-border, #554336));
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(50, 40, 32, 0.72);
  color: var(--text, var(--on-surface, #f5f2f0));
  font-family: var(--qn-font-body, Inter, Arial, sans-serif);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.header-button-primary {
  border-color: var(--primary, var(--brand-accent, #dc7b13));
  background: var(--primary, var(--brand-accent, #dc7b13));
  color: var(--surface-lowest, var(--on-primary-fixed, #140d06));
}

.header-sign-in-button {
  border-color: var(--primary, var(--brand-accent, #dc7b13));
  background: transparent;
  color: var(--muted-warm, var(--on-surface-variant, #dbc2b0));
}

.account-menu-button {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border, var(--surface-border, #554336));
  border-radius: 8px;
  background: rgba(20, 13, 6, 0.58);
  color: var(--muted-warm, var(--on-surface-variant, #dbc2b0));
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

.account-menu-button:hover,
.account-menu-button:focus-visible {
  border-color: var(--muted, var(--on-surface-secondary, #b0a8a2));
  background: rgba(61, 51, 43, 0.78);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  color: var(--text, var(--on-surface, #f5f2f0));
}

.account-menu-success-icon {
  position: absolute;
  right: 5px;
  bottom: 5px;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  width: 12px;
  height: 12px;
  border: 1px solid #000;
  border-radius: 999px;
  background: var(--primary, var(--brand-accent, #dc7b13));
  color: #000;
}

.account-menu-success-icon svg {
  width: 8px;
  height: 8px;
  fill: currentColor;
}

.account-menu-button.is-signed-in .account-menu-success-icon {
  display: inline-flex;
}

.account-menu-button svg {
  position: relative;
  z-index: 1;
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: currentColor;
}

.account-menu-button-label {
  position: relative;
  z-index: 1;
  display: none;
}

.auth-menu {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  z-index: 40;
  width: min(360px, calc(100vw - 32px));
  border: 1px solid var(--border, var(--surface-border, #554336));
  border-radius: 8px;
  padding: 18px;
  background: rgba(34, 26, 19, 0.98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  opacity: 0;
  transform: translateY(-10px);
  transform-origin: top right;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.auth-menu.is-open {
  opacity: 1;
  transform: translateY(0);
}

.account-menu {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  z-index: 40;
  width: min(260px, calc(100vw - 32px));
  border: 1px solid var(--border, var(--surface-border, #554336));
  border-radius: 8px;
  padding: 14px;
  background: rgba(34, 26, 19, 0.98);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  opacity: 0;
  transform: translateY(-10px);
  transform-origin: top right;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.account-menu.is-open {
  opacity: 1;
  transform: translateY(0);
}

.account-menu-header {
  margin-bottom: 10px;
}

.account-menu-header strong {
  display: block;
  overflow: hidden;
  color: var(--muted-warm, var(--on-surface-variant, #dbc2b0));
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-menu-header {
  display: grid;
  gap: 4px;
  margin-bottom: 14px;
}

.auth-menu-header strong {
  color: var(--text, var(--on-surface, #f5f2f0));
  font-family: var(--qn-font-heading, "Space Grotesk", Inter, sans-serif);
  font-size: 18px;
}

.auth-menu-header span {
  color: var(--muted, var(--on-surface-secondary, #b0a8a2));
  font-size: 13px;
}

.auth-form {
  display: grid;
  width: min(100%, 420px);
  gap: 14px;
}

.auth-form .field {
  display: grid;
  gap: 7px;
  color: var(--text, var(--on-surface, #f5f2f0));
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.auth-form .field input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border, var(--surface-border, #554336));
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(20, 13, 6, 0.72);
  color: var(--text, var(--on-surface, #f5f2f0));
  outline: none;
}

.auth-form .field input:focus {
  border-color: var(--primary, var(--brand-accent, #dc7b13));
}

.auth-menu .divider-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: min(100%, 420px);
  gap: 12px;
  margin: 18px 0;
  color: var(--muted, var(--on-surface-secondary, #b0a8a2));
}

.auth-menu .divider-row span {
  height: 1px;
  background: var(--border-soft, var(--surface-border, #36291e));
}

.auth-menu .divider-row p {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.auth-menu .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border-radius: 8px;
  padding: 0 20px;
  font-family: var(--qn-font-body, Inter, Arial, sans-serif);
  font-weight: 700;
}

.account-menu .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 40px;
  border-radius: 8px;
  padding: 0 16px;
  font-family: var(--qn-font-body, Inter, Arial, sans-serif);
  font-weight: 700;
}

.auth-menu .button-primary {
  width: 100%;
  border: 1px solid #dc7b13;
  background: linear-gradient(135deg, #ffd2ad 0%, #f0a35a 52%, #dc7b13 100%);
  color: var(--surface-lowest, var(--on-primary-fixed, #140d06));
  box-shadow: 0 8px 20px rgba(220, 123, 19, 0.28);
  transition:
    box-shadow 180ms ease,
    transform 180ms ease;
}

.auth-menu .button-primary:not(:disabled):hover,
.auth-menu .button-primary:not(:disabled):focus-visible {
  box-shadow: 0 8px 20px rgba(220, 123, 19, 0.36);
  transform: translateY(-1px);
}

.auth-menu .button-primary:disabled {
  border-color: var(--surface-highest, #3d332b);
  background: var(--surface-highest, #3d332b);
  color: var(--muted, var(--on-surface-secondary, #b0a8a2));
  box-shadow: none;
  transform: none;
}

.auth-menu .button-neutral {
  width: 100%;
  border: 1px solid var(--border, var(--surface-border, #554336));
  background: rgba(20, 13, 6, 0.58);
  color: var(--text, var(--on-surface, #f5f2f0));
  gap: 10px;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.auth-menu .button-neutral + .button-neutral {
  margin-top: 10px;
}

.auth-menu .button-neutral:not(:disabled):hover,
.auth-menu .button-neutral:not(:disabled):focus-visible {
  border-color: var(--muted, var(--on-surface-secondary, #b0a8a2));
  background: rgba(61, 51, 43, 0.78);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
  transform: translateY(-1px);
}

.account-menu .button-neutral {
  border: 1px solid var(--border, var(--surface-border, #554336));
  background: rgba(20, 13, 6, 0.58);
  color: var(--text, var(--on-surface, #f5f2f0));
}

.google-mark {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.apple-mark {
  position: relative;
  z-index: 1;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: currentColor;
}

.auth-menu .button-neutral span {
  position: relative;
  z-index: 1;
}

@-moz-document url-prefix() {
  .site-nav-more-button,
  .site-gradient-cta,
  .header-button,
  .account-menu-button,
  .buy-me-coffee-link,
  .buy-me-coffee-link::after,
  .auth-menu .button-primary,
  .auth-menu .button-neutral {
    will-change: transform;
  }
}

.header-auth-feedback {
  margin-top: 14px;
  border: 1px solid var(--border, var(--surface-border, #554336));
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(34, 26, 19, 0.72);
  color: var(--text, var(--on-surface, #f5f2f0));
  font-size: 13px;
}

.header-auth-feedback[data-kind="error"] {
  border-color: rgba(255, 180, 171, 0.45);
  color: var(--danger, #ffb4ab);
}

[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  .site-header-inner {
    min-height: 64px;
    gap: 12px;
  }

  .site-actions {
    gap: 12px;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .brand-link {
    font-size: 22px;
  }

  .auth-menu {
    top: calc(100% + 10px);
  }

  .account-menu {
    top: calc(100% + 10px);
  }
}

@media (max-width: 760px) {
  .site-actions {
    flex: 0 0 auto;
    margin-left: auto;
    gap: 8px;
  }

  .site-gradient-cta {
    min-height: 36px;
    padding: 0 10px;
    font-size: 13px;
    white-space: nowrap;
  }

  .site-nav-overflow {
    position: relative;
    display: block;
  }

  .site-nav-more-button {
    display: inline-flex;
    width: 36px;
    height: 36px;
  }

  .site-nav-overflow-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 40;
    display: grid;
    gap: 8px;
    min-width: 184px;
    border: 1px solid var(--border, var(--surface-border, #554336));
    border-radius: 8px;
    padding: 8px;
    background: rgba(34, 26, 19, 0.98);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transform: translateY(-8px);
    transform-origin: top right;
    transition:
      opacity 180ms ease,
      visibility 180ms ease,
      transform 180ms ease;
  }

  #site-nav-overflow-menu.is-open {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transform: translateY(0);
  }

  .site-nav-overflow-menu .site-nav-submit-link {
    order: 2;
    width: 100%;
    box-sizing: border-box;
  }

  .site-nav-overflow-menu .buy-me-coffee-link {
    order: 3;
    width: 100%;
    box-sizing: border-box;
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }

  .header-button {
    order: 1;
    width: 100%;
    min-height: 36px;
    padding: 0 12px;
    font-size: 13px;
  }

  .account-menu-button {
    order: 1;
    width: 100%;
    min-width: 36px;
    padding: 0 12px;
  }

  .site-nav-overflow-menu .account-menu-button {
    width: 100%;
    height: 36px;
    gap: 8px;
    font-family: var(--qn-font-body, Inter, Arial, sans-serif);
    font-size: 13px;
    font-weight: 700;
  }

  .site-nav-overflow-menu .account-menu-button-label {
    display: inline;
  }
}

@media (max-width: 560px) {
  .site-header-inner {
    width: 100vw;
    min-height: 64px;
    padding: 0 16px;
    justify-content: space-between;
    gap: 8px;
  }

  .brand-link {
    flex: 0 1 auto;
  }

  .brand-wordmark {
    display: none;
  }

  .site-nav {
    display: flex;
    gap: 8px;
  }

  .auth-menu {
    position: fixed;
    top: 74px;
    top: calc(64px + max(10px, env(safe-area-inset-top)));
    right: 16px;
    right: max(16px, env(safe-area-inset-right));
    left: 16px;
    left: max(16px, env(safe-area-inset-left));
    box-sizing: border-box;
    width: auto;
    max-height: calc(100vh - 84px);
    max-height: calc(100dvh - 84px - env(safe-area-inset-top));
    overflow-y: auto;
    transform-origin: top center;
  }

  .account-menu {
    position: fixed;
    top: 74px;
    top: calc(64px + max(10px, env(safe-area-inset-top)));
    right: 16px;
    right: max(16px, env(safe-area-inset-right));
    box-sizing: border-box;
    width: max-content;
    min-width: 172px;
    max-width: calc(100vw - 32px);
    max-width: calc(100vw - max(16px, env(safe-area-inset-left)) - max(16px, env(safe-area-inset-right)));
    transform-origin: top center;
  }
}
