/* 預設主題：白瓷清湯（預設）／夜市暖燈；元件共用同一組色彩角色。 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;500;600;700;900&display=swap');

:root, :root[data-theme="light"] {
  color-scheme: light;
  --paper: #F2F5F6;
  --paper-2: #E7ECEE;
  --paper-3: #DAE1E5;
  --white: #FCFDFD;
  --ink: #1D2830;
  --ink-2: #45535D;
  --ink-3: #7C8993;
  --hair: #D3DBE0;
  --red: #E4572E;
  --red-2: #C8461F;
  --red-wash: #FBE4DB;
  --on-red: #FFFFFF;
  --green: #17906A;
  --green-wash: #D4EFE5;
  --warn: #B7791F;
  --warn-wash: #FBF0D9;
  --linepay: #05A647;
  --scrim: rgba(29,40,48,.45);
  --soldout-veil: rgba(242,245,246,.7);
  --shadow-sm: 0 1px 2px rgba(28, 28, 28, .08);
  --shadow-md: 0 6px 20px rgba(28, 28, 28, .14);
  --on-green: #FFFFFF;
  --primary-bg: var(--ink);
  --primary-text: var(--paper);
  --primary-hover: var(--ink-2);

  --sans: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --serif: var(--sans);
  --r: 10px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --fast: 120ms; --normal: 220ms;
  --ease: cubic-bezier(.25, .46, .45, .94);
  --touch: 56px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #16120F;
  --paper-2: #211B16;
  --paper-3: #2D251F;
  --white: #251E19;
  --ink: #F4ECE2;
  --ink-2: #D2C4B4;
  --ink-3: #958777;
  --hair: #3B3129;
  --red: #FF8A3D;
  --red-2: #F07428;
  --red-wash: #3B2517;
  --on-red: #1A120B;
  --green: #6CC27A;
  --green-wash: #1C3222;
  --warn: #E3B04B;
  --warn-wash: #3A2E14;
  --linepay: #06C755;
  --scrim: rgba(0,0,0,.6);
  --soldout-veil: rgba(22,18,15,.7);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 8px 22px rgba(0,0,0,.45);
  --on-green: #1A120B;
  --primary-bg: var(--red);
  --primary-text: var(--on-red);
  --primary-hover: var(--red-2);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.45;
  overflow-x: hidden; -webkit-font-smoothing: antialiased; user-select: none;
}
input, textarea, button, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--hair); background: var(--white); border-radius: var(--r); min-height: var(--touch); padding: 0 var(--s4); transition: background var(--fast) var(--ease), transform var(--fast) var(--ease), border-color var(--fast); }
button:hover { background: var(--paper-2); }
button:active { transform: scale(.97); background: var(--paper-3); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.primary { background: var(--primary-bg); color: var(--primary-text); border-color: var(--primary-bg); font-weight: 700; }
button.primary:hover { background: var(--primary-hover); }
button.red { background: var(--red); color: var(--on-red); border-color: var(--red); font-weight: 700; }
button.red:hover { background: var(--red-2); }
button.green { background: var(--green); color: var(--on-green); border-color: var(--green); font-weight: 700; }
button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover { background: var(--paper-2); }
button.sm { min-height: 40px; padding: 0 var(--s3); font-size: 14px; }

.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.serif { font-family: var(--serif); }
.muted { color: var(--ink-3); }
.hair-t { border-top: 1px solid var(--hair); }
.hair-b { border-bottom: 1px solid var(--hair); }


/* LOGO（去白底透明 PNG） */
.logo { display: block; height: 40px; width: auto; }
.logo.lg { height: 120px; margin: 0 auto; }

/* FoodYang 匯瀚科技落款 */
/* 系統落款：FoodYang 標誌（不放電話）；亮色用深藍字版、深色用米白字版 */
.sig { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; text-decoration: none; opacity: .88; transition: opacity var(--fast) var(--ease); }
a.sig:hover, a.sig:focus-visible { opacity: 1; }
.sig-by { font-family: var(--sans); font-size: 10px; font-weight: 600; letter-spacing: .22em; color: var(--ink-3); line-height: 1; }
.sig-mark { display: block; height: 22px; width: auto; }
.sig-cream { display: none; }
:root[data-theme="dark"] .sig-ink { display: none; }
:root[data-theme="dark"] .sig-cream { display: block; }

