/* Analisar 3.0 — design portado do leitura-exercicio-ia.pages.dev (Liga da Calistenia)
   Tokens: bg #0a0e23 · dourado #F0B90B · coral #FF7055 · cards rgba(10,13,20,0.85) */

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

html, body { height: 100%; }

body {
  background: #0a0e23;
  color: #fff;
  font-family: 'Inter', 'Manrope', system-ui, -apple-system, sans-serif;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

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

/* ── Header ── */
.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid rgba(255, 112, 85, 0.1);
  background: rgba(10, 14, 35, 0.8);
}
.header-logo { height: 36px; width: auto; object-fit: contain; filter: drop-shadow(0 2px 10px rgba(255,112,85,0.35)); }
.header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.header-title { font-size: 0.72rem; font-weight: 800; color: #FF7055; letter-spacing: 0.08em; text-transform: uppercase; }
.header-sub { font-size: 0.6rem; color: rgba(255,255,255,0.35); }

.app-main {
  flex: 1; padding: 16px;
  display: flex; flex-direction: column; gap: 14px;
}

/* ── Card base ── */
.card {
  background: rgba(10, 13, 20, 0.85);
  border: 1px solid rgba(240,185,11,0.25);
  border-radius: 18px;
  padding: 18px 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), inset 0 1px 0 rgba(240,185,11,0.08);
}

