/* ===== 日系温暖风格 - 小安做菜 ===== */
:root {
  --primary: #e88c6a;
  --primary-light: #f4a584;
  --secondary: #f8e4d9;
  --bg: #faf9f5;
  --card-bg: #ffffff;
  --text: #5a4a42;
  --text-light: #8b7b73;
  --border: #f0e0d5;
  --highlight: #ffe4d6;
  --tip-bg: #fff5f0;
  --tip-border: #e88c6a;
  --accent: #ffb7a5;
  --shadow: 0 4px 20px rgba(232, 140, 106, 0.08);
  --shadow-hover: 0 8px 30px rgba(232, 140, 106, 0.15);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #faf9f5;
    --card-bg: #ffffff;
    --text: #5a4a42;
    --text-light: #8b7b73;
  }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  padding-bottom: 80px;
}

.app {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100vh;
}

/* ===== 头部 - 厨娘图片铺满背景 ===== */
.header {
  position: relative;
  padding: 30px 20px 40px;
  text-align: center;
  color: #fff;
  border-radius: 0 0 30px 30px;
  overflow: hidden;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: url('../images/chef2.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 0;
}

.header-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(232, 140, 106, 0.7) 0%, rgba(244, 165, 132, 0.6) 50%, rgba(249, 213, 196, 0.7) 100%);
  z-index: 1;
}

.header::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
  pointer-events: none;
  z-index: 2;
}

.chef-avatar {
  display: none;
}

.header-content {
  position: relative;
  z-index: 3;
}

/* 右下角装饰 - 覆盖水印 */
.header-corner {
  display: none;
}

.logo {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 3px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: relative;
}

.header .subtitle {
  font-size: 14px;
  opacity: 0.95;
  font-weight: 400;
  letter-spacing: 1px;
}

/* ===== 搜索栏 ===== */
.search-bar {
  padding: 16px 20px;
  background: transparent;
  margin-top: -20px;
  position: relative;
  z-index: 10;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: 25px;
  padding: 12px 20px;
  box-shadow: var(--shadow);
  border: 2px solid var(--secondary);
}

.search-icon {
  font-size: 16px;
  margin-right: 10px;
  opacity: 0.6;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 15px;
  outline: none;
}

.search-input::placeholder {
  color: var(--text-light);
}

/* ===== 主内容 ===== */
.main {
  padding: 16px 20px;
}

/* ===== 菜谱卡片 - 柔和圆角 ===== */
.recipe-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.recipe-card {
  background: var(--card-bg);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  display: block;
  transition: all 0.3s ease;
  border: 1px solid var(--border);
}

.recipe-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.recipe-card:active {
  transform: scale(0.98);
}

.card-cover {
  height: 180px;
  background: linear-gradient(135deg, #f9d5c4 0%, #f4c2b0 50%, #e88c6a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.card-emoji {
  font-size: 80px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));
}

.card-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255,255,255,0.95);
  color: var(--primary);
  font-size: 12px;
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.card-content {
  padding: 20px;
}

.card-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.card-subtitle {
  font-size: 14px;
  color: var(--text-light);
  margin-bottom: 14px;
}

.card-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 14px;
}

.meta-item {
  font-size: 13px;
  color: var(--text-light);
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  font-size: 12px;
  color: var(--primary);
  background: var(--secondary);
  padding: 5px 12px;
  border-radius: 15px;
  font-weight: 500;
}

/* ===== 底部导航 ===== */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 20px rgba(0,0,0,0.05);
  z-index: 100;
  border-radius: 20px 20px 0 0;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: #bbb;
  padding: 6px 24px;
  transition: all 0.2s;
}

.tab-item.active {
  color: var(--primary);
}

.tab-icon {
  font-size: 22px;
  margin-bottom: 3px;
}

.tab-text {
  font-size: 11px;
  font-weight: 500;
}

/* ===== 弹窗 ===== */
.modal, .overlay {
  display: none;
  position: fixed;
}

