*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── Light (Apple.com marketing) ── */
:root,
[data-theme='light'] {
  --bg: #f5f5f7;
  --bg-2: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f5f5f7;
  --text: #1d1d1f;
  --text-muted: #86868b;
  --text-dim: #6e6e73;
  --accent: #0066cc;
  --accent-2: #2997ff;
  --accent-3: #34c759;
  --accent-4: #bf4800;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);
  --status-bar: #f5f5f7;
  --topbar-text: #f5f5f7;
  --topbar-muted: #a1a1a6;
  --chip-bg: rgba(0, 102, 204, 0.08);
  --fill: rgba(0, 0, 0, 0.06);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 8px 28px rgba(0, 0, 0, 0.12);
  --blob-1: transparent;
  --blob-2: transparent;
  --blob-3: transparent;
  --card-tint: #ffffff;
  --search-focus: rgba(0, 102, 204, 0.22);
  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 28px;
  --nav-bg: rgba(22, 22, 23, 0.8);
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display',
    'Noto Sans SC', 'PingFang SC', 'Helvetica Neue', system-ui, sans-serif;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --spring: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ── Dark ── */
[data-theme='dark'] {
  --bg: #000000;
  --bg-2: #161617;
  --surface: #161617;
  --surface-soft: #1d1d1f;
  --text: #f5f5f7;
  --text-muted: #a1a1a6;
  --text-dim: #6e6e73;
  --accent: #2997ff;
  --accent-2: #2997ff;
  --accent-3: #30d158;
  --accent-4: #ff9f0a;
  --border: rgba(255, 255, 255, 0.12);
  --border-strong: rgba(255, 255, 255, 0.2);
  --status-bar: #000000;
  --topbar-text: #f5f5f7;
  --topbar-muted: #a1a1a6;
  --chip-bg: rgba(41, 151, 255, 0.14);
  --fill: rgba(255, 255, 255, 0.1);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 8px 28px rgba(0, 0, 0, 0.5);
  --blob-1: transparent;
  --blob-2: transparent;
  --blob-3: transparent;
  --card-tint: #1d1d1f;
  --search-focus: rgba(41, 151, 255, 0.35);
  --nav-bg: rgba(22, 22, 23, 0.88);
}

/*
 * Edge-to-Edge
 * iOS：状态栏下方必须是纯色 --bg，fixed 装饰层不能盖住采样区
 * PC：允许全屏氛围渐变撑满大屏
 */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--bg);
  background-image: none;
  min-height: 100%;
  min-height: 100dvh;
  height: -webkit-fill-available;
  touch-action: manipulation;
}

body {
  font-family: var(--font);
  background-color: var(--bg);
  background-image: none;
  color: var(--text);
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  width: 100%;
  line-height: 1.7;
  letter-spacing: -0.015em;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  overflow-x: hidden;
  touch-action: manipulation;
  accent-color: var(--accent);
}

/* 氛围层 */
.scene {
  display: block;
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* 氛围装饰默认关闭，保持系统背景干净 */
.scene,
.windmill {
  display: none !important;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  animation: bob 16s var(--ease) infinite alternate;
}

.blob-1 {
  width: 220px;
  height: 220px;
  top: 4%;
  left: -40px;
  background: var(--blob-1);
}

.blob-2 {
  width: 200px;
  height: 200px;
  bottom: 12%;
  right: -36px;
  background: var(--blob-2);
  animation-delay: -5s;
}

.blob-3 {
  width: 160px;
  height: 160px;
  top: 48%;
  left: 38%;
  background: var(--blob-3);
  animation-delay: -10s;
}

@media (min-width: 768px) {
  .blob-1 {
    width: min(42vw, 420px);
    height: min(42vw, 420px);
    top: 8%;
    left: -4%;
  }

  .blob-2 {
    width: min(36vw, 380px);
    height: min(36vw, 380px);
    bottom: 6%;
    right: -3%;
  }

  .blob-3 {
    width: min(28vw, 300px);
    height: min(28vw, 300px);
    top: 48%;
    left: 42%;
  }
}

.dots {
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: radial-gradient(circle, var(--accent) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, black, transparent);
}

@keyframes bob {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(18px, -14px) scale(1.08); }
}

/* ── 动态风车装饰（右下角，不挡操作） ── */
.windmill {
  position: fixed;
  right: max(0.6rem, env(safe-area-inset-right, 0px));
  bottom: max(0.85rem, env(safe-area-inset-bottom, 0px));
  z-index: 2;
  width: 72px;
  height: 96px;
  pointer-events: none;
  opacity: 0.92;
  animation: windmill-sway 5.5s var(--ease) infinite alternate;
}

