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

.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(245, 249, 253, 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(26, 111, 212, 0.18);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(14, 165, 201, 0.2) 0%, transparent 52%),
    radial-gradient(90% 80% at 0% 100%, rgba(26, 111, 212, 0.14) 0%, transparent 48%),
    linear-gradient(160deg, #f3f8ff 0%, #eaf2fc 48%, #eef7fb 100%);
  box-shadow: 0 10px 28px rgba(12, 74, 158, 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(26, 111, 212, 0.22);
  pointer-events: none;
}

.today-motto-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  color: #1a6fd4;
  font-weight: 600;
}

.today-motto-cal {
  margin: 0 0 0.55rem;
  position: relative;
  z-index: 1;
  color: #5a6b7c;
  font-size: 0.82rem;
  line-height: 1.45;
  letter-spacing: 0.02em;
}

.today-motto-text {
  margin: 0;
  position: relative;
  z-index: 1;
  max-width: 92%;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.65;
  color: #1a2d45;
  letter-spacing: 0.01em;
}

/* 识别向导：科技蓝步骤条 */
.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(70, 140, 220, 0.22);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, transparent 42%),
    linear-gradient(125deg, #eef4fc 0%, #e4eef9 48%, #f2f7fc 100%);
  box-shadow: 0 8px 22px rgba(40, 100, 180, 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: #1a6fd4;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(70, 140, 220, 0.18);
  box-shadow: 0 4px 12px rgba(40, 100, 180, 0.08);
}

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

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

.today-guide-arrow {
  flex: 0 0 auto;
  color: rgba(26, 111, 212, 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: #4a7ab0;
}

.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, 111, 212, 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 {
  display: none;
}

.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：与主内容同宽居中对齐 */
.app-tabbar,
.tabbar {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: 0;
  z-index: 140;
  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.35rem 0.35rem calc(0.35rem + 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(12, 74, 158, 0.06);
}

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

.app-tabbar .tab-ico,
.tabbar-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-tabbar .tab-item.is-active,
.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, 111, 212, 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, 111, 212, 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, 111, 212, 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, #d6e6f8, #f5f9fd);
  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, #c9dcf5, #eef4fb);
}

.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(12, 74, 158, 0.92);
  color: #fff;
  font-size: 0.86rem;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(12, 74, 158, 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(12, 74, 158, 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(12, 74, 158, 0.12);
}

.pick-sheet-group .pick-sheet-btn {
  margin: 0;
  border-radius: 0;
  border-bottom: 1px solid rgba(12, 74, 158, 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: #eef4fb;
}

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

/* 查配料 */
.ing-hero {
  margin: 0;
  padding: 1.15rem 1.1rem 1.2rem;
  border-radius: 18px;
  border: 1px solid rgba(26, 111, 212, 0.14);
  background: linear-gradient(160deg, #f2f7fc 0%, #fff 55%, #f5f8fb 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, 111, 212, 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, 111, 212, 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(14, 165, 201, 0.14);
  color: #0a7a96;
}

.ing-verdict.is-ok {
  background: rgba(26, 111, 212, 0.12);
  color: #1a6fd4;
}

.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: #2a3d52;
}

.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(12, 74, 158, 0.06);
  font-size: 0.9rem;
}

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

.ing-flag {
  color: #0a7a96;
  font-size: 0.78rem;
}

.ing-concern {
  display: flex;
  gap: 0.65rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid rgba(12, 74, 158, 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, 111, 212, 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(14, 165, 201, 0.14);
  color: #0a7a96;
}

.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: #1a2d45;
}

.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;
}

/* —— 乐查查：首页工具入口 —— */
.home-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.tool-card {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 1rem 0.85rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  color: inherit;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.tool-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-deep);
  background: rgba(26, 111, 212, 0.1);
}

.tool-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.tool-body strong {
  font-size: 1rem;
  color: var(--brand-deep);
  font-weight: 600;
}

.tool-body em {
  font-style: normal;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.35;
}

.tool-hero {
  margin-bottom: 0.85rem;
}

.tool-hero .block-title {
  margin-bottom: 0.35rem;
}

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

.word-form {
  display: grid;
  gap: 0.75rem;
}

.result-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 1rem;
}

.result-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--brand-deep);
}

.result-img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 0.85rem;
}

.result-section {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
}

.result-section h4,
.result-section h5 {
  margin: 0 0 0.35rem;
  font-size: 0.92rem;
  color: var(--brand-deep);
}

