/* ============================================================
   我的菜谱 · 网页版原型
   配色延续 Android 项目的暖色调
   ============================================================ */

:root {
  --bg: #FFF8F6;
  --surface: #FFFFFF;
  --surface-2: #FBEDE6;
  --primary: #B8562B;
  --primary-weak: #FFF0E8;
  --text: #221A17;
  --text-2: #7B665C;
  --text-3: #AD9A91;
  --border: #F1E2DA;
  --shadow-sm: 0 1px 3px rgba(90, 45, 20, .07);
  --shadow-md: 0 6px 18px rgba(90, 45, 20, .10);
  --radius: 16px;

  --spicy-none: #4C9A5E;
  --spicy-mild: #CE9A25;
  --spicy-medium: #E0752E;
  --spicy-hot: #C4342B;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button {
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

input, textarea {
  -webkit-tap-highlight-color: transparent;
}

/* ==================== 手机容器 ==================== */

.phone {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.app {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

@media (min-width: 660px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 28px;
    background: #EFE2DA;
  }

  .phone {
    width: 402px;
    height: min(858px, calc(100dvh - 56px));
    min-height: 0;
    border: 9px solid #1B1A19;
    border-radius: 40px;
    box-shadow: 0 26px 60px rgba(60, 30, 15, .28);
    overflow: hidden;
  }

  .app {
    overflow-y: auto;
    border-radius: 31px;
    scrollbar-width: thin;
  }
}

/* ==================== 安装提示 ==================== */

/* ==================== 身份选择 ==================== */

.role-gate {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(34, 26, 23, .52);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.role-gate__inner {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  padding: 24px 20px 20px;
  border-radius: 22px;
  background: var(--bg);
  box-shadow: 0 26px 60px rgba(40, 20, 10, .32);
}

.role-gate__title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  text-align: center;
}

.role-gate__hint {
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--text-3);
  text-align: center;
}

.role-card {
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 3px;
  align-items: center;
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.role-card:hover { border-color: var(--primary); background: var(--primary-weak); }

.role-card__emoji {
  grid-row: 1 / 3;
  font-size: 26px;
  line-height: 1;
  text-align: center;
}

.role-card__name { font-size: 15.5px; font-weight: 500; }

.role-card__desc {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-2);
}

/* ==================== 顶部按钮组 ==================== */

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn--role {
  font-size: 17px;
  line-height: 1;
  overflow: hidden;
}

/* ==================== 底部导航 ==================== */

.tabbar {
  flex: 0 0 auto;
  display: flex;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tabbar__item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 9px 6px 8px;
  border: none;
  background: none;
  color: var(--text-3);
  font-size: 11.5px;
  cursor: pointer;
  transition: color .15s;
}
.tabbar__item svg { width: 22px; height: 22px; }
.tabbar__item.is-active { color: var(--primary); }

.tabbar__badge {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(6px);
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  background: #C4342B;
  color: #FFFFFF;
  font-size: 10.5px;
  line-height: 17px;
  text-align: center;
}

/* ==================== 点单列表 ==================== */

.orders {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 4px 20px 40px;
}

.order-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.order-card--done { opacity: .62; }

.order-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.order-card__name { font-size: 15.5px; font-weight: 500; }

.order-card__status {
  flex: 0 0 auto;
  padding: 2px 9px;
  border-radius: 9px;
  font-size: 11.5px;
}
.order-card__status--pending { background: var(--primary-weak); color: var(--primary); }
.order-card__status--done { background: #EAF5EC; color: #3E7C4C; }

.order-card__meta {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-3);
}

.order-card__note {
  margin-top: 9px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-2);
}

.order-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.order-card__actions .btn {
  padding: 9px 14px;
  font-size: 13.5px;
  border-radius: 11px;
}

