/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #0F172A;
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
img { max-width: 100%; display: block; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }
input, textarea { font-family: inherit; outline: none; }
.hidden { display: none !important; }

/* ===== Phone Frame ===== */
#phone-frame {
  width: var(--phone-width);
  height: var(--phone-height);
  max-height: 100vh;
  background: var(--color-bg);
  border-radius: 40px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.5);
  position: relative;
}
@media (max-width: 480px) {
  body { background: var(--color-bg); }
  #phone-frame { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; box-shadow: none; }
}

#app {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  position: relative;
}

/* ===== Header ===== */
.app-header {
  height: var(--header-height);
  background: var(--color-bg-white);
  display: flex; align-items: center;
  padding: 0 var(--space-md);
  border-bottom: 1px solid var(--color-border-light);
  position: relative; flex-shrink: 0;
  z-index: 10;
}
.app-header h1 { font-size: var(--text-lg); font-weight: 600; flex: 1; text-align: center; }
.header-btn { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; color: var(--color-text); border-radius: var(--radius-sm); transition: background .2s; }
.header-btn:active { background: var(--color-border-light); }
.back-btn { position: absolute; left: var(--space-md); }
#header-action { position: absolute; right: var(--space-md); font-size: var(--text-sm); color: var(--color-primary); width: auto; padding: 0 var(--space-sm); }

/* ===== Tab Bar ===== */
.tab-bar {
  height: var(--tabbar-height);
  background: var(--color-bg-white);
  border-top: 1px solid var(--color-border-light);
  display: flex; flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2px;
  color: var(--color-text-tertiary); font-size: var(--text-xs);
  transition: color .2s;
}
.tab-item.active { color: var(--color-primary); }
.tab-item:active { transform: scale(0.95); }

/* ===== Page Container ===== */
#page-container {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  background: var(--color-bg);
}
.page { padding: var(--space-md); animation: fadeIn .25s ease; }
.page-no-padding { animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-sm);
  padding: 14px var(--space-lg); border-radius: var(--radius-lg);
  font-size: var(--text-base); font-weight: 600;
  transition: all .2s; text-align: center; width: 100%;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:active { background: var(--color-primary-light); }
.btn-accent { background: var(--color-accent); color: white; }
.btn-outline { background: transparent; color: var(--color-primary); border: 2px solid var(--color-primary); }
.btn-ghost { background: var(--color-border-light); color: var(--color-text-secondary); }
.btn-danger { background: var(--color-danger); color: white; }
.btn-sm { padding: 8px var(--space-md); font-size: var(--text-sm); width: auto; border-radius: var(--radius-md); }
.btn-icon { width: 40px; height: 40px; padding: 0; border-radius: var(--radius-full); }

.btn:disabled,
.btn.disabled {
  opacity: 0.5;
  filter: grayscale(0.5);
  cursor: not-allowed;
}
.btn:disabled:active,
.btn.disabled:active {
  transform: none;
}

/* ===== Cards ===== */
.card { background: white; border-radius: var(--radius-lg); padding: var(--space-lg); box-shadow: var(--shadow-sm); }
.card-tap { cursor: pointer; transition: transform .15s; }
.card-tap:active { transform: scale(0.98); }

/* ===== Login Page ===== */
.login-page {
  height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: var(--space-xl); background: linear-gradient(145deg, var(--color-primary), var(--color-primary-light));
}
.login-logo { font-size: 64px; margin-bottom: var(--space-md); }
.login-title { color: white; font-size: var(--text-2xl); font-weight: 700; margin-bottom: var(--space-xs); }
.login-subtitle { color: rgba(255,255,255,0.7); font-size: var(--text-sm); margin-bottom: var(--space-2xl); }
.login-card {
  width: 100%; background: white; border-radius: var(--radius-xl);
  padding: var(--space-xl); box-shadow: var(--shadow-xl);
}
.login-tabs { display: flex; gap: var(--space-sm); margin-bottom: var(--space-lg); background: var(--color-bg-gray); border-radius: var(--radius-md); padding: 4px; }
.login-tab { flex: 1; padding: 10px; text-align: center; font-size: var(--text-sm); font-weight: 600; color: var(--color-text-secondary); border-radius: var(--radius-sm); transition: all .2s; }
.login-tab.active { background: white; color: var(--color-primary); box-shadow: var(--shadow-sm); }