.windmill-blades {
  position: absolute;
  left: 50%;
  top: 10px;
  width: 56px;
  height: 56px;
  margin-left: -28px;
  animation: windmill-spin 4.2s linear infinite;
  transform-origin: center center;
}

.blade {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 26px;
  margin-left: -6px;
  margin-top: -26px;
  border-radius: 60% 60% 40% 40%;
  background: linear-gradient(180deg, #7dd3fc 0%, #38bdf8 55%, #0ea5e9 100%);
  box-shadow: 0 2px 6px rgba(14, 165, 233, 0.25);
  transform-origin: 50% 100%;
}

.blade-1 { transform: rotate(0deg); }
.blade-2 { transform: rotate(90deg); background: linear-gradient(180deg, #99f6e4 0%, #2dd4bf 55%, #14b8a6 100%); }
.blade-3 { transform: rotate(180deg); background: linear-gradient(180deg, #93c5fd 0%, #60a5fa 55%, #3b82f6 100%); }
.blade-4 { transform: rotate(270deg); background: linear-gradient(180deg, #a7f3d0 0%, #34d399 55%, #10b981 100%); }

.windmill-hub {
  position: absolute;
  left: 50%;
  top: 30px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff 0%, #fbbf24 45%, #f59e0b 100%);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
  z-index: 1;
}

.windmill-pole {
  position: absolute;
  left: 50%;
  top: 42px;
  width: 6px;
  height: 42px;
  margin-left: -3px;
  border-radius: 4px;
  background: linear-gradient(180deg, #94a3b8, #64748b);
}

.windmill-base {
  position: absolute;
  left: 50%;
  bottom: 4px;
  width: 28px;
  height: 10px;
  margin-left: -14px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 18%, transparent);
  filter: blur(1px);
}

@keyframes windmill-spin {
  to { transform: rotate(360deg); }
}

@keyframes windmill-sway {
  from { transform: rotate(-2.5deg) translateY(0); }
  to   { transform: rotate(2.5deg) translateY(-3px); }
}

@media (min-width: 768px) {
  .windmill {
    width: 96px;
    height: 128px;
    right: max(1.4rem, env(safe-area-inset-right, 0px));
    bottom: max(1.2rem, env(safe-area-inset-bottom, 0px));
  }

  .windmill-blades {
    width: 72px;
    height: 72px;
    margin-left: -36px;
    top: 12px;
  }

  .blade {
    width: 15px;
    height: 34px;
    margin-left: -7.5px;
    margin-top: -34px;
  }

  .windmill-hub {
    top: 40px;
    width: 16px;
    height: 16px;
    margin-left: -8px;
  }

  .windmill-pole {
    top: 54px;
    height: 56px;
    width: 7px;
    margin-left: -3.5px;
  }

  .windmill-base {
    width: 36px;
    margin-left: -18px;
  }
}

[data-theme='dark'] .blade-1 {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
}
[data-theme='dark'] .blade-2 {
  background: linear-gradient(180deg, #2dd4bf 0%, #0f766e 100%);
}
[data-theme='dark'] .blade-3 {
  background: linear-gradient(180deg, #60a5fa 0%, #1d4ed8 100%);
}
[data-theme='dark'] .blade-4 {
  background: linear-gradient(180deg, #34d399 0%, #047857 100%);
}

/* ── Global Nav（apple.com 细顶栏）── */
.topbar,
.global-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  margin: 0;
  border: 0;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  box-shadow: none;
  padding-top: constant(safe-area-inset-top);
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: 0;
  min-height: 48px;
}

[data-theme='dark'] .topbar {
  box-shadow: none;
}

.topbar-inner,
.topbar-search {
  position: relative;
}

.topbar-inner {
  z-index: 2;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1.25rem;
  padding-left: max(1.25rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.25rem, env(safe-area-inset-right, 0px));
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar-search {
  display: none;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.nav-wordmark {
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--topbar-text);
  text-decoration: none;
  opacity: 0.92;
  white-space: nowrap;
  transition: opacity 0.16s var(--ease);
}

.nav-wordmark:hover {
  opacity: 1;
}

.topbar-logo {
  display: none;
}

body:not(.home-body) .topbar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #fff;
  background: transparent;
  border: 0;
  border-radius: 0;
  flex-shrink: 0;
  box-shadow: none;
  opacity: 0.9;
}

body:not(.home-body) .topbar-titles {
  display: block;
}

body:not(.home-body) .topbar-subtitle {
  display: none;
}

.topbar-titles {
  min-width: 0;
}

.topbar-title {
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--topbar-text);
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.92;
}

.topbar-subtitle {
  display: none;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}

.greeting-chip {
  display: none;
}

.topbar-clock {
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
}

@media (min-width: 720px) {
  .home-body .topbar-clock {
    display: flex;
  }
}

.clock-time {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--topbar-muted);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.clock-sec { display: none; }

.clock-sep {
  animation: tick 1s step-end infinite;
  opacity: 0.5;
  color: var(--topbar-muted);
}

.clock-sep-sec { display: none; }

@keyframes tick {
  50% { opacity: 0.15; }
}

.clock-date { display: none; }

.global-nav .btn-ghost,
.topbar .btn-ghost {
  color: var(--topbar-text);
  background: transparent;
  font-size: 0.75rem;
  font-weight: 400;
  min-height: auto;
  padding: 0.35rem 0.55rem;
  opacity: 0.88;
}

.global-nav .btn-ghost:hover,
.topbar .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  opacity: 1;
}

.topbar .user-menu-trigger {
  background: rgba(255, 255, 255, 0.1);
  color: var(--topbar-text);
  font-size: 0.75rem;
  font-weight: 400;
  box-shadow: none;
  border: 0;
}

.topbar .user-menu-trigger:hover,
.topbar .user-menu.is-open .user-menu-trigger {
  background: rgba(255, 255, 255, 0.16);
}

.topbar .user-menu-caret {
  border-top-color: var(--topbar-muted);
}

/* ── Layout ── */
.container {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding-top: 1.25rem;
  padding-left: max(1.4rem, env(safe-area-inset-left, 0px));
  padding-right: max(1.4rem, env(safe-area-inset-right, 0px));
  padding-bottom: 1.5rem;
  background: transparent;
  min-height: 60vh;
  min-height: calc(100dvh - env(safe-area-inset-top, 0px));
}

.container::after {
  content: '';
  display: block;
  height: env(safe-area-inset-bottom, 0px);
}

.home-body {
  background: var(--bg);
}

.home-main {
  position: relative;
  z-index: 1;
  width: 100%;
  padding-bottom: calc(3rem + env(safe-area-inset-bottom, 0px));
}

.site-hero {
  text-align: center;
  padding: clamp(2.5rem, 8vw, 5.5rem) 1.5rem 2.5rem;
  max-width: 720px;
  margin: 0 auto;
}

.site-hero-title {
  font-size: clamp(2.75rem, 9vw, 5rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.05;
  color: var(--text);
  margin: 0 0 0.65rem;
}

.site-hero-sub {
  font-size: clamp(1.125rem, 2.5vw, 1.5rem);
  font-weight: 400;
  letter-spacing: -0.015em;
  line-height: 1.35;
  color: var(--text-muted);
  margin: 0 0 1.75rem;
}

.hero-search {
  max-width: 420px;
  margin: 0 auto;
}

.hero-search .search-box {
  max-width: none;
}

/* ── Search ── */
.search-box {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
}

.topbar-search .search-box {
  max-width: none;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--text-dim);
  pointer-events: none;
  opacity: 0.85;
}

#search {
  width: 100%;
  padding: 0.72rem 2.75rem 0.72rem 2.55rem;
  background: var(--surface);
  border: 0;
  border-radius: 980px;
  color: var(--text);
  caret-color: var(--accent);
  font-family: var(--font);
  font-size: 1.0625rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  outline: none;
  box-shadow: none;
  transition: box-shadow 0.16s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}

#search::placeholder {
  color: var(--text-muted);
  font-weight: 400;
}

#search:focus {
  background: var(--surface);
  box-shadow: 0 0 0 3.5px var(--search-focus);
}

.search-box:focus-within .search-icon {
  color: var(--accent);
}

.search-hint {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  padding: 0.1rem 0.4rem;
  background: var(--fill);
  border: 0;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--text-dim);
  pointer-events: none;
}

.nav-grid,
.footer,
.edit-card,
.edit-toolbar,
.edit-categories,
.edit-page > .form-error,
.edit-page > .form-success,
.menu-page,
.menu-gate,
.meal-panel,
.dish-grid,
.dish-form,
.dish-manage,
.menu-inbox {
  position: relative;
  z-index: 1;
}

/* ── Categories / Units（apple.com 全宽模块）── */
.nav-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.home-body .nav-grid {
  gap: 0.75rem;
  padding: 0 0.75rem;
  max-width: 1200px;
  margin: 0 auto;
}

@media (min-width: 980px) {
  .home-body .nav-grid {
    padding: 0 1.5rem;
  }
}

.category,
.unit {
  --cat: var(--accent);
  padding: 0;
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: none;
  overflow: hidden;
}

.unit-1 { background: #ffffff; color: #1d1d1f; }
.unit-2 { background: #f5f5f7; color: #1d1d1f; }
.unit-3 { background: #000000; color: #f5f5f7; }

[data-theme='dark'] .unit-1 { background: #161617; color: #f5f5f7; }
[data-theme='dark'] .unit-2 { background: #1d1d1f; color: #f5f5f7; }
[data-theme='dark'] .unit-3 { background: #000000; color: #f5f5f7; }

.unit-3 .unit-title,
.unit-3 .tile-name { color: #f5f5f7; }
.unit-3 .unit-eyebrow,
.unit-3 .tile-desc { color: #a1a1a6; }
.unit-3 .tile {
  background: #1d1d1f;
}
.unit-3 .tile:hover {
  background: #2a2a2c;
}
.unit-3 .tile-cta { color: #2997ff; }

.category:nth-child(4n + 1) { --cat: var(--accent); }
.category:nth-child(4n + 2) { --cat: var(--accent-2); }
.category:nth-child(4n + 3) { --cat: var(--accent-3); }
.category:nth-child(4n + 4) { --cat: var(--accent-4); }

.unit-inner {
  padding: clamp(2rem, 5vw, 3.5rem) clamp(1.25rem, 4vw, 2.5rem) clamp(2rem, 4vw, 3rem);
}

.category-header,
.unit-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.35rem;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
  padding: 0;
}

.category-icon {
  display: none;
}

.unit-eyebrow {
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text-muted);
  margin: 0;
}

.category-name,
.unit-title {
  font-size: clamp(1.75rem, 4.5vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.1;
  color: inherit;
  margin: 0;
}

.category-count {
  display: none;
}

.links,
.tile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  background: transparent;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

@media (min-width: 640px) {
  .tile-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.85rem;
  }
}

@media (min-width: 980px) {
  .tile-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
}

/* ── Tiles ── */
.link-card,
.tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1.5rem 1.35rem 1.35rem;
  background: #fff;
  border: 0;
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: transform 0.28s var(--spring), box-shadow 0.28s var(--ease);
  -webkit-tap-highlight-color: transparent;
  min-height: 11rem;
  box-shadow: none;
}

.unit-1 .tile { background: #f5f5f7; }
.unit-2 .tile { background: #ffffff; }

.link-card:hover,
.tile:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-hover);
}

.link-card:active,
.tile:active {
  transform: scale(0.99);
}

.link-card.hidden,
.category.hidden {
  display: none;
}

.link-icon,
.tile-icon {
  flex-shrink: 0;
  width: 3rem;
  height: 3rem;
}

.link-favicon {
  width: 3rem;
  height: 3rem;
  border-radius: 18%;
  background: var(--fill);
  border: 0;
  object-fit: cover;
}

.link-favicon-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: 18%;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #fff;
  background: var(--cat);
}

.link-body,
.tile-body {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.link-name,
.tile-name {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.link-desc,
.tile-desc {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.9375rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text-muted);
  line-height: 1.35;
  white-space: normal;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.link-domain { display: none; }
.link-arrow { display: none; }

.tile-cta {
  margin-top: auto;
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: -0.01em;
}

.tile-cta::after {
  content: ' ›';
}

/* ── Footer ── */
.footer,
.site-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 2.75rem;
  padding: 0 1.5rem;
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text-dim);
  text-align: center;
}

.footer-copy {
  margin: 0;
  color: var(--text-muted);
}

.footer-note {
  margin: 0;
  color: var(--text-dim);
}

.footer-emoji {
  display: none;
}

/* ── Empty ── */
.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
  font-size: 1.0625rem;
  font-weight: 400;
  letter-spacing: -0.015em;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  margin: 0.75rem;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}

/* ── Scroll reveal（官网式滚动渐显）── */
.reveal {
  opacity: 0;
  transform: translate3d(0, 40px, 0);
  transition:
    opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--reveal-i, 0) * 70ms);
  will-change: opacity, transform;
}

.reveal.is-in {
  opacity: 1;
  transform: none;
}

.reveal-unit {
  /* 外壳只做位移，透明度由内部标题/瓷砖承担，避免整块「闪一下」 */
  opacity: 1;
  transform: translate3d(0, 48px, 0);
  transition:
    transform 1s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: 0ms;
}

.reveal-unit.is-in {
  transform: none;
}

.reveal-unit:not(.is-in) .reveal {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
}

.tile.reveal {
  transition-delay: calc(var(--reveal-i, 0) * 80ms + 120ms);
}

.unit-header.reveal {
  transition-delay: 40ms;
}

.site-hero .reveal {
  transform: translate3d(0, 28px, 0);
  transition-duration: 0.95s;
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-unit,
  .reveal-unit:not(.is-in) .reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

@media (min-width: 720px) {
  .topbar-search .search-box {
    max-width: 560px;
  }
}

@media (max-width: 640px) {
  .topbar-inner {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .site-hero {
    padding-top: 2.25rem;
    padding-bottom: 1.75rem;
  }

  .home-body .nav-grid {
    padding: 0 0.55rem;
    gap: 0.55rem;
  }

  .unit-inner {
    padding: 1.75rem 1rem 1.5rem;
  }

  .tile-grid {
    grid-template-columns: 1fr;
  }

  .tile {
    min-height: 9.5rem;
    padding: 1.25rem 1.15rem 1.15rem;
  }

  .search-hint {
    display: none;
  }

  #search {
    padding-right: 1rem;
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .blob,
  .category,
  .clock-sep,
  .windmill,
  .windmill-blades,
  .modal {
    animation: none;
  }

  .link-card,
  .tile,
  #search,
  .btn,
  .user-menu-trigger {
    transition: none;
  }

  .link-card:hover,
  .tile:hover,
  .link-card:active,
  .btn:active:not(:disabled) {
    transform: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .topbar,
  .user-menu-panel,
  .modal-overlay {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .topbar {
    background: #161617;
  }

  .user-menu-panel {
    background: var(--surface);
  }

  .modal-overlay {
    background: rgba(0, 0, 0, 0.72);
  }
}

/* ── Buttons / auth ── */
.auth-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.5rem 1rem;
  border-radius: 980px;
  border: none;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 590;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 100ms ease-out, background 0.15s var(--ease), opacity 0.15s, color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-ghost {
  color: var(--accent);
  background: transparent;
  border: 0;
  border-radius: 980px;
}

.btn-ghost:hover {
  border-color: transparent;
  background: var(--fill);
}

.btn-primary {
  color: #fff;
  background: #1d1d1f;
  border-radius: 980px;
  box-shadow: none;
}

.btn-primary:hover {
  transform: none;
  filter: none;
  background: #000;
}

[data-theme='dark'] .btn-primary {
  background: #f5f5f7;
  color: #1d1d1f;
}

[data-theme='dark'] .btn-primary:hover {
  background: #fff;
}

.btn-secondary {
  color: var(--accent);
  background: var(--chip-bg);
  border: 0;
}

.btn-danger {
  color: #fff;
  background: #ff3b30;
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.8125rem;
}

.btn-block {
  width: 100%;
  padding: 0.75rem 1rem;
  min-height: 2.75rem;
}

.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 10.5rem;
  padding: 0.4rem 0.7rem 0.4rem 0.85rem;
  border: 0;
  border-radius: 999px;
  background: var(--fill);
  color: var(--topbar-text);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 510;
  letter-spacing: -0.01em;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s var(--ease), transform 100ms ease-out;
  -webkit-tap-highlight-color: transparent;
}

.user-menu-trigger:hover,
.user-menu.is-open .user-menu-trigger {
  border-color: transparent;
  background: var(--surface-soft);
}

.user-menu-trigger:active {
  transform: scale(0.97);
}

.user-menu-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-caret {
  width: 0;
  height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4.5px solid var(--text-muted);
  transition: transform 0.18s var(--ease);
}

.user-menu.is-open .user-menu-caret {
  transform: rotate(180deg);
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  z-index: 50;
  min-width: 11.5rem;
  padding: 0.35rem;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(40px) saturate(180%);
  -webkit-backdrop-filter: blur(40px) saturate(180%);
  border: 0.5px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-hover);
  display: none;
}

.user-menu.is-open .user-menu-panel {
  display: grid;
  gap: 0.08rem;
}

.user-menu-badge {
  min-width: 1.05rem;
  height: 1.05rem;
  padding: 0 0.28rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.05rem;
  text-align: center;
}

.user-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  padding: 0.48rem 0.72rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.12s var(--ease);
}

.user-menu-item:hover,
.user-menu-item:focus-visible {
  background: var(--surface-soft);
  outline: none;
}

.user-menu-item-count {
  min-width: 1.1rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
}

.user-menu-item-stack {
  align-items: flex-start;
}

.user-menu-item-main {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 0;
}

.user-menu-item-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
}

.user-menu-item-sub {
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 11rem;
}

.user-menu-sep {
  height: 1px;
  margin: 0.22rem 0.4rem;
  border: 0;
  background: var(--border);
}

.user-menu-danger {
  color: #ff3b30;
  font-weight: 510;
}

.user-chip {
  max-width: 7rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.32rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 510;
  letter-spacing: -0.01em;
  color: var(--topbar-text);
  background: var(--chip-bg);
  border-radius: 999px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  position: relative;
  width: min(100%, 400px);
  padding: 1.5rem 1.35rem 1.25rem;
  background: var(--surface);
  border: 0;
  border-radius: 20px;
  box-shadow: var(--shadow-hover);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  animation: fadeUp 0.35s var(--spring) both;
}

html.modal-open,
body.modal-open {
  overflow: hidden !important;
  overscroll-behavior: none;
  height: 100%;
  touch-action: none;
}

body.modal-open {
  position: fixed;
  left: 0;
  right: 0;
  width: 100%;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.85rem;
  width: 1.85rem;
  height: 1.85rem;
  border: none;
  border-radius: 999px;
  background: var(--fill);
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 100ms ease-out, background 0.15s var(--ease);
}

.modal-close:active {
  transform: scale(0.94);
}

.modal-title {
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin-bottom: 0.2rem;
}

.modal-hint {
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--text-muted);
  margin-bottom: 1.15rem;
}

.auth-form,
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.auth-form {
  gap: 0.85rem;
}

.field span {
  font-size: 0.8125rem;
  font-weight: 510;
  letter-spacing: -0.01em;
  color: var(--text-muted);
}

.field input,
.edit-page input {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 0;
  border-radius: 12px;
  background: var(--fill);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -0.01em;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: box-shadow 0.16s var(--ease), background 0.16s var(--ease);
}

.field input:focus,
.edit-page input:focus {
  background: var(--surface);
  border-color: transparent;
  box-shadow: 0 0 0 3.5px var(--search-focus);
}

.form-error {
  margin-top: 0.35rem;
  color: #ff3b30;
  font-size: 0.875rem;
  font-weight: 510;
}

.form-success {
  margin-top: 0.35rem;
  color: var(--accent-3);
  font-size: 0.875rem;
  font-weight: 510;
}

.modal-switch {
  margin-top: 1rem;
  text-align: center;
}

.link-btn {
  border: none;
  background: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  cursor: pointer;
}

/* ── Edit page ── */
.edit-page {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.edit-card {
  padding: 1.15rem 1.2rem;
  background: var(--surface);
  border: 2.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.edit-section-title {
  font-size: 1rem;
  font-weight: 800;
  margin-bottom: 0.85rem;
}

.edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}

.edit-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.edit-toolbar .edit-section-title {
  margin-bottom: 0;
}

.edit-categories {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.category-editor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.icon-input {
  width: 3.2rem !important;
  text-align: center;
}

.name-input {
  flex: 1;
  min-width: 140px;
}

.edit-links {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.edit-link-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr auto;
  gap: 0.45rem;
  align-items: center;
}

.edit-empty {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-dim);
  padding: 0.5rem 0;
}

@media (max-width: 720px) {
  .edit-grid,
  .edit-link-row {
    grid-template-columns: 1fr;
  }

  .greeting-chip,
  .topbar-clock {
    display: none;
  }

  .meal-actions {
    grid-template-columns: 1fr;
  }
}

/* ── Menu inbox (首页) ── */
.menu-inbox {
  position: relative;
  z-index: 1;
  margin: 0 auto 0.85rem;
  max-width: 1080px;
  padding: 0 max(1.4rem, env(safe-area-inset-left, 0px)) 0 max(1.4rem, env(safe-area-inset-right, 0px));
}

.menu-inbox[hidden] {
  display: none !important;
}

.menu-inbox-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.95rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: border-color 0.15s var(--ease), transform 0.15s var(--ease);
}

.menu-inbox-link:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.menu-inbox-badge {
  flex-shrink: 0;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.menu-inbox-badge.is-cook {
  background: linear-gradient(135deg, var(--accent-4), #f97316);
}

.menu-inbox-body {
  min-width: 0;
  flex: 1;
}

.menu-inbox-title {
  display: block;
  font-size: 0.88rem;
  font-weight: 800;
}

.menu-inbox-desc {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-inbox-arrow {
  color: var(--text-dim);
  font-weight: 800;
}

/* ── Menu page ── */
.menu-page .edit-section-title {
  margin-bottom: 0.35rem;
}

.menu-gate {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2.5rem 1rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.menu-gate p {
  margin-bottom: 1rem;
  font-weight: 700;
  color: var(--text-muted);
}

.meal-panel-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.meal-meta {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.meal-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  min-width: min(100%, 420px);
}

.meal-actions-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: min(100%, 280px);
}

.meal-tabs {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
  padding: 0.3rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.meal-tab {
  flex: 1 0 auto;
  min-width: 4.2rem;
  padding: 0.55rem 0.9rem;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 800;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}

.meal-tab.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.meal-tab:hover:not(.is-active) {
  background: var(--surface-soft);
  color: var(--text);
}

.slot-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.55rem;
  align-items: end;
  margin-bottom: 0.85rem;
}

.slot-manage-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.slot-manage-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  padding: 0.55rem 0.65rem;
  background: var(--card-tint);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.slot-manage-list li.is-disabled {
  opacity: 0.55;
}

.slot-manage-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.slot-manage-info strong {
  font-size: 0.88rem;
}

.slot-manage-info small {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-dim);
}

.slot-manage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  justify-content: flex-end;
}

.meal-field span {
  font-size: 0.72rem;
}

.meal-cook-text,
.meal-status-text {
  margin: 0;
  padding: 0.55rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--card-tint);
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
}

.meal-field select,
.field select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--card-tint);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
}

.meal-summary {
  padding-top: 0.35rem;
  border-top: 1px dashed var(--border);
}

.pick-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.pick-list li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  background: var(--card-tint);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.pick-emoji {
  font-size: 1.1rem;
}

.pick-name {
  flex: 1;
  font-weight: 800;
  font-size: 0.9rem;
}

.pick-by {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
}

.menu-hint {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
}

.dish-picker {
  display: grid;
  grid-template-columns: 5.6rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: start;
}

.dish-cat-nav {
  position: sticky;
  top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: calc(100dvh - 7rem);
  overflow-y: auto;
  padding-right: 0.1rem;
}

.dish-cat-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem;
  min-height: 2.65rem;
  padding: 0.7rem 0.55rem;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--card-tint);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.25;
}

