/* ===========================================================================
   CodeTalk · pay page styles
   Same design tokens as app.css. No `inset` shorthand alone (Chrome 55 drops
   the whole declaration) — every positioned layer carries explicit
   top/right/bottom/left. No clamp() without a plain-unit fallback.
   =========================================================================== */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f1f4;
  --text: #14171a;
  --muted: #697586;
  --line: #e3e6ea;
  --accent: #2f6df6;
  --accent-ink: #ffffff;
  --ok: #12a150;
  --warn: #e08d0b;
  --danger: #d93a3a;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1e222b;
    --text: #e8eaed;
    --muted: #98a2b3;
    --line: #262b36;
    --accent: #4a83ff;
    --ok: #2fbf6d;
    --warn: #e8a33d;
    --danger: #f05656;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

[hidden] { display: none !important; }

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}

button, input { font: inherit; color: inherit; }

.wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

/* ---------------- header ---------------- */

.head { text-align: center; margin: 12px 0 24px; }

.brand {
  display: inline-flex;
  align-items: baseline;
  font-weight: 800;
  letter-spacing: -.02em;
  background: var(--accent);
  color: #fff;
  border-radius: 12px;
  padding: 6px 14px;
  margin-bottom: 14px;
}
.badge-big { font-size: 24px; }
.badge-dim { font-size: 15px; opacity: .85; }

.head h1 { font-size: 24px; margin: 0 0 8px; letter-spacing: -.01em; }
.lede { color: var(--muted); margin: 0 auto; max-width: 560px; }
.lede b { color: var(--text); }

/* ---------------- plan cards ---------------- */

.plans {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}
.plan { flex: 1 1 200px; display: flex; }
.plan input { position: absolute; opacity: 0; pointer-events: none; }

.plan-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color .15s ease;
}
.plan input:checked + .plan-card { border-color: var(--accent); }
.plan input:focus-visible + .plan-card { outline: 2px solid var(--accent); outline-offset: 2px; }

.plan-tag {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 999px;
  padding: 2px 8px;
  margin-bottom: 4px;
}
.plan-price { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.plan-name { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.plan-line { font-size: 13px; color: var(--muted); }

/* ---------------- form card ---------------- */

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

.field { margin-bottom: 18px; }
.field > label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.opt { font-weight: 400; color: var(--muted); }

.pass-row { display: flex; gap: 8px; align-items: stretch; }

input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 15px;
  background: var(--surface-2);
  letter-spacing: .02em;
}
input:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
input::placeholder { color: var(--muted); font-size: 13.5px; letter-spacing: 0; }

/* Masking via CSS, never type="password" (see the note in pay.html). */
.masked { -webkit-text-security: disc; }

.reveal {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.reveal:active { color: var(--text); }

.hint { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.hint b { color: var(--text); }

.error {
  font-size: 13.5px;
  color: var(--danger);
  background: rgba(217, 58, 58, .08);
  border: 1px solid rgba(217, 58, 58, .25);
  border-radius: 8px;
  padding: 9px 12px;
  margin: 0 0 14px;
}

button.primary, a.primary {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
}
button.primary:active, a.primary:active { filter: brightness(.92); }
button.primary:disabled { opacity: .6; cursor: default; }

button.ghost {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 16px;
  font-size: 14.5px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.secure-note { font-size: 12.5px; color: var(--muted); text-align: center; margin: 12px 0 0; }
.secure-note b { color: var(--text); }

/* ---------------- result ---------------- */

.result-title { font-size: 19px; margin: 0 0 10px; }
.result-body { margin: 0 0 16px; color: var(--muted); }
.result-body b { color: var(--text); }
.result-body.ok { color: var(--ok); }
.result-actions { display: flex; flex-direction: column; gap: 10px; }
.result-actions a.primary { width: 100%; }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--muted);
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  margin-right: 8px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- faq ---------------- */

.faq h2 { font-size: 16px; margin: 4px 0 10px; }
.faq h2 + ol, .faq h2 + ul { margin: 0 0 18px; padding-left: 20px; }
.faq li { font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.faq li b { color: var(--text); }
.faq a { color: var(--accent); }

.back-line { font-size: 13.5px; margin: 4px 0 0; }
.back-line a { color: var(--accent); text-decoration: none; }

.foot {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

@media (max-width: 560px) {
  .plans { flex-direction: column; }
  .plan { flex-basis: auto; }
}
