@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@500;600;700&family=Noto+Sans+TC:wght@400;500;600;700;800&display=swap');

:root {
  --accent: #ff5a45;
  --accent-dark: #e74533;
  --accent-soft: #fff0ed;
  --ink: #211d1b;
  --muted: #766f6a;
  --line: #eee8e3;
  --paper: #fff;
  --canvas: #f4f0ec;
  --success: #15966f;
  --warning: #dc8a14;
  --danger: #d94a42;
  --shadow: 0 14px 40px rgba(68, 46, 34, .09);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

:root[data-theme="classic"] {
  --accent: #f5bd2d;
  --accent-dark: #d99a00;
  --accent-soft: #fff8dd;
  --ink: #161513;
  --canvas: #f5f3eb;
}

* { box-sizing: border-box; }

html { background: var(--canvas); color: var(--ink); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans TC", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 1.35em; height: 1.35em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

#app { min-height: 100vh; }

.app-shell {
  position: relative;
  width: min(100%, 600px);
  min-height: 100vh;
  margin: 0 auto;
  overflow: clip;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.boot-screen, .state-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--muted);
}

.state-screen { min-height: 62vh; padding: 40px 28px; text-align: center; }
.state-screen h2, .state-screen p { margin: 0; }
.state-screen h2 { font-size: 22px; color: var(--ink); }
.state-screen p { max-width: 360px; line-height: 1.8; }
.state-icon { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-dark); font-size: 28px; }

