:root {
  --bg: #fff7f6;
  --card: #ffffff;
  --text: #2e2d2b;
  --muted: #6f6b66;
  --accent: #f7d7df;
  --accent-strong: #ef9fb2;
  --accent-deep: #d75b78;
  --high: #e77c8e;
  --medium: #f1c36d;
  --low: #b5b0ab;
  --ok: #4f966a;
  --shadow: 0 12px 32px rgba(116, 55, 75, 0.1);
  --heart-glow: 0 0 26px rgba(239, 159, 178, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 209, 221, 0.72), transparent 32%),
    radial-gradient(circle at 86% 24%, rgba(246, 218, 198, 0.62), transparent 30%),
    radial-gradient(circle at 48% 90%, rgba(255, 230, 235, 0.8), transparent 36%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body::before,
body::after {
  content: "♡";
  position: fixed;
  z-index: 0;
  color: rgba(239, 159, 178, 0.16);
  font-size: clamp(90px, 13vw, 190px);
  line-height: 1;
  pointer-events: none;
  filter: blur(0.2px);
  animation: softPulse 6s ease-in-out infinite;
}

body::before {
  left: -24px;
  top: 90px;
  transform: rotate(-18deg);
}

body::after {
  right: -18px;
  bottom: 40px;
  transform: rotate(14deg);
  animation-delay: 1.7s;
}

.app {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 14px;
}

.card {
  position: relative;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 20px;
  padding: 15px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(247, 215, 223, 0.85);
  backdrop-filter: blur(12px);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 45px rgba(116, 55, 75, 0.13);
  border-color: rgba(239, 159, 178, 0.72);
}

h1,
h2,
h3,
p {
  margin: 0;
}

.subtitle {
  margin-top: 6px;
  color: var(--muted);
}

.mini-label {
  width: fit-content;
  margin-bottom: 7px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #fff0f4;
  color: var(--accent-deep);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.header {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
}

.user-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 0.92rem;
}

#userEmail {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-heart {
  color: var(--accent-deep);
  font-size: 1.25rem;
  animation: heartBeat 1.9s ease-in-out infinite;
}

.overview-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.overview-item {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #fff, #fff4f7);
  border: 1px solid #f4dbe1;
  border-radius: 18px;
  padding: 13px;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.overview-item::after {
  content: "♡";
  position: absolute;
  right: 12px;
  bottom: -16px;
  color: rgba(215, 91, 120, 0.12);
  font-size: 54px;
}

.overview-item:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: var(--heart-glow);
}

.overview-item .label {
  color: var(--muted);
  font-size: 0.9rem;
}

.overview-item .value {
  font-size: 1.15rem;
  font-weight: 800;
  margin-top: 5px;
}

.can-buy-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--text);
}

.can-buy-list li {
  margin: 6px 0;
}

form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

label {
  display: grid;
  gap: 5px;
  font-size: 0.92rem;
}

input,
select,
textarea,
button {
  font: inherit;
}

input,
select,
textarea {
  border: 1px solid #ead5db;
  border-radius: 13px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.95);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #efb7c4;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 4px rgba(239, 159, 178, 0.22);
  transform: translateY(-1px);
}

.field-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.actions-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  position: relative;
  overflow: hidden;
  border: none;
  border-radius: 13px;
  background: #f7edf0;
  color: var(--text);
  text-decoration: none;
  padding: 9px 14px;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn::after {
  content: "";
  position: absolute;
  inset: auto auto 50% 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  transform: translate(-50%, 50%) scale(0);
  opacity: 0;
  pointer-events: none;
}

.btn:active::after {
  animation: ripple 0.48s ease-out;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(116, 55, 75, 0.13);
}

.btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn.primary {
  background: linear-gradient(135deg, #ef9fb2, #e77c8e);
  color: #421c28;
  font-weight: 800;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid #dfc7cf;
}

.btn.small {
  font-size: 0.88rem;
  padding: 7px 10px;
}

.btn.danger {
  background: #f5d5dc;
  color: #8a2f44;
}

.heart-btn::before {
  content: "♡";
  margin-right: 6px;
  color: rgba(122, 38, 60, 0.76);
}

.hidden {
  display: none !important;
}

.app-message {
  border-radius: 16px;
  padding: 12px 14px;
  background: #fff0f4;
  border: 1px solid #efc5cf;
  color: #734b31;
  animation: slideDown 0.28s ease-out;
}

.toolbar-top {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  align-items: center;
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab-btn {
  border: 1px solid #ead5db;
  border-radius: 999px;
  padding: 7px 12px;
  background: #fff;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.tab-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(116, 55, 75, 0.1);
}

.tab-btn.active {
  background: linear-gradient(135deg, #ffe3ea, #f7d7df);
  color: #773347;
  font-weight: 800;
}

.filters {
  margin-top: 10px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.item-card {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  animation: cardIn 0.3s ease-out;
}

.item-card.just-added {
  animation: popSuccess 0.78s ease-out;
}

.favorite-heart {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(239, 159, 178, 0.58);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--accent-deep);
  cursor: pointer;
  font-size: 1.15rem;
  box-shadow: 0 8px 18px rgba(116, 55, 75, 0.08);
  transition: transform 0.18s ease, background 0.18s ease;
}

.favorite-heart:hover {
  transform: scale(1.12) rotate(-8deg);
  background: #fff0f4;
}

.favorite-heart.active {
  color: #fff;
  background: linear-gradient(135deg, #ef9fb2, #e77c8e);
  animation: heartPop 0.42s ease-out;
}

.item-image-wrap {
  width: 100px;
  height: 100px;
  border-radius: 16px;
  overflow: hidden;
  background: #f7edf0;
  border: 1px solid #f1dce2;
}

.item-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.32s ease, filter 0.32s ease;
}

.item-card:hover .item-image {
  transform: scale(1.06);
  filter: saturate(1.04);
}

.item-content {
  display: grid;
  gap: 7px;
}

.item-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-right: 32px;
}

.priority-badge {
  border-radius: 999px;
  font-size: 0.8rem;
  padding: 4px 8px;
  height: fit-content;
  white-space: nowrap;
}

.priority-high {
  background: #ffe2e7;
  color: #9c3547;
}

.priority-medium {
  background: #fff2d6;
  color: #916316;
}

.priority-low {
  background: #ece8e5;
  color: #635f5b;
}

.item-meta,
.item-store,
.item-comment {
  color: var(--muted);
  font-size: 0.9rem;
}

.money-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.92rem;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar {
  position: relative;
  flex: 1;
  height: 11px;
  border-radius: 999px;
  background: #f2e3e7;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #ef9fb2, #e77c8e, #f1c36d);
  box-shadow: 0 0 16px rgba(239, 159, 178, 0.42);
  transition: width 0.55s ease;
}

.progress-fill::after {
  content: "♡";
  position: absolute;
  right: 3px;
  top: 50%;
  color: rgba(255, 255, 255, 0.92);
  font-size: 10px;
  transform: translateY(-52%);
}

.progress-text {
  min-width: 40px;
  font-size: 0.83rem;
  color: var(--muted);
}

.status-badge {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.84rem;
}

.status-saving {
  background: #f6e6dc;
}

.status-canbuy {
  background: #e0f0e4;
  color: #2f7348;
  animation: glowReady 1.7s ease-in-out infinite;
}

.status-bought {
  background: #e7e7e7;
}

/* Auth */
.auth-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 18px;
  display: grid;
  place-items: center;
}

.auth-card {
  position: relative;
  width: min(460px, 100%);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(247, 215, 223, 0.9);
  border-radius: 26px;
  box-shadow: 0 24px 80px rgba(116, 55, 75, 0.16);
  padding: 26px;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.auth-card::after {
  content: "♡";
  position: absolute;
  right: -14px;
  bottom: -34px;
  color: rgba(215, 91, 120, 0.1);
  font-size: 148px;
  line-height: 1;
}

.auth-kicker {
  width: fit-content;
  border-radius: 999px;
  background: #fff0f4;
  border: 1px solid #f0c8d2;
  color: #9b3650;
  font-weight: 800;
  font-size: 0.86rem;
  padding: 6px 10px;
  margin-bottom: 14px;
}

.auth-form {
  margin-top: 18px;
  position: relative;
  z-index: 1;
}

.auth-actions {
  margin-top: 4px;
}

.auth-message {
  min-height: 22px;
  color: #8b5338;
  font-size: 0.92rem;
}

.auth-message.error {
  color: #9c3547;
}

.auth-message.success {
  color: #2f7348;
}

.heart-orbit {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.heart-orbit span {
  position: absolute;
  color: rgba(215, 91, 120, 0.24);
  animation: orbitHeart 5s ease-in-out infinite;
}

.heart-orbit span:nth-child(1) {
  top: 22px;
  right: 36px;
  font-size: 22px;
}

.heart-orbit span:nth-child(2) {
  top: 72px;
  right: 18px;
  font-size: 15px;
  animation-delay: 1.1s;
}

.heart-orbit span:nth-child(3) {
  bottom: 34px;
  left: 28px;
  font-size: 18px;
  animation-delay: 2s;
}

/* Toast + hearts */
.toast {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(520px, calc(100vw - 28px));
  border-radius: 999px;
  padding: 12px 18px;
  background: rgba(46, 45, 43, 0.9);
  color: #fff;
  box-shadow: 0 18px 55px rgba(52, 35, 24, 0.22);
  backdrop-filter: blur(12px);
  animation: toastIn 0.25s ease-out;
}

.toast::before {
  content: "♥";
  color: #ffbdcb;
  margin-right: 8px;
}

.floating-hearts {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.floating-hearts span {
  position: absolute;
  bottom: -40px;
  color: rgba(215, 91, 120, 0.18);
  font-size: 20px;
  animation: floatHeart 12s linear infinite;
}

.floating-hearts span:nth-child(1) { left: 8%; animation-delay: 0s; }
.floating-hearts span:nth-child(2) { left: 22%; animation-delay: 2.1s; font-size: 14px; }
.floating-hearts span:nth-child(3) { left: 42%; animation-delay: 4.4s; font-size: 24px; }
.floating-hearts span:nth-child(4) { left: 61%; animation-delay: 1.2s; }
.floating-hearts span:nth-child(5) { left: 78%; animation-delay: 5.7s; font-size: 16px; }
.floating-hearts span:nth-child(6) { left: 92%; animation-delay: 3.6s; font-size: 22px; }

.burst-heart {
  position: fixed;
  z-index: 40;
  pointer-events: none;
  color: var(--accent-deep);
  font-size: 18px;
  animation: burstHeart 0.8s ease-out forwards;
  text-shadow: 0 6px 20px rgba(215, 91, 120, 0.24);
}

@keyframes floatHeart {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
    opacity: 0;
  }
  12% {
    opacity: 0.9;
  }
  100% {
    transform: translateY(-115vh) translateX(32px) rotate(220deg);
    opacity: 0;
  }
}

@keyframes burstHeart {
  0% {
    transform: translate(-50%, -50%) scale(0.6) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.35) rotate(var(--rot));
    opacity: 0;
  }
}

@keyframes heartBeat {
  0%, 100% { transform: scale(1); }
  35% { transform: scale(1.22); }
  55% { transform: scale(0.96); }
}

@keyframes heartPop {
  0% { transform: scale(0.8); }
  55% { transform: scale(1.22) rotate(-8deg); }
  100% { transform: scale(1); }
}

@keyframes ripple {
  0% { transform: translate(-50%, 50%) scale(0); opacity: 0.65; }
  100% { transform: translate(-50%, 50%) scale(18); opacity: 0; }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 18px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes popSuccess {
  0% { transform: scale(0.98); box-shadow: var(--shadow); }
  45% { transform: scale(1.025); box-shadow: 0 0 0 6px rgba(239, 159, 178, 0.18), var(--heart-glow); }
  100% { transform: scale(1); box-shadow: var(--shadow); }
}

@keyframes glowReady {
  0%, 100% { box-shadow: 0 0 0 rgba(79, 150, 106, 0); }
  50% { box-shadow: 0 0 18px rgba(79, 150, 106, 0.22); }
}

@keyframes softPulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 0.85; }
}

@keyframes orbitHeart {
  0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.35; }
  50% { transform: translateY(-8px) rotate(14deg); opacity: 0.7; }
}

@media (max-width: 768px) {
  .overview-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .item-card {
    grid-template-columns: 1fr;
  }

  .item-image-wrap {
    width: 100%;
    height: 170px;
  }

  .header,
  .toolbar-top {
    align-items: flex-start;
    flex-direction: column;
  }

  .user-bar {
    justify-content: flex-start;
  }

  #userEmail {
    max-width: 100%;
  }

  .toast {
    bottom: 14px;
    border-radius: 18px;
  }

  body::before,
  body::after {
    opacity: 0.4;
  }
}
