* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: #0f172a;
  color: #e2e8f0;
}

.container { width: min(1100px, 100%); margin: 0 auto; padding: 24px; }

.card {
  background: #1e293b;
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

h1 { margin-top: 0; font-size: 30px; display: flex; align-items: center; gap: 10px; }
h2 { font-size: 20px; }

.badge {
  font-size: 13px;
  background: #6366f1;
  color: #fff;
  padding: 3px 9px;
  border-radius: 999px;
  vertical-align: middle;
}

.subtitle { color: #94a3b8; font-size: 16px; }
code { background: #0f172a; padding: 1px 6px; border-radius: 6px; color: #93c5fd; }

/* ---------- Abas ---------- */
.tabs { display: flex; gap: 8px; margin-top: 22px; }
.tab {
  flex: 1; background: #0f172a; color: #94a3b8; font-weight: 600;
  border: 1px solid #334155; padding: 12px; border-radius: 12px; font-size: 15px;
}
.tab:hover { background: #11203a; color: #e2e8f0; }
.tab.active { background: #6366f1; color: #fff; border-color: #6366f1; }

/* ---------- Câmera ---------- */
.camera-box { display: grid; gap: 12px; }
#video {
  width: 100%; max-height: 420px; background: #000;
  border-radius: 14px; object-fit: contain;
}
.camera-controls { display: flex; flex-wrap: wrap; gap: 10px; }
.camera-controls button { flex: 1; min-width: 130px; }
#cam-shot { background: #16a34a; }
#cam-shot:hover:not(:disabled) { background: #15803d; }
#cam-stop { background: #475569; }

/* ---------- Upload ---------- */
.upload-box { display: grid; gap: 16px; margin-top: 18px; }
.tab-panel { display: grid; gap: 14px; }
.tab-panel[hidden] { display: none; }   /* o hidden precisa vencer o display:grid acima */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 38px 18px;
  border: 2px dashed #475569;
  border-radius: 16px;
  background: #0f172a;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  text-align: center;
}
.dropzone:hover, .dropzone.drag { border-color: #6366f1; background: #11203a; }
.dz-icon { font-size: 34px; }
.dz-text { font-size: 18px; font-weight: 600; }
.dz-hint { font-size: 13px; color: #94a3b8; }

.thumbs { display: flex; flex-wrap: wrap; gap: 10px; }
.thumb { width: 92px; text-align: center; position: relative; }
.thumb img {
  width: 92px; height: 92px; object-fit: cover; border-radius: 10px; background: #000;
}
.thumb-x {
  position: absolute; top: -6px; right: -6px; width: 22px; height: 22px;
  padding: 0; border-radius: 50%; background: #dc2626; color: #fff;
  font-size: 15px; line-height: 1; display: flex; align-items: center; justify-content: center;
}
.thumb-x:hover { background: #b91c1c; }
.thumb span {
  display: block; font-size: 10px; color: #94a3b8; margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

button {
  border: 0; border-radius: 12px; padding: 15px 18px; font-size: 16px;
  font-weight: 600; cursor: pointer; background: #6366f1; color: white;
  transition: background .15s;
}
button:hover { background: #4f46e5; }
button:disabled { background: #475569; cursor: default; }

/* ---------- Galeria de resultados ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.result-card {
  background: #0f172a;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #334155;
}
.result-card.dim { opacity: .82; border-style: dashed; }

.result-img-wrap { position: relative; }
.result-img {
  width: 100%; height: 210px; object-fit: cover; display: block; background: #000;
}
.pill {
  position: absolute; top: 10px; left: 10px;
  font-size: 12px; padding: 4px 9px; border-radius: 999px; font-weight: 600;
  backdrop-filter: blur(4px);
}
.pill.ok { background: rgba(22,163,74,.85); color: #fff; }
.pill.warn { background: rgba(217,119,6,.9); color: #fff; }

.result-body { padding: 16px; }

.primary {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--c) 18%, transparent);
  border-left: 5px solid var(--c);
}
.primary-emoji { font-size: 34px; }
.primary-label { font-size: 22px; font-weight: 700; color: #f1f5f9; }
.primary-conf { font-size: 13px; color: #94a3b8; }

.emotion-scores { margin-top: 14px; display: grid; gap: 7px; }
.mini-row {
  display: grid; grid-template-columns: 78px 1fr 38px; gap: 8px; align-items: center;
  font-size: 13px; color: #cbd5e1;
}

.filename { font-size: 12px; color: #64748b; margin: 14px 0 4px; }
.narrative { font-size: 14px; line-height: 1.5; color: #cbd5e1; }

details { margin-top: 10px; }
summary { cursor: pointer; color: #93c5fd; font-size: 14px; }

.scores { display: grid; gap: 8px; margin-top: 10px; }
.score-row {
  display: grid; grid-template-columns: 150px 1fr 50px; gap: 8px; align-items: center;
  font-size: 13px; color: #cbd5e1;
}

.bar-wrap { height: 9px; background: #334155; border-radius: 100px; overflow: hidden; }
.bar { height: 100%; background: #6366f1; border-radius: 100px; }
.bar.light { background: #38bdf8; }

.err { color: #fca5a5; }

.note {
  margin-top: 26px; padding: 16px;
  border-left: 4px solid #6366f1; background: #0f172a; border-radius: 10px;
  color: #94a3b8; font-size: 14px; line-height: 1.6;
}
.alert {
  padding: 12px; border-radius: 12px; margin-top: 16px;
  background: #422006; border: 1px solid #b45309; color: #fde68a;
}
.back { display: inline-block; margin-bottom: 12px; color: #93c5fd; text-decoration: none; }

@media (max-width: 600px) {
  .container { padding: 12px; }
  .card { padding: 18px; }
  .score-row { grid-template-columns: 110px 1fr 46px; }
}
