:root {
  --paper: #fbf6ee;
  --card: #ffffff;
  --line: #eadfcd;
  --rule: #f0e6d6;
  --ink: #5a4632;
  --ink-2: #7a6550;
  --ink-3: #a8917a;
  --brown: #8b5e3c;
  --caramel: #c08a5b;
  --pink: #f6a8a0;
  --tape: #f6cfc4;
  --mint: #cfe3d4;
  --butter: #f2c46b;
  --danger: #b5483a;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { background: var(--paper); -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.6 var(--sans); color: var(--ink); background: var(--paper); }
.wrap { max-width: 480px; margin: 0 auto; padding: 18px 16px 120px; }
h1, h2, .serif { font-family: var(--serif); font-weight: 600; }
button, input, textarea, select { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.top { display: flex; align-items: center; gap: 12px; margin: 4px 0 18px; }
.top h1 { margin: 0; font-size: 24px; letter-spacing: 2px; }
.top p { margin: 0; font-size: 12px; color: var(--ink-3); }
.mascot { width: 54px; height: 54px; flex: none; }
.bob { animation: bob 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes bob { 50% { transform: translateY(-3px) rotate(-5deg); } }
.star { margin-left: auto; width: 24px; height: 24px; animation: twinkle 3.2s ease-in-out infinite; }
@keyframes twinkle { 50% { transform: scale(.82) rotate(12deg); opacity: .7; } }

/* sections */
.sec { margin: 22px 0 0; }
.sec-title { display: flex; align-items: baseline; gap: 8px; margin: 0 0 10px; font-size: 15px; font-family: var(--serif); font-weight: 600; }
.sec-title .n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--butter); color: var(--ink); font: 600 12px var(--sans); border: 1.5px solid var(--brown); }
.sec-title small { font: 12px var(--sans); color: var(--ink-3); }
.card { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.tape { position: absolute; top: -8px; left: 22px; width: 54px; height: 16px; background: var(--tape); opacity: .85; transform: rotate(-6deg); border-radius: 2px; pointer-events: none; }
.tape.r { left: auto; right: 22px; transform: rotate(5deg); background: var(--mint); }

/* lined textarea */
.lined { padding: 14px 14px 8px; }
.lined textarea { display: block; width: 100%; min-height: 176px; resize: vertical; border: 0; outline: 0; background: transparent;
  font: 15px/28px var(--serif); color: var(--ink);
  background-image: repeating-linear-gradient(transparent 0 27px, var(--rule) 27px 28px); background-attachment: local; }
.lined textarea::placeholder { color: var(--ink-3); }
.count { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); padding-top: 4px; border-top: 1px dashed var(--line); }

/* style picker */
.styles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.style { padding: 0; overflow: hidden; cursor: pointer; text-align: left; transition: transform .2s, border-color .2s; }
.style img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #fffdf8; }
.style span { display: block; padding: 6px 10px 8px; font-family: var(--serif); font-size: 14px; }
.style[aria-checked="true"] { border: 2px solid var(--caramel); }
.style[aria-checked="true"]::after { content: "✓"; position: absolute; top: 6px; right: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--caramel); color: #fff; font-size: 12px; display: grid; place-items: center; }
.style.pop { animation: pop .32s ease; }
@keyframes pop { 40% { transform: scale(1.04); } }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 14px; border-radius: 22px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 14px; }
.chip[aria-checked="true"] { background: var(--brown); border-color: var(--brown); color: #fff8ee; }
.hint { margin: 8px 2px 0; font-size: 12px; color: var(--ink-2); background: #fff3e2; border-radius: 10px; padding: 8px 10px; }

/* fields */
.field { display: block; margin: 0 0 12px; }
.field > span { display: block; font-size: 13px; color: var(--ink-2); margin: 0 0 6px 2px; }
.field input, .field textarea { width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); outline: 0; }
.field input:focus, .field textarea:focus, .lined:focus-within { border-color: var(--caramel); box-shadow: 0 0 0 3px #c08a5b22; }
.field textarea { min-height: 64px; resize: vertical; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 22px; background: var(--card); }
.stepper button { width: 40px; height: 38px; border: 0; background: none; font-size: 18px; color: var(--brown); cursor: pointer; }
.stepper output { min-width: 34px; text-align: center; font-weight: 600; }
.err { color: var(--danger); font-size: 12px; margin: 4px 2px 0; min-height: 0; }

/* bottom bar */
.bar { position: fixed; left: 0; right: 0; bottom: 0; background: #fbf6eef2; backdrop-filter: blur(6px); border-top: 1px solid var(--line); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.bar-in { max-width: 480px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.stamp { border: 1.5px dashed var(--caramel); background: var(--card); padding: 4px 10px; transform: rotate(-3deg); line-height: 1.2; }
.stamp small { display: block; font-size: 9px; letter-spacing: 1.5px; color: var(--ink-3); }
.stamp b { font: 600 20px var(--serif); color: var(--brown); }
.breakdown { flex: 1; font-size: 11px; color: var(--ink-3); line-height: 1.4; }
.btn { border: 0; border-radius: 24px; background: var(--brown); color: #fff8ee; padding: 12px 22px; font-size: 15px; cursor: pointer; white-space: nowrap; }
.btn:disabled { opacity: .55; }
.btn.ghost { background: var(--card); color: var(--brown); border: 1px solid var(--line); }

/* done / status */
.done { text-align: center; padding: 22px 16px 18px; }
.done h2 { margin: 6px 0 4px; font-size: 20px; }
.done p { margin: 4px 0; color: var(--ink-2); font-size: 14px; }
.no { font-family: var(--serif); font-size: 15px; color: var(--brown); letter-spacing: 1px; }
.link-box { display: flex; gap: 8px; margin: 12px 0 4px; }
.link-box input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fffdf8; font-size: 12px; color: var(--ink-2); }
.steps { display: flex; justify-content: space-between; margin: 16px 4px 0; }
.step { width: 25%; text-align: center; font-size: 12px; color: var(--ink-3); }
.step i { display: grid; place-items: center; width: 34px; height: 34px; margin: 0 auto 4px; border-radius: 50%; border: 1px dashed #c9b596; background: var(--card); font-style: normal; font-size: 15px; }
.step.on { color: var(--ink); }
.step.on i { border: 1.5px solid var(--brown); background: var(--butter); }
.step.past i { border: 0; background: var(--caramel); color: #fff; }
.rows { margin: 0; padding: 4px 16px; }
.rows div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.rows div:last-child { border-bottom: 0; }
.rows dt { color: var(--ink-3); }
.rows dd { margin: 0; text-align: right; }
.foot { text-align: center; font-size: 11px; color: var(--ink-3); margin-top: 26px; }

@media (prefers-reduced-motion: reduce) { .bob, .star, .style.pop { animation: none; } }
