@charset "utf-8";

/* 兑换中心：一张凭证贯穿全程。
   凭证（.voucher）是页面唯一的重点：随流程写入套餐与账号，完成时盖章。
   其余界面保持安静：冷灰纸面、玉绿只用于主操作与"已验证"。 */

:root {
  color-scheme: light dark;

  --paper: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f4f7fa;
  --ink: #0f1c2e;
  --ink-2: #475569;
  --ink-3: #8593a6;
  --line: #dbe2ea;
  --line-strong: #b9c4d2;

  --jade: #0b6b5a;
  --jade-ink: #0a5446;
  --jade-soft: #dcf1ea;
  --on-jade: #ffffff;
  --amber-ink: #8a5300;
  --amber-soft: #fbefd2;
  --rose-ink: #b3261e;
  --rose-soft: #fde8e5;
  --sky-ink: #1c5b9e;
  --sky-soft: #e1edfa;

  --face-idle: #2c4543;
  --face-ok: #0b2e2a;
  --face-fail: #3a1f20;
  --face-review: #3a2f14;

  --radius-s: 10px;
  --radius-m: 12px;
  --radius-l: 20px;
  --radius-voucher: 22px;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --enter-y: 8px;
  --enter-x: 14px;

  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI",
    "Noto Sans CJK SC", "Noto Sans SC", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, "Noto Sans Mono CJK SC", monospace;

  --chrome-h: 64px;
  --tabbar-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #09111c;
    --surface: #111d2d;
    --surface-2: #162639;
    --ink: #e8eef6;
    --ink-2: #a3b3c7;
    --ink-3: #6f8198;
    --line: #22344b;
    --line-strong: #35495f;

    --jade: #3fc2a3;
    --jade-ink: #7ee0c5;
    --jade-soft: #123a35;
    --on-jade: #04231c;
    --amber-ink: #f0c36d;
    --amber-soft: #392d12;
    --rose-ink: #ff9d92;
    --rose-soft: #3d1c1d;
    --sky-ink: #8fc2f5;
    --sky-soft: #152f4c;

    --face-idle: #1c3231;
    --face-ok: #0f3a34;
    --face-fail: #4a2425;
    --face-review: #4a3a17;
  }
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none; /* 下拉刷新会丢掉兑换进度 */
  scrollbar-gutter: stable;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.3; letter-spacing: -0.01em; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }

button, a, summary, label { touch-action: manipulation; }
button, .tabs a, .step, summary { user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

:focus-visible { outline: 2px solid var(--jade); outline-offset: 2px; border-radius: 6px; }

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

.skip-link {
  position: absolute; left: 12px; top: -64px; z-index: 100;
  padding: 10px 16px; border-radius: var(--radius-s);
  background: var(--ink); color: var(--paper); text-decoration: none; font-weight: 600;
  transition: top 160ms var(--ease-out);
}
.skip-link:focus { top: 12px; }

/* ── 顶栏与标签 ── */
.chrome {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: var(--chrome-h);
  padding: 0 max(24px, calc((100vw - 1040px) / 2));
  border-bottom: 1px solid var(--line);
}
/* 毛玻璃放在伪元素上：祖先带 backdrop-filter 会让 fixed 的标签栏相对它定位 */
.chrome::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--paper) 78%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none;
}
.brand-mark {
  width: 24px; height: 24px; flex: none; border-radius: 7px;
  /* 与凭证齿孔呼应的缺口 */
  background: radial-gradient(circle at 100% 50%, var(--paper) 0 4.5px, transparent 5px), var(--jade);
}

