/* 乐食 · 移动端壳层 */

.app-shell {
  --topbar-h: 52px;
  --tabbar-h: 58px;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  min-height: 100dvh;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--topbar-h);
  padding: calc(env(safe-area-inset-top, 0px) + 0.55rem) 2.75rem 0.55rem;
  background: rgba(247, 250, 248, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.app-topbar .brand-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  min-width: 0;
  text-align: center;
}

.app-topbar .brand {
  font-family: var(--font-display);
  font-size: 1.45rem;
  color: var(--brand-deep);
  text-decoration: none;
  letter-spacing: 0.08em;
  line-height: 1.1;
}

.app-topbar .brand-tag {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(70vw, 16rem);
}

.app-back {
  position: absolute;
  left: 0.45rem;
  top: calc(env(safe-area-inset-top, 0px) + 0.55rem);
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--brand-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.app-topbar-title {
  margin: 0;
}

.app-topbar-actions,
.topbar-user {
  display: none;
}

/* 查今日：摄入区占满首屏，下方饮食记录 */
#panel-today.is-active {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.app-shell .today-motto {
  margin: 0;
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(184, 140, 74, 0.22);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(255, 214, 153, 0.35) 0%, transparent 52%),
    radial-gradient(90% 80% at 0% 100%, rgba(26, 92, 69, 0.12) 0%, transparent 48%),
    linear-gradient(160deg, #fff8ee 0%, #f7f1e6 48%, #eef5f0 100%);
  box-shadow: 0 10px 28px rgba(120, 88, 40, 0.08);
  padding: 0;
}

.today-motto-inner {
  position: relative;
  padding: 1rem 1.15rem 1.05rem 1.2rem;
}

.today-motto-inner::before {
  content: "“";
  position: absolute;
  top: 0.15rem;
  right: 0.85rem;
  font-family: var(--font-display);
  font-size: 3.2rem;
  line-height: 1;
  color: rgba(184, 140, 74, 0.28);
  pointer-events: none;
}

.today-motto-kicker {
  margin: 0 0 0.45rem;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  color: #9a6b2f;
  font-weight: 600;
}

.today-motto-text {
  margin: 0;
  position: relative;
  z-index: 1;
  max-width: 92%;
  font-family: var(--font-display);
  font-size: 1.12rem;
  line-height: 1.58;
  color: #2a3d34;
  letter-spacing: 0.03em;
}

/* 识别向导：浅绿色步骤条 */
.app-shell .today-guide {
  appearance: none;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.95rem 0.9rem 0.85rem;
  text-align: left;
  color: inherit;
  cursor: pointer;
  border-radius: 18px;
  border: 1px solid rgba(76, 140, 110, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, transparent 42%),
    linear-gradient(125deg, #eef8f1 0%, #e4f3ea 48%, #f3faf5 100%);
  box-shadow: 0 8px 22px rgba(46, 110, 80, 0.08);
}

.app-shell .today-guide:active {
  transform: scale(0.992);
}

.today-guide-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.15rem;
}

.today-guide-step {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.today-guide-icon {
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #2f7a55;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(76, 140, 110, 0.16);
  box-shadow: 0 4px 12px rgba(46, 110, 80, 0.08);
}

.today-guide-icon svg {
  width: 1.2rem;
  height: 1.2rem;
}

.today-guide-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #2a5f45;
  letter-spacing: 0.02em;
}

.today-guide-arrow {
  flex: 0 0 auto;
  color: rgba(47, 122, 85, 0.4);
  font-size: 1.15rem;
  line-height: 1;
  margin-top: -1.1rem;
}

.today-guide-desc {
  margin: 0.75rem 0 0;
  text-align: center;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #4a7a60;
}

.app-shell .today-intake {
  margin: 0;
  max-width: none;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.1rem 1.05rem;
}

.app-shell .today-intake .today-date {
  margin: 0.15rem 0 0;
}

.app-shell .today-intake-body {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.85rem;
  margin-top: 0.65rem;
}

.app-shell .today-intake .today-grid {
  margin-top: 0;
  gap: 0.6rem;
}

.app-shell .today-intake .today-item {
  padding: 0.8rem 0.55rem;
}

.app-shell .today-intake .today-value {
  font-size: 1.4rem;
}

.app-shell .today-intake .progress-track {
  height: 8px;
}

.app-shell .today-records {
  margin: 0;
  max-width: none;
}

.today-meal-cards {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.today-meal-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
  color: inherit;
  appearance: none;
}

.today-meal-card:active {
  transform: scale(0.99);
}

.today-meal-thumb {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(26, 92, 69, 0.08);
  flex: 0 0 auto;
}

.today-meal-thumb.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
}

