:root {
  --bg: #faf7f2; --card: #fff; --ink: #1f1a17; --muted: #7a6f66; --line: #e8e0d6;
  --accent: #b5412a; --accent-ink: #fff; --ok: #2f8f5b; --paypay: #ff0033;
  --radius: 14px; --tab-h: 44px; --bar-h: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", system-ui, sans-serif; font-size: 16px; }
button { font: inherit; cursor: pointer; }
img { display: block; }
.hidden { display: none !important; }

/* header */
.hdr { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: 12px 16px 8px; display: flex; align-items: baseline; justify-content: space-between; }
.hdr .store { font-size: 13px; color: var(--muted); }
.hdr .table { font-size: 20px; font-weight: 700; }
.tabs { position: sticky; top: 48px; z-index: 10; background: var(--bg); display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 10px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 0 0 auto; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
.tabs button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* menu */
main { padding: 0 16px calc(var(--bar-h) + 24px); }
.cat-title { font-size: 15px; font-weight: 700; color: var(--muted); margin: 18px 0 8px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.item { background: var(--card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); display: flex; flex-direction: column; }
.item .ph { aspect-ratio: 4/3; background: #eee5da; object-fit: cover; width: 100%; }
.item .ph.none { display: flex; align-items: center; justify-content: center; color: #c9bcae; font-size: 28px; }
.item .body { padding: 10px 10px 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.item .name { font-size: 14px; font-weight: 600; line-height: 1.3; min-height: 2.6em; }
.item .row { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.item .price { font-weight: 700; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: #fff; }
.stepper button { width: 34px; height: 34px; border: 0; background: transparent; font-size: 20px; line-height: 1; color: var(--accent); }
.stepper button:disabled { color: #ccc; }
.stepper span { min-width: 22px; text-align: center; font-weight: 700; }
.item.in { border-color: var(--accent); }

/* bottom bar */
.bar { position: fixed; left: 0; right: 0; bottom: 0; height: var(--bar-h); background: var(--card); border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; padding: 0 16px; padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
.bar .sum { flex: 1; font-size: 14px; color: var(--muted); }
.bar .sum b { display: block; font-size: 18px; color: var(--ink); }
.btn { height: 44px; padding: 0 20px; border-radius: 999px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 16px; }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.paypay { background: var(--paypay); }
.btn.ok { background: var(--ok); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; }

/* sheet (cart / checkout) */
.sheet { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; }
.sheet .panel { width: 100%; max-height: 88vh; background: var(--bg); border-radius: 20px 20px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; }
.sheet h2 { margin: 4px 0 12px; font-size: 18px; }
.line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line .n { flex: 1; }
.line .p { font-weight: 700; white-space: nowrap; }
.line input { width: 100%; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font: inherit; }
.totalrow { display: flex; justify-content: space-between; font-size: 20px; font-weight: 700; padding: 14px 0; }
.actions { display: flex; gap: 10px; margin-top: 12px; }
.actions .btn { flex: 1; }
.orders .o { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.orders .o .h { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.orders .o .l { display: flex; justify-content: space-between; padding: 3px 0; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--bar-h) + 16px); background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; text-align: center; z-index: 40; }
.toast.err { background: var(--accent); }
.empty { color: var(--muted); text-align: center; padding: 30px 0; }

/* paid screen */
.paid { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; text-align: center; background: linear-gradient(160deg, #1d7a4b, #2f8f5b 60%, #46a86f); color: #fff; }
.paid .badge { font-size: 34px; font-weight: 800; letter-spacing: .1em; margin: 6px 0; }
.paid .big { font-size: 44px; font-weight: 800; margin: 4px 0 12px; }
.paid .kv { display: grid; grid-template-columns: auto auto; gap: 6px 16px; font-size: 16px; margin: 8px 0 16px; text-align: left; }
.paid .kv span:nth-child(odd) { opacity: .8; }
.paid .clock { font-variant-numeric: tabular-nums; font-size: 40px; font-weight: 700; letter-spacing: .04em; }
.paid .ring { width: 150px; height: 150px; border-radius: 50%; margin: 14px auto; display: grid; place-items: center; background: conic-gradient(#fff var(--deg, 0deg), rgba(255,255,255,.25) 0); position: relative; }
.paid .ring::after { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: #2f8f5b; }
.paid .ring .in { position: relative; z-index: 1; font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }
.paid .marquee { overflow: hidden; width: 100%; max-width: 360px; white-space: nowrap; opacity: .85; font-size: 14px; margin-top: 8px; }
.paid .marquee span { display: inline-block; padding-left: 100%; animation: mq 8s linear infinite; }
@keyframes mq { to { transform: translateX(-100%); } }
.paid .staff { margin-top: 26px; width: 100%; max-width: 360px; }
.paid .staff input { width: 100%; font-size: 24px; letter-spacing: .3em; text-align: center; padding: 10px; border-radius: 10px; border: 0; margin-bottom: 8px; }
.paid.closed { background: linear-gradient(160deg, #333, #555); }
.pinbox { display: flex; gap: 8px; }
.pinbox input { flex: 1; }

/* 写真: picture 要素（WebP/JPEG）・低解像度プレースホルダを背景に敷いて遅延読み込み */
.item picture.ph { display: block; aspect-ratio: 1/1; background-color: #eee5da; background-size: cover; background-position: center; overflow: hidden; }
.item picture.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.item { position: relative; }
.item .badges { position: absolute; top: 6px; left: 6px; display: flex; gap: 4px; }
.badge { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; color: #fff; background: var(--accent); }
.badge.s { background: #2f8f5b; } .badge.r { background: #d9822b; } .badge.so { background: #666; }
/* 旬・おすすめ: 1 列ぶち抜き・大きな写真 */
.grid.featured { grid-template-columns: 1fr; }
.item.big .name { font-size: 18px; min-height: 0; }
.item.big .price { font-size: 18px; }
/* 売切れ: 写真を薄く・＋を押せない */
.item.soldout picture.ph, .item.soldout .ph.none { opacity: .4; }
.item.soldout .name { color: var(--muted); }

/* オプション（ハンディの選択シート・レジの商品編集） */
.opts { display: flex; flex-direction: column; gap: 12px; margin: 8px 0; }
.og { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; }
.ogh { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-weight: 700; background: #f7f7f7; border-bottom: 1px solid var(--line); }
.ogh small { font-weight: 500; font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; }
.ogh small.req { color: #fff; background: var(--accent); border-color: var(--accent); }
.oc { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--line); }
.og .oc:first-of-type { border-top: 0; }
.oc input[type=radio], .oc input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }
.oc .ocn { flex: 1; }
.oc .ocp { font-weight: 700; white-space: nowrap; }
.oc.so { color: var(--muted); }
.ol { font-size: 12px; color: var(--muted); }
