:root {
  --ink: #0b1f3a;
  --navy: #123a6f;
  --mist: #edf2f8;
  --paper: #ffffff;
  --text: #13233d;
  --muted: #617289;
  --line: #d7e0ec;
  --primary: #123a6f;
  --primary-hover: #0d2d57;
  --ok-bg: #eaf7f0;
  --ok: #0f766e;
  --bad-bg: #fef2f2;
  --bad: #b91c1c;
  --radius-sm: 10px;
  --font: "Nunito", "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --display: "Noto Serif SC", "Songti SC", "STSong", serif;
  --shadow: 0 20px 48px rgba(11, 31, 58, 0.12);
  --flow-base: #e6edf6;
  --flow-warm: #bfd0e6;
  --flow-cool: #9bb3d0;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  overflow-x: hidden;
}
html { isolation: isolate; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--flow-base);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-tap-highlight-color: transparent;
}

.flow-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 8% 18%, var(--flow-warm), transparent 65%),
    radial-gradient(ellipse at 96% 70%, var(--flow-cool), transparent 65%),
    var(--flow-base);
}
.flow-bg canvas {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity .7s ease-out;
}
.flow-bg[data-ready="true"] canvas { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .flow-bg canvas { display: none; }
}

a { color: var(--navy); }
button, .btn {
  font: inherit;
  border: 0;
  cursor: pointer;
  border-radius: 12px;
  padding: 16px 20px;
  background: var(--primary);
  color: #fff;
  font-weight: 650;
  font-size: 1.12rem;
}
.work-card > button.block {
  width: 100%;
  padding: 18px 20px;
  font-size: 1.2rem;
}
button:hover, .btn:hover { background: var(--primary-hover); }
button.secondary, .btn.secondary {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}
button:disabled { opacity: .55; cursor: not-allowed; }
button.block { width: 100%; }

/* —— Home stage: one composition —— */
.stage {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.nav {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px clamp(24px, 3.5vw, 48px);
}
.nav-brand {
  border: 0;
  background: transparent !important;
  padding: 0;
  cursor: pointer;
  font-family: var(--display);
  font-size: clamp(1.55rem, 2.2vw, 1.85rem);
  font-weight: 700;
  color: var(--ink) !important;
  flex: 0 0 auto;
  white-space: nowrap;
  position: relative;
  z-index: 6;
}
.nav-brand:hover {
  background: transparent !important;
  opacity: 0.82;
}
.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 4px 2px;
  flex: 1 1 auto;
  max-width: none;
}
.nav-link {
  background: transparent;
  color: var(--muted);
  border: 0;
  padding: 12px 14px;
  font-family: var(--font);
  font-weight: 600;
  font-size: clamp(1.05rem, 1.35vw, 1.2rem);
  letter-spacing: 0.04em;
  border-radius: 10px;
  white-space: nowrap;
}
.nav-link:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
}

.split {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 112px clamp(24px, 3.5vw, 40px) 28px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(36px, 4.5vw, 64px);
  align-items: center;
  min-height: calc(100vh - 160px);
}

