/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', sans-serif;
  background: #FFF8F0; color: #333; line-height: 1.5;
  min-height: 100vh; min-height: 100dvh;
  overflow-x: hidden;
}
input, textarea, button { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
.tag, .tag-taste, .tag-diff { cursor: pointer; }

/* ===== Nav Bar ===== */
.nav-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  padding-top: env(safe-area-inset-top);
  background: #C45C26; color: #fff;
  display: flex; align-items: center; justify-content: center;
  height: calc(44px + env(safe-area-inset-top));
}
.nav-back {
  position: absolute; left: 8px; bottom: 0; height: 44px;
  background: none; border: none; color: #fff; font-size: 28px;
  padding: 4px 12px;
  display: flex; align-items: center;
}
.nav-title { font-size: 17px; font-weight: 600; }
.nav-right {
  position: absolute; right: 12px; bottom: 0; height: 44px;
  display: flex; align-items: center;
}
.nav-setting-btn {
  background: none; border: none; color: #fff;
  font-size: 20px; padding: 4px 8px;
  -webkit-tap-highlight-color: transparent;
}

/* ===== Page Container ===== */
.page-container {
  padding-top: calc(44px + env(safe-area-inset-top));
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  min-height: 100vh; min-height: 100dvh;
}
.page { padding: 16px; }

/* ===== Card ===== */
.card {
  background: #fff; border-radius: 12px; padding: 16px;
  margin-bottom: 12px; box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}

/* ===== Buttons ===== */
.btn-primary {
  background: #C45C26; color: #fff; border: none; border-radius: 10px;
  padding: 12px 0; text-align: center; font-size: 15px; font-weight: 500;
  width: 100%; display: block; -webkit-tap-highlight-color: transparent;
}
.btn-secondary {
  background: #FFF0E6; color: #C45C26; border: none; border-radius: 10px;
  padding: 12px 0; text-align: center; font-size: 15px;
  width: 100%; display: block; -webkit-tap-highlight-color: transparent;
}
.btn-danger {
  background: #fff; color: #E74C3C; border: 1px solid #E74C3C; border-radius: 10px;
  padding: 11px 0; text-align: center; font-size: 14px;
  width: 100%; display: block;
}
.btn-row { display: flex; gap: 12px; }
.btn-row > * { flex: 1; }

