/* ---- Design tokens: change the look here ---- */
:root {
  --bg: #e3eee3;
  --card: #fffefb;
  --ink: #1f3a2e;
  --muted: #58705f;
  --accent: #c8362b;
  --on: #fff;
  --line: #c9dbc9;
  --check: rgba(200, 54, 43, 0.42);
  --r: 22px;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14231b;
    --card: #1d3226;
    --ink: #e8f1e6;
    --muted: #a3bba9;
    --accent: #ef6a5c;
    --line: #2d4a38;
    --check: rgba(239, 106, 92, 0.35);
  }
}
:root[data-theme="dark"] {
  --bg: #14231b;
  --card: #1d3226;
  --ink: #e8f1e6;
  --muted: #a3bba9;
  --accent: #ef6a5c;
  --line: #2d4a38;
  --check: rgba(239, 106, 92, 0.35);
}
html {
  scroll-padding-top: env(safe-area-inset-top, 0px);
}
*, *::before, *::after {
  box-sizing: inherit;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.5 Nunito, system-ui, sans-serif;
}
h1, h2, h3 {
  font-family: "Young Serif", Georgia, serif;
  font-weight: 400;
  margin: 0;
  line-height: 1.2;
}
[x-cloak] {
  display: none !important;
}
button,
input {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}


/* ---- Header: the gingham tablecloth is the one memorable element ---- */
.top {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  background-color: var(--card);
  background-image: linear-gradient(90deg, var(--check) 50%, transparent 50%),
    linear-gradient(var(--check) 50%, transparent 50%);
  background-size: 22px 22px;
}
.top h1 {
  background: var(--card);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 1.15rem;
}
.cartbtn {
  position: relative;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  font-size: 1.25rem;
  cursor: pointer;
}
.badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  border-radius: 11px;
  background: var(--accent);
  color: var(--on);
  font-size: 0.8rem;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.bump {
  animation: bump 0.3s ease;
}
@keyframes bump {
  50% {
    transform: scale(1.4);
  }
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem 1rem 6rem;
}
.view {
  animation: fade 0.25s ease;
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
.muted {
  color: var(--muted);
}
.grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}


/* ---- Tile: one item per row ---- */
.tile {
  background: var(--card);
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
}
.pic {
  position: relative;
  height: 150px;
  display: grid;
  place-items: center;
  font-size: 4.5rem;
}
.stock {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  background: var(--card);
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.15rem 0.7rem;
  border-radius: 999px;
  transition: background 0.3s, color 0.3s;
}
.stock.flash {
  animation: flash 0.9s ease;
}
.stock.out {
  background: var(--ink);
  color: var(--card);
}
@keyframes flash {
  0%,
  60% {
    background: var(--accent);
    color: var(--on);
    transform: scale(1.12);
  }
}
.tile .body {
  padding: 1rem;
}
.row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}
.row b {
  font-family: "Young Serif", Georgia, serif;
  font-weight: 400;
  font-size: 1.1rem;
}
.tile p {
  margin: 0.25rem 0 0.9rem;
  color: var(--muted);
}
.btn {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on);
  font-weight: 700;
  cursor: pointer;
}
.btn:disabled {
  background: var(--line);
  color: var(--muted);
  cursor: not-allowed;
}
.btn:active {
  transform: scale(0.98);
}
.step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  border-radius: 999px;
  border: 2px solid var(--accent);
  animation: pop 0.2s ease;
}
.step button {
  width: 52px;
  height: 46px;
  border: 0;
  background: none;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
}
.step span {
  font-weight: 700;
}
@keyframes pop {
  from {
    transform: scale(0.92);
  }
}


