.app-topbar-scroll-sentinel {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.app-topbar [hidden] { display: none !important; }

body.app-public-layout { padding-top: 0; }
body.app-public-layout > main.content { padding-top: 0; }

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  width: 100%;
  border-bottom: 1px solid transparent;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, Arial, sans-serif;
  transition: background .24s ease, border-color .24s ease, box-shadow .24s ease, backdrop-filter .24s ease;
}

.app-topbar.is-scrolled {
  border-color: rgba(221, 226, 237, .72);
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 8px 22px rgba(21, 35, 59, .07);
  backdrop-filter: blur(16px) saturate(145%);
  -webkit-backdrop-filter: blur(16px) saturate(145%);
}

.app-topbar-shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  min-height: 70px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 28px;
}

.app-topbar-brand {
  display: inline-flex;
  grid-column: 1;
  align-items: center;
  justify-self: start;
  gap: 9px;
  color: #20232b;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.03em;
  text-decoration: none;
}

.app-topbar-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 31px;
  height: 31px;
  border-radius: 7px;
  background: #3767f0;
  color: #fff;
  font-size: 14px;
}

.app-topbar-logo.has-image {
  width: auto;
  max-width: 132px;
  background: transparent;
  border-radius: 0;
}
.app-topbar-logo img { display: block; width: auto; max-width: 132px; height: 100%; object-fit: contain; }

.app-topbar-links {
  display: flex;
  grid-column: 2;
  align-items: center;
  gap: 38px;
  margin: 0;
}

.app-topbar-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 70px;
  color: #262934;
  font-size: 16px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  transition: color .2s ease, transform .2s ease;
}

.app-topbar-link:hover,
.app-topbar-link.is-active {
  color: #2859e8;
}

.app-topbar-link.is-active { font-weight: 500; }
.app-topbar-link-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: inherit;
  line-height: 1;
}

.app-topbar-link.is-active .app-topbar-link-label::after {
  content: "";
  position: absolute;
  bottom: 14px;
  left: 50%;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transform: translateX(-50%);
}
.app-topbar-link:active { transform: translateY(1px); }

.app-topbar-spacer { display: none; }

.app-topbar-login,
.app-topbar-user {
  grid-column: 3;
  justify-self: end;
}

.app-topbar-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 84px;
  min-height: 36px;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  background: #3767f0;
  box-shadow: none;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: background .2s ease, transform .2s ease;
}

