/* 潮客人家自家点菜谱样式表（适老化大字版，红绿色盲无障碍高对比配色） */

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

/* 遵循系统字号缩放规范：绝不在 html 或 :root 上写死 font-size */
body {
  margin: 0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 1.1875rem;
  line-height: 1.65;
  color: #141210;
  background-color: #FAF7F2;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

body.font-xl {
  font-size: 1.375rem;
}

body.has-menu-bar {
  padding-bottom: 6.5rem;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid #D97706;
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 页面主容器 */
.page-shell {
  width: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding: 1rem 0.9rem 3rem;
}

/* 顶部标题与字号切换栏 */
.site-header {
  background-color: #FFFFFF;
  border: 1.5px solid #D6CFC4;
  border-radius: 1rem;
  padding: 1.15rem 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 10px rgba(20, 18, 16, 0.04);
}

.header-top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-block {
  min-width: 0;
  flex: 1 1 14rem;
}

.site-title {
  margin: 0;
  font-size: 1.5em;
  line-height: 1.25;
  font-weight: 800;
  color: #0B3D6B;
  letter-spacing: 0.02em;
}

.site-subtitle {
  margin: 0.35rem 0 0;
  font-size: 0.92em;
  line-height: 1.5;
  color: #4A433B;
}

/* 所有按钮、标签、徽章严格使用 inline-flex 垂直水平居中 */
.btn,
.pill-btn,
.tag-btn,
.badge,
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  text-align: center;
}

.btn,
.pill-btn,
.tag-btn {
  min-height: 2.75rem;
  border-radius: 0.75rem;
  font-weight: 700;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn:active,
.pill-btn:active,
.tag-btn:active {
  transform: scale(0.98);
}

.font-toggle-btn {
  gap: 0.45em;
  padding: 0.6em 0.95em;
  font-size: 0.92em;
  background-color: #FEF3C7;
  color: #141210;
  border: 2px solid #92400E;
  flex-wrap: wrap;
}

.font-toggle-btn[aria-pressed="true"] {
  background-color: #0B3D6B;
  color: #FFFFFF;
  border-color: #0B3D6B;
}

.font-state-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0.25em 0.55em;
  border-radius: 999px;
  font-size: 0.85em;
  font-weight: 800;
  background-color: #FFFFFF;
  color: #141210;
  border: 1.5px solid #92400E;
}

.font-toggle-btn[aria-pressed="true"] .font-state-chip {
  background-color: #F59E0B;
  color: #141210;
  border-color: #F59E0B;
}

/* 随机配一桌区域 */
.picker-section {
  margin-bottom: 1rem;
}

.picker-launch-btn {
  width: 100%;
  min-height: 3.35rem;
  padding: 0.8em 1.1em;
  gap: 0.45em;
  flex-wrap: wrap;
  font-size: 1.05em;
  background-color: #0B3D6B;
  color: #FFFFFF;
  border: 2px solid #0B3D6B;
  border-radius: 0.95rem;
  box-shadow: 0 4px 12px rgba(11, 61, 107, 0.18);
}

.picker-launch-btn:hover {
  background-color: #082E52;
}

.picker-panel {
  margin-top: 0.85rem;
  background-color: #FFFDF8;
  border: 2px solid #92400E;
  border-radius: 1rem;
  padding: 1rem;
}

.picker-panel[hidden] {
  display: none;
}

.picker-panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  margin-bottom: 0.85rem;
}

.picker-panel-title {
  margin: 0;
  font-size: 1.15em;
  line-height: 1.35;
  color: #141210;
}

.picker-panel-desc {
  margin: 0.2rem 0 0;
  font-size: 0.88em;
  color: #4A433B;
}

.picker-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.picker-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.55rem;
  background-color: #FFFFFF;
  border: 1.5px solid #D6CFC4;
  border-radius: 0.85rem;
  padding: 0.85rem;
  text-align: left;
}

