:root {
  --bg: #f6eee6;
  --bg-deep: #efe0d4;
  --paper: #fffaf6;
  --ink: #3d2c28;
  --ink-soft: #7a5f58;
  --line: #ead6cc;
  --brand: #c4787a;
  --brand-deep: #9a5457;
  --brand-soft: #f8e6e4;
  --gold: #c4a27a;
  --leaf: #6b7a5c;
  --danger: #b85c55;
  --shadow: 0 14px 40px rgba(92, 48, 42, 0.07);
  --radius: 22px;
  --max: 1080px;
  --header: 72px;
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(880px 420px at 8% -12%, #f8ddd6 0%, transparent 58%),
    radial-gradient(720px 380px at 100% 0%, #f3e2c8 0%, transparent 52%),
    linear-gradient(180deg, rgba(255, 250, 246, 0.35), transparent 28%),
    var(--bg);
  font-family: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", sans-serif;
  line-height: 1.55;
  min-height: 100dvh;
}

img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea { touch-action: manipulation; }
a { color: inherit; }
.short { display: none; }

.page { min-height: 100vh; }
.wrap {
  width: min(var(--max), calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  backdrop-filter: blur(16px);
  background: rgba(246, 238, 230, 0.78);
  border-bottom: 1px solid rgba(234, 223, 210, 0.8);
}
.site-header .wrap,
.admin-top .wrap {
  height: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.logo {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(160deg, #d89193, #c4787a);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 8px 18px rgba(196, 120, 122, 0.22);
}
.brand-name {
  font-family: "Ma Shan Zheng", "Noto Serif SC", serif;
  font-size: 20px;
  letter-spacing: 0.04em;
}
.brand-sub { font-size: 12px; color: var(--ink-soft); }
.nav-links { display: flex; gap: 8px; }
.btn {
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  padding: 10px 16px;
  background: var(--paper);
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(160deg, #d89193, #c4787a);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  box-shadow: none;
  border: 1px solid var(--line);
}
.btn-danger { background: #fff1ef; color: var(--danger); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 24px;
  padding: 28px 0 8px;
}
.hero-card,
.panel,
.dish-card,
.cart-bar,
.sheet,
.modal {
  background: var(--paper);
  border: 1px solid rgba(234, 223, 210, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-card { padding: 28px; }
.hero-card.letter {
  background:
    linear-gradient(180deg, rgba(255, 250, 246, 0.96), rgba(255, 246, 240, 0.98)),
    var(--paper);
}
.letter-open {
  margin: 0 0 6px;
  font-family: "Ma Shan Zheng", "Noto Serif SC", serif;
  font-size: 22px;
  color: var(--brand-deep);
}
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 600;
}
.hero h1 {
  margin: 8px 0 10px;
  font-family: "Ma Shan Zheng", "Noto Serif SC", serif;
  font-size: clamp(36px, 6vw, 54px);
  line-height: 1.15;
}
.notice { color: var(--ink-soft); margin: 0 0 18px; }
.meta-row, .stat-row, .qty, .admin-actions, .chip-row, .form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.pill {
  background: var(--bg-deep);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--ink-soft);
}
.hero-visual {
  min-height: 240px;
  overflow: hidden;
  position: relative;
}
.hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 260px;
}
.hero-badge {
  position: absolute;
  left: 16px;
  bottom: 16px;
  background: rgba(61, 44, 40, 0.62);
  color: #fff8f4;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
}

.search-box {
  margin: 18px 0 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 16px;
}
.search-box input {
  border: 0;
  outline: 0;
  width: 100%;
  background: transparent;
  font-size: 16px;
}

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  padding: 12px 0 140px;
}
.cats {
  position: sticky;
  top: calc(var(--header) + 16px);
  align-self: start;
  padding: 12px;
}
.cat-btn {
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  color: var(--ink-soft);
}
.cat-btn.active, .cat-btn:hover {
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-weight: 600;
}

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 8px 0 14px;
}
.section-title h2 {
  margin: 0;
  font-family: "Noto Serif SC", serif;
  font-size: 24px;
}
.dish-list { display: grid; gap: 14px; }
.dish-card {
  display: grid;
  grid-template-columns: 148px 1fr auto;
  gap: 16px;
  padding: 12px;
  cursor: pointer;
}
.dish-cover {
  width: 148px;
  height: 112px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-deep);
  position: relative;
}
.dish-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.tag-abs {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(196, 120, 122, 0.92);
  color: #fff;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
}
.dish-card h3 {
  margin: 2px 0 6px;
  font-size: 18px;
  font-family: "Noto Serif SC", serif;
}
.dish-card p, .muted { color: var(--ink-soft); margin: 0; font-size: 13px; }
.dish-note { margin-top: 8px; }
.price {
  color: var(--brand-deep);
  font-weight: 600;
  font-size: 18px;
}
.price small {
  color: var(--ink-soft);
  font-weight: 400;
  font-size: 13px;
  margin-left: 6px;
}
.price small.unit { text-decoration: none; }
.dish-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
}
.qty button {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  cursor: pointer;
}
.qty .plus, .add-btn {
  background: var(--brand);
  color: #fff;
}
.add-btn {
  min-width: 64px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0 12px;
}

.cart-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  width: min(720px, calc(100% - 24px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 18px;
  z-index: 40;
}
.cart-info {
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  padding: 0;
  min-width: 0;
}
.cart-info strong { font-size: 22px; display: block; }
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(36, 28, 22, 0.42);
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translate(-50%, 110%);
  width: min(640px, 100%);
  max-height: 86vh;
  overflow: auto;
  z-index: 60;
  padding: 20px;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  transition: transform 0.25s ease;
}
.sheet.show { transform: translate(-50%, 0); }
.sheet-head, .modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.cart-item, .admin-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.cart-item img, .admin-item img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 14px;
}
.total-line {
  display: flex;
  justify-content: space-between;
  margin: 8px 0;
  color: var(--ink-soft);
}
.total-line.strong { color: var(--ink); font-size: 18px; font-weight: 700; }

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -46%) scale(0.96);
  width: min(720px, calc(100% - 24px));
  max-height: 88vh;
  overflow: auto;
  z-index: 70;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}