.tabs { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); width: 384px; }
.tabs a {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; border-radius: var(--radius-m);
  color: var(--ink-2); text-decoration: none; font-size: 15px; font-weight: 600;
  transition: color 160ms ease, transform 160ms var(--ease-out);
}
.tabs a:active { transform: scale(0.96); }
.tabs a[aria-current="page"] { color: var(--jade-ink); }
.tab-indicator {
  position: absolute; top: 0; bottom: 0; left: 0; width: 25%;
  transition: transform 260ms var(--ease-in-out);
}
.tab-indicator::before {
  content: ""; position: absolute; inset: 0 4px; border-radius: var(--radius-m); background: var(--jade-soft);
}
.tabs[data-active="1"] .tab-indicator { transform: translateX(100%); }
.tabs[data-active="2"] .tab-indicator { transform: translateX(200%); }
.tabs[data-active="3"] .tab-indicator { transform: translateX(300%); }

@media (hover: hover) and (pointer: fine) {
  .tabs a:hover { color: var(--ink); }
  .tabs a[aria-current="page"]:hover { color: var(--jade-ink); }
}

/* ── 页面 ── */
.page { max-width: 1040px; margin: 0 auto; padding: 36px 24px 96px; }
.page:focus { outline: none; }

.view[hidden], .panel-step[hidden] { display: none; }

.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: clamp(26px, 4vw, 34px); line-height: 1.2; letter-spacing: -0.02em; }
.page-head h1:focus-visible { outline-offset: 6px; }
.page-sub { margin-top: 8px; color: var(--ink-2); max-width: 56ch; }

.narrow { max-width: 640px; }
.narrow + .narrow, .narrow + .results { margin-top: 28px; }

/* ── 兑换：凭证 + 步骤 ── */
.redeem-grid {
  display: grid; grid-template-columns: 340px minmax(0, 1fr);
  gap: 36px; align-items: start;
}

.voucher {
  position: sticky; top: calc(var(--chrome-h) + 24px);
  overflow: hidden; border-radius: var(--radius-voucher);
  background: var(--surface);
  box-shadow: 0 1px 0 var(--line), 0 18px 36px -22px rgba(9, 24, 40, 0.45);
  --seal-done: #8ff0cf; --seal-fail: #ffb4a9; --seal-review: #ffd88a;
}
.voucher-face {
  position: relative; min-height: 176px; padding: 22px 22px 20px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 22px;
  color: #e8f5f0; background-color: var(--face-idle);
  /* 钞券式细纹：两组错位同心圆叠出干涉纹 */
  background-image:
    repeating-radial-gradient(circle at 108% -12%, transparent 0 7px, rgba(255, 255, 255, 0.05) 7px 8px),
    repeating-radial-gradient(circle at -8% 112%, transparent 0 9px, rgba(255, 255, 255, 0.04) 9px 10px);
  transition: background-color 420ms ease;
}
.voucher[data-tone="ok"] .voucher-face,
.voucher[data-tone="proc"] .voucher-face,
.voucher[data-tone="done"] .voucher-face { background-color: var(--face-ok); }
.voucher[data-tone="fail"] .voucher-face { background-color: var(--face-fail); }
.voucher[data-tone="review"] .voucher-face { background-color: var(--face-review); }

/* 处理中：一道光从左到右扫过卡面，表示系统仍在工作。匀速，所以用 linear */
.voucher-face::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 45%; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  transform: translateX(-100%);
}
.voucher[data-tone="proc"] .voucher-face::after { opacity: 1; animation: scan 2.4s linear infinite; }
@keyframes scan { to { transform: translateX(230%); } }