/* ===== Form Inputs ===== */
.form-group { margin-bottom: var(--space-md); }
.form-label { display: block; font-size: var(--text-sm); color: var(--color-text-secondary); margin-bottom: var(--space-xs); font-weight: 500; }
.form-input {
  width: 100%; padding: 12px var(--space-md); font-size: var(--text-base);
  border: 2px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-bg-gray); transition: all .2s;
}
.form-input:focus { border-color: var(--color-primary); background: white; }
textarea.form-input { min-height: 200px; resize: vertical; line-height: 1.6; }

/* ===== Home Page ===== */
.hero-section {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light));
  border-radius: var(--radius-xl); padding: var(--space-xl);
  color: white; margin-bottom: var(--space-lg);
}
.hero-title { font-size: var(--text-2xl); font-weight: 700; margin-bottom: var(--space-xs); }
.hero-subtitle { font-size: var(--text-sm); opacity: 0.8; }

.import-grid { display: flex; flex-direction: column; gap: var(--space-md); margin-bottom: var(--space-xl); }
.import-card {
  display: flex; align-items: center; gap: var(--space-md);
  padding: var(--space-lg); background: white;
  border-radius: var(--radius-lg); cursor: pointer;
  transition: all .2s; position: relative;
  border: 2px solid transparent;
}
.import-card:active { transform: scale(0.98); border-color: var(--color-primary-lighter); }
.import-card.recommended { background: linear-gradient(135deg, #fff, var(--color-primary-lighter)); border-color: var(--color-primary); }
.import-icon { width: 48px; height: 48px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 24px; flex-shrink: 0; }
.import-info { flex: 1; }
.import-title { font-size: var(--text-base); font-weight: 600; }
.import-desc { font-size: var(--text-xs); color: var(--color-text-secondary); margin-top: 2px; }
.recommend-badge { position: absolute; top: -6px; right: var(--space-md); background: var(--color-accent); color: white; font-size: 10px; padding: 2px 8px; border-radius: var(--radius-full); font-weight: 600; }

.section-title { font-size: var(--text-lg); font-weight: 600; margin-bottom: var(--space-md); display: flex; align-items: center; justify-content: space-between; }

/* ===== Recipe Card ===== */
.recipe-card { background: white; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); cursor: pointer; transition: all .2s; }
.recipe-card:active { transform: scale(0.97); }
.recipe-cover { height: 120px; display: flex; align-items: center; justify-content: center; font-size: 48px; }
.recipe-cover.cuisine-chuancai { background: linear-gradient(135deg, #E53E3E, #C53030); }
.recipe-cover.cuisine-yuecai { background: linear-gradient(135deg, #3182CE, #2C5282); }
.recipe-cover.cuisine-jiachangcai { background: linear-gradient(135deg, #38A169, #276749); }
.recipe-cover.cuisine-xican { background: linear-gradient(135deg, #D69E2E, #B7791F); }
.recipe-cover.cuisine-default { background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light)); }
.recipe-cover-letter { color: white; font-size: 36px; font-weight: 700; }
.recipe-card-body { padding: var(--space-md); }
.recipe-card-title { font-size: var(--text-base); font-weight: 600; margin-bottom: var(--space-xs); }
.recipe-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.recipe-card-meta { display: flex; gap: var(--space-md); font-size: var(--text-xs); color: var(--color-text-secondary); margin-top: var(--space-sm); }

.recipe-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-md); }

/* ===== Tags / Badges ===== */
.tag { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--radius-full); font-size: var(--text-xs); font-weight: 500; }
.tag-primary { background: var(--color-primary-lighter); color: var(--color-primary); }
.tag-accent { background: var(--color-accent-light); color: var(--color-accent); }
.tag-success { background: var(--color-success-light); color: var(--color-success); }
.tag-warning { background: var(--color-warning-light); color: var(--color-warning); }
.tag-danger { background: var(--color-danger-light); color: var(--color-danger); }
.tag-info { background: var(--color-info-light); color: var(--color-info); }
.tag-gray { background: var(--color-bg-gray); color: var(--color-text-secondary); }

/* Heat level badges */
.heat-high { background: var(--color-danger-light); color: var(--color-danger); }
.heat-medium { background: var(--color-warning-light); color: var(--color-warning); }
.heat-low { background: var(--color-info-light); color: var(--color-info); }

/* ===== Detail Page ===== */
.detail-cover {
  height: 200px; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: white; position: relative;
}
.detail-cover h2 { font-size: var(--text-3xl); font-weight: 700; margin-top: var(--space-sm); }
.detail-cover .cuisine-letter { font-size: 64px; font-weight: 700; opacity: 0.9; }

.detail-tags { display: flex; flex-wrap: wrap; gap: var(--space-sm); padding: var(--space-md); }
.detail-section { padding: var(--space-md); }
.detail-section h3 { font-size: var(--text-lg); font-weight: 600; margin-bottom: var(--space-md); }

.servings-control { display: flex; align-items: center; gap: var(--space-md); background: var(--color-bg-gray); border-radius: var(--radius-lg); padding: var(--space-sm) var(--space-md); }
.servings-btn { width: 36px; height: 36px; border-radius: var(--radius-full); background: white; display: flex; align-items: center; justify-content: center; font-size: var(--text-xl); font-weight: 600; box-shadow: var(--shadow-sm); }
.servings-btn:active { transform: scale(0.9); }
.servings-value { font-size: var(--text-lg); font-weight: 600; min-width: 60px; text-align: center; }

.ingredient-list { display: flex; flex-direction: column; gap: 1px; background: var(--color-border-light); border-radius: var(--radius-md); overflow: hidden; }
.ingredient-item { display: flex; align-items: center; padding: var(--space-md); background: white; }
.ingredient-name { flex: 1; font-weight: 500; }
.ingredient-amount { color: var(--color-text-secondary); font-size: var(--text-sm); }
.ingredient-edit { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; color: var(--color-text-tertiary); margin-left: var(--space-sm); }
.ingredient-section-label { font-size: var(--text-sm); color: var(--color-text-secondary); margin: var(--space-md) 0 var(--space-sm); font-weight: 500; }

.step-list { display: flex; flex-direction: column; gap: var(--space-md); }
.step-item { background: white; border-radius: var(--radius-lg); padding: var(--space-md); box-shadow: var(--shadow-sm); }
.step-header { display: flex; align-items: center; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.step-number { width: 28px; height: 28px; border-radius: var(--radius-full); background: var(--color-primary); color: white; display: flex; align-items: center; justify-content: center; font-size: var(--text-sm); font-weight: 600; flex-shrink: 0; }
.step-desc { font-size: var(--text-base); line-height: 1.6; }
.step-meta { display: flex; flex-wrap: wrap; gap: var(--space-sm); margin-top: var(--space-sm); }
.step-tip { background: var(--color-info-light); border-radius: var(--radius-sm); padding: var(--space-sm) var(--space-md); font-size: var(--text-sm); color: var(--color-info); margin-top: var(--space-sm); display: flex; gap: var(--space-sm); align-items: flex-start; }
.step-warning { background: var(--color-danger-light); border-radius: var(--radius-sm); padding: var(--space-sm) var(--space-md); font-size: var(--text-sm); color: var(--color-danger); margin-top: var(--space-sm); display: flex; gap: var(--space-sm); align-items: flex-start; }

.bottom-bar { position: absolute; bottom: 0; left: 0; right: 0; background: white; border-top: 1px solid var(--color-border-light); padding: var(--space-md); display: flex; gap: var(--space-md); z-index: 10; }

/* ===== Prep Plan Page ===== */
.prep-meal-card { background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light)); border-radius: var(--radius-xl); padding: var(--space-lg); color: white; margin-bottom: var(--space-lg); text-align: center; }
.prep-meal-time { font-size: var(--text-3xl); font-weight: 700; }
.prep-meal-label { font-size: var(--text-sm); opacity: 0.8; margin-top: var(--space-xs); }
.prep-total { display: flex; justify-content: center; gap: var(--space-xl); margin-top: var(--space-md); }
.prep-total-item { text-align: center; }
.prep-total-num { font-size: var(--text-xl); font-weight: 700; }
.prep-total-label { font-size: var(--text-xs); opacity: 0.7; }

.timeline { position: relative; padding-left: 40px; }
.timeline::before { content: ''; position: absolute; left: 15px; top: 0; bottom: 0; width: 2px; background: var(--color-border); }
.timeline-item { position: relative; margin-bottom: var(--space-md); }
.timeline-dot { position: absolute; left: -33px; top: 16px; width: 16px; height: 16px; border-radius: 50%; border: 3px solid white; box-shadow: 0 0 0 2px var(--color-border); z-index: 1; }
.timeline-dot.prep { background: var(--color-info); }
.timeline-dot.cook { background: var(--color-accent); }
.timeline-dot.done { background: var(--color-success); box-shadow: 0 0 0 2px var(--color-success); }
.timeline-time { font-size: var(--text-xs); color: var(--color-text-secondary); margin-bottom: 4px; }
.timeline-task { background: white; border-radius: var(--radius-lg); padding: var(--space-md); box-shadow: var(--shadow-sm); cursor: pointer; transition: all .2s; }
.timeline-task:active { transform: scale(0.98); }
.timeline-task.done { opacity: 0.5; text-decoration: line-through; }
.timeline-task-title { font-weight: 600; font-size: var(--text-base); }
.timeline-task-desc { font-size: var(--text-sm); color: var(--color-text-secondary); margin-top: 4px; }
.timeline-task-meta { display: flex; gap: var(--space-sm); margin-top: var(--space-sm); }

/* ===== Cooking Guide Page ===== */
.guide-progress-bar { height: 4px; background: var(--color-border-light); border-radius: var(--radius-full); overflow: hidden; margin: var(--space-md); }
.guide-progress-fill { height: 100%; background: var(--color-primary); border-radius: var(--radius-full); transition: width .3s; }
.guide-step-num { font-size: 72px; font-weight: 800; color: var(--color-primary-lighter); text-align: center; line-height: 1; }
.guide-step-desc { font-size: var(--text-lg); line-height: 1.6; text-align: center; padding: var(--space-md); }

.timer-container { display: flex; flex-direction: column; align-items: center; margin: var(--space-lg) 0; }
.timer-ring { width: 180px; height: 180px; border-radius: 50%; display: flex; align-items: center; justify-content: center; position: relative; }
.timer-inner { width: 150px; height: 150px; border-radius: 50%; background: white; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: var(--shadow-md); }
.timer-display { font-size: var(--text-3xl); font-weight: 700; font-variant-numeric: tabular-nums; }
.timer-label { font-size: var(--text-xs); color: var(--color-text-secondary); margin-top: 4px; }
.timer-controls { display: flex; gap: var(--space-md); margin-top: var(--space-lg); }
.timer-btn { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 24px; }
.timer-btn-start { background: var(--color-primary); color: white; }
.timer-btn-reset { background: var(--color-border-light); color: var(--color-text-secondary); }

.guide-bottom { display: flex; gap: var(--space-md); padding: var(--space-md); }
.guide-bottom .btn { flex: 1; }

/* ===== Collection / History Page ===== */
.filter-bar { display: flex; gap: var(--space-sm); overflow-x: auto; padding: var(--space-md) 0; -webkit-overflow-scrolling: touch; }
.filter-bar::-webkit-scrollbar { display: none; }
.filter-chip { padding: 6px var(--space-md); border-radius: var(--radius-full); background: white; font-size: var(--text-sm); color: var(--color-text-secondary); white-space: nowrap; border: 1px solid var(--color-border); transition: all .2s; }
.filter-chip.active { background: var(--color-primary); color: white; border-color: var(--color-primary); }

.history-item { display: flex; gap: var(--space-md); background: white; border-radius: var(--radius-lg); padding: var(--space-md); margin-bottom: var(--space-md); box-shadow: var(--shadow-sm); cursor: pointer; transition: all .2s; }
.history-item:active { transform: scale(0.98); }
.history-cover { width: 80px; height: 80px; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; font-size: 32px; flex-shrink: 0; }
.history-info { flex: 1; min-width: 0; }
.history-title { font-weight: 600; font-size: var(--text-base); margin-bottom: 4px; }
.history-meta { font-size: var(--text-xs); color: var(--color-text-secondary); }

/* ===== Profile Page ===== */
.profile-header { background: linear-gradient(135deg, var(--color-primary), var(--color-primary-light)); padding: var(--space-xl) var(--space-md); color: white; text-align: center; }
.profile-avatar { width: 72px; height: 72px; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-size: 32px; margin: 0 auto var(--space-sm); }
.profile-name { font-size: var(--text-xl); font-weight: 600; }
.profile-stats { display: flex; justify-content: center; gap: var(--space-xl); margin-top: var(--space-lg); }
.profile-stat { text-align: center; }
.profile-stat-num { font-size: var(--text-2xl); font-weight: 700; }
.profile-stat-label { font-size: var(--text-xs); opacity: 0.7; }

.profile-section { padding: var(--space-md); }
.profile-section h3 { font-size: var(--text-base); font-weight: 600; margin-bottom: var(--space-md); }
.setting-item { display: flex; align-items: center; justify-content: space-between; padding: var(--space-md); background: white; border-radius: var(--radius-md); margin-bottom: var(--space-sm); }
.setting-label { font-size: var(--text-base); }
.setting-value { font-size: var(--text-sm); color: var(--color-text-secondary); }

.cuisine-selector { display: flex; flex-wrap: wrap; gap: var(--space-sm); }
.cuisine-chip { padding: 6px var(--space-md); border-radius: var(--radius-full); font-size: var(--text-sm); border: 1px solid var(--color-border); background: white; transition: all .2s; }
.cuisine-chip.active { background: var(--color-primary); color: white; border-color: var(--color-primary); }

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: var(--space-2xl) var(--space-md); color: var(--color-text-tertiary); }
.empty-state-icon { font-size: 48px; margin-bottom: var(--space-md); }
.empty-state-text { font-size: var(--text-sm); }

/* ===== Loading ===== */
.loading-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 100; backdrop-filter: blur(4px); }
.loading-card { background: white; border-radius: var(--radius-xl); padding: var(--space-xl); text-align: center; min-width: 200px; }
.loading-spinner { width: 48px; height: 48px; border: 4px solid var(--color-border-light); border-top-color: var(--color-primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto var(--space-md); }
.loading-card p { font-size: var(--text-sm); color: var(--color-text-secondary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Toast ===== */
.toast-container { position: absolute; top: 70px; left: 50%; transform: translateX(-50%); z-index: 200; pointer-events: none; }
.toast { background: rgba(26, 32, 44, 0.92); color: white; padding: 10px var(--space-lg); border-radius: var(--radius-full); font-size: var(--text-sm); backdrop-filter: blur(8px); animation: toastIn .3s ease; margin-bottom: var(--space-sm); white-space: nowrap; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Modal ===== */
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: flex-end; justify-content: center; z-index: 150; backdrop-filter: blur(2px); animation: fadeIn .2s; }
.modal-sheet { background: white; border-radius: var(--radius-xl) var(--radius-xl) 0 0; width: 100%; max-height: 70%; overflow-y: auto; padding: var(--space-lg); animation: sheetUp .3s ease; }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle { width: 36px; height: 4px; background: var(--color-border); border-radius: var(--radius-full); margin: 0 auto var(--space-lg); }
.modal-title { font-size: var(--text-lg); font-weight: 600; margin-bottom: var(--space-md); text-align: center; }

/* ===== Info Banner ===== */
.info-banner { display: flex; gap: var(--space-sm); padding: var(--space-md); border-radius: var(--radius-md); font-size: var(--text-sm); margin-bottom: var(--space-md); align-items: flex-start; }
.info-banner.info { background: var(--color-info-light); color: var(--color-info); }
.info-banner.warning { background: var(--color-warning-light); color: var(--color-warning); }
.info-banner.danger { background: var(--color-danger-light); color: var(--color-danger); }

/* ===== Scrollbar ===== */
#page-container::-webkit-scrollbar { width: 0; }

/* ===== Action Sheet (for edit ingredient) ===== */
.edit-sheet input { margin-bottom: var(--space-sm); }

/* ===== Advance Prep Alert (备菜计划顶部强提醒) ===== */
.advance-prep-alert {
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
  border: 2px solid #F59E0B;
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-lg);
  animation: pulse-border 2s ease-in-out infinite;
}
@keyframes pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
}
.advance-prep-alert-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}
.advance-prep-alert-icon { font-size: 24px; }
.advance-prep-alert-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: #92400E;
}
.advance-prep-alert-body {
  font-size: var(--text-sm);
  color: #78350F;
  margin-bottom: var(--space-md);
  line-height: 1.4;
}
.advance-prep-item {
  background: rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-sm);
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid rgba(245, 158, 11, 0.3);
}
.advance-prep-item:active { transform: scale(0.98); }
.advance-prep-item.done {
  opacity: 0.6;
  background: rgba(220, 252, 231, 0.7);
  border-color: #86EFAC;
}
.advance-prep-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.advance-prep-item-title {
  font-weight: 600;
  color: #92400E;
  font-size: var(--text-base);
}
.advance-prep-item-badge {
  background: #DC2626;
  color: white;
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 100px;
  white-space: nowrap;
}
.advance-prep-item-time {
  font-size: var(--text-xs);
  color: #92400E;
  margin-bottom: 4px;
}
.advance-prep-item-desc {
  font-size: var(--text-sm);
  color: #78350F;
  line-height: 1.4;
}
.advance-prep-item-check {
  font-size: var(--text-xs);
  color: #92400E;
  margin-top: 4px;
  font-weight: 500;
}

