@import url("/css/tokens.css");

/* Runtime shell; layouts belong to css/pages/*. */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--color-ink);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.nav-open,
html.modal-open,
body.modal-open {
  overflow: hidden;
}

a,
button {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

img,
svg,
video {
  max-width: 100%;
}

img {
  display: block;
}

section {
  scroll-margin-top: 92px;
}

.container {
  width: min(var(--content-max), calc(100% - var(--content-gutter)));
  margin-inline: auto;
}

.skip-link { min-width: 44px; min-height: 44px; position: fixed; top: -80px; left: 18px; z-index: 1000; display: inline-flex; align-items: center; padding: 10px 15px; border-radius: var(--radius-control); background: var(--color-white); color: var(--color-black); text-decoration: none; transition: top var(--motion-fast) var(--ease-standard); }
.skip-link:focus { top: 18px; }

/* Header and navigation */
.header {
  height: 76px;
  position: sticky;
  top: 0;
  z-index: 300;
  border-bottom: 1px solid var(--line-dark);
  background: rgba(13, 13, 16, .96);
  color: var(--color-white);
  box-shadow: none;
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  transition: background var(--motion-base) var(--ease-standard), border-color var(--motion-base) var(--ease-standard), box-shadow var(--motion-base) var(--ease-standard);
}

.header.scrolled {
  border-bottom-color: var(--line-dark-strong);
  background: rgba(13, 13, 16, .985);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .18);
}

body.error-v2 .header {
  border-bottom-color: var(--line-dark);
  background: rgba(7, 7, 8, .9);
}

.header-inner {
  height: 76px;
  display: flex;
  align-items: center;
  gap: 38px;
}

.brand {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  color: var(--color-white);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -.04em;
  text-decoration: none;
}

.brand-icon {
  display: flex;
}

.brand-icon img {
  display: block;
  border-radius: 8px;
}

.brand-mark-v2 {
  width: 31px;
  height: 31px;
  position: relative;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 9px;
  background: var(--color-white);
}

.brand-mark-v2::before,
.brand-mark-v2::after {
  content: "";
  position: absolute;
  border: 2px solid #09090a;
  border-radius: 50%;
}

.brand-mark-v2::before {
  width: 13px;
  height: 13px;
  top: 6px;
  left: 6px;
}

.brand-mark-v2::after {
  width: 10px;
  height: 10px;
  right: 5px;
  bottom: 5px;
  background: var(--color-white);
}

.brand-name-v2 sup {
  margin-left: 3px;
  color: #a3a3aa;
  font-family: var(--font-mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: .08em;
  vertical-align: super;
}

.nav {
  display: flex;
  gap: 4px;
}

.nav a {
  padding: 9px 11px;
  border-radius: 9px;
  background: transparent;
  color: #a7a7ae;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--motion-fast) ease, background var(--motion-fast) ease;
}

.nav a:hover,
.nav a[aria-current="page"] {
  background: rgba(255, 255, 255, .07);
  color: var(--color-white);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.nav-close,
.nav-toggle {
  display: none;
}

.nav-toggle {
  width: 44px;
  height: 44px;
  margin-left: auto;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius-control);
  background: rgba(255, 255, 255, .04);
}

.nav-toggle span {
  width: 18px;
  height: 2px;
  display: block;
  border-radius: 2px;
  background: var(--color-white);
}

.nav-mask {
  position: fixed;
  inset: 0;
  z-index: 330;
  display: none;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  touch-action: none;
  background: rgba(4, 4, 7, .66);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: opacity var(--motion-fast) ease;
}

.nav-mask.show {
  display: block;
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

/* Controls */
.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--motion-base) var(--ease-standard), background var(--motion-base) ease, border-color var(--motion-base) ease, box-shadow var(--motion-base) ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0) scale(.985);
}

.btn:focus-visible,
.nav a:focus-visible,
.nav-toggle:focus-visible,
.nav-close:focus-visible,
.float-btn:focus-visible,
.modal-close:focus-visible {
  outline: 2px solid var(--color-violet-soft);
  outline-offset: 3px;
}

