/* 页面基础样式 */
* {
  box-sizing: border-box;
}

body {
  margin: 0 auto;
  max-width: 720px;
  padding: 28px 18px 60px;
  background: #f7f6f2;
  color: #29362d;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  line-height: 1.7;
}

h1 {
  margin: 0 0 8px;
  font-size: 30px;
  letter-spacing: 1px;
}

h2 {
  margin: 0 0 14px;
  font-size: 21px;
}

body > p {
  color: #69736b;
}

a {
  color: #356b4b;
  text-underline-offset: 4px;
}

/* 家人点菜：菜品卡片 */
#menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}

article {
  min-width: 0;
  overflow: hidden;
  padding: 12px;
  background: #fff;
  border: 1px solid #e5e8df;
  border-radius: 20px;
  box-shadow: 0 5px 18px rgba(38, 59, 43, 0.04);
}

article img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 13px;
}

article h2 {
  margin: 12px 0;
  font-size: 18px;
}

article button {
  width: 100%;
}

/* 按钮 */
button {
  min-height: 46px;
  padding: 10px 18px;
  border: 0;
  border-radius: 12px;
  background: #356b4b;
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

button[aria-pressed="true"] {
  background: #e5efe5;
  color: #28573b;
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* 点菜汇总 */
#selected-summary {
  padding: 16px;
  background: #eaf0e5;
  color: #35583e;
  border-radius: 14px;
}

/* 管理页：表单和分区 */
form {
  margin: 24px 0;
  padding: 22px;
  background: #fff;
  border: 1px solid #e5e8df;
  border-radius: 20px;
}

form section {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid #edf0e9;
}

label {
  display: inline-block;
  margin-bottom: 8px;
  font-weight: 600;
}

input[type="text"],
textarea {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d9e0d5;
  border-radius: 12px;
  background: #fcfcf9;
  color: #29362d;
  font: inherit;
  font-size: 16px;
}

textarea {
  resize: vertical;
}

input[type="file"] {
  display: block;
  width: 100%;
  margin: 8px 0 14px;
  font: inherit;
  font-size: 14px;
}

input[type="file"]::file-selector-button {
  margin-right: 10px;
  padding: 8px 12px;
  border: 1px solid #d9e0d5;
  border-radius: 8px;
  background: #edf3e9;
  color: #35583e;
  cursor: pointer;
}

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

input:focus-visible,
textarea:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid #91ad74;
  outline-offset: 3px;
}

#save-recipe {
  width: 100%;
  margin-top: 16px;
}

#save-message,
#shopping-message {
  color: #496442;
  overflow-wrap: anywhere;
}

#recipe-list {
  display: grid;
  gap: 10px;
  padding: 0;
  list-style: none;
}

#recipe-list button {
  width: 100%;
  text-align: left;
  background: #fff;
  color: #35583e;
  border: 1px solid #d9e0d5;
}

/* 较窄的手机屏幕 */
@media (max-width: 380px) {
  #menu {
    grid-template-columns: 1fr;
  }

  form {
    padding: 16px;
  }
}
/* 点击分类时，平滑滚动到对应位置 */
html {
  scroll-behavior: smooth;
}

.menu-layout {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-top: 24px;
}

/* 左侧分类导航在滚动时保持可见 */
.category-nav {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.category-nav a {
  display: block;
  padding: 13px 4px;
  border: 1px solid #dce5d6;
  border-radius: 12px;
  background: #eaf0e5;
  color: #35583e;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
}

.category-nav a:hover,
.category-nav a:focus-visible {
  background: #356b4b;
  color: white;
}

/* 右侧每行只展示一道菜 */
#menu {
  display: block;
  min-width: 0;
  margin: 0;
}

#menu .category-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

#menu > section {
  margin-bottom: 32px;
  scroll-margin-top: 16px;
}

#menu article {
  margin: 0;
}

#menu article img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
/* 管理页的页面切换 */
[hidden] {
  display: none !important;
}

.admin-choices {
  display: grid;
  gap: 16px;
  margin: 28px 0;
}

.admin-choices button {
  padding: 26px 22px;
  text-align: left;
  font-size: 22px;
  border-radius: 18px;
}

.admin-choices small {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  font-weight: normal;
}

#editor-title,
#library-page > h2 {
  margin-top: 24px;
}

.back-home {
  background: #eaf0e5;
  color: #35583e;
}

/* 用自己的上传按钮，替代原生文件名提示 */
.upload-button {
  position: relative;
  display: inline-block;
  margin: 12px 0;
  padding: 10px 16px;
  border: 1px solid #d9e0d5;
  border-radius: 10px;
  background: #edf3e9;
  color: #35583e;
  cursor: pointer;
}

.upload-button .file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
}

.upload-button:focus-within {
  outline: 3px solid #91ad74;
  outline-offset: 3px;
}

#editor-page form section > div {
  color: #69736b;
  font-size: 14px;
}
/* 暖米色背景，搭配陶红色 */
body {
  background: #faf5ec;
  color: #443329;
}

h1 {
  color: #703b2b;
  font-family: "Songti SC", "STSong", serif;
}

body > h1 + p {
  color: #8a6a54;
  letter-spacing: 2px;
}

button {
  background: #a3442d;
}

button[aria-pressed="true"] {
  background: #f3dfc9;
  color: #783922;
}

article,
form {
  background: #fffdf8;
  border-color: #ebddca;
  box-shadow: 0 8px 24px rgba(104, 62, 31, 0.06);
}

.admin-choices button {
  background: #fffdf8;
  color: #703b2b;
  border: 1px solid #e6d2b8;
}

.admin-choices small {
  color: #8a6a54;
}

.back-home,
#back-library {
  background: #f1e5d5;
  color: #703b2b;
}

#selected-summary {
  background: #f3e6d2;
  color: #79452e;
}

.category-nav a {
  background: #f5eadb;
  border-color: #e7d6bd;
  color: #79452e;
}

.category-nav a:hover,
.category-nav a:focus-visible {
  background: #a3442d;
  color: white;
}

#recipe-list button {
  padding: 20px;
  background: #fffdf8;
  color: #703b2b;
  border-color: #e6d2b8;
}

.recipe-detail {
  margin-top: 20px;
  padding: 22px;
}

.recipe-detail h2 {
  margin-top: 18px;
  font-size: 26px;
}

.recipe-detail h3 {
  margin-top: 26px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ecdfcd;
  color: #91432d;
}

.recipe-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.95;
}

#detail-cover img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 14px;
}

#detail-category {
  color: #8a6a54;
}

.upload-button {
  background: #f7ecdc;
  border-color: #e6d2b8;
  color: #79452e;
}
#meal-page > h2 {
  margin-top: 24px;
}

#shopping-section {
  margin: 24px 0;
  padding: 22px;
  background: #fffdf8;
  border: 1px solid #e6d2b8;
  border-radius: 18px;
}

#shopping-checklist {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

#shopping-checklist li + li {
  border-top: 1px solid #eee3d4;
}

#shopping-checklist label {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  margin: 0;
  padding: 10px 0;
  cursor: pointer;
  font-weight: normal;
}

#shopping-checklist input {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: #a3442d;
}

#shopping-checklist input:checked + span {
  color: #9a9087;
  text-decoration: line-through;
}

#shopping-warning,
#meal-action-message {
  color: #8a6a54;
}

#meal-recipes {
  display: grid;
  gap: 18px;
  margin-bottom: 24px;
}

#meal-recipes article {
  margin: 0;
}

.secondary-button,
#finish-meal {
  background: #f1e5d5;
  color: #703b2b;
}