.result-section ul {
  margin: 0;
  padding-left: 1.1rem;
}

.result-section li {
  margin: 0.25rem 0;
}

.pre-wrap {
  white-space: pre-wrap;
  word-break: break-word;
}

.skip-box {
  text-align: center;
  padding: 0.5rem 0;
}

.similar-item {
  margin-top: 0.65rem;
  padding: 0.75rem 0.8rem;
  border-radius: 12px;
  background: rgba(26, 111, 212, 0.06);
  border: 1px solid rgba(26, 111, 212, 0.08);
}

.similar-head {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand-deep);
  margin-bottom: 0.35rem;
}

.similar-q {
  margin: 0 0 0.45rem;
  line-height: 1.5;
}

.similar-a {
  margin: 0;
  display: flex;
  gap: 0.45rem;
  align-items: baseline;
  font-weight: 600;
  color: var(--brand-deep);
}

.similar-a span {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.12rem 0.4rem;
  border-radius: 6px;
  background: rgba(26, 111, 212, 0.12);
}

.wrong-answer {
  margin: 0;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  background: rgba(26, 111, 212, 0.1);
  color: var(--brand-deep);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.45;
}

.wrong-student {
  margin: 0;
  color: #0a6b84;
}

.wrong-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.65rem;
}

.wrong-step {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
}

.wrong-step-num {
  flex: 0 0 auto;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  margin-top: 0.1rem;
}

.wrong-step-body {
  min-width: 0;
  flex: 1;
}

.wrong-step-body strong {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.9rem;
  color: var(--brand-deep);
}

.wrong-step-body p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #2a3d52;
}

.wrong-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.wrong-chip {
  display: inline-block;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  background: rgba(14, 165, 201, 0.12);
  color: #0a6b84;
  font-size: 0.78rem;
}

.wrong-tip {
  margin: 0;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  background: rgba(14, 120, 180, 0.08);
  color: #0a5f7a;
  line-height: 1.5;
}

.pick-actions {
  display: grid;
  gap: 0.55rem;
}

.pick-sheet .btn-link {
  color: var(--muted);
  text-decoration: none;
}

/* 结果层在底栏之上留空，避免挡住导航 */
#pickModal {
  z-index: 120;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
}

#resultModal {
  z-index: 120;
  align-items: flex-end;
  justify-content: center;
  padding: 0 0 calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  /* 遮罩不盖住底栏：用渐变遮罩高度限制 */
  background: linear-gradient(
    to bottom,
    rgba(12, 74, 158, 0.35) 0%,
    rgba(12, 74, 158, 0.35) calc(100% - var(--tabbar-h) - env(safe-area-inset-bottom, 0px)),
    transparent calc(100% - var(--tabbar-h) - env(safe-area-inset-bottom, 0px))
  );
}

.action-sheet {
  position: relative;
  left: auto;
  bottom: 0.55rem;
  transform: none;
  width: min(420px, calc(100% - 1.2rem));
  z-index: 60;
  display: grid;
  gap: 0.55rem;
  margin: 0 auto;
  animation: sheet-up 0.22s ease both;
}

@keyframes sheet-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

.action-sheet-group {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(12, 74, 158, 0.12);
}

.action-sheet-title {
  margin: 0;
  padding: 0.75rem 1rem 0.35rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.action-sheet-btn {
  appearance: none;
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(12, 74, 158, 0.08);
  background: transparent;
  padding: 0.95rem 1rem;
  font-size: 1.05rem;
  color: var(--brand);
  font-weight: 500;
}

.action-sheet-btn:first-of-type {
  border-top: 0;
}

.action-sheet-cancel {
  font-weight: 600;
  color: var(--ink);
}

.result-drawer {
  width: min(100%, 520px);
  max-height: calc(100dvh - var(--tabbar-h) - env(safe-area-inset-bottom, 0px) - 1rem);
  overflow: auto;
  margin: 0 auto;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.result-preview {
  margin-bottom: 0.75rem;
}

.result-preview img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 12px;
}

.result-body {
  padding-bottom: 0.5rem;
}

.result-actions {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--line);
}

.result-trans {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: var(--brand-deep);
  font-weight: 600;
}

.records-manage-bar {
  display: flex;
  gap: 0.5rem;
  margin: 0.55rem 0 0.25rem;
}

