.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--color-border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 0 16px;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.site-brand__logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.site-brand__name {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
}

.site-nav {
  gap: 8px;
}

.site-nav__item {
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--color-text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
}

.site-nav__item:hover {
  color: var(--color-text);
  background: var(--color-bg);
}

.site-nav__item.is-active {
  color: var(--color-primary);
  background: var(--color-primary-light);
  font-weight: 600;
}

/* Main */
.view-root {
  flex: 1;
  min-height: 0;
}

.page {
  min-height: calc(100vh - var(--header-height) - var(--tabbar-height));
}

body.route-detail .page {
  min-height: calc(100vh - var(--header-height));
}

/* 预点栏遮挡：给可滚动菜品列表留底边距 */
body.has-preorder .menu-dishes {
  padding-bottom: calc(var(--preorder-bar-height) + 24px);
}

@media (min-width: 768px) {
  .page {
    min-height: calc(100vh - var(--header-height));
  }

  body.has-preorder .menu-dishes {
    padding-bottom: calc(var(--preorder-bar-height) + 48px);
  }

  .view-root,
  .page--menu,
  .page--cart {
    max-width: var(--content-max-width);
    margin: 0 auto;
    width: 100%;
  }
}

/* Bottom tabbar (mobile) */
.site-tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  height: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #fff;
  border-top: 1px solid var(--color-border);
}

.site-tabbar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--color-text-secondary);
  font-size: 11px;
}

.site-tabbar__item.is-active {
  color: var(--color-primary);
}

.site-tabbar__icon {
  width: 22px;
  height: 22px;
  background: currentColor;
  opacity: 0.85;
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}

.site-tabbar__icon--menu {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M4 6h16M4 12h16M4 18h10'/%3E%3C/svg%3E");
}

.site-tabbar__icon--cart {
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'%3E%3Cpath d='M6 6h15l-1.5 9h-12z'/%3E%3Cpath d='M6 6L5 3H2M9 20a1 1 0 100-2 1 1 0 000 2zm8 0a1 1 0 100-2 1 1 0 000 2z'/%3E%3C/svg%3E");
}

body.route-detail .site-tabbar {
  display: none;
}

/* Menu page */
.page--menu {
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
}

.search-fixed {
  flex-shrink: 0;
  padding: 10px 16px;
}

.search__box {
  display: flex;
  align-items: center;
  height: 40px;
  padding: 0 14px;
  background: var(--color-card);
  border-radius: 999px;
  box-shadow: var(--shadow-card);
}

.search__icon {
  width: 16px;
  height: 16px;
  margin-right: 10px;
  flex-shrink: 0;
  border: 2px solid var(--color-text-muted);
  border-radius: 50%;
  position: relative;
  opacity: 0.85;
}

.search__icon::after {
  content: '';
  position: absolute;
  width: 7px;
  height: 2px;
  right: -5px;
  bottom: -1px;
  background: var(--color-text-muted);
  transform: rotate(45deg);
}

.search__input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
}

.search__clear {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-bg);
  color: var(--color-text-muted);
  font-size: 18px;
  line-height: 1;
}

.menu-body {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
  background: var(--color-card);
  border-top: 1px solid var(--color-border);
}

.menu-sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  overflow-y: auto;
  background: #f5f5f5;
}

.sidebar-item {
  position: relative;
  display: block;
  width: 100%;
  padding: 16px 10px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-secondary);
  line-height: 1.35;
}

.sidebar-item--active {
  background: var(--color-card);
  color: var(--color-text);
  font-weight: 600;
}

.sidebar-item--active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 20px;
  margin-top: -10px;
  background: var(--color-primary);
  border-radius: 0 2px 2px 0;
}

.menu-dishes {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.dish-section__title {
  margin: 0;
  padding: 12px 16px 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: #fafafa;
}

.dish-section__list {
  display: flex;
  flex-direction: column;
}

.dish-row {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-bg);
}

.dish-row__main {
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
  cursor: pointer;
}

.dish-row__cover-wrap {
  position: relative;
  flex-shrink: 0;
  width: 72px;
  height: 72px;
  margin-right: 12px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-bg);
}

.dish-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dish-cover--empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dish-row__badge {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #ff7a45, #e85d2a);
  border-bottom-right-radius: 6px;
}

.dish-row__name {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dish-row__meta {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--color-text-secondary);
}

.dish-row__meta--muted {
  color: var(--color-text-muted);
}

.dish-row__add {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  margin-left: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 300;
  color: var(--color-text);
  background: #ffd161;
  border-radius: 50%;
}

@media (min-width: 768px) {
  .menu-sidebar {
    width: var(--sidebar-width-desktop);
  }

  .sidebar-item {
    padding: 16px 14px;
    font-size: 14px;
  }

  .dish-section__list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
  }

  .dish-row {
    border-bottom: 1px solid var(--color-bg);
    border-right: 1px solid var(--color-bg);
  }

  .dish-row__cover-wrap {
    width: 80px;
    height: 80px;
  }
}

@media (min-width: 1024px) {
  .dish-section__list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1280px) {
  .dish-section__list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Preorder bar */
.preorder-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
  z-index: 55;
  background: #2c2c2c;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.12);
  cursor: pointer;
}