.loader {
  width: 30px;
  height: 30px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.button-loader { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: currentColor; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.store-header {
  position: relative;
  display: grid;
  grid-template-columns: 68px 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: 124px;
  padding: 24px 22px 20px;
  background:
    radial-gradient(circle at 94% 0, color-mix(in srgb, var(--accent) 20%, transparent) 0 24%, transparent 25%),
    linear-gradient(145deg, #fff 0%, color-mix(in srgb, var(--accent-soft) 55%, #fff) 100%);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 16%, var(--line));
}

.brand-mark { width: 68px; height: 68px; display: grid; place-items: center; overflow: hidden; border: 1px solid rgba(0,0,0,.04); border-radius: 21px; background: var(--ink); box-shadow: 0 10px 24px rgba(53,34,25,.14); }
.brand-mark::after { content: "點"; position: absolute; color: #fff; font-size: 22px; font-weight: 800; }
.brand-mark img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; }
.store-copy { min-width: 0; }
.store-copy .eyebrow, .section-title span, .section-heading span, .sheet-intro > small, .payment-hero > small, .status-card > small {
  display: block;
  margin-bottom: 5px;
  color: var(--accent-dark);
  font: 700 10px/1 "DM Sans", sans-serif;
  letter-spacing: 1.8px;
}
.store-copy h1 { margin: 0 0 5px; overflow: hidden; font-size: 21px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.store-copy p { margin: 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.demo-badge { align-self: start; padding: 5px 8px; border: 1px solid color-mix(in srgb, var(--accent) 36%, transparent); border-radius: 99px; background: rgba(255,255,255,.65); color: var(--accent-dark); font-size: 10px; font-weight: 700; }

.sub-header { position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; min-height: 64px; padding: 8px 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); backdrop-filter: blur(16px); }
.sub-header h1 { margin: 0; font-size: 18px; text-align: center; }
.icon-button { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: #f7f4f1; }

.notice { display: flex; align-items: flex-start; gap: 10px; margin: 16px 20px 0; padding: 11px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--muted); font-size: 12px; line-height: 1.6; }
.notice span { flex: none; margin-top: 1px; padding: 2px 7px; border-radius: 99px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; }

.category-nav { position: sticky; top: 0; z-index: 15; display: flex; gap: 8px; overflow-x: auto; padding: 16px 20px 12px; background: rgba(255,255,255,.94); scrollbar-width: none; backdrop-filter: blur(14px); }
.category-nav::-webkit-scrollbar { display: none; }
.category-pill { flex: none; padding: 9px 15px; border: 1px solid var(--line); border-radius: 99px; background: #fff; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; transition: .2s ease; }
.category-pill.is-active { border-color: var(--ink); background: var(--ink); color: #fff; box-shadow: 0 7px 16px rgba(33,29,27,.16); }

.menu-section, .content-section { padding: 12px 20px 112px; }
.section-title, .section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 5px 0 18px; }
.section-title h2, .section-heading h2 { margin: 0; font-size: 24px; letter-spacing: -.5px; }
.section-title > small, .section-heading > small { padding-bottom: 3px; color: #a49d98; font: 600 10px/1 "DM Sans", sans-serif; letter-spacing: 1px; }
.section-heading.compact { align-items: center; margin: 0 0 18px; }
.section-heading.compact h2 { font-size: 19px; }

.menu-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.menu-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #fff; box-shadow: 0 7px 22px rgba(46,34,28,.055); cursor: pointer; transition: transform .18s ease, box-shadow .18s ease; }
.menu-card:active { transform: scale(.98); }
.menu-card > img, .food-placeholder { width: 100%; aspect-ratio: 1.32; display: grid; place-items: center; object-fit: cover; background: linear-gradient(145deg, var(--accent-soft), #f4eee8); color: var(--accent-dark); font-size: 30px; font-weight: 800; }
.menu-card__body { min-height: 148px; display: flex; flex-direction: column; justify-content: space-between; gap: 12px; padding: 13px; }
.menu-card h3 { margin: 0 0 6px; font-size: 15px; line-height: 1.4; }
.menu-card p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.menu-card__foot { display: flex; align-items: center; justify-content: space-between; }
.menu-card__foot strong { font: 700 16px/1 "DM Sans", "Noto Sans TC", sans-serif; }
.add-button { width: 30px; height: 30px; border: 0; border-radius: 50%; background: var(--accent); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }

.cart-dock { position: fixed; z-index: 20; bottom: calc(14px + var(--safe-bottom)); left: 50%; width: min(calc(100% - 28px), 568px); min-height: 66px; display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 12px; padding: 9px 18px 9px 11px; transform: translateX(-50%); border: 0; border-radius: 20px; background: var(--ink); color: #fff; box-shadow: 0 18px 35px rgba(24,19,17,.25); text-align: left; cursor: pointer; }
.cart-dock__icon { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: var(--accent); font-size: 20px; }
.cart-dock__icon b { position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 4px; display: grid; place-items: center; border: 2px solid var(--ink); border-radius: 99px; background: #fff; color: var(--ink); font-size: 9px; }
.cart-dock small, .checkout-dock small { display: block; margin-bottom: 3px; color: #aaa29e; font: 600 9px/1 "DM Sans", sans-serif; letter-spacing: 1.5px; }
.cart-dock strong { font-size: 13px; }
.cart-dock__price { font: 700 17px/1 "DM Sans", sans-serif; }

.product-dialog { width: min(100%, 600px); max-width: none; max-height: 92dvh; margin: auto auto 0; padding: 0; overflow: hidden; border: 0; border-radius: 26px 26px 0 0; background: #fff; color: var(--ink); box-shadow: 0 -20px 60px rgba(0,0,0,.18); }
.product-dialog::backdrop { background: rgba(25,20,18,.52); backdrop-filter: blur(2px); }
.product-sheet { position: relative; max-height: 92dvh; overflow-y: auto; padding-bottom: 112px; }
.sheet-close { position: absolute; z-index: 2; top: 15px; right: 15px; width: 38px; height: 38px; border: 0; border-radius: 50%; background: rgba(255,255,255,.9); box-shadow: 0 5px 15px rgba(0,0,0,.1); font-size: 25px; line-height: 1; }
.sheet-image { width: 100%; max-height: 250px; display: block; object-fit: cover; }
.sheet-intro { padding: 24px 22px 18px; border-bottom: 1px solid var(--line); }
.sheet-intro h2 { margin: 0 0 8px; font-size: 23px; }
.sheet-intro p { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.sheet-intro strong { color: var(--accent-dark); font: 700 19px/1 "DM Sans", sans-serif; }
.option-groups { padding: 0 22px; }
.option-groups fieldset { margin: 0; padding: 22px 0 8px; border: 0; border-bottom: 1px solid var(--line); }
.option-groups legend { width: 100%; display: flex; justify-content: space-between; padding: 0 0 10px; font-size: 15px; font-weight: 700; }
.option-groups legend small { color: var(--muted); font-size: 11px; font-weight: 500; }
.option-row { display: flex; align-items: center; justify-content: space-between; min-height: 54px; cursor: pointer; }
.option-row > span { display: flex; flex-direction: column; gap: 2px; }
.option-row b { font-size: 14px; font-weight: 600; }
.option-row small { color: var(--muted); font-size: 11px; }
.option-row input { position: absolute; opacity: 0; pointer-events: none; }
.option-row i { width: 23px; height: 23px; display: grid; place-items: center; border: 1.5px solid #cfc7c2; border-radius: 7px; transition: .15s; }
.option-row input:checked + i { border-color: var(--accent); background: var(--accent); }
.option-row input:checked + i::after { content: ""; width: 8px; height: 4px; transform: translateY(-1px) rotate(-45deg); border-bottom: 2px solid #fff; border-left: 2px solid #fff; }
.sheet-footer { position: fixed; z-index: 3; bottom: 0; left: 50%; width: min(100%, 600px); display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 14px 18px calc(14px + var(--safe-bottom)); transform: translateX(-50%); border-top: 1px solid var(--line); background: rgba(255,255,255,.95); backdrop-filter: blur(14px); }

.stepper { display: inline-grid; grid-template-columns: 34px 34px 34px; align-items: center; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.stepper button { width: 34px; height: 38px; padding: 0; border: 0; background: transparent; font-size: 18px; cursor: pointer; }
.stepper span { text-align: center; font: 700 14px/1 "DM Sans", sans-serif; }

.button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 20px; border: 0; border-radius: 13px; font-size: 14px; font-weight: 700; cursor: pointer; }
.button--primary { background: var(--accent); color: #fff; box-shadow: 0 9px 20px color-mix(in srgb, var(--accent) 24%, transparent); }
:root[data-theme="classic"] .button--primary, :root[data-theme="classic"] .add-button { color: var(--ink); }
.button--ghost { border: 1px solid var(--line); background: #fff; color: var(--ink); }
.button:disabled { opacity: .6; cursor: wait; }
.add-order { min-width: 0; justify-content: space-between; }
.add-order strong { font: 700 14px/1 "DM Sans", sans-serif; }
.full-button { width: 100%; }

.content-section { padding-top: 24px; }
.page-with-dock .content-section { padding-bottom: 128px; }
.text-button { display: inline-flex; align-items: center; gap: 5px; padding: 5px; border: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.text-button svg { width: 16px; }
.text-button.danger { color: var(--danger); }
.cart-list { display: grid; gap: 10px; }
.cart-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.cart-row h3 { margin: 0 0 7px; font-size: 14px; line-height: 1.55; }
.cart-row strong { color: var(--accent-dark); font: 700 14px/1 "DM Sans", sans-serif; }
.summary-card { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 22px; padding: 18px; border-radius: 15px; background: #f8f5f2; font-size: 13px; }
.summary-card strong { font: 700 18px/1 "DM Sans", sans-serif; }
.info-card, .receipt-card, .progress-card { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.field { display: grid; gap: 8px; margin-top: 15px; }
.field > span { font-size: 12px; font-weight: 600; }
.field > span b { margin-left: 4px; color: var(--danger); font-size: 10px; }
.field > span small { margin-left: 4px; color: #aaa29e; }
.field input, .field textarea { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: #faf8f6; color: var(--ink); font-size: 14px; transition: .15s; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px var(--accent-soft); }
.shop-reminder { display: grid; gap: 4px; margin: 16px 0 0; padding: 12px 13px; border-radius: 11px; background: var(--accent-soft); color: var(--muted); font-size: 11px; line-height: 1.6; }
.shop-reminder b { color: var(--accent-dark); }

.checkout-dock { position: fixed; z-index: 19; bottom: 0; left: 50%; width: min(100%, 600px); min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 18px calc(12px + var(--safe-bottom)); transform: translateX(-50%); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(16px); }
.checkout-dock > div { flex: none; }
.checkout-dock > div strong { display: block; font: 700 21px/1 "DM Sans", sans-serif; }
.checkout-dock .button { min-width: 185px; }
.checkout-dock .button svg { transform: rotate(180deg); }

.empty-cart { min-height: 60vh; display: grid; place-content: center; justify-items: center; text-align: center; }
.empty-cart > span { width: 78px; height: 78px; display: grid; place-items: center; border-radius: 24px; background: var(--accent-soft); color: var(--accent-dark); font-size: 34px; }
.empty-cart h2 { margin: 20px 0 6px; font-size: 21px; }
.empty-cart p { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.empty-inline { grid-column: 1 / -1; padding: 36px 16px; color: var(--muted); text-align: center; font-size: 13px; }

.payment-hero { display: grid; justify-items: center; padding: 30px 20px 28px; text-align: center; }
.payment-hero > span { width: 72px; height: 72px; display: grid; place-items: center; margin-bottom: 17px; border-radius: 24px; background: var(--accent-soft); color: var(--accent-dark); font-size: 31px; }
.payment-hero h2 { margin: 3px 0 5px; font-size: 24px; }
.payment-hero p { margin: 0; color: var(--muted); font-size: 12px; }
.receipt-card { margin-bottom: 16px; }
.receipt-list { display: grid; gap: 0; }
.receipt-list > div { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.receipt-list span { display: grid; gap: 4px; }
.receipt-list b { font-size: 13px; font-weight: 600; line-height: 1.55; }
.receipt-list small { color: var(--muted); font-size: 10px; }
.receipt-list strong { flex: none; font: 700 13px/1 "DM Sans", sans-serif; }
.receipt-total { display: flex; align-items: center; justify-content: space-between; padding-top: 17px; font-size: 13px; }
.receipt-total strong { color: var(--accent-dark); font: 700 19px/1 "DM Sans", sans-serif; }
.payment-options { display: grid; gap: 11px; margin-top: 22px; }
.payment-options > button { display: grid; grid-template-columns: 46px 1fr 20px; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: #fff; text-align: left; cursor: pointer; }
.payment-options > button > span:nth-child(2) { display: grid; gap: 4px; }
.payment-options b { font-size: 14px; }
.payment-options small { color: var(--muted); font-size: 10px; }
.payment-option__icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--accent-soft); color: var(--accent-dark); font-size: 20px; }
.payment-options > button > svg { width: 17px; transform: rotate(180deg); color: #bdb5b0; }

.result-wrap { min-height: 100vh; display: grid; gap: 14px; padding: 22px 18px 36px; background: #f8f5f2; }
.status-card { position: relative; overflow: hidden; display: grid; justify-items: center; padding: 34px 24px 30px; border: 1px solid var(--line); border-radius: 24px; background: #fff; text-align: center; }
.status-card::after { content: ""; position: absolute; top: -100px; right: -80px; width: 220px; height: 220px; border-radius: 50%; background: currentColor; opacity: .055; }
.status-icon { width: 68px; height: 68px; display: grid; place-items: center; margin: 11px 0 18px; border-radius: 22px; background: color-mix(in srgb, currentColor 12%, #fff); font-size: 31px; }
.status-card p { margin: 0 0 3px; color: var(--muted); font-size: 11px; }
.status-card h1 { margin: 0 0 14px; color: var(--ink); font: 700 27px/1.2 "DM Sans", sans-serif; }
.status-card.tone-success { color: var(--success); }
.status-card.tone-info { color: #367dc4; }
.status-card.tone-warning { color: var(--warning); }
.status-card.tone-danger { color: var(--danger); }
.status-chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 99px; background: color-mix(in srgb, currentColor 10%, #fff); font-size: 12px; font-weight: 700; }
.status-chip i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.wait-info { margin-top: 12px; color: var(--danger); font-size: 12px; }
.progress-card { margin: 0; }
.timeline { display: grid; }
.timeline-row { position: relative; display: grid; grid-template-columns: 22px 1fr; gap: 11px; min-height: 65px; color: #bbb4af; }
.timeline-row:not(:last-child)::after { content: ""; position: absolute; top: 18px; left: 6px; width: 2px; height: 43px; background: #e8e2de; }
.timeline-row > i { position: relative; z-index: 1; width: 14px; height: 14px; margin-top: 2px; border: 3px solid #eee9e5; border-radius: 50%; background: #cfc8c3; }
.timeline-row > span { display: grid; align-content: start; gap: 4px; }
.timeline-row b { font-size: 13px; }
.timeline-row small { font-size: 10px; }
.timeline-row.is-active { color: var(--ink); }
.timeline-row.is-active > i { border-color: var(--accent-soft); background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.timeline-row.is-active:not(:last-child)::after { background: color-mix(in srgb, var(--accent) 40%, #e8e2de); }
.timeline-row.is-current b { color: var(--accent-dark); }
.result-wrap .receipt-card, .result-wrap .progress-card { box-shadow: none; }
.payment-detail dl { display: grid; gap: 0; margin: 0; }
.payment-detail dl > div { display: flex; justify-content: space-between; gap: 20px; padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: 12px; }
.payment-detail dl > div:last-child { border-bottom: 0; }
.payment-detail dt { color: var(--muted); }
.payment-detail dd { margin: 0; font-weight: 600; text-align: right; }

.toast-region { position: fixed; z-index: 9999; top: 16px; left: 50%; width: min(calc(100% - 32px), 480px); display: grid; gap: 8px; transform: translateX(-50%); pointer-events: none; }
.toast { padding: 12px 16px; transform: translateY(-12px); border: 1px solid rgba(255,255,255,.15); border-radius: 13px; background: rgba(33,29,27,.94); color: #fff; box-shadow: 0 12px 30px rgba(0,0,0,.18); font-size: 12px; opacity: 0; backdrop-filter: blur(12px); transition: .22s ease; }
.toast.is-visible { transform: translateY(0); opacity: 1; }
.toast--success { background: rgba(21,128,95,.95); }
.toast--error { background: rgba(187,56,49,.96); }

@media (min-width: 601px) {
  body { padding: 22px 0; }
  .app-shell { min-height: calc(100vh - 44px); border-radius: 26px; }
  .cart-dock { bottom: 34px; }
  .checkout-dock, .sheet-footer { bottom: 22px; border-radius: 0 0 26px 26px; }
  .product-dialog { margin-bottom: 22px; border-radius: 26px; }
  .result-wrap { min-height: calc(100vh - 44px); }
}

@media (max-width: 390px) {
  .store-header { grid-template-columns: 58px 1fr auto; gap: 12px; padding-inline: 16px; }
  .brand-mark { width: 58px; height: 58px; border-radius: 18px; }
  .menu-section, .content-section { padding-inline: 15px; }
  .category-nav { padding-inline: 15px; }
  .menu-grid { gap: 10px; }
  .menu-card__body { min-height: 143px; padding: 11px; }
  .checkout-dock .button { min-width: 160px; }
}

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