:root {
  --paper: #f5f2e8;
  --paper-2: #e7ebda;
  --card: #fcfbf5;
  --ink: #263d2d;
  --ink-2: #59634f;
  --ink-3: #717761;
  --rule: #d7dccb;
  --seal: #365b42;
  --seal-ink: #f4f1e6;
  --focus: #2f5d8a;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --radius: 18px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12140f;
    --paper-2: #1a1d15;
    --card: #181b13;
    --ink: #e7ead9;
    --ink-2: #b3b7a2;
    --ink-3: #80846d;
    --rule: #2e3226;
    --seal: #3f8f68;
    --seal-ink: #f4f1e6;
    --focus: #7fb0e0;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 50% 20%, var(--card), transparent 65%), var(--paper);
  color: var(--ink);
  font: 16px/1.7 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
button, textarea, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.motif-library { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }

.top {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 920px; width: 100%; margin: 0 auto; padding: 26px 24px 18px;
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.seal {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 12px 12px 12px 4px;
  background: var(--seal); color: var(--seal-ink); font: 700 18px/1 var(--serif);
}
.brand-name { font: 600 18px/1 var(--serif); letter-spacing: .04em; }
.seal svg { width: 27px; height: 27px; }
.top-nav { display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--ink-2); }
.top-nav a { text-decoration: none; }
.top-nav a:hover { color: var(--ink); }
.lang {
  border: 1px solid var(--rule); background: transparent; border-radius: 999px;
  padding: 2px 10px; font-size: 13px; cursor: pointer; color: var(--ink-2);
}

.sheet { flex: 1; max-width: 680px; width: 100%; margin: 0 auto; padding: 16px 16px 48px; }

.hero-art { position: relative; height: 184px; margin: 28px 0 0; }
.master-portrait { position: relative; display: block; width: 200px; height: 180px; margin: 0 auto; color: var(--seal); }
.portrait-halo { fill: var(--paper-2); }
.portrait-orbit { fill: none; stroke: var(--seal); stroke-width: .8; opacity: .4; }
.hero-shell { --shell-fill: var(--seal); --shell-line: var(--paper-2); }
.bamboo { position: absolute; width: 160px; height: 190px; color: var(--seal); opacity: .22; pointer-events: none; }
.bamboo-left { left: 8px; top: -12px; transform: rotate(12deg); }
.bamboo-right { right: 8px; top: 14px; transform: scaleX(-1) rotate(12deg); }

.hero h1 {
  text-align: center;
  font: 600 clamp(28px, 6vw, 40px)/1.4 var(--serif); margin: 20px 0 32px; letter-spacing: .01em;
  text-wrap: balance;
}

.composer {
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px;
  box-shadow: 0 8px 30px #263d2d05;
}
.composer:focus-within { border-color: var(--seal); }
.composer-host { display: flex; align-items: center; gap: 10px; margin: -6px 0 14px; padding-bottom: 14px; border-bottom: 1px solid var(--rule); color: var(--ink-2); font-size: 13px; text-wrap: pretty; }
.shifu-icon { width: 40px; height: 40px; object-fit: contain; flex-shrink: 0; }
.paw-icon { width: 18px; height: 18px; flex-shrink: 0; }
.composer .btn.primary { display: inline-flex; align-items: center; justify-content: center; gap: 12px; }
.composer textarea {
  width: 100%; border: 0; background: transparent; resize: vertical; min-height: 96px;
  font: 17px/1.7 var(--serif); outline: none;
}
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.hint { color: var(--ink-3); font-size: 13px; }

.btn {
  border: 1px solid var(--rule); background: var(--card); border-radius: 999px;
  padding: 8px 18px; cursor: pointer; font-size: 15px; white-space: nowrap;
  transition: transform .06s ease, background .15s ease;
}
.btn:hover { background: var(--paper-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--seal); color: var(--seal-ink); border-color: var(--seal); }
.btn.primary:hover { opacity: .9; }
.btn.seal-btn { background: var(--seal); color: var(--seal-ink); border-color: var(--seal); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--ink-2); text-decoration: underline; padding: 8px 6px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.steps { list-style: none; padding: 0; margin: 40px 0 0; display: grid; gap: 16px; counter-reset: s; }
.steps li { display: grid; grid-template-columns: 28px 1fr; column-gap: 12px; counter-increment: s; }
.steps li::before {
  content: counter(s); grid-row: span 2; font: 600 15px/28px var(--serif); text-align: center;
  border: 1px solid var(--rule); border-radius: 50%; width: 28px; height: 28px; color: var(--ink-2);
}
.steps strong { font-family: var(--serif); font-weight: 600; }
.steps span { color: var(--ink-2); font-size: 14px; }

/* conversation */
.thread { display: flex; flex-direction: column; gap: 14px; margin: 16px 0 20px; }
.msg { max-width: 88%; }
.msg .who { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-3); margin-bottom: 6px; letter-spacing: .05em; }
.msg .who .shifu-icon { width: 28px; height: 28px; }
.msg .bubble { padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; text-align: left; }
.msg.user .who { justify-content: flex-end; }
.msg.user .bubble { background: var(--ink); color: var(--paper); border-bottom-right-radius: 4px; }
.msg.assistant .bubble { background: var(--card); border: 1px solid var(--rule); border-bottom-left-radius: 4px; }