.dish-cat-link-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dish-cat-link-count {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-dim);
}

.dish-cat-link.is-active,
.dish-cat-link:hover {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
}

.dish-cat-link.is-active {
  border-color: var(--accent);
  color: var(--accent);
}

.dish-catalog {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.dish-cat-block {
  scroll-margin-top: 0.75rem;
}

.dish-cat-heading {
  margin: 0 0 0.45rem;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text);
}

.dish-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.45rem;
}

.dish-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.65rem 0.3rem 0.55rem;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--card-tint);
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  min-width: 0;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.15s var(--ease);
}

.dish-tile:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.dish-tile.is-picked {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.dish-tile.is-disabled {
  opacity: 0.65;
  cursor: default;
}

.dish-emoji {
  font-size: 1.55rem;
  line-height: 1;
}

.dish-name {
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.dish-cat {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-dim);
}

.dish-form {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.6fr auto;
  gap: 0.55rem;
  align-items: end;
  margin-bottom: 0.85rem;
}

.dish-manage-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.dish-manage-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.55rem;
  background: var(--card-tint);
  border-radius: 12px;
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.86rem;
}

@media (max-width: 720px) {
  .menu-inbox {
    padding-left: max(0.75rem, env(safe-area-inset-left, 0px));
    padding-right: max(0.75rem, env(safe-area-inset-right, 0px));
  }

  .dish-form {
    grid-template-columns: 1fr 1fr;
  }

  .dish-form .btn {
    grid-column: 1 / -1;
  }

  .dish-picker {
    grid-template-columns: 4.8rem minmax(0, 1fr);
    gap: 0.5rem;
  }

  .dish-cat-nav {
    top: 0.4rem;
    max-height: calc(100dvh - 6rem);
  }

  .dish-cat-link {
    min-height: 2.8rem;
    padding: 0.65rem 0.35rem;
    font-size: 0.7rem;
  }

  .dish-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.35rem;
  }
}