/* ===== Pre-Cook Check (烹饪前检查页面) ===== */
.pre-check-section {
  background: var(--color-card);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}
.pre-check-section.has-warning {
  border: 2px solid #F59E0B;
  background: #FFFBEB;
}
.pre-check-section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-border-light);
}
.pre-check-count {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  background: var(--color-bg);
  padding: 2px 8px;
  border-radius: 100px;
}
.pre-check-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-xs);
}
.pre-check-item.done { opacity: 0.5; }
.pre-check-item.warning { background: #FEF3C7; }
.pre-check-checkbox {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}
.pre-check-checkbox.checked {
  background: #22C55E;
  color: white;
}
.pre-check-item:not(.done) .pre-check-checkbox {
  background: #F59E0B;
  color: white;
}
.pre-check-content { flex: 1; }
.pre-check-label { font-size: var(--text-base); font-weight: 500; color: var(--color-text); }
.pre-check-detail { font-size: var(--text-sm); color: var(--color-text-secondary); }
.pre-check-warn-text {
  font-size: var(--text-sm);
  color: #DC2626;
  font-weight: 500;
  margin-top: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  background: #FEE2E2;
  border-radius: var(--radius-sm);
}
.pre-check-items-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}
.pre-check-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: var(--space-xs) var(--space-sm);
  min-width: 80px;
}
.pre-check-chip > span:first-child { font-weight: 500; font-size: var(--text-base); }
.pre-check-chip-detail { font-size: var(--text-xs); color: var(--color-text-secondary); }
.pre-check-steps-overview {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}
.pre-check-step-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
}
.pre-check-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
  flex-shrink: 0;
}
.pre-check-step-text {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--color-text);
}
.pre-check-step-time {
  font-size: var(--text-xs);
  color: var(--color-info);
  white-space: nowrap;
}

