:root {
  --bg: #f5f7ff;
  --card: #ffffff;
  --stroke: #e8ecf8;
  --text: #1a1d2e;
  --muted: #7b82a3;
  --muted2: #b0b6cc;

  --primary: #4f6ef7;
  --primary-light: rgba(79,110,247,.12);
  --accent: #22c55e;
  --accent-light: rgba(34,197,94,.12);
  --danger: #f43f5e;
  --danger-light: rgba(244,63,94,.10);

  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 8px 40px rgba(79,110,247,.10);
  --shadow-card: 0 2px 24px rgba(26,29,46,.07);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Nunito', ui-sans-serif, system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- Background blobs ---- */
.bg-blobs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .45;
}
.blob-1 {
  width: 600px; height: 600px;
  background: radial-gradient(circle, #c7d4ff, #e5ebff);
  top: -180px; left: -180px;
}
.blob-2 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, #bbf7d0, #dcfce7);
  bottom: -120px; right: -100px;
}
.blob-3 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, #fde68a, #fef3c7);
  top: 40%; left: 60%;
  opacity: .30;
}

/* ---- Layout ---- */
.app {
  position: relative;
  z-index: 1;
  width: min(820px, 94vw);
  margin: 48px auto 60px;
}

/* ---- Header ---- */
.header {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.title-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  font-size: 36px;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(79,110,247,.25));
}

h1 {
  margin: 0;
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 900;
  letter-spacing: -.5px;
  color: var(--text);
}

.subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

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

/* ---- Card ---- */
.card {
  background: var(--card);
  border: 1.5px solid var(--stroke);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 24px;
}

/* ---- Form ---- */
.add-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

input[type="text"] {
  flex: 1;
  height: 48px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--stroke);
  background: var(--bg);
  color: var(--text);
  padding: 0 16px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
input[type="text"]::placeholder {
  color: var(--muted2);
  font-weight: 500;
}
input[type="text"]:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79,110,247,.13);
  background: #fff;
}

/* ---- Buttons ---- */
.btn {
  height: 48px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  border: 1.5px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform .1s, box-shadow .15s, filter .15s;
  user-select: none;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-icon {
  font-size: 15px;
  font-weight: 900;
}

.btn-primary {
  background: var(--primary-light);
  border-color: rgba(79,110,247,.25);
  color: var(--primary);
}
.btn-primary:hover {
  background: rgba(79,110,247,.18);
  box-shadow: 0 4px 14px rgba(79,110,247,.18);
}

.btn-accent {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 14px rgba(34,197,94,.30);
}
.btn-accent:hover {
  filter: brightness(1.07);
  box-shadow: 0 6px 20px rgba(34,197,94,.38);
}

.btn-ghost {
  background: transparent;
  border-color: var(--stroke);
  color: var(--muted);
}
.btn-ghost:hover {
  background: var(--danger-light);
  border-color: rgba(244,63,94,.25);
  color: var(--danger);
}

/* ---- Meta row ---- */
.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 2px 8px;
  font-size: 13px;
}

.count {
  font-weight: 800;
  color: var(--text);
  background: var(--primary-light);
  padding: 4px 12px;
  border-radius: 99px;
  color: var(--primary);
  font-size: 13px;
}

.hint {
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
}
.hint kbd {
  font-family: ui-monospace, monospace;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 7px;
  border: 1.5px solid var(--stroke);
  background: var(--bg);
  color: var(--muted);
}

/* ---- List ---- */
.list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--stroke);
  background: var(--bg);
  transition: border-color .2s, background .2s, opacity .2s;
  animation: slideIn .22s ease;
}
.item:hover {
  border-color: rgba(79,110,247,.22);
  background: #fff;
}

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

.item.bought {
  opacity: .75;
  background: var(--accent-light);
  border-color: rgba(34,197,94,.20);
}

.left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

/* Custom checkbox */
.checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 2px solid var(--stroke);
  background: #fff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: border-color .2s, background .2s;
}
.checkbox:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.checkbox:checked::after {
  content: '';
  position: absolute;
  top: 3px; left: 6px;
  width: 6px; height: 10px;
  border: 2.5px solid #fff;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}
.checkbox:hover:not(:checked) {
  border-color: var(--accent);
}

.label {
  font-size: 15px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color .2s;
}

.item.bought .label {
  color: var(--muted);
  text-decoration: line-through;
  font-weight: 600;
}

/* Delete button */
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid transparent;
  background: transparent;
  cursor: pointer;
  color: var(--muted2);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
}
.icon-btn:hover {
  background: var(--danger-light);
  border-color: rgba(244,63,94,.20);
  color: var(--danger);
}
.icon-btn:active { transform: scale(.92); }

/* ---- Footer ---- */
.footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1.5px solid var(--stroke);
  color: var(--muted2);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}

/* ---- Accessibility ---- */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---- Responsive ---- */
@media (max-width: 560px) {
  .app { margin: 24px auto 40px; }
  .header { flex-direction: column; align-items: flex-start; gap: 14px; }
  .actions { width: 100%; }
  .btn { flex: 1; justify-content: center; }
  .add-row { flex-direction: column; align-items: stretch; }
  .add-row .btn { width: 100%; justify-content: center; }
}
