:root {
  color-scheme: light;
  --bg: #fff5f5;
  --card: #ffffff;
  --text: #2b1113;
  --muted: #7b5a5d;
  --green: #d71920;
  --green-dark: #8f1118;
  --line: #f2d7d9;
  --danger: #8f1118;
  --soft-red: #fff0f1;
  --shadow: 0 14px 35px rgba(143, 17, 24, .12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background:
    radial-gradient(circle at 20% 0%, rgba(215, 25, 32, .18), transparent 32%),
    linear-gradient(180deg, #ffe3e5 0%, var(--bg) 42%);
  color: var(--text);
  min-height: 100vh;
}

.app {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(28px, env(safe-area-inset-bottom));
}

.hero {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 2px 14px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green-dark);
  font-weight: 800;
  letter-spacing: .02em;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 8vw, 48px);
  line-height: .98;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 16px;
}

button, input {
  font: inherit;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 6px 0 14px;
}

.tab {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 12px;
  background: rgba(255,255,255,.78);
  color: var(--green-dark);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(143, 17, 24, .08);
}

.tab.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.tab span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  margin-left: 6px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(215, 25, 32, .12);
  color: var(--green-dark);
  font-size: 14px;
}

.tab.active span {
  background: rgba(255,255,255,.22);
  color: white;
}

.add-card, .list-card {
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(242, 215, 217, .95);
  border-radius: 22px;
  box-shadow: var(--shadow);
}

.add-card {
  padding: 16px;
}

label {
  display: block;
  margin-bottom: 10px;
  font-weight: 800;
}

.add-row {
  display: flex;
  gap: 10px;
}

input {
  flex: 1;
  min-width: 0;
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 15px 14px;
  font-size: 18px;
  outline: none;
  background: #fffafa;
}

input:focus {
  border-color: var(--green);
}

.add-row button, .ghost {
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 800;
}

.add-row button {
  background: var(--green);
  color: white;
  padding: 0 18px;
}

.ghost {
  background: rgba(255,255,255,.85);
  color: var(--green-dark);
  border: 1px solid var(--line);
  padding: 10px 12px;
  white-space: nowrap;
}

.summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 700;
  padding: 16px 4px 10px;
}

.list-card {
  overflow: hidden;
}

.shopping-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.item {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px 14px;
  border-bottom: 1px solid var(--line);
  background: white;
}

.item:last-child { border-bottom: 0; }

.check {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--green);
  background: white;
  cursor: pointer;
  position: relative;
}

.item.done .check {
  background: var(--green);
}

.item.done .check::after {
  content: "✓";
  color: white;
  font-size: 26px;
  font-weight: 900;
  position: absolute;
  inset: 4px 0 0;
}

.text {
  font-size: 20px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.item.done .text {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 3px;
}

.delete {
  border: 0;
  background: var(--soft-red);
  color: var(--danger);
  border-radius: 14px;
  padding: 11px 12px;
  font-weight: 800;
  cursor: pointer;
}

.empty {
  text-align: center;
  padding: 34px 22px 40px;
  color: var(--muted);
}

.empty-icon { font-size: 46px; }
.empty h2 { color: var(--text); margin: 10px 0 8px; }
.empty p { margin: 0 auto; max-width: 330px; line-height: 1.45; }

.hidden { display: none; }

@media (max-width: 520px) {
  .hero { display: block; }
  .ghost { margin-top: 14px; width: 100%; }
  .add-row { flex-direction: column; }
  .add-row button { padding: 15px 18px; font-size: 18px; }
  .item { grid-template-columns: 42px 1fr; }
  .delete { grid-column: 2; justify-self: start; }
}
