:root {
  --bg-0: #031312;
  --bg-1: #0a2b2a;
  --ink: #ebfff8;
  --muted: #93c9bc;
  --accent: #40e7c8;
  --accent-strong: #07b89d;
  --warning: #ff6d3a;
  --glass: rgba(2, 20, 18, 0.5);
  --mask: rgba(3, 17, 15, 0.7);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% 15%, #145047 0%, transparent 35%),
    radial-gradient(circle at 85% 80%, #0f4038 0%, transparent 28%),
    linear-gradient(140deg, var(--bg-0), var(--bg-1));
  display: grid;
  place-items: center;
  padding: 18px;
}

.app-shell {
  width: min(100%, 560px);
  display: grid;
  gap: 12px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
}

.brand-title {
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.12em;
  font-weight: 700;
  text-transform: uppercase;
}

.status {
  font-size: 13px;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--glass);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.status-ok {
  color: #cbffe8;
  border-color: rgba(64, 231, 200, 0.6);
}

.status-error {
  color: #ffd4c7;
  border-color: rgba(255, 109, 58, 0.6);
}

.camera-stage {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow:
    0 14px 42px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  aspect-ratio: 3 / 4;
  background: #021110;
}

#camera {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #020909;
}

.mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(1, 11, 10, 0.3), rgba(1, 11, 10, 0.68));
  pointer-events: none;
}

.face-window {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(70vw, 260px);
  aspect-ratio: 1 / 1.22;
  transform: translate(-50%, -50%);
  border-radius: 44% 44% 38% 38%;
  box-shadow:
    0 0 0 100vmax var(--mask),
    inset 0 0 50px rgba(64, 231, 200, 0.14);
  border: 1px solid rgba(64, 231, 200, 0.52);
  overflow: hidden;
}

.corner {
  position: absolute;
  width: 38px;
  height: 38px;
  border-color: rgba(64, 231, 200, 0.95);
}

.corner-tl {
  top: 12px;
  left: 12px;
  border-left: 3px solid;
  border-top: 3px solid;
  border-top-left-radius: 12px;
}

.corner-tr {
  top: 12px;
  right: 12px;
  border-right: 3px solid;
  border-top: 3px solid;
  border-top-right-radius: 12px;
}

.corner-bl {
  bottom: 12px;
  left: 12px;
  border-left: 3px solid;
  border-bottom: 3px solid;
  border-bottom-left-radius: 12px;
}

.corner-br {
  bottom: 12px;
  right: 12px;
  border-right: 3px solid;
  border-bottom: 3px solid;
  border-bottom-right-radius: 12px;
}

.scan-line {
  position: absolute;
  left: 7%;
  width: 86%;
  height: 3px;
  border-radius: 6px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 18px rgba(64, 231, 200, 0.9);
  animation: scan 2.4s ease-in-out infinite;
}

.hud {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: "Space Grotesk", sans-serif;
  letter-spacing: 0.08em;
  font-size: 12px;
  color: rgba(209, 255, 246, 0.95);
  text-shadow: 0 0 12px rgba(64, 231, 200, 0.6);
}

.hud-top {
  top: 16px;
}

.hud-bottom {
  bottom: 16px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.btn {
  border: 0;
  border-radius: 12px;
  min-height: 44px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
}

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

.btn-primary {
  color: #032018;
  background: linear-gradient(120deg, var(--accent), #5ef7d5);
}

.btn-ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.tips {
  margin: 2px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

@keyframes scan {
  0% {
    top: 12%;
    opacity: 0.5;
  }

  50% {
    opacity: 1;
  }

  100% {
    top: 84%;
    opacity: 0.5;
  }
}

@media (max-width: 420px) {
  body {
    padding: 12px;
  }

  .brand-title {
    font-size: 14px;
  }

  .controls {
    grid-template-columns: 1fr;
  }
}
