* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: linear-gradient(160deg, #0d1117 0%, #161b22 100%);
  color: #e6edf3;
  overflow: hidden;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.screen.active {
  display: flex;
}

.panel {
  width: 100%;
  max-width: 440px;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 40px 28px;
  backdrop-filter: blur(6px);
}

.panel.narrow {
  max-width: 360px;
}

.logo {
  width: 84px;
  height: 84px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #35c4f0, #7b2ff7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 2px;
}

.logo.ok {
  background: linear-gradient(135deg, #2bd576, #16a34a);
}

h1 {
  font-size: 26px;
  margin-bottom: 12px;
}

h2 {
  font-size: 22px;
  margin-bottom: 10px;
}

.desc {
  color: #9aa4b2;
  line-height: 1.7;
  margin-bottom: 28px;
  font-size: 15px;
}

.btn-primary {
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #35c4f0, #7b2ff7);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-ghost {
  padding: 12px 28px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  background: transparent;
  color: #c9d1d9;
  font-size: 15px;
  cursor: pointer;
}

.btn-ghost:active {
  transform: scale(0.98);
}

.hint {
  color: #6e7781;
  font-size: 13px;
  margin-top: 16px;
}

#screen-camera {
  justify-content: flex-start;
  padding: 0;
}

.topbar {
  width: 100%;
  max-width: 520px;
  padding: 18px 22px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#step-tag {
  font-size: 14px;
  color: #9aa4b2;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 4px 12px;
}

.video-wrap {
  position: relative;
  width: calc(100% - 40px);
  max-width: 480px;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#video {
  visibility: hidden;
}

#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.occlusion {
  width: 100%;
  max-width: 420px;
  background: rgba(255, 193, 7, 0.12);
  border: 1px solid rgba(255, 193, 7, 0.6);
  color: #ffca28;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 10px;
  text-align: center;
}

.prompt-area {
  margin: 22px 24px 0;
  text-align: center;
  min-height: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#prompt {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.4;
}

#prompt.pass {
  color: #2bd576;
}

#prompt-sub {
  color: #9aa4b2;
  font-size: 14px;
  margin-top: 8px;
}

.controls {
  margin-top: auto;
  padding: 18px 0 32px;
}

.mask {
  position: fixed;
  inset: 0;
  background: rgba(13, 17, 23, 0.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 50;
}

.mask p {
  margin-top: 6px;
  color: #9aa4b2;
}

.mask .panel .btn-primary {
  margin-bottom: 14px;
}

.mask .panel .btn-ghost {
  width: 100%;
}

.hidden {
  display: none !important;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  border-top-color: #35c4f0;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 18px;
}

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

#debug {
  position: fixed;
  left: 8px;
  bottom: 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  font-family: Consolas, monospace;
  z-index: 99;
  pointer-events: none;
}