.working { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-family: var(--serif); margin: 8px 0; }
.dots span { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--ink-3); margin-right: 3px; animation: blink 1.2s infinite; }
.dots span:nth-child(2) { animation-delay: .2s; } .dots span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* master card */
.master {
  position: relative; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 28px 22px 22px; margin: 24px 0 16px; overflow: hidden;
}
.master .eyebrow { font-size: 12px; letter-spacing: .12em; color: var(--ink-3); margin: 0 0 14px; }
.master .stamp {
  position: absolute; top: 18px; right: 18px; width: 44px; height: 44px; border-radius: 6px;
  background: var(--seal); color: var(--seal-ink); display: grid; place-items: center;
  font: 700 22px/1 var(--serif); transform: rotate(-6deg); opacity: .92;
}
.stamp svg { width: 32px; height: 32px; }
.verdict { font: 600 clamp(22px, 5vw, 30px)/1.45 var(--serif); margin: 0 56px 12px 0; text-wrap: balance; }
.why { font: 17px/1.8 var(--serif); color: var(--ink-2); margin: 0 0 20px; }
.where { border-top: 1px solid var(--rule); padding-top: 14px; display: grid; gap: 6px; font-size: 14px; color: var(--ink-2); }
.where b { color: var(--ink); font-weight: 600; }
.quote {
  margin: 10px 0 0; padding: 10px 14px; border-left: 3px solid var(--seal);
  background: var(--paper-2); font: italic 15px/1.7 var(--serif); color: var(--ink);
}

.locked .lines { display: grid; gap: 10px; margin: 6px 0 20px; filter: blur(0.5px); }
.locked .lines i { display: block; height: 14px; border-radius: 4px; background: var(--paper-2); }
.locked .lines i:nth-child(1) { width: 78%; height: 22px; } .locked .lines i:nth-child(2) { width: 92%; } .locked .lines i:nth-child(3) { width: 56%; }
.paybar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.fine { color: var(--ink-3); font-size: 13px; margin: 10px 0 0; }

.after { border: 1px dashed var(--rule); border-radius: var(--radius); padding: 16px; margin: 16px 0; }
.after h3 { font: 600 16px/1.4 var(--serif); margin: 0 0 8px; }
.after p { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.after textarea { width: 100%; border: 1px solid var(--rule); background: var(--card); border-radius: 8px; padding: 8px 10px; margin: 0 0 10px; min-height: 64px; }
.status-pill { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); }

/* lists */
.list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; }
.list li { background: var(--card); padding: 12px 14px; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.list a { text-decoration: none; }
.list .t { font-family: var(--serif); }
.list .m { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
h2.page { font: 600 24px/1.4 var(--serif); margin: 28px 0 4px; }
.sub { color: var(--ink-2); margin: 0 0 8px; }
.error { color: var(--seal); font-size: 14px; }

.foot { max-width: 680px; width: 100%; margin: 0 auto; padding: 16px; color: var(--ink-3); font-size: 12px; text-align: center; }
.foot p { margin: 2px 0; }

.mock-pay .sheet { max-width: 420px; text-align: center; padding-top: 80px; }
.mock-pay .amount { font: 600 40px/1.2 var(--serif); margin: 12px 0 24px; }
.mock-pay .eyebrow { color: var(--ink-3); font-size: 13px; letter-spacing: .1em; }

@media (max-width: 480px) {
  .top { padding: 18px 16px 14px; gap: 12px; flex-wrap: wrap; }
  .brand-name { font-size: 16px; }
  .top-nav { gap: 12px; font-size: 12px; margin-left: auto; }
  .seal { width: 30px; height: 30px; }
  .brand { gap: 7px; }
  .sheet { padding-top: 8px; }
  .hero-art { margin-top: 20px; height: 162px; }
  .master-portrait { width: 180px; height: 162px; }
  .bamboo { width: 94px; height: 130px; opacity: .18; }
  .bamboo-left { left: 0; top: 12px; }
  .bamboo-right { right: 0; top: 30px; }
  .composer { padding: 16px; }
  .composer-row { align-items: flex-end; }
  .composer-row .hint { max-width: 45%; font-size: 12px; }
  .composer-row .btn { padding: 8px 13px; }
  .list li { flex-wrap: wrap; gap: 4px; }
  .list .t, .list .m { min-width: 0; overflow-wrap: anywhere; white-space: normal; }
  .master { padding: 24px 16px 18px; }
  .msg { max-width: 94%; }
}
@media (prefers-reduced-motion: reduce) { .dots span { animation: none; opacity: .6; } }
