:root {
  --bg: #fdf8f4;
  --surface: #ffffff;
  --text: #3d2c29;
  --muted: #8a7670;
  --line: #eadfd8;
  --primary: #c9576b;
  --primary-soft: #fbe9ec;
  --primary-text: #ffffff;
  --disabled: #cfc5c0;
  --radius: 14px;
  --shadow: 0 2px 12px rgba(61, 44, 41, 0.08);
}

* { box-sizing: border-box; }

/* hidden 属性を display 指定より優先させる（完了画面でボタンが残らないように） */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 96px;
}

button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 1.4rem; font-weight: 700; color: var(--primary); }
.brand span { font-size: .8rem; color: var(--muted); font-weight: 500; margin-left: 4px; }
.cart-button {
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 6px 14px; font-weight: 700;
}

/* ---------- Steps ---------- */
.steps ol {
  display: flex; list-style: none; margin: 0; padding: 12px 16px; gap: 4px;
  max-width: 960px; margin-inline: auto;
}
.steps li {
  flex: 1; text-align: center; font-size: .75rem; color: var(--muted);
  padding-top: 8px; border-top: 3px solid var(--line);
}
.steps li.active { color: var(--primary); border-color: var(--primary); font-weight: 700; }
.steps li.complete { border-color: var(--primary); }

main { max-width: 960px; margin: 0 auto; padding: 0 16px 24px; }
h2 { font-size: 1.1rem; margin: 24px 0 12px; }
.hint { color: var(--muted); font-size: .85rem; margin: -6px 0 12px; }

/* ---------- Menu ---------- */
.category-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 16px; }
.category-tabs button {
  flex-shrink: 0; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 8px 16px;
}
.category-tabs button.active { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }

.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.menu-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column;
}
.menu-card .thumb {
  aspect-ratio: 4 / 3; display: grid; place-items: center; font-size: 3.5rem;
  background: linear-gradient(135deg, #fbe9ec, #fdf3e6);
}
.menu-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.menu-card .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.menu-card h3 { margin: 0; font-size: 1rem; }
.menu-card p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.5; flex: 1; }
.menu-card .row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.price { font-weight: 700; }

/* ---------- Buttons ---------- */
.btn {
  border: none; border-radius: 999px; padding: 10px 20px; font-weight: 700; white-space: nowrap;
}
.btn.primary { background: var(--primary); color: var(--primary-text); }
.btn.primary:disabled { background: var(--disabled); cursor: not-allowed; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.small { padding: 6px 14px; font-size: .85rem; }
.icon-btn { border: none; background: none; font-size: 1.1rem; padding: 4px 8px; }

.qty { display: inline-flex; align-items: center; gap: 8px; }
.qty button {
  width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); line-height: 1;
}