.voucher-chip {
  display: block; width: 36px; height: 27px; border-radius: 6px;
  background:
    linear-gradient(90deg, transparent 33%, rgba(60, 40, 0, 0.28) 33% 35%, transparent 35% 65%, rgba(60, 40, 0, 0.28) 65% 67%, transparent 67%),
    linear-gradient(0deg, transparent 46%, rgba(60, 40, 0, 0.28) 46% 54%, transparent 54%),
    #d8b45c;
  opacity: 0.55; transition: opacity 420ms ease;
}
.voucher:not([data-tone="idle"]) .voucher-chip { opacity: 1; }
.voucher-plan { font-size: 24px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.voucher:is([data-tone="done"], [data-tone="fail"], [data-tone="review"]) .voucher-plan { padding-right: 76px; }
.voucher-code { margin-top: 8px; font: 500 15px/1.4 var(--mono); letter-spacing: 0.14em; color: rgba(232, 245, 240, 0.72); word-break: break-all; }

.voucher-stub {
  position: relative; padding: 18px 22px 20px;
  border-top: 2px dashed var(--line-strong);
}
/* 齿孔缺口：圆心压在两侧边缘上，被 overflow 裁出半圆 */
.voucher-stub::before, .voucher-stub::after {
  content: ""; position: absolute; top: -12px; width: 22px; height: 22px; border-radius: 50%; background: var(--paper);
}
.voucher-stub::before { left: -11px; }
.voucher-stub::after { right: -11px; }
.voucher-fields { display: grid; gap: 12px; margin: 0 0 16px; }
.voucher-fields dt { font-size: 13px; color: var(--ink-2); }
.voucher-fields dd { margin: 2px 0 0; font-weight: 600; word-break: break-all; transition: opacity 280ms ease, filter 280ms ease; }
.voucher-fields dd.is-empty { color: var(--ink-3); font-weight: 400; }
.voucher-fields dd.is-filling { opacity: 0; filter: blur(3px); }
.voucher-state { min-height: 28px; }

/* 印章 */
.seal {
  position: absolute; top: 20px; right: 20px; z-index: 2;
  width: 68px; height: 68px; display: grid; place-items: center;
  border: 2px solid currentColor; border-radius: 50%;
  color: var(--seal-c, transparent); font-size: 15px; font-weight: 800; letter-spacing: 0.06em; line-height: 1;
  transform: rotate(-9deg); opacity: 0; visibility: hidden; pointer-events: none;
}
.seal::before { content: ""; position: absolute; inset: 4px; border: 1px solid currentColor; border-radius: 50%; opacity: 0.7; }
.seal > span { position: relative; padding-left: 0.06em; text-align: center; }

[data-tone="done"] { --seal-c: var(--seal-done); }
[data-tone="fail"] { --seal-c: var(--seal-fail); }
[data-tone="review"] { --seal-c: var(--seal-review); }
[data-tone="done"] > .seal, [data-tone="fail"] > .seal, [data-tone="review"] > .seal { visibility: visible; opacity: 0.94; }
[data-tone="fail"] > .seal, [data-tone="review"] > .seal { animation: seal-settle 260ms var(--ease-out) both; }
/* 完成才"盖下去"：这是整个页面唯一一次稀有的庆祝 */
[data-tone="done"] > .seal { animation: seal-stamp 440ms var(--ease-out) both; }
[data-tone="done"] .voucher-face { animation: stamp-thump 280ms var(--ease-out) 200ms both; }

@keyframes seal-stamp {
  0% { opacity: 0; transform: rotate(-22deg) scale(1.7); }
  55% { opacity: 0.94; transform: rotate(-9deg) scale(0.94); }
  100% { opacity: 0.94; transform: rotate(-9deg) scale(1); }
}
@keyframes seal-settle {
  from { opacity: 0; transform: rotate(-9deg) scale(1.12); }
  to { opacity: 0.94; transform: rotate(-9deg) scale(1); }
}
@keyframes stamp-thump {
  0% { transform: scale(1); }
  35% { transform: scale(0.99); }
  100% { transform: scale(1); }
}
@keyframes seal-fade { from { opacity: 0; } to { opacity: 0.94; } }

/* ── 印章冲击波 + 墨点迸溅 ── */
.seal-ring, .seal-burst { position: absolute; inset: 0; pointer-events: none; }
.seal-ring {
  border-radius: 50%; border: 2px solid currentColor; opacity: 0;
}
[data-tone="done"] > .seal .seal-ring { animation: ring-out 520ms var(--ease-out) 140ms both; }
@keyframes ring-out {
  0%   { opacity: 0.9; transform: scale(1); }
  100% { opacity: 0;   transform: scale(1.65); }
}
.seal-burst i {
  position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px;
  border-radius: 50%; background: currentColor; opacity: 0;
}
[data-tone="done"] > .seal .seal-burst i { animation: burst 460ms var(--ease-out) 180ms both; }
@keyframes burst {
  0%   { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--bx), var(--by)) scale(0.4); }
}
/* 8 粒墨点向 8 个方向飞散（方向写死：这是装饰层，纯 CSS） */
[data-tone="done"] > .seal .seal-burst i:nth-child(1) { --bx:  34px; --by:   0px; }
[data-tone="done"] > .seal .seal-burst i:nth-child(2) { --bx:  24px; --by:  24px; }
[data-tone="done"] > .seal .seal-burst i:nth-child(3) { --bx:   0px; --by:  34px; }
[data-tone="done"] > .seal .seal-burst i:nth-child(4) { --bx: -24px; --by:  24px; }
[data-tone="done"] > .seal .seal-burst i:nth-child(5) { --bx: -34px; --by:   0px; }
[data-tone="done"] > .seal .seal-burst i:nth-child(6) { --bx: -24px; --by: -24px; }
[data-tone="done"] > .seal .seal-burst i:nth-child(7) { --bx:   0px; --by: -34px; }
[data-tone="done"] > .seal .seal-burst i:nth-child(8) { --bx:  24px; --by: -24px; }

