:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #15181d;
  --muted: #6b717c;
  --line: #e3e6eb;
  --field-line: #cfd4dc;
  --accent: #2f5bea;
  --accent-text: #ffffff;
  --accent-soft: #eef2fe;
  /* The dark button that moves on to the next step. */
  --ink: #15181d;
  --ink-text: #ffffff;
  --error: #d92d20;
  --error-soft: #fdecea;
  --sat: #2563eb;
  --sun: #dc2626;
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #181b21;
    --text: #eceef2;
    --muted: #9aa1ad;
    --line: #2a2f38;
    --field-line: #3a404b;
    --accent: #7d9bff;
    --accent-text: #0b1020;
    --accent-soft: #1c2440;
    --ink: #eceef2;
    --ink-text: #111318;
    --error: #ff8a80;
    --error-soft: #3a1f1f;
    --sat: #8fb0ff;
    --sun: #ff8a80;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
}

.num { font-variant-numeric: tabular-nums; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

p { margin: 0 0 12px; }

h1 {
  font-size: 22px;
  line-height: 1.4;
  margin: 16px 0 6px;
  outline: none;
}

h2 { font-size: 17px; margin: 24px 0 8px; }

.lead { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.loading { color: var(--muted); }

/* ---------------------------------------------------------------- page frame */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}

.site-header-inner {
  max-width: 1120px;
  margin: 0 auto;
  min-height: 60px;
  padding: 10px max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.shop-name { margin: 0; font-size: 18px; font-weight: 800; }

.site-badge {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1px 8px;
}

.shop-tel { margin: 0 0 0 auto; font-size: 13px; color: var(--muted); }

/* 日本語 / English: a small two-way switch at the end of the header. */
.lang-switch {
  display: inline-flex;
  margin-left: auto;
  padding: 2px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--line);
}
.shop-tel:not([hidden]) + .lang-switch { margin-left: 12px; }
.lang-switch button {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.lang-switch button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.shop-tel a { color: var(--accent); font-weight: 700; text-decoration: none; white-space: nowrap; }
@media (max-width: 599px) { .shop-tel, .site-badge { display: none; } .lang-switch { margin-left: auto !important; } }

.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px max(16px, env(safe-area-inset-left)) 32px;
}

/* Steps without the summary (confirm, done, status) read as one centred column. */
main { max-width: 680px; margin: 0 auto; outline: none; }

.site-footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 max(16px, env(safe-area-inset-left)) max(24px, env(safe-area-inset-bottom));
  color: var(--muted);
  font-size: 12px;
}

@media (min-width: 880px) {
  .layout { padding-top: 20px; }
  body.has-cart .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 40px;
    align-items: start;
  }
  body.has-cart main { max-width: none; margin: 0; }
  h1 { font-size: 28px; }
}

/* ---------------------------------------------------------------- stepper */

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.stepper li { display: flex; align-items: center; gap: 6px; }
.stepper li + li::before {
  content: "";
  width: 20px;
  height: 1.5px;
  background: var(--line);
  margin-right: 2px;
}
.step-no {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--line);
  color: var(--muted);
  font-size: 11px;
  display: grid;
  place-items: center;
  flex: none;
}
.stepper li.done { color: var(--text); }
.stepper li.done .step-no { background: var(--ink); color: var(--ink-text); }
.stepper li.current { color: var(--accent); }
.stepper li.current .step-no { background: var(--accent); color: var(--accent-text); }
/* Phones: only the current step keeps its name. */
@media (max-width: 599px) {
  .stepper li:not(.current) .step-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .stepper li + li::before { width: 14px; }
}

/* ---------------------------------------------------------------- buttons */

button { font: inherit; color: inherit; }

.primary {
  display: block;
  width: 100%;
  min-height: 52px;
  margin: 20px 0 12px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}
.primary:disabled { opacity: 0.4; cursor: default; }

.link {
  border: 0;
  background: none;
  padding: 10px 0;
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
}
.link:disabled { color: var(--muted); opacity: 0.5; cursor: default; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

/* ---------------------------------------------------------------- booking summary */

.cart-head { display: flex; justify-content: space-between; align-items: center; }
.cart-head h2 { margin: 0; font-size: 16px; }
.cart-head .link { font-size: 13px; padding: 0; min-height: 32px; }

.cart-lines { list-style: none; padding: 0; margin: 10px 0 0; }
.cart-lines li { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 3px 0; }
.cart-lines li span:last-child { white-space: nowrap; }
.cart-lines .cart-option { color: var(--muted); font-size: 13px; padding-left: 12px; }

.cart-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 17px;
  font-weight: 800;
}
.cart-total span:last-child { white-space: nowrap; }
.cart-note { text-align: right; color: var(--muted); font-size: 12px; margin: 2px 0 0; }
.cart-empty { color: var(--muted); font-size: 14px; margin: 10px 0 0; }

