:root {
  --bg: #0f1117;
  --panel: #181b24;
  --border: #2a2e3a;
  --text: #e7e9ee;
  --muted: #8b8f9c;
  --accent: #5b8cff;
  --accent-disabled: #3a3f4d;
  --success: #3ddc84;
  --fail: #ff5c6c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  justify-content: center;
  padding: 32px 16px;
}

.app {
  width: 100%;
  max-width: 880px;
}

h1 {
  margin: 0 0 4px;
  font-size: 1.6rem;
}

.subtitle {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 0.95rem;
}

.panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 640px) {
  .panels { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 1rem;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.camera-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

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

/* Square guide box for face placement */
.face-guide {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 55%;
  aspect-ratio: 1 / 1;
  transform: translate(-50%, -50%);
  border: 3px dashed rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  pointer-events: none;
}

.controls {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.upload-wrapper {
  display: flex;
}

.btn {
  flex: 1;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #232733;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) {
  background: #2b303e;
}

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

.preview-box {
  margin-top: 14px;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px dashed var(--border);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #11131a;
}

.preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.empty-state {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 0 12px;
}

.submit-area {
  margin-top: 24px;
  text-align: center;
}

.btn-primary {
  flex: none;
  width: 100%;
  max-width: 320px;
  padding: 14px;
  font-weight: 600;
  font-size: 1rem;
  background: var(--accent-disabled);
  border: none;
  color: #fff;
}

.btn-primary:not(:disabled) {
  background: var(--accent);
  cursor: pointer;
}

.btn-primary:not(:disabled):hover {
  background: #4a78e0;
}

.status {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 1.2em;
}

.result {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  font-size: 1.05rem;
  font-weight: 600;
}

.result.match {
  background: rgba(61, 220, 132, 0.12);
  color: var(--success);
  border: 1px solid rgba(61, 220, 132, 0.3);
}

.result.no-match {
  background: rgba(255, 92, 108, 0.12);
  color: var(--fail);
  border: 1px solid rgba(255, 92, 108, 0.3);
}

.hidden {
  display: none !important;
}

/* =============================================
   Verification shimmer overlay
   ============================================= */
.verification-overlay {
  margin-top: 20px;
  padding: 24px 16px;
  border-radius: 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.shimmer-bar {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    var(--border) 0%,
    var(--accent) 40%,
    var(--border) 80%
  );
  background-size: 200% 100%;
  animation: shimmer-sweep 1.6s ease-in-out infinite;
}

@keyframes shimmer-sweep {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.shimmer-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.shimmer-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.shimmer-message {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  animation: pulse-text 2s ease-in-out infinite;
}

@keyframes pulse-text {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.5; }
}
