.nav .nav-links > a[aria-current],
.nav .nav-drop > button[aria-current],
.nav .brand[aria-current] .brand-sub {
  color: var(--gold-ink);
  box-shadow: inset 0 -2px var(--gold);
}
#drawer > a.d-link[aria-current] {
  color: var(--gold-ink);
  background: var(--gold-soft);
  box-shadow: inset 3px 0 var(--gold);
  padding-inline-start: 12px;
}
/* Homepage hero: the CTA row is removed, so the lead sits directly above the trust points. */
.hero-lead { margin-bottom: 0; }
/* Keep the two clauses of each trust point on their own line on wide screens. */
@media (max-width: 780px) { .hero-trust br { display: none; } }
/* Step badges hold "第 1 幕" on one line instead of wrapping the last character. */
.fde-num { width: auto; min-width: 32px; padding: 0 10px; align-self: flex-start; white-space: nowrap; flex-shrink: 0; }
.gw-bar .gw-hint { margin-left: 10px; font-size: 12.5px; font-weight: 500; color: var(--sub); }
.gateway-pending { width: min(1120px, 92%); margin: 4rem auto; }
#models .model-grid { grid-template-columns: minmax(0,1.06fr) minmax(0,.94fr); }
#models .model-grid > *, #models .m-id, #models .dir-pills { min-width: 0; }
#models .m-id { overflow-wrap: anywhere; }
#models .dir-pills { max-width: 100%; flex-wrap: wrap; }
@media (max-width: 960px) {
  #models .model-grid { grid-template-columns: minmax(0,1fr); }
}
#model-api { color: var(--sub); margin-top: 16px; scroll-margin-top: 80px; }
#model-api summary { color: var(--gold-ink); cursor: pointer; width: fit-content; font-weight: 600; }
#model-api p, #model-api pre { margin-block: 12px; }
#model-api pre { padding: 12px; border-radius: 8px; background: var(--bg-alt); overflow-x: auto; }
#model-api a { color: var(--gold-ink); text-decoration: underline; }
@media (prefers-reduced-motion: reduce) {
  html:focus-within, html { scroll-behavior: auto; }
}
html:has(.nav) { scrollbar-gutter: auto; }
html:has(.nav)::-webkit-scrollbar { width: 10px; }
html:has(> .gateway-host) { overflow-x: clip; overflow-y: auto; }
body.gateway-host { height: auto; min-height: 100dvh; overflow: visible; }

html[data-storefront=home] #site-marketplace,
html[data-storefront=marketplace] #site-home { display: none; }
#site-marketplace { min-height: calc(100dvh - 68px); }
#gateway-state, #gateway-error { margin: 2rem auto; width: min(1120px, 92%); }
#site-navigation [hidden], #site-marketplace [hidden] { display: none !important; }

#cs {
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--cs-keyboard, 0px));
}
#cs #cs-box.on {
  padding: 0;
  display: flex; flex-direction: column; bottom: calc(100% + 8px);
  width: min(350px, calc(100vw - 32px));
  max-height: calc(var(--cs-height, 100dvh) - 88px - env(safe-area-inset-bottom));
}
#cs #cs-box[data-view="chat"] {
  width: min(410px, calc(100vw - 32px));
  height: min(660px, calc(var(--cs-height, 100dvh) - 88px - env(safe-area-inset-bottom)));
}
#cs-box .support-head { position: static; display: flex; flex: none; align-items: center; gap: 8px; padding: 6px 10px 6px 16px; min-height: 48px; }
#cs-box .support-head strong { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#cs-box .support-head button { flex: none; min-height: 38px; min-width: 38px; border: 0; border-radius: 8px; background: transparent; color: white; font: inherit; cursor: pointer; }
#cs-box .support-head button:hover, #cs-box .support-head button:focus-visible { background: #294463; }
#cs-box #support-close { margin-left: auto; font-size: 24px; line-height: 1; }
#cs-box .cs-bd, #support-qr { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
#support-profile-status { color: var(--sub); font-size: 13px; }
#cs-box #support-online { color: var(--teal); }
#support-chat { min-height: 0; flex: 1; position: relative; }
#support-widget { display: block; width: 100%; height: 100%; border: 0; }
#support-feedback { padding: 16px; }
#support-feedback p { margin: 0 0 8px; }
#support-qr { padding: 14px; text-align: center; }
#support-qr img { display: block; width: min(100%, 260px); height: auto; margin: 0 auto 8px; background: white; }
#contact-qr-slot { padding: 4px; }
#contact-qr-slot button { width: 100%; height: 100%; padding: 0; border: 0; background: white; cursor: zoom-in; }
#contact-qr-slot img { display: block; object-fit: contain; }
@media (max-width: 520px), (max-height: 500px) {
  #cs #cs-box[data-view="chat"] {
    position: fixed; z-index: 1; left: max(6px, env(safe-area-inset-left)); right: max(6px, env(safe-area-inset-right));
    top: calc(var(--cs-top, 0px) + env(safe-area-inset-top) + 6px); bottom: auto; width: auto;
    height: calc(var(--cs-height, 100dvh) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 12px);
    max-height: none;
  }
}
