:root { color-scheme: light; --ink: #101114; --muted: #68707d; --paper: #edf1f6; --line: rgba(16,17,20,.16); --lime: #cafa63; --coral: #ff826e; --blue: #6784ff; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; font-size: 16px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.first-screen { min-height: 100svh; display: grid; grid-template-rows: auto 1fr auto; width: min(1500px, 100%); margin: 0 auto; padding: 24px; }
.topbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 0 2px 20px; }
.eyebrow, .kicker { margin: 0 0 4px; color: var(--muted); font-size: .78rem; font-weight: 780; letter-spacing: .1em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.8rem, 3.2vw, 3rem); line-height: .95; letter-spacing: -.055em; }
.ghost-button { border: 1px solid var(--line); padding: 9px 16px; border-radius: 999px; background: rgba(255,255,255,.66); color: var(--ink); font-weight: 760; }
.ghost-button:hover, .ghost-button:focus-visible { background: white; border-color: var(--ink); }
.triad { min-height: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.life-card { min-width: 0; min-height: 560px; border-radius: 30px; padding: clamp(22px, 2.7vw, 38px); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.spend-card { background: var(--ink); color: white; }
.eat-card { background: var(--lime); }
.poop-card { background: var(--coral); }
.card-topline { display: flex; justify-content: space-between; gap: 16px; align-items: center; font-size: .82rem; font-weight: 720; opacity: .7; }
.card-index { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid currentColor; border-radius: 50%; font-variant-numeric: tabular-nums; }
.card-title-row { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-top: clamp(26px, 5vh, 54px); }
.card-title-row h2 { margin: 0; font-size: clamp(4.8rem, 9vw, 8.2rem); line-height: .72; letter-spacing: -.1em; }
.card-total { font-size: clamp(1.6rem, 2.5vw, 2.8rem); font-weight: 820; line-height: 1; letter-spacing: -.055em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-total small { margin-left: 4px; font-size: .84rem; letter-spacing: 0; }
.card-caption { margin: 22px 0 auto; max-width: 23ch; opacity: .66; font-size: .92rem; }
.entry-form { display: grid; gap: 12px; margin-top: 28px; }
label { display: grid; gap: 6px; font-size: .82rem; font-weight: 760; }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid rgba(16,17,20,.19); border-radius: 12px; background: rgba(255,255,255,.82); color: var(--ink); padding: 10px 12px; outline: none; }
.spend-card input, .spend-card select { border-color: rgba(255,255,255,.22); background: rgba(255,255,255,.1); color: white; }
.spend-card select option { color: var(--ink); }
textarea { resize: vertical; min-height: 94px; }
input:focus, select:focus, textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(103,132,255,.2); }
.money-input { position: relative; }
.money-input > span { position: absolute; inset: 0 auto 0 13px; display: grid; place-items: center; opacity: .7; font-weight: 760; }
.money-input input { padding-left: 34px; font-size: 1.2rem; font-weight: 800; }
.card-action { min-height: 48px; border: 0; border-radius: 12px; font-weight: 820; transition: transform .15s ease; }
.light-action { background: white; color: var(--ink); }
.dark-action { background: var(--ink); color: white; }
.card-action:hover, .poop-counter:hover { transform: translateY(-2px); }
.card-action:active, .poop-counter:active { transform: translateY(0); }
.poop-form { flex: 1; display: grid; align-items: end; padding: 32px 0 10px; }
.poop-counter { justify-self: center; width: min(100%, 260px); aspect-ratio: 1; border: 2px solid var(--ink); border-radius: 50%; background: transparent; color: var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-weight: 820; transition: transform .15s ease, background .15s ease; }
.poop-counter:hover { background: rgba(255,255,255,.24); }
.poop-counter .plus { font-size: clamp(3.2rem, 5vw, 5rem); line-height: .8; letter-spacing: -.08em; }
.scroll-cue { justify-self: center; padding: 15px 20px 0; color: var(--muted); text-decoration: none; font-size: .82rem; font-weight: 740; }
.scroll-cue span { display: inline-block; margin-left: 5px; }
.history-section { width: min(900px, calc(100% - 36px)); margin: 0 auto; padding: 76px 0 110px; }
.history-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.history-heading h2 { margin: 0; font-size: clamp(2.4rem, 6vw, 5rem); line-height: .9; letter-spacing: -.06em; }
.text-button { border: 0; background: transparent; color: #c33b2d; padding: 8px; font-weight: 740; }
.text-button:disabled { color: #98a2b3; cursor: not-allowed; }
.timeline { display: grid; padding-top: 22px; }
.timeline-item { display: grid; grid-template-columns: 62px 38px 1fr auto; align-items: start; gap: 10px; min-height: 80px; }
.time { padding-top: 8px; color: var(--muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
.dot-column { position: relative; height: 100%; display: grid; justify-items: center; }
.dot-column::after { content: ""; position: absolute; width: 1px; top: 38px; bottom: 0; background: var(--line); }
.timeline-item:last-child .dot-column::after { display: none; }
.dot { position: relative; z-index: 1; width: 32px; height: 32px; margin-top: 2px; display: grid; place-items: center; border-radius: 10px; font-size: .72rem; font-weight: 850; }
.dot.expense { background: #dfe5ff; color: #344bb2; }
.dot.meal { background: #dfffa1; color: #3d5f00; }
.dot.poop { background: #ffd6cf; color: #a73324; }
.item-main { padding: 4px 0 18px; min-width: 0; }
.item-title { display: block; font-weight: 760; overflow-wrap: anywhere; }
.item-meta { color: var(--muted); font-size: .82rem; }
.item-value { padding-top: 4px; font-weight: 820; white-space: nowrap; }
.delete-button { grid-column: 4; justify-self: end; margin-top: -18px; border: 0; background: transparent; color: #98a2b3; font-size: .76rem; }
.delete-button:hover { color: #c33b2d; }
.empty-state { min-height: 300px; display: grid; place-items: center; text-align: center; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); font-size: 1.08rem; margin-bottom: 5px; }
.empty-symbol { display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 15px; border-radius: 20px; background: white; font-size: 1.6rem; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 10; transform: translate(-50%, 22px); padding: 11px 16px; border-radius: 999px; background: white; color: var(--ink); opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: 0 18px 50px rgba(16,17,20,.22); font-weight: 760; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 980px) {
  .first-screen { padding: 18px; }
  .triad { grid-template-columns: repeat(3, minmax(280px, 1fr)); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 8px; }
  .life-card { min-height: calc(100svh - 135px); scroll-snap-align: start; }
  .triad::-webkit-scrollbar { height: 6px; }
  .triad::-webkit-scrollbar-thumb { background: rgba(16,17,20,.22); border-radius: 99px; }
}
@media (max-width: 560px) {
  .first-screen { padding: 12px; }
  .topbar { padding: 6px 2px 14px; }
  .triad { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: calc(100vw - 36px); }
  .life-card { min-height: calc(100svh - 116px); padding: 22px; border-radius: 24px; }
  .card-title-row { margin-top: 30px; }
  .card-title-row h2 { font-size: 5.6rem; }
  .card-caption { margin-top: 18px; }
  .history-section { padding-top: 58px; }
  .timeline-item { grid-template-columns: 50px 34px 1fr auto; gap: 5px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }

/* 只增加“点开一页”的交互，保留原来的三栏样式。 */
.open-card-button { width: 100%; min-height: 50px; margin-top: auto; border: 0; border-radius: 14px; padding: 14px 18px; font-weight: 820; cursor: pointer; }
.close-card-button { display: none; position: absolute; z-index: 4; top: 22px; left: 22px; border: 1px solid currentColor; border-radius: 999px; background: transparent; padding: 9px 13px; font-weight: 760; cursor: pointer; }
.slide-cover { display: none; position: absolute; z-index: 3; inset: 0; align-items: center; justify-content: center; background: inherit; transform: translateY(0); transition: transform .55s cubic-bezier(.76,0,.24,1); }
.slide-cover strong { font-size: clamp(7rem, 22vw, 15rem); line-height: 1; letter-spacing: -.1em; }
.life-card:not(.is-open) .entry-form, .life-card:not(.is-open) .poop-form { display: none; }
.life-card.is-open { position: fixed; z-index: 20; inset: 0; width: 100%; min-height: 100svh; border-radius: 0; overflow-y: auto; padding: clamp(76px, 9vw, 110px) max(24px, calc((100vw - 680px) / 2)); }
.life-card.is-open .open-card-button { display: none; }
.life-card.is-open .close-card-button { display: block; }
.life-card.is-open .slide-cover { display: flex; }
.life-card.is-open .slide-cover.cover-up { transform: translateY(-102%); }
.life-card.is-open .card-title-row { margin-top: 26px; }
.life-card.is-open .entry-form { display: grid; }
.life-card.is-open .poop-form { display: grid; min-height: 360px; }
.life-card.is-open .card-caption { max-width: 560px; }
body.card-is-open { overflow: hidden; }
