/* ============================================================
   前台（客戶付款頁）— 手機優先、字大好按、適合年長者
   ============================================================ */
html {
  font-size: 106.25%; /* 17px */
}
html[data-fs='l'] {
  font-size: 118.75%; /* 19px */
}
html[data-fs='xl'] {
  font-size: 131.25%; /* 21px */
}
@media (min-width: 720px) {
  html {
    font-size: 106.25%;
  }
}

body.public {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
}
.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ── 頂部列 ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(8, 19, 48, 0.96);
  color: var(--on-night);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  backdrop-filter: saturate(140%) blur(8px);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
}
.brand img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  flex: none;
}
.brand-text {
  display: grid;
  line-height: 1.1;
  min-width: 0;
}
.brand-text b {
  font-size: 1.125rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.brand-text small {
  font-family: var(--font-num);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--on-night-2);
  white-space: nowrap;
}
.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
.fs-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: transparent;
  color: var(--on-night);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.fs-toggle span {
  font-size: 0.75em;
  margin-left: 2px;
  color: var(--on-night-2);
}
.topbar .btn-site {
  --h: 44px;
  padding: 0 16px;
  font-size: 0.9375rem;
}

/* ── 頁首（深色） ── */
.hero {
  background: radial-gradient(1200px 400px at 80% -10%, rgba(28, 168, 255, 0.18), transparent 60%),
    radial-gradient(900px 300px at -10% 120%, rgba(123, 97, 255, 0.16), transparent 60%), var(--night);
  color: var(--on-night);
  padding: 22px 0 60px;
}
@media (min-width: 720px) {
  .hero {
    padding: 32px 0 68px;
  }
}
.card,
.field,
.method,
.alert {
  scroll-margin-top: 84px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--on-night-2);
}
.eyebrow .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #3ddc84;
  box-shadow: 0 0 0 4px rgba(61, 220, 132, 0.18);
}
.hero h1 {
  margin-top: 10px;
  font-size: clamp(1.625rem, 6.2vw, 2.5rem);
  font-weight: 900;
  letter-spacing: 0.01em;
}
.hero h1 em {
  font-style: normal;
  color: var(--gold-2);
}
.hero .lead {
  margin-top: 8px;
  color: var(--on-night-2);
  font-size: 1rem;
}
.trust {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  padding: 0;
  list-style: none;
}
.trust li {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.8125rem;
  color: var(--on-night);
}
@media (min-width: 720px) {
  .trust li {
    padding: 6px 12px;
    font-size: 0.875rem;
  }
}
.trust svg {
  width: 16px;
  height: 16px;
  color: var(--gold-2);
}

/* ── 主要內容 ── */
.main {
  flex: 1;
  margin-top: -40px;
  padding-bottom: 40px;
}
.layout {
  display: grid;
  gap: 16px;
}
@media (min-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1fr) 340px;
    align-items: start;
    gap: 24px;
  }
  .layout .aside {
    position: sticky;
    top: 88px;
  }
}
.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--r-l);
  box-shadow: var(--shadow);
  padding: 22px 18px;
}
@media (min-width: 560px) {
  .card {
    padding: 28px 28px;
  }
}
.card + .card {
  margin-top: 16px;
}
.step-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.step-no {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 2px solid var(--gold);
  color: var(--gold-ink);
  background: var(--gold-soft);
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 1.25rem;
}
.step-head h2 {
  font-size: 1.3125rem;
  font-weight: 900;
}
.step-head p {
  color: var(--slate-2);
  font-size: 0.9375rem;
  margin-top: 2px;
}

/* 課程資訊 */
.product-line {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-radius: var(--r-m);
  background: var(--paper);
  border: 1px solid var(--line);
}
.product-line .pi {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--night);
  color: var(--gold-2);
  flex: none;
}
.product-line .pi svg {
  width: 26px;
  height: 26px;
}
.product-line b {
  display: block;
  font-size: 1.0625rem;
}
.product-line span {
  color: var(--slate-2);
  font-size: 0.9375rem;
}

