/* 对了 · 成契流程原型
   设计单源：design/inpact-ux.md
   朱色只在「已入账」出现；草稿与校验中一律黑白灰。 */

:root {
  --ink: #1a1a1a;
  --muted: #6b6b6b;
  --faint: #9a9a9a;
  --line: #e2e2e2;
  --paper: #fff;
  --bg: #f4f4f2;
  --vermilion: #b4432f;

  --instant: 100ms;
  --quick: 180ms;
  --move: 280ms;
  --settle: 420ms;
  --ease: cubic-bezier(.2, .6, .2, 1);
  --ease-enter: cubic-bezier(.16, 1, .3, 1);
  --ease-settle: cubic-bezier(.34, 1.2, .34, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0 0 64px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Source Han Sans SC", "Noto Sans CJK SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 560px; margin: 0 auto; padding: 0 20px; }

/* ── 样张提示条 ── */
.band {
  background: #fff8e1;
  border-bottom: 1px solid #ecd9a0;
  color: #5a4a00;
  font-size: 13.5px;
  line-height: 1.75;
  padding: 11px 0;
  transition: opacity var(--quick) var(--ease);
}
.band b { font-weight: 600; }
.band[hidden] { display: none; }
.band-x {
  margin-left: 6px;
  border: 0;
  background: none;
  color: #8a7400;
  font: inherit;
  font-size: 12.5px;
  text-decoration: underline;
  cursor: pointer;
  padding: 2px 4px;
}

/* ── 视图切换 ── */
.view { display: none; }
.view.is-active { display: block; animation: view-in var(--move) var(--ease-enter) both; }

@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ── 选边 ── */
.intro { padding: 40px 0 0; }

.brand { font-size: 13px; letter-spacing: .36em; color: var(--muted); }

h1 {
  margin: 12px 0 0;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: -.015em;
}

.lede {
  margin: 14px 0 0;
  font-size: 16.5px;
  line-height: 1.9;
  color: #3a3a3a;
}

.intro h1, .intro .lede { transition: opacity var(--quick) var(--ease); }
/* 选中那一侧升为页首标题：换的是内容，不是位置——比硬做位移更说明「我站这边」 */
.intro.is-lifted h1 { animation: fill-in var(--move) var(--ease-enter) both; letter-spacing: .1em; }
.intro.is-lifted .lede { animation: fill-in var(--move) var(--ease-enter) both; animation-delay: 60ms; }

.sides { margin-top: 32px; display: flex; flex-direction: column; gap: 12px; }
.sides[hidden] { display: none; }

.side-card {
  display: block;
  width: 100%;
  text-align: left;
  padding: 26px 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2px;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: transform var(--instant) linear, border-color var(--quick) var(--ease);
}
.side-card:active { transform: scale(.985); }
.side-card:hover { border-color: #c8c8c8; }

.side-label { display: block; font-size: 23px; font-weight: 600; letter-spacing: .16em; }
.side-hint { display: block; margin-top: 9px; font-size: 14px; color: var(--faint); line-height: 1.7; }

/* 选边升位：未选中退场，选中的由 JS 用 FLIP 移到页首 */
.side-card.is-out {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--quick) var(--ease), transform var(--quick) var(--ease);
  pointer-events: none;
}
.side-card.is-flying { transition: transform var(--move) var(--ease-enter); z-index: 2; position: relative; }

/* ── 本人 / 代人 ── */
.who { margin-top: 30px; animation: view-in var(--move) var(--ease-enter) both; }
.who-q { font-size: 17px; font-weight: 500; }
.who-opts { margin-top: 14px; display: flex; gap: 10px; flex-wrap: wrap; }

.chip {
  padding: 12px 20px;
  min-height: 44px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2px;
  font: inherit;
  font-size: 15.5px;
  color: inherit;
  cursor: pointer;
  transition: transform var(--instant) linear, border-color var(--quick) var(--ease), background var(--quick) var(--ease);
}
.chip:active { transform: scale(.97); }
.chip:hover { border-color: #bdbdbd; }
.chip.is-on { background: var(--ink); border-color: var(--ink); color: #fff; }

.who-note { margin: 14px 0 0; font-size: 13.5px; line-height: 1.8; color: var(--faint); }

/* ── 面包屑 ── */
.side-crumb {
  padding: 26px 0 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 13px;
  letter-spacing: .28em;
  color: var(--muted);
}
.crumb-who { letter-spacing: 0; font-size: 12.5px; color: var(--faint); }

/* ── 契卡：主进度指示 ── */
.pact {
  margin-top: 18px;
  background: var(--paper);
  border: 1px dashed #d2d2d2;
  border-radius: 2px;
  padding: 20px 20px 8px;
  position: relative;
  transition: border-color var(--move) var(--ease);
}
.pact.is-applied { border-style: solid; border-color: var(--ink); }

.pact-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.pact-state { font-size: 12.5px; letter-spacing: .28em; color: var(--faint); transition: color var(--quick) var(--ease); }
.pact.is-applied .pact-state { color: var(--vermilion); }
.pact-id {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  color: var(--faint);
}

.fields { margin: 0; }

.field {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 12px;
  align-items: baseline;
  padding: 13px 0 13px 12px;
  border-left: 2px dashed #dcdcdc;
  margin: 4px 0;
  opacity: .5;
  transition: opacity var(--quick) var(--ease), border-color var(--quick) var(--ease);
}
.field.is-filled { opacity: 1; border-left-style: solid; border-left-color: var(--ink); }
/* premise 是这个产品的分水岭，填上之后加重 */
.field.is-key.is-filled { border-left-width: 3px; }

.field dt { margin: 0; font-size: 13px; color: var(--muted); }
.field dd { margin: 0; font-size: 16px; line-height: 1.8; }
.field.is-empty dd::before {
  content: attr(data-placeholder);
  color: #bfbfbf;
  font-size: 14.5px;
}
.field.is-filled dd { animation: fill-in var(--quick) var(--ease-enter) both; }

@keyframes fill-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* 未过闸时被门闸点名的那一栏 */
.field.is-blocked { opacity: 1; border-left-color: var(--ink); border-left-style: solid; }
.field.is-blocked dt { color: var(--ink); font-weight: 600; }

/* ── 朱印：只在 applied 出现 ── */
.seal {
  position: absolute;
  right: 14px;
  bottom: 12px;
  width: 76px;
  height: 76px;
  border: 2px solid var(--vermilion);
  border-radius: 8px;
  color: var(--vermilion);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transform: rotate(-3deg);
  animation: seal-drop var(--settle) var(--ease-settle) both;
}
.seal-top { font-size: 15px; font-weight: 700; letter-spacing: .1em; }
.seal-id { font-family: "SFMono-Regular", Consolas, monospace; font-size: 10.5px; letter-spacing: .02em; }

@keyframes seal-drop {
  from { opacity: 0; transform: scale(1.4) rotate(-10deg); }
  to { opacity: 1; transform: scale(1) rotate(-3deg); }
}

/* ── 对话 ── */
.talk { margin-top: 26px; }

.ask {
  margin: 0;
  font-size: 19px;
  line-height: 1.75;
  font-weight: 500;
  animation: fill-in var(--quick) var(--ease-enter) both;
}

.opts { margin-top: 16px; display: flex; flex-direction: column; gap: 9px; }

.opt {
  text-align: left;
  padding: 15px 18px;
  min-height: 44px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 2px;
  font: inherit;
  font-size: 16px;
  line-height: 1.65;
  color: inherit;
  cursor: pointer;
  transition: transform var(--instant) linear, border-color var(--quick) var(--ease);
  animation: fill-in var(--quick) var(--ease-enter) both;
}
.opt:active { transform: scale(.985); }
.opt:hover { border-color: #c4c4c4; }

.skip {
  margin-top: 14px;
  border: 0;
  background: none;
  padding: 10px 2px;
  font: inherit;
  font-size: 14px;
  color: var(--faint);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ── 底部主操作 ── */
.dock {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: view-in var(--move) var(--ease-enter) both;
}

.act {
  display: block;
  width: 100%;
  text-align: center;
  padding: 17px 20px;
  min-height: 52px;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 2px;
  color: #fff;
  font: inherit;
  font-size: 17px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: transform var(--instant) linear, opacity var(--quick) var(--ease);
}
.act:active { transform: scale(.99); }
.act[disabled] { opacity: .4; cursor: default; }

.act-ghost { background: none; color: var(--ink); border-color: #cfcfcf; }

/* ── 门闸逐条校验 ── */
.gate-title { margin: 24px 0 0; font-size: 24px; font-weight: 600; line-height: 1.5; }
.gate-sub { margin: 10px 0 0; font-size: 15px; line-height: 1.85; color: var(--muted); }

.checks { list-style: none; margin: 26px 0 0; padding: 0; }

.check {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  opacity: .32;
  transition: opacity var(--quick) var(--ease);
}
.check.is-live, .check.is-ok, .check.is-bad { opacity: 1; }

.check-mark {
  width: 20px;
  height: 20px;
  border: 1px solid #cfcfcf;
  border-radius: 50%;
  position: relative;
  margin-top: 2px;
  transition: border-color var(--quick) var(--ease);
}
.check.is-live .check-mark { border-color: var(--ink); animation: pulse var(--quick) var(--ease) infinite alternate; }
.check.is-ok .check-mark { border-color: var(--ink); }
.check.is-ok .check-mark::after {
  content: "";
  position: absolute;
  left: 6px; top: 2px;
  width: 6px; height: 11px;
  border-right: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  transform: rotate(42deg);
  animation: tick var(--quick) var(--ease-enter) both;
}
.check.is-bad .check-mark { border-color: var(--ink); border-width: 2px; }
.check.is-bad .check-mark::after {
  content: "";
  position: absolute;
  left: 8px; top: 3px;
  width: 2px; height: 9px;
  background: var(--ink);
  animation: tick var(--quick) var(--ease-enter) both;
}
.check.is-bad .check-mark::before {
  content: "";
  position: absolute;
  left: 8px; bottom: 3px;
  width: 2px; height: 2px;
  background: var(--ink);
}

@keyframes pulse { from { opacity: .45; } to { opacity: 1; } }
@keyframes tick { from { opacity: 0; transform: rotate(42deg) scale(.5); } to { opacity: 1; } }
/* 竖杠不旋转 */
.check.is-bad .check-mark::after { animation-name: tick-bar; }
@keyframes tick-bar { from { opacity: 0; transform: scaleY(.3); } to { opacity: 1; transform: none; } }

.check-text { font-size: 16px; line-height: 1.7; }
.check-note { display: block; margin-top: 5px; font-size: 13.5px; color: var(--faint); line-height: 1.7; }

/* ── 卡点：就地展开，墨色不红色 ── */
.blocked {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--move) var(--ease-enter);
  margin-top: 8px;
}
.blocked.is-open { grid-template-rows: 1fr; }
.blocked-inner { overflow: hidden; }
.blocked[hidden] { display: none; }

.blocked-h { padding-top: 22px; font-size: 19px; font-weight: 600; }
.blocked p { margin: 10px 0 18px; font-size: 15.5px; line-height: 1.9; color: #3a3a3a; }

/* ── 已入账 ── */
.done { margin-top: 28px; animation: view-in var(--move) var(--ease-enter) both; }
.done[hidden] { display: none; }
.done-h { font-size: 20px; font-weight: 600; color: var(--vermilion); letter-spacing: .04em; }
.done p { margin: 10px 0 20px; font-size: 15.5px; line-height: 1.9; color: #3a3a3a; }
.done-acts { display: flex; flex-direction: column; gap: 10px; }

/* ── 停 ── */
.stopped { margin-top: 26px; animation: view-in var(--move) var(--ease-enter) both; }
.stopped[hidden] { display: none; }
.stopped-h { font-size: 19px; font-weight: 500; line-height: 1.7; }
.stopped .opts { margin-top: 16px; }

.pact.is-stopped { opacity: .62; transform: translateY(3px); transition: opacity var(--move) var(--ease), transform var(--move) var(--ease); }

.talk[hidden] { display: none; }
.dock[hidden] { display: none; }
.act[hidden] { display: none; }
.who[hidden] { display: none; }
.seal[hidden] { display: none; }

.foot {
  margin-top: 46px;
  padding-top: 18px;
  font-size: 12.5px;
  line-height: 1.95;
  color: var(--faint);
}
.foot code { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.foot a { color: var(--muted); }

/* ── 降级：动效不许单独承载信息，关掉后信息一条不少 ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .seal { transform: rotate(-3deg); }
  .check.is-live .check-mark { animation: none; }
}