.record-item-wrap {
  display: flex;
  align-items: stretch;
  gap: 0.45rem;
}

.record-check {
  display: flex;
  align-items: center;
  padding-left: 0.15rem;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.goal-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.me-card {
  margin-bottom: 0.85rem;
}

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

.me-profile {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.me-avatar-btn {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  border-radius: 50%;
  width: 64px;
  height: 64px;
  overflow: hidden;
  flex: 0 0 auto;
}

.me-avatar,
.me-avatar-fallback {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: block;
}

.me-avatar {
  object-fit: cover;
}

.me-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 111, 212, 0.12);
  color: var(--brand-deep);
  font-size: 1.4rem;
  font-weight: 600;
}

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

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

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

.records-list {
  display: grid;
  gap: 0.55rem;
}

.record-item {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 0.75rem 0.85rem;
  text-align: left;
  display: grid;
  gap: 0.2rem;
  color: inherit;
}

.record-tag {
  display: inline-block;
  width: fit-content;
  font-size: 0.7rem;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  background: rgba(26, 111, 212, 0.1);
  color: var(--brand-deep);
}

.record-item strong {
  font-size: 0.95rem;
}

.record-item em {
  font-style: normal;
  font-size: 0.82rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.about-card p {
  margin: 0;
  line-height: 1.55;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 18px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 200;
  max-width: min(90vw, 320px);
  padding: 0.65rem 1rem;
  border-radius: 999px;
  background: rgba(12, 74, 158, 0.92);
  color: #fff;
  font-size: 0.88rem;
  text-align: center;
  box-shadow: 0 10px 30px rgba(12, 74, 158, 0.2);
}

.loading-mask {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(15, 26, 44, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.loading-card {
  background: #fff;
  border-radius: 14px;
  padding: 1rem 1.35rem;
  box-shadow: var(--shadow);
  color: var(--brand-deep);
  font-weight: 600;
}

/* 错题 PDF 导出文档（离屏渲染） */
.wrong-pdf-doc {
  position: fixed;
  left: -10000px;
  top: 0;
  width: 720px;
  padding: 28px 32px 36px;
  background: #fff;
  color: #1a2d45;
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13.5px;
  line-height: 1.65;
  box-sizing: border-box;
}

.wpdf-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 12px;
  margin-bottom: 16px;
  border-bottom: 2px solid #1a6fd4;
}

.wpdf-brand {
  font-size: 22px;
  font-weight: 700;
  color: #0c4a9e;
  letter-spacing: 0.06em;
}

.wpdf-sub {
  font-size: 13px;
  color: #1a6fd4;
  font-weight: 600;
}

.wpdf-title {
  margin: 0 0 18px;
  font-size: 20px;
  color: #0f1a2c;
  font-weight: 700;
}

.wpdf-sec {
  margin: 0 0 16px;
  page-break-inside: avoid;
}

.wpdf-sec h2 {
  margin: 0 0 8px;
  font-size: 14px;
  color: #1a6fd4;
  font-weight: 700;
}

.wpdf-sec p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.wpdf-answer {
  padding: 10px 12px;
  border-radius: 8px;
  background: #eef4fb;
  color: #0c4a9e;
  font-weight: 700;
  font-size: 15px;
}

.wpdf-step {
  display: flex;
  gap: 10px;
  margin: 0 0 10px;
  page-break-inside: avoid;
}

.wpdf-step-num {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #1a6fd4;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.wpdf-step strong {
  display: block;
  margin-bottom: 2px;
  color: #0c4a9e;
}

.wpdf-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.wpdf-chip {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: #e8f1fb;
  color: #0c4a9e;
  font-size: 12px;
}

.wpdf-sim {
  margin: 0 0 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #f5f9fd;
  border: 1px solid #d6e6f8;
  page-break-inside: avoid;
}

.wpdf-sim-h {
  font-weight: 700;
  color: #1a6fd4;
  margin-bottom: 4px;
  font-size: 12px;
}

.wpdf-muted {
  color: #5a6b7c;
  font-size: 12px;
  margin-top: 4px !important;
}

.wpdf-foot {
  margin-top: 22px;
  padding-top: 10px;
  border-top: 1px solid #d6e6f8;
  color: #8a9aa8;
  font-size: 11px;
  text-align: right;
}

@media (max-width: 380px) {
  .app-tabbar .tab-item,
  .tabbar-item {
    font-size: 0.52rem;
  }
}

