:root {
  --bg: #f3f5f1;
  --paper: #fff;
  --ink: #1d2a22;
  --muted: #53635a;
  --line: #dce4db;
  --green: #246842;
  --soft: #e3f0e7;
  --warning: #8b4426;
  --warm: #f8ebdf;
  --radius: 16px;
  --shadow: 0 1px 2px #14281e0d, 0 4px 14px #14281e0d;
}

* { box-sizing: border-box; }

html { background: #dfe5dd; color: var(--ink); }
body { margin: 0; font: 15px/1.45 "Segoe UI", Roboto, system-ui, sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}
[hidden] { display: none !important; }
a { color: var(--green); text-underline-offset: .2em; }

.app {
  width: min(100%, 452px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: calc(70px + env(safe-area-inset-bottom));
  background: var(--bg);
}
header {
  position: sticky;
  z-index: 2;
  top: 0;
  padding: calc(14px + env(safe-area-inset-top)) 16px 8px;
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand h1 { margin: 0; font-size: 18px; letter-spacing: -.025em; line-height: 1.2; }
.brand p { margin: 0; color: var(--muted); font-size: 12.5px; }
.guide-open { margin-left: auto; white-space: nowrap; }
#guide-content {
  position: relative; max-height: 91vh; max-height: 91dvh; overflow-y: auto;
  padding: 22px 20px calc(24px + env(safe-area-inset-bottom)); line-height: 1.45; font-size: 15px;
}
#guide .close { position: sticky; top: 0; float: right; margin: -10px -8px 0 10px; }
#guide-content h2 { margin: 6px 0 14px; font-size: 20px; line-height: 1.25; }
#guide-content h3 { margin: 20px 0 6px; font-size: 16px; color: var(--green); }
#guide-content p { margin: 0 0 10px; }
#guide-content ul { margin: 0 0 10px; padding-left: 20px; }
#guide-content li { margin: 2px 0; }
#guide-content em { color: var(--muted); }

.logo {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: white;
  background: var(--green);
}
.logo::before, .logo::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 10px;
  border: 1.5px solid currentColor;
  background: #ffffff35;
}
.logo::before { top: 10px; left: 9px; border-radius: 0 10px 0 10px; }
.logo::after { top: 7px; left: 18px; border-radius: 10px 0 10px 0; }
.logo i { position: absolute; left: 18px; top: 17px; width: 2px; height: 13px; background: currentColor; }

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 13px;
  padding: 0 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.search input { flex: 1; min-width: 0; padding: 10px 0; border: 0; background: transparent; }
.search input:focus { outline: none; }
.search:focus-within { outline: 2px solid var(--green); }
.glass {
  position: relative;
  flex: 0 0 14px;
  height: 14px;
  border: 1.7px solid var(--muted);
  border-radius: 50%;
}
.glass::after {
  position: absolute;
  bottom: -2px;
  right: -5px;
  width: 6px;
  height: 2px;
  transform: rotate(45deg);
  background: var(--muted);
  content: "";
}
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 3px 5px;
  margin: 0 -3px;
  scrollbar-width: thin;
}
.chip {
  flex: none;
  min-height: 36px;
  padding: 5px 12px;
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 13px;
  background: var(--paper);
}
.chip[aria-pressed="true"] { background: var(--green); color: white; border-color: var(--green); }