/* 结果只保留一个最终图标，避免勾和叉同时可见 */
.result-hero .icon-check,
.result-hero .icon-cross { opacity: 0; }
.result-hero[data-tone="done"] .icon-check,
.result-hero[data-tone="fail"] .icon-cross { opacity: 1; }
.result-message {
  min-height: 1.4em; margin: 0 0 18px; color: var(--ink-2); font-size: 14px;
}
.result-message:empty { display: none; }
/* ---------- 结果横幅：大图标 + 标题 + 套餐 ---------- */
.result-hero {
  display: flex; align-items: center; gap: 18px;
  margin: -4px 0 20px; padding: 18px 20px;
  border-radius: var(--radius-m); background: var(--sky-soft);
  transition: background-color 300ms ease;
}
.result-hero[data-tone="done"]  { background: var(--jade-soft); }
.result-hero[data-tone="fail"]  { background: var(--rose-soft); }
.result-hero[data-tone="review"]{ background: var(--amber-soft); }

.result-icon {
  position: relative; width: 52px; height: 52px; flex: none;
  display: grid; place-items: center;
}
.result-icon svg { position: absolute; inset: 0; width: 52px; height: 52px; fill: none; stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; }
.result-icon circle { r: 24; }
.icon-check  { stroke: var(--jade-ink); }
.icon-cross  { stroke: var(--rose-ink); }
.activation-orbit { display: none; width: 48px; height: 48px; position: relative; color: var(--jade-ink); }
.result-hero[data-tone="proc"] .activation-orbit { display: block; }
.activation-orbit::before {
  content: ""; position: absolute; inset: 0; border: 3px solid var(--jade-soft);
  border-top-color: currentColor; border-right-color: currentColor; border-radius: 50%;
  animation: activation-orbit 1.2s linear infinite;
}
.activation-orbit::after {
  content: ""; position: absolute; inset: 19px; border-radius: 50%; background: currentColor;
}
@keyframes activation-orbit { to { transform: rotate(360deg); } }
.processing-caption { display: none; }
.result-hero[data-tone="proc"] .processing-caption { display: block; }
/* 保留读屏状态，视觉上以光环代替固定标题。 */
.result-hero[data-tone="proc"] #result-hero-title {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
html[data-page-hidden="true"] .activation-orbit::before { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) {
  .activation-orbit::before { animation: none; }
  .result-hero[data-tone="proc"] #result-hero-title {
    position: static; width: auto; height: auto; margin: 0; overflow: visible; clip-path: none;
  }
}

