:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --ink: #18202f;
  --muted: #647086;
  --line: #e3e8f2;
  --brand: #2557d6;
  --brand-2: #1b46b8;
  --good: #1b8a5a;
  --warn: #a66412;
  --bad: #b42318;
  --shadow: 0 10px 30px rgba(24, 32, 47, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }

.hidden { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 50% -160px, #e7edff 0%, transparent 70%),
    linear-gradient(180deg, #f8faff 0%, var(--bg) 45%);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #dfe8ff, #c9d8ff);
  color: var(--brand-2);
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: inset 0 0 0 1px rgba(37, 87, 214, 0.12);
}

.brand-title { font-weight: 800; font-size: 18px; letter-spacing: 0.2px; }
.brand-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.version { color: var(--muted); font-size: 12px; }

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px 40px;
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(420px, 1.15fr);
  gap: 18px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.form-card h1 {
  font-size: 20px;
  line-height: 1.35;
  margin: 0 0 6px;
}

.muted { color: var(--muted); }
.small { font-size: 12px; }

.field { display: block; margin-top: 16px; }
.field span { display: block; font-size: 13px; font-weight: 650; margin-bottom: 7px; }

.field input {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #f7f9fd;
  color: var(--ink);
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.field input:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 87, 214, 0.12);
}

.rules {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #f7f9fd;
  border: 1px solid var(--line);
}

.rules-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.rules ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.7; }

.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
}

.consent input { margin-top: 2px; accent-color: var(--brand); }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s, filter 0.15s, background 0.15s, color 0.15s;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:not(:disabled):hover { background: var(--brand-2); }
.btn.ghost { background: #eef2fb; color: var(--ink); }
.btn.ghost:not(:disabled):hover { background: #e4eaf8; }

.status { margin-top: 14px; font-size: 13px; color: var(--muted); min-height: 18px; }
.status.bad { color: var(--bad); }
.status.good { color: var(--good); }

.camera-card { position: sticky; top: 16px; }

.camera-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  overflow: hidden;
  background: #0f1726;
}

#video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.guide {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 38%;
  height: 66%;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(255, 168, 76, 0.95);
  border-radius: 50%;
  box-shadow: 0 0 0 9999px rgba(6, 12, 24, 0.18);
  pointer-events: none;
}

.camera-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  color: #dfe7f7;
  background: radial-gradient(500px 300px at 50% 30%, #1a2740, #0f1726);
  font-size: 14px;
}

.camera-icon { font-size: 34px; opacity: 0.8; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.chip {
  font-size: 12px;
  color: var(--muted);
  background: #f2f5fb;
  border: 1px solid var(--line);
  padding: 6px 10px;
  border-radius: 999px;
}

.chip.good { color: var(--good); background: #eef9f3; border-color: #cdeee0; }
.chip.warn { color: var(--warn); background: #fff8ec; border-color: #f3dfbd; }
.chip.bad { color: var(--bad); background: #fff1f0; border-color: #f5cdc9; }

.camera-select {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}
.camera-select select {
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f7f9fd;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  max-width: 100%;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.thumbs figure {
  margin: 0;
  min-width: 0;
}

.thumbs img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #eef2fb;
  display: block;
}

.thumbs figcaption {
  margin-top: 3px;
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gate-msg {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f7f9fd;
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.gate-msg.good { color: var(--good); background: #eef9f3; border-color: #cdeee0; }
.gate-msg.warn { color: var(--warn); background: #fff8ec; border-color: #f3dfbd; }
.gate-msg.bad { color: var(--bad); background: #fff1f0; border-color: #f5cdc9; }

.quality-list { margin-top: 12px; display: grid; gap: 6px; }
.quality-item { font-size: 12.5px; color: var(--muted); }
.quality-item.bad { color: var(--bad); }
.quality-item.warn { color: var(--warn); }
.quality-item.good { color: var(--good); }

.submit-row { margin-top: 16px; }
.submit-row .btn { width: 100%; padding: 14px 18px; }

.result { margin-top: 14px; font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.result.good { color: var(--good); }
.result.bad { color: var(--bad); }

.verify-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(9, 15, 28, 0.62);
  backdrop-filter: blur(3px);
}

.verify-card {
  width: min(640px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 30px 80px rgba(9, 15, 28, 0.35);
}

.verify-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.verify-head h2 { margin: 0; font-size: 20px; }

.verify-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f2f5fb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.verify-badge.good { background: #eef9f3; color: var(--good); }
.verify-badge.warn { background: #fff8ec; color: var(--warn); }
.verify-badge.bad { background: #fff1f0; color: var(--bad); }

.verify-message { margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

.verify-summary {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f7f9fd;
  border: 1px solid var(--line);
  font-size: 12.5px;
}
.verify-summary dt { color: var(--muted); margin: 0; }
.verify-summary dd { margin: 0; overflow-wrap: anywhere; }

.verify-checks { display: grid; gap: 6px; margin-top: 14px; }
.verify-check { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.5; }
.verify-check .dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; background: var(--muted); }
.verify-check.ok .dot { background: var(--good); }
.verify-check.bad .dot { background: var(--bad); }
.verify-check.warn .dot { background: var(--warn); }
.verify-check .name { font-weight: 650; }
.verify-check .detail { color: var(--muted); }

.verify-actions { margin-top: 18px; }
.verify-actions .btn { flex: 1 1 160px; }

.footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px 30px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .camera-card { position: static; }
  .thumbs { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 480px) {
  .topbar { padding: 16px 14px 6px; }
  .layout { padding: 8px 14px 30px; gap: 14px; }
  .card { padding: 18px 16px; border-radius: 16px; }
  .camera-wrap { aspect-ratio: 16 / 9; }
  .guide { width: 50%; height: 66%; }
  .thumbs { grid-template-columns: repeat(4, 1fr); }
}