main { padding: 4px 16px 18px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}
.card-open { width: 100%; display: block; border: 0; padding: 0; text-align: left; background: transparent; }
.card-open:focus-visible { outline-offset: -3px; }
.pic { position: relative; display: grid; place-items: center; overflow: hidden; background: #e9efe5; }
.card .pic { aspect-ratio: 1; }
.pic img { display: block; width: 100%; height: 100%; object-fit: cover; }
.placeholder { display: grid; place-items: center; gap: 8px; text-align: center; font-size: 12px; color: var(--muted); }
.placeholder .logo { transform: scale(1.2); background: #dbe8dc; color: var(--green); }
.tag {
  position: absolute;
  top: 8px;
  left: 8px;
  right: auto;
  max-width: calc(100% - 16px);
  padding: 4px 8px;
  border-radius: 18px;
  color: var(--warning);
  background: var(--warm);
  font-size: 11px;
  font-weight: 650;
}
.card-copy { display: grid; gap: 4px; padding: 10px 10px 4px; }
.name { font-weight: 650; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.muted, .hint { color: var(--muted); }
.muted { font-size: 12.5px; }
.hint { font-size: 13px; }
.card .row { padding: 6px 10px 10px; margin-top: auto; flex-wrap: wrap; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.price { font-weight: 700; white-space: nowrap; }
.btn { border: 0; border-radius: 11px; padding: 10px 13px; background: var(--green); color: white; font-weight: 650; }
.btn.small { min-height: 36px; padding: 7px 8px; font-size: 12px; }
.btn.ghost { background: var(--soft); color: var(--green); }
.btn.wide { width: 100%; min-height: 45px; }
.step { display: inline-flex; align-items: center; border-radius: 10px; background: var(--soft); }
.step button {
  width: 32px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--green);
  font-size: 18px;
  font-weight: 700;
}
.step span { min-width: 20px; padding: 0 2px; text-align: center; font-weight: 650; }
.empty { padding: 36px 8px 18px; text-align: center; color: var(--muted); }
#reload { display: block; margin: 0 auto; }

.tabs {
  position: fixed;
  z-index: 3;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, 452px);
  display: flex;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 10px 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}
.tabs button[aria-current] { color: var(--green); font-weight: 700; }
.catalog-icon {
  width: 18px; height: 18px;
  background: linear-gradient(90deg, currentColor 42%, transparent 42% 58%, currentColor 58%);
  clip-path: polygon(0 0,100% 0,100% 42%,0 42%,0 58%,100% 58%,100% 100%,0 100%);
}
.cart-icon {
  position: relative;
  width: 18px; height: 12px;
  margin: 2px 0 4px;
  border: 1.6px solid currentColor;
  border-radius: 2px;
  transform: skew(-8deg);
}
.cart-icon::before, .cart-icon::after {
  content: "";
  position: absolute;
  bottom: -5px;
  left: 2px;
  width: 3px; height: 3px;
  border-radius: 50%; background: currentColor;
}
.cart-icon::after { left: auto; right: 2px; }
.badge {
  position: absolute;
  left: calc(50% + 11px);
  top: 4px;
  border-radius: 99px;
  padding: 1px 5px;
  background: var(--warning);
  color: white;
  font-size: 10px;
  font-weight: 700;
}

dialog {
  position: fixed;
  inset: auto 0 0;
  margin: 0 auto;
  padding: 0;
  width: min(100%, 452px);
  max-width: 100%;
  max-height: 91vh;
  max-height: 91dvh;
  color: var(--ink);
  border: 0;
  border-radius: 22px 22px 0 0;
  background: var(--paper);
}
dialog::backdrop { background: #13261cad; }
#product-content { position: relative; }
#product .pic { height: min(60vw, 295px); }
#product .pic img { object-fit: contain; }
.close {
  position: absolute; z-index: 1; top: 12px; right: 12px;
  width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: var(--paper); box-shadow: var(--shadow); font-size: 23px;
}
.thumbs { display: flex; gap: 8px; padding: 10px 16px 0; }
.thumbs button {
  width: 52px; height: 52px; padding: 0; overflow: hidden;
  border-radius: 8px; border: 2px solid var(--line); background: var(--bg);
}
.thumbs button[aria-pressed="true"] { border-color: var(--green); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.sheet-copy { padding: 14px 18px calc(20px + env(safe-area-inset-bottom)); overflow-wrap: anywhere; }
h2 { margin: 0 0 8px; font-size: 20px; letter-spacing: -.015em; }
.sheet-copy p { white-space: pre-line; }
.sheet-copy dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; }
dt { color: var(--muted); }
dd { margin: 0; white-space: pre-line; }
.sheet-copy .wide { margin-top: 12px; }

.box { padding: 14px; margin-bottom: 12px; background: var(--paper); border-radius: var(--radius); box-shadow: var(--shadow); }
.cart-line { display: flex; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-line .pic { flex: 0 0 44px; height: 44px; border-radius: 9px; }
.cart-line .placeholder .logo { transform: scale(.75); }
.cart-line .placeholder > span:last-child:not(.logo) { display: none; }
.cart-item { flex: 1; min-width: 0; }
.cart-item > span { display: block; }
.total { padding-top: 12px; font-size: 17px; font-weight: 700; }
#checkout > label { display: block; margin: 10px 0; font-weight: 600; font-size: 13px; }
#checkout small { font-weight: 400; color: var(--muted); }
.input {
  display: block; width: 100%; margin-top: 4px; padding: 10px 11px;
  border: 1px solid var(--line); border-radius: 11px; background: white;
  font-size: 16px; font-weight: 400;
}
textarea { resize: vertical; }
.opt-in { padding: 10px; margin: 13px 0; border-radius: 11px; background: var(--bg); }
.check-label { display: flex; align-items: start; gap: 7px; font-size: 14px; }
.check-label input { flex: none; width: 18px; height: 18px; margin: 2px 0; accent-color: var(--green); }
.opt-in a { margin-left: 25px; }
.feedback { padding: 10px; border-radius: 10px; color: var(--warning); background: var(--warm); }
.done { padding: 44px 14px 20px; text-align: center; }
.done p { margin: 6px 0 18px; color: var(--muted); }
.legal { max-width: 680px; margin: 18px auto; padding: 22px; border-radius: var(--radius); background: white; overflow-wrap: anywhere; }
.legal h1 { font-size: 25px; line-height: 1.2; }
.legal h2 { margin-top: 24px; font-size: 17px; }
.setup { max-width: 440px; margin: 18px auto; width: calc(100% - 32px); }
.setup .btn { margin-top: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (min-width: 520px) {
  .app { margin-top: 23px; min-height: calc(100vh - 46px); border-radius: 25px; box-shadow: 0 12px 40px #14281e28; }
  header { border-radius: 25px 25px 0 0; }
  .tabs { bottom: 23px; border-radius: 0 0 25px 25px; overflow: hidden; }
}
@media (max-width: 360px) {
  .card .row { align-items: start; flex-direction: column; }
}
