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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px 16px;
  gap: 16px;
  text-align: center;
}

.screen.active {
  display: flex;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: #f1f5f9;
}

h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #f1f5f9;
}

.subtitle {
  color: #94a3b8;
  font-size: 0.9rem;
  max-width: 320px;
  line-height: 1.5;
}

.note {
  color: #475569;
  font-size: 0.8rem;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 320px;
}

.btn-primary {
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 0;
  padding: 14px 20px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

.btn-primary:active {
  background: #2563eb;
}

.btn-secondary {
  background: #1e293b;
  color: #94a3b8;
  border: 1px solid #334155;
  border-radius: 0;
  padding: 12px 20px;
  font-size: 0.9rem;
  cursor: pointer;
  width: 100%;
}

.btn-secondary:active {
  background: #0f172a;
}

/* Crop */
.crop-container {
  width: 100%;
  max-width: 420px;
  max-height: 50dvh;
  overflow: hidden;
  background: #1e293b;
}

.crop-container img {
  max-width: 100%;
  display: block;
}

/* Progress */
.progress-bar {
  width: 240px;
  height: 6px;
  background: #1e293b;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #3b82f6;
  transition: width 0.3s ease;
}

/* Spinner */
.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #1e293b;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

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

/* Result */

.count-box {
  background: #1e293b;
  border: 1px solid #334155;
  padding: 16px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 200px;
}

.count-label {
  color: #64748b;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.count-number {
  color: #22c55e;
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
}

.count-unit {
  color: #64748b;
  font-size: 0.8rem;
}

.no-detection {
  color: #f59e0b;
  font-size: 0.85rem;
  max-width: 300px;
  line-height: 1.5;
  border: 1px solid #78350f;
  padding: 12px;
  background: #1c1208;
}

/* Cropper.js — handles más grandes para móvil */
.cropper-point {
  width: 16px !important;
  height: 16px !important;
  opacity: 0.9 !important;
}
.cropper-point.point-e  { right: -8px !important;   margin-top: -8px !important; }
.cropper-point.point-w  { left: -8px !important;    margin-top: -8px !important; }
.cropper-point.point-n  { top: -8px !important;     margin-left: -8px !important; }
.cropper-point.point-s  { bottom: -8px !important;  margin-left: -8px !important; }
.cropper-point.point-ne { right: -8px !important;   top: -8px !important; }
.cropper-point.point-nw { left: -8px !important;    top: -8px !important; }
.cropper-point.point-se { right: -8px !important;   bottom: -8px !important; }
.cropper-point.point-sw { left: -8px !important;    bottom: -8px !important; }

/* Incompatibility banner (JS-injected) */
.compat-error {
  background: #7f1d1d;
  color: #fca5a5;
  padding: 16px;
  text-align: center;
  font-size: 0.85rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
}