/* ---------- Location ---------- */
.location-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.choice {
  text-align: left; background: var(--surface); border: 2px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.choice.selected { border-color: var(--primary); background: var(--primary-soft); }
.choice strong { display: block; margin-bottom: 4px; }
.choice small { color: var(--muted); display: block; line-height: 1.6; }
.choice small.partner-note { color: var(--primary); margin-top: 4px; }
.choice small.loc-notice { color: #d32f2f; font-weight: 600; margin-top: 4px; }

/* ---------- Calendar ---------- */
.calendar {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 12px; max-width: 420px;
}
.cal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.cal-head strong { font-size: 1rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-grid .dow { font-size: .75rem; color: var(--muted); padding: 4px 0; }
.cal-grid .dow.sun { color: #d9534f; }
.cal-grid .dow.sat { color: #4a7fc1; }
.cal-day {
  aspect-ratio: 1; border: none; border-radius: 50%; background: none; font-size: .9rem;
}
.cal-day:disabled { color: var(--disabled); cursor: default; }
.cal-day:not(:disabled):hover { background: var(--primary-soft); }
.cal-day.selected { background: var(--primary); color: var(--primary-text); font-weight: 700; }
.cal-day.today { outline: 1px dashed var(--muted); }

/* ---------- Time slots ---------- */
.slot-list { display: flex; flex-wrap: wrap; gap: 8px; }
.slot-list .choice { padding: 8px 16px; border-radius: 999px; }
.slot-list:empty::before { content: "Please choose a pickup date first."; color: var(--muted); font-size: .85rem; }

/* ---------- Form ---------- */
.form { display: grid; gap: 14px; max-width: 520px; }
.form label { display: grid; gap: 6px; font-size: .9rem; font-weight: 500; }
.form em { font-style: normal; font-size: .7rem; color: var(--primary-text); background: var(--primary); border-radius: 4px; padding: 1px 6px; margin-left: 6px; }
.form input, .form textarea {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.form input:focus, .form textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }
.form .invalid { border-color: #d9534f; }
.form .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form .hint { margin: 0; }
.form .field-note { color: var(--muted); font-size: .8rem; font-weight: 400; }

/* ---------- Summary ---------- */
.summary { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.summary dl { display: grid; grid-template-columns: 7em 1fr; gap: 8px 12px; margin: 0; }
.summary dt { color: var(--muted); font-size: .85rem; }
.summary dd { margin: 0; }
.summary table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.summary td { padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.summary td:last-child { text-align: right; white-space: nowrap; }
.summary .sub td, .cart-totals .sub td { color: var(--muted); border-bottom: none; padding: 4px 0; }
.fee-waived s { color: var(--muted); }
.fee-waived strong { color: var(--primary); margin-left: 4px; }
.summary .grand td { font-weight: 700; border-bottom: none; font-size: 1.05rem; border-top: 1px solid var(--line); padding-top: 10px; }
.cart-totals { width: 100%; border-collapse: collapse; margin-top: 12px; }
.cart-totals td:last-child { text-align: right; }
.cart-totals .grand td { font-weight: 700; padding-top: 8px; border-top: 1px solid var(--line); }
.summary .note { color: var(--muted); font-size: .8rem; margin: 16px 0 0; }

/* ---------- Action bar ---------- */
.action-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.action-bar .total { font-size: .9rem; white-space: nowrap; }
.action-bar .total strong { font-size: 1.2rem; margin-left: 4px; }
.action-bar .total small { color: var(--muted); margin-left: 2px; }
.action-bar .actions { display: flex; gap: 8px; }

/* ---------- Drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(380px, 100%); z-index: 31;
  background: var(--surface); padding: 16px; overflow-y: auto; box-shadow: -4px 0 20px rgba(0,0,0,.1);
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
.drawer-head h2 { margin: 0; }
.cart-items { margin-top: 12px; }
.cart-line { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-line .name { font-weight: 500; }
.cart-line small { display: block; color: var(--muted); }
.cart-line .right { text-align: right; display: grid; gap: 6px; justify-items: end; }
.empty { color: var(--muted); text-align: center; padding: 32px 0; }

/* ---------- Dialog ---------- */
.item-dialog {
  border: none; border-radius: var(--radius); padding: 20px; width: min(400px, calc(100% - 32px));
  box-shadow: var(--shadow);
}
.item-dialog::backdrop { background: rgba(0,0,0,.35); }
.item-dialog h3 { margin: 0 0 12px; }
.item-dialog .size-list { display: grid; gap: 8px; margin-bottom: 16px; }
.item-dialog .size-list .choice { display: flex; justify-content: space-between; padding: 10px 14px; }
.item-dialog .foot { display: flex; justify-content: space-between; align-items: center; }

/* ---------- Done ---------- */
.done { text-align: center; padding-top: 16px; }
.done .done-icon { font-size: 4rem; }
.done .order-no { font-size: 1.6rem; font-weight: 700; color: var(--primary); letter-spacing: .1em; margin-top: 0; }
.done .summary { text-align: left; margin: 24px auto; max-width: 520px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: .85rem;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 40;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 480px) {
  .menu-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .menu-card .thumb { font-size: 2.6rem; }
  .menu-card .row { flex-direction: column; align-items: stretch; gap: 6px; }
  .action-bar { gap: 8px; }
  .action-bar .total { font-size: .8rem; }
  .action-bar .total small { display: none; }
  .action-bar .btn { padding: 10px 14px; }
}

/* ---------- Cancel page (cancel.html) ---------- */
a.brand { text-decoration: none; }
.cancel-page { padding-bottom: 32px; }
.cancel-card { max-width: 560px; margin: 24px auto; }
.cancel-card h2 { margin-top: 0; }
.cancel-card dl { margin: 16px 0; }
.cancel-card .pre { white-space: pre-line; }
.cancel-card .muted { color: var(--muted); font-size: .85rem; }
.cancel-card .error { color: #d9534f; font-size: .85rem; }
.cancel-card a { color: var(--primary); }
.cancel-actions { margin: 16px 0 8px; }

/* ---------- Netlify バナーがあるときの配置（badge.js が body に has-badge を付けます） ---------- */
/* バナー: 右下に固定、幅約200px・高さ約64px */
body.has-badge .action-bar { padding-right: 230px; }
body.has-badge.cancel-page { padding-bottom: 96px; }

@media (max-width: 640px) {
  /* スマホ: ボタンの列をバナーの上に持ち上げる */
  body.has-badge .action-bar {
    padding-right: 16px;
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }
  body.has-badge { padding-bottom: 170px; }
  body.has-badge .toast { bottom: 170px; }
}

/* ---------- Header links / Policies page (policies.html) ---------- */
.header-actions { display: flex; align-items: center; gap: 12px; }
/* ヘッダーのリンク（Policies など）: 目立つようにピンクの枠付きボタン風 */
.header-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px; border: 1.5px solid var(--primary); border-radius: 999px;
  background: var(--primary-soft); color: var(--primary);
  font-size: .85rem; font-weight: 700; text-decoration: none; white-space: nowrap;
}
.header-link:hover { background: var(--primary); color: var(--primary-text); }
.header-link-icon { font-size: .95em; }

/* 狭いスマホでは「Online Order」の小見出しを省いてヘッダーを1行に収める */
@media (max-width: 360px) {
  .site-header .brand span { display: none; }
  .header-link { padding: 6px 10px; }
}
.hint.agree { margin-top: 12px; }
.hint a, .policy a { color: var(--primary); }

.policy-page { padding-bottom: 32px; }
body.has-badge.policy-page { padding-bottom: 96px; }
.policy { max-width: 720px; }
.policy h1 { font-size: 1.5rem; margin: 24px 0 8px; }
.policy .lead { color: var(--muted); margin: 0 0 8px; }
.policy section {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 4px 20px 12px; margin: 16px 0;
}
.policy h2 { font-size: 1.05rem; margin: 16px 0 8px; color: var(--primary); }
.policy ul { margin: 0; padding-left: 1.2em; line-height: 1.7; }
.policy li + li { margin-top: 4px; }
.policy .agree-note { font-weight: 700; margin: 24px 0 16px; }
.policy a.btn { display: inline-block; text-decoration: none; color: var(--primary-text); }

/* ---------- Thanks page (thanks.html) ---------- */
.thanks-icon { font-size: 3rem; text-align: center; }
.cancel-card a.btn { display: inline-block; text-decoration: none; color: var(--primary-text); }