/* 完成时：圆 + 勾依次描边（stroke-dashoffset），这是醒目提示的核心 */
.result-hero[data-tone="done"] .icon-check circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw 380ms var(--ease-out) 60ms forwards; }
.result-hero[data-tone="done"] .icon-check path   { stroke-dasharray: 34;  stroke-dashoffset: 34;  animation: draw 260ms var(--ease-out) 340ms forwards; }
/* 失败时：圆 + 叉描边 */
.result-hero[data-tone="fail"] .icon-cross circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw 380ms var(--ease-out) 60ms forwards; }
.result-hero[data-tone="fail"] .icon-cross path   { stroke-dasharray: 48;  stroke-dashoffset: 48;  animation: draw 260ms var(--ease-out) 340ms forwards; }
/* 处理中：只显示脉冲点 */
.result-hero:not([data-tone="done"], [data-tone="fail"]) .icon-check,
.result-hero:not([data-tone="done"], [data-tone="fail"]) .icon-cross { opacity: 0; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.result-hero-text h2 { font-size: 20px; margin: 0; }
.result-hero-text p { margin-top: 2px; font-size: 14px; color: var(--ink-2); }
.result-hero[data-tone="done"] .result-hero-text h2 { color: var(--jade-ink); }
.result-hero[data-tone="fail"] .result-hero-text h2 { color: var(--rose-ink); }
.result-hero[data-tone="review"] .result-hero-text h2 { color: var(--amber-ink); }

/* ── 步骤条 ── */
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 20px; padding: 0; }
.step { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; font-size: 14px; color: var(--ink-3); }
.step-dot {
  position: relative; z-index: 1; width: 28px; height: 28px; flex: none; display: grid; place-items: center;
  border-radius: 50%; border: 2px solid var(--line-strong); background: var(--paper);
  font-size: 13px; font-weight: 700; color: var(--ink-3);
  transition: background-color 240ms ease, border-color 240ms ease, color 240ms ease;
}
.step-label { font-weight: 600; transition: color 240ms ease; }
.step-line { position: absolute; top: 13px; left: 36px; right: 8px; height: 2px; background: var(--line); overflow: hidden; }
.step-line::after {
  content: ""; position: absolute; inset: 0; background: var(--jade);
  transform: scaleX(0); transform-origin: left; transition: transform 320ms var(--ease-in-out);
}
.step.active { color: var(--ink); }
.step.active .step-dot { border-color: var(--jade); color: var(--jade-ink); background: var(--jade-soft); }
.step.done .step-dot { background: var(--jade); border-color: var(--jade); color: var(--on-jade); }
.step.done .step-label { color: var(--ink-2); }
.step.done .step-line::after { transform: scaleX(1); }

/* ── 面板 ── */
.panel-step { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.panel-step h2 { font-size: 20px; margin-bottom: 16px; }
.panel-step h3, .results h3, .ticket h3 { font-size: 15px; margin: 24px 0 12px; }
.lead { color: var(--ink-2); max-width: 56ch; margin: -6px 0 20px; }

/* ── 表单 ── */
.field { margin-bottom: 4px; }
.field > label { display: block; margin-bottom: 8px; font-weight: 600; }

input[type="text"], textarea, select {
  width: 100%; min-height: 48px; padding: 11px 14px;
  font-size: 16px; /* 低于 16px 时 iOS 会放大页面 */
  background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius-m);
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
input[type="text"] { font-family: var(--mono); letter-spacing: 0.02em; }
textarea { font-family: var(--mono); font-size: 16px; line-height: 1.5; resize: vertical; min-height: 128px; }
input::placeholder, textarea::placeholder { color: var(--ink-3); font-family: var(--sans); letter-spacing: 0; }
input[type="text"]:focus, textarea:focus, select:focus {
  outline: none; background: var(--surface); border-color: var(--jade);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--jade) 24%, transparent);
}
input:disabled, textarea:disabled { opacity: 0.55; }

