* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --bg: #0d1b0e;
  --surface: #1a2e1c;
  --primary: #2d6a3f;
  --accent: #4ade80;
  --gold: #fbbf24;
  --text: #e8f5e9;
  --text-dim: #81c784;
  --danger: #ef4444;
  --radius: 16px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

/* Header */
header {
  text-align: center;
  padding: 12px 0 8px;
}

.logo {
  font-size: 48px;
  line-height: 1;
}

h1 {
  font-size: 20px;
  font-weight: 700;
  margin-top: 4px;
}

.subtitle {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Status */
.status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: var(--radius);
  margin: 12px 0;
  font-size: 14px;
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gold);
  animation: pulse 1.5s ease-in-out infinite;
}

.status-indicator.ready { background: var(--accent); animation: none; }
.status-indicator.error { background: var(--danger); animation: none; }
.status-indicator.found { background: var(--gold); animation: pulse 0.5s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* Camera */
.camera-container {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}

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

#overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

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

.btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--text);
}

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

.btn-icon {
  font-size: 24px;
}

.btn-primary { background: var(--primary); }
.btn-primary:active:not(:disabled) { background: #1b4d2e; }
.btn-secondary { background: var(--surface); }
.btn-accent { background: #7c2d12; }
.btn-accent.active { background: var(--primary); }

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}

.stat-found {
  background: linear-gradient(135deg, #7c2d12, #92400e);
}

.stat-number {
  font-size: 28px;
  font-weight: 800;
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Detection info */
.detection-info {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #7c2d12, #92400e);
  border-radius: var(--radius);
  animation: slideIn 0.3s ease;
}

.detection-badge {
  font-size: 48px;
  line-height: 1;
}

.detection-conf {
  font-size: 13px;
  color: var(--gold);
  margin-top: 2px;
}

@keyframes slideIn {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Loading */
.loading {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 1000;
  gap: 16px;
  padding: 20px;
  text-align: center;
}

.loading.hidden { display: none; }
#app.hidden { display: none; }

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--surface);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.hidden { display: none !important; }

/* Responsive */
@media (max-width: 380px) {
  h1 { font-size: 17px; }
  .stat-number { font-size: 22px; }
}
