/* ========== 主题变量(米白底 + 深灰文字 + 橘色点缀) ========== */
:root {
  --bg: #fafaf7;
  --surface: #ffffff;
  --border: #eceae4;
  --text: #2b2b2b;
  --text-soft: #6b6b6b;
  --text-muted: #9a9a9a;
  --accent: #e8743b;
  --accent-soft: #fdece2;
  --shadow: 0 1px 2px rgba(20, 20, 20, 0.04), 0 4px 12px rgba(20, 20, 20, 0.04);
  --radius: 10px;
  --radius-sm: 6px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.65;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }

/* ========== 顶部导航 ========== */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.5px;
}
.brand .dot { color: var(--accent); }
.nav-links {
  display: flex;
  gap: 20px;
  font-size: 14px;
  color: var(--text-soft);
}
.nav-search {
  flex: 0 1 320px;
  display: flex;
  gap: 8px;
}
.nav-search input {
  flex: 1;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  font: inherit;
  color: inherit;
  outline: none;
}
.nav-search input:focus { border-color: var(--accent); }

/* ========== 通用容器 ========== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}
.page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
}
.page-sub {
  color: var(--text-soft);
  margin: 0 0 24px;
  font-size: 14px;
}

/* ========== 广告位 ========== */
.ad-slot {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin: 18px 0;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}
#ad-top { min-height: 90px; display: flex; align-items: center; justify-content: center; }
#ad-sidebar { min-height: 240px; display: flex; align-items: center; justify-content: center; }

/* ========== 列表卡片网格 ========== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.card-cover {
  aspect-ratio: 4 / 3;
  background: #f0ede6 url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="%23c8c1b2" stroke-width="1.5"><path d="M4 7h16M4 12h16M4 17h10"/></svg>') center/40px no-repeat;
  object-fit: cover;
  width: 100%;
}
.card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title { font-size: 15px; font-weight: 600; line-height: 1.4; }
.card-summary {
  font-size: 13px;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-meta {
  display: flex;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: auto;
}
.card-meta .accent { color: var(--accent); }

/* ========== 标签 / 小徽章 ========== */
.tag {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  margin-right: 6px;
}

/* ========== 分页 ========== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
}
.pagination button {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  color: var(--text);
}
.pagination button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pagination button:disabled { opacity: 0.45; cursor: not-allowed; }
.pagination .page-info { padding: 6px 12px; color: var(--text-soft); font-size: 13px; }

/* ========== 详情页布局 ========== */
.detail-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 28px;
}
@media (max-width: 900px) {
  .detail-wrap { grid-template-columns: 1fr; }
}
.article header .title {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 8px;
}
.article header .meta {
  color: var(--text-soft);
  font-size: 13px;
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.article .cover {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 18px;
  object-fit: cover;
  max-height: 420px;
}
.article .summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: var(--text-soft);
  margin: 0 0 22px;
}
.section-title {
  font-size: 17px;
  font-weight: 700;
  margin: 28px 0 12px;
  border-left: 3px solid var(--accent);
  padding-left: 10px;
}
.ingredients {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
}
.ingredients ul { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 24px; }
.ingredients li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed var(--border);
  break-inside: avoid;
  font-size: 14px;
}
.ingredients li:last-child { border-bottom: 0; }
.ingredients .amount { color: var(--text-soft); }

.steps { counter-reset: step; display: flex; flex-direction: column; gap: 16px; }
.step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.step::before {
  counter-increment: step;
  content: '步骤 ' counter(step);
  display: inline-block;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}
.step-body { min-width: 0; }
.step-body .text { white-space: pre-wrap; word-break: break-word; }
.step-body img {
  margin-top: 12px;
  border-radius: var(--radius-sm);
  width: 100%;
  max-height: 420px;
  object-fit: cover;
}

/* ========== 点赞按钮 ========== */
.like-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  color: var(--text);
  transition: all 0.15s ease;
}
.like-btn:hover { border-color: var(--accent); color: var(--accent); }
.like-btn.liked { background: var(--accent); color: #fff; border-color: var(--accent); }
.like-btn .heart { font-size: 15px; }

/* ========== 评论区 ========== */
.comments { margin-top: 36px; }
.comment-form {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.comment-form input, .comment-form textarea {
  font: inherit;
  color: inherit;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  resize: vertical;
  outline: none;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--accent); }
.comment-form .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
}
.btn-primary:hover { filter: brightness(0.96); }
.btn-ghost {
  background: transparent;
  color: var(--text-soft);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
}
.comment-list { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.comment-item {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: var(--radius);
}
.comment-item .meta { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.comment-item .meta strong { color: var(--text); font-weight: 600; margin-right: 8px; }
.comment-item .content { white-space: pre-wrap; word-break: break-word; font-size: 14px; }

/* ========== 状态 / 提示 ========== */
.empty, .loading {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
  font-size: 14px;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: rgba(30, 30, 30, 0.9);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 100;
}
.toast.show { opacity: 1; }

/* ========== 底部 ========== */
.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 24px 10px 36px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
  background: var(--surface);
}

/* ========== 后台表单 ========== */
.form-grid {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px 16px;
  align-items: start;
}
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.form-grid label { padding-top: 8px; color: var(--text-soft); font-size: 14px; }
.form-grid input, .form-grid textarea, .form-grid select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  color: inherit;
  background: var(--surface);
  outline: none;
}
.form-grid textarea { min-height: 90px; }
.form-grid input:focus, .form-grid textarea:focus { border-color: var(--accent); }
.repeater { display: flex; flex-direction: column; gap: 8px; }
.repeater-row {
  display: grid;
  grid-template-columns: 1fr 160px auto;
  gap: 8px;
  align-items: center;
}
.repeater-row.step-row { grid-template-columns: 1fr auto auto; }
.repeater button.del {
  background: transparent;
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-soft);
}
.repeater button.add {
  align-self: flex-start;
  background: transparent;
  border: 1px dashed var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-soft);
}
.preview-img {
  max-width: 120px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ========== Top 列表(排行榜) ========== */
.top-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.top-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.top-row:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}
.top-row .rank {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  min-width: 28px;
  text-align: center;
}
.top-row .thumb {
  width: 64px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}
.top-row .thumb.placeholder {
  width: 64px;
  height: 48px;
}
.top-row .info {
  flex: 1;
  min-width: 0;
}
.top-row .info .card-title {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top-row .likes {
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}

/* ========== 语言切换器 ========== */
.lang-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font: inherit;
  font-size: 13px;
  color: var(--text-soft);
  cursor: pointer;
  outline: none;
}
.lang-select:hover { border-color: var(--accent); }