.field-hint { margin-top: 8px; font-size: 13px; color: var(--ink-2); max-width: 60ch; }
.field-status { margin-top: 8px; font-size: 14px; color: var(--ink-2); }
.field-error {
  margin-top: 10px; padding: 10px 14px; font-size: 14px; border-radius: var(--radius-s);
  background: var(--rose-soft); color: var(--rose-ink);
}
.field-error:empty { display: none; }
.field-error[hidden], .field-status[hidden] { display: none; }

.field-check { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 4px; }
.field-check label { font-weight: 500; margin: 0; cursor: pointer; }
.field-check input, .check-line input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--jade); }
.check-line { display: flex; align-items: center; gap: 10px; margin: 16px 0 4px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check-line input { margin: 0; }

/* ── 按钮 ── */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 20px; }
.actions-inline { margin-top: 12px; }
.actions-split { justify-content: space-between; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border: 1px solid transparent; border-radius: var(--radius-m);
  font-size: 16px; font-weight: 600; line-height: 1.2; cursor: pointer;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, opacity 160ms ease;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary { background: var(--jade); color: var(--on-jade); }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-quiet { background: transparent; color: var(--ink-2); padding: 0 14px; }
.btn-small { min-height: 44px; padding: 0 16px; font-size: 14px; }
.btn:disabled { background: var(--surface-2); border-color: var(--line); color: var(--ink-3); cursor: not-allowed; }
.btn[hidden] { display: none; }

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--jade) 88%, var(--ink)); }
  .btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--ink-3); }
  .btn-quiet:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
}

/* ── 摘要、提示、状态 ── */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin: 0 0 20px; }
.summary > div { padding: 12px 14px; border-radius: var(--radius-m); background: var(--surface-2); }
.summary dt { font-size: 13px; color: var(--ink-2); }
.summary dd { margin: 2px 0 0; font-weight: 600; word-break: break-all; }

.alert { margin: 0 0 20px; padding: 12px 16px; border-radius: var(--radius-m); font-size: 14px; }
.alert-warn { background: var(--amber-soft); color: var(--amber-ink); }
.alert[hidden] { display: none; }

.status-line { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 0 0 8px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px; min-height: 28px; padding: 2px 12px;
  border-radius: 999px; background: var(--surface-2); color: var(--ink-2);
  font-size: 13px; font-weight: 600; white-space: nowrap;
  transition: background-color 240ms ease, color 240ms ease;
}
.status-pill.success { background: var(--jade-soft); color: var(--jade-ink); }
.status-pill.fail { background: var(--rose-soft); color: var(--rose-ink); }
.status-pill.warning { background: var(--amber-soft); color: var(--amber-ink); }
.status-pill.neutral { background: var(--surface-2); color: var(--ink-2); }
.status-pill.processing { background: var(--sky-soft); color: var(--sky-ink); }
.status-pill.processing::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  animation: pulse 1.3s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* 时间线：竖线串起节点，最后一项（当前）用玉绿 */
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; }
.timeline li { position: relative; padding: 0 0 18px 24px; }
.timeline li::before {
  content: ""; position: absolute; left: 0; top: 0.5em; width: 10px; height: 10px; border-radius: 50%;
  background: var(--line-strong); box-shadow: 0 0 0 3px var(--surface);
}
.timeline li::after { content: ""; position: absolute; left: 4px; top: calc(0.5em + 10px); bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline li:last-child::before { background: var(--jade); }
.timeline strong { display: block; font-size: 15px; font-weight: 600; }
.timeline span { display: block; font-size: 13px; color: var(--ink-2); }

/* ── 查询结果：缩小版凭证 ── */
.ticket {
  position: relative; margin-top: 28px; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface);
  --seal-done: var(--jade-ink); --seal-fail: var(--rose-ink); --seal-review: var(--amber-ink);
  --band: var(--line-strong);
}
.ticket[hidden] { display: none; }
.ticket[data-tone="done"] { --band: var(--jade); }
.ticket[data-tone="fail"] { --band: var(--rose-ink); }
.ticket[data-tone="review"] { --band: var(--amber-ink); }
.ticket[data-tone="proc"] { --band: var(--sky-ink); }
/* 打孔边：圆孔取纸面色 */
.ticket-band {
  height: 14px; background-color: var(--band);
  background-image: radial-gradient(circle at 7px 50%, var(--paper) 0 3px, transparent 3.5px);
  background-size: 14px 100%;
}
.ticket-body { padding: 22px 24px 24px; }
.ticket-body h2 { font-size: 20px; margin-bottom: 14px; }
.ticket-body .status-line { margin-bottom: 16px; }
.ticket-body .summary { margin-bottom: 0; }
.seal-ticket { top: 30px; right: 22px; width: 64px; height: 64px; font-size: 14px; }

