:root {
  color-scheme: light;
  --brand: #1f5fd4;
  --brand-deep: #1749a4;
  --brand-soft: #eaf1ff;
  --accent: #ffd042;
  --ink: #172033;
  --muted: #667085;
  --line: #dfe5ef;
  --surface: #f7f9fc;
  --panel: #fcfdff;
  --success: #147d64;
  --warning: #fff4cf;
  --warning-ink: #5f4700;
  --shadow: 0 12px 30px rgba(31, 65, 122, 0.14);
}

@supports (color: oklch(0.5 0.1 20)) {
  :root {
    --brand: oklch(0.52 0.19 259);
    --brand-deep: oklch(0.42 0.16 259);
    --brand-soft: oklch(0.96 0.025 259);
    --accent: oklch(0.86 0.15 91);
    --ink: oklch(0.25 0.035 259);
    --muted: oklch(0.53 0.025 259);
    --line: oklch(0.9 0.018 259);
    --surface: oklch(0.98 0.008 259);
    --panel: oklch(0.995 0.005 259);
    --success: oklch(0.53 0.11 171);
    --warning: oklch(0.96 0.08 91);
    --warning-ink: oklch(0.38 0.075 82);
  }
}

* {
  box-sizing: border-box;
}

html {
  background: var(--surface);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--surface);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

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

button {
  font: inherit;
}

.brand-band {
  color: #f9fbff;
  background: var(--brand);
  padding: max(28px, env(safe-area-inset-top)) 22px 32px;
}

.brand-band__inner {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 14px 16px;
  width: min(100%, 680px);
  margin: 0 auto;
}

.app-icon {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.65);
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(9, 35, 94, 0.26);
}

.brand-copy {
  min-width: 0;
  align-self: center;
}

.eyebrow,
.subtitle,
.section-label,
.market-section__heading p,
footer p,
.security-note {
  margin: 0;
}

.eyebrow {
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

h1 {
  margin: 2px 0 3px;
  font-size: clamp(26px, 7vw, 38px);
  line-height: 1.18;
  font-weight: 800;
  letter-spacing: 0;
}

.subtitle {
  color: rgba(249, 251, 255, 0.78);
  font-size: 14px;
}

.device-status {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  justify-self: start;
  min-height: 34px;
  padding: 6px 11px;
  color: rgba(249, 251, 255, 0.9);
  background: rgba(13, 47, 118, 0.36);
  border: 1px solid rgba(255, 255, 255, 0.17);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.device-status__dot {
  width: 8px;
  height: 8px;
  margin-right: 8px;
  background: var(--accent);
  border-radius: 50%;
}

.device-status--matched .device-status__dot {
  background: #54deb6;
}

main {
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 22px 18px 16px;
}

.wechat-notice {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  margin-bottom: 22px;
  padding: 15px;
  color: var(--warning-ink);
  background: var(--warning);
  border: 1px solid rgba(171, 125, 0, 0.2);
  border-radius: 8px;
}

.wechat-notice[hidden],
.recommendation[hidden],
.web-fallback[hidden],
.toast[hidden] {
  display: none;
}

.wechat-notice__number {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: var(--warning-ink);
  background: rgba(255, 255, 255, 0.48);
  border-radius: 50%;
  font-weight: 800;
}

.wechat-notice h2 {
  margin: 0 0 2px;
  font-size: 16px;
  line-height: 1.4;
}

.wechat-notice p {
  margin: 0;
  font-size: 13px;
}

.recommendation {
  margin-bottom: 30px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.section-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.section-heading h2,
.market-section h2 {
  margin: 2px 0 0;
  font-size: 20px;
  line-height: 1.3;
}

.section-heading h2 {
  white-space: nowrap;
}

.match-badge {
  flex: 0 0 auto;
  padding: 5px 8px;
  color: var(--success);
  background: #e8f7f1;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.primary-action {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 54px;
  padding: 12px 16px 12px 18px;
  color: #f9fbff;
  background: var(--brand);
  border: 0;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(31, 95, 212, 0.25);
  cursor: pointer;
  font-weight: 750;
  text-align: left;
  transition: background-color 180ms ease-out, transform 180ms ease-out;
}

.primary-action:hover {
  background: var(--brand-deep);
}

.primary-action:active {
  transform: translateY(1px);
}

.action-arrow,
.market-arrow {
  font-family: Arial, sans-serif;
  line-height: 1;
}

.action-arrow {
  font-size: 28px;
}

.web-fallback {
  display: block;
  margin-top: 12px;
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 650;
  text-align: center;
  text-decoration: none;
}

.web-fallback:hover {
  text-decoration: underline;
}

.market-section__heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}

.market-section__heading p {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.market-list {
  display: grid;
  gap: 9px;
}

.market-button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease-out, background-color 160ms ease-out, transform 160ms ease-out;
}

.market-button:hover {
  background: var(--brand-soft);
  border-color: rgba(31, 95, 212, 0.36);
}

.market-button:active {
  transform: translateY(1px);
}

.market-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #fbfcff;
  background: var(--market-color);
  border-radius: 8px;
  font-size: 16px;
  font-weight: 800;
}

.market-name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

.market-arrow {
  color: var(--muted);
  font-size: 24px;
  text-align: right;
}

.security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 22px 0 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.security-note span {
  color: var(--success);
  font-weight: 800;
}

.toast {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  color: #f9fbff;
  background: rgba(23, 32, 51, 0.92);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.22);
  font-size: 13px;
  text-align: center;
  transform: translateX(-50%);
}

footer {
  padding: 10px 18px calc(22px + env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

@media (min-width: 720px) {
  .brand-band {
    padding-top: 44px;
    padding-bottom: 40px;
  }

  .brand-band__inner {
    grid-template-columns: 92px minmax(0, 1fr) auto;
    align-items: center;
  }

  .app-icon {
    width: 92px;
    height: 92px;
    border-radius: 20px;
  }

  .device-status {
    grid-column: auto;
    justify-self: end;
  }

  main {
    padding-top: 30px;
  }
}

@media (max-width: 360px) {
  .brand-band {
    padding-inline: 16px;
  }

  .brand-band__inner {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .app-icon {
    width: 64px;
    height: 64px;
    border-radius: 15px;
  }

  h1 {
    font-size: 24px;
  }

  .subtitle {
    font-size: 12px;
  }

  .market-section__heading {
    display: block;
  }

  .market-section__heading p {
    margin-top: 3px;
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
  }
}