.toast {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: min(360px, calc(100vw - 40px));
  padding: 13px 18px;
  border-radius: 13px;
  background: #B02E24;
  color: #FFFFFF;
  font-size: 13.5px;
  line-height: 1.55;
  text-align: center;
  box-shadow: 0 12px 28px rgba(120, 40, 30, .35);
}

.install-hint {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--primary-weak);
  border-bottom: 1px solid #F6DCCE;
}

.install-hint__text {
  flex: 1 1 auto;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: #8A3E1C;
}

.install-hint__close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: none;
  color: #B0724F;
  cursor: pointer;
}
.install-hint__close:hover { background: rgba(184, 86, 43, .12); }
.install-hint__close svg { width: 15px; height: 15px; }

/* ==================== 通用组件 ==================== */

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 50%;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn svg { width: 19px; height: 19px; }

.text-btn {
  border: none;
  background: none;
  padding: 6px 2px;
  font-size: 15px;
  color: var(--text-2);
  cursor: pointer;
  border-radius: 8px;
}
.text-btn:hover { color: var(--text); }
.text-btn--primary { color: var(--primary); font-weight: 500; }
.text-btn--primary:hover { color: #96411E; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 13px;
  padding: 12px 18px;
  font-size: 15px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn svg { width: 17px; height: 17px; }
.btn--block { width: 100%; }
.btn--danger {
  color: #B02E24;
  border-color: #F3D6D2;
  margin-top: 28px;
  background: #FFF6F5;
}
.btn--danger:hover { background: #FDEBE8; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 12px;
  background: linear-gradient(var(--bg) 72%, rgba(255, 248, 246, 0));
}

.topbar__title {
  margin: 0;
  font-size: 23px;
  font-weight: 600;
  letter-spacing: .2px;
}
.topbar__title--sm { font-size: 17px; font-weight: 500; }

.topbar--edit { padding-bottom: 8px; }

/* ==================== 搜索 ==================== */

.search { padding: 0 20px 12px; }

.search__input {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 11px 14px;
  font-size: 16px; /* iOS 上小于 16px 聚焦会放大页面 */
  font-family: inherit;
  color: var(--text);
}
.search__input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-weak);
}

/* ==================== 筛选 chips ==================== */

.filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px 0 4px;
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 20px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip-row--wrap {
  flex-wrap: wrap;
  overflow: visible;
  padding: 0;
}

.chip {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.chip:hover { border-color: var(--text-3); }
.chip[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 500;
}

.chip--spicy[aria-pressed="true"] {
  background: var(--chip-color, var(--primary));
  border-color: var(--chip-color, var(--primary));
  color: #fff;
}

.summary {
  margin: 12px 20px 10px;
  font-size: 12.5px;
  color: var(--text-3);
}

/* ==================== 菜谱网格 ==================== */

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 0 20px 120px;
}

.card {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .16s, box-shadow .16s;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.card:active { transform: translateY(0); }

.card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
}
.card__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 38px;
}

.card__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 7px; }

