/* ==========================================================
   Hime Matcha · ordering UI (bag, sheets, checkout)
   ========================================================== */

.ico { width: 13px; height: 13px; flex: none; }
.hide-sm { display: inline; }

/* test-mode strip */
.testmode { background: #FFF1C9; color: #6B4E12; font-size: 13px; text-align: center; padding: 6px 16px; border-bottom: 1px solid #EBD592; }

/* header bag button */
.header-order { margin-left: 4px; }
.bag-btn {
  position: relative; flex: none;
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--matcha-deep); color: var(--matcha-deep);
  border: 0; cursor: pointer;
  box-shadow: 0 3px 0 #1D3117;
  transition: transform .12s;
}
.bag-btn svg { width: 26px; height: 26px; color: var(--washi); --bag-dot: var(--sakura-mid); }
.bag-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #1D3117; }
.bag-count {
  position: absolute; top: -4px; right: -4px;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--sakura); color: var(--ink); border: 2px solid var(--ink);
  font: 700 12px/1 var(--f-body);
  animation: pop .3s ease;
}
.bag-count[hidden] { display: none; }
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* menu card bits */
.arch { padding: 0; cursor: pointer; display: block; width: 100%; font: inherit; }
.arch:disabled { cursor: default; }
.card.is-out .arch img { filter: grayscale(.85); opacity: .7; }
.btn-soldout { background: var(--washi-2); color: var(--ink-soft); border-color: var(--line); cursor: not-allowed; box-shadow: none; }
.btn-wide { width: 100%; justify-content: center; padding-block: 16px; font-size: 17px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-link { background: none; border: 0; color: var(--matcha-deep); font: 500 15px var(--f-body); text-decoration: underline; text-underline-offset: 4px; cursor: pointer; padding: 10px; margin: 4px auto 0; display: block; }

/* floating bag bar (phones) */
.bagbar {
  position: fixed; z-index: 60;
  left: 16px; right: 16px; bottom: calc(14px + env(safe-area-inset-bottom));
  display: none; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-radius: 999px; border: 0; cursor: pointer;
  background: var(--matcha-deep); color: var(--washi);
  font: 700 16px/1 var(--f-body);
  box-shadow: 0 4px 0 #1D3117, 0 12px 30px -10px rgba(47,74,38,.6);
  animation: rise .3s ease;
}
.bagbar-count { min-width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; background: var(--sakura); color: var(--ink); font-size: 13px; padding: 0 6px; }
.bagbar-total { margin-left: auto; font-family: var(--f-display); font-size: 18px; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* toast */
.toast {
  position: fixed; z-index: 120; left: 50%; top: 18px;
  transform: translate(-50%, -140%);
  background: var(--ink); color: var(--washi);
  padding: 11px 18px; border-radius: 999px; font-size: 15px; font-weight: 500;
  transition: transform .25s ease; pointer-events: none; max-width: calc(100% - 32px); text-align: center;
}
.toast.is-on { transform: translate(-50%, 0); }

/* ---------- dialogs ---------- */
html.is-locked, html.is-locked body { overflow: hidden; }
dialog { border: 0; padding: 0; color: var(--ink); background: var(--washi); }
dialog::backdrop { background: rgba(43, 42, 38, .45); backdrop-filter: blur(2px); }

.sheet {
  width: min(480px, calc(100% - 32px)); max-height: min(720px, 92dvh);
  border-radius: var(--r-lg); border: 2px solid var(--ink);
  box-shadow: 6px 6px 0 var(--sakura-mid);
  overflow: auto;
}
.sheet[open] { animation: sheet-in .22s ease; }
@keyframes sheet-in { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-inner { padding: 22px; display: grid; gap: 18px; }
.sheet-head { display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; align-items: start; }
.sheet-photo { width: 92px; height: 92px; border-radius: 50%; overflow: hidden; border: 2px solid var(--ink); box-shadow: 0 0 0 5px var(--washi), 0 0 0 7px var(--ink); margin: 7px; }
.sheet-photo img { width: 100%; height: 100%; object-fit: cover; }
.sheet h2 { font-size: 24px; font-weight: 800; padding-top: 8px; }
.sheet-notes { color: var(--ink-soft); font-size: 14.5px; margin-top: 4px; line-height: 1.5; }
.sheet-foot { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; position: sticky; bottom: -22px; background: var(--washi); padding: 12px 0 4px; margin-bottom: -4px; }
.sheet-foot .btn-wide { font-size: 16px; padding-inline: 14px; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--card); border: 2px solid var(--ink); color: var(--ink);
  cursor: pointer; font: 700 18px/1 var(--f-body);
}
.icon-btn svg { width: 14px; height: 14px; }
.icon-btn:hover { background: var(--sakura); }

/* drawer */
.drawer {
  margin: 0 0 0 auto;
  width: min(440px, 100%); max-width: 100%; height: 100dvh; max-height: 100dvh;
  border-left: 2px solid var(--ink);
  overflow: hidden;
}
.drawer[open] { animation: drawer-in .25s ease; }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-inner { height: 100%; display: flex; flex-direction: column; overflow: auto; overscroll-behavior: contain; }
.drawer-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; background: var(--washi);
  border-bottom: 2px dashed var(--line);
}
.drawer-head h2 { font-size: 24px; font-weight: 800; margin-right: auto; }
.drawer-foot { margin-top: auto; padding: 16px 20px calc(20px + env(safe-area-inset-bottom)); border-top: 2px dashed var(--line); background: var(--washi); position: sticky; bottom: 0; }

.lines { list-style: none; margin: 0; padding: 8px 20px; }
.line { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: start; padding: 14px 0; border-bottom: 2px dotted var(--line); }
.line:last-child { border-bottom: 0; }
.line img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--ink); }
.line.is-out img { filter: grayscale(1); }
.line-name { font-family: var(--f-display); font-weight: 800; color: var(--matcha-deep); font-size: 17px; line-height: 1.25; }
.line-meta { color: var(--ink-soft); font-size: 13.5px; margin-top: 2px; }
.line-meta b { color: var(--beni); }
.line-price { font-family: var(--f-display); font-weight: 800; font-size: 17px; }

