:root {
  color-scheme: light;
  --ink: #112a4e;
  --blue: #0658d9;
  --border: #cddff6;
  --background: #f2f7ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--background);
  color: var(--ink);
  font: 16px/1.5 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

.shell {
  width: min(100% - 32px, 1040px);
  margin-inline: auto;
}

.hero {
  position: sticky;
  z-index: 3;
  top: 0;
  padding: calc(10px + env(safe-area-inset-top)) 0 10px;
  text-align: center;
  background: linear-gradient(124deg, #fff 8%, #e4f0ff 72%, #cce2ff);
  border-bottom: 1px solid var(--border);
}

.hero-heading {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 8px;
}

.brand {
  display: block;
  width: clamp(112px, 32vw, 148px);
  height: auto;
}

h1, h2, h3 { margin: 0; }

h1 {
  white-space: nowrap;
  font-size: clamp(20px, 5vw, 28px);
  line-height: 1.2;
}

.region-label {
  color: #456080;
  font-size: 0.85em;
  white-space: nowrap;
}

.categories {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(100%, 380px);
  margin-inline: auto;
  gap: 4px;
}

.categories a {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  display: grid;
  place-items: center;
  min-height: 40px;
  padding: 4px 0;
  white-space: nowrap;
  color: var(--blue);
  text-decoration: none;
  font-size: clamp(11px, 3.6vw, 14px);
  font-weight: 700;
}

main > section {
  margin-top: 28px;
  scroll-margin-top: calc(var(--sticky-header-height, 118px) + 12px);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}

h2 { font-size: 21px; }

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

#accelerators .app-grid,
#usdt-wallets .app-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.app-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 3px 12px #234c8410;
}

.app-heading {
  display: flex;
  gap: 10px;
  align-items: center;
}

.app-heading h3 {
  font-size: 16px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.app-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  object-fit: contain;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  background: #e4efff;
  color: #0645a2;
}

img.app-icon { background: transparent; }
.app-icon.gold { background: #fff3c8; color: #614400; }
.app-icon.green { background: #e0f7ee; color: #05563e; }
.app-icon.indigo { background: #e9eaff; color: #3735a5; }

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.card-actions .action { flex: 1 1 88px; }

.action {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 6px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.primary { color: #fff; background: var(--blue); }
.primary:hover { background: #0349b8; }
.secondary { color: #064ba9; background: #eff6ff; border-color: var(--border); }
.secondary:hover, .categories a:hover { background: #e1efff; }

a:focus-visible, button:focus-visible {
  outline: 2px solid #083579;
  outline-offset: 2px;
}

footer {
  margin: 28px 16px 8px;
  color: #526682;
  text-align: center;
  font-size: 13px;
}

.bottom-bar {
  position: fixed;
  z-index: 1;
  inset: auto 0 0;
  padding: 10px env(safe-area-inset-right) calc(10px + env(safe-area-inset-bottom)) env(safe-area-inset-left);
  background: #fff;
  border-top: 1px solid var(--border);
  box-shadow: 0 -5px 22px #234c8412;
}

.bottom-bar .shell {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-width: 440px;
}

.bottom-bar .action { min-height: 44px; }

.tutorial {
  width: min(920px, 100% - 24px);
  max-height: 90vh;
  max-height: 90dvh;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--ink);
  overscroll-behavior: contain;
}

.tutorial::backdrop { background: #0b204ab8; }

.tutorial-bar {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.tutorial-bar h2 { font-size: 16px; }
.tutorial-bar button { flex-shrink: 0; }
.tutorial img { display: block; width: 100%; height: auto; }

@media (max-width: 640px) {
  .app-grid,
  #accelerators .app-grid,
  #usdt-wallets .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .app-card { padding: 10px; gap: 10px; }
  .app-heading { gap: 6px; }
  .app-heading h3 { font-size: 14px; }
  .app-icon { width: 35px; height: 35px; font-size: 12px; }
  .card-actions .action { padding-inline: 4px; }
}

.wallet-download-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #e8f2ff;
}

.wallet-download-note p {
  flex: 1 1 280px;
  margin: 0;
  color: #345478;
  font-size: 14px;
}

#apple-hk-guide { width: min(640px, 100% - 24px); }

.guide-source {
  margin: 0;
  padding: 12px 16px;
  text-align: center;
}

.guide-source a { color: var(--blue); }

.back-to-top {
  position: fixed;
  z-index: 2;
  right: max(16px, env(safe-area-inset-right), calc((100% - 1040px) / 2));
  bottom: calc(76px + env(safe-area-inset-bottom));
  min-height: 44px;
  gap: 5px;
  border-radius: 999px;
  box-shadow: 0 4px 14px #11366a33;
}

.back-to-top[hidden] { display: none; }
