:root {
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #28251f;
  background: #fff9da;
  font-synthesis: none;
  --brand: #74ad40;
  --brand-dark: #45772b;
  --yellow: #ffe769;
  --yellow-soft: #fff6b8;
  --orange: #f06b39;
  --cream: #fffdf0;
  --ink: #28251f;
  --muted: #716a58;
  --line: #3a352c;
  --error: #c84635;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 12px 12px, rgba(116, 173, 64, .12) 2px, transparent 2.5px) 0 0 / 34px 34px,
    linear-gradient(180deg, #fff9da 0, #f8f2c9 100%);
}
button, input, select, textarea { font: inherit; }
button, select, summary { cursor: pointer; }
button, input, select { min-height: 44px; border: 2px solid var(--line); border-radius: 13px; }
button { padding: 10px 16px; background: var(--cream); color: inherit; font-weight: 750; box-shadow: 2px 3px 0 rgba(40, 37, 31, .18); }
button:hover { background: var(--yellow-soft); transform: translateY(-1px); }
button:active { box-shadow: 1px 1px 0 rgba(40, 37, 31, .18); transform: translateY(1px); }
button:disabled { cursor: not-allowed; opacity: .55; }
input, select, textarea { width: 100%; min-width: 0; padding: 10px 12px; background: #fffefa; color: inherit; }
textarea { border: 2px solid var(--line); border-radius: 13px; }
input:focus-visible, select:focus-visible, button:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 4px solid rgba(255, 190, 55, .72); outline-offset: 2px;
}
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--error); }
[hidden] { display: none !important; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(38px, 6vw, 62px); line-height: 1.03; letter-spacing: -.055em; }
h1 span { color: var(--brand-dark); }
h2 { font-size: 20px; margin-bottom: 12px; }
p { line-height: 1.6; }
p:empty, small:empty { display: none; }
.primary { background: var(--brand); border-color: var(--line); color: var(--ink); }
.primary:hover { background: #8fc957; }
.quiet { background: transparent; }
.danger { color: var(--error); }
.muted { color: var(--muted); font-size: 14px; }
.app-shell { max-width: 960px; margin: auto; padding: 30px 24px 200px; }
.hero {
  min-height: 300px;
  margin-bottom: 18px;
  padding: 34px 36px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(230px, .85fr);
  align-items: center;
  overflow: hidden;
  position: relative;
  border: 3px solid var(--line);
  border-radius: 28px;
  background: repeating-conic-gradient(from -8deg at 78% 52%, #fffdf0 0deg 14deg, var(--yellow) 14deg 29deg);
  box-shadow: 6px 7px 0 rgba(40, 37, 31, .18);
}
.hero::after { content: ""; position: absolute; inset: auto 0 0; height: 13px; background: var(--orange); border-top: 3px solid var(--line); }
.hero-copy { position: relative; z-index: 1; }
.hero-copy > p:not(.eyebrow) { max-width: 420px; color: #514b3f; margin-bottom: 20px; font-weight: 600; }
.eyebrow { display: inline-flex; color: var(--ink); background: var(--yellow); border: 2px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 800; letter-spacing: .08em; margin-bottom: 14px; transform: rotate(-2deg); }
.hero-art { height: 260px; position: relative; z-index: 1; display: grid; place-items: center; }
.hero-art img { width: min(310px, 125%); max-height: 310px; object-fit: contain; filter: drop-shadow(5px 7px 0 rgba(40, 37, 31, .13)); transform: rotate(3deg); }
.hero-steps { display: flex; flex-wrap: wrap; gap: 8px; }
.hero-steps span { padding: 7px 10px; border: 2px solid var(--line); border-radius: 10px; background: var(--cream); font-size: 13px; font-weight: 750; }
.storage-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; color: var(--muted); font-size: 13px; }
.layout { display: grid; gap: 20px; }
.card { background: var(--cream); border: 2px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: 4px 5px 0 rgba(40, 37, 31, .12); }
.card h2::before { content: "♛"; display: inline-block; margin-right: 7px; color: var(--orange); transform: rotate(-8deg); }
.section-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.section-head > button { flex-shrink: 0; }
.section-head p { margin-bottom: 16px; }
.person-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.person-form > input { flex: 1; min-width: 160px; }
.people { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.person-tag { display: flex; align-items: center; gap: 4px; background: #dff1b8; border: 2px solid var(--line); border-radius: 14px; padding: 2px 6px 2px 12px; max-width: 100%; }
.person-tag > span { overflow-wrap: anywhere; }
.person-tag button { border: 0; background: transparent; box-shadow: none; padding: 8px; color: var(--muted); font-size: 12px; flex-shrink: 0; }
[data-person-notice] { margin: 12px 0 0; font-size: 14px; }
.expense-list { display: grid; gap: 16px; }
.empty-state { min-height: 220px; display: flex; align-items: center; justify-content: center; gap: 22px; text-align: left; padding: 16px; line-height: 2; background: var(--yellow-soft); border: 2px dashed var(--line); border-radius: 16px; }
.empty-state img { width: 130px; height: 165px; object-fit: contain; flex: 0 0 auto; filter: drop-shadow(3px 4px 0 rgba(40, 37, 31, .12)); }
.empty-state strong { font-size: 18px; }
.expense { border: 2px solid var(--line); border-radius: 16px; min-width: 0; overflow: hidden; box-shadow: 3px 4px 0 rgba(40, 37, 31, .09); }
.expense-head { display: flex; align-items: start; padding: 10px 12px; gap: 8px; background: var(--yellow-soft); border-radius: 0; border-bottom: 2px solid var(--line); }
.expense-toggle { border: none; text-align: left; display: grid; gap: 6px; flex: 1; background: transparent; box-shadow: none; min-width: 0; padding: 8px; }
.expense-toggle strong { overflow-wrap: anywhere; }
.expense-toggle[aria-expanded="false"] strong::after { content: " · 展开"; font-size: 12px; color: var(--brand-dark); }
.expense-toggle[aria-expanded="true"] strong::after { content: " · 收起"; font-size: 12px; color: var(--muted); }
.expense-body { display: grid; gap: 18px; padding: 20px; }
.field { display: grid; gap: 7px; min-width: 0; align-content: start; }
.field > span, legend { font-size: 14px; font-weight: 650; }
.field-error { color: var(--error); font-size: 13px; line-height: 1.5; }
.two-columns, .amount-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
fieldset { margin: 0; padding: 0; border: none; min-width: 0; }
legend { margin-bottom: 10px; }
fieldset p { margin-bottom: 8px; }
.participant-list { display: flex; flex-wrap: wrap; gap: 8px; }
.participant-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; min-height: 44px; border: 2px solid var(--line); border-radius: 13px; cursor: pointer; max-width: 100%; background: #fffefa; }
.participant-chip:has(:checked) { background: #dff1b8; border-color: var(--line); }
.participant-chip input { width: 17px; height: 17px; min-height: 0; accent-color: var(--brand-dark); flex-shrink: 0; }
.participant-chip span { overflow-wrap: anywhere; }
.share-preview { display: flex; flex-wrap: wrap; gap: 10px 20px; padding: 14px; border: 2px dashed #9a8332; border-radius: 12px; background: #fff8c9; font-size: 14px; }
.share-preview > span { overflow-wrap: anywhere; }
output { font-size: 22px; padding: 8px 0; }
.transfers { list-style: none; padding: 0; display: grid; gap: 10px; }
.transfers li { padding: 16px; border: 2px solid var(--line); border-left: 9px solid var(--orange); border-radius: 13px; background: var(--yellow-soft); font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
details { margin-top: 22px; border-top: 2px dashed #cabf83; padding-top: 16px; }
summary { padding: 8px 0; color: var(--muted); }
.person-results > div { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 14px 0; border-top: 1px solid #d8cf99; }
.person-results strong { overflow-wrap: anywhere; }
.person-results span { color: var(--muted); font-size: 13px; grid-row: 2; grid-column: 1 / -1; }
.person-results b { color: var(--brand-dark); font-size: 14px; }
[data-fallback] { display: grid; gap: 8px; color: var(--error); }
.action-dock { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(255, 253, 240, .97); border-top: 2px solid var(--line); padding: 12px 24px calc(12px + env(safe-area-inset-bottom)); z-index: 5; box-shadow: 0 -6px 0 rgba(255, 231, 105, .55); }
.dock-content { max-width: 912px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dock-feedback { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; min-width: 0; overflow-wrap: anywhere; }
.dock-buttons { display: flex; gap: 10px; flex-shrink: 0; }
dialog { width: min(480px, calc(100% - 32px)); padding: 24px; border: 3px solid var(--line); border-radius: 20px; color: inherit; background: var(--cream); box-shadow: 6px 7px 0 rgba(40, 37, 31, .2); }
dialog::backdrop { background: rgba(73, 91, 44, .55); }
.dialog-actions { display: flex; justify-content: end; gap: 10px; margin-top: 24px; }
result-panel { scroll-margin-bottom: 160px; }
@media (max-width: 600px) {
  .app-shell { padding: 18px 12px 220px; }
  .hero { min-height: 260px; padding: 22px 18px 26px; grid-template-columns: minmax(0, 1fr) 118px; border-radius: 22px; }
  .hero h1 { font-size: clamp(34px, 12vw, 48px); }
  .hero-art { height: 170px; align-self: end; }
  .hero-art img { width: 175px; max-width: none; transform: translateX(18px) rotate(3deg); }
  .hero-steps { grid-column: 1 / -1; }
  .card { padding: 16px; border-radius: 14px; }
  .expense-body { padding: 14px; }
  .two-columns, .amount-grid { grid-template-columns: 1fr; }
  .person-form > label { width: 100%; }
  .dock-content { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .dock-buttons { display: grid; grid-template-columns: 1fr 1fr; }
  .action-dock { padding-left: 16px; padding-right: 16px; }
  .section-head { flex-wrap: wrap; }
  .transfers li { font-size: 16px; }
  .empty-state { min-height: 190px; gap: 10px; padding: 12px; }
  .empty-state img { width: 100px; height: 135px; }
}
@media (max-width: 390px) {
  .hero { grid-template-columns: 1fr 96px; }
  .hero-art img { width: 150px; transform: translateX(20px) rotate(3deg); }
  .hero-copy > p:not(.eyebrow) { font-size: 14px; }
  .hero-steps span { font-size: 12px; padding: 6px 7px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
