@font-face { font-family: 'LiaoMark'; src: url('../fonts/kaushanscript.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Playfair Display'; src: url('../fonts/playfair-display-italic.woff2') format('woff2'); font-style: italic; font-weight: 400; font-display: swap; }

:root {
  --paper: #FBF8F4;
  --bg: var(--paper);
  --bg-2: #F4EFEA;
  --card: #FFFFFF;
  --ink: #141114;
  --ink-2: #4A4448;
  --ink-3: #8A8287;
  --line: #EAE4DF;
  --rose: #FF4D6D;
  --rose-soft: #FFE9EC;
  --butter: #FFE08A;
  --lilac: #7B6CF6;
  --lilac-soft: #EFEDFF;
  --sage: #2E9D6A;
  --sage-soft: #E6F5EE;
  --alert: #D9363E;
  --alert-soft: #FDE9E7;
  /* Compatibility aliases for the existing component styles. */
  --coral: var(--rose);
  --coral-d: #E33E5D;
  --coral-soft: var(--rose-soft);
  --coral-tint: #FFF6F6;
  --blue: var(--lilac);
  --blue-soft: var(--lilac-soft);
  --blue-tint: #F7F5FF;
  --green: var(--sage);
  --green-soft: var(--sage-soft);
  --amber: #C7851B;
  --amber-soft: #FDF3E1;
  --red: var(--alert);
  --red-soft: var(--alert-soft);
  --radius: 24px;
  --shadow: 0 1px 2px rgba(20, 17, 20, .03), 0 12px 30px rgba(56, 43, 50, .055);
  --font: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 17px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.3; letter-spacing: .01em; }
p { margin: 0; }
.en { font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif; letter-spacing: 0; }

/* brand */
.logo { font-family: 'LiaoMark', cursive; font-size: 34px; line-height: 1; color: var(--ink); display: inline-flex; align-items: flex-start; gap: 2px; }
.logo svg { width: 14px; height: 14px; margin-top: -2px; color: var(--coral); }
.hand { font-family: 'Playfair Display', Georgia, serif; font-style: italic; font-weight: 400; color: var(--coral-d); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 24px; border-radius: 999px; border: 0; cursor: pointer; font-weight: 600; font-size: 17px; transition: transform .12s, background .2s, box-shadow .2s, opacity .2s; white-space: nowrap; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 6px 18px rgba(20, 17, 20, .13); }
.btn-primary:hover { background: #342D32; }
.btn-ghost { background: var(--card); border: 1.5px solid var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: #DCCBC1; }
.btn-blue { background: var(--lilac); color: #fff; box-shadow: 0 6px 18px rgba(123, 108, 246, .20); }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: 15px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--bg-2); }
.icon { width: 20px; height: 20px; flex: none; }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); font-size: 15px; cursor: pointer; color: var(--ink-2); transition: all .15s; }
.chip:hover { border-color: #DCCBC1; }
.chip.on { background: var(--coral-soft); border-color: transparent; color: var(--coral-d); font-weight: 600; }
.chip.blue.on { background: var(--blue-soft); color: var(--blue); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--coral-soft); color: var(--coral-d); }
.tag.blue { background: var(--blue-soft); color: var(--blue); }
.tag.green { background: var(--green-soft); color: var(--green); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.red { background: var(--red-soft); color: var(--red); }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.muted { color: var(--ink-3); }
.small { font-size: 15px; }
.tiny { font-size: 13px; }

/* copyable english block */
.say { position: relative; border-radius: 14px; background: var(--bg); padding: 14px 52px 14px 16px; }
.say .en-text { font-size: 17px; line-height: 1.55; color: var(--ink); }
.say .zh-text { margin-top: 6px; font-size: 15px; color: var(--ink-3); }
.say .copy { position: absolute; top: 8px; right: 8px; }
.copy.done { color: var(--green); }

/* form */
.field { display: grid; gap: 6px; }
.field label { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.field .hint { font-size: 13px; color: var(--ink-3); }
.input, .textarea, .select { width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 14px; font-size: 17px; outline: none; transition: border .15s, box-shadow .15s; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--coral); box-shadow: 0 0 0 4px rgba(238, 93, 108, .12); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.grid2 { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }

/* before/after compare */
.compare { position: relative; overflow: hidden; border-radius: 16px; aspect-ratio: 3 / 4; background: var(--bg-2); user-select: none; touch-action: pan-y; }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare .after { clip-path: inset(0 0 0 var(--pos, 50%)); }
.compare .bar { position: absolute; top: 0; bottom: 0; left: var(--pos, 50%); width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 8px rgba(0,0,0,.25); pointer-events: none; }
.compare .knob { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.2); display: grid; place-items: center; color: var(--ink-2); }
.compare .lbl { position: absolute; bottom: 12px; padding: 4px 12px; border-radius: 999px; background: rgba(31,26,28,.6); color: #fff; font-size: 13px; backdrop-filter: blur(6px); }
.compare .lbl.l { left: 12px; } .compare .lbl.r { right: 12px; background: rgba(238,93,108,.85); }
.compare input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }

/* toast + loading */
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: rgba(31,26,28,.92); color: #fff; padding: 12px 20px; border-radius: 14px; font-size: 15px; opacity: 0; transition: all .25s; z-index: 100; pointer-events: none; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.dots { display: inline-flex; gap: 5px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .3; animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.fade-in { animation: fadeIn .4s ease both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* analysis blocks (shared by demo + app) */
.insight { display: grid; gap: 12px; }
.insight-row { display: grid; grid-template-columns: 28px 1fr; gap: 10px; }
.insight-row .ic { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue); }
.insight-row .ic svg { width: 16px; height: 16px; }
.insight-row h4 { font-size: 15px; color: var(--ink-3); font-weight: 600; margin-bottom: 2px; }
.insight-row p { font-size: 17px; color: var(--ink); }
.risk { border-radius: 14px; padding: 14px 16px; display: grid; gap: 6px; }
.risk.none { background: var(--green-soft); }
.risk.low { background: var(--amber-soft); }
.risk.medium, .risk.high { background: var(--red-soft); }
.risk h4 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.risk.none h4 { color: var(--green); } .risk.low h4 { color: var(--amber); } .risk.medium h4, .risk.high h4 { color: var(--red); }
.risk ul { margin: 0; padding-left: 20px; font-size: 15px; color: var(--ink-2); }
.reply { border: 1.5px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 10px; background: #fff; }
.reply-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.reply .why { font-size: 14px; color: var(--ink-3); }

/* sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(31,26,28,.35); z-index: 50; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 51; max-height: 92vh; overflow: auto; background: var(--bg); border-radius: 24px 24px 0 0; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); animation: up .25s ease; }
@media (min-width: 760px) { .sheet { left: 50%; right: auto; width: 640px; transform: translateX(-50%); bottom: 24px; border-radius: 24px; max-height: 88vh; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 760px) { @keyframes up { from { transform: translate(-50%, 40px); opacity: 0; } } }
.sheet .grab { width: 40px; height: 5px; border-radius: 99px; background: #DDD0C8; margin: 4px auto 10px; }
.sheet-h { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sheet-h h3 { font-size: 20px; }
.sheet-h .icon-btn { margin-left: auto; }