/* 地區切換 */
.regions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 640px) {
  .regions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.region-opt {
  position: relative;
}
.region-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.region-opt label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 64px;
  padding: 8px;
  border-radius: 14px;
  border: 1.5px solid var(--line-strong);
  background: var(--white);
  font-weight: 700;
  font-size: 1.0625rem;
  cursor: pointer;
  text-align: center;
  line-height: 1.3;
}
.region-opt label small {
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--slate-2);
}
.region-opt input:checked + label {
  border-color: var(--navy);
  background: var(--navy);
  color: var(--gold-2);
}
.region-opt input:checked + label small {
  color: var(--on-night-2);
}
.region-opt input:focus-visible + label {
  box-shadow: var(--focus);
}

/* 付款方式 */
.methods {
  display: grid;
  gap: 12px;
}
.method {
  position: relative;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-m);
  background: var(--white);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.method > input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.method-row {
  display: grid;
  grid-template-columns: 28px 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 16px;
  cursor: pointer;
  min-height: 84px;
}
.radio-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  display: grid;
  place-items: center;
  background: #fff;
}
.radio-dot::after {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: transparent;
}
.m-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--paper);
  color: var(--navy);
  border: 1px solid var(--line);
}
.m-icon svg {
  width: 24px;
  height: 24px;
}
.m-text {
  min-width: 0;
}
.m-name {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 2px 10px;
}
.m-name b {
  font-size: 1.125rem;
  font-weight: 900;
}
.m-price {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--navy);
  white-space: nowrap;
}
.m-price small {
  font-family: var(--font);
  font-weight: 500;
  font-size: 0.8125rem;
  color: var(--slate-2);
  margin-left: 2px;
}
.m-sub {
  font-size: 0.9375rem;
  color: var(--slate-2);
  margin-top: 2px;
}
.m-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.m-tags .badge {
  font-size: 0.75rem;
  padding: 2px 8px;
}
.method > input:checked ~ .method-row .radio-dot {
  border-color: var(--navy);
}
.method > input:checked ~ .method-row .radio-dot::after {
  background: var(--navy);
}
.method:has(> input:checked) {
  border-color: var(--gold);
  background: #fffdf6;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.25);
}
.method.is-selected {
  border-color: var(--gold);
  background: #fffdf6;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.25);
}
.method > input:focus-visible ~ .method-row {
  box-shadow: var(--focus);
  border-radius: var(--r-m);
}
.method-more {
  display: none;
  padding: 0 16px 16px;
}
.method.is-selected .method-more,
.method:has(> input:checked) .method-more {
  display: block;
}
.no-js .method-more {
  display: block;
}
.empty-region {
  padding: 18px;
  border-radius: var(--r-m);
  background: var(--paper);
  color: var(--slate-2);
  text-align: center;
}

/* 分期方案 */
.plans-title {
  font-weight: 700;
  margin: 2px 0 10px;
}
.plans {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 640px) {
  .plans {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.plan input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.plan {
  position: relative;
}
.plan label {
  display: grid;
  gap: 2px;
  height: 100%;
  padding: 12px 12px 12px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line-strong);
  background: #fff;
  cursor: pointer;
}
.plan label b {
  font-size: 1.0625rem;
}
.plan label .num {
  font-size: 1.125rem;
  font-weight: 700;
}
.plan label small {
  font-size: 0.8125rem;
  color: var(--slate-2);
  line-height: 1.4;
}
.plan input:checked + label {
  border-color: var(--navy);
  background: var(--navy);
  color: #fff;
}
.plan input:checked + label small {
  color: var(--on-night-2);
}
.plan input:focus-visible + label {
  box-shadow: var(--focus);
}
.method-note {
  margin-top: 12px;
}
.steps-mini {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: s;
  display: grid;
  gap: 8px;
}
.steps-mini li {
  counter-increment: s;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
  font-size: 0.9875rem;
}
.steps-mini li::before {
  content: counter(s);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold-soft);
  border: 1.5px solid var(--gold);
  color: var(--gold-ink);
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 0.9375rem;
}