.modal.show {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
.modal-cover { height: 260px; background: var(--bg-deep); }
.modal-cover img { width: 100%; height: 100%; object-fit: cover; }
.modal-body { padding: 20px 22px 24px; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
  font-size: 12px;
}
.order-box {
  width: 100%;
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  resize: vertical;
  background: #fff6f1;
}

.admin-page { padding-bottom: 60px; }
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 24px 0;
}
.panel { padding: 20px; }
.panel h2, .panel h3 {
  font-family: "Noto Serif SC", serif;
  margin: 0 0 14px;
}
label { display: block; font-size: 13px; color: var(--ink-soft); margin: 10px 0 6px; }
input[type="text"], input[type="number"], input[type="tel"], input[type="search"], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 11px 12px;
  outline: none;
  font-size: 16px;
}
input:focus, select:focus, textarea:focus { border-color: #d7a4a2; box-shadow: 0 0 0 4px rgba(196, 120, 122, 0.12); }
.image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.image-pick {
  border: 2px solid transparent;
  padding: 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-deep);
  cursor: pointer;
  position: relative;
  min-height: 92px;
}
.image-pick img { width: 100%; height: 92px; object-fit: cover; }
.image-pick.selected { border-color: var(--brand); }
.image-pick .src-tag {
  position: absolute;
  left: 6px;
  bottom: 6px;
  background: rgba(0,0,0,.62);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 8px;
}
.preview-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(36, 28, 22, 0.04), rgba(36, 28, 22, 0.02)),
    var(--bg-deep);
}
.preview-img:not([src]),
.preview-img[src=""] {
  visibility: hidden;
}
.empty {
  padding: 28px;
  text-align: center;
  color: var(--ink-soft);
}
.toast {
  position: fixed;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: #241c16;
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  z-index: 80;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.toast.show { opacity: 1; }
.hint { font-size: 13px; color: var(--ink-soft); }
.cloud-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px auto 0;
  padding: 12px 16px;
}
.cloud-bar .pill.ok { background: #e7f6ec; color: var(--leaf); }
.cloud-bar .pill.warn { background: #fff4d6; color: #8a6a12; }
.cloud-bar .pill.off { background: #f3eee8; color: var(--ink-soft); }
.pin-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink);
}
.pin-field input {
  width: 160px;
  margin: 0;
  padding: 8px 10px;
}
.order-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.hidden-commercial {
  opacity: 0.55;
}

@media (max-width: 860px) {
  :root { --header: 58px; --radius: 16px; }
  .wrap { width: min(100% - 16px, var(--max)); }
  .short { display: inline; }
  .full { display: none; }
  .site-header .wrap { height: var(--header); gap: 8px; }
  .logo { width: 36px; height: 36px; border-radius: 12px; }
  .brand { gap: 8px; }
  .brand-name { font-size: 17px; }
  .brand-sub { display: none; }
  .btn { padding: 9px 12px; min-height: 40px; }
  .hero, .layout, .admin-grid { grid-template-columns: 1fr; }
  .hero { padding: 12px 0 0; gap: 0; }
  .hero-card { padding: 16px; }
  .hero h1 { font-size: 26px; margin: 4px 0 6px; }
  .notice { margin: 0 0 10px; font-size: 13px; }
  .pill { font-size: 12px; padding: 5px 9px; }
  .hero-visual { display: none; }
  .search-box { margin: 12px 0; padding: 11px 14px; border-radius: 14px; }
  .layout { padding: 0 0 118px; gap: 8px; }
  .cats {
    position: sticky;
    top: var(--header);
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    margin: 0 -8px;
    padding: 8px;
    z-index: 20;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: rgba(246, 238, 230, 0.94);
    backdrop-filter: blur(14px);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .cats::-webkit-scrollbar { display: none; }
  .cat-btn {
    width: auto;
    white-space: nowrap;
    background: var(--paper);
    padding: 8px 12px;
    min-height: 40px;
    font-size: 13px;
    flex: 0 0 auto;
  }
  .section-title { margin: 6px 2px 10px; }
  .section-title h2 { font-size: 18px; }
  .dish-list { gap: 10px; }
  .dish-card {
    grid-template-columns: 92px 1fr auto;
    gap: 10px;
    padding: 10px;
    border-radius: 16px;
  }
  .dish-cover { width: 92px; height: 92px; border-radius: 12px; }
  .dish-card h3 { font-size: 16px; margin: 0 0 4px; }
  .dish-card p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 12px;
  }
  .price { font-size: 17px; }
  .add-btn, .qty button {
    width: 36px;
    height: 36px;
    min-width: 36px;
    font-size: 18px;
  }
  .add-btn {
    width: auto;
    min-width: 60px;
    height: 34px;
    font-size: 13px;
  }
  .qty { align-items: center; }
  .cart-bar {
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
    width: 100%;
    border-radius: 18px 18px 0 0;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }
  .cart-bar .btn-primary {
    min-height: 44px;
    min-width: 108px;
    padding: 0 18px;
  }
  .sheet {
    width: 100%;
    max-height: min(88vh, 720px);
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
  }
  .modal {
    left: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-height: 92vh;
    transform: translateY(110%);
    border-radius: 20px 20px 0 0;
  }
  .modal.show {
    transform: translateY(0);
  }
  .modal-cover { height: 200px; }
  .modal-body { padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
  .cart-item, .admin-item {
    grid-template-columns: 64px 1fr auto;
    gap: 10px;
  }
  .cart-item img, .admin-item img { width: 64px; height: 64px; }
  .admin-item {
    grid-template-columns: 64px 1fr;
  }
  .admin-item .admin-actions {
    grid-column: 1 / -1;
  }
  .admin-grid { padding: 12px 0 28px; gap: 12px; }
  .cloud-bar { margin-top: 12px; }
  .pin-field { width: 100%; }
  .pin-field input { flex: 1; width: auto; }
  .panel { padding: 16px; }
  .image-grid { grid-template-columns: repeat(2, 1fr); }
  .toast {
    top: auto;
    bottom: calc(84px + env(safe-area-inset-bottom));
    max-width: calc(100% - 24px);
    text-align: center;
  }
}

@media (max-width: 380px) {
  .dish-card { grid-template-columns: 80px 1fr auto; }
  .dish-cover { width: 80px; height: 80px; }
  .hero h1 { font-size: 22px; }
}