.picker-card-role {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  align-self: flex-start;
  padding: 0.3em 0.6em;
  border-radius: 0.5rem;
  font-size: 0.82em;
  font-weight: 700;
  background-color: #F3EDE2;
  color: #141210;
  border: 1px solid #C8BFB0;
}

.picker-card-open {
  width: 100%;
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.picker-card-name {
  font-size: 1.08em;
  font-weight: 800;
  line-height: 1.35;
  color: #0B3D6B;
}

.picker-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85em;
  color: #4A433B;
}

.picker-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.9rem;
}

.btn-amber {
  padding: 0.65em 1.1em;
  background-color: #F59E0B;
  color: #141210;
  border: 2px solid #92400E;
}

.btn-amber:hover {
  background-color: #D97706;
}

.btn-neutral {
  padding: 0.65em 1.1em;
  background-color: #F0EBE3;
  color: #141210;
  border: 1.5px solid #B8AEA0;
}

.btn-neutral:hover {
  background-color: #E5DEC9;
}

.btn-navy {
  padding: 0.65em 1.1em;
  background-color: #0B3D6B;
  color: #FFFFFF;
  border: 2px solid #0B3D6B;
}

.btn-navy:hover {
  background-color: #082E52;
}

.btn-selected {
  padding: 0.65em 1.1em;
  background-color: #FEF3C7;
  color: #141210;
  border: 2px solid #92400E;
}

/* 筛选与搜索区 */
.controls-panel {
  background-color: #FFFFFF;
  border: 1.5px solid #D6CFC4;
  border-radius: 1rem;
  padding: 1rem;
  margin-bottom: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
}

.category-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.pill-btn {
  padding: 0.55em 0.95em;
  font-size: 0.95em;
  background-color: #FAF7F2;
  color: #141210;
  border: 1.5px solid #C8BFB0;
  border-radius: 999px;
}

.pill-btn[aria-pressed="true"] {
  background-color: #0B3D6B;
  color: #FFFFFF;
  border-color: #0B3D6B;
}

.ingredient-filter-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-label {
  font-size: 0.95em;
  font-weight: 700;
  color: #141210;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag-btn {
  padding: 0.5em 0.9em;
  font-size: 0.92em;
  background-color: #FAF7F2;
  color: #141210;
  border: 1.5px solid #C8BFB0;
}

.tag-btn[aria-pressed="true"] {
  background-color: #FEF3C7;
  color: #141210;
  border: 2px solid #92400E;
}

.search-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.search-input {
  width: 100%;
  min-height: 2.9rem;
  padding: 0.55em 0.9em;
  font-size: 1em;
  line-height: 1.4;
  color: #141210;
  background-color: #FAF7F2;
  border: 1.5px solid #9A8F80;
  border-radius: 0.75rem;
}

.search-input::placeholder {
  color: #6B6257;
}

/* 风味徽章（几何图形 + 文字 + 高明度对比） */
.badge {
  gap: 0.3em;
  padding: 0.38em 0.7em;
  border-radius: 0.5rem;
  font-size: 0.82em;
  font-weight: 800;
  white-space: nowrap;
}

.badge-chaoshan {
  background-color: #0B3D6B;
  color: #FFFFFF;
  border: 2px solid #0B3D6B;
}

.badge-hakka {
  background-color: #F59E0B;
  color: #141210;
  border: 2px solid #F59E0B;
}

.badge-fusion {
  background-color: #FEF3C7;
  color: #0B3D6B;
  border: 2px solid #0B3D6B;
}

/* 菜谱列表状态与网格 */
.results-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.results-summary {
  margin: 0;
  font-size: 0.95em;
  color: #4A433B;
  font-weight: 600;
}

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

.recipe-card {
  display: flex;
  flex-direction: column;
  background-color: #FFFFFF;
  border: 1.5px solid #D6CFC4;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(20, 18, 16, 0.04);
}

.card-photo-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background-color: #EFE8DC;
  position: relative;
}