.cart-block { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.cart-block span { display: block; font-size: 11px; font-weight: 700; color: var(--muted); }
.cart-block strong { display: block; font-size: 15px; }
.cart-block.empty strong { color: var(--muted); font-weight: 500; font-size: 14px; }

.cart-next { background: var(--ink); color: var(--ink-text); }

.cart-toggle {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  display: none;
}
.cart-toggle-label { display: block; font-size: 12px; font-weight: 700; color: var(--accent); }
.cart-toggle-label::after { content: " ▲"; font-size: 10px; }
.cart-toggle[aria-expanded="true"] .cart-toggle-label::after { content: " ▼"; }
.cart-toggle strong { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Wide screens: a card beside the steps that stays in view. */
@media (min-width: 880px) {
  .cart {
    position: sticky;
    top: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 20px;
    box-shadow: 0 18px 36px -26px rgba(20, 25, 35, 0.35);
  }
  .cart-next { margin: 18px 0 0; }
}

/* Phones: a bar at the bottom; the summary is pulled up over the page from it. */
@media (max-width: 879px) {
  body.has-cart .layout { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  body.has-cart .site-footer { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
  .cart { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; }
  /* While typing, the keyboard needs the room; the button is back when the field is left. */
  body.typing .cart { display: none; }
  .cart.open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background: rgba(10, 12, 16, 0.45);
  }
  .cart-sheet {
    display: none;
    max-height: 65vh;
    overflow-y: auto;
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    padding: 18px 16px 10px;
  }
  .cart.open .cart-sheet { display: block; }
  .cart-foot {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 10px max(16px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 30px -22px rgba(0, 0, 0, 0.4);
  }
  .cart.open .cart-foot { border-top-color: transparent; box-shadow: none; }
  .cart-toggle { display: block; }
  .cart-next { width: auto; min-height: 48px; margin: 0; padding: 0 20px; flex: none; }
}

/* ---------------------------------------------------------------- menu */

.menus {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.menus > li + li { border-top: 1px solid var(--line); }

.menu-card {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
  align-items: start;
  width: 100%;
  text-align: left;
  padding: 16px;
  border: 0;
  background: none;
  cursor: pointer;
}
.menu-card:disabled { opacity: 0.45; cursor: default; }
.menu-check {
  position: relative;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  border: 2px solid var(--field-line);
  border-radius: 7px;
}
.menu-card[aria-pressed="true"] .menu-check { border-color: var(--accent); background: var(--accent); }
.menu-card[aria-pressed="true"] .menu-check::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid var(--accent-text);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.menu-text { display: grid; gap: 1px; }
.menu-name { font-size: 16px; font-weight: 700; }
.menu-desc { font-size: 13px; color: var(--muted); }
.menu-meta { display: grid; text-align: right; line-height: 1.4; }
.menu-price { font-size: 15px; font-weight: 600; white-space: nowrap; }
.menu-meta span:last-child { font-size: 12px; color: var(--muted); }
/* A scheduled price change, under the menu's name and price. */
.menu-change { grid-column: 2 / -1; font-size: 12px; font-weight: 700; color: var(--accent); }

.menu-options {
  margin: -4px 16px 14px 52px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: var(--bg);
}
/* Floated so the legend sits inside the tinted box instead of on its edge. */
.menu-options legend { float: left; width: 100%; padding: 8px 0 0; font-size: 12px; font-weight: 700; color: var(--muted); }
.option {
  clear: both;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-size: 14px;
  cursor: pointer;
}
.option + .option { border-top: 1px solid var(--line); }
.option input { width: 20px; height: 20px; margin: 0; accent-color: var(--accent); flex: none; }
.option-name { flex: 1; }
.option-meta { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- date and time */

/* Calendar above the times: a shop with many start times would otherwise make a very long column. */
.pick { display: grid; gap: 16px; }

.cal-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.cal-nav h2 { margin: 0; font-size: 15px; text-align: center; }
.cal-nav .link { font-size: 13px; padding: 0 2px; white-space: nowrap; }

.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-wds { margin-bottom: 6px; text-align: center; font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-wds .sat { color: var(--sat); }
.cal-wds .sun { color: var(--sun); }

.date {
  display: grid;
  justify-items: center;
  padding: 8px 0 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  line-height: 1.3;
}
.date:hover:not(:disabled) { border-color: var(--accent); }
.date .day { font-size: 19px; font-weight: 600; }
.date.sat .day { color: var(--sat); }
.date.sun .day { color: var(--sun); }
.date .mark { font-size: 11px; font-weight: 800; color: var(--accent); white-space: nowrap; }
.date:disabled { border-color: transparent; background: var(--bg); cursor: default; }
.date:disabled .day,
.date:disabled .mark { color: var(--muted); opacity: 0.6; }
.date[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.date[aria-checked="true"] .day,
.date[aria-checked="true"] .mark { color: var(--accent-text); }
@media (max-width: 599px) { .date .mark-text { display: none; } }

.times-panel h2 { margin: 0 0 10px; font-size: 15px; }
.times { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }

.time {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}
.time:hover { border-color: var(--accent); }
.time-start { font-size: 16px; font-weight: 600; }
.time-end { font-size: 12px; color: var(--muted); }
.time[aria-checked="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.time[aria-checked="true"] .time-end { color: var(--accent-text); opacity: 0.85; }

/* ---------------------------------------------------------------- details form */

.details { display: grid; gap: 18px; margin-top: 12px; }

.field label,
.contact legend { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; margin-bottom: 6px; padding: 0; }

.req,
.opt { padding: 0 6px; border-radius: 5px; font-size: 11px; font-weight: 700; }
.req { background: var(--ink); color: var(--ink-text); }
.opt { color: var(--muted); background: var(--line); }
.legend-note { font-size: 12px; font-weight: 500; color: var(--muted); }

input,
textarea {
  width: 100%;
  /* 16px or larger keeps iOS Safari from zooming in on focus. */
  font: inherit;
  font-size: 16px;
  padding: 12px 14px;
  border: 1px solid var(--field-line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
}
input::placeholder,
textarea::placeholder { color: var(--muted); opacity: 0.7; }
textarea { resize: vertical; }

.field.invalid input,
.field.invalid textarea { border: 2px solid var(--error); padding: 11px 13px; }
.field-error { color: var(--error); font-size: 13px; margin: 6px 0 0; font-weight: 700; }

.contact { border: 0; margin: 0; padding: 0; min-width: 0; }
.contact .field { margin: 0; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--line);
}
.segmented button {
  min-height: 40px;
  border: 0;
  border-radius: 9px;
  background: none;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); }

/* ---------------------------------------------------------------- confirm */

.review-card {
  margin: 16px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.review-section { padding: 14px 16px; }
.review-section + .review-section { border-top: 1px solid var(--line); }
.review-head { display: flex; justify-content: space-between; align-items: center; }
.review-head h2 { margin: 0; font-size: 12px; color: var(--muted); }
.review-head .link { font-size: 13px; padding: 0; min-height: 32px; }
.review-section .cart-lines { margin-top: 4px; }
.review-value { font-size: 16px; font-weight: 700; margin: 2px 0 0; }
.review-sub { font-size: 14px; color: var(--muted); margin: 0; overflow-wrap: anywhere; }
.review-note {
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--bg);
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.turnstile { min-height: 65px; margin-top: 12px; }

/* ---------------------------------------------------------------- done and status */

.done-mark {
  position: relative;
  width: 56px;
  height: 56px;
  margin: 24px 0 0;
  border-radius: 50%;
  background: var(--accent-soft);
}
.done-mark::after {
  content: "";
  position: absolute;
  left: 21px;
  top: 14px;
  width: 11px;
  height: 21px;
  border: solid var(--accent);
  border-width: 0 3.5px 3.5px 0;
  transform: rotate(45deg);
}
.done-title { margin-top: 12px; }

.review {
  display: grid;
  grid-template-columns: 6.5em 1fr;
  gap: 10px 12px;
  margin: 16px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.review dt { color: var(--muted); font-size: 14px; }
.review dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.reference { font-size: 22px; font-weight: 700; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }

.notice {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--accent-soft);
}
.notice.error { background: var(--error-soft); color: var(--error); font-weight: 600; }
.notice.ok { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.phone { margin-top: 20px; font-size: 14px; color: var(--muted); }
.phone a { color: var(--accent); font-weight: 700; white-space: nowrap; }

.state {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
}
.state-declined,
.state-cancelled { background: var(--line); color: var(--muted); }
.state-cancelling,
.state-pending,
.state-requested { background: #fdf0d9; color: #8a5a00; }
@media (prefers-color-scheme: dark) {
  .state-cancelling,
  .state-pending,
  .state-requested { background: #3a2f1a; color: #f2c879; }
}

.secondary,
.danger {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 12px 0 4px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.secondary { border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.danger { border: 0; background: var(--error); color: #fff; }
.danger:disabled { opacity: 0.45; cursor: default; }

.cancel-box {
  padding: 16px;
  border: 1px solid var(--error);
  border-radius: var(--radius);
  background: var(--error-soft);
}

a.as-link { text-align: center; line-height: 52px; text-decoration: none; }

.my-bookings {
  margin: 0 0 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--accent-soft);
}
.my-bookings h2 { margin: 0 0 4px; font-size: 15px; }
.my-bookings ul { margin: 0; padding-left: 1.2em; }
.my-bookings a { color: var(--accent); }
/* Colours come from the status page's .state-* rules; confirmed sits on the box's own tint. */
.my-state {
  display: inline-block;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  vertical-align: 1px;
}
.my-state.state-confirmed { background: var(--surface); color: var(--accent); }

/* The author's display rule above would otherwise show an empty pill while the state loads. */
.my-state[hidden] { display: none; }
