/* 保质期助手——长辈友好大字界面
   硬性要求：基准字号≥22px、结果关键数字≥40px、可点区域≥64px、主按钮≥80px */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  background: #FFF9F1;
  color: #1F1F1F;
  font-size: 26px;          /* 基准字号 */
  line-height: 1.5;
}

#app { max-width: 640px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: 36px 28px calc(36px + env(safe-area-inset-bottom));
}
.screen.active { display: flex; }

.hidden-input { display: none; }

/* ---------- 按钮（长辈尺寸） ---------- */
.btn {
  display: block; width: 100%; border: none; border-radius: 22px;
  margin-top: 26px; font-family: inherit; font-weight: 700;
  cursor: pointer; touch-action: manipulation; padding: 0 24px;
}
.btn-primary {
  min-height: 108px; font-size: 40px; color: #FFFFFF; background: #E23E0A;
  box-shadow: 0 7px 0 #B53008;
}
.btn-primary:active { transform: translateY(5px); box-shadow: 0 2px 0 #B53008; }
.btn-primary:disabled { opacity: 0.45; box-shadow: none; }
.btn-danger {
  min-height: 108px; font-size: 40px; color: #FFFFFF; background: #D93025;
  box-shadow: 0 7px 0 #A61B12;
}
.btn-danger:active { transform: translateY(5px); box-shadow: 0 2px 0 #A61B12; }
.btn-secondary {
  min-height: 88px; font-size: 33px; color: #C93307; background: #FFE9DF; border: 3px solid #FFC6AD;
}
.btn-secondary:active { background: #FFD9C8; }
.btn-ghost { min-height: 68px; font-size: 26px; color: #8A7A6E; background: transparent; text-decoration: underline; }
.btn.holding { background: #FFD24D !important; color: #5A3E00 !important; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 26px; }
.quick-grid .btn { margin-top: 0; }

/* ---------- 首屏 ---------- */
.home-hero { text-align: center; padding: 70px 0 50px; }
.app-logo {
  font-size: 66px; font-weight: 900; color: #E23E0A; letter-spacing: 4px;
}
.app-logo .check { color: #0B7A3E; }
.home-sub { font-size: 28px; color: #5A4A3E; margin: 30px 0 10px; }
.home-tip { font-size: 23px; color: #99897D; text-align: center; margin-top: 26px; }
.home-footer { text-align: center; margin-top: auto; padding-top: 40px; }
.home-footer span { font-size: 22px; color: #C8BDB4; letter-spacing: 2px; }

/* ---------- 录像 ---------- */
.cam-wrap { position: relative; border-radius: 24px; overflow: hidden; background: #000; aspect-ratio: 3 / 4; max-height: 62vh; }
#cam-preview { width: 100%; height: 100%; object-fit: cover; display: block; }
.rec-badge {
  position: absolute; top: 22px; right: 22px; background: rgba(0, 0, 0, 0.65);
  color: #fff; font-size: 30px; font-weight: 700; border-radius: 999px; padding: 10px 28px;
}
.rec-badge.on { background: #D93025; }
.record-tips { text-align: center; margin: 30px 0 6px; }
.big-tip { font-size: 32px; font-weight: 700; margin: 8px 0; color: #3E2E22; }

/* ---------- 通用标题 ---------- */
.screen-title { font-size: 44px; font-weight: 900; text-align: center; margin: 50px 0 12px; }
.screen-sub { font-size: 30px; text-align: center; color: #5A4A3E; margin: 6px 0 30px; }
.center-block { text-align: center; }
.detected-date { font-size: 48px; font-weight: 900; color: #C93307; text-align: center; margin: 8px 0 4px; }

/* ---------- 处理中 ---------- */
.processing { padding-top: 130px; }
.spinner { display: flex; gap: 22px; justify-content: center; margin-bottom: 50px; }
.spinner div {
  width: 34px; height: 34px; border-radius: 50%; background: #E23E0A;
  animation: bounce 1.2s infinite ease-in-out;
}
.spinner div:nth-child(2) { animation-delay: 0.15s; }
.spinner div:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.5); opacity: 0.4; }
  40% { transform: scale(1); opacity: 1; }
}
.processing-main { font-size: 44px; font-weight: 900; text-align: center; }
.processing-sub { font-size: 28px; color: #5A4A3E; text-align: center; margin-top: 18px; }
.processing-sub2 { font-size: 23px; color: #99897D; text-align: center; margin-top: 30px; }

/* ---------- 结果 ---------- */
.result-card {
  background: #FFFFFF; border-radius: 28px; padding: 46px 30px 42px;
  text-align: center; border: 4px solid #FFE3D3; box-shadow: 0 10px 30px rgba(190, 90, 30, 0.10);
}
.result-card.danger { border-color: #F3B8B3; background: #FFF6F5; }
.result-label { font-size: 30px; color: #8A7A6E; margin: 0; }
.result-date { font-size: 60px; font-weight: 900; margin: 14px 0 26px; letter-spacing: 1px; }
.result-remain { font-size: 30px; margin: 0; }
.result-remain b { font-size: 84px; font-weight: 900; }
.result-remain.ok b { color: #0B7A3E; }
.result-remain.danger { color: #D93025; font-weight: 700; }
.result-remain.danger b { color: #D93025; }
.result-warn { font-size: 30px; font-weight: 700; color: #D93025; margin: 20px 0 0; }
.result-info { font-size: 24px; color: #8A7A6E; margin: 26px 0 0; border-top: 2px dashed #E8DCD2; padding-top: 22px; line-height: 1.7; }

/* ---------- 手动输入 ---------- */
.field-label { font-size: 28px; font-weight: 700; color: #3E2E22; margin: 26px 0 10px; }
.big-input {
  width: 100%; min-height: 92px; font-size: 36px; font-family: inherit;
  border: 3px solid #D8C8BB; border-radius: 18px; padding: 10px 20px; background: #fff; color: #1F1F1F;
}
.manual-preview {
  margin-top: 30px; background: #FFF3E4; border-radius: 18px; padding: 24px;
  font-size: 28px; text-align: center; min-height: 60px; color: #5A4A3E;
}
.manual-preview b { font-size: 34px; color: #C93307; }

/* ---------- 分享 ---------- */
#share-img { width: 100%; border-radius: 20px; border: 3px solid #EFE2D6; margin-top: 10px; display: block; }

/* ---------- 失败 ---------- */
.fail-emoji { font-size: 96px; text-align: center; margin: 60px 0 10px; }

/* ---------- 品类参考值兜底 ---------- */
.ref-tip { font-size: 24px; color: #8A6D3B; text-align: center; margin: 22px 4px 0; line-height: 1.55; }
.btn.ref-pick { background: #FFD24D; color: #5A3E00; border-color: #E8B93A; }
.ref-big { color: #C93307; font-size: 36px; }
.screen-sub b { color: #C93307; }

/* ---------- 提示条 ---------- */
#toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(30px);
  background: rgba(30, 20, 10, 0.88); color: #fff; font-size: 28px;
  padding: 20px 34px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s; max-width: 86vw; text-align: center; z-index: 99;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
