:root {
  --fawn: #D4A063;
  --fawn-dark: #C08349;
  --cream: #F3E3C8;
  --sand: #FDF8F0;
  --sand-2: #F1E4CE;
  --ink: #2A3D5C;
  --muted: #7A6A55;
  --gold: #C9A227;
  --pink: #E8759B;
  --pink-ink: #4B1528;
  --line: #E3D6C2;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  max-width: 480px;
  margin-inline: auto;
  background: var(--sand);
  color: var(--ink);
  font: 400 16px/1.5 "Poppins", system-ui, -apple-system, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

h1 { font-size: 20px; font-weight: 500; margin: 12px 0 4px; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }
.center { text-align: center; padding-top: 32px; }
.error { color: #A32D2D; font-size: 13px; }

.head { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; }
.avatar { border-radius: 50%; background: var(--sand-2); }

.balance { font-size: 40px; font-weight: 500; margin: 0 0 4px; letter-spacing: -0.5px; }

.bar { background: var(--sand-2); height: 8px; border-radius: 4px; margin: 14px 0 8px; }
.bar-fill { background: var(--gold); height: 8px; border-radius: 4px; width: 0; transition: width .4s ease; }

button {
  font: inherit; font-size: 15px; border-radius: var(--radius);
  padding: 12px 16px; cursor: pointer; border: none; width: 100%;
}
.primary { background: var(--pink); color: var(--pink-ink); font-weight: 500; margin-top: 20px; }
.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button:active { transform: scale(.985); }

input {
  font: inherit; width: 100%; padding: 12px 14px; margin: 6px 0 14px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--ink);
}
input:focus { outline: 2px solid var(--fawn); outline-offset: 1px; }

.entries { list-style: none; padding: 0; margin: 32px 0 0; }
.entries li {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.entries .amt { font-weight: 500; font-variant-numeric: tabular-nums; }
.entries .neg { color: #A32D2D; }
.entries .when { font-size: 12px; color: var(--muted); }

dialog {
  border: none; border-radius: 16px; padding: 20px;
  width: min(90vw, 360px); background: var(--sand); color: var(--ink);
}
dialog::backdrop { background: rgba(42, 61, 92, .35); }
dialog label { font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 10px; }
.row button { margin-top: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: var(--sand-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 18px 8px 8px; font-size: 15px; font-weight: 500;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

[hidden] { display: none !important; }

body { padding-top: 48px; }

#pin-screen {
  min-height: 80vh;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  padding-top: 0;
}
#pin-screen input, #pin-screen .primary { max-width: 280px; }

.goal-line {
  width: auto; padding: 2px 0; background: none; border: none;
  color: var(--muted); font-size: 13px; text-align: left;
  text-decoration: underline; text-underline-offset: 3px;
  text-decoration-color: var(--line);
}
.goals { list-style: none; padding: 0; margin: 8px 0 20px; }
.goals li {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px;
}
.goals .when { font-size: 12px; color: var(--muted); }
.link {
  width: auto; padding: 4px 8px; background: none; border: none;
  color: var(--muted); font-size: 13px; text-decoration: underline;
}
dialog h1 { margin-top: 0; }


.brand {
  font-family: "Pacifico", cursive;
  font-size: 17px; color: var(--ink); line-height: 1.3;
}
.brand-big { font-size: 24px; font-weight: 400; margin: 14px 0 18px; }

.balance { font-weight: 600; }

.goal-line {
  width: auto; display: inline-flex; align-items: center; gap: 8px;
  margin-top: 6px; padding: 7px 14px;
  background: var(--sand-2); border: 1px solid var(--line);
  border-radius: 999px; color: var(--ink); font-size: 14px;
  text-decoration: none;
}
.goal-line svg { color: var(--muted); flex-shrink: 0; }
.goal-line:active { background: var(--cream); }

.bar { margin-top: 18px; }

.chat { margin-top: 28px; }
#chat-log { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.bubble {
  max-width: 85%; padding: 9px 14px; border-radius: 16px; font-size: 14px;
  line-height: 1.45; white-space: pre-wrap;
}
.bubble.me { align-self: flex-end; background: var(--pink); color: var(--pink-ink); border-bottom-right-radius: 4px; }
.bubble.pinky { align-self: flex-start; background: var(--sand-2); color: var(--ink); border-bottom-left-radius: 4px; }
.bubble.proposal { display: flex; flex-direction: column; gap: 10px; max-width: 100%; }
.bubble.proposal .row button { margin: 0; padding: 8px 14px; font-size: 14px; }
.chat-row { display: flex; gap: 8px; align-items: center; }
.chat-row input { margin: 0; }
.chat-send { width: auto; padding: 12px 16px; font-size: 18px; line-height: 1; }

.foot {
  display: flex; gap: 4px; justify-content: center;
  margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line);
}

.head { align-items: center; gap: 14px; margin-bottom: 28px; }
.avatar { width: 64px; height: 64px; flex-shrink: 0; }
.brand { font-size: clamp(21px, 6vw, 30px); line-height: 1.25; }
.brand-big { font-size: clamp(26px, 8vw, 36px); }
#pin-screen img { width: 128px; height: 128px; }