.modal {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--card-bg);
  border-radius: 24px;
  width: 88%;
  max-width: 360px;
  z-index: 200;
  box-shadow: 0 25px 80px rgba(0,0,0,0.15);
}

.modal.show, .overlay.show {
  display: block;
}

.overlay {
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(90, 74, 66, 0.4);
  z-index: 150;
  backdrop-filter: blur(4px);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-size: 18px;
  color: var(--text);
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #ccc;
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

.modal-body p {
  margin-bottom: 14px;
  color: var(--text);
  line-height: 1.7;
}

.modal-body ul {
  margin-left: 20px;
  margin-bottom: 18px;
}

.modal-body li {
  margin-bottom: 10px;
  color: var(--text-light);
}

.install-tip {
  background: var(--secondary);
  border-radius: 12px;
  padding: 14px 18px;
  margin-top: 18px;
}

.install-tip p {
  margin: 0;
  color: var(--primary);
  font-size: 14px;
  font-weight: 500;
}

/* ===== 详情页 ===== */
.back-bar {
  background: linear-gradient(135deg, #f9d5c4 0%, #e88c6a 100%);
  padding: 16px 20px;
  padding-top: calc(16px + env(safe-area-inset-top));
  border-radius: 0 0 24px 24px;
}

.back-btn {
  color: #fff;
  text-decoration: none;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.recipe-detail {
  padding: 0 20px 100px;
}

.detail-header {
  background: var(--card-bg);
  margin: 16px 0;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.detail-cover {
  height: 220px;
  background: linear-gradient(135deg, #f9d5c4 0%, #f4c2b0 50%, #e88c6a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.detail-emoji {
  font-size: 100px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.1));
}

.detail-info {
  padding: 24px;
}

.detail-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.detail-subtitle {
  font-size: 15px;
  color: var(--text-light);
  margin-bottom: 20px;
}

.detail-stats {
  display: flex;
  justify-content: space-around;
  padding: 18px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}

.stat {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 22px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-light);
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ===== 内容区块 ===== */
.section {
  background: var(--card-bg);
  margin: 16px 0;
  padding: 24px;
  border-radius: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 24px;
  background: linear-gradient(180deg, var(--primary) 0%, var(--accent) 100%);
  border-radius: 2px;
}

.section-title h2 {
  font-size: 18px;
  color: var(--text);
  font-weight: 600;
}

/* ===== 材料清单 - 柔和卡片 ===== */
.ingredient-group {
  margin-bottom: 20px;
}

.ingredient-group:last-child {
  margin-bottom: 0;
}

.group-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 12px;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}

.ingredient-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: 14px;
  margin-bottom: 10px;
  transition: all 0.2s;
}

.ingredient-item:hover {
  background: var(--secondary);
}

.ingredient-item:last-child {
  margin-bottom: 0;
}

.ingredient-name {
  font-size: 15px;
  color: var(--text);
  font-weight: 500;
}

.ingredient-amount {
  font-size: 14px;
  color: var(--text-light);
}

/* ===== 步骤 - 柔和风格 ===== */
.step-card {
  background: var(--bg);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}

.step-card:last-child {
  margin-bottom: 0;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.step-num {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(232, 140, 106, 0.3);
}

.step-title {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}

.step-body {
  padding-left: 50px;
}

.step-item {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 15px;
  line-height: 1.7;
}

.step-item:last-child {
  margin-bottom: 0;
}

.step-dot {
  color: var(--accent);
  font-weight: bold;
  font-size: 18px;
}

.step-tip {
  margin-top: 14px;
  background: var(--tip-bg);
  border-left: 4px solid var(--tip-border);
  padding: 14px 16px;
  border-radius: 0 12px 12px 0;
  font-size: 14px;
  color: var(--primary);
  font-weight: 500;
}

/* ===== 小贴士 ===== */
.tips-list {
  margin-bottom: 16px;
}

.tip-item {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.tip-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.tip-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tip-title::before {
  content: '✨';
}

.tip-content {
  color: var(--text-light);
  font-size: 14px;
  line-height: 1.7;
}

.key-points {
  background: var(--tip-bg);
  border-radius: 16px;
  padding: 18px 20px;
  font-size: 14px;
  color: var(--primary);
  line-height: 1.8;
  font-weight: 500;
}

/* ===== 引用 ===== */
.quote-section {
  background: linear-gradient(135deg, var(--secondary) 0%, #fff 100%);
  margin: 16px 0;
  padding: 30px 24px;
  border-radius: 24px;
  text-align: center;
  border: 1px solid var(--border);
}

.quote-text {
  display: block;
  font-size: 17px;
  color: var(--primary);
  font-style: italic;
  margin-bottom: 12px;
  font-weight: 500;
}

.quote-author {
  font-size: 14px;
  color: var(--text-light);
}

/* ===== 底部操作栏 ===== */
.detail-actions {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  padding: 14px 20px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
  display: flex;
  gap: 12px;
  z-index: 50;
  border-radius: 24px 24px 0 0;
}

.action-btn {
  flex: 1;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  border: none;
  padding: 16px 0;
  border-radius: 16px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(232, 140, 106, 0.3);
  transition: all 0.2s;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(232, 140, 106, 0.4);
}

.action-btn:active {
  transform: scale(0.98);
}

/* ===== 跟做模式 ===== */
.cooking-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  z-index: 300;
  flex-direction: column;
}

.cooking-modal.show {
  display: flex;
}

.cooking-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cooking-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  padding: 20px 24px;
  padding-top: calc(20px + env(safe-area-inset-top));
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 0 0 24px 24px;
}

.cooking-progress {
  font-size: 15px;
  font-weight: 500;
}

.cooking-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}

.cooking-step {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.cooking-step-content {
  background: var(--card-bg);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.cooking-step-title {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.cooking-step-number {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 600;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(232, 140, 106, 0.3);
}

.cooking-step-name {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
}

.cooking-items {
  margin-bottom: 20px;
}

.cooking-item {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 16px;
  line-height: 1.8;
}

.cooking-nav {
  background: #fff;
  padding: 18px 24px;
  padding-bottom: calc(18px + env(safe-area-inset-bottom));
  display: flex;
  gap: 14px;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
  border-radius: 24px 24px 0 0;
}

.nav-btn {
  flex: 1;
  background: var(--bg);
  color: var(--text);
  border: none;
  padding: 16px 0;
  border-radius: 16px;
  font-size: 16px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: var(--secondary);
}

.nav-btn.primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  box-shadow: 0 4px 16px rgba(232, 140, 106, 0.3);
}

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

/* ===== 高亮文本 ===== */
.highlight {
  background: var(--highlight);
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 500;
  color: var(--primary);
}

/* ===== 比例盒 ===== */
.ratio-box {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: #fff;
  padding: 18px 20px;
  border-radius: 16px;
  text-align: center;
  margin: 14px 0;
  box-shadow: 0 4px 16px rgba(232, 140, 106, 0.25);
}

.ratio-box strong {
  font-size: 16px;
  display: block;
  margin-bottom: 6px;
}

.ratio-box small {
  font-size: 13px;
  opacity: 0.9;
}

/* ===== 空状态 ===== */
.empty-state {
  text-align: center;
  padding: 70px 20px;
  color: var(--text-light);
}

.empty-state .emoji {
  font-size: 72px;
  margin-bottom: 20px;
  opacity: 0.8;
}

.empty-state p {
  font-size: 15px;
}

/* ===== 更新提示条 ===== */
.update-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: linear-gradient(135deg, #81c784 0%, #66bb6a 100%);
  color: white;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 9999;
  font-size: 15px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  font-weight: 500;
}

.update-bar button {
  background: white;
  color: #4caf50;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}