:root {
  color-scheme: light;
  --paper: #f7f4ec;
  --white: #fffcf5;
  --ink: #242c25;
  --muted: #5b655b;
  --line: #dddcd0;
  --forest: #1c352b;
  --vault: #182f25;
  --ivory: #f7f2dc;
  --mist: #c0cbb5;
  --brass: #f0c784;
  --amber-ink: #784822;
  --amber-paper: #f3e6cf;
  --radius: 19px;
  --gutter: 20px;
  --sans: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --figures: Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 300px; background: #e7e9df; }
body { margin: 0; color: var(--ink); font: 15px/1.5 var(--sans); font-variant-numeric: tabular-nums; }
button, input { font: inherit; }
button { border: 0; cursor: pointer; color: inherit; background: none; }
button:disabled { cursor: default; opacity: .55; }
button, a, input, label { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid #926024; outline-offset: 3px; }
[hidden] { display: none !important; }
p, h1, h2 { margin: 0; }
.icon { width: 21px; height: 21px; flex: none; display: inline-block; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.phone { max-width: 480px; min-height: 100dvh; margin: auto; background: var(--paper); position: relative; }
.main { padding: max(24px, env(safe-area-inset-top)) var(--gutter) calc(28px + env(safe-area-inset-bottom)); }
.main:is(.home, .calendar, .milestones) { padding-bottom: calc(89px + env(safe-area-inset-bottom)); }
.page-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 23px; }
.headline { min-width: 0; flex: 1; }
.page-head h1 { font-size: 32px; font-weight: 740; line-height: 1.23; letter-spacing: -.035em; }
.page-head h1:focus { outline: none; }
.page-head p { color: var(--muted); margin-top: 6px; font-size: 14px; overflow-wrap: anywhere; }
.edition { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); padding-block: 6px; font-size: 12px; margin-top: 5px; white-space: nowrap; }
.edition .icon { width: 15px; height: 15px; }
.icon-button { width: 44px; height: 44px; margin: 0 1px 0 -3px; flex: none; display: grid; place-items: center; background: #eeeee3; border-radius: 50%; }
.has-back h1 { font-size: 28px; }

.vault {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--ivory);
  border-radius: var(--radius);
  background: radial-gradient(ellipse at 48% 62%, #3a5039 0%, #233b2d 50%, transparent 76%), var(--vault);
}
.vault::before {
  position: absolute;
  z-index: -1;
  inset: 0;
  content: "";
  background: repeating-linear-gradient(90deg, transparent 0 17px, #c4d8ac15 17px 18px), repeating-linear-gradient(0deg, transparent 0 17px, #c4d8ac15 17px 18px);
  mask-image: radial-gradient(ellipse at center, #000 10%, transparent 74%);
  pointer-events: none;
}
.vault-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 18px 17px 0; }
.vault-label { display: block; color: var(--mist); font-size: 12px; letter-spacing: .11em; font-weight: 550; }
.vault-total { font: 52px/1 var(--figures); letter-spacing: -.04em; margin-top: 5px; white-space: nowrap; }
.vault-total > span { font-size: .55em; display: inline-block; margin-right: 3px; color: var(--brass); vertical-align: 7px; }
.vault-tag { color: var(--mist); font-size: 12px; font-weight: 650; padding-block: 4px; white-space: nowrap; }
.jar-art { width: 100%; max-width: 386px; height: auto; margin: -1px auto -3px; display: block; }
.vault-foot { display: flex; gap: 5px; justify-content: space-between; align-items: center; min-height: 51px; padding: 10px 17px; color: var(--mist); font-size: 12px; background: #0d231c54; }
.vault-foot strong { color: var(--ivory); font-size: 14px; font-weight: 700; }
.amber-dot { display: inline-block; width: 7px; height: 7px; margin: 0 7px 1px 0; border-radius: 50%; background: var(--brass); }

.ticket { margin-top: 20px; padding: 14px 15px; display: flex; justify-content: space-between; align-items: center; gap: 10px; border-radius: 12px; background: var(--white); }
.ticket-info { display: grid; gap: 3px; min-width: 0; }
.ticket-info span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.ticket-info strong { font-size: 19px; line-height: 1.25; }
.home .ticket-info strong { font-size: 21px; }
.primary, .secondary, .text-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 48px; border-radius: 10px; padding: 10px 13px; font-size: 14px; font-weight: 680; text-align: center; line-height: 1.35; }
.primary { background: var(--forest); color: #fffaf0; }
.primary:hover { background: #2a4a3a; }
.primary:active { background: #11261c; }
.primary .icon, .secondary .icon { width: 17px; height: 17px; }
.secondary { color: var(--forest); background: #e8eddf; }
.text-button { color: var(--forest); }
.text-button:hover { background: #eeeee3; }
.secondary:hover, .icon-button:hover { background: #e0e7d7; }
.ticket .primary { flex: none; }
.wide { width: 100%; min-height: 51px; }
.inline-link { display: flex; width: 100%; min-height: 48px; align-items: center; justify-content: space-between; padding: 0 3px; margin-top: 4px; color: var(--amber-ink); font-size: 13px; font-weight: 620; }
.inline-link i { display: inline-block; background: #a46c31; width: 6px; height: 6px; border-radius: 50%; margin: 0 7px 2px 2px; }
.inline-link .icon { width: 17px; }

.tabbar { position: fixed; z-index: 2; inset: auto 0 0; width: min(100%, 480px); margin-inline: auto; padding: 8px var(--gutter) max(10px, env(safe-area-inset-bottom)); background: #eeefe5; display: grid; grid-template-columns: repeat(3, 1fr); }
.tabbar button { display: grid; align-content: center; justify-items: center; gap: 1px; min-height: 48px; font-size: 12px; color: var(--muted); }
.tab-icon { display: grid; place-items: center; width: 49px; height: 28px; border-radius: 24px; }
.tabbar button[aria-current] { color: var(--forest); font-weight: 750; }
.tabbar button[aria-current] .tab-icon { background: #e0e7d7; }
.tabbar button:hover .tab-icon { background: #e7e9de; }

.setup-intro { background: #e9ecdf; border-radius: var(--radius); display: flex; align-items: center; gap: 13px; padding: 16px; margin-bottom: 23px; }
.setup-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--forest); color: var(--ivory); }
.setup-intro div { display: grid; color: var(--muted); gap: 2px; font-size: 13px; }
.setup-intro strong { color: var(--forest); font: 30px/1 var(--figures); }
.setup-form { display: grid; gap: 16px; }
.setup-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.setup-form legend, .field { font-weight: 660; }
.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 7px; }
.choice { position: relative; cursor: pointer; }
.choice input { position: absolute; inset: 12px 10px auto auto; width: 17px; height: 17px; margin: 0; accent-color: var(--forest); }
.choice-body { display: grid; gap: 2px; border: 1px solid var(--line); border-radius: 11px; padding: 10px 11px; background: var(--white); }
.choice-body b { font-size: 15px; }
.choice-body span { color: var(--muted); font-size: 12px; }
.choice input:checked + span { border-color: #5d765f; background: #e8eddf; }
.field { display: grid; gap: 7px; }
.field-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.field-label small { color: var(--amber-ink); font-size: 12px; font-weight: 600; }
.field input { width: 100%; min-width: 0; display: block; min-height: 48px; padding: 10px 12px; border: 1px solid #c8cbbd; border-radius: 10px; background: var(--white); color: var(--ink); font-size: 16px; }
.field input::placeholder { color: var(--muted); font-size: 15px; }
.hint { color: var(--muted); font-size: 13px; }
.storage-warning, .error { background: #f5e6da; color: #753e2b; padding: 10px 12px; font-size: 13px; border-radius: 8px; }
.storage-warning { margin-bottom: 12px; }

.ledger-title { display: flex; align-items: center; justify-content: space-between; gap: 7px; padding: 0 1px; color: var(--muted); font-size: 13px; }
.ledger-title strong { font: 26px/1.1 var(--figures); color: var(--ink); }
.ledger-count { color: var(--amber-ink); }
.filters { display: flex; gap: 6px; margin: 10px 0 11px; }
.filters button { min-height: 44px; padding: 5px 11px; border-radius: 8px; color: var(--muted); font-size: 13px; }
.filters [aria-pressed="true"] { color: var(--forest); background: #e7ebdf; font-weight: 720; }
.filters button span { margin-left: 3px; }
.week-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 4px 2px; }
.week { min-width: 0; min-height: 44px; display: grid; place-content: center; justify-items: center; gap: 0; padding: 2px; border-radius: 6px; font-size: 13px; font-weight: 650; line-height: 1.24; }
.week span { font-size: 11px; line-height: 1.28; font-weight: 720; }
.week.paid, .key.paid { background: #e7ecdf; color: #355340; }
.week.missed, .key.missed { background: var(--amber-paper); color: var(--amber-ink); }
.week.current, .key.current { background: var(--forest); color: var(--ivory); }
.week.future, .key.future { background: #eeece3; color: #62695d; }
.week[aria-current="date"] { box-shadow: inset 0 -3px #bf945a; }
.week[aria-pressed="true"]:not(:focus-visible) { outline: 2px solid currentColor; outline-offset: -3px; }
.legend { display: flex; flex-wrap: wrap; gap: 5px 10px; margin-top: 13px; color: var(--muted); font-size: 12px; }
.legend > span { display: inline-flex; align-items: center; gap: 4px; }
.key { border-radius: 4px; font-style: normal; display: inline-grid; place-items: center; width: 16px; height: 17px; line-height: 1; }
.week-detail { margin-top: 22px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.week-detail strong { display: block; font-size: 23px; line-height: 1.25; }
.week-detail p, .status-line { color: var(--muted); font-size: 12px; }
.status-line.missed { color: var(--amber-ink); }
.compact { flex: none; min-height: 44px; }
.empty-filter { padding: 17px 0; color: var(--muted); }
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; margin-top: 60px; }
.empty > span { display: grid; place-items: center; border-radius: 50%; width: 58px; height: 58px; background: #e5eadc; color: var(--forest); }
.empty h2 { font-size: 19px; }
.empty p { color: var(--muted); font-size: 14px; margin-bottom: 6px; }

.milestone-vault { display: grid; justify-items: center; text-align: center; padding: 19px 12px 20px; gap: 5px; }
.milestone-vault h2 { font-size: 23px; line-height: 1.28; }
.milestone-vault p { font-size: 13px; color: var(--mist); }
.medal { display: inline-grid; place-items: center; width: 41px; height: 41px; flex: none; border: 1px solid #bdbaad; border-radius: 50%; padding: 3px; color: #5e665a; }
.medal > span { border: 1px dashed currentColor; display: grid; width: 100%; height: 100%; place-items: center; border-radius: 50%; font: 20px/1 var(--figures); }
.medal.large, .earned .medal, .unlock .medal { background: #ebc385; border-color: #ac7740; color: #5e3a1b; }
.medal.large { width: 99px; height: 99px; padding: 6px; margin: 0 0 5px; box-shadow: inset 0 0 0 3px #f3d8a4, 0 0 27px #d8ad6954; background: conic-gradient(from 15deg, #d3a161, #f0d5a2, #d3a161, #f0d5a2, #d3a161); }
.medal.large > span { font-size: 46px; }
.milestone-list { list-style: none; padding: 0; margin: 20px 1px 0; display: grid; gap: 8px; }
.milestone-list li { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 5px 1px; }
.milestone-list li > div { flex: 1; display: grid; gap: 2px; }
.milestone-list li > div span { font-size: 12px; color: var(--muted); }
.milestone-state { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; font-size: 12px; color: var(--muted); }
.milestone-state .icon { width: 15px; height: 15px; }
.earned .milestone-state { color: var(--amber-ink); font-weight: 650; }

.deposit-top { display: grid; justify-items: center; gap: 4px; padding-top: 17px; }
.deposit-top > strong { font: 56px/1 var(--figures); letter-spacing: -.035em; }
.deposit-vault .jar-art { margin-top: -3px; }
.deposit-actions { display: grid; gap: 9px; margin-top: 15px; }
.deposit-actions .hint { text-align: center; }
.unlock { display: flex; align-items: center; gap: 11px; border-radius: 10px; background: var(--amber-paper); padding: 9px 12px; margin-top: 12px; }
.unlock p { color: var(--amber-ink); font-size: 12px; }
.falling-coin { position: absolute; z-index: 1; left: 47.6%; top: 30%; width: 46px; height: 46px; display: grid; place-items: center; color: #5e3616; border: 2px solid #f8d99b; border-radius: 50%; background: #efbe73; box-shadow: inset 0 0 0 3px #ba8848, 0 0 17px #eab26499; font-size: 12px; font-weight: 750; animation: drop-coin .77s both; }
.dropping .jar-water { animation: fill-jar .3s .47s both; }
.unlock { animation: settle-in .25s ease-out both; }
.arrive .home-vault { animation: settle-in .26s ease-out both; }
.arrive .ticket { animation: settle-in .24s .06s ease-out both; }
.undo-feedback { position: fixed; z-index: 3; inset: auto auto calc(82px + env(safe-area-inset-bottom)) 50%; transform: translateX(-50%); border-radius: 20px; background: var(--forest); color: var(--ivory); padding: 8px 16px; font-size: 13px; white-space: nowrap; }
@keyframes drop-coin {
  0% { transform: translate(-50%, -100%) rotate(-18deg); opacity: 0; }
  16% { opacity: 1; }
  55% { transform: translate(-50%, 208%) rotate(22deg) scale(.72); opacity: 1; }
  70% { opacity: 0; }
  100% { transform: translate(-50%, 280%) rotate(35deg) scale(.32); opacity: 0; }
}
@keyframes fill-jar {
  to { transform: translateY(var(--water-shift)); }
}
@keyframes settle-in {
  from { opacity: .82; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 365px) {
  :root { --gutter: 13px; }
  .page-head { margin-bottom: 18px; }
  .vault-total { font-size: 46px; }
  .ticket { padding: 11px 9px; }
  .ticket .primary { padding-inline: 8px; }
}
@media (max-width: 386px) {
  .week-grid { grid-template-columns: repeat(6, minmax(0,1fr)); }
}
@media (max-width: 313px) {
  .week-grid { grid-template-columns: repeat(5, minmax(0,1fr)); }
}
@media (min-width: 510px) {
  .phone { box-shadow: 0 0 60px #1e38221c; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; }
}
