:root {
  --bg: #f5f7fb;
  --card: rgba(255, 255, 255, 0.96);
  --line: #e4e8ef;
  --text: #13243a;
  --muted: #5a6b81;
  --brand: #1d4f91;
  --accent: #0f766e;
  --accent-2: #10b981;
  --accent-soft: #eafaf3;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 14px 34px rgba(16, 29, 51, 0.09);
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  color: var(--text);
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif;
  background:
    radial-gradient(circle at 0% 10%, rgba(31, 96, 187, 0.08), transparent 36%),
    radial-gradient(circle at 100% 0%, rgba(16, 185, 129, 0.08), transparent 28%),
    linear-gradient(165deg, #f9fbff 0%, #f3f6fb 100%);
}

.bg-halo {
  position: fixed;
  width: 280px;
  height: 280px;
  border-radius: 999px;
  filter: blur(40px);
  opacity: 0.15;
  z-index: -1;
}

.halo-a {
  left: -120px;
  top: 28%;
  background: #6ea8f3;
}

.halo-b {
  right: -130px;
  top: -90px;
  background: #7fd7a8;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: 22px auto 30px;
  display: grid;
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #0b56a6;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Noto Serif SC", "Source Han Serif SC", serif;
}

h1 {
  margin-top: 6px;
  font-size: clamp(32px, 3vw, 42px);
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(26px, 2.4vw, 32px);
}

h3 {
  margin-bottom: 10px;
  font-size: 22px;
}

.top-lead {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
}

.wechat-pill {
  color: #0f5132;
  background: #dcfce7;
}

.trust-inline {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trust-inline span {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #31557f;
  background: #eaf0f7;
}

.warning-banner {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #f5d48f;
  background: #fff6df;
  color: #8a5b03;
}

.layout {
  display: grid;
  grid-template-columns: 1fr 1.12fr;
  gap: 14px;
  align-items: stretch;
}

.intro-col,
.checkout-col {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.checkout-col {
  position: relative;
}

.hero-image-wrap {
  margin-bottom: 14px;
}

.hero-image {
  width: 100%;
  min-height: 240px;
  object-fit: cover;
  border-radius: var(--radius-md);
}

.hero-placeholder {
  width: 100%;
  min-height: 240px;
  border-radius: var(--radius-md);
  border: 1px dashed #d4dde9;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  line-height: 1.7;
  padding: 14px;
}

.hero-placeholder code {
  background: #e8f0fb;
  border-radius: 6px;
  padding: 0 6px;
}

.feature-list {
  margin: 0;
  padding-left: 18px;
}

.feature-list li {
  color: var(--muted);
  line-height: 1.9;
}

.checkout-subtitle {
  margin: 0 0 12px;
  color: var(--muted);
}

.checkout-subtitle strong {
  color: var(--brand);
}

.plan-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.plan-option {
  position: relative;
  min-height: 102px;
  padding: 10px;
  border-radius: var(--radius-md);
  border: 1px solid #cfd9e7;
  background: #ffffff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.plan-option:hover {
  transform: translateY(-1px);
  border-color: #95b4db;
}

.plan-name {
  display: block;
  font-size: 20px;
  font-weight: 700;
}

.plan-option strong {
  display: block;
  margin-top: 2px;
  font-size: 23px;
  color: var(--brand);
}

.plan-option small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.plan-stock {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: #0f5132;
  background: #e8f8ef;
}

.plan-option em,
.plan-option i {
  position: absolute;
  top: 8px;
  right: 8px;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 11px;
  font-style: normal;
}

.plan-option em {
  color: #0f5132;
  background: #dcfce7;
}

.plan-option i {
  color: var(--danger);
  background: #feeceb;
}

.plan-option-featured {
  border-color: #86d9b0;
  background: linear-gradient(180deg, #f4fdf8 0%, #ffffff 100%);
}

.plan-option-selected {
  border-color: #4d8ed4;
  box-shadow: 0 8px 16px rgba(50, 98, 161, 0.16);
}

.plan-option-disabled {
  opacity: 0.55;
}

label {
  display: block;
  margin: 8px 0;
  font-weight: 700;
}

input[type="email"] {
  width: 100%;
  border: 1px solid #d2dbe8;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  font-size: 15px;
}

input[type="email"]:focus {
  outline: 2px solid rgba(77, 142, 212, 0.2);
  border-color: #4d8ed4;
}

.btn {
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.16s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

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

.btn:active {
  transform: translateY(0);
  filter: brightness(0.98);
}

.btn-primary {
  width: 100%;
  padding: 12px 16px;
  font-size: 20px;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(130deg, var(--accent) 0%, var(--accent-2) 100%);
  box-shadow: 0 12px 28px rgba(15, 118, 110, 0.25);
}

.btn-secondary {
  width: 100%;
  padding: 12px 16px;
  font-size: 17px;
  text-decoration: none;
  text-align: center;
  color: #18457a;
  background: #eef3fa;
  border-color: #c9d7e9;
  box-shadow: 0 6px 14px rgba(24, 69, 122, 0.09);
}

.action-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-row-single {
  grid-template-columns: 1fr;
}

.buy-hooks {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.buy-hooks span {
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  color: #255482;
  background: #edf3fb;
}

.btn-ghost {
  padding: 10px 14px;
  color: var(--text);
  background: #f8fafc;
  border-color: #d9e1ec;
}

.btn-mini {
  width: auto;
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 10px;
  font-weight: 600;
}

.btn-inline-link {
  width: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-size: 14px;
}

.status {
  min-height: 22px;
  margin: 8px 0 0;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.status.success {
  color: var(--ok);
}

.hidden {
  display: none !important;
}

body.upstream-outage-lock {
  overflow: hidden;
}

.upstream-outage-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(11, 20, 34, 0.55);
  backdrop-filter: blur(12px);
}

.upstream-outage-card {
  width: min(560px, 100%);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 20px 44px rgba(11, 20, 34, 0.26);
  padding: 26px 24px;
  text-align: center;
}

.upstream-outage-card h3 {
  margin: 0;
  font-size: 30px;
  color: #0f172a;
}

.upstream-outage-card p {
  margin: 14px 0 0;
  font-size: 18px;
  line-height: 1.7;
  color: #1f2937;
}

.pay-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed #d7dfeb;
}

.pay-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  align-items: start;
}

.qr-stage {
  display: grid;
  gap: 8px;
}

.qr-box {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid #d7e1ef;
  background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#qrcode-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

.qr-help {
  margin: 0;
  font-size: 13px;
  color: #31557f;
  line-height: 1.55;
}

.pay-meta {
  border: 1px solid #dce5f2;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbfdff 0%, #f6f9fd 100%);
  padding: 12px;
}

.pay-meta p {
  margin: 0;
  line-height: 1.75;
}

.scan-flow-wrap {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px dashed #c8d7eb;
  background: #f8fbff;
}

.scan-flow-title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  color: #20456f;
}

.scan-flow {
  margin: 6px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 3px;
}

.scan-flow li {
  color: #36587f;
  font-size: 13px;
  line-height: 1.45;
}

.manual-order-line code {
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid #d6e2f1;
  background: #f4f8fd;
  color: #173a66;
}

.pay-action-row {
  margin-top: 8px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.pay-action-compact {
  grid-template-columns: auto;
  justify-content: start;
}

.countdown strong {
  font-size: 22px;
  color: #0f5132;
}

.hint {
  margin-top: 8px;
  color: var(--muted);
}

.done-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed #d7dfeb;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: 14px;
  background:
    radial-gradient(circle at 12% -18%, rgba(16, 185, 129, 0.16), transparent 46%),
    radial-gradient(circle at 88% -24%, rgba(29, 79, 145, 0.14), transparent 40%),
    linear-gradient(180deg, #f9fffc 0%, #f4f9ff 100%);
}

.simple-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 20, 33, 0.5);
  backdrop-filter: blur(6px);
  padding: 16px;
}

.simple-modal-card {
  width: min(520px, 100%);
  border-radius: 16px;
  background: #fff;
  border: 1px solid #d7e1ee;
  box-shadow: 0 20px 36px rgba(10, 25, 43, 0.2);
  padding: 18px;
}

.simple-modal-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.manual-modal-order {
  margin-top: 10px;
  color: #243f61;
}

.manual-modal-order code {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 8px;
  border: 1px solid #d8e4f0;
  background: #f7faff;
  color: #14385f;
}

#wechat-order-input {
  width: 100%;
  margin-top: 12px;
  border: 1px solid #d2dbe8;
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  font-size: 16px;
  letter-spacing: 0.02em;
}

#wechat-order-input:focus {
  outline: 2px solid rgba(77, 142, 212, 0.2);
  border-color: #4d8ed4;
}

.manual-confirm-checks {
  margin-top: 10px;
  display: grid;
  gap: 7px;
}

.check-item {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 600;
  color: #264669;
  font-size: 13px;
  line-height: 1.45;
}

.check-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  margin-top: 2px;
  accent-color: #1d4f91;
}