.stepper { display: inline-flex; align-items: center; border: 2px solid var(--ink); border-radius: 999px; background: var(--card); }
.stepper button { width: 42px; height: 42px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; color: var(--ink); border-radius: 50%; }
.stepper button:hover { background: var(--matcha-soft); }
.stepper svg { width: 14px; height: 14px; }
.stepper output { min-width: 26px; text-align: center; font-weight: 700; font-size: 17px; }
.stepper-sm { margin-top: 8px; }
.stepper-sm button { width: 34px; height: 34px; }
.stepper-sm output { min-width: 22px; font-size: 15px; }

.sum { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; }
.sum b { font-family: var(--f-display); font-size: 20px; color: var(--matcha-deep); }
.drawer-foot .sum { margin-bottom: 12px; font-size: 16px; }

.bag-empty { text-align: center; padding: 40px 24px; display: grid; justify-items: center; gap: 6px; margin: auto 0; }
.bag-empty img { width: 170px; margin-bottom: 6px; }
.bag-empty .hand { font-size: 22px; color: var(--sakura-deep); }
.bag-empty p:not(.hand) { color: var(--ink-soft); margin-bottom: 14px; }

/* ---------- forms ---------- */
.checkout { padding: 18px 20px calc(28px + env(safe-area-inset-bottom)); display: grid; gap: 18px; }
.field { display: grid; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field[hidden] { display: none; }
.label, .field legend { font-weight: 700; font-size: 14px; color: var(--matcha-deep); letter-spacing: .02em; padding: 0; margin-bottom: 6px; }
.label i, .field legend i { font-style: normal; font-weight: 400; color: var(--ink-soft); margin-left: 4px; }
.field input:not([type=radio]), .field textarea {
  width: 100%; font: 400 16px/1.4 var(--f-body); color: var(--ink);
  background: var(--card); border: 2px solid var(--ink); border-radius: 14px;
  padding: 12px 14px;
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--matcha); box-shadow: 0 0 0 4px var(--matcha-soft); }
.field [aria-invalid="true"] { border-color: var(--beni); box-shadow: 0 0 0 4px #F6D3D0; }
.hint { font-size: 13px; color: var(--ink-soft); }

.options { display: grid; gap: 8px; }
.option {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--card); border: 2px solid var(--ink); border-radius: 14px;
  padding: 12px 14px; cursor: pointer;
}
.option:has(input:checked) { background: var(--matcha-soft); border-color: var(--matcha-deep); }
.option input[type=radio] { accent-color: var(--matcha-deep); width: 20px; height: 20px; margin: 0; }
.option span { flex: 1; font-weight: 500; }
.option b { font-family: var(--f-display); }
.field .time-input { width: auto; flex: 0 1 140px; padding: 6px 10px; border-radius: 10px; }
.time-input:disabled { opacity: .45; }

