:root {
  color-scheme: light;
  --bg: #faf5ec;
  --surface: #fffefa;
  --surface-warm: #f7efe2;
  --ink: #20241f;
  --muted: #747067;
  --line: #e5dbcc;
  --line-strong: #d7cab8;
  --accent: #356f55;
  --accent-dark: #24533f;
  --accent-soft: #e7f1ea;
  --warn: #a34a3b;
  --ok: #2d6a4f;
  --shadow: 0 12px 34px rgba(57, 42, 22, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(255, 234, 202, 0.65), transparent 280px),
    linear-gradient(180deg, #fffaf2 0%, var(--bg) 42%, #f6efe4 100%);
  color: var(--ink);
}

.page {
  width: min(100%, 780px);
  margin: 0 auto;
  padding: 14px 12px 92px;
}

.hero-image {
  display: grid;
  place-items: center;
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 132px;
  max-height: 220px;
  overflow: hidden;
  background: #f3eadb;
  box-shadow: var(--shadow);
}

.hero-image img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 220px;
  object-fit: contain;
}

.topbar,
.summary-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  padding: 10px 2px 14px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 27px;
  line-height: 1.08;
}

h2 {
  margin-bottom: 5px;
  font-size: 19px;
  line-height: 1.15;
}

h3 {
  margin-bottom: 9px;
  color: #3b403b;
  font-size: 14px;
  line-height: 1.2;
}

.summary-link,
button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
}

.summary-link {
  flex: 0 0 auto;
  padding: 9px 11px;
  font-size: 14px;
}

.notice,
.name-panel,
.meal,
.summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.notice {
  margin-bottom: 12px;
  padding: 11px 12px;
  font-size: 14px;
}

.notice p:last-child {
  margin-bottom: 0;
}

.notice.error {
  border-color: #e7b2a6;
  color: var(--warn);
}

.notice.success {
  border-color: #b8d8c6;
  color: var(--ok);
}

.notice.locked {
  color: var(--muted);
}

.name-panel {
  margin-bottom: 12px;
  padding: 12px;
}

.name-panel label {
  display: block;
  margin-bottom: 7px;
  font-size: 14px;
  font-weight: 800;
}

.name-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.name-panel p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.enroll-form {
  display: grid;
  gap: 7px;
}

.enroll-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.enroll-row button {
  min-height: 46px;
  padding: 11px 13px;
  font-size: 15px;
}

.enrolled-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.enrolled-state span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.enrolled-state strong {
  display: block;
  margin-top: 1px;
  font-size: 18px;
}

.enrolled-state a {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: white;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.meal {
  margin-bottom: 12px;
  overflow: hidden;
}

.meal-heading {
  padding: 13px 12px 12px;
  background: linear-gradient(135deg, #f5eadb 0%, #eaf3ed 100%);
}

.meal-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.section-block {
  padding: 12px;
  border-top: 1px solid var(--line);
}

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

.vote-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) 66px;
  align-items: center;
  gap: 9px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: white;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.vote-item.is-selected {
  border-color: #8bbba2;
  background: var(--accent-soft);
}

.check-wrap {
  display: grid;
  place-items: center;
}

.check-wrap input {
  position: absolute;
  opacity: 0;
}

.fake-check {
  width: 22px;
  height: 22px;
  border: 2px solid #a7a296;
  border-radius: 6px;
  background: white;
}

.check-wrap input:checked + .fake-check {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 5px white;
}

.item-copy {
  min-width: 0;
}

.item-title {
  display: block;
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
}

.item-unit {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

.quantity-wrap input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 6px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}

.save-bar {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin: 14px -12px 18px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(250, 245, 236, 0.9);
  backdrop-filter: blur(10px);
}

.save-bar button {
  width: 100%;
  min-height: 48px;
  padding: 13px 16px;
  font-size: 15px;
}

.summary {
  padding: 13px 12px;
}

.summary-heading {
  margin-bottom: 12px;
}

.summary-heading span {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 6px 9px;
  background: var(--surface-warm);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.shopping-list {
  display: grid;
  gap: 7px;
}

.summary-row,
.mini-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.manage-list details {
  padding-bottom: 14px;
}

.manage-items {
  display: grid;
  gap: 7px;
}

.manage-row {
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: white;
}

.manage-row strong {
  font-size: 14px;
  line-height: 1.25;
}

.manage-row span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

.manage-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.unit-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.unit-form input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 9px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.unit-form button {
  padding: 8px 9px;
  font-size: 13px;
}

.danger-button {
  padding: 8px 9px;
  background: var(--warn);
  font-size: 13px;
}

.inline-add {
  margin-top: 2px;
}

.inline-add-button,
.ghost-button,
.inline-add-form button {
  padding: 10px 11px;
  font-size: 13px;
}

.inline-add-button {
  width: 100%;
  border: 1px dashed #97b7a8;
  background: #eff6f1;
  color: var(--accent-dark);
}

.inline-add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 78px;
  gap: 8px;
  border: 1px solid #9ec3ad;
  border-radius: 8px;
  padding: 9px;
  background: var(--accent-soft);
}

.inline-add-form input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 9px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
}

.inline-add-form button[type="submit"] {
  grid-column: 1 / 2;
}

.ghost-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
}

.summary-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.summary-row strong {
  font-size: 14px;
}

.summary-row span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

.summary-row b {
  font-size: 14px;
}

.summary-row b,
.mini-row strong {
  flex: 0 0 auto;
}

.details {
  margin-top: 14px;
}

details {
  border-top: 1px solid var(--line-strong);
  padding: 11px 0;
}

summary {
  cursor: pointer;
  font-size: 15px;
  font-weight: 900;
}

.mini-row {
  padding: 7px 0;
  color: var(--muted);
  font-size: 13px;
}

.empty {
  color: var(--muted);
}

@media (min-width: 720px) {
  .page {
    padding-top: 24px;
  }

  .hero-image,
  .hero-image img {
    max-height: 320px;
  }

  h1 {
    font-size: 36px;
  }

  .item-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shopping-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .manage-row {
    grid-template-columns: minmax(0, 1fr) minmax(280px, auto);
    align-items: center;
  }

  .enroll-row {
    grid-template-columns: minmax(0, 1fr) 136px;
  }

  .inline-add-form {
    grid-template-columns: minmax(0, 1fr) 120px 90px 100px;
    align-items: center;
  }

  .inline-add-form button[type="submit"] {
    grid-column: auto;
  }
}
