/* ==========================================================================
   TouchIn 員購表單
   ========================================================================== */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --border: #e3e6ea;
  --border-strong: #c8cdd4;
  --text: #16191d;
  --text-muted: #656d78;
  /* 品牌主色。--accent 用於邊框、選取態、focus ring；
     --accent-ink 是淺底上的強調文字，--accent-fill 是承載白字的實心底色。
     後兩者刻意深一階，讓對比度過 WCAG AA。 */
  --accent: #ea522f;
  --accent-ink: #c0431f;
  --accent-fill: #cf4722;
  --accent-weak: #fdeeea;
  --danger: #c0392b;
  --success: #1a7f4b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101215;
    --surface: #191c21;
    --border: #2a2f36;
    --border-strong: #3d444d;
    --text: #e9ecef;
    --text-muted: #9aa3ad;
    --accent: #f4714f;
    --accent-ink: #f4714f;
    --accent-fill: #cf4722;
    --accent-weak: #331810;
    --danger: #f0776a;
    --success: #4cc38a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  padding: 0 0 7.5rem;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC",
               "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.page {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 0;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.honeypot {
  position: absolute;
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

/* --- Hero ---------------------------------------------------------------- */

.hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
}

.hero__eyebrow {
  margin: 0 0 .5rem;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--accent-ink);
}

.hero__title {
  margin: 0 0 .75rem;
  font-size: 1.5rem;
  line-height: 1.3;
  font-weight: 700;
}

.hero__price {
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: .25rem;
}

.hero__price-value {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -.02em;
}

.hero__price-unit {
  font-size: .9rem;
  color: var(--text-muted);
}

.hero__note {
  margin: .5rem 0 0;
  font-size: .875rem;
  color: var(--text-muted);
}

/* --- Form ---------------------------------------------------------------- */

.form { margin: 0; }

.field {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin: 0 0 1rem;
}

.field__legend {
  padding: 0;
  margin-bottom: .875rem;
  font-size: .9375rem;
  font-weight: 600;
}

.field__hint,
.field__error {
  margin: .625rem 0 0;
  font-size: .8125rem;
}

.field__hint { color: var(--text-muted); }
.field__error { color: var(--danger); }

/* --- Stepper ------------------------------------------------------------- */

.stepper {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--surface);
}

.stepper__btn {
  width: 3rem;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background .12s;
}

.stepper__btn:hover { background: var(--accent-weak); }
.stepper__btn:disabled { opacity: .35; cursor: not-allowed; background: transparent; }

.stepper__input {
  width: 4rem;
  padding: .625rem 0;
  border: 0;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 600;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.stepper__input::-webkit-outer-spin-button,
.stepper__input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* --- Radios -------------------------------------------------------------- */

.radios { display: grid; gap: .5rem; }

.radios--inline {
  grid-template-columns: repeat(2, 1fr);
}

.radio {
  display: flex;
  align-items: flex-start;
  gap: .625rem;
  padding: .75rem .875rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}

.radio:hover { border-color: var(--accent); }

.radio:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-weak);
}

.radio input {
  margin: .3rem 0 0;
  accent-color: var(--accent);
  flex: none;
}

.radio__body { display: block; min-width: 0; }

.radio__title {
  display: block;
  font-size: .9375rem;
  font-weight: 500;
}

.radio__meta {
  display: block;
  font-size: .8125rem;
  color: var(--text-muted);
}

/* --- Inputs -------------------------------------------------------------- */

.input {
  display: block;
  margin-bottom: .875rem;
}

.input:last-child { margin-bottom: 0; }

.input__label {
  display: block;
  margin-bottom: .3125rem;
  font-size: .8125rem;
  font-weight: 500;
  color: var(--text-muted);
}

.input__label em {
  font-style: normal;
  color: var(--danger);
}

.input input,
.input select,
.input textarea {
  width: 100%;
  padding: .625rem .75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem; /* 避免 iOS Safari 聚焦時自動放大 */
  transition: border-color .12s, box-shadow .12s;
}

.input textarea { resize: vertical; }

.input input:focus,
.input select:focus,
.input textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}

.input input[aria-invalid="true"],
.input select[aria-invalid="true"] {
  border-color: var(--danger);
}

.input__hint,
.input__error {
  display: block;
  margin-top: .3125rem;
  font-size: .8125rem;
}

.input__hint { color: var(--text-muted); }
.input__error { color: var(--danger); }

.linkbtn {
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent-ink);
  font: inherit;
  font-size: .8125rem;
  cursor: pointer;
  text-decoration: underline;
}

/* --- Buttons ------------------------------------------------------------- */

.form__actions { padding-bottom: 1rem; }

.form__error {
  margin: 0 0 1rem;
  padding: .75rem 1rem;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: .875rem;
  background: var(--surface);
}

.btn {
  display: block;
  width: 100%;
  padding: .875rem 1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .12s, background .12s;
}

.btn--primary { background: var(--accent-fill); color: #fff; }
.btn--primary:hover:not(:disabled) { opacity: .9; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}

.btn--ghost:hover { background: var(--accent-weak); }

/* --- Panels -------------------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.5rem;
  text-align: center;
}

.panel--closed h2 { margin-top: 0; }

.panel__check {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-size: 1.5rem;
  line-height: 3rem;
}

.panel__title { margin: 0 0 .75rem; font-size: 1.25rem; }

.panel__lead {
  margin: 0 0 1.5rem;
  font-size: .9375rem;
  color: var(--text-muted);
}

.panel__lead strong {
  color: var(--text);
  font-size: 1.0625rem;
  letter-spacing: .02em;
}

.panel__foot {
  margin: 1.25rem 0;
  font-size: .8125rem;
  color: var(--text-muted);
}

/* --- Payment box --------------------------------------------------------- */

.paybox {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  text-align: left;
}

.paybox__title {
  margin: 0 0 .875rem;
  font-size: .9375rem;
  font-weight: 600;
}

.paybox__list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .5rem .875rem;
  margin: 0;
  font-size: .9375rem;
}

.paybox__list dt {
  color: var(--text-muted);
  font-size: .8125rem;
  padding-top: .1rem;
  white-space: nowrap;
}

.paybox__list dd {
  margin: 0;
  word-break: break-all;
}

.paybox__list dd.is-amount {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--accent-ink);
}

.paybox__list dd.is-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .02em;
}

.paybox__hint {
  margin: .875rem 0 0;
  font-size: .8125rem;
  color: var(--text-muted);
}

/* --- Sticky summary bar -------------------------------------------------- */

.summary {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  z-index: 10;
}

.summary[hidden] { display: none; }

.summary__inner {
  max-width: 34rem;
  margin: 0 auto;
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.summary__lines {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.summary__line {
  font-size: .8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary__total {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  flex: none;
}

.summary__total-label {
  font-size: .8125rem;
  color: var(--text-muted);
}

.summary__total-value {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -.01em;
}