/* ===== Tags ===== */
.tag {
  display: inline-block; padding: 4px 10px; border-radius: 6px;
  font-size: 12px; margin-right: 8px; margin-bottom: 6px;
  background: #FFF0E6; color: #C45C26;
  -webkit-tap-highlight-color: transparent;
}
.tag.active { background: #C45C26; color: #fff; }
.tag-taste { background: #FEF3E2; color: #E67E22; }
.tag-taste.active { background: #E67E22; color: #fff; }
.tag-diff { background: #EBF5FB; color: #2E86C1; }
.tag-diff.active { background: #2E86C1; color: #fff; }
.tag-wrap { display: flex; flex-wrap: wrap; }

/* ===== Form ===== */
.form-group { margin-bottom: 18px; }
.form-label { font-size: 14px; font-weight: 500; display: block; margin-bottom: 8px; }
.form-input {
  width: 100%; padding: 10px 12px; border: 1px solid #E8E8E8;
  border-radius: 10px; font-size: 14px; background: #fff;
  outline: none; -webkit-appearance: none;
}
.form-input:focus { border-color: #C45C26; }
.form-textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #E8E8E8;
  border-radius: 10px; font-size: 14px; background: #fff;
  min-height: 80px; resize: vertical; outline: none; -webkit-appearance: none;
}
.form-textarea:focus { border-color: #C45C26; }

/* ===== Section Title ===== */
.section-title {
  font-size: 16px; font-weight: 600; color: #333;
  margin: 20px 0 12px; padding-left: 10px;
  border-left: 3px solid #C45C26;
}

/* ===== Empty ===== */
.empty-tip { text-align: center; color: #999; font-size: 14px; padding: 50px 0; }

/* ===== Search ===== */
.search-bar {
  display: flex; align-items: center; background: #fff;
  border-radius: 10px; padding: 10px 14px; margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.search-bar input { flex: 1; border: none; outline: none; font-size: 14px; margin-left: 8px; background:transparent; }

/* ===== Recipe Card ===== */
.recipe-card { padding: 0; overflow: hidden; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.recipe-card-inner { display: flex; align-items: stretch; }
.recipe-img { width: 100px; min-height: 100px; object-fit: cover; flex-shrink: 0; }
.recipe-img-empty {
  width: 100px; min-height: 100px; background: #FFF0E6; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 36px;
}
.recipe-info { flex: 1; padding: 12px 14px; display: flex; flex-direction: column; justify-content: center; }
.recipe-name { font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.recipe-tags { display: flex; flex-wrap: wrap; margin-bottom: 4px; }
.recipe-meta { display: flex; gap: 10px; font-size: 12px; color: #999; }

/* ===== Action Row ===== */
.action-row { display: flex; gap: 12px; margin-bottom: 16px; }
.action-row > * { flex: 1; font-size: 13px; padding: 10px 0; }

/* ===== Filter Button ===== */
.search-filter-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.filter-btn {
  position: relative; width: 42px; height: 42px;
  border-radius: 10px; background: #fff; border: none;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; -webkit-tap-highlight-color: transparent;
}
.filter-icon { color: #888; }
.filter-badge {
  position: absolute; top: -4px; right: -4px;
  background: #C45C26; color: #fff; font-size: 10px;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
}

/* ===== Filter Panel (底部拉起 + 动画) ===== */
.fp-mask {
  position: fixed; inset: 0; z-index: 400;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(0,0,0,0);
  transition: background 0.3s ease;
}
.fp-mask.show { background: rgba(0,0,0,0.45); }
.fp-mask .fp-panel {
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.fp-mask.show .fp-panel {
  transform: translateY(0);
}
.fp-panel {
  background: #fff; border-radius: 16px 16px 0 0; width: 100%;
  height: 80vh; display: flex; flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}
.fp-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px; border-bottom: 1px solid #F0F0F0;
}
.fp-title { font-size: 17px; font-weight: 600; }
.fp-close { background: none; border: none; font-size: 18px; color: #999; padding: 4px 8px; }
.fp-body { display: flex; flex: 1; min-height: 0; overflow: hidden; }
.fp-sidebar {
  width: 80px; background: #F7F7F7; flex-shrink: 0;
  overflow-y: auto; border-right: 1px solid #ECECEC;
}
.fp-tab {
  position: relative; padding: 16px 0; text-align: center;
  font-size: 13px; color: #666;
  -webkit-tap-highlight-color: transparent; cursor: pointer;
}
.fp-tab.active { color: #C45C26; font-weight: 600; background: #fff; }
.fp-tab.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: #C45C26; border-radius: 0 2px 2px 0;
}
.fp-tab-badge {
  display: inline-block; background: #C45C26; color: #fff;
  font-size: 10px; width: 16px; height: 16px; line-height: 16px;
  border-radius: 50%; text-align: center; margin-left: 2px;
  vertical-align: middle; font-weight: 600;
}
.fp-content {
  flex: 1; overflow-y: auto; padding: 0 16px; -webkit-overflow-scrolling: touch;
  scrollbar-width: none; -ms-overflow-style: none;
}
.fp-content::-webkit-scrollbar { display: none; }
.fp-section { padding: 16px 0; }
.fp-section + .fp-section { border-top: 1px solid #F0F0F0; }
.fp-section-title {
  font-size: 14px; font-weight: 600; color: #C45C26;
  margin-bottom: 12px;
}

/* 标签网格：统一大小 3 列 */
.fp-tags-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.fp-tag {
  padding: 10px 0; border-radius: 8px; font-size: 13px;
  background: #F5F5F5; color: #333; border: 1px solid transparent;
  -webkit-tap-highlight-color: transparent;
  text-align: center; cursor: pointer;
}
.fp-tag.active { background: #FFF0E6; color: #C45C26; border-color: #C45C26; }
.fp-taste.active { background: #FEF3E2; color: #E67E22; border-color: #E67E22; }
.fp-ingr.active { background: #E8F8F0; color: #27AE60; border-color: #27AE60; }

/* 用时进度条 */
.fp-slider-section { padding: 10px 4px; }
.fp-slider-label {
  font-size: 15px; font-weight: 600; color: #C45C26;
  text-align: center; margin-bottom: 20px;
}
.fp-slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px; border-radius: 2px;
  background: linear-gradient(to right, #C45C26 0%, #C45C26 var(--pct, 0%), #E8E8E8 var(--pct, 0%), #E8E8E8 100%);
  outline: none;
}
.fp-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: #C45C26; border: 3px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  cursor: pointer;
}
.fp-slider-marks {
  display: flex; justify-content: space-between;
  margin-top: 10px; font-size: 10px; color: #999;
}
.fp-footer {
  display: flex; gap: 12px; padding: 12px 18px;
  border-top: 1px solid #F0F0F0;
}
.fp-clear {
  flex: 1; padding: 12px 0; border-radius: 10px;
  background: #F5F5F5; color: #666; border: none;
  font-size: 15px; -webkit-tap-highlight-color: transparent;
}
.fp-confirm {
  flex: 1; padding: 12px 0; border-radius: 10px;
  background: #C45C26; color: #fff; border: none;
  font-size: 15px; font-weight: 500; -webkit-tap-highlight-color: transparent;
}

/* ===== Detail ===== */
.detail-img { width: 100%; height: 220px; object-fit: cover; border-radius: 12px; margin-bottom: 12px; }
.detail-img-empty {
  width: 100%; height: 220px; background: #FFF0E6; border-radius: 12px;
  margin-bottom: 12px; display: flex; align-items: center; justify-content: center; font-size: 60px;
}
.detail-name { font-size: 22px; font-weight: 700; margin-bottom: 10px; }
.detail-rating { display: flex; align-items: center; margin-top: 6px; }
.rating-num { font-size: 20px; font-weight: 700; color: #F5A623; margin-right: 4px; }
.rating-count { font-size: 12px; color: #999; margin-left: 6px; }
.ingr-item { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #F5F5F5; }
.ingr-item:last-child { border-bottom: none; }
.ingr-item-name { font-weight: 500; }
.ingr-item-detail { color: #888; font-size: 13px; }
.step-item { padding: 14px; }
.step-item-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.step-item-num {
  width: 28px; height: 28px; border-radius: 50%; background: #C45C26; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600;
}
.step-item-tags { display: flex; gap: 8px; }
.step-fire-tag, .step-dur-tag {
  font-size: 12px; color: #C45C26; background: #FFF0E6;
  padding: 3px 8px; border-radius: 4px;
}
.step-item-desc { font-size: 14px; line-height: 1.6; color: #555; }
.detail-actions { display: flex; gap: 12px; margin-top: 24px; }
.detail-actions > * { flex: 1; }

/* ===== Ingredient Form ===== */
.ingr-card { padding: 12px; }
.ingr-form-row { display: flex; align-items: center; gap: 8px; }
.ingr-form-row .form-input { flex: 1; }
.ingr-amount-input { max-width: 70px; }
.ingr-unit-btn, .ingr-prep-btn {
  padding: 10px 10px; background: #F5F5F5; border-radius: 10px;
  font-size: 13px; color: #666; border: none; white-space: nowrap;
}
.ingr-row2 { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.ingr-del { font-size: 12px; color: #E74C3C; background: none; border: none; }

/* ===== Step Form ===== */
.step-card { padding: 14px; }
.step-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.step-num { font-size: 14px; font-weight: 600; color: #C45C26; }
.step-del { font-size: 12px; color: #E74C3C; background: none; border: none; }
.step-meta { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.step-fire-btn {
  padding: 8px 12px; background: #FFF0E6; border-radius: 8px;
  font-size: 13px; color: #C45C26; border: none;
}
.step-dur-wrap { display: flex; align-items: center; flex: 1; gap: 4px; }
.step-dur-wrap .form-input { flex: 1; }
.step-dur-unit { font-size: 12px; color: #999; }

/* ===== Image Picker ===== */
.img-picker {
  width: 120px; height: 120px; border-radius: 12px; overflow: hidden;
  border: 1px dashed #ddd; position: relative; cursor: pointer;
}
.img-picker img { width: 100%; height: 100%; object-fit: cover; }
.img-placeholder {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; background: #FAFAFA;
}
.img-plus { font-size: 32px; color: #ccc; }
.img-tip { font-size: 11px; color: #999; margin-top: 4px; }
.img-picker input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ===== Order Page ===== */
.order-card { padding: 0; overflow: hidden; }
.order-card-inner { display: flex; align-items: center; }
.order-img { width: 80px; height: 80px; object-fit: cover; flex-shrink: 0; }
.order-img-empty {
  width: 80px; height: 80px; background: #FFF0E6; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 30px;
}
.order-info { flex: 1; padding: 10px 12px; }
.order-name { font-size: 15px; font-weight: 600; display: block; margin-bottom: 4px; }
.order-counter { display: flex; align-items: center; padding-right: 12px; gap: 2px; }
.counter-btn {
  width: 32px; height: 32px; border-radius: 50%; border: none;
  font-size: 18px; font-weight: 600; display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.counter-plus { background: #C45C26; color: #fff; }
.counter-minus { background: #F5F5F5; color: #666; }
.counter-num { font-size: 15px; font-weight: 600; min-width: 28px; text-align: center; }
.bottom-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  background: #fff; padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
  display: flex; align-items: center; gap: 12px;
}
.bottom-bar.hidden { display: none; }
.bottom-info { flex: 1; }
.bottom-count { font-size: 15px; font-weight: 600; }
.bottom-clear { font-size: 12px; color: #999; margin-left: 10px; border: none; background: none; }
.bottom-btn { padding: 10px 24px; border-radius: 10px; font-size: 14px; width: auto; }

/* ===== Summary ===== */
.dish-item { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #F5F5F5; }
.dish-item:last-child { border-bottom: none; }
.dish-name { font-weight: 500; }
.dish-count { color: #C45C26; font-weight: 600; }
.summary-ingr-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #F5F5F5; }
.summary-ingr-row:last-child { border-bottom: none; }
.summary-ingr-left { display: flex; align-items: center; gap: 8px; }
.summary-ingr-name { font-weight: 500; }
.summary-prep-tag { font-size: 11px; padding: 2px 6px; background: #FFF0E6; color: #C45C26; border-radius: 4px; }
.summary-ingr-amount { color: #666; font-weight: 500; }
.prep-row { padding: 8px 0; border-bottom: 1px solid #F5F5F5; font-size: 14px; color: #555; }
.prep-row:last-child { border-bottom: none; }

/* ===== Review ===== */
.review-title { font-size: 20px; font-weight: 700; text-align: center; margin-bottom: 20px; }
.star-container { display: flex; align-items: center; justify-content: center; margin-bottom: 24px; gap: 4px; }
.star-touch { padding: 4px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.star-icon { font-size: 32px; transition: color 0.15s; }
.star-full { color: #F5A623; }
.star-half-lit { color: #F5A623; opacity: 0.55; }
.star-empty { color: #E0E0E0; }
.rating-display { font-size: 16px; font-weight: 600; color: #F5A623; margin-left: 10px; }
.review-item { padding: 14px; }
.review-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.review-stars { display: flex; align-items: center; }
.review-star { font-size: 16px; color: #E0E0E0; }
.review-star.lit { color: #F5A623; }
.review-rating-num { font-size: 14px; font-weight: 600; color: #F5A623; margin-left: 6px; }
.review-date { font-size: 11px; color: #BBB; }
.review-comment { font-size: 14px; color: #555; margin-bottom: 8px; line-height: 1.6; }
.review-improve {
  background: #FFF8E1; padding: 8px 12px; border-radius: 6px;
  font-size: 13px; color: #E67E22; margin-bottom: 8px;
}
.improve-label { font-weight: 600; }
.review-del { font-size: 11px; color: #CCC; background: none; border: none; }

/* ===== Action Sheet (自定义) ===== */
.action-sheet-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 300;
  display: flex; align-items: flex-end; justify-content: center;
}
.action-sheet {
  background: #fff; border-radius: 14px 14px 0 0; width: 100%;
  padding-bottom: env(safe-area-inset-bottom); max-height: 60vh; overflow-y: auto;
}
.action-sheet-item {
  padding: 14px; text-align: center; font-size: 16px;
  border-bottom: 1px solid #F5F5F5; -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.action-sheet-item:active { background: #F5F5F5; }
.action-sheet-cancel {
  padding: 14px; text-align: center; font-size: 16px; color: #999;
  margin-top: 6px; -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

/* ===== Confirm Modal ===== */
.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 300;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: #fff; border-radius: 14px; width: 280px; padding: 24px 20px 0; text-align: center;
}
.modal-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.modal-content { font-size: 14px; color: #666; margin-bottom: 20px; }
.modal-btns { display: flex; border-top: 1px solid #E8E8E8; }
.modal-btn {
  flex: 1; padding: 14px 0; font-size: 16px; border: none; background: none;
  -webkit-tap-highlight-color: transparent;
}
.modal-btn:first-child { border-right: 1px solid #E8E8E8; color: #666; }
.modal-btn:last-child { color: #C45C26; font-weight: 500; }

/* ===== Toast ===== */
.toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  background: rgba(0,0,0,0.7); color: #fff; padding: 12px 24px;
  border-radius: 10px; font-size: 14px; z-index: 999;
  pointer-events: none; opacity: 0; transition: opacity 0.3s;
}
.toast.show { opacity: 1; }

/* ===== Save Button ===== */
.save-btn { margin-top: 30px; margin-bottom: 24px; }