.card-img-box {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background-color: #EFE8DC;
  overflow: hidden;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-img-fallback {
  display: none;
  position: absolute;
  inset: 0;
  padding: 1rem;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 800;
  font-size: 1.2em;
  color: #0B3D6B;
  background-color: #F3EDE2;
}

.card-img-box.is-img-fallback .card-img,
.dialog-hero-wrap.is-img-fallback .dialog-hero-img {
  opacity: 0;
}

.card-img-box.is-img-fallback .card-img-fallback,
.dialog-hero-wrap.is-img-fallback .card-img-fallback {
  display: flex;
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 0.95rem 1rem 1rem;
  gap: 0.6rem;
}

.card-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.meta-text {
  font-size: 0.86em;
  font-weight: 700;
  color: #4A433B;
}

.card-title {
  margin: 0;
  font-size: 1.22em;
  line-height: 1.35;
  color: #141210;
}

.card-summary {
  margin: 0;
  font-size: 0.94em;
  line-height: 1.55;
  color: #4A433B;
  flex: 1 1 auto;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.25rem;
}

.card-actions .btn {
  flex: 1 1 8.5rem;
  font-size: 0.94em;
}

.empty-state {
  background-color: #FFFFFF;
  border: 1.5px solid #D6CFC4;
  border-radius: 1rem;
  padding: 2rem 1.25rem;
  text-align: center;
}

.empty-state p {
  margin: 0 0 1rem;
  font-size: 1.05em;
  color: #4A433B;
}

/* 底部常备魂料清单 */
.pantry-footer {
  margin-top: 1.75rem;
}

.pantry-card {
  background-color: #FFFFFF;
  border: 1.5px solid #D6CFC4;
  border-radius: 1rem;
  overflow: hidden;
}

.pantry-summary {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  min-height: 3.25rem;
  padding: 0.9rem 1rem;
  background-color: #F5EFE6;
  cursor: pointer;
  font-weight: 800;
  font-size: 1.02em;
  color: #0B3D6B;
}

.pantry-summary::-webkit-details-marker {
  display: none;
}

.pantry-toggle-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0.35em 0.7em;
  border-radius: 0.5rem;
  font-size: 0.85em;
  background-color: #FFFFFF;
  color: #141210;
  border: 1.5px solid #B8AEA0;
}

.pantry-card[open] .pantry-toggle-hint::after {
  content: "收起";
}

.pantry-card:not([open]) .pantry-toggle-hint::after {
  content: "展开查看";
}

.pantry-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1rem;
}

.pantry-col {
  background-color: #FAF7F2;
  border: 1.5px solid #D6CFC4;
  border-radius: 0.85rem;
  padding: 0.9rem 1rem;
}

.pantry-col-title {
  margin: 0 0 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05em;
}

.pantry-list {
  margin: 0;
  padding-left: 1.25em;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.94em;
}

/* 底部今日已点浮动条 */
.menu-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background-color: #FFFFFF;
  border-top: 2px solid #0B3D6B;
  box-shadow: 0 -4px 18px rgba(20, 18, 16, 0.14);
  padding: 0.7rem 0.9rem calc(0.7rem + env(safe-area-inset-bottom));
}

.menu-bar[hidden] {
  display: none;
}

.menu-bar-inner {
  max-width: 68rem;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.menu-bar-text {
  font-size: 1em;
  font-weight: 700;
  color: #141210;
}

.menu-bar-count {
  color: #0B3D6B;
  font-size: 1.15em;
  font-weight: 800;
}

.menu-bar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

/* 原生模态框 dialog 样式（严格遵守无无条件 display，并阻断背景滚动穿透） */
dialog {
  font-size: 1em;
  line-height: inherit;
  color: #141210;
  background-color: #FFFFFF;
  border: 2px solid #0B3D6B;
  border-radius: 1rem;
  padding: 0;
  width: min(94vw, 44rem);
  max-height: 90dvh;
  margin: auto;
  box-shadow: 0 18px 45px rgba(20, 18, 16, 0.35);
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
  background-color: rgba(24, 22, 20, 0.68);
  backdrop-filter: blur(3px);
}

.dialog-inner {
  display: flex;
  flex-direction: column;
}

.dialog-sticky-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background-color: #FFFFFF;
  border-bottom: 1.5px solid #D6CFC4;
}