.manual-deterrence {
  margin-top: 8px;
  font-size: 12px;
  color: #4f647d;
  line-height: 1.5;
}

.simple-modal-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.simple-modal-actions .btn {
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 10px;
}

.simple-modal-actions .btn-primary {
  letter-spacing: 0;
  box-shadow: none;
}

.done-panel::before {
  content: "";
  position: absolute;
  inset: -24% -12%;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transform: scale(0.68);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.84) 0%, rgba(255, 255, 255, 0) 58%);
}

.done-panel > :not(.celebration-layer) {
  position: relative;
  z-index: 3;
}

.done-panel.done-panel-celebrate::before {
  animation: celebration-flash 0.9s ease-out;
}

.celebration-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 2;
}

.confetti-piece {
  position: absolute;
  top: -14%;
  width: var(--piece-size, 8px);
  height: calc(var(--piece-size, 8px) * 1.5);
  border-radius: 2px;
  opacity: 0;
  background: var(--piece-color, #10b981);
  transform: translate3d(0, -24px, 0) rotate(0deg);
  animation: confetti-fall var(--fall-duration, 1.8s) var(--fall-delay, 0s) cubic-bezier(0.24, 0.83, 0.31, 0.98) forwards;
}

.confetti-piece:nth-child(3n) {
  border-radius: 999px;
  height: var(--piece-size, 8px);
}

.confetti-piece:nth-child(5n) {
  width: calc(var(--piece-size, 8px) * 1.35);
  height: calc(var(--piece-size, 8px) * 0.86);
}

.history-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed #d7dfeb;
}