/* ── Seletor de modo ── */
.exercise-label {
  font-size: 0.65rem; font-weight: 800;
  color: rgba(240,185,11,0.7);
  letter-spacing: 0.1em; text-transform: uppercase;
  margin-bottom: 10px;
}
.exercise-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ex-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 13px;
  background: rgba(255,255,255,0.04);
  border: 1.5px solid rgba(240,185,11,0.18);
  border-radius: 12px;
  color: rgba(255,255,255,0.6);
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: all 0.15s;
  user-select: none;
}
.ex-btn input { display: none; }
.ex-btn:hover { background: rgba(240,185,11,0.08); border-color: rgba(240,185,11,0.4); }
.ex-btn:has(input:checked) { background: rgba(240,185,11,0.14); border-color: #F0B90B; color: #fff; }
.ex-btn-wide { grid-column: 1 / -1; }
.ex-icon { font-size: 1.1rem; }

/* ── Upload ── */
.upload-wrap { display: flex; flex-direction: column; gap: 12px; }

.drop-zone {
  border: 2px dashed rgba(240,185,11,0.3);
  border-radius: 16px; padding: 30px 20px;
  text-align: center; cursor: pointer;
  background: rgba(240,185,11,0.04);
  transition: all 0.2s;
}
.drop-zone:hover, .drop-zone.dragover { border-color: #F0B90B; background: rgba(240,185,11,0.08); }
.drop-icon { font-size: 2.2rem; margin-bottom: 10px; }
.drop-title { font-size: 0.9rem; font-weight: 600; margin-bottom: 4px; }
.drop-hint { font-size: 0.7rem; color: rgba(255,255,255,0.35); }

.btn-analyze {
  width: 100%; padding: 15px;
  border-radius: 50px; border: none;
  background: linear-gradient(135deg, #F0B90B, #d4a009);
  color: #0a0d14; font-size: 0.95rem; font-weight: 900;
  cursor: pointer; letter-spacing: 0.04em;
  box-shadow: 0 4px 20px rgba(240,185,11,0.35);
  transition: all 0.2s;
}
.btn-analyze:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(240,185,11,0.45); }
.btn-analyze:active { transform: scale(0.98); }

.actions-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap;
}
.btn-cancel {
  padding: 9px 22px; border-radius: 50px;
  border: 1px solid rgba(240,185,11,0.25);
  background: transparent; color: rgba(255,255,255,0.5);
  font-size: 0.8rem; cursor: pointer;
  transition: all 0.15s;
}
.btn-cancel:hover { border-color: rgba(240,185,11,0.5); color: #fff; }

.status { color: rgba(255,255,255,0.4); font-size: 0.72rem; text-align: right; flex: 1; }
.status.ready { color: #F0B90B; }
.status.error { color: #f87171; }

/* ── Palco de vídeo ── */
.vp-container {
  position: relative; border-radius: 16px; overflow: hidden;
  background: #000;
  border: 1px solid rgba(240,185,11,0.2);
  box-shadow: 0 8px 32px rgba(0,0,0,0.7);
}
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #000;
}
#video { display: none; }
#canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.counters {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  z-index: 5;
}
.counter {
  font-weight: 800;
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 6px;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(6px);
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
.counter.correct { background: rgba(22,163,74,0.85); }
.counter.incorrect { background: rgba(220,38,38,0.85); }

.feedback {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 5;
}
.feedback .msg {
  font-weight: 800;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 6px;
  color: #0a0d14;
  background: #fbbf24;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
  animation: pop 0.15s ease-out;
}
.feedback .msg.danger { background: #f87171; color: #fff; }
@keyframes pop { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.camera-warn {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(220, 38, 38, 0.92);
  color: #fff;
  font-weight: 700;
  font-size: 0.72rem;
  padding: 6px 14px;
  border-radius: 50px;
  z-index: 5;
  white-space: nowrap;
  max-width: 95%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hidden { display: none !important; }

/* ── Overlay de análise (feedback de que está trabalhando) ── */
.analyze-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(10, 13, 20, 0.55);
  backdrop-filter: blur(3px);
  text-align: center;
  padding: 16px;
}
.analyze-spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(240,185,11,0.2);
  border-top-color: #F0B90B;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.analyze-text {
  font-size: 1.15rem;
  font-weight: 900;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.analyze-sub {
  font-size: 0.66rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.04em;
}

/* ── Progresso ── */
.progress {
  height: 5px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 3px;
  background: linear-gradient(90deg, #F0B90B, #d4a009);
  transition: width 0.1s linear;
}

/* ── Download / Compartilhar ── */
.download-bar { display: flex; gap: 10px; }
.btn-share {
  flex: 1.4;
  padding: 13px 14px; border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, #F0B90B, #d4a009);
  color: #0a0d14;
  font-size: 0.85rem; font-weight: 900; cursor: pointer;
  box-shadow: 0 4px 20px rgba(240,185,11,0.35);
  transition: all 0.15s;
}
.btn-share:not(:disabled):hover { transform: translateY(-1px); }
.btn-share:disabled { opacity: 0.4; cursor: wait; }
.btn-download {
  flex: 1;
  padding: 13px 14px; border-radius: 12px;
  border: 1px solid rgba(240,185,11,0.5);
  background: rgba(240,185,11,0.12); color: #F0B90B;
  font-size: 0.85rem; font-weight: 800; cursor: pointer;
  transition: all 0.15s;
}
.btn-download:hover { background: rgba(240,185,11,0.2); }
.btn-download:disabled { opacity: 0.4; cursor: wait; }

/* ── HUD (linha de infos) ── */
.vp-info-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.vp-info-item {
  background: rgba(10,13,20,0.9); border: 1px solid rgba(240,185,11,0.18);
  border-radius: 12px; padding: 10px 8px; text-align: center;
}
.vp-info-label { display: block; font-size: 0.58rem; color: rgba(255,255,255,0.35); margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.06em; }
.vp-info-value { font-size: 0.92rem; font-weight: 800; color: #fff; }
.vp-info-value b { font-weight: 800; }

/* ── Painel AI Calistenia ── */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(240,185,11,0.18);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.45);
}
.chip b { color: #fff; text-transform: capitalize; font-weight: 700; }

.detect-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.detect-label {
  font-size: 0.62rem; font-weight: 800;
  color: rgba(240,185,11,0.7);
  letter-spacing: 0.14em; text-transform: uppercase;
}
.move-name { font-size: 1.5rem; font-weight: 900; color: #F0B90B; }
.move-name.none { color: rgba(255,255,255,0.25); }
.detect-score { text-align: right; }
.move-score { font-size: 1.5rem; font-weight: 900; color: #FF7055; }

.breakdown { display: flex; flex-direction: column; gap: 7px; }
.breakdown .row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) 1fr 46px;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
}
.breakdown .row .lbl { color: rgba(255,255,255,0.65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breakdown .row .bar {
  height: 7px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.breakdown .row .fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #d4a009, #F0B90B);
  transition: width 0.15s linear;
}
.breakdown .row .fill.low { background: linear-gradient(90deg, #b45309, #fb923c); }
.breakdown .row .pct { text-align: right; color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ── Footer ── */
.app-footer {
  text-align: center;
  color: rgba(255,255,255,0.18);
  font-size: 0.6rem;
  padding: 8px 16px 22px;
}
