:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --text: #191918;
  --muted: #6d6b66;
  --line: #e4e2dc;
  --accent: #191918;
  --accent-text: #ffffff;
  --error: #b3261e;
  --radius: 16px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151514;
    --card: #1f1f1d;
    --text: #f1f0ec;
    --muted: #9c9a94;
    --line: #2f2e2b;
    --accent: #f1f0ec;
    --accent-text: #151514;
    --error: #f2b8b5;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 460px;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
}

a { color: inherit; }

.intro { margin: 8px 4px 24px; }
.brand {
  display: inline-block;
  margin: 0 0 18px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted);
  text-decoration: none;
}
h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -.02em;
  font-weight: 700;
  overflow-wrap: anywhere;
}
h2 { font-size: 15px; font-weight: 600; color: var(--muted); margin: 0 4px 8px; }
.lead { margin: 10px 0 0; color: var(--muted); overflow-wrap: anywhere; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}
.card p { margin: 0; }

label { display: block; font-size: 15px; font-weight: 600; margin: 0 0 8px; }
label ~ label { margin-top: 18px; }
.muted { color: var(--muted); font-weight: 400; }

input {
  display: block;
  width: 100%;
  font: inherit;
  font-size: 17px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}
input:focus { border-color: var(--text); }
input::placeholder { color: var(--muted); opacity: .7; }

.money { position: relative; }
.money input {
  font-size: 34px;
  font-weight: 650;
  padding: 12px 52px 12px 16px;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.money span {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 26px;
  color: var(--muted);
  pointer-events: none;
}

button, .button {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 15px 18px;
  font: inherit;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  color: var(--accent-text);
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: opacity .15s;
}
button:active, .button:active { opacity: .75; }
button:disabled { opacity: .5; cursor: default; }
button.secondary {
  color: var(--text);
  background: transparent;
  border: 1px solid var(--line);
}
.row { display: flex; gap: 10px; }
.row button { margin-top: 16px; }

.hint { margin-top: 10px !important; font-size: 14px; color: var(--muted); }
.error { margin-top: 12px !important; font-size: 15px; color: var(--error); }

.total { text-align: center; padding: 26px 20px 24px; }
.total .label { font-size: 14px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.sum {
  font-size: 54px !important;
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.1;
  margin: 6px 0 6px !important;
  font-variant-numeric: tabular-nums;
}
.sum.pending { font-size: 20px !important; font-weight: 600; letter-spacing: 0; line-height: 1.35; margin: 12px 0 8px !important; }
.sub { color: var(--muted); font-size: 15px; }

.banner { background: transparent; border-style: dashed; }

.modes { border: 0; padding: 0; margin: 22px 0 0; }
.modes legend { font-size: 15px; font-weight: 600; padding: 0; margin-bottom: 8px; }
label.mode {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 8px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 400;
  font-size: 14px;
  color: var(--muted);
  cursor: pointer;
}
label.mode:has(input:checked) { border-color: var(--text); }
label.mode input { -webkit-appearance: radio; appearance: auto; display: inline-block; width: 18px; height: 18px; padding: 0; margin: 2px 0 0; border: 0; background: none; accent-color: var(--text); flex: none; }
label.mode strong { display: block; color: var(--text); font-size: 15px; margin-bottom: 2px; }
.card-title { font-size: 17px; color: var(--text); margin: 0 0 6px; }
#finish label:first-of-type { margin-top: 16px; }

.money.small input { font-size: 20px; font-weight: 600; padding: 13px 44px 13px 14px; }
.money.small span { font-size: 18px; right: 16px; }

.goal { margin-top: 18px; }
.goal p { color: var(--muted); font-size: 15px; }
.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 10px;
}
.bar span { display: block; height: 100%; width: 0; background: var(--text); border-radius: inherit; transition: width .4s ease; }
.goal.reached p { color: var(--text); font-weight: 600; }

button.link {
  display: inline-block;
  width: auto;
  margin: 14px auto 0;
  padding: 4px 6px;
  background: none;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.goal-form { text-align: left; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }

.share { margin: 22px 0 0; }
.share button { margin-top: 0; }
.url {
  margin: 10px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  overflow-wrap: anywhere;
  user-select: all;
  -webkit-user-select: all;
}

.recent { margin-top: 26px; }
.recent ul { list-style: none; margin: 0; padding: 0; }
.recent li a {
  display: block;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.foot { margin: 28px 4px 0; font-size: 14px; color: var(--muted); text-align: center; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}