.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border: 1px solid #d8e1ed;
  border-radius: 10px;
  background: #fbfdff;
  padding: 8px 10px;
}

.history-main {
  display: grid;
  gap: 2px;
}

.history-title {
  font-weight: 700;
  color: #173a66;
}

.history-meta {
  color: var(--muted);
  font-size: 12px;
}

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

.history-btn {
  border: 1px solid #c8d7ea;
  background: #eef4fc;
  color: #18457a;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.history-empty {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.card-key-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

#card-key {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #bfe7d3;
  background: var(--accent-soft);
  word-break: break-all;
}

.done-panel.done-panel-celebrate #card-key {
  animation: card-key-pop 0.95s cubic-bezier(0.22, 1, 0.36, 1) 0.06s both;
  box-shadow: 0 10px 24px rgba(16, 185, 129, 0.24);
}

@keyframes celebration-flash {
  0% {
    opacity: 0;
    transform: scale(0.66);
  }
  40% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: scale(1.14);
  }
}

@keyframes confetti-fall {
  0% {
    opacity: 0;
    transform: translate3d(0, -26px, 0) rotate(0deg);
  }
  12% {
    opacity: 1;
  }
  88% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift, 0), 290px, 0) rotate(var(--rotate-end, 480deg));
  }
}

@keyframes card-key-pop {
  0% {
    transform: scale(0.92);
    filter: saturate(0.88);
  }
  58% {
    transform: scale(1.04);
    filter: saturate(1.08);
  }
  100% {
    transform: scale(1);
    filter: saturate(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .done-panel.done-panel-celebrate::before,
  .confetti-piece,
  .done-panel.done-panel-celebrate #card-key {
    animation: none !important;
  }
}

.notes details + details {
  margin-top: 8px;
}

.notes summary {
  padding: 8px 0;
  font-weight: 700;
  cursor: pointer;
}

.notes p,
.notes li {
  color: var(--muted);
  line-height: 1.85;
}

.notes ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

a {
  color: var(--brand);
}

body.embed-mode {
  background: #f7f9fc;
}

body.embed-mode .bg-halo,
body.embed-mode #intro-panel,
body.embed-mode #notes-panel {
  display: none !important;
}

