/* 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;
}

/* ══ TELA 1 — escolha de modo (cards 3D estilo Liga da Calistenia web) ══ */
.home-head { text-align: center; margin: 18px 0 16px; }
.home-title {
  font-size: 1.15rem; font-weight: 900; color: #fff; letter-spacing: 0.02em;
}
.home-sub { font-size: 0.72rem; color: rgba(255,255,255,0.45); margin-top: 3px; }

.mode-list { display: flex; flex-direction: column; gap: 10px; }

.mode-card {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 13px;
  width: 100%; padding: 14px 14px;
  border-radius: 16px; cursor: pointer; text-align: left;
  background: linear-gradient(135deg, #141031 0%, #16213e 45%, #0f1729 100%);
  border: 1px solid rgba(var(--ac), 0.4);
  border-top: 1.5px solid rgba(var(--ac), 0.65);
  box-shadow:
    0 0 28px rgba(var(--ac), 0.16),
    0 8px 24px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.06);
  color: #fff; font-family: inherit;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  animation: modeIn 0.4s cubic-bezier(0.16,1,0.3,1) both;
}
.mode-card:nth-child(1) { animation-delay: 0.02s; }
.mode-card:nth-child(2) { animation-delay: 0.08s; }
.mode-card:nth-child(3) { animation-delay: 0.14s; }
.mode-card:nth-child(4) { animation-delay: 0.20s; }
@keyframes modeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.mode-card:active { transform: scale(0.97); }
.mode-card:hover { box-shadow: 0 0 34px rgba(var(--ac), 0.28), 0 8px 24px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.08); }

.mode-glow {
  position: absolute; top: -20px; right: -20px; width: 90px; height: 90px;
  border-radius: 50%; background: rgba(var(--ac), 0.18);
  filter: blur(22px); pointer-events: none;
}
.mode-icon {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--g1), var(--g2));
  box-shadow: 0 4px 14px rgba(var(--ac), 0.5);
  font-size: 1.45rem; line-height: 1;
}
.mode-info { flex: 1; display: flex; flex-direction: column; gap: 2px; position: relative; }
.mode-name { font-weight: 900; font-size: 0.86rem; letter-spacing: 0.01em; color: #fff; }
.mode-desc { font-size: 0.63rem; color: rgba(255,255,255,0.5); line-height: 1.4; }
.mode-chev { color: rgba(var(--ac), 0.7); font-size: 1.25rem; line-height: 1; font-weight: 700; }

/* ══ TELA 2 — topbar com voltar + chip do modo ══ */
.analyze-topbar { display: flex; align-items: center; gap: 10px; margin: 10px 0 12px; }
.back-btn {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 12px;
  background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.75);
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 1.3rem; line-height: 1; cursor: pointer; padding-bottom: 3px;
  transition: transform 0.15s ease;
}
.back-btn:active { transform: scale(0.92); }
.mode-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px;
  background: rgba(240,185,11,0.08);
  border: 1px solid rgba(240,185,11,0.3);
  font-size: 0.74rem; font-weight: 800; color: #F0B90B; letter-spacing: 0.02em;
}

/* ══ TELA 0 — categorias: card desabilitado (EM BREVE) ══ */
.mode-soon { opacity: 0.55; cursor: default; }
.mode-soon:active { transform: none; }
.mode-soon:hover { box-shadow: 0 0 28px rgba(var(--ac), 0.16), 0 8px 24px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.06); }
.soon-chip {
  display: inline-block; vertical-align: middle; margin-left: 6px;
  padding: 1.5px 7px; border-radius: 5px;
  background: rgba(var(--ac), 0.3); border: 1px solid rgba(var(--ac), 0.5);
  font-size: 0.5rem; font-weight: 800; letter-spacing: 0.07em;
  color: rgba(255,255,255,0.85); text-transform: uppercase; line-height: 1.5;
}

/* ══ MOVIX — identidade estilo produto de IA ══ */
.brand { display: flex; align-items: center; gap: 7px; }
.brand-name {
  font-size: 1.15rem; font-weight: 900; letter-spacing: 0.06em;
  background: linear-gradient(90deg, #a78bfa 0%, #60a5fa 45%, #22d3ee 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 12px rgba(96,165,250,0.35));
}
.brand-ai {
  font-size: 0.52rem; font-weight: 800; letter-spacing: 0.1em;
  padding: 2px 6px; border-radius: 5px;
  color: #c4b5fd; background: rgba(139,92,246,0.18);
  border: 1px solid rgba(139,92,246,0.45);
}

.hero { text-align: center; padding: 26px 10px 6px; position: relative; }
.hero::before {
  content: ''; position: absolute; top: -30px; left: 50%; transform: translateX(-50%);
  width: 280px; height: 160px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(124,58,237,0.28), rgba(34,211,238,0.10), transparent);
  filter: blur(30px); pointer-events: none;
}
.hero-title {
  position: relative;
  font-size: 2.6rem; font-weight: 900; letter-spacing: 0.08em; line-height: 1;
  background: linear-gradient(90deg, #a78bfa 0%, #60a5fa 45%, #22d3ee 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 24px rgba(96,165,250,0.4));
}
.hero-tag {
  position: relative; margin-top: 8px;
  font-size: 0.82rem; font-weight: 700; color: rgba(255,255,255,0.85);
}
.hero-sub {
  position: relative; margin-top: 5px;
  font-size: 0.66rem; color: rgba(255,255,255,0.45);
}