.dialog-title {
  margin: 0;
  font-size: 1.25em;
  line-height: 1.3;
  color: #0B3D6B;
  min-width: 0;
}

.dialog-close-top {
  flex-shrink: 0;
  padding: 0.5em 0.95em;
  font-size: 0.94em;
  background-color: #F0EBE3;
  color: #141210;
  border: 1.5px solid #9A8F80;
}

.dialog-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dialog-hero-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 0.85rem;
  overflow: hidden;
  background-color: #EFE8DC;
}

.dialog-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dialog-meta-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
}

.dialog-meta-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.dialog-summary {
  margin: 0;
  font-size: 1em;
  color: #4A433B;
}

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

.ingredient-box {
  background-color: #FAF7F2;
  border: 1.5px solid #D6CFC4;
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
}

.section-heading {
  margin: 0 0 0.55rem;
  font-size: 1.05em;
  line-height: 1.3;
  color: #0B3D6B;
}

.plain-list {
  margin: 0;
  padding-left: 1.25em;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.steps-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.step-item {
  background-color: #FAF7F2;
  border: 1.5px solid #D6CFC4;
  border-radius: 0.85rem;
  padding: 0.85rem 0.95rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.step-num {
  flex-shrink: 0;
  width: 2.1em;
  height: 2.1em;
  border-radius: 999px;
  background-color: #0B3D6B;
  color: #FFFFFF;
  font-weight: 800;
  font-size: 0.95em;
}

.step-content {
  min-width: 0;
  flex: 1 1 auto;
}

.step-title {
  margin: 0 0 0.25rem;
  font-size: 1.02em;
  font-weight: 800;
  color: #141210;
}

.step-detail {
  margin: 0;
  font-size: 0.96em;
  line-height: 1.65;
  color: #2B2622;
}

.elder-tip-box {
  background-color: #FEF3C7;
  border: 2px solid #92400E;
  border-radius: 0.85rem;
  padding: 0.9rem 1rem;
}

.elder-tip-title {
  margin: 0 0 0.3rem;
  font-size: 1em;
  font-weight: 800;
  color: #141210;
}

.elder-tip-text {
  margin: 0;
  font-size: 0.96em;
  line-height: 1.6;
  color: #141210;
}

.dialog-bottom-close {
  width: 100%;
  min-height: 3.2rem;
  padding: 0.75em 1rem;
  font-size: 1.02em;
}

/* 买菜清单弹窗 */
.cart-dish-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cart-dish-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background-color: #FAF7F2;
  border: 1.5px solid #D6CFC4;
  border-radius: 0.75rem;
  padding: 0.6rem 0.8rem;
}

.cart-dish-name-btn {
  background: transparent;
  border: 0;
  padding: 0.25rem 0;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  line-height: 1.3;
  text-align: left;
  font-weight: 800;
  color: #0B3D6B;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.cart-remove-btn {
  padding: 0.45em 0.85em;
  font-size: 0.88em;
}

.copy-feedback {
  padding: 0.75rem 0.95rem;
  border-radius: 0.75rem;
  background-color: #FEF3C7;
  color: #0B3D6B;
  border: 2px solid #0B3D6B;
  font-weight: 800;
  text-align: center;
}

.copy-feedback[hidden] {
  display: none;
}

.cart-copy-btn {
  width: 100%;
  min-height: 3.3rem;
  padding: 0.75em 1rem;
  font-size: 1.04em;
}

/* 基于 em 的响应式断点，字号放大后也能合理折行 */
@media (min-width: 42em) {
  .page-shell {
    padding: 1.5rem 1.5rem 3.5rem;
  }

  .site-header {
    padding: 1.35rem 1.5rem;
  }

  .picker-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .recipe-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .ingredients-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .pantry-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 64em) {
  .recipe-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