/* ===== Recipe Card Delete Button ===== */
.recipe-card {
  position: relative;
}
.recipe-card-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 2;
}
.recipe-card:hover .recipe-card-delete,
.recipe-card:active .recipe-card-delete {
  opacity: 1;
}

/* ===== Section Title Clear Button ===== */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.btn-text-danger {
  background: none;
  border: none;
  color: var(--color-danger, #ef4444);
  font-size: var(--text-sm);
  cursor: pointer;
  padding: 4px 8px;
}
.btn-text-danger:hover {
  text-decoration: underline;
}

/* ===== History Item Delete Button ===== */
.history-item {
  position: relative;
}
.history-delete-btn {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-danger, #ef4444);
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}
.history-item:hover .history-delete-btn,
.history-item:active .history-delete-btn {
  opacity: 1;
}

/* ===== 语音交互控制栏 ===== */
.voice-control-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-md);
  background: var(--color-bg-secondary, #f5f5f5);
  border-radius: var(--radius-md, 12px);
  border: 1px solid var(--color-border-light, #e0e0e0);
}

.voice-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--color-border-light, #e0e0e0);
  color: var(--color-text-secondary, #999);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  position: relative;
}

.voice-toggle-btn.active {
  background: var(--color-primary, #ff6b35);
  color: white;
}

.voice-toggle-btn:active {
  transform: scale(0.92);
}

/* 开关按钮动画状态 */
.voice-toggle-btn.speaking {
  background: var(--color-primary, #ff6b35);
  animation: mic-pulse-speak 1.5s ease-in-out infinite;
}

.voice-toggle-btn.listening {
  background: var(--color-info, #1890ff);
  animation: mic-pulse-listen 1s ease-in-out infinite;
}

.voice-toggle-btn.processing {
  background: var(--color-text-secondary, #999);
  animation: mic-spin 1s linear infinite;
}

.voice-status-text {
  flex: 1;
  font-size: var(--text-sm, 14px);
  color: var(--color-text-secondary, #666);
  text-align: center;
  min-height: 20px;
  transition: color 0.2s;
}

.voice-status-text.speaking {
  color: var(--color-primary, #ff6b35);
  font-weight: 500;
}

.voice-status-text.listening {
  color: var(--color-info, #1890ff);
  font-weight: 500;
}

.voice-status-text.processing {
  color: var(--color-text-secondary, #999);
}

.voice-status-text.off {
  color: var(--color-text-tertiary, #ccc);
}

@keyframes mic-pulse-speak {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(255, 107, 53, 0); }
}

@keyframes mic-pulse-listen {
  0%, 100% { box-shadow: 0 0 0 0 rgba(24, 144, 255, 0.5); transform: scale(1); }
  50% { box-shadow: 0 0 0 10px rgba(24, 144, 255, 0); transform: scale(1.05); }
}

@keyframes mic-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ===== 文字输入降级（STT不可用时） ===== */
.voice-text-input {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  border: 1px solid var(--color-border-light, #e0e0e0);
  border-radius: var(--radius-md, 8px);
  font-size: var(--text-sm, 14px);
  background: var(--color-bg-primary, #fff);
  color: var(--color-text-primary, #333);
  outline: none;
  transition: border-color 0.2s;
}

.voice-text-input:focus {
  border-color: var(--color-primary, #ff6b35);
}

.voice-text-input:disabled {
  background: var(--color-bg-secondary, #f5f5f5);
  color: var(--color-text-tertiary, #ccc);
  cursor: not-allowed;
}

.voice-send-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-md, 8px);
  background: var(--color-primary, #ff6b35);
  color: white;
  font-size: var(--text-sm, 14px);
  cursor: pointer;
  transition: opacity 0.2s;
}

.voice-send-btn:active {
  transform: scale(0.95);
}

.voice-send-btn:disabled {
  background: var(--color-border-light, #e0e0e0);
  cursor: not-allowed;
}

/* ===== 语音权限请求弹窗 ===== */
.voice-perm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: background 0.3s ease;
  padding: var(--space-md);
}

.voice-perm-overlay.show {
  background: rgba(0, 0, 0, 0.5);
}

.voice-perm-modal {
  background: var(--color-bg, #fff);
  border-radius: 20px;
  padding: 32px 24px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.voice-perm-overlay.show .voice-perm-modal {
  transform: scale(1) translateY(0);
  opacity: 1;
}

.voice-perm-icon {
  font-size: 48px;
  margin-bottom: var(--space-sm);
  animation: voice-perm-bounce 2s ease-in-out infinite;
}

@keyframes voice-perm-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.voice-perm-title {
  font-size: var(--text-lg, 18px);
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--color-text, #333);
}

.voice-perm-desc {
  font-size: var(--text-sm, 14px);
  color: var(--color-text-secondary, #666);
  line-height: 1.6;
  margin-bottom: var(--space-lg, 20px);
}

.voice-perm-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
}

.voice-perm-actions .btn {
  flex: 1;
  max-width: 140px;
}