@media (min-width: 900px) {
  .dish-picker {
    grid-template-columns: 7.5rem minmax(0, 1fr);
  }

  .dish-cat-link {
    min-height: 2.85rem;
    padding: 0.75rem 0.6rem;
    font-size: 0.8rem;
  }

  .dish-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ── Messages（官网风）── */
.messages-page {
  padding-top: 0.5rem;
  max-width: 720px;
}

.messages-hero {
  text-align: center;
  padding: 1.75rem 0.5rem 1.5rem;
}

.messages-display {
  font-size: clamp(2.25rem, 7vw, 3.25rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.05;
  color: var(--text);
  margin: 0 0 0.45rem;
}

.messages-page .messages-card {
  position: relative;
  z-index: 1;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.messages-toolbar {
  display: none;
}

.messages-unread {
  font-size: 1.0625rem;
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--text-muted);
  background: transparent;
  padding: 0;
  border-radius: 0;
  margin: 0;
  min-height: 1.4em;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.message-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  padding: 1.1rem 1.25rem;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.16s var(--ease), transform 100ms ease-out;
  -webkit-tap-highlight-color: transparent;
}

.messages-list .message-item:last-child {
  border-bottom: 0;
}

.message-item:hover {
  background: var(--fill);
}

.message-item:active {
  transform: scale(0.995);
  background: var(--fill);
}

.message-item.is-unread {
  background: transparent;
}

.message-dot {
  width: 0.5rem;
  height: 0.5rem;
  margin-top: 0.45rem;
  border-radius: 50%;
  background: transparent;
  flex-shrink: 0;
}

.message-item.is-unread .message-dot {
  background: var(--accent);
}

.message-main {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.message-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.message-kind {
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--accent);
}

.message-time {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.message-title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.25;
}

.message-item:not(.is-unread) .message-title {
  font-weight: 400;
}

.message-body {
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.messages-empty {
  text-align: center;
  padding: 3.5rem 1.25rem;
  font-size: 1.0625rem;
  font-weight: 400;
  color: var(--text-muted);
  background: var(--surface);
  border-radius: var(--radius-lg);
}

.messages-page .menu-gate {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: none;
  padding: 3rem 1.5rem;
  text-align: center;
}

.messages-page .menu-gate p {
  font-weight: 400;
  letter-spacing: -0.015em;
  font-size: 1.0625rem;
  margin-bottom: 1.25rem;
  color: var(--text-muted);
}

.nav-sep {
  color: var(--topbar-muted);
  opacity: 0.5;
  font-weight: 300;
  margin: 0 0.15rem;
}

/* ── Order cart (外卖式) ── */
.edit-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.dish-tile-wrap {
  position: relative;
  min-width: 0;
}

.dish-tile-wrap .dish-tile {
  width: 100%;
  height: 100%;
}

.dish-remove-btn {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  z-index: 2;
  padding: 0.12rem 0.35rem;
  border: none;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.92);
  color: #fff;
  font-family: inherit;
  font-size: 0.58rem;
  font-weight: 800;
  cursor: pointer;
}

.dish-modal {
  max-width: 26rem;
}

.dish-cart-tag {
  margin-top: 0.1rem;
  font-size: 0.58rem;
  font-weight: 800;
  color: var(--accent);
}

.dish-cart-tag.is-others {
  color: var(--accent-4);
}

.dish-tile.is-mine-cart {
  border-color: var(--accent);
}

.cart-live-block + .cart-live-block {
  margin-top: 0.75rem;
}

.cart-live-title {
  margin-bottom: 0.35rem;
  font-size: 0.76rem;
  font-weight: 800;
  color: var(--text-muted);
}

.cart-section-label {
  margin-top: 0.45rem !important;
  padding-top: 0.55rem !important;
  border-top: 1px dashed var(--border) !important;
  font-size: 0.72rem !important;
  font-weight: 800 !important;
  color: var(--text-muted) !important;
}

.cart-other-block {
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 0.2rem !important;
}

.cart-other-user {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--accent);
}

.cart-other-items {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

body.has-order-cart .menu-page {
  padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
}

.order-cart-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 60;
  transform: translateX(-50%);
  width: min(1080px, 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 1rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-top: 1.5px solid var(--border);
  backdrop-filter: blur(10px);
  box-shadow: 0 -8px 24px rgba(30, 58, 95, 0.08);
}

.order-cart-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 800;
  cursor: pointer;
}

.order-cart-icon {
  font-size: 1.2rem;
}

.order-cart-sheet {
  position: fixed;
  left: 50%;
  bottom: calc(4.2rem + env(safe-area-inset-bottom, 0px));
  z-index: 59;
  transform: translateX(-50%);
  width: min(1080px, 100%);
  padding: 0 0.75rem;
  pointer-events: none;
}

.order-cart-sheet-inner {
  pointer-events: auto;
  max-height: min(45vh, 22rem);
  overflow: auto;
  padding: 0.75rem 0.85rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 16px 16px 12px 12px;
  box-shadow: 0 12px 28px rgba(30, 58, 95, 0.14);
}

.order-cart-sheet-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.order-cart-sheet-top h3 {
  font-size: 0.95rem;
  font-weight: 800;
}

.order-cart-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.order-cart-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.35rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.86rem;
  font-weight: 700;
}

.order-cart-list li:last-child {
  border-bottom: none;
}