/* ---- Other views ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1rem;
  margin-top: 1rem;
  display: grid;
  gap: 0.8rem;
}
.center {
  text-align: center;
}
label {
  display: grid;
  gap: 0.25rem;
  font-weight: 700;
}
input {
  min-height: 46px;
  padding: 0 0.9rem;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--bg);
  font-weight: 400;
}
.err {
  color: var(--accent);
  font-weight: 400;
  min-height: 1em;
}
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.steps li {
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  background: var(--bg);
  color: var(--muted);
  transition: background 0.3s, color 0.3s;
}
.steps li.on {
  background: var(--accent);
  color: var(--on);
  font-weight: 700;
}
.link {
  background: none;
  border: 0;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}
a.btn {
  display: grid;
  place-items: center;
  text-decoration: none;
}
.big {
  font-family: "Young Serif", Georgia, serif;
  font-size: 2.4rem;
}

/* ---- Bottom tabs, cart sheet, toast ---- */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs button {
  flex: 1;
  max-width: 160px;
  min-height: 58px;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  align-content: center;
  color: var(--muted);
  cursor: pointer;
}
.tabs button.on {
  color: var(--accent);
  font-weight: 700;
}
.tabs small {
  font-size: 0.8rem;
}
.back {
  position: fixed;
  inset: 0;
  z-index: 8;
  background: rgba(0, 0, 0, 0.45);
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  margin: 0 auto;
  max-width: 480px;
  max-height: 88%;
  overflow: auto;
  background: var(--card);
  border-radius: var(--r) var(--r) 0 0;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: 0.8rem;
}
.tr {
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.off {
  transform: translateY(100%);
  opacity: 0.6;
}
.on {
  transform: none;
  opacity: 1;
}
.x {
  border: 0;
  background: none;
  font-size: 1.2rem;
  cursor: pointer;
}
.line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.tot {
  border-top: 2px dashed var(--line);
  padding-top: 0.7rem;
  font-size: 1.1rem;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 10;
  background: var(--ink);
  color: var(--card);
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  max-width: 90%;
  text-align: center;
}
#nojs {
  margin: 1rem;
  padding: 1rem;
  border-radius: 12px;
  background: var(--card);
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 1rem;
  margin-top: 1rem;
  display: grid;
  gap: 0.8rem;
}
.center {
  text-align: center;
}
label {
  display: grid;
  gap: 0.25rem;
  font-weight: 700;
}
input {
  min-height: 46px;
  padding: 0 0.9rem;
  border-radius: 12px;
  border: 2px solid var(--line);
  background: var(--bg);
  font-weight: 400;
}
.err {
  color: var(--accent);
  font-weight: 400;
  min-height: 1em;
}
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}
.steps li {
  padding: 0.5rem 0.8rem;
  border-radius: 12px;
  background: var(--bg);
  color: var(--muted);
  transition: background 0.3s, color 0.3s;
}
.steps li.on {
  background: var(--accent);
  color: var(--on);
  font-weight: 700;
}
.link {
  background: none;
  border: 0;
  color: var(--muted);
  text-decoration: underline;
  cursor: pointer;
}
a.btn {
  display: grid;
  place-items: center;
  text-decoration: none;
}
.big {
  font-family: "Young Serif", Georgia, serif;
  font-size: 2.4rem;
}

/* ---- Bottom tabs, cart sheet, toast ---- */
.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.tabs button {
  flex: 1;
  max-width: 160px;
  min-height: 58px;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  align-content: center;
  color: var(--muted);
  cursor: pointer;
}
.tabs button.on {
  color: var(--accent);
  font-weight: 700;
}
.tabs small {
  font-size: 0.8rem;
}
.back {
  position: fixed;
  inset: 0;
  z-index: 8;
  background: rgba(0, 0, 0, 0.45);
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9;
  margin: 0 auto;
  max-width: 480px;
  max-height: 88%;
  overflow: auto;
  background: var(--card);
  border-radius: var(--r) var(--r) 0 0;
  padding: 1rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  display: grid;
  gap: 0.8rem;
}
.tr {
  transition: transform 0.3s ease, opacity 0.3s ease;
}
.off {
  transform: translateY(100%);
  opacity: 0.6;
}
.on {
  transform: none;
  opacity: 1;
}
.x {
  border: 0;
  background: none;
  font-size: 1.2rem;
  cursor: pointer;
}
.line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.tot {
  border-top: 2px dashed var(--line);
  padding-top: 0.7rem;
  font-size: 1.1rem;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 10;
  background: var(--ink);
  color: var(--card);
  padding: 0.6rem 1.1rem;
  border-radius: 999px;
  max-width: 90%;
  text-align: center;
}
#nojs {
  margin: 1rem;
  padding: 1rem;
  border-radius: 12px;
  background: var(--card);
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}