@font-face { font-family: Fredoka; font-weight: 400; src: url(fonts/fredoka-latin-400-normal.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: Fredoka; font-weight: 600; src: url(fonts/fredoka-latin-600-normal.woff2) format('woff2'); font-display: swap; }

/* Change the app's colors here. */
:root {
  --background: #dcebff;
  --card: #ffffff;
  --ink: #3b2a5c;
  --money: #7edba6;
  --gold: #ffcb47;
  --pink: #ff8fb4;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  font-family: Fredoka, system-ui, sans-serif;
  color: var(--ink);
  background-color: var(--background);
  background-image: radial-gradient(#ffffff 3px, transparent 4px); /* polka dots */
  background-size: 34px 34px;
}

main {
  width: min(100%, 23rem);
  padding: 1.5rem;
  text-align: center;
  background: var(--card);
  border: 3px solid var(--ink);
  border-radius: 2rem;
  box-shadow: 0 8px 0 var(--ink);
}

h1 { margin: 0; font-size: 2rem; font-weight: 600; }

/* The jar */
#jar { display: block; width: 13rem; margin: 0.5rem auto 0; }
.glass { fill: #f1f8ff; }
.money { fill: var(--money); }
.gold, #coin { fill: var(--gold); stroke: var(--ink); stroke-width: 3; }
.outline { fill: none; stroke: var(--ink); stroke-width: 5; }
.shine { fill: none; stroke: #ffffff; stroke-width: 9; stroke-linecap: round; opacity: 0.85; }
.lid { fill: var(--pink); stroke: var(--ink); stroke-width: 5; }
.slot { fill: var(--ink); }

#fill { transform: translateY(215px); transition: transform 0.8s cubic-bezier(0.3, 1.4, 0.5, 1); }

.face { fill: var(--ink); }
.cheek { fill: var(--pink); opacity: 0.75; }
.smile { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }

/* The coin that drops in when you add money */
#coin { opacity: 0; }
#coin.drop { animation: drop 0.55s ease-in; }
@keyframes drop {
  0%   { opacity: 1; transform: translateY(0); }
  80%  { opacity: 1; transform: translateY(36px); }
  100% { opacity: 0; transform: translateY(42px); }
}

.total { margin: 0.75rem 0 0; font-size: 1.25rem; }
#saved { font-size: 2.25rem; font-weight: 600; }
#message { min-height: 1.5em; margin: 0.25rem 0 1rem; }

label { display: block; margin-bottom: 0.4rem; text-align: left; }
.row { display: flex; gap: 0.5rem; }

input, button { font: inherit; color: inherit; border-radius: 999px; }
input { flex: 1; min-width: 0; padding: 0.6rem 1rem; border: 3px solid var(--ink); }

button { cursor: pointer; }
button:disabled { opacity: 0.5; cursor: wait; }
button[type="submit"] {
  padding: 0.6rem 1.1rem;
  font-weight: 600;
  background: var(--gold);
  border: 3px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink);
}
button[type="submit"]:active { transform: translateY(4px); box-shadow: none; }

#reset { margin-top: 1.25rem; background: none; border: 0; text-decoration: underline; }

input:focus-visible, button:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
  #fill { transition: none; }
  #coin.drop { animation: none; }
}