/* ── 批量查询 ── */
.progress { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-fill { width: 100%; height: 100%; border-radius: inherit; background: var(--jade); transform: scaleX(0); transform-origin: left; transition: transform 300ms linear; }

.results { margin-top: 32px; }
.results-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; }
.results-head h2 { font-size: 20px; }
.filter-label { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.filter-label select { width: auto; min-width: 132px; background: var(--surface); }

.table-wrap { margin-top: 16px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.batch-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.batch-table th, .batch-table td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.batch-table th { font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; background: var(--surface-2); }
.batch-table tr:last-child td { border-bottom: 0; }
.batch-table td:first-child { font-family: var(--mono); font-size: 13px; word-break: break-all; }
.batch-table td { word-break: break-word; }
.batch-table .empty-row { padding: 28px; text-align: center; color: var(--ink-2); font-family: var(--sans); }

/* ── 帮助 ── */
.faq { border-top: 1px solid var(--line); }
details { border-bottom: 1px solid var(--line); }
summary {
  position: relative; display: flex; align-items: center; min-height: 56px; padding: 0 36px 0 0;
  font-weight: 600; cursor: pointer; list-style: none;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: ""; position: absolute; right: 6px; top: 50%; width: 9px; height: 9px; margin-top: -7px;
  border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3);
  transform: rotate(45deg); transition: transform 200ms var(--ease-out);
}
details[open] summary::after { transform: rotate(225deg); margin-top: -2px; }
details > p { padding: 0 0 8px; color: var(--ink-2); max-width: 62ch; }
details > .btn { margin: 4px 0 18px; }
details > p:last-child { padding-bottom: 20px; }
code { padding: 1px 6px; border-radius: 6px; background: var(--surface-2); font: 13px var(--mono); word-break: break-all; }

/* ── 对话框 ── */
.modal-mask {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(6, 14, 24, 0.5);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  opacity: 1; transition: opacity 200ms var(--ease-out), display 200ms allow-discrete;
}
.modal-mask[hidden] { display: none; opacity: 0; }
.modal {
  width: 100%; max-width: 480px; max-height: 85dvh; overflow-y: auto; overscroll-behavior: contain;
  padding: 24px; border-radius: var(--radius-l); background: var(--surface);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.5);
  transition: transform 220ms var(--ease-out); /* 对话框不挂在触发按钮上，保持居中缩放 */
}
.modal-mask[hidden] .modal { transform: scale(0.96); }
.modal h2 { font-size: 20px; margin-bottom: 14px; }
.modal-steps { margin: 0 0 8px; padding-left: 22px; color: var(--ink-2); }
.modal-steps li + li { margin-top: 6px; }
.modal .field-hint { margin-top: 14px; }