/* 取餐號印章框：品牌記憶錨點 */
.stamp { display: inline-block; border: 3px solid var(--red); color: var(--ink); font-family: var(--sans); font-weight: 900; line-height: 1; padding: .1em .25em; border-radius: var(--r); letter-spacing: .02em; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--paper); padding: var(--s3) var(--s5); border-radius: var(--r); box-shadow: var(--shadow-md); opacity: 0; transition: opacity var(--normal) var(--ease), transform var(--normal) var(--ease); z-index: 1000; pointer-events: none; width: max-content; max-width: min(90vw, 640px); text-align: center; text-wrap: balance; }
.toast.in { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); color: var(--on-red); }
.toast.ok { background: var(--green); color: var(--on-green); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: var(--scrim); display: none; align-items: center; justify-content: center; z-index: 500; padding: var(--s4); }
.modal-bg.open { display: flex; }
.modal { background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow-md); width: min(720px, 100%); display: flex; flex-direction: column; max-height: 94vh; max-height: 94dvh; overflow: hidden; border: 1px solid var(--hair); }
.modal > header, .modal > footer { flex: 0 0 auto; }
.modal > header [data-close] { min-width: 44px; min-height: 44px; }
.modal > .body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
/* 保留表單的送出語意，讓表單內的底列也固定、只有內容捲動。 */
.modal > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.modal > form > .body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.modal > form > footer { flex: 0 0 auto; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: var(--s4) var(--s5); border-bottom: 1px solid var(--hair); }
.modal header h3 { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 20px; }
.modal .body { padding: var(--s5); }
.modal footer { display: flex; gap: var(--s3); padding: var(--s4) var(--s5); border-top: 1px solid var(--hair); justify-content: flex-end; }

.reveal { opacity: 0; transform: translateY(12px); animation: fadeUp .4s var(--ease) forwards; }
@keyframes fadeUp { to { opacity: 1; transform: none; } }

/* SS-W14：共用確認／輸入視窗；既有色票與 modal 規則保留。 */
.ui-dialog-bg { position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; background: var(--scrim); overscroll-behavior: contain; }
.ui-dialog-bg[hidden] { display: none; }
.ui-dialog { width: min(92vw, 440px); max-height: 92vh; max-height: 92dvh; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--hair); border-radius: var(--r); background: var(--paper); color: var(--ink); animation: ui-dialog-in var(--fast) var(--ease); }
.ui-dialog-header, .ui-dialog-footer { flex: 0 0 auto; padding: var(--s4); }
.ui-dialog-header { border-bottom: 1px solid var(--hair); }
.ui-dialog-title-only .ui-dialog-header { border-bottom: 0; }
.ui-dialog-body[hidden] { display: none; }
.ui-dialog-title { margin: 0; font-family: var(--serif); font-size: 20px; font-weight: 700; overflow-wrap: anywhere; }
.ui-dialog-body { flex: 1 1 auto; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: var(--s4); }
.ui-dialog-message { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.ui-dialog-label { display: block; margin-bottom: var(--s2); }
.ui-dialog-input { width: 100%; min-height: 56px; padding: var(--s3); border: 1px solid var(--hair); border-radius: var(--r); background: var(--white); color: var(--ink); font-size: 18px; }
.ui-dialog-error { margin: var(--s2) 0 0; color: var(--red); }
.ui-dialog-footer { display: flex; gap: var(--s3); border-top: 1px solid var(--hair); }
.ui-dialog-footer button { flex: 1 1 0; min-width: 0; min-height: 56px; padding: 0 var(--s2); font-size: 18px; white-space: nowrap; }
.ui-dialog .ui-dialog-cancel { background: var(--paper); color: var(--ink); }
.ui-dialog .ui-dialog-cancel:hover { background: var(--paper-2); color: var(--ink); }
.ui-dialog .ui-dialog-cancel:active { background: var(--paper-3); color: var(--ink); }
.ui-dialog .ui-dialog-ok { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 700; }
.ui-dialog .ui-dialog-ok:hover { background: var(--ink-2); color: var(--paper); }
.ui-dialog .ui-dialog-ok:active { background: var(--ink-2); color: var(--paper); }
.ui-dialog .ui-dialog-ok.ui-dialog-danger { background: var(--red-2); color: var(--on-red); border-color: var(--red-2); }
.ui-dialog .ui-dialog-ok.ui-dialog-danger:hover { background: var(--red-2); color: var(--on-red); box-shadow: inset 0 0 0 100vmax rgba(0,0,0,.10); }
.ui-dialog .ui-dialog-ok.ui-dialog-danger:active { background: var(--red-2); color: var(--on-red); box-shadow: inset 0 0 0 100vmax rgba(0,0,0,.18); }
:root[data-theme="dark"] .ui-dialog .ui-dialog-ok.ui-dialog-danger:hover { box-shadow: inset 0 0 0 100vmax rgba(255,255,255,.12); }
:root[data-theme="dark"] .ui-dialog .ui-dialog-ok.ui-dialog-danger:active { box-shadow: inset 0 0 0 100vmax rgba(255,255,255,.20); }
.toast.over-dialog { top: calc(12px + env(safe-area-inset-top)); bottom: auto; transform: translateX(-50%) translateY(-20px); }
.toast.over-dialog.in { transform: translateX(-50%) translateY(0); }
.ui-dialog button:focus-visible, .ui-dialog-input:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@keyframes ui-dialog-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .ui-dialog { animation: none; } .ui-dialog button { transition: none; } }