.guide {
  width: min(1360px, calc(100% - 36px));
  margin: 0 auto 24px;
  padding: 18px 4px 4px;
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px 32px;
  border-top: 1px solid var(--line);
}
.guide-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  flex: 1 1 0;
}
.guide-n {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid var(--navy);
  color: var(--navy);
  display: grid;
  place-items: center;
  font-size: .9rem;
  font-weight: 700;
  margin-top: 2px;
}
.guide-n.on {
  background: var(--navy);
  color: #fff;
}
.guide-item h3 {
  margin: 0 0 6px;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.guide-item p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
}
.guide-item a {
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.brand-pane {
  width: max-content;
  max-width: min(40rem, 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0;
  justify-self: start;
}
.display {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(3.5rem, 6vw, 4.8rem);
  line-height: 1.38;
  letter-spacing: 0.01em;
  color: var(--ink);
}
.lede {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 1.32rem;
  line-height: 1.7;
  max-width: none;
}

.work-pane {
  width: 100%;
  max-width: 780px;
  margin-left: auto;
  display: flex;
  align-items: center;
}
.work-card {
  width: 100%;
  background: var(--paper);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 34px 34px 36px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: rise .4s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .work-card { animation: none; }
}

.steps {
  list-style: none;
  margin: 0;
  padding: 0 0 18px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  border-bottom: 1px solid var(--line);
}
.step {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin: 0;
  color: var(--muted);
  font-size: 1.08rem;
  font-weight: 650;
  padding-bottom: 16px;
  border-bottom: 2px solid transparent;
  margin-bottom: -19px;
}
.step .n {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  font-size: .9rem;
}
.step.on {
  color: var(--navy);
  border-bottom-color: var(--navy);
}
.step.on .n {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.member-card {
  border-radius: 18px;
  padding: 30px 28px 28px;
  min-height: 132px;
  width: 100%;
  color: #eef4ff;
  background: linear-gradient(145deg, #17457d 0%, #0b2748 100%);
  opacity: .72;
  transition: opacity .25s ease, transform .28s ease, box-shadow .28s ease;
}
.member-card.is-on {
  opacity: 1;
  box-shadow: 0 14px 32px rgba(11, 31, 58, 0.22);
}
.member-card.is-pop {
  animation: mc-pop .45s cubic-bezier(.2, .9, .25, 1.15) both;
}
@keyframes mc-pop {
  from { opacity: .5; transform: translateY(10px) scale(.97); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .member-card.is-pop { animation: none; }
}
.member-card .mc-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 1.05rem;
  opacity: .9;
  margin-bottom: 14px;
}
.member-card .mc-title {
  margin: 0;
  font-family: var(--display);
  font-size: 2.2rem;
  font-weight: 700;
}
.member-card .mc-meta {
  margin: 12px 0 0;
  font-size: 1rem;
  opacity: .85;
  letter-spacing: 0.02em;
}

.field { margin: 0; width: 100%; }
.field .hint { display: none; }
label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 1.08rem;
  font-weight: 650;
}
input, textarea, select {
  width: 100%;
  font: inherit;
  padding: 17px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 1.12rem;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(18, 58, 111, 0.2);
  border-color: #9bb4d6;
}
textarea {
  min-height: 132px;
  resize: vertical;
  font-family: ui-monospace, Consolas, monospace;
  font-size: .84rem;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.actions { margin-top: 2px; }
.row.actions button { flex: 1; }
.tip { display: none; }

.summary {
  margin: 0;
  display: grid;
  gap: 10px;
}
.summary > div {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 8px;
  align-items: baseline;
}
.summary dt {
  margin: 0;
  color: var(--muted);
  font-size: .84rem;
}
.summary dd {
  margin: 0;
  font-weight: 600;
  word-break: break-all;
}

/* —— Inner pages —— */
.wrap {
  width: min(880px, 100%);
  margin: 0 auto;
  padding: 18px 16px 40px;
}
.wrap .nav {
  position: static;
  padding: 8px 0 16px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}
.page-hero { margin: 4px 0 14px; }
.page-hero h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.6rem, 3vw, 2rem);
  color: var(--ink);
  font-weight: 700;
}
.page-hero p { margin: 8px 0 0; color: var(--muted); }
.shell-back {
  margin: 16px 0 8px;
  display: flex;
  justify-content: flex-start;
}
.panel {
  background: var(--paper);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.panel h2 { margin: 0 0 6px; font-size: 1.12rem; color: var(--ink); }
.muted { color: var(--muted); font-size: .92rem; line-height: 1.55; }

.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td {
  text-align: left;
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table th { color: var(--muted); font-weight: 600; }

.footer {
  margin-top: 28px;
  text-align: center;
  color: var(--muted);
  font-size: .82rem;
}
.footer-stage { display: none; }

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: min(360px, calc(100% - 32px));
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: .2s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: none; }
.toast.err { background: #7f1d1d; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .78rem;
  background: var(--ok-bg);
  color: var(--ok);
  font-weight: 650;
}
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.pre {
  white-space: pre-wrap;
  word-break: break-all;
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px;
  border-radius: 10px;
  font-size: .82rem;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72) !important;
  color: var(--ink) !important;
  box-shadow: 0 4px 14px rgba(11, 31, 58, 0.08);
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  z-index: 7;
}
.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: .2s ease;
}
.nav-toggle.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

body.nav-open { overflow: hidden; }

@media (max-width: 980px) {
  .nav {
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    padding: 14px 16px 10px;
  }
  .nav-brand { display: none !important; }
  .nav-link[data-go="/admin"] { display: none !important; }
  .nav-toggle { display: none !important; }
  .nav-links {
    display: flex !important;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    align-items: center;
    gap: 6px;
    max-width: none;
    padding: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    max-height: none;
    overflow: visible;
  }
  .nav-link {
    width: auto;
    flex: 0 0 auto;
    text-align: center;
    padding: 9px 12px;
    font-size: .92rem;
    letter-spacing: 0.02em;
    background: rgba(255, 255, 255, 0.72) !important;
    color: var(--text) !important;
    border: 1px solid rgba(215, 224, 236, 0.9);
    border-radius: 999px;
  }
  .nav-link:hover {
    background: #fff !important;
    color: var(--ink) !important;
  }
  .stage > .split { order: 1; }
  .stage > .nav { order: 2; }
  .stage > .guide { order: 3; }
  .split {
    padding-top: 12px;
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 14px;
  }
  .work-pane {
    max-width: none;
    margin-left: 0;
  }
  .brand-pane { display: none; }
  .stage .nav {
    position: relative;
    inset: auto;
    padding-top: 8px;
    margin-top: 4px;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 860px) {
  .split {
    grid-template-columns: 1fr;
    padding: 8px 16px 16px;
    gap: 12px;
    align-items: start;
  }
  .brand-pane { display: none; }
  .work-pane { max-width: none; }
  .work-card {
    padding: 20px 16px 22px;
    border-radius: 20px;
    gap: 16px;
  }
  .nav-brand { font-size: 1.35rem; }
  .display,
  .lede { display: none; }
  .member-card {
    padding: 22px 18px 20px;
    min-height: 110px;
  }
  .member-card .mc-title { font-size: 1.7rem; }
  .steps {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2px;
    padding-bottom: 12px;
  }
  .step {
    font-size: .78rem;
    gap: 5px;
    padding-bottom: 12px;
    margin-bottom: -13px;
  }
  .step .n {
    width: 22px;
    height: 22px;
    font-size: .75rem;
  }
  .guide {
    width: calc(100% - 24px);
    margin: 8px auto 20px;
    padding: 16px 0 8px;
    flex-direction: column;
    gap: 14px;
  }
  .guide-item h3 { white-space: normal; }
  .row { gap: 8px; }
  .row.actions button { min-width: 0; flex: 1 1 calc(50% - 8px); }
  .wrap {
    width: 100%;
    padding: 12px 14px 28px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  }
  .wrap .nav { padding: 4px 0 10px; }
  .topbar {
    margin-bottom: 8px;
  }
  .topbar .secondary {
    width: 100%;
    padding: 12px 14px;
  }
  .page-hero h1 { font-size: clamp(1.4rem, 6vw, 1.75rem); }
  .page-hero p {
    font-size: .92rem;
    line-height: 1.5;
  }
  .panel {
    padding: 16px;
    border-radius: 16px;
  }
  input, textarea, select {
    padding: 15px 14px;
    font-size: 16px; /* avoid iOS zoom */
  }
  button, .btn {
    padding: 14px 16px;
    font-size: 1.05rem;
  }
  .table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    font-size: .84rem;
  }
  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    max-width: none;
  }
  .order-meta,
  .redeem-retry-hint { display: none !important; }
}

