/* styles.css */
:root {
  --pink: #ec4899;
  --pink-dark: #db2777;
  --pink-deep: #be185d;
  --pink-light: #fce7f3;
  --pink-soft: #fbcfe8;
  --violet: #a855f7;
  --peach: #fb7185;
  --text: #4a2c3d;
  --muted: #a47f90;
  --glass: #ffffff9e;
  --glass-brd: #ffffffb3;
  --shadow: 0 20px 45px -18px #be185d73;
  --shadow-sm: 0 10px 28px -14px #be185d66;
}

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

html {
  scroll-behavior: smooth;
}

body {
  color: var(--text);
  position: relative;
  overflow-x: hidden;
  background: linear-gradient(160deg, #fff0f7 0%, #ffe9f3 40%, #fdeafe 100%);
  min-height: 100vh;
  padding-bottom: 7rem;
  font-family: Nunito, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Noto Sans, Ubuntu, Cantarell, Helvetica Neue, sans-serif;
}

.blobs {
  position: fixed;
  z-index: -1;
  overflow: hidden;
  filter: blur(70px);
  inset: 0;
}

.blob {
  position: absolute;
  opacity: .55;
  animation: float 18s ease-in-out infinite;
  border-radius: 50%;
}

.b1 {
  background: var(--pink);
  width: 340px;
  height: 340px;
  top: -80px;
  left: -60px;
}

.b2 {
  background: var(--violet);
  animation-delay: -6s;
  width: 300px;
  height: 300px;
  top: 30%;
  right: -90px;
}

.b3 {
  background: var(--peach);
  animation-delay: -12s;
  width: 320px;
  height: 320px;
  bottom: -100px;
  left: 25%;
}

@keyframes float {
  0%, 100% {
    transform: translate(0)scale(1);
  }

  33% {
    transform: translate(30px, -40px)scale(1.08);
  }

  66% {
    transform: translate(-25px, 25px)scale(.95);
  }
}

.app {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 0;
}

header {
  text-align: center;
  animation: rise .6s ease both;
  margin-bottom: 2rem;
}

h1 {
  letter-spacing: -.5px;
  background: linear-gradient(100deg, var(--pink-deep), var(--violet));
  -webkit-text-fill-color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
  font-family: Fraunces, serif;
  font-size: 2.6rem;
  font-weight: 600;
}

.spark {
  -webkit-text-fill-color: var(--pink);
  display: inline-block;
  animation: twinkle 2.4s ease-in-out infinite;
}

@keyframes twinkle {
  0%, 100% {
    transform: scale(1)rotate(0);
    opacity: 1;
  }

  50% {
    transform: scale(1.25)rotate(20deg);
    opacity: .7;
  }
}

.subtitle {
  color: var(--muted);
  margin-top: .35rem;
  font-size: .98rem;
  font-weight: 500;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .9rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-brd);
  text-align: center;
  box-shadow: var(--shadow-sm);
  display: flex;
  animation: rise .6s ease both;
  border-radius: 22px;
  flex-direction: column;
  align-items:  center;
  gap: .15rem;
  padding: 1.1rem .75rem;
}

.stat:nth-child(2) {
  animation-delay: 80ms;
}

.stat:nth-child(3) {
  animation-delay: .16s;
}

.stat-label {
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
}

.stat-value {
  color: var(--pink-deep);
  font-family: Fraunces, serif;
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.1;
}

.stat-value.up {
  color: var(--peach);
}

.stat-value.down {
  color: #12a594;
}

.stat-unit {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
}

.card {
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow);
  animation: rise .6s ease both;
  animation-delay: .12s;
  border-radius: 26px;
  margin-bottom: 1.5rem;
  padding: 1.5rem;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items:  center;
  margin-bottom: 1.1rem;
}

h2 {
  color: var(--pink-deep);
  font-family: Fraunces, serif;
  font-size: 1.4rem;
  font-weight: 600;
}

.pill {
  color: var(--pink-dark);
  background: #fce7f3cc;
  border-radius: 999px;
  padding: .3rem .7rem;
  font-size: .78rem;
  font-weight: 700;
}

.chart-wrap {
  position: relative;
  height: 260px;
}

.history {
  list-style: none;
}

.history li {
  display: flex;
  animation: slidein .4s ease both;
  border-bottom: 1px solid #fbcfe88c;
  border-radius: 14px;
  justify-content: space-between;
  align-items:  center;
  padding: .9rem .6rem;
  transition: background .18s, transform .18s;
}

.history li:last-child {
  border-bottom: none;
}

.history li:hover {
  background: #ffffff8c;
  transform: translateX(4px);
}