.today-meal-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.today-meal-meta strong {
  font-size: 0.95rem;
  color: var(--brand-deep);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-meal-meta span {
  font-size: 0.8rem;
  color: var(--muted);
}

.today-meal-kcal {
  flex: 0 0 auto;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.today-meal-kcal em {
  display: block;
  font-style: normal;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--brand);
}

.today-meal-kcal small {
  color: var(--muted);
  font-size: 0.72rem;
}

.app-main {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: 0.75rem 1rem 1.25rem;
  box-sizing: border-box;
}

.app-panel[hidden],
.app-subpanel[hidden] {
  display: none !important;
}

.app-panel.is-active {
  display: block;
  animation: shell-fade 0.28s ease both;
}

.app-subpanel {
  display: block;
  animation: shell-slide 0.28s ease both;
}

@keyframes shell-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes shell-slide {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: none; }
}

.shell-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1rem 1rem 0.95rem;
  backdrop-filter: blur(10px);
  margin-bottom: 0.85rem;
}

.analyze-kicker {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.cook-lead-compact {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
}

/* 底部 TabBar：与主内容同宽居中对齐 */
.tabbar {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: stretch;
  gap: 0;
  width: min(720px, 100%);
  transform: translateX(-50%);
  box-sizing: border-box;
  margin: 0;
  padding: 0.4rem 1rem calc(0.4rem + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(14px);
  box-shadow: 0 -8px 28px rgba(15, 61, 46, 0.06);
}

.tabbar-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  padding: 0.3rem 0.15rem;
  font-size: 0.58rem;
  line-height: 1.15;
  min-height: 50px;
}

.tabbar-icon {
  width: 22px;
  height: 22px;
}

.tabbar-item.is-active {
  color: var(--brand);
  font-weight: 600;
}

/* 制定计划：保存 / 返回 */
.app-shell .goal-form-actions {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.7rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--line);
}

.app-shell .goal-action-btn {
  min-height: 46px;
  width: 100%;
  border-radius: 14px;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.65rem 1rem;
}

.app-shell .goal-action-btn.btn-primary {
  box-shadow: 0 8px 18px rgba(26, 92, 69, 0.18);
}

.goal-recommend-method {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--muted);
}

.goal-field.is-recommended input {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(26, 92, 69, 0.15);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.app-shell .auth-modal.d-none {
  display: none !important;
}


.auth-drawer {
  width: min(520px, 100%);
  margin: 0;
  border-radius: 20px 20px 0 0;
  max-height: min(88vh, 720px);
  overflow: auto;
  animation: drawer-up 0.28s ease both;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
}

.auth-drawer-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: rgba(26, 92, 69, 0.2);
  margin: 0 auto 0.75rem;
}

@keyframes drawer-up {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}

/* 我的 */
.me-profile {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.me-avatar-btn {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: linear-gradient(145deg, #d8ebe2, #f7faf8);
  color: var(--brand-deep);
  overflow: visible;
  flex: 0 0 auto;
}

.me-avatar-img,
.me-avatar-fallback {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.me-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.6rem;
  background: linear-gradient(145deg, #cfe5db, #eef6f1);
}

.me-avatar-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  font-size: 0.65rem;
  line-height: 1;
  padding: 0.22rem 0.35rem;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  border: 2px solid #fff;
}

.me-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 650;
  color: var(--brand-deep);
}

.me-meta {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.me-guest-card p {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.me-guest-actions {
  display: flex;
  gap: 0.5rem;
}

.me-menu {
  padding: 0.25rem 0;
  overflow: hidden;
}

.me-menu-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.95rem 1rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  font-size: 0.95rem;
}

.me-menu-item:last-child {
  border-bottom: 0;
}

.me-menu-icon {
  width: 1.4em;
  color: var(--brand);
  text-align: center;
}

.me-menu-label {
  flex: 1;
}

.me-menu-arrow {
  color: var(--muted);
  font-size: 1.1rem;
}

.me-menu-danger .me-menu-label {
  color: #a33;
}

.about-brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--brand-deep);
}

.about-tag {
  margin: 0.35rem 0 0.9rem;
  color: var(--accent);
  font-size: 0.9rem;
}

.about-list {
  margin: 0.75rem 0;
  padding-left: 1.1rem;
  color: var(--muted);
}

.about-version {
  margin: 1rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

/* 壳层内隐藏旧桌面顶栏/页脚习惯 */
.app-shell .site-header,
.app-shell .site-footer {
  display: none !important;
}

.app-shell .hero-title {
  display: none;
}

.app-shell .main-wrap {
  max-width: none;
  padding-bottom: 0;
}

.app-shell .goal-form {
  display: block;
}

.app-shell .goal-form.d-none {
  display: none !important;
}

.app-shell .history-block.d-none {
  display: none !important;
}

@media (min-width: 768px) {
  .tabbar {
    border-radius: 16px 16px 0 0;
  }
}

.app-shell .copy-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 90;
  margin: 0;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: rgba(15, 61, 46, 0.92);
  color: #fff;
  font-size: 0.86rem;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(15, 61, 46, 0.2);
}