.btn-primary {
  border-color: var(--color-white);
  background: var(--color-white);
  color: #09090a;
  box-shadow: 0 10px 32px rgba(255, 255, 255, .09);
}

.btn-primary:hover {
  border-color: #efefec;
  background: #efefec;
  box-shadow: 0 14px 38px rgba(255, 255, 255, .13);
}

.btn-outline,
.btn-outline-light {
  border-color: var(--line-dark-strong);
  background: rgba(255, 255, 255, .055);
  color: var(--color-white);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn-outline:hover,
.btn-outline-light:hover {
  border-color: rgba(255, 255, 255, .3);
  background: rgba(255, 255, 255, .1);
}

.btn-lg {
  min-height: 48px;
  padding-inline: 26px;
}

.btn-full {
  width: 100%;
}

/* Footer */
.footer {
  padding: 30px 0;
  border-top: 1px solid var(--line-dark);
  background: var(--color-black);
  color: #6e6e77;
}

.footer-inner {
  max-width: 820px;
  margin-inline: auto;
  text-align: center;
}

.footer-info {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
  color: #a8a8b0;
  font-size: 14px;
}

.footer-info [data-footer-contact],
.footer-info [data-copy-domain] {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-inline: 14px;
  border: 1px solid var(--line-dark);
  border-radius: 999px;
  background: rgba(255, 255, 255, .03);
  cursor: pointer;
  transition: color var(--motion-fast) ease, border-color var(--motion-fast) ease, background var(--motion-fast) ease;
}

.footer-info [data-footer-contact]:hover,
.footer-info [data-copy-domain]:hover {
  border-color: rgba(185, 176, 255, .36);
  background: rgba(139, 125, 255, .08);
  color: var(--color-white);
}

.footer-copy {
  color: #777780;
  font-size: 13px;
  line-height: 1.65;
}

.footer-action-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 1200;
  padding: 9px 14px;
  border: 1px solid var(--line-dark);
  border-radius: 10px;
  background: rgba(20, 20, 25, .96);
  color: var(--color-white);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .3);
  font-size: 13px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 8px);
  transition: opacity var(--motion-fast) ease, transform var(--motion-fast) ease;
}

.footer-action-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Floating actions */
.floating-btns {
  position: fixed;
  right: 20px;
  bottom: 100px;
  z-index: 260;
  display: flex;
  flex-direction: column;
  gap: 9px;
  pointer-events: none;
}

.float-btn,
.float-btn--green,
.float-btn--yellow,
.float-btn--blue {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
  background: rgba(20, 20, 25, .92);
  color: var(--color-white);
  box-shadow: 0 14px 34px rgba(0, 0, 0, .2);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  pointer-events: auto;
  transition: transform var(--motion-base) var(--ease-standard), border-color var(--motion-fast) ease, background var(--motion-fast) ease;
}

.float-btn:hover {
  border-color: rgba(185, 176, 255, .48);
  background: #24222d;
  transform: translateY(-2px);
}

.float-btn:active {
  transform: scale(.96);
}

/* Modal system */
#modalContainer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  pointer-events: none;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: auto;
  transition: opacity var(--motion-base) var(--ease-standard);
}

.modal.visible {
  opacity: 1;
}