.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--washi-2); border: 2px solid var(--ink); border-radius: 999px; padding: 4px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 11px; border-radius: 999px; font-weight: 700; cursor: pointer; }
.seg input:checked + span { background: var(--matcha-deep); color: var(--washi); }
.seg input:focus-visible + span { outline: 3px solid var(--sakura-deep); outline-offset: 2px; }

.pickup-info { background: var(--matcha-soft); border-radius: 14px; padding: 10px 14px; font-size: 14.5px; }
.paybox { background: var(--sakura); border-radius: 14px; padding: 12px 14px; font-size: 14.5px; line-height: 1.5; }
.paybox-warn { background: #FFF1C9; }
.form-error { background: #FBE3E0; color: #8E2A23; border: 2px solid var(--beni); border-radius: 14px; padding: 10px 14px; font-size: 14.5px; font-weight: 500; margin-bottom: 10px; }
.checkout .form-error { margin: 0; }

.summary { background: var(--card); border: 2px solid var(--ink); border-radius: 18px; padding: 12px 16px; font-size: 14.5px; }
.sum-line { color: var(--ink-soft); }
.sum-total { border-top: 2px dotted var(--line); margin-top: 6px; padding-top: 10px; font-size: 16px; align-items: baseline; }
.summary .sum[hidden] { display: none; }

/* ---------- QR pay card ---------- */
.qrpay {
  margin: 0; width: 100%;
  background: var(--card); border: 2px solid var(--ink); border-radius: 24px;
  box-shadow: 5px 5px 0 var(--sakura-mid);
  overflow: hidden; text-align: center;
}
.qrpay-head {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: var(--matcha-deep); color: var(--washi);
  padding: 12px 16px 20px;
  font-weight: 700; font-size: 15px;
}
.qrpay-head::after { /* scalloped edge, like the hero */
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 10px;
  background: radial-gradient(circle at 9px -2px, transparent 8.5px, var(--card) 9px) 0 0 / 18px 10px repeat-x;
}
.qrpay-jp { font-family: var(--f-display); font-weight: 800; font-size: 13px; letter-spacing: .2em; background: var(--sakura); color: var(--matcha-deep); border-radius: 6px; padding: 1px 7px; }
.qrpay-body { padding: 18px 18px 20px; display: grid; justify-items: center; gap: 10px; }

.qrpay-frame {
  position: relative;
  width: min(250px, 100%); aspect-ratio: 1;
  padding: 10px; margin-top: 6px;
  background: #fff;
  border: 2px solid var(--ink); border-radius: 18px;
  box-shadow: 0 0 0 6px var(--card), 0 0 0 8px var(--matcha-soft);
}
.qrpay-frame::before { /* stitched inner line, kept outside the QR's white border */
  content: ""; position: absolute; inset: 4px; border: 1.5px dashed var(--froth); border-radius: 13px; pointer-events: none;
}
.qrpay-qr { width: 100%; height: 100%; display: block; image-rendering: pixelated; border-radius: 6px; }
.qrpay-flower { position: absolute; width: 30px; height: 30px; fill: var(--sakura); stroke: var(--ink); stroke-width: 1.6; z-index: 1; }
.qrpay-flower.f1 { top: -15px; left: -15px; transform: rotate(-12deg); }
.qrpay-flower.f2 { bottom: -15px; right: -15px; transform: rotate(20deg); width: 24px; height: 24px; }
.qrpay-mascot { position: absolute; width: 74px; top: -70px; right: -22px; transform: rotate(10deg); z-index: 1; pointer-events: none; }

.qrpay figcaption { display: grid; gap: 0; margin-top: 4px; }
.qrpay-name { font-family: var(--f-display); font-weight: 800; font-size: 22px; color: var(--matcha-deep); line-height: 1.2; }
.qrpay-via { font-size: 13px; color: var(--ink-soft); letter-spacing: .04em; }
.qrpay-amount { background: var(--sakura); border-radius: 999px; padding: 7px 16px; font-size: 15px; }
.qrpay-amount b { font-family: var(--f-display); font-size: 19px; color: var(--matcha-deep); margin-left: 2px; }
.qrpay-save { margin-top: 2px; }
.qrpay-fine { font-size: 12.5px; color: var(--ink-soft); max-width: 30em; line-height: 1.5; }

/* ---------- stamp card ---------- */
.stamps-sec { background: var(--washi-2); }
.stamps-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 48px; align-items: center; }
.stamps-grid > * { min-width: 0; }
.stamps-copy h2 { font-size: clamp(34px, 4.2vw, 50px); font-weight: 800; }
.stamps-lede { color: var(--ink-soft); margin-top: 14px; max-width: 32em; }
.stamps-lede b { color: var(--ink); }
.stamps-how { list-style: none; padding: 0; margin: 22px 0 26px; display: grid; gap: 10px; }
.stamps-how li { display: flex; align-items: center; gap: 12px; font-weight: 500; }
.stamps-how span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--sakura); border: 2px solid var(--ink); font: 800 14px var(--f-display); }
.stamp-lookup { display: flex; gap: 10px; max-width: 440px; }
.stamp-lookup input { flex: 1; min-width: 0; font: 500 16px var(--f-body); padding: 12px 16px; border: 2px solid var(--ink); border-radius: 999px; background: var(--card); }
.stamp-lookup input:focus { outline: none; border-color: var(--matcha); box-shadow: 0 0 0 4px var(--matcha-soft); }
.stamps-copy .form-error { margin-top: 12px; max-width: 440px; }
.stamps-hint { margin-top: 12px; }

