* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Microsoft YaHei", "PingFang SC", sans-serif;
  color: #2f2922;
  background:
    radial-gradient(circle at 18% 8%, rgba(175, 42, 38, .10), transparent 28%),
    linear-gradient(135deg, #f7f1e5 0%, #efe4d2 46%, #f8f4ec 100%);
}
button, input { font: inherit; }
.patient-app {
  min-height: 100vh;
  background-image:
    linear-gradient(rgba(94, 66, 38, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 66, 38, .03) 1px, transparent 1px);
  background-size: 28px 28px;
}
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }
.camera-page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(36px, auto) minmax(0, 1fr) auto auto;
  justify-items: center;
  gap: 14px;
  padding: 18px 18px 16px;
}
.brand-bar {
  width: min(720px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 2px 2px;
}
.seal {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 2px solid #a9362f;
  color: #a9362f;
  font-weight: 900;
  font-size: 24px;
  background: rgba(255, 253, 248, .66);
}
.brand-bar strong { display: block; color: #2f2922; font-size: 20px; letter-spacing: 0; }
.brand-bar span { display: block; margin-top: 2px; color: #7e6750; font-size: 14px; }
.brand-bar p { margin: 0; color: #4e755c; font-weight: 700; white-space: nowrap; }
.frame-alert {
  align-self: end;
  min-height: 40px;
  max-width: min(700px, calc(100vw - 32px));
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(169, 54, 47, .94);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.frame-alert.show { opacity: 1; transform: translateY(0); }
.camera-card {
  align-self: center;
  position: relative;
  display: grid;
  place-items: center;
  width: min(63vh, 80vw, 560px);
  aspect-ratio: 1 / 1;
}
.camera-card::before,
.camera-card::after {
  content: "";
  position: absolute;
  inset: 3.5%;
  border: 1px solid rgba(167, 130, 72, .36);
  border-radius: 50%;
  pointer-events: none;
}
.camera-card::after { inset: 7.5%; border-color: rgba(79, 117, 92, .24); }
.face-frame {
  position: relative;
  width: 88%;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  background: #e8dcc9;
  border: 9px solid rgba(255, 253, 248, .98);
  box-shadow:
    0 24px 56px rgba(63, 43, 22, .20),
    inset 0 0 0 1px rgba(126, 91, 54, .16);
}
.face-frame video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.tongue-guide {
  position: absolute;
  left: 50%;
  top: 60%;
  width: 46%;
  height: 25%;
  transform: translateX(-50%);
  z-index: 3;
  border: 3px dashed rgba(169, 54, 47, .96);
  border-radius: 50% 50% 46% 46%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .86), 0 0 18px rgba(0, 0, 0, .20);
  pointer-events: none;
}
.tongue-guide span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 34%;
  height: 2px;
  transform: translate(-50%, -50%);
  border-top: 2px dashed rgba(169, 54, 47, .96);
}
.camera-tip {
  position: absolute;
  left: 50%;
  top: 17%;
  transform: translateX(-50%);
  z-index: 4;
  max-width: 82%;
  padding: 8px 13px;
  border-radius: 999px;
  background: rgba(47, 41, 34, .76);
  color: #fff;
  font-size: 14px;
  text-align: center;
  line-height: 1.4;
  pointer-events: none;
}
.camera-tip.ready { background: rgba(78, 117, 92, .88); }
.camera-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  color: #2f2922;
  text-align: center;
  background: #e8dcc9;
  z-index: 5;
}
.capture-button {
  width: min(280px, calc(100vw - 80px));
  min-height: 58px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #a9362f, #7a2d29);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(122, 45, 41, .26);
}
.capture-button:disabled { opacity: .65; cursor: wait; }
.analysis-source {
  width: min(700px, calc(100vw - 32px));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.analysis-source div {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(167, 130, 72, .28);
  border-radius: 12px;
  background: rgba(255, 253, 248, .66);
  box-shadow: 0 8px 20px rgba(63, 43, 22, .06);
}
.analysis-source i {
  grid-row: span 2;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(169, 54, 47, .10);
  color: #a9362f;
  font-style: normal;
  font-weight: 900;
}
.analysis-source strong { color: #2f2922; font-size: 14px; }
.analysis-source span { color: #7e6750; font-size: 12px; line-height: 1.45; }
.agreements {
  width: min(700px, calc(100vw - 32px));
  display: grid;
  gap: 8px;
  justify-content: center;
  padding: 2px 0 10px;
  font-size: 14px;
  color: #6f5d49;
}
.agreements label { display: flex; align-items: center; justify-content: center; gap: 7px; }
.agreements input { width: 16px; height: 16px; accent-color: #a9362f; }
#statusLine {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 30px;
  padding: 6px 16px;
  text-align: center;
  color: #a9362f;
  background: rgba(247, 241, 229, .92);
}
.loading-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  text-align: center;
  padding: 24px;
}
.loading-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 2px solid #a9362f;
  color: #a9362f;
  font-size: 34px;
  font-weight: 900;
  background: rgba(255, 253, 248, .62);
}
.loading-page h1 { margin: 0; font-size: 30px; color: #2f2922; }
.loading-page p { margin: 0; color: #7e6750; }
.spinner {
  width: 52px;
  height: 52px;
  border: 5px solid rgba(167, 130, 72, .28);
  border-top-color: #4e755c;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.result-page {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto;
  align-content: start;
  gap: 22px;
  padding: 24px 36px 36px;
}
.result-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.back-button {
  border: 1px solid rgba(167, 130, 72, .42);
  border-radius: 999px;
  background: rgba(255, 253, 248, .82);
  color: #7a2d29;
  padding: 10px 17px;
  cursor: pointer;
}
.countdown { color: #7a2d29; font-weight: 800; }
.countdown span { font-size: 28px; }
.result-main {
  width: min(860px, 100%);
  margin: 0 auto;
  text-align: center;
  padding: 24px;
  border-top: 1px solid rgba(167, 130, 72, .34);
  border-bottom: 1px solid rgba(167, 130, 72, .34);
}
.badge { color: #4e755c; font-weight: 800; }
.result-main h1 { margin: 8px 0 10px; color: #a9362f; font-size: 58px; line-height: 1.15; }
.result-main p { margin: 0; color: #6f5d49; line-height: 1.8; }
.confidence { margin: 22px 0 0; }
.confidence div { height: 12px; margin-top: 8px; border-radius: 999px; overflow: hidden; background: rgba(167, 130, 72, .24); }
.confidence i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #4e755c, #a78248); }
.result-grid {
  width: min(960px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.result-grid div,
.tea-recommendation,
.tcm-note {
  border: 1px solid rgba(167, 130, 72, .30);
  border-radius: 8px;
  padding: 15px;
  background: rgba(255, 253, 248, .78);
  box-shadow: 0 10px 24px rgba(63, 43, 22, .07);
}
.result-grid div {
  display: grid;
  align-content: center;
}
.result-grid span,
.tea-recommendation span { display: block; color: #7e6750; font-size: 13px; margin-bottom: 6px; }
.result-grid strong,
.tea-recommendation strong { color: #2f2922; font-size: 18px; }
.tea-recommendation {
  width: min(960px, 100%);
  margin: 0 auto;
}
.tcm-note {
  width: min(960px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 7px;
  border-color: rgba(78, 117, 92, .26);
}
.tcm-note strong { color: #4e755c; font-size: 17px; }
.tcm-note p { margin: 0; color: #6f5d49; line-height: 1.75; }
.disclaimer { max-width: 960px; margin: 0 auto; text-align: center; color: #7e6750; font-size: 13px; line-height: 1.7; }
@media (max-width: 720px) {
  .camera-page { grid-template-rows: auto minmax(24px, auto) minmax(0, auto) auto auto; gap: 8px; padding: 8px 16px 8px; align-content: start; }
  .brand-bar { grid-template-columns: auto 1fr auto; gap: 8px; padding-top: 2px; }
  .brand-bar strong { font-size: 17px; }
  .brand-bar span { font-size: 12px; }
  .brand-bar p { grid-column: auto; font-size: 12px; padding-left: 0; }
  .seal { width: 36px; height: 36px; font-size: 20px; }
  .frame-alert { min-height: 28px; padding: 5px 12px; font-size: 13px; border-radius: 12px; }
  .camera-card { width: min(44vh, 78vw, 340px); align-self: start; }
  .face-frame { width: 88%; border-width: 5px; }
  .camera-tip { top: 13%; font-size: 13px; }
  .capture-button { width: min(240px, calc(100vw - 96px)); min-height: 50px; font-size: 18px; }
  .analysis-source { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .analysis-source div { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 8px 6px; }
  .analysis-source i { grid-row: auto; width: 28px; height: 28px; }
  .analysis-source strong { font-size: 12px; }
  .analysis-source span { font-size: 10px; line-height: 1.35; }
  .agreements { justify-content: stretch; font-size: 12px; gap: 5px; padding-bottom: 4px; }
  .agreements label { justify-content: flex-start; }
  .result-page { padding: 16px; gap: 14px; }
  .result-top { align-items: flex-start; }
  .result-main { padding: 14px 8px; }
  .result-main h1 { font-size: 40px; }
  .result-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .result-grid div { padding: 12px 10px; }
  .tea-recommendation, .tcm-note { padding: 12px 10px; }
  .result-grid strong, .tea-recommendation strong { font-size: 16px; }
  .result-grid span, .tea-recommendation span { font-size: 12px; }
}
@media (max-width: 720px) and (max-height: 740px) {
  .camera-page { gap: 6px; padding-top: 6px; }
  .brand-bar { transform: scale(.94); transform-origin: top center; width: min(760px, calc(100vw - 16px)); }
  .frame-alert { min-height: 22px; padding: 3px 10px; }
  .camera-card { width: min(39vh, 72vw, 300px); }
  .camera-tip { top: 11%; }
  .capture-button { min-height: 46px; }
  .analysis-source div { padding: 6px 4px; }
  .analysis-source i { width: 24px; height: 24px; font-size: 13px; }
  .analysis-source span { display: none; }
  .agreements { font-size: 11px; line-height: 1.35; }
  .agreements input { width: 14px; height: 14px; }
}