.modal.closing {
  opacity: 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(3, 3, 6, .72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-content {
  width: min(480px, 100%);
  max-height: calc(100dvh - 40px);
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  margin-top: 60px;
  overflow: hidden;
  border: 1px solid rgba(17, 17, 19, .12);
  border-radius: var(--radius-panel);
  background: var(--color-white);
  color: var(--color-ink);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .35);
  opacity: 0;
  transform: translateY(20px) scale(.97);
  transition: transform 320ms var(--ease-standard), opacity var(--motion-base) ease;
}

.modal.visible .modal-content {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.modal.closing .modal-content {
  opacity: 0;
  transform: translateY(10px) scale(.98);
}

.modal-header {
  min-height: 86px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 26px;
  border-bottom: 1px solid var(--line-light);
}

.modal-subtitle {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  margin-bottom: 8px;
  padding-inline: 10px;
  border: 1px solid rgba(139, 125, 255, .2);
  border-radius: 999px;
  background: rgba(139, 125, 255, .08);
  color: #6254df;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
}

.modal-subtitle:empty,
.modal-description:empty {
  display: none;
}

.modal-title {
  color: var(--color-ink);
  font-size: 24px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -.03em;
}

.modal-description {
  margin-top: 6px;
  color: var(--color-ink-secondary);
  font-size: 14px;
}

.modal-close {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-light);
  border-radius: var(--radius-control);
  background: var(--color-paper);
  color: var(--color-ink);
  font-size: 20px;
  transition: transform var(--motion-base) var(--ease-standard), background var(--motion-fast) ease, border-color var(--motion-fast) ease;
}

.modal-close:hover {
  border-color: var(--line-light-strong);
  background: var(--color-paper-raised);
  transform: rotate(90deg);
}

.modal-body {
  padding: 26px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.modal-doc-content p {
  margin-bottom: 14px;
  color: var(--color-ink);
  font-size: 14px;
  line-height: 1.65;
}

.modal-doc-content a {
  color: #6254df;
}

body .modal .btn-primary {
  border-color: var(--color-black);
  background: var(--color-black);
  color: var(--color-white);
  box-shadow: none;
}

body .modal .btn-primary:hover {
  border-color: var(--color-black-raised);
  background: var(--color-black-raised);
}

body .modal .btn-outline {
  border-color: var(--line-light-strong);
  background: var(--color-white);
  color: var(--color-ink);
  backdrop-filter: none;
}

body .modal .btn-outline:hover {
  border-color: rgba(139, 125, 255, .42);
  background: var(--color-paper);
}

.modal-note {
  color: var(--color-ink-secondary) !important;
  font-size: 13px !important;
}

.modal-note--spaced {
  margin-top: 18px;
}

.modal-qr-wrap {
  margin-bottom: 12px !important;
  text-align: center;
}

.modal-qr-image {
  width: 220px;
  height: auto;
  margin-inline: auto;
  border: 1px solid var(--line-light);
  border-radius: var(--radius-control);
}

.modal-inline-link {
  color: #6254df !important;
}

/* Contact and download hub modal variants */
.contact-panel {
  display: grid;
  gap: 10px;
}

.contact-item,
.demo-hub-card {
  border: 1px solid var(--line-light);
  border-radius: var(--radius-card);
  background: var(--color-white);
}

.contact-item {
  padding: 14px;
}

.contact-item h4 {
  margin-bottom: 10px;
  color: var(--color-ink);
  font-size: 16px;
  font-weight: 650;
}

.contact-row {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line-light);
  border-radius: var(--radius-control);
  background: var(--color-paper);
}

.contact-link {
  text-decoration: none;
}

.contact-link:hover,
.contact-link:focus-visible {
  border-color: rgba(139, 125, 255, .45);
  background: var(--color-white);
  box-shadow: 0 0 0 3px rgba(139, 125, 255, .1);
}

.contact-main {
  color: #5144c8;
  font-size: 18px;
  font-weight: 650;
  line-height: 1.25;
}

.contact-side {
  color: var(--color-ink-secondary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.contact-copy-btn {
  min-height: 40px;
  color: var(--color-ink);
  border-color: var(--line-light-strong);
  background: var(--color-white);
}

.contact-panel-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 2px;
}

.modal.modal-demo-hub .modal-content {
  width: min(760px, 100%);
}

.demo-hub-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.demo-hub-card {
  min-height: 168px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px 14px;
  color: var(--color-ink);
  text-align: center;
  text-decoration: none;
  transition: transform var(--motion-base) var(--ease-standard), border-color var(--motion-fast) ease, box-shadow var(--motion-base) ease;
}

.demo-hub-card:hover {
  border-color: var(--line-light-strong);
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}

.demo-hub-icon {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  border-radius: 16px;
}

.demo-logo {
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.demo-logo--demo { border: 1px solid rgba(139, 125, 255, .22); background: rgba(139, 125, 255, .1); color: #5144c8; font-size: 14px; }
.demo-logo--apple { background: #111113; color: white; }
.demo-logo--huawei { color: #d92d48; font-size: 27px; }
.demo-logo--qq { color: #287ac7; }
.demo-logo--mi { background: #ff7f4a; color: white; font-size: 18px; }
.demo-logo--vivo { background: #4b61f2; color: white; font-size: 15px; }
.demo-logo--honor { background: #40a9c2; color: white; font-size: 14px; }

.demo-hub-card h4 {
  margin-bottom: 4px;
  font-size: 16px;
  font-weight: 650;
}

.demo-hub-card p {
  margin: 0;
  color: var(--color-ink-secondary);
  font-size: 13px;
}

/* Runtime overlay safety */
html.modal-open .header,
body.modal-open .header,
body.modal-open .nav-toggle,
body.modal-open .nav,
body.modal-open .nav-actions {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

body.modal-open .floating-btns {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

body.modal-open .nav-mask {
  display: none;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

@media (max-width: 900px) {
  .nav,
  .nav-actions {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  body.nav-open .header {
    z-index: 350;
  }

  .nav.open {
    width: min(320px, 86vw);
    height: 100dvh;
    position: fixed;
    inset: 0 0 0 auto;
    z-index: 340;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 84px 18px 24px;
    overflow-y: auto;
    border-left: 1px solid var(--line-dark);
    background: rgba(13, 13, 16, .985);
    color: var(--color-white);
    box-shadow: -30px 0 80px rgba(0, 0, 0, .38);
  }

  .nav.open a {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 10px;
    color: #b8b8c0;
    font-size: 15px;
  }

  .nav-close {
    width: 42px;
    height: 42px;
    position: absolute;
    top: 17px;
    right: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line-dark);
    border-radius: 11px;
    background: rgba(255, 255, 255, .055);
  }

  .nav-close span {
    width: 18px;
    height: 2px;
    position: absolute;
    border-radius: 1px;
    background: var(--color-white);
  }

  .nav-close span:first-child { transform: rotate(45deg); }
  .nav-close span:last-child { transform: rotate(-45deg); }
}

@media (max-width: 680px) {
  .container {
    width: min(var(--content-max), calc(100% - var(--content-gutter-mobile)));
  }

  .floating-btns {
    right: 14px;
    bottom: 24px;
  }

  .modal {
    align-items: flex-start;
    padding: 10px;
  }

  .modal-content,
  .modal.modal-demo-hub .modal-content,
  .modal.modal-contact-panel .modal-content {
    width: 100%;
    max-height: calc(100dvh - 20px);
    margin-top: 0;
    border-radius: 18px;
  }

  .modal-header,
  .modal.modal-demo-hub .modal-header,
  .modal.modal-contact-panel .modal-header {
    min-height: 68px;
    padding: 16px;
  }

  .modal-title {
    font-size: 21px;
  }

  .modal-body,
  .modal.modal-demo-hub .modal-body,
  .modal.modal-contact-panel .modal-body {
    padding: 16px;
  }

  .modal-close {
    width: 44px;
    height: 44px;
  }

  .demo-hub-grid {
    gap: 8px;
  }

  .demo-hub-card {
    min-height: 142px;
    padding: 12px 8px;
    border-radius: 12px;
  }

  .demo-hub-icon {
    width: 48px;
    height: 48px;
  }

  .contact-item {
    padding: 12px;
    border-radius: 12px;
  }

  .contact-row {
    padding: 11px 12px;
  }

  .contact-main {
    font-size: 16px;
  }

  .error-actions .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