@media (min-width: 768px) {
  .preorder-bar {
    left: 50%;
    right: auto;
    bottom: 24px;
    width: min(560px, calc(100vw - 32px));
    transform: translateX(-50%);
    border-radius: 999px;
    overflow: hidden;
  }
}

.preorder-bar__inner {
  display: flex;
  align-items: center;
  height: var(--preorder-bar-height);
  padding: 0 16px;
}

.preorder-bar__icon-wrap {
  position: relative;
  margin-right: 12px;
}

.preorder-bar__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  font-size: 14px;
  font-weight: 700;
  color: #2c2c2c;
  background: #ffd161;
  border-radius: 10px;
}

.preorder-bar__badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  line-height: 18px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--color-primary);
  border-radius: 999px;
}

.preorder-bar__center {
  flex: 1;
  min-width: 0;
}

.preorder-bar__title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
}

.preorder-bar__hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
}

.preorder-bar__btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  background: #ffd161;
  border-radius: 999px;
}

/* Sheet */
.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  background: rgba(0, 0, 0, 0.45);
}

.sheet-mask.is-open {
  display: block;
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 78vh;
  padding-bottom: env(safe-area-inset-bottom, 16px);
  background: var(--color-card);
  border-radius: 16px 16px 0 0;
}

@media (min-width: 768px) {
  .sheet {
    left: 50%;
    right: auto;
    bottom: 50%;
    width: min(520px, calc(100vw - 32px));
    max-height: 80vh;
    transform: translate(-50%, 50%);
    border-radius: var(--radius-lg);
    padding-bottom: 16px;
  }
}

.sheet__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-bg);
}

.sheet__title {
  margin: 0;
  font-size: 18px;
}

.sheet__clear {
  font-size: 14px;
  color: var(--color-text-muted);
}

.sheet__list {
  max-height: 36vh;
  overflow-y: auto;
}

.sheet-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-bg);
}

.sheet-item__img {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  margin-right: 12px;
  object-fit: cover;
  background: var(--color-bg);
  flex-shrink: 0;
}

.sheet-item__img--empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.sheet-item__info {
  flex: 1;
  min-width: 0;
}

.sheet-item__name {
  font-size: 15px;
  font-weight: 500;
}

.sheet-item__cat {
  margin-top: 2px;
  font-size: 12px;
  color: var(--color-text-muted);
}

.sheet-item__remove {
  font-size: 13px;
  color: var(--color-primary);
  padding: 6px 8px;
}

.sheet__remark {
  padding: 14px 20px;
  border-top: 1px dashed var(--color-border);
}

.sheet__remark-label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--color-text-secondary);
}

.sheet__remark-input {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: none;
  outline: none;
  resize: vertical;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
}

.sheet__submit {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100% - 40px);
  height: 46px;
  margin: 12px 20px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  background: #ffd161;
  border-radius: 999px;
}

/* Cart page */
.page--cart {
  background: var(--color-bg);
  padding-bottom: calc(var(--tabbar-height) + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 768px) {
  .page--cart {
    padding: 16px 16px 32px;
  }
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 32px;
  text-align: center;
}

.empty__title {
  margin: 0;
  font-size: 20px;
}

.empty__hint {
  margin: 8px 0 0;
  font-size: 14px;
  color: var(--color-text-muted);
}

.empty__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 24px;
  padding: 0 28px;
  height: 42px;
  font-size: 15px;
  color: var(--color-text);
  background: #ffd161;
  border-radius: 999px;
}

.order-list__inner {
  padding: 16px;
}

.order-masonry {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 16px;
}

@media (min-width: 1024px) {
  .order-masonry {
    padding: 0 0 8px;
  }
}

.order-masonry__col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.order-list__more {
  display: flex;
  justify-content: center;
  padding: 8px 16px 24px;
}

.order-list__more-btn {
  min-width: 140px;
  height: 40px;
  padding: 0 20px;
  font-size: 14px;
  color: var(--color-text);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 999px;
}

.order-list__more-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.order-list__end {
  margin: 0;
  padding: 8px 16px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
}

.state-box__spinner--sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.receipt {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  line-height: 0;
}

.receipt__teeth {
  display: block;
  height: 10px;
  background: #fffef8;
  border-left: 1px solid #ebe6dc;
  border-right: 1px solid #ebe6dc;
  box-sizing: border-box;
  flex-shrink: 0;
}

