:root {
  --bg: #f5ede3; --card: #fffaf4; --line: #e6d8c7; --soft: #efe3d4;
  --ink: #2b211a; --muted: #75614f; --accent: #6f4e37; --accent-ink: #fff8f0; --danger: #a33b2b;
  --r: 18px; --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1c1612; --card: #2a211b; --line: #3d3128; --soft: #342920; --ink: #f3e9de; --muted: #c2ae9c;
    --accent: #c9a07e; --accent-ink: #1c1612; --danger: #ef8a78; }
  .logo { filter: invert(1) sepia(.3); }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.45 var(--font); -webkit-text-size-adjust: 100%; }
button, input, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: center;
  min-height: 64px; padding: 10px 64px; padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.logo { height: 18px; width: auto; }
.icon-btn, .cart-btn { position: absolute; bottom: 10px; width: 44px; height: 44px; border: 0;
  border-radius: 50%; background: var(--card); color: var(--accent); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.icon-btn { left: 12px; font-size: 28px; line-height: 1; }
.cart-btn { right: 12px; display: grid; place-items: center; }
.badge { position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-size: 12px; font-weight: 700; display: grid; place-items: center; }

main { padding: 16px 16px calc(100px + env(safe-area-inset-bottom)); max-width: 720px; margin: 0 auto; }
h1 { font-size: 24px; line-height: 1.2; margin: 4px 0 12px; }
h2 { font-size: 18px; margin: 20px 0 10px; }
.muted { color: var(--muted); }

.hero { background: linear-gradient(135deg, var(--soft), var(--card)); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px; margin-bottom: 14px; }
.hero h1 { margin-top: 0; }
.hero p { margin: 0; color: var(--muted); }

.chips { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 10px; padding: 0 16px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; min-height: 40px; padding: 8px 16px; border-radius: 20px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; display: flex; flex-direction: column; }
.card .open { display: block; border: 0; padding: 0; background: none; text-align: left; cursor: pointer; }
.card .ph { aspect-ratio: 1; background: #fff; }
.card .ph img { width: 100%; height: 100%; object-fit: contain; }
.card .name { padding: 10px 12px 0; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden; }
.card .row { margin-top: auto; padding: 8px 12px 12px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.price { font-weight: 700; font-size: 16px; white-space: nowrap; }
.add { flex: none; width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--accent); color: var(--accent-ink);
  font-size: 22px; line-height: 1; cursor: pointer; }
.add:disabled, .btn:disabled { opacity: .45; cursor: default; }
.out { font-size: 13px; color: var(--muted); }

.product .ph { background: #fff; border-radius: var(--r); border: 1px solid var(--line); overflow: hidden; aspect-ratio: 1; }
.product .ph img { width: 100%; height: 100%; object-fit: contain; }
.product h1 { margin-top: 16px; }
.product .desc { white-space: pre-line; }
.product .art { font-size: 13px; }

.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; padding: 12px 18px;
  border: 0; border-radius: 26px; background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--line); }
.bar .inner { max-width: 688px; margin: 0 auto; }

.line { display: grid; grid-template-columns: 64px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.line img { width: 64px; height: 64px; object-fit: contain; background: #fff; border-radius: 12px; border: 1px solid var(--line); }
.line .t { font-size: 14px; line-height: 1.3; }
.line .ctl { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; gap: 8px; }
.qty { display: flex; align-items: center; gap: 4px; }
.qty button { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 18px; }
.qty span { min-width: 24px; text-align: center; }
.total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 700; margin: 16px 0; }

form { display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
input, textarea { width: 100%; min-height: 48px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font-size: 16px; }
textarea { min-height: 80px; resize: vertical; }
input:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.check { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: start; color: var(--ink); }
.check input { width: 22px; height: 22px; min-height: 0; margin: 1px 0 0; accent-color: var(--accent); }
a { color: var(--accent); }
.err { color: var(--danger); font-size: 14px; margin: 0; }

.state { text-align: center; padding: 40px 8px; }
.state .big { font-size: 44px; line-height: 1; margin-bottom: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 9;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 20px; font-size: 14px; max-width: calc(100% - 32px); }
.skeleton { background: linear-gradient(90deg, var(--soft), var(--card), var(--soft)); background-size: 200% 100%;
  animation: sk 1.2s infinite linear; border-radius: var(--r); aspect-ratio: .7; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