/* 表單區塊 */
.grid-2 {
  display: grid;
  gap: 18px;
}
@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
  .grid-2 .field + .field {
    margin-top: 0;
  }
}
.grid-2 + .field,
.field + .grid-2,
.grid-2 + .grid-2 {
  margin-top: 18px;
}

/* 發票 */
.inv-types {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.inv-type {
  position: relative;
}
.inv-type input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.inv-type label {
  display: grid;
  gap: 2px;
  min-height: 76px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1.5px solid var(--line-strong);
  cursor: pointer;
  background: #fff;
}
.inv-type label b {
  font-size: 1.0625rem;
}
.inv-type label small {
  color: var(--slate-2);
  font-size: 0.8125rem;
  line-height: 1.4;
}
.inv-type input:checked + label {
  border-color: var(--gold);
  background: #fffdf6;
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.25);
}
.inv-type input:focus-visible + label {
  box-shadow: var(--focus);
}
.inv-fields {
  margin-top: 18px;
}
.inv-more {
  margin-top: 12px;
  font-size: 0.9375rem;
}
.inv-more button {
  background: none;
  border: none;
  color: var(--info);
  padding: 6px 0;
  cursor: pointer;
  text-decoration: underline;
}
.no-invoice-note {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* 摘要（右側 / 底部） */
.summary h3 {
  font-size: 1.125rem;
  font-weight: 900;
  margin-bottom: 12px;
}
.sum-rows {
  display: grid;
  gap: 10px;
  font-size: 0.9875rem;
}
.sum-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.sum-row span:first-child {
  color: var(--slate-2);
  flex: none;
}
.sum-row span:last-child {
  text-align: right;
  font-weight: 700;
}
.sum-total {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line-strong);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.sum-total .num {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}
.sum-total small {
  color: var(--slate-2);
}
.summary .btn {
  margin-top: 18px;
}
.summary .terms {
  margin-top: 12px;
  font-size: 0.8125rem;
  color: var(--slate-2);
}

/* 手機底部固定付款列 */
.paybar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--line);
  box-shadow: 0 -10px 30px -16px rgba(10, 37, 64, 0.35);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
}
.paybar-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}
.paybar .amt {
  display: grid;
  line-height: 1.15;
  min-width: 0;
}
.paybar .amt small {
  color: var(--slate-2);
  font-size: 0.8125rem;
}
.paybar .amt .num {
  font-size: 1.625rem;
  font-weight: 700;
  white-space: nowrap;
}
.paybar .amt .pick {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--gold-ink);
}
.paybar .btn {
  margin-left: auto;
  flex: none;
  min-width: 46%;
}
body.has-paybar {
  padding-bottom: 96px;
}
@media (min-width: 960px) {
  .paybar {
    display: none;
  }
  body.has-paybar {
    padding-bottom: 0;
  }
}
@media (max-width: 959px) {
  .aside .summary .btn-pay {
    display: none;
  }
}