/* ── 入场：只回应用户的操作（切页、换步、出错），不做装饰性入场 ── */
@starting-style {
  .view { opacity: 0; transform: translateY(var(--enter-y)); }
  .panel-step { opacity: 0; transform: translateX(var(--enter-x)); }
  .redeem-main[data-dir="back"] .panel-step { transform: translateX(calc(var(--enter-x) * -1)); }
  .field-error, .alert, .ticket { opacity: 0; transform: translateY(-4px); }
  .modal-mask { opacity: 0; }
  .modal-mask .modal { transform: scale(0.96); }
}
.view, .panel-step, .field-error, .alert, .ticket { transition: opacity 220ms var(--ease-out), transform 220ms var(--ease-out); }

/* ── 窄屏：底部标签栏、凭证压缩、主按钮置底 ── */
@media (max-width: 860px) {
  :root { --chrome-h: 56px; }
  .chrome { padding: 0 max(16px, env(safe-area-inset-left)); }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; width: auto;
    padding: 6px max(8px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    -webkit-backdrop-filter: blur(18px) saturate(170%); backdrop-filter: blur(18px) saturate(170%);
  }
  .tabs a { flex-direction: column; gap: 3px; min-height: 52px; font-size: 12px; }
  .tab-indicator { top: 6px; bottom: calc(6px + env(safe-area-inset-bottom)); }
  .tab-indicator::before { inset: 0 6px; }

  .page { padding: 24px 16px calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom)); }
  .page-head { margin-bottom: 20px; }
  .redeem-grid { grid-template-columns: 1fr; gap: 20px; }
  .voucher { position: relative; top: 0; }
  .voucher-face { min-height: 140px; padding: 18px 18px 16px; gap: 14px; }
  .voucher-stub { padding: 14px 18px 16px; }
  .voucher-fields { grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 12px; }
  .panel-step { padding: 20px 18px; }
  .step-label { font-size: 12px; }
  .step-line { left: 34px; right: 6px; }

  .actions .btn-primary { flex: 1 1 100%; }
  .actions-split { flex-direction: column-reverse; align-items: stretch; }
  .actions-split .btn { width: 100%; }
  .actions-inline .btn { flex: 1 1 auto; }

  .table-wrap { border: 0; background: none; overflow: visible; }
  .batch-table, .batch-table tbody, .batch-table tr, .batch-table td { display: block; width: 100%; }
  .batch-table thead { display: none; }
  .batch-table tr { margin-bottom: 10px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
  .batch-table td { padding: 3px 0; border: 0; }
  .batch-table td[data-label]::before { content: attr(data-label) "\FF1A"; margin-right: 6px; color: var(--ink-2); font: 13px var(--sans); }
  .batch-table td:first-child { font-size: 14px; margin-bottom: 4px; }
  .batch-table .empty-row::before { content: none; }
}

@media (max-width: 420px) {
  .voucher-plan { font-size: 21px; }
  .summary { grid-template-columns: 1fr; }
}

/* ── 偏好：减少动态 / 减少透明 / 高对比 ── */
@media (prefers-reduced-motion: reduce) {
  :root { --enter-y: 0px; --enter-x: 0px; }
  .tab-indicator, .step-line::after { transition: none; }
  [data-tone="done"] > .seal, [data-tone="fail"] > .seal, [data-tone="review"] > .seal { animation: seal-fade 200ms ease both; }
  [data-tone="done"] .voucher-face { animation: none; }
  .status-pill.processing::before { animation: none; }
  .voucher[data-tone="proc"] .voucher-face::after { animation: none; opacity: 0; }
  .seal-ring, .seal-burst i { animation: none !important; opacity: 0 !important; }
  .result-hero .icon-check circle, .result-hero .icon-check path,
  .result-hero .icon-cross circle, .result-hero .icon-cross path { animation: none; stroke-dashoffset: 0; }
  .modal-mask[hidden] .modal, .modal { transform: none; }
  .btn:active:not(:disabled), .tabs a:active { transform: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .chrome::before { background: var(--paper); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .tabs { background: var(--surface); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .modal-mask { -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --line: var(--ink-3); --line-strong: var(--ink-2); }
}