/* 手机端兜底：隐藏任何「可重试」提示行 */
@media (max-width: 980px) {
  .order-meta,
  .redeem-retry-hint { display: none !important; }
}

@media (max-width: 480px) {
  .split { padding: 6px 12px 12px; }
  .step { font-size: .72rem; }
  .member-card .mc-title { font-size: 1.45rem; }
  .nav-link { padding: 8px 10px; font-size: .86rem; }
  .nav { padding: 12px 12px 8px; }
}

/* 发卡商城 */
.shop-lookup {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.shop-card {
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  border-radius: 14px;
  padding: 16px;
  background: color-mix(in srgb, #fff 72%, transparent);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shop-card.is-out { opacity: .62; }
.shop-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
}
.shop-card-top h3 {
  margin: 0;
  font-size: 1.05rem;
  font-family: "Noto Serif SC", "Noto Sans SC", serif;
}
.shop-price {
  margin: 0;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.shop-price span { font-size: 1.25rem; }
.shop-card-foot {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.shop-buy-row input {
  width: 64px;
  padding: 10px 8px;
}
.shop-order-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.shop-orderno { font-size: 1.05rem; font-weight: 600; margin: 4px 0 0; }
.shop-pay-box {
  margin-top: 14px;
  padding: 16px;
  border-radius: 14px;
  background: linear-gradient(160deg, #f3f7fc, #e8eef7);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.shop-amount {
  margin: 6px 0 0;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--ink);
}
.shop-pay-grid {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.shop-qr {
  border-radius: 10px;
  background: #fff;
  padding: 6px;
  border: 1px solid var(--line);
}
.shop-addr {
  word-break: break-all;
  font-size: .92rem;
  line-height: 1.45;
}
.shop-deliver {
  margin-top: 16px;
  padding: 16px;
  border-radius: 14px;
  background: #edf7f0;
  border: 1px solid #c5e0cf;
}
.shop-deliver h2 { margin: 0 0 8px; font-size: 1.1rem; }
.shop-keys {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .92rem;
  white-space: pre-wrap;
  word-break: break-all;
}