/* ── 訂單 / 結果頁 ── */
.status-hero {
  text-align: center;
  padding: 8px 0 4px;
}
.status-icon {
  width: 84px;
  height: 84px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.status-icon svg {
  width: 44px;
  height: 44px;
}
.status-icon.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.status-icon.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.status-icon.info {
  background: var(--info-soft);
  color: var(--info);
}
.status-icon.bad {
  background: var(--danger-soft);
  color: var(--danger);
}
.status-icon.muted {
  background: #eef1f5;
  color: var(--slate-2);
}
.status-hero h1 {
  font-size: 1.75rem;
  font-weight: 900;
}
.status-hero p {
  margin-top: 6px;
  color: var(--slate);
}
.kv {
  display: grid;
  gap: 0;
  margin: 0;
}
.kv > div {
  display: grid;
  grid-template-columns: 7.5em minmax(0, 1fr);
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.kv > div:last-child {
  border-bottom: none;
}
.kv dt {
  color: var(--slate-2);
}
.kv dd {
  margin: 0;
  font-weight: 700;
  word-break: break-word;
}
.big-amount {
  font-family: var(--font-num);
  font-size: 2.25rem;
  font-weight: 700;
  line-height: 1.1;
}
.copy-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.copy-line + .copy-line {
  margin-top: 8px;
}
.copy-line .k {
  display: block;
  font-size: 0.8125rem;
  color: var(--slate-2);
}
.copy-line .v {
  display: block;
  font-weight: 700;
  font-size: 1.0625rem;
  word-break: break-all;
}
.copy-btn {
  flex: none;
}
.qr-box {
  width: min(280px, 100%);
  margin: 12px auto 0;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-m);
}
.qr-box img {
  width: 100%;
  height: auto;
}
.upload-box {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-m);
  background: var(--paper);
  text-align: center;
}
.upload-box {
  position: relative;
}
.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.thumbs img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.next-steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.next-steps li {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: start;
}
.next-steps .step-no {
  width: 36px;
  height: 36px;
  font-size: 1.0625rem;
}
.next-steps b {
  display: block;
}
.next-steps .btn {
  margin-top: 8px;
}
.actions {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}
@media (min-width: 560px) {
  .actions.row {
    grid-template-columns: 1fr 1fr;
  }
}
.help-card {
  display: grid;
  gap: 12px;
}
.help-card .btns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* 模擬 / 測試標示 */
.test-banner {
  background: repeating-linear-gradient(-45deg, #fff4dc, #fff4dc 12px, #ffeec2 12px, #ffeec2 24px);
  color: #6e4a00;
  border-bottom: 1px solid #f1d79a;
  font-size: 0.875rem;
  font-weight: 700;
  text-align: center;
  padding: 6px 12px;
}

/* 導轉頁 */
.redirect-box {
  max-width: 480px;
  margin: 40px auto;
  text-align: center;
}
.spinner {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 5px solid var(--line);
  border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}

/* ── 頁尾 ── */
.footer {
  background: var(--night-deep);
  color: var(--on-night-2);
  padding: 36px 0 28px;
  font-size: 0.9375rem;
}
.footer .wrap {
  display: grid;
  gap: 18px;
}
.footer .brand-text b {
  color: var(--on-night);
}
.footer a {
  color: var(--on-night);
  text-decoration: none;
}
.footer a:hover {
  text-decoration: underline;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 0;
  margin: 0;
  list-style: none;
}
.footer .copy {
  font-size: 0.8125rem;
  color: #7f8cab;
}
body.has-paybar .footer {
  padding-bottom: 28px;
}

/* 手機：隱藏付款方式圖示，讓文字有更多空間 */
@media (max-width: 480px) {
  .method-row {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 12px;
  }
  .method-row .m-icon {
    display: none;
  }
}
.help-card .btns .btn {
  padding: 0 12px;
  white-space: nowrap;
}

/* 極小螢幕（320px） */
@media (max-width: 360px) {
  .wrap {
    padding: 0 12px;
  }
  .card {
    padding: 18px 14px;
    border-radius: 18px;
  }
  .method-row {
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 10px;
    padding: 14px 12px;
  }
  .method-row .m-icon {
    display: none;
  }
  .radio-dot {
    width: 26px;
    height: 26px;
  }
  .brand-text small {
    display: none;
  }
  .topbar .btn-site {
    display: none;
  }
  .plans,
  .inv-types {
    grid-template-columns: 1fr;
  }
  .paybar .btn {
    min-width: 0;
    padding: 0 18px;
  }
  .kv > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