.card__name {
  margin: 0;
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card__tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.tag {
  font-size: 11px;
  line-height: 1.6;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  white-space: nowrap;
}
.tag--spicy { color: #fff; }
.tag--time { background: transparent; color: var(--text-3); padding: 0; }

/* ==================== 空状态 ==================== */

.empty {
  padding: 60px 40px 120px;
  text-align: center;
}
.empty__art { font-size: 56px; line-height: 1; margin-bottom: 16px; }
.empty__title { margin: 0 0 6px; font-size: 16px; font-weight: 500; }
.empty__hint { margin: 0; font-size: 13.5px; color: var(--text-3); }
.empty__seed { margin-top: 22px; }

/* ==================== 悬浮按钮 ==================== */

.fab {
  position: fixed;
  right: 22px;
  bottom: calc(26px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 20px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(184, 86, 43, .38);
  transition: transform .16s, box-shadow .16s;
}
.fab:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(184, 86, 43, .45); }
.fab:active { transform: translateY(0) scale(.97); }
.fab svg { width: 25px; height: 25px; }

@media (min-width: 660px) {
  .fab { position: absolute; right: 20px; bottom: 22px; }
}

/* ==================== 详情页 ==================== */

.hero {
  position: relative;
  height: 258px;
  background: var(--surface-2);
}
.hero__img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero__placeholder {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 76px;
  background: linear-gradient(140deg, #FFE6D6, #FFD2BA 55%, #F9C0A4);
}

.hero__btn {
  position: absolute;
  top: 16px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(32, 20, 14, .42);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.hero__btn:hover { background: rgba(32, 20, 14, .6); }
.hero__btn svg { width: 20px; height: 20px; }
.hero__btn--back { left: 16px; }
.hero__btn--edit { right: 16px; }

.detail-body { padding: 20px 20px 44px; }

.detail-title {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
}

.detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.block { margin-top: 30px; }

.block__title {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.block__title::after {
  content: "";
  display: block;
  width: 26px;
  height: 3px;
  margin-top: 7px;
  border-radius: 2px;
  background: var(--primary);
  opacity: .85;
}

.ingredients { list-style: none; margin: 0; padding: 0; }
.ingredients li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  font-size: 14.5px;
  border-bottom: 1px solid var(--border);
}
.ingredients li:last-child { border-bottom: none; }
.ingredients .amount { color: var(--text-2); white-space: nowrap; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li {
  position: relative;
  padding: 0 0 18px 38px;
  font-size: 14.5px;
  line-height: 1.65;
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-weak);
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 600;
}
.steps li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 11.5px;
  top: 30px;
  bottom: 6px;
  width: 1px;
  background: var(--border);
}

/* ==================== 表单 ==================== */

.form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 6px 20px 48px;
}

.cover-wrap {
  position: relative;
}

/* 用 label 包住，点击由浏览器原生触发文件选择，比 JS 调 click() 可靠 */
.cover-picker {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  border: 1.5px dashed #E2CEC4;
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  overflow: hidden;
  transition: border-color .15s, background .15s;
}
.cover-picker:hover { border-color: var(--primary); background: var(--primary-weak); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.cover-picker__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  font-size: 13.5px;
}
.cover-picker__empty svg { width: 30px; height: 30px; }

.cover-picker__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-picker__remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(32, 20, 14, .5);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.cover-picker__remove svg { width: 16px; height: 16px; }

.field { display: flex; flex-direction: column; gap: 9px; }

.field__label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

.field__input {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 16px; /* iOS 上小于 16px 聚焦会放大页面 */
  font-family: inherit;
  color: var(--text);
  width: 100%;
}
.field__input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-weak);
}
.field__input::placeholder { color: var(--text-3); }

.rows { display: flex; flex-direction: column; gap: 8px; }

.row { display: flex; align-items: center; gap: 8px; }

.row__input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 11px;
  padding: 11px 13px;
  font-size: 16px; /* iOS 上小于 16px 聚焦会放大页面 */
  font-family: inherit;
  color: var(--text);
}
.row__input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-weak);
}
.row__input::placeholder { color: var(--text-3); }

.row__del {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text-3);
  cursor: pointer;
}
.row__del:hover { color: #B02E24; border-color: #F3D6D2; background: #FFF6F5; }
.row__del svg { width: 16px; height: 16px; }

.row__index {
  flex: 0 0 auto;
  width: 22px;
  text-align: center;
  font-size: 13px;
  color: var(--text-3);
}

.add-row {
  align-self: flex-start;
  border: none;
  background: none;
  color: var(--primary);
  font-size: 13.5px;
  padding: 4px 0;
  cursor: pointer;
  border-radius: 8px;
}
.add-row:hover { color: #96411E; }

.form-error {
  margin: 0;
  padding: 11px 14px;
  border-radius: 11px;
  background: #FDEBE8;
  color: #B02E24;
  font-size: 13.5px;
}