.receipt__teeth--top {
  -webkit-mask-image:
    linear-gradient(45deg, #000 25%, transparent 25%),
    linear-gradient(-45deg, #000 25%, transparent 25%);
  -webkit-mask-size: 10px 10px;
  -webkit-mask-repeat: repeat-x;
  -webkit-mask-position: 0 100%, 5px 100%;
  mask-image:
    linear-gradient(45deg, #000 25%, transparent 25%),
    linear-gradient(-45deg, #000 25%, transparent 25%);
  mask-size: 10px 10px;
  mask-repeat: repeat-x;
  mask-position: 0 100%, 5px 100%;
}

.receipt__teeth--bottom {
  -webkit-mask-image:
    linear-gradient(135deg, #000 25%, transparent 25%),
    linear-gradient(225deg, #000 25%, transparent 25%);
  -webkit-mask-size: 10px 10px;
  -webkit-mask-repeat: repeat-x;
  -webkit-mask-position: 0 0, 5px 0;
  mask-image:
    linear-gradient(135deg, #000 25%, transparent 25%),
    linear-gradient(225deg, #000 25%, transparent 25%);
  mask-size: 10px 10px;
  mask-repeat: repeat-x;
  mask-position: 0 0, 5px 0;
}

.receipt__content {
  padding: 16px;
  background: #fffef8;
  border-left: 1px solid #ebe6dc;
  border-right: 1px solid #ebe6dc;
  line-height: 1.5;
  flex: 1;
}

.receipt__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.receipt__time {
  font-size: 14px;
  font-weight: 600;
  font-family: 'Courier New', Courier, monospace;
}

.receipt__del {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-light);
  border: 1px solid rgba(232, 93, 42, 0.35);
  border-radius: 999px;
}

.receipt__divider {
  height: 1px;
  margin: 12px 0;
  background: repeating-linear-gradient(90deg, #ccc 0, #ccc 6px, transparent 6px, transparent 12px);
}

.receipt-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  cursor: pointer;
}

.receipt-item--gone {
  opacity: 0.72;
}

.receipt-item__img {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  margin-right: 12px;
  object-fit: cover;
  background: var(--color-bg);
  flex-shrink: 0;
}

.receipt-item__img--empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.receipt-item__body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  gap: 12px;
}

.receipt-item__name {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.receipt-item__cat {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--color-text-muted);
}

.receipt__count {
  display: block;
  font-size: 13px;
  color: var(--color-text-secondary);
}

.receipt__remark {
  margin: 8px 0 0;
  padding: 10px 12px;
  font-size: 14px;
  background: var(--color-bg);
  border-radius: var(--radius-sm);
}

.receipt__remark--empty {
  color: var(--color-text-muted);
}

/* Detail page */
.page--detail {
  background: var(--color-bg);
  padding-bottom: 24px;
}

.detail-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--color-border);
}

.detail-back {
  width: 36px;
  height: 36px;
  font-size: 28px;
  line-height: 1;
  color: var(--color-text);
}

.detail-topbar__title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.gallery {
  position: relative;
  width: 100%;
  height: 280px;
  background: #e8e2da;
  overflow: hidden;
}

@media (min-width: 768px) {
  .gallery {
    height: 420px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }

  .detail-main {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 16px;
  }
}

.gallery__track {
  position: relative;
  width: 100%;
  height: 100%;
}

.gallery__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.gallery__slide.is-active {
  opacity: 1;
}

.gallery__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery__img--single {
  display: block;
}

.gallery__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #fff4ee 0%, #e8f6ef 60%, #f7f3ee 100%);
}

.gallery__dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.gallery__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
}

.gallery__dot.is-active {
  background: #fff;
}

.info-card {
  position: relative;
  margin: -24px 16px 16px;
  padding: 20px;
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  z-index: 2;
}

@media (min-width: 768px) {
  .info-card {
    margin-top: -32px;
  }
}

.info-card__title-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.info-card__name {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
}

.info-card__category {
  position: relative;
  padding-left: 12px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.info-card__category::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 1px;
  height: 14px;
  margin-top: -7px;
  background: var(--color-border);
}

.info-card__tags {
  margin-top: 10px;
}

.info-card__desc {
  margin-top: 16px;
  padding: 14px;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--color-primary);
}

.info-card__desc-text {
  margin: 0;
  font-size: 15px;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.section {
  margin: 0 16px 16px;
  background: var(--color-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.section__head {
  display: flex;
  align-items: center;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--color-bg);
}

.section__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
}

.section__dot--orange {
  background: var(--color-primary);
}

.section__title {
  flex: 1;
  margin: 0;
  font-size: 18px;
}

.section__count {
  font-size: 13px;
  color: var(--color-text-muted);
}

.section__body--steps {
  padding: 0 18px 8px;
}

.step-item {
  padding: 18px 0;
}

.step-item--divider {
  border-bottom: 1px dashed var(--color-border);
}

.step-item__head {
  display: flex;
  align-items: flex-start;
}

.step-item__no {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  margin-right: 12px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 30px;
  text-align: center;
}

.step-item__desc {
  flex: 1;
  margin: 0;
  font-size: 15px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

.step-item__img {
  width: 100%;
  margin-top: 12px;
  border-radius: var(--radius-md);
}

.page-footer {
  padding: 16px 0 8px;
  text-align: center;
}

.page-footer__text {
  margin: 0;
  font-size: 12px;
  color: var(--color-text-muted);
  letter-spacing: 2px;
}

body.route-detail .site-header .site-brand__name,
body.route-detail .site-nav {
  display: none;
}

@media (min-width: 768px) {
  body.route-detail .site-header .site-brand__name,
  body.route-detail .site-nav {
    display: inline-flex;
  }
}
