/* =============================================================================
   お客様用 注文画面
   ============================================================================= */
:root {
  --bg: #f6f1ea;
  --surface: #ffffff;
  --ink: #2b221d;
  --muted: #7b6e64;
  --line: #e9dfd4;
  --accent: #c2410c;
  --accent-dark: #9a3412;
  --accent-soft: #fdeee5;
  --hdr: #2a1f1a;
  --hdr-ink: #fbf4ea;
  --hdr-muted: #c9b9a8;
  --ok: #15803d;
  --ok-soft: #e7f5ec;
  --danger: #b91c1c;
  --line-green: #06c755;
  --line-green-dark: #05a647;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 34, 29, .06), 0 6px 18px rgba(43, 34, 29, .07);
  --bar-h: 72px;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}
body.lock { overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
img { display: block; max-width: 100%; }
h1, h2 { margin: 0; line-height: 1.35; }
.muted { color: var(--muted); }

#app { max-width: 640px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; background: var(--bg); }
@media (min-width: 700px) {
  body { background: #e9e1d6; }
  #app { box-shadow: 0 0 0 1px var(--line), 0 10px 40px rgba(0, 0, 0, .08); }
}

.i { width: 22px; height: 22px; flex: none; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px;
  border: 0; border-radius: 999px;
  font-weight: 700; font-size: 16px;
  transition: background .15s, transform .1s, opacity .15s;
}
.btn:active:not(:disabled) { transform: scale(.98); }
.btn.block { width: 100%; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-dark); }
.btn.line { background: var(--line-green); color: #fff; }
.btn.line:hover:not(:disabled) { background: var(--line-green-dark); }
.btn.ghost { background: #f1ebe4; color: var(--ink); }
.btn.accent-outline { background: var(--surface); color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.btn:disabled { background: #e4dcd3; color: #9b8f85; box-shadow: none; }

/* ---------- 読み込み・メッセージ画面 ---------- */
.center-screen {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 14px; padding: 32px 24px; text-align: center;
}
.center-inline { display: flex; justify-content: center; padding: 40px 0; }
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.msg h1 { font-size: 21px; }
.msg p { margin: 0; color: var(--muted); max-width: 22em; }
.msg-icon {
  width: 72px; height: 72px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.msg-icon .i { width: 34px; height: 34px; }
.msg-store { font-size: 13px; color: var(--muted); letter-spacing: .08em; }
.msg .btn { margin-top: 8px; min-width: 200px; }

/* ---------- デモ表示 ---------- */
.demo-ribbon {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 6px 12px;
  background: #fff4c2; color: #6b4e00; font-size: 12px; font-weight: 600;
}
.demo-ribbon button {
  border: 1px solid #d9b84a; background: #fffbe6; border-radius: 999px;
  padding: 2px 10px; font-size: 11px; color: #6b4e00;
}

/* ---------- 友だち追加ゲート ---------- */
.gate {
  min-height: calc(100vh - 30px); min-height: calc(100dvh - 30px);
  display: flex; align-items: center; justify-content: center;
  padding: 28px 18px;
  background:
    radial-gradient(120% 60% at 50% 0%, #3a2a22 0%, var(--hdr) 60%),
    var(--hdr);
}
.gate-card {
  width: 100%; max-width: 400px;
  background: var(--surface); border-radius: 22px;
  padding: 32px 24px 26px; text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .35);
}
.gate-store { font-size: 13px; color: var(--muted); letter-spacing: .1em; margin-bottom: 18px; }
.gate-icon {
  width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 50%;
  display: grid; place-items: center;
  background: #e8f8ee; color: var(--line-green-dark);
}
.gate-icon .i { width: 36px; height: 36px; }
.gate h1 { font-size: 21px; margin-bottom: 12px; }
.gate p { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.gate-msg { margin: 14px 0 0 !important; color: var(--danger) !important; font-size: 13px !important; }
.steps {
  list-style: none; margin: 24px 0 0; padding: 18px 0 0;
  display: flex; justify-content: space-between; gap: 6px;
  border-top: 1px dashed var(--line);
  font-size: 12px; color: var(--muted);
}
.steps li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.steps span {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-weight: 700;
}

/* ---------- ヘッダー ---------- */
.hdr {
  position: sticky; top: 0; z-index: 20;
  background: var(--hdr); color: var(--hdr-ink);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}
.hdr-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px 8px;
}
.hdr-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.store { font-size: 17px; font-weight: 700; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table-chip {
  align-self: flex-start;
  background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 700; padding: 1px 10px; border-radius: 999px;
}
.hdr-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px; padding: 6px 10px; color: var(--hdr-ink);
  font-size: 11px; font-weight: 600; flex: none;
}
.hdr-btn .i { width: 20px; height: 20px; }

.tabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 4px 12px 10px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; border: 0; border-radius: 999px;
  padding: 7px 14px; font-size: 14px; font-weight: 600;
  background: rgba(255, 255, 255, .08); color: var(--hdr-muted);
  transition: background .2s, color .2s;
}
.tab.on { background: var(--hdr-ink); color: var(--hdr); }

/* ---------- メニュー ---------- */
.menu { padding: 6px 14px calc(var(--bar-h) + 40px + env(safe-area-inset-bottom)); }
.sec { padding-top: 18px; }
.sec-title {
  font-size: 17px; margin: 0 2px 10px;
  display: flex; align-items: center; gap: 8px;
}
.sec-title::before { content: ""; width: 4px; height: 18px; border-radius: 2px; background: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 540px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.card {
  display: flex; flex-direction: column; text-align: left;
  padding: 0; border: 0; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow);
  transition: transform .12s;
}
.card:active { transform: scale(.98); }
.card-img { position: relative; aspect-ratio: 1 / 1; background: #efe7dd; }
.card-img img, .card-img .noimg { width: 100%; height: 100%; object-fit: cover; }
.noimg { display: grid; place-items: center; color: #c3b4a5; background: #efe7dd; }
.noimg .i { width: 40%; height: 40%; stroke-width: 1.4; }
.card-body { display: flex; flex-direction: column; gap: 2px; padding: 9px 11px 11px; flex: 1; }
.card-name {
  font-size: 14px; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-price { margin-top: auto; font-size: 16px; font-weight: 800; color: var(--accent); }
.card-price small { font-size: 12px; margin-left: 1px; }

.badge {
  position: absolute; top: 8px; left: 8px;
  font-size: 11px; font-weight: 700; color: #fff;
  padding: 2px 9px; border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}
.badge[data-label="人気"] { background: #b45309; }
.badge[data-label="新商品"] { background: #047857; }
.badge[data-label="期間限定"] { background: #7c3aed; }
.badge[data-label="店長イチオシ"] { background: #be123c; }

.incart {
  position: absolute; top: 8px; right: 8px;
  min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--hdr); color: #fff; font-size: 13px; font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}
.soldout-mark { display: none; }
.card.soldout .card-img img, .card.soldout .card-img .noimg { filter: grayscale(1) opacity(.55); }
.card.soldout .soldout-mark {
  display: grid; place-items: center;
  position: absolute; inset: 0;
  color: #fff; font-weight: 800; font-size: 15px; letter-spacing: .1em;
  background: rgba(40, 32, 28, .35);
}
.card.soldout .card-price { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; margin: 0; }
.menu-foot { text-align: center; color: var(--muted); font-size: 12px; margin: 28px 0 0; }

/* ---------- 下部バー ---------- */
.bar {
  position: fixed; left: 50%; bottom: 0; z-index: 30;
  width: 100%; max-width: 640px; transform: translateX(-50%);
  display: flex; gap: 10px; align-items: center;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.bar-call {
  flex: none; width: 64px; height: 52px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  border: 1.5px solid var(--line); border-radius: 14px; background: var(--surface);
  font-size: 10.5px; font-weight: 700; color: var(--ink);
}
.bar-call .i { width: 20px; height: 20px; color: var(--accent); }
.bar-cart {
  flex: 1; height: 52px; min-width: 0;
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px 0 14px;
  border: 0; border-radius: 999px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 16px;
  box-shadow: 0 6px 16px rgba(194, 65, 12, .3);
}
.bar-cart:disabled { background: #e4dcd3; color: #8f8379; box-shadow: none; }
.cart-ic { position: relative; display: grid; place-items: center; }
.cart-count {
  position: absolute; top: -8px; right: -10px;
  min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  display: grid; place-items: center;
  background: #fff; color: var(--accent); font-size: 12px; font-weight: 800;
}
.cart-label { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
.cart-total { font-size: 17px; font-weight: 800; }

/* ---------- ボトムシート ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(20, 14, 10, .5); opacity: 0; transition: opacity .25s; }
.sheet {
  position: relative; width: 100%; max-width: 640px; max-height: 92vh; max-height: 92dvh;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: 22px 22px 0 0;
  transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  overflow: hidden;
}
.sheet-wrap.open .sheet-backdrop { opacity: 1; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-close {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 38px; height: 38px; border-radius: 50%; border: 0;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .92); box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}
.sheet-close .i { width: 20px; height: 20px; }
.sheet-head { padding: 18px 60px 12px 20px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { font-size: 18px; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.sheet-foot {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line); background: var(--surface);
}
.note { margin: 0; text-align: center; font-size: 12px; color: var(--muted); }

/* ダイアログ（中央表示） */
.sheet-wrap.dialog { align-items: center; padding: 20px; }
.sheet-wrap.dialog .sheet {
  max-width: 360px; border-radius: 20px;
  transform: scale(.94); opacity: 0;
  transition: transform .2s, opacity .2s;
}
.sheet-wrap.dialog.open .sheet { transform: none; opacity: 1; }
.sheet-wrap.dialog .sheet-close { display: none; }
.sheet-wrap.dialog .sheet-body { padding: 26px 22px 6px; text-align: center; }
.sheet-wrap.dialog .sheet-foot { flex-direction: row; border-top: 0; padding-bottom: 20px; }
.sheet-wrap.dialog .sheet-foot .btn { flex: 1; padding: 0 12px; }
.dlg-title { font-size: 18px; margin-bottom: 8px; }
.dlg-text { margin: 0; color: var(--muted); font-size: 14px; }
.done-icon {
  width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ok-soft); color: var(--ok);
}
.done-icon .i { width: 34px; height: 34px; stroke-width: 2.6; }
.sheet-wrap.done .sheet-foot { flex-direction: column-reverse; }

/* 商品詳細 */
.item-hero { aspect-ratio: 16 / 10; background: #efe7dd; }
.item-hero img, .item-hero .noimg { width: 100%; height: 100%; object-fit: cover; }
.item-main { position: relative; padding: 16px 20px 8px; }
.item-main .badge { position: static; display: inline-block; margin-bottom: 8px; }
.item-name { font-size: 21px; }
.item-desc { margin: 8px 0 0; color: var(--muted); font-size: 14px; white-space: pre-wrap; }
.item-base { margin-top: 10px; font-size: 20px; font-weight: 800; color: var(--accent); }
.item-base small { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 6px; }
.opt { border: 0; margin: 18px 0 0; padding: 0; }
.opt legend {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 0 0 8px; font-weight: 700; font-size: 15px;
}
.opt-req { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.opt-req.single { background: var(--accent-soft); color: var(--accent-dark); }
.opt-req.multi { background: #eef0f3; color: #555; }
.opt-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; margin-bottom: 8px;
  border: 1.5px solid var(--line); border-radius: 12px;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.opt-row input { position: absolute; opacity: 0; pointer-events: none; }
.opt-mark {
  width: 22px; height: 22px; flex: none; border-radius: 50%;
  border: 2px solid #cbbfb3; display: grid; place-items: center;
}
.opt-row input[type="checkbox"] + .opt-mark { border-radius: 6px; }
.opt-row.on { border-color: var(--accent); background: var(--accent-soft); }
.opt-row input:checked + .opt-mark { border-color: var(--accent); background: var(--accent); }
.opt-row input:checked + .opt-mark::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff;
}
.opt-row input[type="checkbox"]:checked + .opt-mark::after {
  width: 10px; height: 5px; border-radius: 0; background: none;
  border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}
.opt-row input:focus-visible + .opt-mark { outline: 2px solid var(--accent); outline-offset: 2px; }
.opt-name { flex: 1; font-weight: 600; }
.opt-price { color: var(--muted); font-size: 14px; font-weight: 600; }

.sheet-wrap.item .sheet-foot { flex-direction: row; align-items: center; gap: 12px; }
.qty { display: flex; align-items: center; gap: 4px; }
.qty-btn {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid var(--line); background: var(--surface);
}
.qty-btn:disabled { opacity: .35; }
.qty-btn.sm { width: 34px; height: 34px; }
.qty-btn.sm .i { width: 18px; height: 18px; }
.qty-num { min-width: 32px; text-align: center; font-size: 18px; font-weight: 800; }
.add-btn { flex: 1; justify-content: space-between; padding: 0 22px; }
.add-btn span { font-size: 17px; }

/* カート */
.cl { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.cl-img { width: 60px; height: 60px; border-radius: 10px; overflow: hidden; flex: none; background: #efe7dd; }
.cl-img img, .cl-img .noimg { width: 100%; height: 100%; object-fit: cover; }
.cl-info { flex: 1; min-width: 0; }
.cl-name { font-weight: 700; font-size: 15px; }
.cl-opt { font-size: 12px; color: var(--muted); }
.cl-price { font-size: 14px; font-weight: 700; color: var(--accent); }
.cl-ng { font-size: 12px; color: var(--danger); font-weight: 700; }
.cl.ng .cl-img { filter: grayscale(1); opacity: .6; }
.cl-qty { display: flex; align-items: center; gap: 2px; }
.cl-qty .qty-num { min-width: 26px; font-size: 16px; }
.sum-row { display: flex; align-items: baseline; justify-content: space-between; font-weight: 700; }
.sum-row small { margin-left: 8px; color: var(--muted); font-weight: 600; font-size: 12px; }
.sum-row strong { font-size: 22px; }

/* 注文履歴 */
.ho { padding: 14px 16px 6px; border-bottom: 8px solid var(--bg); }
.ho-head { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.ho-head small { margin-left: 4px; }
.ho-who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.hi {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; column-gap: 12px;
  padding: 9px 0; border-top: 1px solid var(--line);
}
.ho-head + .hi { border-top: 0; }
.hi-name { font-weight: 600; grid-column: 1; }
.hi-name small { display: block; font-size: 12px; color: var(--muted); font-weight: 500; }
.hi-qty { color: var(--muted); font-size: 14px; }
.hi-price { font-weight: 700; text-align: right; min-width: 70px; }
.hi .st { grid-column: 1 / -1; justify-self: start; margin-top: 4px; }
.hi.cancelled .hi-name, .hi.cancelled .hi-price { text-decoration: line-through; color: var(--muted); }
.st { font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.st-pending { background: #fff4d6; color: #8a5a00; }
.st-served { background: var(--ok-soft); color: var(--ok); }
.st-cancelled { background: #f1f1f1; color: #777; }

/* ---------- トースト ---------- */
.toast {
  position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); z-index: 80;
  width: max-content; max-width: calc(100% - 32px);
  transform: translate(-50%, -10px); opacity: 0; pointer-events: none;
  background: rgba(30, 22, 18, .92); color: #fff;
  padding: 11px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 600; text-align: center;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