.pick-sheet {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
}

.pick-sheet.d-none {
  display: none !important;
}

.pick-sheet-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 61, 46, 0.4);
}

.pick-sheet-panel {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  padding: 0.5rem 0.75rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  animation: drawer-up 0.22s ease both;
}

.pick-sheet-caption {
  margin: 0 0 0.45rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--muted);
}

.pick-sheet-group {
  overflow: hidden;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 8px 28px rgba(15, 61, 46, 0.12);
}

.pick-sheet-group .pick-sheet-btn {
  margin: 0;
  border-radius: 0;
  border-bottom: 1px solid rgba(15, 61, 46, 0.08);
}

.pick-sheet-group .pick-sheet-btn:last-child {
  border-bottom: 0;
}

.pick-sheet-btn {
  display: block;
  width: 100%;
  margin: 0;
  padding: 1rem 1rem;
  border: 0;
  background: rgba(255, 255, 255, 0.98);
  color: var(--brand-deep);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.pick-sheet-btn:active {
  background: #eef5f1;
}

.pick-sheet-cancel {
  margin-top: 0.5rem;
  border-radius: 14px;
  font-weight: 600;
  color: var(--muted);
  box-shadow: 0 8px 28px rgba(15, 61, 46, 0.1);
}

/* 查配料 */
.ing-hero {
  margin: 0;
  padding: 1.15rem 1.1rem 1.2rem;
  border-radius: 18px;
  border: 1px solid rgba(26, 92, 69, 0.14);
  background: linear-gradient(160deg, #f4faf6 0%, #fff 55%, #f7f9f8 100%);
}

.ing-kicker {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--brand-deep);
  letter-spacing: 0.04em;
}

.ing-lead {
  margin: 0.45rem 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.ing-tip {
  margin: 0.75rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.45;
}

.ing-loading {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}

.ing-loading-dot {
  width: 2rem;
  height: 2rem;
  margin: 0 auto 0.85rem;
  border-radius: 50%;
  border: 2px solid rgba(26, 92, 69, 0.2);
  border-top-color: var(--brand);
  animation: ing-spin 0.8s linear infinite;
}

@keyframes ing-spin {
  to { transform: rotate(360deg); }
}

.ing-reject {
  padding: 1.15rem 1.1rem;
}

.ing-reject-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--brand-deep);
}

.ing-reject-text {
  margin: 0.5rem 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.ing-result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.ing-product {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--brand-deep);
}

.ing-summary {
  margin: 0.35rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.ing-verdict {
  flex: 0 0 auto;
  max-width: 7.5rem;
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  background: rgba(26, 92, 69, 0.1);
  color: var(--brand-deep);
}

.ing-verdict.is-strict {
  background: rgba(180, 60, 50, 0.12);
  color: #8f2f28;
}

.ing-verdict.is-mid {
  background: rgba(180, 130, 40, 0.14);
  color: #8a6420;
}

.ing-verdict.is-ok {
  background: rgba(26, 92, 69, 0.12);
  color: #1a5c45;
}

.ing-preview-wrap {
  margin-bottom: 0.85rem;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.ing-preview-wrap img {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: cover;
}

.ing-block {
  margin-bottom: 0.95rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.ing-block-title {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  color: var(--brand);
  font-weight: 600;
}

.ing-raw {
  margin: 0 0 0.65rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: #33443c;
}

.ing-list,
.ing-advice,
.ing-concerns {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ing-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid rgba(15, 61, 46, 0.06);
  font-size: 0.9rem;
}

.ing-list li:last-child {
  border-bottom: 0;
}

.ing-flag {
  color: #9a5a28;
  font-size: 0.78rem;
}

.ing-concern {
  display: flex;
  gap: 0.65rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(15, 61, 46, 0.06);
}

.ing-concern:last-child {
  border-bottom: 0;
}

.ing-level {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 600;
  background: rgba(26, 92, 69, 0.1);
  color: var(--brand-deep);
}

.ing-concern.level-high .ing-level {
  background: rgba(180, 60, 50, 0.12);
  color: #8f2f28;
}

.ing-concern.level-mid .ing-level {
  background: rgba(180, 130, 40, 0.14);
  color: #8a6420;
}

.ing-concern strong {
  display: block;
  font-size: 0.9rem;
  color: var(--brand-deep);
}

.ing-concern p {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.4;
}

.ing-advice li {
  position: relative;
  padding: 0.35rem 0 0.35rem 0.9rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: #2a3d34;
}

.ing-advice li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.7rem;
  width: 0.35rem;
  height: 0.35rem;
  border-radius: 50%;
  background: var(--brand);
}

.ing-muted {
  color: var(--muted);
  font-size: 0.88rem;
}
