:root {
  --green-dark: #1b5e20;
  --green: #2e7d32;
  --green-light: #e8f5e9;
  --bg: #f4f7f4;
  --card: #ffffff;
  --text: #263238;
  --text-light: #78909c;
  --border: #e0e8e0;
  --warn-bg: #fff8e1;
  --warn-border: #f9a825;
  --error-bg: #fdecea;
  --error-border: #c62828;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(27, 94, 32, 0.08);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 0 14px 40px;
}

.hero {
  text-align: center;
  padding: 28px 10px 20px;
  background: linear-gradient(160deg, var(--green-dark), var(--green));
  color: #fff;
  border-radius: 0 0 22px 22px;
  margin: 0 -14px 18px;
}

.hero-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
}

.hero-sub {
  margin: 6px 0 0;
  font-size: 14px;
  opacity: 0.9;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}

.card-title {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--green-dark);
}

/* 照片区域 */
.photo-box {
  position: relative;
  border: 2px dashed var(--border);
  border-radius: 12px;
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #fafdfa;
  margin-bottom: 12px;
}

.photo-box img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: contain;
}

.photo-placeholder {
  text-align: center;
  padding: 30px 16px;
  color: var(--text-light);
}

.photo-icon {
  font-size: 44px;
  margin-bottom: 8px;
}

.photo-hint {
  font-size: 13px;
}

.photo-tip {
  font-size: 13px;
  color: var(--text-light);
  background: #f0f7f0;
  border-radius: 10px;
  padding: 8px 10px;
  margin: 0 0 12px;
}

.photo-tip b {
  color: var(--green-dark);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #fafdfa;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.thumb-remove:active {
  background: rgba(0, 0, 0, 0.8);
}

.photo-count {
  font-size: 12px;
  color: var(--text-light);
  text-align: right;
  margin: 4px 0 10px;
}

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 16px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  transition: opacity 0.15s;
}

.btn:active {
  opacity: 0.8;
}

.btn-primary {
  background: var(--green);
}

.btn-secondary {
  background: #66a16a;
}

.btn-outline {
  background: rgba(255, 255, 255, 0.92);
  color: var(--green-dark);
  border: 1px solid var(--green);
  min-height: 36px;
  font-size: 13px;
  border-radius: 999px;
}

.btn-big {
  width: 100%;
  min-height: 52px;
  font-size: 17px;
  border-radius: 14px;
  margin: 2px 0 14px;
  box-shadow: 0 4px 14px rgba(46, 125, 50, 0.28);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 4px;
}

.btn-row .btn {
  flex: 1;
}

/* 表单 */
.field-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin: 12px 0 6px;
}

.field-label:first-child {
  margin-top: 0;
}

.req {
  color: #c62828;
}

input[type="text"],
select,
textarea {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(46, 125, 50, 0.35);
  border-color: var(--green);
}

/* 加载中 */
.loading {
  text-align: center;
  color: var(--text-light);
  padding: 20px 0;
}

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 10px;
  border: 4px solid var(--green-light);
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

/* 结果 */
.result {
  scroll-margin-top: 10px;
}

.disease-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 10px;
}

.confidence-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.confidence-label {
  font-size: 13px;
  color: var(--text-light);
  white-space: nowrap;
}

.bar {
  flex: 1;
  height: 10px;
  background: #eef2ee;
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}

.bar-fill.high { background: var(--green); }
.bar-fill.mid { background: #f9a825; }
.bar-fill.low { background: #e53935; }
.bar-fill.none { background: #cfd8cf; }

.confidence-value {
  font-weight: 700;
  min-width: 46px;
  text-align: right;
}

.result-block {
  margin-top: 12px;
  padding: 10px 12px;
  background: #f7faf7;
  border-radius: 10px;
}

.result-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 4px;
}

.result-text {
  font-size: 14px;
  white-space: pre-wrap;
}

.demo-note {
  margin-top: 12px;
  font-size: 12px;
  color: #8d6e63;
  background: #fdf3e7;
  border-radius: 8px;
  padding: 8px 10px;
}

/* 提示条 */
.alert {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  margin-top: 12px;
}

.alert-warn {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  color: #795500;
}

.alert-error {
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  color: var(--error-border);
}

/* 付费弹窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99;
  padding: 20px;
}

.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 24px 18px 18px;
  width: 100%;
  max-width: 320px;
  text-align: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--green-dark);
}

.modal-desc {
  color: var(--text-light);
  font-size: 14px;
  margin: 8px 0 12px;
}

.modal-price {
  font-size: 34px;
  font-weight: 800;
  color: #e65100;
  margin-bottom: 16px;
}

.modal-price .per {
  font-size: 14px;
  color: var(--text-light);
  font-weight: 400;
}

.modal-box .btn {
  width: 100%;
  margin-top: 8px;
}

.modal-divider {
  color: var(--text-light);
  font-size: 13px;
  margin: 14px 0 10px;
}

.modal-box input[type="text"] {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  text-align: center;
  letter-spacing: 1px;
  font-family: inherit;
}

.package-list {
  display: grid;
  gap: 8px;
}

.package-btn {
  width: 100%;
  min-height: 48px;
  font-size: 16px;
}

.qr-tip {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 10px;
}

.qr-image {
  width: 220px;
  height: 220px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  margin-bottom: 10px;
}

.qr-order {
  font-size: 12px;
  color: var(--text-light);
  word-break: break-all;
  margin-bottom: 8px;
}

.qr-hint {
  font-size: 13px;
  color: #8d6e63;
  background: #fdf3e7;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.footer {
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
  margin-top: 18px;
  line-height: 1.8;
}

.footer a {
  color: var(--text-light);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

@media (min-width: 600px) {
  body {
    padding-top: 20px;
  }
  .page {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0 20px 40px;
    box-shadow: var(--shadow);
  }
  .hero {
    margin: 0 -20px 18px;
  }
}

.pest-source {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-light);
  line-height: 1.6;
}