.history .h-date {
  font-weight: 600;
}

.history .h-right {
  display: flex;
  align-items:  center;
  gap: .85rem;
}

.history .h-weight {
  color: var(--pink-deep);
  text-align: right;
  min-width: 3.5rem;
  font-family: Fraunces, serif;
  font-size: 1.15rem;
  font-weight: 700;
}

.history .h-delta {
  background: var(--pink-light);
  color: var(--muted);
  border-radius: 999px;
  padding: .18rem .5rem;
  font-size: .76rem;
  font-weight: 700;
}

.history .h-delta.up {
  color: #e11d6b;
  background: #ffe4e6;
}

.history .h-delta.down {
  color: #0f9b86;
  background: #d1fae5;
}

.delete-btn {
  color: var(--pink-soft);
  cursor: pointer;
  background: none;
  border: none;
  border-radius: 8px;
  padding: .2rem;
  transition: color .15s, background .15s;
  font-size: 1rem;
  line-height: 1;
}

.delete-btn:hover {
  color: var(--pink-deep);
  background: #fbcfe880;
}

.empty {
  text-align: center;
  color: var(--muted);
  padding: 2.5rem 0;
  font-weight: 500;
}

.empty b {
  color: var(--pink-dark);
}

.hidden {
  display: none !important;
}

.fab {
  position: fixed;
  background: linear-gradient(135deg, var(--peach) 0%, var(--pink) 45%, var(--violet) 100%);
  color: #fff;
  cursor: pointer;
  display: grid;
  border: none;
  border-radius: 50%;
  place-items:  center;
  width: 64px;
  height: 64px;
  transition: transform .18s, box-shadow .18s;
  bottom: 1.9rem;
  right: 1.9rem;
  box-shadow: 0 12px 30px -6px #db277799;
}

.fab:after {
  content: "";
  position: absolute;
  background: inherit;
  z-index: -1;
  animation: pulse 2.4s ease-out infinite;
  border-radius: 50%;
  inset: 0;
}

.fab-plus {
  font-size: 2.1rem;
  font-weight: 300;
  line-height: 1;
}

.fab:hover {
  transform: scale(1.1)rotate(90deg);
  box-shadow: 0 16px 38px -6px #a855f7a6;
}

.fab:active {
  transform: scale(.95);
}

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: .55;
  }

  70%, 100% {
    transform: scale(1.7);
    opacity: 0;
  }
}

.modal-overlay {
  position: fixed;
  display: flex;
  z-index: 10;
  backdrop-filter: blur(4px);
  animation: fade .2s ease;
  background: #4a2c3d59;
  justify-content: center;
  align-items:  center;
  padding: 1rem;
  inset: 0;
}

.modal {
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-brd);
  box-shadow: var(--shadow);
  animation: pop .3s cubic-bezier(.34, 1.56, .64, 1);
  background: #ffffffe6;
  border-radius: 26px;
  width: 100%;
  max-width: 390px;
  padding: 1.9rem;
}

.modal h2 {
  margin-bottom: 1.3rem;
}

#weight-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

#weight-form label {
  display: flex;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  flex-direction: column;
  gap: .45rem;
  font-size: .82rem;
  font-weight: 700;
}

#weight-form input {
  border: 2px solid var(--pink-light);
  color: var(--text);
  background: #ffffffb3;
  border-radius: 14px;
  padding: .8rem 1rem;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
  font-size: 1.05rem;
}

#weight-form input:focus {
  outline: none;
  border-color: var(--pink);
  box-shadow: 0 0 0 4px #ec489926;
}

.form-error {
  color: var(--pink-deep);
  font-size: .85rem;
  font-weight: 600;
}

.modal-actions {
  display: flex;
  gap: .75rem;
  margin-top: .4rem;
}

.btn {
  cursor: pointer;
  border: none;
  border-radius: 14px;
  flex: 1;
  padding: .8rem;
  transition: transform .12s, box-shadow .15s, opacity .15s;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
}

.btn:active {
  transform: scale(.97);
}

.btn.primary {
  background: linear-gradient(135deg, var(--pink) 0%, var(--violet) 100%);
  color: #fff;
  box-shadow: 0 8px 20px -6px #db277799;
}

.btn.primary:hover {
  box-shadow: 0 12px 26px -6px #a855f7a6;
}

.btn.ghost {
  background: var(--pink-light);
  color: var(--pink-deep);
}

.btn.ghost:hover {
  background: var(--pink-soft);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slidein {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fade {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(.9)translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1)translateY(0);
  }
}

@media (width <= 420px) {
  h1 {
    font-size: 2.1rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .app {
    padding-top: 1.75rem;
  }
}

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