:root {
  --white: #ffffff;
  --ink: #3a0d1e;
  --berry: #ff4f7f;
  --berry-deep: #e63368;
  --cream: #ffe3ea;
  --muted: #a07f8a;
  --line: #f6e4ea;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Onest", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; }

html, body {
  background: var(--white);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.serif {
  font-family: var(--serif);
  font-variation-settings: "SOFT" 100, "WONK" 0;
}

main {
  max-width: 440px;
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 20px max(40px, env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main.center { justify-content: center; align-items: center; text-align: center; gap: 28px; }

:focus-visible { outline: 3px solid var(--berry); outline-offset: 3px; }

/* header */
header { display: flex; justify-content: space-between; align-items: center; }
header form { margin: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.logo-sm { width: 28px; height: 28px; }
.link {
  background: none; border: 0; padding: 6px 0;
  color: var(--muted); font: inherit; font-size: 14px; cursor: pointer;
}

/* other person's score */
.other { text-align: center; margin-top: 40px; }
.other-name { font-size: 26px; font-weight: 500; }
.score {
  font-size: clamp(120px, 40vw, 176px);
  font-weight: 650;
  line-height: 0.95;
  font-variant-numeric: lining-nums tabular-nums;
  letter-spacing: -0.03em;
  display: inline-block;
}
.unit { color: var(--muted); font-size: 15px; }

/* the plus */
.plus-wrap { position: relative; display: grid; place-items: center; margin: 36px 0 8px; }
.plus {
  width: 168px; height: 168px;
  border: 0; border-radius: 50%;
  background: var(--berry);
  display: grid; place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 0 var(--berry-deep);
  transform: translateY(0);
  transition: transform 0.08s, box-shadow 0.08s;
}
.plus svg { width: 72px; height: 72px; }
.plus:active { transform: translateY(8px); box-shadow: 0 2px 0 var(--berry-deep); }
.plus:disabled { cursor: default; }
.plus-caption { text-align: center; color: var(--muted); font-size: 15px; margin-top: 18px; }

.floater {
  position: absolute; top: 0; left: 50%;
  font-family: var(--serif); font-variation-settings: "SOFT" 100;
  font-size: 40px; font-weight: 700; color: var(--berry);
  pointer-events: none;
  animation: float 0.9s ease-out forwards;
}

/* own score + withdraw */
.mine {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-top: 40px; padding: 14px 14px 14px 20px;
  background: var(--cream); border-radius: 999px;
}
.mine-text { font-size: 15px; }
.mine-text b { font-family: var(--serif); font-variation-settings: "SOFT" 100; font-size: 24px; font-weight: 650; margin-left: 4px; }

.pill {
  display: inline-block;
  border: 1.5px solid var(--ink);
  background: var(--white); color: var(--ink);
  border-radius: 999px;
  padding: 10px 18px;
  font: inherit; font-size: 15px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  transition: transform 0.08s;
}
.pill:active { transform: scale(0.96); }
.pill:disabled { border-color: transparent; color: var(--muted); background: transparent; cursor: not-allowed; transform: none; }
.pill.armed { background: var(--berry); border-color: var(--berry); color: var(--white); }
.pill.solid { background: var(--berry); border-color: var(--berry); color: var(--white); padding: 14px 26px; font-size: 16px; }

.error { color: var(--berry-deep); text-align: center; font-size: 14px; min-height: 1.4em; margin-top: 10px; }

/* history */
.history { margin-top: 28px; }
.history h2 { font-family: var(--serif); font-variation-settings: "SOFT" 100; font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.history ul { list-style: none; padding: 0; }
.history li {
  display: grid; grid-template-columns: 52px 1fr auto; align-items: baseline; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 15px;
}
.history .delta { font-family: var(--serif); font-variation-settings: "SOFT" 100; font-weight: 700; font-size: 18px; color: var(--berry); }
.history .delta.neg { color: var(--muted); }
.history time { color: var(--muted); font-size: 13px; white-space: nowrap; }
.history .empty { display: block; color: var(--muted); text-align: center; border: 0; padding: 20px 0; }

/* login */
.logo-lg { width: 112px; height: 112px; }
.title { font-size: 48px; font-weight: 650; letter-spacing: -0.02em; line-height: 1; }
.tagline { color: var(--muted); margin-top: -16px; }

@keyframes float {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.8); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -70px) scale(1.1); }
}

/* ---------- moments ---------- */
#fx { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 55; }

.plus.jelly { animation: jelly 0.6s cubic-bezier(.3, 1.4, .5, 1); }
.ring {
  position: absolute; inset: 0; margin: auto; width: 168px; height: 168px; border-radius: 50%;
  border: 4px solid var(--berry); pointer-events: none;
  animation: ring 0.6s ease-out forwards;
}

.pop { animation: pop 0.9s cubic-bezier(.3, 1.8, .5, 1); }
.score.pop { display: inline-block; }
#my-score { display: inline-block; }
.drain { animation: drain 0.7s ease-in-out; }

.mine.shake { animation: shake 0.5s cubic-bezier(.36, .07, .19, .97); }
.mine.glow { animation: glow 1.2s ease-out; }

.slam {
  position: fixed; inset: 0; z-index: 50; pointer-events: none;
  display: grid; place-content: center; text-align: center; opacity: 0;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.slam.show { animation: slam-fade 1.6s ease-out forwards; }
.slam-num { font-size: 132px; font-weight: 800; color: var(--ink); line-height: 1; display: block; }
.slam.show .slam-num { animation: slam-in 1.6s cubic-bezier(.2, 1.5, .4, 1) forwards; }
.slam-sub { display: block; font-family: var(--serif); font-variation-settings: "SOFT" 100, "WONK" 1; font-style: italic; font-size: 30px; color: var(--berry); margin-top: 4px; }
.slam.show .slam-sub { animation: rise 1.6s ease-out forwards; }

.toast {
  position: fixed; left: 50%; top: max(16px, env(safe-area-inset-top)); z-index: 60;
  transform: translate(-50%, -140%);
  background: var(--ink); color: var(--white);
  padding: 12px 20px; border-radius: 999px; font-weight: 500; font-size: 15px;
  white-space: nowrap; pointer-events: none;
  opacity: 0; visibility: hidden;
  transition: transform 0.45s cubic-bezier(.3, 1.5, .5, 1), opacity 0.3s, visibility 0s 0.45s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: transform 0.45s cubic-bezier(.3, 1.5, .5, 1), opacity 0.2s; }

.history li.fresh { animation: fresh 1.4s ease-out; }

@keyframes jelly {
  0% { transform: scale(1, 1); }
  25% { transform: scale(1.18, 0.82); }
  45% { transform: scale(0.88, 1.12); }
  65% { transform: scale(1.06, 0.95); }
  85% { transform: scale(0.98, 1.02); }
  100% { transform: scale(1, 1); }
}
@keyframes ring { from { transform: scale(1); opacity: 0.7; } to { transform: scale(1.9); opacity: 0; } }
@keyframes pop { 0% { transform: scale(1); } 25% { transform: scale(1.22) rotate(-3deg); color: var(--berry); } 60% { transform: scale(1); color: var(--berry); } 100% { color: var(--ink); } }
@keyframes drain { 0% { transform: scale(1); } 30% { transform: scale(0.7) translateY(6px); } 100% { transform: scale(1); } }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(5px) rotate(1deg); }
  30%, 50%, 70% { transform: translateX(-9px) rotate(-1.5deg); }
  40%, 60% { transform: translateX(9px) rotate(1.5deg); }
}
@keyframes glow {
  0% { box-shadow: 0 0 0 0 rgba(255, 79, 127, 0.55); background: #ffc4d3; }
  100% { box-shadow: 0 0 0 22px rgba(255, 79, 127, 0); background: var(--cream); }
}
@keyframes slam-fade { 0% { opacity: 0; } 8% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
@keyframes slam-in {
  0% { transform: scale(3.2) rotate(-12deg); }
  22% { transform: scale(0.92) rotate(3deg); }
  32% { transform: scale(1.04) rotate(-1deg); }
  45%, 70% { transform: scale(1) rotate(0); }
  100% { transform: translateY(60px) scale(0.9); }
}
@keyframes rise { 0%, 20% { opacity: 0; transform: translateY(12px); } 35%, 75% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; } }
@keyframes fresh { from { background: var(--cream); } to { background: transparent; } }

@media (prefers-reduced-motion: reduce) {
  .floater, .ring { display: none; }
  .plus.jelly, .pop, .drain, .mine.shake, .mine.glow, .history li.fresh,
  .slam.show .slam-num, .slam.show .slam-sub { animation: none; }
  .slam.show { animation-duration: 1.2s; }
}