.app-topbar-login:hover { background: #2553da; color: #fff; }
.app-topbar-login:active { transform: translateY(1px); }

.app-topbar-user {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.app-topbar-account {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  gap: 10px;
  padding: 3px 2px 3px 0;
  min-width: 0;
  color: #262934;
  text-decoration: none;
  transition: color .2s ease, transform .2s ease;
}

.app-topbar-account:hover {
  color: #2859e8;
}

.app-topbar-user-meta {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}

.app-topbar-avatar-wrap {
  position: relative;
  display: inline-flex;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
}

.app-topbar-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  overflow: hidden;
  border-radius: 50%;
  background: #edf2ff;
  color: #2859e8;
  font-size: 13px;
  font-weight: 700;
}

.app-topbar-avatar img { width: 100%; height: 100%; object-fit: cover; }
.app-topbar-user-heading { display: flex; min-width: 0; align-items: center; }
.app-topbar-user-name { display: block; max-width: 136px; overflow: hidden; color: #262934; font-size: 14px; font-weight: 600; line-height: 17px; text-overflow: ellipsis; white-space: nowrap; }
.app-topbar-account:hover .app-topbar-user-name { color: #2859e8; }
.app-topbar-user-type { position: absolute; top: -4px; right: -5px; z-index: 1; display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 14px; padding: 0 3px; border: 2px solid #fff; border-radius: 8px; background: #7d8797; box-shadow: 0 1px 3px rgba(27, 43, 69, .18); color: #fff; font-size: 8px; font-weight: 700; letter-spacing: .02em; line-height: 10px; }
.app-topbar-user-type.is-member { background: #fff1c7; box-shadow: 0 1px 3px rgba(164, 105, 15, .22); color: #a66d14; }
.app-topbar-user-benefits { display: block; max-width: 190px; overflow: hidden; color: #7f8999; font-size: 12px; line-height: 15px; text-overflow: ellipsis; white-space: nowrap; }

.app-topbar-account-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #7f8998;
  cursor: pointer;
  transition: color .2s ease, transform .2s ease, background .2s ease;
}

.app-topbar-account-toggle:hover { color: #2859e8; }
.app-topbar-account-toggle:active { transform: translateY(1px); }

.app-topbar-account-menu-bridge {
  position: absolute;
  top: 100%;
  right: 0;
  width: 254px;
  height: 8px;
}

.app-topbar-account-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 2;
  display: flex;
  width: 254px;
  flex-direction: column;
  padding: 0;
  visibility: hidden;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 26px rgba(21, 35, 59, .12);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .16s ease, transform .16s ease, visibility .16s ease;
}

.app-topbar-user.is-account-menu-open .app-topbar-account-menu {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.app-topbar-account-menu-item {
  display: flex;
  align-items: center;
  min-height: 38px;
  gap: 10px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #3f4755;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background .16s ease, color .16s ease;
}

.app-topbar-account-menu-item:hover,
.app-topbar-account-menu-item:focus-visible { background: #f3f6ff; color: #2859e8; outline: 0; }
.app-topbar-account-menu-item i { width: 14px; color: #8791a3; font-size: 14px; text-align: center; }
.app-topbar-account-menu-item.is-logout { margin-top: 5px; border-top: 1px solid #edf0f5; border-radius: 0 0 7px 7px; color: #c43d4b; }
.app-topbar-account-menu-item.is-logout:hover,
.app-topbar-account-menu-item.is-logout:focus-visible { background: #fff3f4; color: #b42332; }
.app-topbar-account-menu-item.is-logout i { color: currentColor; }

.app-topbar-account-summary {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto 12px auto;
  align-self: stretch;
  width: auto;
  aspect-ratio: 2 / 1;
  margin: 0;
  padding: 16px 18px 13px;
  overflow: hidden;
  border-radius: 16px 16px 0 0;
  background: url('../img/vip-membership-card-v4.png') center / 100% 100% no-repeat;
  color: #3c2b19;
  text-decoration: none;
}

.app-topbar-account-summary:focus-visible { outline: 2px solid #9a6a22; outline-offset: 2px; }

.app-topbar-account-plan { grid-column: 1 / -1; grid-row: 1; display: block; max-width: 138px; overflow: hidden; color: #342414; font-size: 17px; font-weight: 700; letter-spacing: .01em; line-height: 23px; text-overflow: ellipsis; white-space: nowrap; }
.app-topbar-account-expire { grid-column: 1 / -1; grid-row: 2; display: block; max-width: 148px; overflow: hidden; margin-top: 1px; color: #9a783d; font-size: 12px; line-height: 17px; text-overflow: ellipsis; white-space: nowrap; }
.app-topbar-account-divider { grid-column: 1 / -1; grid-row: 3; display: block; align-self: center; height: 1px; margin-right: 8px; background: rgba(154, 120, 61, .18); }
.app-topbar-account-balance { position: static; grid-column: 1; grid-row: 4; display: flex; align-self: center; flex-direction: column; gap: 2px; color: #957748; font-size: 10px; line-height: 13px; }
.app-topbar-account-balance > strong { color: #9a6a22; font-size: 13px; font-weight: 500; line-height: 16px; }
.app-topbar-account-balance > strong.is-empty { color: #a8571b; }
.app-topbar-account-recharge { position: static; grid-column: 2; grid-row: 4; display: inline-flex; align-items: center; justify-content: center; align-self: center; min-width: 72px; height: 26px; margin-left: 10px; border-radius: 13px; background: #8a5a25; color: #fffaf0; font-size: 12px; font-weight: 600; line-height: 1; }

.app-topbar-account-summary.is-membership-promo {
  grid-template-rows: auto 1fr auto;
  padding: 16px 18px 14px;
  background-image: url('../img/membership-upgrade-card-v1.png');
}

.app-topbar-account-summary.is-membership-promo:focus-visible { outline-color: #3f7fe5; }
.app-topbar-account-summary.is-membership-promo .app-topbar-account-plan { grid-row: 1; max-width: 144px; color: #2b4f82; }
.app-topbar-account-summary.is-membership-promo .app-topbar-account-expire { grid-row: 2; max-width: 152px; margin-top: 3px; align-self: start; color: #6c83a6; }
.app-topbar-account-summary.is-membership-promo .app-topbar-account-divider,
.app-topbar-account-summary.is-membership-promo .app-topbar-account-balance { display: none; }
.app-topbar-account-summary.is-membership-promo .app-topbar-account-recharge { grid-column: 1; grid-row: 3; justify-self: start; min-width: 76px; margin-left: 0; background: #3f7fe5; color: #fff; }

.app-topbar-menu {
  display: none;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: #fff;
  color: #303744;
  font-family: inherit;
  cursor: pointer;
}

.app-topbar-menu::before {
  content: "";
  display: block;
  width: 15px;
  height: 2px;
  margin: 0 auto;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 0 -5px currentColor, 0 5px currentColor;
}

.app-topbar-menu:active { transform: scale(.97); }
.app-topbar-link:focus-visible, .app-topbar-menu:focus-visible, .app-topbar-login:focus-visible, .app-topbar-account:focus-visible, .app-topbar-account-toggle:focus-visible { outline: 3px solid rgba(55, 103, 240, .26); outline-offset: 2px; }

@media (max-width: 960px) {
  .app-topbar-shell {
    display: flex;
    min-height: 62px;
    padding: 0 18px;
    gap: 10px;
  }

  .app-topbar-menu { display: block; flex: 0 0 36px; order: 3; }
  .app-topbar-spacer { display: block; flex: 1 1 auto; order: 2; }
  .app-topbar-login, .app-topbar-user { order: 4; }
  .app-topbar-links {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 6px 16px;
    border-top: 1px solid #e7ebf2;
    border-bottom: 1px solid #e7ebf2;
    background: #fff;
    box-shadow: 0 12px 22px rgba(21, 35, 59, .08);
  }

  .app-topbar.is-open .app-topbar-links { display: flex; }
  .app-topbar-link { min-height: 48px; border-bottom: 1px solid #eef1f5; }
  .app-topbar-link.is-active .app-topbar-link-label::after { bottom: 7px; }
  .app-topbar-link:last-child { border-bottom: 0; }
  .app-topbar-account-toggle { display: inline-flex; }
  .app-topbar-account-menu-bridge { display: none; }
}

@media (max-width: 520px) {
  .app-topbar-shell { min-height: 58px; padding: 0 14px; }
  .app-topbar-brand { gap: 7px; font-size: 18px; }
  .app-topbar-logo { width: 29px; height: 29px; }
  .app-topbar-login { min-width: 68px; padding: 0 12px; font-size: 13px; }
  .app-topbar-user { gap: 7px; }
  .app-topbar-account { min-height: 34px; padding: 0; }
  .app-topbar-user-meta { display: none; }
  .app-topbar-account-toggle { width: 28px; height: 28px; border-left: 0; border-radius: 50%; }
}

@media (prefers-reduced-transparency: reduce) {
  .app-topbar.is-scrolled {
    background: #fff;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .app-topbar.is-scrolled { background: #fff; }
}
