/* 三套模板共用同一布局；配色由 js/themes.js 注入 CSS 变量 */

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

html {
  -webkit-text-size-adjust: 100%;
}

:root {
  --brand: #a50064;
  --brand-deep: #6d0043;
  --brand-soft: #fce7f3;
  --brand-mid: #c2185b;
  --page-bg: #fdf2f8;
  --hero-grad: linear-gradient(160deg, #6d0043 0%, #a50064 55%, #c2185b 100%);
  --label: #9d174d;
  --value: #831843;
  --line: #fbcfe8;
}

body {
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  color: #0f172a;
  background: var(--page-bg);
}

.demo-bar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 40;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.92);
  color: #e2e8f0;
}

.demo-bar.is-local {
  display: flex;
}

.demo-bar .label {
  font-size: 12px;
  font-weight: 700;
  margin-right: 4px;
}

.demo-bar button {
  border: 1px solid #475569;
  background: transparent;
  color: #e2e8f0;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.demo-bar button.active {
  background: #fff;
  color: #0f172a;
  border-color: #fff;
}

.pay-page {
  min-height: calc(100vh - 48px);
}

.mm-hero {
  padding: 28px 20px 52px;
  background: var(--hero-grad);
  color: #fff;
  text-align: center;
  position: relative;
  z-index: 0;
}

.mm-hero img.brand {
  height: 48px;
  width: auto;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  background: #fff;
  padding: 4px 8px;
  object-fit: contain;
}

.mm-hero .sub {
  margin-top: 14px;
  font-size: 13px;
  opacity: 0.85;
  font-weight: 600;
}

.mm-hero .amount {
  margin-top: 8px;
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -0.03em;
  word-break: break-word;
}

.mm-timer-badge {
  position: absolute;
  right: 16px;
  top: 16px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
}

.mm-timer-badge span[data-bind="timer"] {
  display: block;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.mm-card {
  margin: 0 14px 28px;
  position: relative;
  z-index: 2;
  background: #fff;
  border-radius: 24px;
  padding: 22px 16px 18px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  transform: translateY(-28px);
}

.mm-method {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--brand);
  margin-bottom: 10px;
}

.mm-save {
  display: block;
  width: 100%;
  margin: 0 0 12px;
  min-height: 44px;
  border: none;
  border-radius: 14px;
  background: var(--hero-grad);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}

.mm-method.secondary {
  margin-top: 0;
  margin-bottom: 12px;
}

.mm-card-main {
  display: block;
}

.mm-col-qr,
.mm-col-info {
  min-width: 0;
}

/* 方形二维码，完整可见 */
.mm-qr-box {
  width: 196px;
  height: 196px;
  margin: 0 auto 12px;
  border-radius: 16px;
  background: #fff;
  border: 2px solid var(--brand-soft);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, white);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}

.mm-qr-box .qr-canvas {
  display: block;
  width: 168px !important;
  height: 168px !important;
}

/* 二维码下方：NAPAS + 银行 */
.mm-rail-icons {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin: 0 auto 14px;
  flex-wrap: nowrap;
  min-height: 24px;
}

.mm-rail-icons img {
  height: 20px;
  width: auto;
  max-width: 96px;
  object-fit: contain;
  object-position: center;
  display: block;
}

.mm-rail-icons .napas-logo {
  transform: translateY(4px);
}

.mm-rail-icons .bank-logo {
  height: 20px;
  max-width: 64px;
  transform: translateY(3px);
}

.mm-rail-icons .bank-logo.is-empty {
  visibility: hidden;
  width: 56px;
  height: 20px;
}

.mm-list {
  display: grid;
  gap: 0;
}

.mm-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 12px 4px;
  border-bottom: 1px dashed var(--line);
}

.mm-item:last-child {
  border-bottom: none;
}

.mm-item .k {
  grid-column: 1;
  font-size: 11px;
  color: var(--label);
  font-weight: 700;
}

.mm-item .v {
  grid-column: 1;
  font-size: 15px;
  font-weight: 800;
  color: var(--value);
  word-break: break-all;
}

.mm-item .copy-btn {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  border: none;
  background: var(--brand);
  color: #fff;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.disclaimer {
  margin-top: 14px;
  padding: 14px 14px 12px;
  border-radius: 16px;
  font-size: 12px;
  line-height: 1.65;
  background: var(--brand-soft);
  border: 1px solid color-mix(in srgb, var(--brand) 28%, white);
}

.disclaimer h4 {
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 6px;
  color: var(--brand);
}

.disclaimer ol {
  margin-left: 18px;
  color: #334155;
}

.disclaimer strong {
  color: var(--brand);
  font-weight: 800;
}

.mm-oid {
  margin: -8px 16px 24px;
  text-align: center;
  font-size: 11px;
  color: #64748b;
  word-break: break-all;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
  .mm-hero .amount {
    font-size: 30px;
  }
}

/* PC：卡片加宽，左二维码 / 右信息，尽量一屏展示 */
@media (min-width: 900px) {
  .pay-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }

  .mm-hero {
    padding: 22px 32px 56px;
    flex-shrink: 0;
  }

  .mm-hero img.brand {
    height: 44px;
  }

  .mm-hero .amount {
    font-size: 40px;
  }

  .mm-card {
    width: min(960px, calc(100% - 48px));
    max-width: 960px;
    margin: 0 auto 12px;
    padding: 28px 32px 24px;
    transform: translateY(-36px);
    flex: 0 0 auto;
  }

  .mm-card-main {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 8px 40px;
    align-items: start;
  }

  .mm-col-qr {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .mm-col-qr .mm-method {
    width: 100%;
    margin-bottom: 14px;
  }

  .mm-col-info .mm-method.secondary {
    text-align: left;
    margin-bottom: 8px;
  }

  .mm-qr-box {
    width: 280px;
    height: 280px;
    margin: 0 auto 16px;
    border-radius: 20px;
  }

  .mm-qr-box .qr-canvas {
    width: 248px !important;
    height: 248px !important;
  }

  .mm-rail-icons {
    margin: 0 auto 16px;
  }

  .mm-rail-icons img {
    height: 24px;
    max-width: 120px;
  }

  .mm-rail-icons .bank-logo {
    height: 24px;
    max-width: 80px;
  }

  .mm-col-qr .mm-save {
    max-width: 280px;
    margin-bottom: 0;
  }

  .mm-item {
    padding: 10px 4px;
  }

  .mm-item .k {
    font-size: 12px;
  }

  .mm-item .v {
    font-size: 16px;
  }

  .disclaimer {
    margin-top: 12px;
    padding: 12px 14px;
    font-size: 12px;
    line-height: 1.55;
  }

  .mm-oid {
    margin: -20px 16px 16px;
  }
}

/* 无参 / 参数错误 */
.invalid-page {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px;
  color: #334155;
}

.invalid-page[hidden] {
  display: none !important;
}

.invalid-page h1 {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
}

.invalid-page p {
  margin: 0;
  max-width: 360px;
  font-size: 14px;
  line-height: 1.6;
  color: #64748b;
}

body.is-invalid .pay-page {
  display: none !important;
}