body.embed-mode .page {
  width: min(100%, calc(100% - 24px));
  margin: 12px auto;
  gap: 12px;
}

body.embed-mode .card {
  padding: 16px;
  border-radius: 16px;
  box-shadow: 0 8px 18px rgba(16, 29, 51, 0.06);
}

body.embed-mode .topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 8px;
  padding: 10px 12px;
  width: min(920px, 100%);
  margin: 0 auto;
}

body.embed-mode .topbar h1 {
  grid-column: 1 / -1;
  margin-top: 0;
  font-size: 28px;
  line-height: 1.2;
}

body.embed-mode .brand {
  font-size: 22px;
}

body.embed-mode .top-lead,
body.embed-mode .trust-inline {
  display: none;
}

body.embed-mode .layout {
  grid-template-columns: 1fr;
  width: min(920px, 100%);
  margin: 0 auto;
}

body.embed-mode .checkout-col {
  position: static;
  width: 100%;
}

body.embed-mode .plan-picker {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 10px;
}

body.embed-mode .plan-option {
  min-height: 92px;
  padding: 10px;
}

body.embed-mode .plan-name {
  font-size: 18px;
}

body.embed-mode .plan-option strong {
  font-size: 20px;
}

body.embed-mode .action-row {
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

body.embed-mode .btn-primary {
  font-size: 17px;
  padding: 10px 12px;
}

body.embed-mode .btn-secondary {
  font-size: 15px;
  padding: 10px 12px;
}

body.embed-mode .pay-grid {
  grid-template-columns: 210px 1fr;
  gap: 10px;
  align-items: start;
}

body.embed-mode .countdown strong {
  font-size: 18px;
}

@media (max-width: 920px) {
  body.embed-mode .page {
    width: min(100%, calc(100% - 20px));
    margin: 10px auto;
  }

  body.embed-mode .plan-picker,
  body.embed-mode .pay-grid,
  body.embed-mode .action-row {
    grid-template-columns: 1fr;
  }

  body.embed-mode .topbar h1 {
    font-size: 24px;
  }
}

@media (max-width: 980px) {
  .layout,
  .plan-picker,
  .pay-grid,
  .pay-action-row {
    grid-template-columns: 1fr;
  }

  .checkout-col {
    position: static;
  }

  .intro-col {
    display: none;
  }

  .notes {
    margin-top: 2px;
  }
}

@media (max-width: 560px) {
  .page {
    width: min(100%, calc(100% - 14px));
    margin: 10px auto 18px;
  }

  .card {
    padding: 14px;
    border-radius: 18px;
  }

  h1 {
    font-size: 28px;
    line-height: 1.2;
  }

  h2 {
    font-size: 24px;
  }

  .plan-option {
    min-height: 90px;
    padding: 11px;
  }

  .plan-name {
    font-size: 18px;
  }

  .plan-option strong {
    font-size: 20px;
  }

  .btn-primary {
    font-size: 18px;
    padding: 11px 14px;
  }

  .btn-secondary {
    font-size: 16px;
    padding: 11px 14px;
  }

  .pay-grid {
    gap: 10px;
  }

  .pay-action-row,
  .simple-modal-actions {
    grid-template-columns: 1fr;
  }

  .history-item {
    grid-template-columns: 1fr;
  }

  .history-actions {
    justify-content: flex-start;
  }

  .action-row {
    grid-template-columns: 1fr;
  }

  #card-key {
    width: 100%;
  }
}
