:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-soft: #f9fafb;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #285c6d;
  --primary-strong: #174557;
  --primary-soft: #e7f0f3;
  --accent: #e98f24;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --radius: 18px;
  --shadow: 0 16px 42px rgba(15, 23, 42, 0.09);
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(40, 92, 109, 0.12), transparent 32rem),
    var(--bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

code {
  padding: 0.1rem 0.35rem;
  border-radius: 0.45rem;
  background: #eef2f7;
  color: #334155;
}

.page-shell {
  min-height: 100vh;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.site-header__content {
  width: min(1280px, calc(100% - 28px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand__mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary-strong), var(--primary));
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(23, 69, 87, 0.22);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  line-height: 1.1;
}

.brand small {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.header-link {
  color: var(--primary-strong);
  text-decoration: none;
  font-weight: 800;
}

.home-layout,
.store-layout,
.not-found {
  width: min(1280px, calc(100% - 28px));
  margin: 0 auto;
}

.home-layout {
  padding: 1.5rem 0 3rem;
  display: grid;
  gap: 1.2rem;
}

.hero-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: clamp(1.2rem, 4vw, 2.4rem);
}

.hero-card h1,
.store-hero h1 {
  margin: 0;
  line-height: 1.1;
  font-size: clamp(2rem, 5vw, 3.5rem);
}

.hero-card p,
.store-hero p,
.panel__header p {
  color: var(--muted);
  line-height: 1.65;
}

.eyebrow {
  margin: 0 0 0.55rem;
  color: var(--accent);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel__header {
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.panel__header--split {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.panel__header h2 {
  margin: 0;
}

.panel__header p {
  margin: 0.35rem 0 0;
}

.store-grid {
  padding: 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.store-card {
  display: flex;
  flex-direction: column;
  min-height: 178px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  text-decoration: none;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.store-card:hover {
  transform: translateY(-2px);
  border-color: rgba(40, 92, 109, 0.35);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.store-card__mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: var(--primary);
  font-weight: 900;
}

.store-card h3 {
  margin: 0.9rem 0 0.3rem;
  font-size: 1.2rem;
}

.store-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.store-card__footer {
  margin-top: auto;
  padding-top: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--primary-strong);
  font-weight: 800;
}

.store-layout {
  padding: 1.5rem 0 3rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 1rem;
  align-items: start;
}

.store-main {
  display: grid;
  gap: 1rem;
}

.store-hero {
  padding: clamp(1rem, 3vw, 2rem);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.store-meta {
  flex: 0 0 auto;
  padding: 0.55rem 0.75rem;
  border-radius: 999px;
  color: var(--primary-strong);
  background: var(--primary-soft);
  font-weight: 800;
}

.menu-panel {
  overflow: hidden;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
}

.input,
.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.72rem 0.85rem;
  outline: none;
  color: var(--text);
  background: #fff;
}

.textarea {
  resize: vertical;
  min-height: 120px;
}

.input:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(40, 92, 109, 0.12);
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  min-height: 42px;
  padding: 0.68rem 0.9rem;
  border: 1px solid transparent;
  border-radius: 14px;
  text-decoration: none;
  font-weight: 900;
  white-space: nowrap;
}

.button--sm {
  min-height: 34px;
  padding: 0.45rem 0.7rem;
  border-radius: 11px;
}

.button--primary {
  color: #fff;
  background: var(--primary);
}

.button--primary:hover {
  background: var(--primary-strong);
}

.button--secondary {
  color: var(--primary-strong);
  background: var(--primary-soft);
}

.button--ghost {
  color: var(--primary-strong);
  border-color: var(--line);
  background: #fff;
}

.button--danger {
  color: var(--danger);
  border-color: #fecaca;
  background: var(--danger-soft);
}

.category-tabs {
  margin-top: 0.85rem;
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.category-button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.52rem 0.78rem;
  color: var(--muted);
  background: #fff;
  font-weight: 800;
}

.category-button.is-active {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

.quick-input {
  padding: 1rem;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.quick-input h2 {
  margin: 0;
}

.quick-input p {
  margin: 0.35rem 0 0.7rem;
  color: var(--muted);
}

.quick-input__actions {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.message {
  margin-top: 0.65rem;
  color: var(--muted);
  line-height: 1.55;
}

.message.is-error {
  color: var(--danger);
}

.message.is-ok {
  color: var(--primary-strong);
}

.menu-list {
  padding: 1rem;
  display: grid;
  gap: 1.25rem;
}

.category-section {
  display: grid;
  gap: 0.75rem;
}

.category-section__header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.category-section__header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.category-section__header span {
  color: var(--muted);
  font-weight: 700;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.item-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.8rem;
  min-height: 112px;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.item-card h3 {
  margin: 0;
  font-size: 1.02rem;
}

.item-card p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.item-card__price {
  display: grid;
  justify-items: end;
  gap: 0.55rem;
}

.item-card__price strong {
  font-size: 1.15rem;
}

.add-button {
  border: 0;
  border-radius: 999px;
  min-width: 46px;
  min-height: 38px;
  color: #fff;
  background: var(--primary);
  font-weight: 900;
}

.order-panel {
  position: sticky;
  top: 88px;
  overflow: hidden;
}

.order-mode {
  padding: 1rem 1rem 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.mode-button {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 0.65rem;
  color: var(--muted);
  background: #fff;
  font-weight: 900;
}

.mode-button.is-active {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

.field {
  padding: 1rem 1rem 0;
  display: grid;
  gap: 0.45rem;
}

.field span {
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.field--modal-note {
  padding: 0 1rem 1rem;
}

.cart-list {
  padding: 1rem;
  display: grid;
  gap: 0.7rem;
  max-height: calc(100vh - 410px);
  overflow: auto;
}

.empty-state {
  margin: 0;
  padding: 1.2rem;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.cart-item {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
}

.cart-item__top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.cart-item__name {
  font-weight: 900;
}

.cart-item__meta {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.cart-item__actions {
  margin-top: 0.7rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.qty-control {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
}

.qty-control button {
  width: 34px;
  height: 34px;
  border: 0;
  color: var(--primary-strong);
  background: transparent;
  font-weight: 900;
}

.qty-control span {
  min-width: 34px;
  text-align: center;
  font-weight: 900;
}

.remove-button {
  border: 0;
  color: var(--danger);
  background: transparent;
  font-weight: 800;
}

.total-box {
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.total-box span {
  color: var(--muted);
  font-weight: 900;
}

.total-box strong {
  color: var(--primary-strong);
  font-size: 2rem;
}

.order-actions {
  padding: 1rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.not-found {
  padding: 2rem 0;
}

.not-found .panel {
  padding: 2rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  padding: 1rem;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.48);
}

.modal {
  width: min(620px, 100%);
  max-height: min(720px, calc(100vh - 2rem));
  overflow: auto;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 24px 72px rgba(15, 23, 42, 0.28);
}

.modal__header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.modal__header h2 {
  margin: 0;
}

.modal__header p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.icon-button {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 13px;
  color: var(--text);
  background: #eef2f7;
  font-size: 1.45rem;
  line-height: 1;
}

.modal__body {
  padding: 1rem;
  display: grid;
  gap: 1rem;
}

.option-group {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.option-group h3 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
}

.option-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.option-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 750;
}

.option-pill input {
  accent-color: var(--primary);
}

.modal__footer {
  position: sticky;
  bottom: 0;
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.modal__footer--right {
  justify-content: flex-end;
}

.summary-text {
  margin: 0;
  padding: 1rem;
  white-space: pre-wrap;
  line-height: 1.65;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color: var(--text);
  background: var(--surface-soft);
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 90;
  max-width: min(420px, calc(100vw - 2rem));
  padding: 0.8rem 1rem;
  border-radius: 14px;
  color: #fff;
  background: var(--primary-strong);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
}

@media (max-width: 980px) {
  .store-layout {
    grid-template-columns: 1fr;
  }

  .order-panel {
    position: static;
  }

  .cart-list {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .site-header__content {
    min-height: 64px;
  }

  .brand small {
    display: none;
  }

  .header-link {
    font-size: 0.9rem;
  }

  .panel__header--split,
  .store-hero {
    flex-direction: column;
  }

  .toolbar,
  .order-actions {
    grid-template-columns: 1fr;
  }

  .item-grid,
  .store-grid {
    grid-template-columns: 1fr;
  }

  .item-card {
    grid-template-columns: 1fr;
  }

  .item-card__price {
    grid-template-columns: 1fr auto;
    justify-items: start;
    align-items: center;
  }

  .modal__footer {
    align-items: stretch;
    flex-direction: column;
  }

  .qty-control {
    justify-content: space-between;
  }
}