.stampcard {
  position: relative;
  background:
    radial-gradient(circle at 100% 0, var(--sakura) 0 70px, transparent 71px),
    var(--card);
  border: 2px solid var(--ink); border-radius: 24px;
  box-shadow: 7px 7px 0 var(--matcha-deep);
  padding: 22px 22px 20px;
  max-width: 480px; margin-inline: auto;
  transform: rotate(-1.2deg);
}
.stampcard.is-full { box-shadow: 7px 7px 0 var(--kin); }
.stampcard.is-preview .sc-grid { opacity: .55; }
.sc-top { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 2px dashed var(--line); margin-bottom: 18px; }
.sc-mon { width: 40px; height: 40px; color: var(--kin); flex: none; }
.sc-title { margin-right: auto; line-height: 1.1; }
.sc-jp { font-family: var(--f-display); font-weight: 800; font-size: 20px; color: var(--matcha-deep); letter-spacing: .06em; }
.sc-en { font-size: 11px; font-weight: 700; letter-spacing: .26em; text-transform: uppercase; color: var(--ink-soft); }
.sc-owner { font: 800 15px var(--f-display); background: var(--washi); border: 2px solid var(--ink); border-radius: 999px; padding: 3px 12px; letter-spacing: .08em; }

.sc-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.sc-slot { aspect-ratio: 1; border-radius: 50%; border: 2px dashed #CFC5AE; display: grid; place-items: center; position: relative; }
.sc-slot.is-on { border-style: solid; border-color: transparent; }
.sc-slot.is-soon { border-color: var(--sakura-mid); background: #FDF1F3; }
.sc-num { font: 600 15px var(--f-display); color: #B9AF99; }
.sc-stamp {
  width: 92%; height: 92%; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--beni); color: var(--washi);
  font: 800 clamp(16px, 3.4vw, 22px)/1 var(--f-display);
  box-shadow: inset 0 0 0 2.5px var(--beni), inset 0 0 0 4px rgba(251,246,236,.7);
  transform: rotate(var(--r, 0deg));
  animation: stamp-in .35s cubic-bezier(.2, 1.6, .4, 1) both;
}
.sc-stamp-kin { background: var(--kin); box-shadow: inset 0 0 0 2.5px var(--kin), inset 0 0 0 4px rgba(251,246,236,.7); font-size: clamp(12px, 2.4vw, 15px); }
.sc-gift { border-color: var(--kin); border-style: solid; background: #FBF1DA; }
.sc-gift.is-on { background: none; }
.sc-gift-label { display: grid; justify-items: center; line-height: 1.05; }
.sc-gift-label b { font: 800 clamp(13px, 2.6vw, 16px) var(--f-display); color: #9A7524; }
.sc-gift-label small { font-size: 9.5px; font-weight: 700; letter-spacing: .04em; color: #9A7524; text-transform: uppercase; }
.sc-grid li:nth-child(n) .sc-stamp { animation-delay: calc(var(--i, 0) * 40ms); }
@keyframes stamp-in { from { transform: rotate(var(--r, 0deg)) scale(1.6); opacity: 0; } to { transform: rotate(var(--r, 0deg)) scale(1); opacity: 1; } }
.sc-status { margin-top: 18px; text-align: center; font-size: 15px; color: var(--ink-soft); }
.sc-status b { color: var(--matcha-deep); }
.is-full .sc-status b { color: #8A6418; }
.sc-pending { text-align: center; font-size: 13.5px; color: var(--sakura-deep); margin-top: 4px; }

/* mini dots (checkout / confirmation) */
.sc-dots { display: inline-flex; gap: 4px; flex-wrap: wrap; flex: none; }
.sc-dots i { width: 13px; height: 13px; border-radius: 50%; border: 1.5px dashed #C8BEA6; }
.sc-dots i.on { background: var(--beni); border: 1.5px solid var(--beni); }
.sc-dots i.add { background: var(--sakura); border: 1.5px solid var(--sakura-deep); }
.stamp-note { background: var(--card); border: 2px solid var(--ink); border-radius: 16px; padding: 12px 14px; display: grid; gap: 10px; }
.stamp-note-row { display: grid; gap: 8px; font-size: 14.5px; }
.stamp-note-row .sc-dots { max-width: 170px; }
.reward-toggle { display: flex; gap: 10px; align-items: center; background: #FBF1DA; border: 2px solid var(--kin); border-radius: 12px; padding: 10px 12px; cursor: pointer; font-size: 15px; }
.reward-toggle input { width: 20px; height: 20px; accent-color: var(--matcha-deep); flex: none; }
.reward-toggle em { font-style: normal; font-weight: 700; color: var(--beni); white-space: nowrap; }
.sum-reward { color: var(--beni); font-weight: 700; }
.done-reward { color: var(--beni); font-weight: 700; }
.done-stamps { display: grid; justify-items: center; gap: 6px; background: var(--card); border: 2px dashed var(--line); border-radius: 14px; padding: 10px 14px; width: 100%; font-size: 14.5px; }

@media (max-width: 960px) {
  .stamps-grid { grid-template-columns: minmax(0, 1fr); gap: 34px; }
}
@media (max-width: 720px) {
  .stampcard { padding: 18px 16px 16px; transform: none; box-shadow: 5px 5px 0 var(--matcha-deep); }
  .sc-grid { gap: 8px; }
  .stamp-lookup { flex-direction: column; }
  .stamp-lookup .btn { justify-content: center; }
}

/* confirmation */
.done { padding: 22px 24px calc(30px + env(safe-area-inset-bottom)); text-align: center; display: grid; gap: 12px; justify-items: center; }
.done img { width: 180px; }
.done-kicker { color: var(--sakura-deep); font-size: 22px; }
.done-code { font-family: var(--f-display); font-weight: 800; font-size: 40px; letter-spacing: .08em; color: var(--matcha-deep); background: var(--card); border: 2px dashed var(--matcha); border-radius: 16px; padding: 4px 18px; }
.done .paybox { text-align: left; width: 100%; }

/* ---------- phones ---------- */
@media (max-width: 720px) {
  .hide-sm { display: none; }
  .header-order { display: none; }
  .bag-btn { width: 44px; height: 44px; }
  .bagbar { display: flex; }
  .bagbar[hidden] { display: none; }
  body.has-bagbar .site-footer { padding-bottom: 84px; }

  .sheet {
    width: 100%; max-width: 100%; margin: auto 0 0; max-height: 92dvh;
    border-radius: 26px 26px 0 0; border-width: 2px 0 0; box-shadow: none;
  }
  .sheet[open] { animation: up .25s ease; }
  .sheet-inner { padding: 18px 16px calc(14px + env(safe-area-inset-bottom)); }
  .sheet-inner::before { content: ""; width: 44px; height: 5px; border-radius: 9px; background: var(--line); justify-self: center; margin: -6px 0 -6px; }
  .sheet-head { grid-template-columns: 76px 1fr auto; }
  .sheet-photo { width: 76px; height: 76px; }
  .sheet h2 { font-size: 21px; }
  .sheet-foot { bottom: calc(-14px - env(safe-area-inset-bottom)); padding-bottom: calc(10px + env(safe-area-inset-bottom)); }

  .drawer { width: 100%; height: 94dvh; max-height: 94dvh; margin: auto 0 0; border-left: 0; border-top: 2px solid var(--ink); border-radius: 26px 26px 0 0; }
  .drawer[open] { animation: up .28s ease; }
  .drawer-head { padding: 14px 16px; }
  .lines { padding: 4px 16px; }
  .checkout { padding-inline: 16px; }
  .drawer-foot { padding-inline: 16px; }
  .done-code { font-size: 34px; }
}
@keyframes up { from { transform: translateY(60px); opacity: .4; } to { transform: none; opacity: 1; } }
