:root {
  --bg: #f3f5f7;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --ok: #0f766e;
  --bad: #b91c1c;
  --line: #e5e7eb;
  --accent: #0369a1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at top right, #e0f2fe, var(--bg) 55%);
  color: var(--text);
}

.container {
  width: min(1080px, 94%);
  margin: 24px auto 40px;
}

h1,
h2 {
  margin: 0 0 12px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px;
  font-size: 14px;
}

button {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
}

button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.form-actions,
.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.link-btn {
  display: inline-block;
  text-decoration: none;
  border: 1px solid #0ea5e9;
  background: #e0f2fe;
  color: #075985;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
}

.muted-text {
  color: var(--muted);
  font-size: 14px;
}

#savedHint {
  color: var(--muted);
  font-size: 13px;
}

.camera-wrap {
  position: relative;
  width: min(640px, 100%);
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
}

.preview-wrap {
  position: relative;
  width: min(640px, 100%);
  height: 220px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px dashed #94a3b8;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 70%);
}

.success-toast {
  --toast-left: 50%;
  --toast-top: 18px;
  --toast-width: 260px;
  position: absolute;
  left: var(--toast-left);
  top: var(--toast-top);
  width: min(var(--toast-width), calc(100% - 24px));
  transform: translateX(-50%) translateY(-8px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: rgba(15, 118, 110, 0.92);
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 4;
}

.success-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.success-icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #ecfeff;
  color: #0f766e;
  font-size: 20px;
  font-weight: 900;
  line-height: 30px;
  text-align: center;
}

.success-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.success-text strong {
  font-size: 15px;
  line-height: 1;
}

.success-text span {
  font-size: 12px;
  opacity: 0.95;
}

video {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

#canvas {
  display: none;
}

.face-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

#status {
  margin: 10px 0 0;
  font-weight: 600;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px;
}

.result-ok {
  color: var(--ok);
  font-weight: 700;
}

.result-bad {
  color: var(--bad);
  font-weight: 700;
}

@media (max-width: 720px) {
  .container {
    width: 96%;
    margin-top: 10px;
  }

  .card {
    padding: 12px;
  }
}
