/* ══════════════════════════════════════════════════════════════
   Projeto 02 — Recomendador de Filmes e Séries
   Dark theme · Accent violeta (#d2a8ff)
   ══════════════════════════════════════════════════════════════ */

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

:root {
  --bg:        #0d1117;
  --surface:   #161b22;
  --border:    #30363d;
  --border-hi: #484f58;
  --text:      #e6edf3;
  --muted:     #8b949e;
  --dim:       #484f58;
  --accent:    #d2a8ff;
  --accent-lo: rgba(210,168,255,.12);
  --accent-hi: #e0c3ff;
  --green:     #3fb950;
  --yellow:    #e3b341;
  --red:       #f85149;
  --radius:    12px;
  --radius-sm: 8px;
}

html { font-size: 16px; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Utilitários ── */
.hidden { display: none !important; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); }

/* ══ BOTÕES ══════════════════════════════════════════════════════ */

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #0d1117;
  font-size: .9rem; font-weight: 700;
  padding: 10px 22px; border-radius: var(--radius-sm);
  border: none; cursor: pointer;
  transition: background .18s, transform .18s, box-shadow .18s;
  box-shadow: 0 4px 16px rgba(210,168,255,.25);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hi);
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(210,168,255,.4);
}
.btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: var(--muted);
  font-size: .85rem; font-weight: 500;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-hi); background: rgba(255,255,255,.04); }

.btn-sm { font-size: .8rem; padding: 6px 14px; }

/* ══ SPINNER ══════════════════════════════════════════════════════ */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ══ TELA: LOBBY ══════════════════════════════════════════════════ */

#screen-lobby {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.lobby-emoji { font-size: 3.5rem; margin-bottom: 16px;
  animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%,100%{transform:scale(1)} 50%{transform:scale(1.08)} }

.lobby-tag {
  font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 8px;
}

#screen-lobby h1 {
  font-size: 2rem; font-weight: 800; color: #fff;
  letter-spacing: -.02em; margin-bottom: 10px;
}

.lobby-desc {
  font-size: .95rem; color: var(--muted);
  max-width: 420px; line-height: 1.7; margin-bottom: 36px;
}
.lobby-desc strong { color: var(--text); }

/* Formulário de entrada */
.lobby-form {
  display: flex; flex-direction: column; gap: 14px;
  width: 100%; max-width: 340px; text-align: left;
}

.lobby-form label {
  font-size: .8rem; font-weight: 600; color: var(--muted);
  letter-spacing: .06em; text-transform: uppercase;
  display: flex; flex-direction: column; gap: 6px;
}

.lobby-form input {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 1rem;
  outline: none; transition: border-color .18s, box-shadow .18s;
}
.lobby-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(210,168,255,.15);
}
.lobby-form input::placeholder { color: var(--dim); }

.lobby-form .btn-primary { width: 100%; justify-content: center; margin-top: 4px; }

.lobby-divider {
  width: 100%; max-width: 340px;
  display: flex; align-items: center; gap: 12px;
  color: var(--dim); font-size: .8rem; margin: 4px 0;
}
.lobby-divider::before, .lobby-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.lobby-restore-btn {
  background: transparent; color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 22px; font-size: .85rem; font-weight: 500;
  cursor: pointer; width: 100%; max-width: 340px;
  transition: color .18s, border-color .18s;
}
.lobby-restore-btn:hover { color: var(--accent); border-color: var(--accent); }

.lobby-error {
  color: var(--red); font-size: .82rem; margin-top: 4px; text-align: center;
}

.lobby-hint {
  font-size: .75rem; color: var(--dim);
  max-width: 340px; text-align: center;
  margin-top: 10px; line-height: 1.5;
}

.back-link {
  position: fixed; top: 20px; left: 24px;
  font-size: .8rem; color: var(--dim); text-decoration: none;
  letter-spacing: .05em; transition: color .18s;
}
.back-link:hover { color: var(--accent); }

/* ── K-Means: grupos de gosto ────────────────────────────────────────────── */
.kmeans-estado {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.6;
}
.kmeans-icone { font-size: 2rem; flex-shrink: 0; }
.kmeans-msg strong { color: var(--text); }

.kmeans-meu-cluster {
  background: linear-gradient(135deg, #1a2f4a 0%, #0d1b2a 100%);
  border: 2px solid var(--accent);
  border-radius: 14px;
  padding: 20px 24px;
  margin-bottom: 20px;
  font-size: .95rem;
  line-height: 1.7;
}
.kmeans-meu-cluster .cluster-titulo {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 4px;
}
.kmeans-meu-cluster .cluster-colegas {
  font-size: .82rem;
  color: var(--muted);
  margin-top: 8px;
}
.kmeans-meu-cluster .cluster-colegas span {
  display: inline-block;
  background: rgba(88,166,255,.12);
  border-radius: 20px;
  padding: 2px 10px;
  margin: 3px 4px 3px 0;
  color: var(--text);
  font-size: .78rem;
}

.kmeans-meu-cluster .cluster-explicacao {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,.08);
  color: var(--text);
}

.kmeans-meu-cluster .cluster-explicacao strong {
  display: block;
  margin-bottom: 6px;
}

.cluster-tags-explicacao {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.cluster-tags-explicacao span {
  display: inline-block;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .75rem;
  color: var(--text);
}

.kmeans-rec-section {
  margin-bottom: 20px;
}

.kmeans-rec-section h4 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.kmeans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.kmeans-cluster-card {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  font-size: .85rem;
  line-height: 1.6;
}
.kmeans-cluster-card.eu-aqui {
  border-color: var(--accent);
  background: rgba(88,166,255,.06);
}
.kmeans-cluster-card .cluster-label {
  font-weight: 700;
  font-size: .95rem;
  margin-bottom: 6px;
}
.kmeans-cluster-card .cluster-criterio {
  margin-top: 10px;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.55;
}
.kmeans-cluster-card .cluster-membros {
  color: var(--muted);
  font-size: .78rem;
}
.kmeans-cluster-card .cluster-membros span {
  display: inline-block;
  background: rgba(255,255,255,.06);
  border-radius: 20px;
  padding: 2px 8px;
  margin: 2px 3px 2px 0;
  color: var(--text);
  font-size: .75rem;
}

.footer-note {
  position: fixed; bottom: 20px;
  font-size: .72rem; color: var(--dim);
}

/* Modal restaurar código */
.restore-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 24px;
}
.restore-modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px;
  width: 100%; max-width: 360px; text-align: center;
  display: flex; flex-direction: column; gap: 16px;
}
.restore-modal h3 { font-size: 1.1rem; color: var(--text); }
.restore-modal p  { font-size: .85rem; color: var(--muted); }
.restore-modal input {
  width: 100%; background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 1.1rem; font-weight: 700;
  text-align: center; letter-spacing: .2em; text-transform: uppercase;
  outline: none; transition: border-color .18s, box-shadow .18s;
}
.restore-modal input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(210,168,255,.15);
}
.restore-modal-actions { display: flex; gap: 10px; justify-content: center; }
.restore-modal-error { color: var(--red); font-size: .82rem; }

/* ══ HEADER (telas internas) ══════════════════════════════════════ */

#app-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13,17,23,.9);
  backdrop-filter: blur(12px) saturate(1.5);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px; height: 56px;
}

.header-logo { font-size: 1.3rem; }
.header-title { font-size: .95rem; font-weight: 700; color: var(--text); }
.header-code {
  font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-lo);
  padding: 3px 8px; border-radius: 4px;
}

.header-nome {
  font-size: .8rem; font-weight: 600; color: var(--muted);
  padding: 3px 8px;
}
.header-spacer { flex: 1; }
.header-nav { display: flex; gap: 4px; }

.header-nav a, .header-nav button {
  background: transparent; color: var(--muted);
  font-size: .82rem; font-weight: 500;
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: none; cursor: pointer; text-decoration: none;
  transition: color .18s, background .18s;
  display: inline-flex; align-items: center; gap: 5px;
}
.header-nav a:hover, .header-nav button:hover { color: var(--text); background: rgba(255,255,255,.06); }
.header-nav a.active { color: var(--accent); background: var(--accent-lo); }

/* ══ TELA: CATÁLOGO ═══════════════════════════════════════════════ */

#screen-catalogo {
  max-width: 900px; margin: 0 auto;
  padding: 32px 24px 80px;
}

.catalogo-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 28px; flex-wrap: wrap; gap: 16px;
}
.catalogo-header h2 { font-size: 1.4rem; font-weight: 800; color: var(--text); }
.catalogo-header p  { font-size: .85rem; color: var(--muted); margin-top: 4px; }

.catalogo-progress-group {
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
}
.catalogo-progress {
  display: flex; align-items: center; gap: 10px;
  font-size: .82rem; color: var(--muted);
}
.progress-bar-legend {
  font-size: .72rem; color: var(--dim); width: 90px; text-align: right; flex-shrink: 0;
}
.progress-bar-wrap {
  width: 120px; height: 6px; background: var(--border);
  border-radius: 3px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; background: var(--accent);
  border-radius: 3px; transition: width .4s;
}
.progress-bar-fill-cat {
  background: var(--green);
}

/* Filtros */
.catalogo-filters-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.catalogo-filters {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.filter-btn {
  background: var(--surface); color: var(--muted);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 5px 14px; font-size: .78rem; font-weight: 500;
  cursor: pointer; transition: color .18s, border-color .18s, background .18s;
}
.filter-btn:hover { color: var(--text); border-color: var(--border-hi); }
.filter-btn.active { color: var(--accent); border-color: var(--accent); background: var(--accent-lo); }

.catalogo-ordenar {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 600;
  white-space: nowrap;
}

.catalogo-ordenar label {
  color: var(--text);
}

.catalogo-ordenar select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 36px 8px 12px;
  font-size: .85rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  outline: none;
  transition: border-color .18s, box-shadow .18s, background .18s;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.catalogo-ordenar select:hover {
  border-color: var(--border-hi);
}

.catalogo-ordenar select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(210,168,255,.15);
}

/* Grid de filmes */
.filmes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

/* Card de filme */
.filme-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex; flex-direction: column; gap: 10px;
  transition: border-color .18s, box-shadow .18s;
  position: relative;
}
.filme-card:hover { border-color: var(--border-hi); box-shadow: 0 4px 20px rgba(0,0,0,.3); }
.filme-card.avaliado { border-color: rgba(210,168,255,.3); }
.filme-card.gostou  { border-color: rgba(63,185,80,.3); }
.filme-card.nao-assisti { opacity: .6; }

.filme-card-top { display: flex; align-items: flex-start; gap: 10px; }

.filme-tipo-badge {
  font-size: .62rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 4px;
  flex-shrink: 0; margin-top: 2px;
}
.badge-filme { background: rgba(63,185,80,.15); color: var(--green); }
.badge-serie { background: rgba(226,179,65,.15); color: var(--yellow); }

.filme-titulo { font-size: .95rem; font-weight: 700; color: var(--text); line-height: 1.3; flex: 1; }
.filme-meta   { font-size: .75rem; color: var(--dim); line-height: 1.6; }

.filme-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.filme-tag {
  font-size: .68rem; padding: 2px 8px; border-radius: 4px;
  background: rgba(255,255,255,.06); color: var(--muted);
}

/* Estado: salvando nota */
.saving-indicator {
  position: absolute; top: 10px; right: 12px;
  font-size: .7rem; color: var(--accent);
  display: flex; align-items: center; gap: 4px;
}
.saving-indicator .spinner { width: 10px; height: 10px; border-width: 2px; }

/* ══ TELA: RECOMENDAÇÕES ══════════════════════════════════════════ */

#screen-recomendacoes {
  max-width: 800px; margin: 0 auto;
  padding: 32px 24px 80px;
}

#screen-recomendacoes h2 {
  font-size: 1.4rem; font-weight: 800; margin-bottom: 6px;
}
#screen-recomendacoes .rec-sub {
  font-size: .88rem; color: var(--muted); margin-bottom: 32px;
}

/* Botão calcular */
.rec-calc-wrap { text-align: center; padding: 40px 0; }
.rec-calc-wrap p { font-size: .88rem; color: var(--muted); margin-top: 12px; }

/* Estado: poucas notas */
.rec-empty {
  text-align: center; padding: 48px 24px;
  background: var(--surface); border: 1px dashed var(--border);
  border-radius: var(--radius);
}
.rec-empty .rec-empty-emoji { font-size: 3rem; margin-bottom: 12px; }
.rec-empty p { color: var(--muted); font-size: .9rem; line-height: 1.6; }
.rec-empty strong { color: var(--text); }

/* Vizinhos */
.vizinhos-section { margin-bottom: 32px; }
.vizinhos-section h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 14px; }

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

.vizinho-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 14px;
}

.vizinho-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-lo); border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 800; color: var(--accent);
  flex-shrink: 0;
}

.vizinho-info { flex: 1; min-width: 0; }
.vizinho-nome { font-size: .9rem; font-weight: 700; color: var(--text); }
.vizinho-turma { font-size: .75rem; color: var(--dim); }

.vizinho-sim { text-align: right; flex-shrink: 0; }
.vizinho-pct {
  font-size: 1rem; font-weight: 800;
  color: var(--accent);
}
.vizinho-pct-label { font-size: .7rem; color: var(--dim); }

.sim-bar-wrap {
  width: 80px; height: 4px; background: var(--border);
  border-radius: 2px; overflow: hidden; margin-top: 4px;
}
.sim-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; }

/* Cards de recomendação */
.rec-lista-section h3 {
  font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 14px;
}

.rec-filmes-list { display: flex; flex-direction: column; gap: 12px; }

.rec-filme-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex; align-items: center; gap: 16px;
  transition: border-color .18s;
}
.rec-filme-card:hover { border-color: var(--border-hi); }

.rec-rank {
  font-size: 1.3rem; font-weight: 900; color: var(--accent);
  width: 28px; text-align: center; flex-shrink: 0;
}

.rec-info { flex: 1; min-width: 0; }
.rec-titulo { font-size: 1rem; font-weight: 700; color: var(--text); }
.rec-motivo { font-size: .78rem; color: var(--muted); margin-top: 3px; line-height: 1.5; }

.rec-score {
  flex-shrink: 0; text-align: right;
  font-size: .85rem; color: var(--muted);
  display: flex; flex-direction: column; align-items: flex-end; gap: 3px;
}
.rec-score-stars { font-size: .9rem; }

/* Loading de recomendações */
.rec-loading {
  text-align: center; padding: 48px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  color: var(--muted); font-size: .9rem;
}

.didatica-section {
  margin-top: 32px;
}

.didatica-section h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.didatica-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.didatica-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.didatica-card-wide {
  grid-column: 1 / -1;
}

.didatica-card-title {
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}

.didatica-resumo {
  font-size: .84rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

.didatica-vazia {
  font-size: .84rem;
  color: var(--dim);
  line-height: 1.6;
}

.didatica-formula {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  font-size: .8rem;
  color: var(--text);
  line-height: 1.6;
}

.didatica-tabela-wrap {
  overflow-x: auto;
}

.didatica-tabela {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
}

.didatica-tabela th,
.didatica-tabela td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-align: left;
}

.didatica-tabela th {
  color: var(--muted);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.didatica-metricas {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.didatica-metrica {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 10px;
  padding: 10px;
}

.didatica-metrica span {
  display: block;
  font-size: .68rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--dim);
  margin-bottom: 4px;
}

.didatica-metrica strong {
  font-size: .98rem;
  color: var(--text);
}

.didatica-subbloco {
  margin-top: 14px;
}

.didatica-subtitulo {
  font-size: .78rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.didatica-lista {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.6;
}

.didatica-lista li + li {
  margin-top: 6px;
}

.didatica-eixos-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* ══ CARD: badges de metadados ══ */

.meta-badge {
  font-size: .65rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; padding: 2px 7px; border-radius: 4px;
}
.meta-ok    { background: rgba(63,185,80,.12); color: var(--green); }
.meta-vazio { background: rgba(226,179,65,.1); color: var(--yellow); }

/* ══ CARD: linha de avaliação inline ══ */

.card-nota-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  padding-top: 10px;
  flex-wrap: nowrap;
}

/* Botões de nota inline no card */
.nota-inline-btn {
  flex: 1;
  min-width: 0;
  padding: 6px 2px;
  border-radius: 8px;
  border: 2px solid var(--border);
  background: var(--bg);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s, transform .1s;
  opacity: .55;
}
.nota-inline-btn:hover {
  opacity: .85;
  border-color: var(--border-hi);
  transform: translateY(-1px);
}
.nota-inline-btn.selected {
  opacity: 1;
  transform: translateY(-2px);
}
.nota-inline-btn.saving {
  opacity: .4;
  cursor: wait;
}

/* Cores selecionadas por variante */
.nota-inline-btn.btn-nao-gostei.selected  { border-color: var(--red);    background: rgba(248,81,73,.12); }
.nota-inline-btn.btn-foi-ok.selected      { border-color: var(--yellow); background: rgba(226,179,65,.12); }
.nota-inline-btn.btn-gostei.selected      { border-color: var(--green);  background: rgba(63,185,80,.12); }
.nota-inline-btn.btn-gostei-mt.selected   { border-color: #58a6ff;       background: rgba(88,166,255,.12); }
.nota-inline-btn.btn-amei.selected        { border-color: #a78bfa;       background: rgba(167,139,250,.15); }

/* ══ LINHA: NÃO ASSISTI ══ */

.card-nao-assisti-row {
  display: flex;
  margin-top: -2px;
}

.btn-nao-assisti {
  width: 100%;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: .75rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--muted);
  transition: border-color .15s, color .15s, background .15s;
  text-align: center;
  letter-spacing: .02em;
}
.btn-nao-assisti:hover {
  border-color: var(--border-hi);
  color: var(--text);
}
.btn-nao-assisti.selected {
  border-color: #4caf50;
  border-style: solid;
  border-width: 2px;
  background: rgba(76,175,80,.12);
  color: #4caf50;
  font-weight: 700;
}

/* Linha de metadados (abaixo dos botões de nota) */
.card-meta-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

/* Botão de metadados (abre modal) */
.btn-meta-icon {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: .78rem;
  cursor: pointer;
  color: var(--muted);
  transition: border-color .15s, color .15s;
  white-space: nowrap;
  text-align: center;
}
.btn-meta-icon:hover { border-color: var(--accent); color: var(--accent); }

/* Check de metadados completos */
.meta-check {
  color: var(--green);
  font-weight: 700;
  margin-right: 2px;
}

/* ══ MODAL DE AVALIAÇÃO ══ */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 24px;
  overflow-y: auto;
}

.modal-card {
  background: var(--surface); border: 1px solid var(--border-hi);
  border-radius: 16px;
  width: 100%; max-width: 520px;
  padding: 28px 28px 24px;
  display: flex; flex-direction: column; gap: 24px;
  max-height: 90vh; overflow-y: auto;
}

.modal-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
}
.modal-titulo { font-size: 1.15rem; font-weight: 800; color: var(--text); }
.modal-subtitulo { font-size: .8rem; color: var(--muted); margin-top: 3px; }

.modal-close {
  background: transparent; border: 1px solid var(--border);
  border-radius: 8px; color: var(--muted);
  padding: 4px 10px; font-size: .9rem; cursor: pointer;
  flex-shrink: 0; transition: color .18s, border-color .18s;
}
.modal-close:hover { color: var(--red); border-color: var(--red); }

.modal-section { display: flex; flex-direction: column; gap: 12px; }
.modal-section-title {
  font-size: .82rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
  border-bottom: 1px solid var(--border); padding-bottom: 6px;
}

.modal-nota-status {
  font-size: .8rem; color: var(--accent); min-height: 1.2em;
  text-align: center;
}

.modal-meta-desc {
  font-size: .8rem; color: var(--muted); line-height: 1.5;
}

.btn-salvar-meta {
  align-self: flex-start;
  font-size: .85rem; padding: 9px 20px;
}

/* ══ CAMPOS DINÂMICOS (modal + form adicionar) ══ */

.campo-wrap {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.05);
}
.campo-wrap:last-child { border-bottom: none; }

.campo-label {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted);
}

.campo-select, .campo-text-input {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 12px; font-size: .9rem; font-family: inherit;
  outline: none; width: 100%;
  transition: border-color .18s;
}
.campo-select:focus, .campo-text-input:focus {
  border-color: var(--accent);
}

.campo-bool-row { display: flex; gap: 8px; }
.campo-bool-btn {
  flex: 1; padding: 8px;
  background: var(--bg); color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; font-size: .88rem; font-weight: 600; font-family: inherit;
  transition: color .18s, border-color .18s, background .18s;
}
.campo-bool-btn:hover { color: var(--text); border-color: var(--border-hi); }
.campo-bool-btn.selected {
  color: var(--accent); border-color: var(--accent); background: var(--accent-lo);
}

.campo-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.campo-chip {
  background: var(--bg); color: var(--muted);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 4px 13px; font-size: .78rem; font-weight: 500; font-family: inherit;
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.campo-chip:hover { color: var(--text); border-color: var(--border-hi); }
.campo-chip.selected {
  color: var(--accent); border-color: var(--accent); background: var(--accent-lo);
}

/* ══ TELA: ADICIONAR FILME ══ */

#screen-adicionar {
  max-width: 700px; margin: 0 auto;
  padding: 32px 24px 80px;
}

.adicionar-header { margin-bottom: 28px; }
.adicionar-header h2 { font-size: 1.4rem; font-weight: 800; }
.adicionar-header p  { font-size: .88rem; color: var(--muted); margin-top: 6px; }

.adicionar-form { display: flex; flex-direction: column; gap: 24px; }

.form-fieldset {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 20px 16px;
  display: flex; flex-direction: column; gap: 16px;
}
.form-fieldset legend {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted);
  padding: 0 6px; margin-left: -6px;
}

.form-label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted);
}
.form-label input, .form-label select {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 9px 13px; font-size: .95rem; font-family: inherit;
  outline: none; transition: border-color .18s;
}
.form-label input:focus, .form-label select:focus {
  border-color: var(--accent);
}
.form-label input::placeholder { color: var(--dim); }

.form-required { color: var(--accent); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.form-actions {
  display: flex; gap: 12px; justify-content: flex-end;
}
.form-error {
  color: var(--red); font-size: .82rem; text-align: center;
  background: rgba(248,81,73,.08); border: 1px solid rgba(248,81,73,.2);
  border-radius: 8px; padding: 10px 14px;
}
.form-success {
  color: var(--green); font-size: .82rem; text-align: center;
  background: rgba(63,185,80,.08); border: 1px solid rgba(63,185,80,.2);
  border-radius: 8px; padding: 10px 14px;
}

/* ══ VISUALIZAÇÕES (PCA + Heatmap) ════════════════════════════════ */

.viz-section {
  margin-top: 40px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.viz-section h3 {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 6px;
}

.viz-intro {
  color: var(--muted);
  font-size: .88rem;
  margin-bottom: 20px;
}

.viz-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.viz-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.viz-card-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
}

.viz-card-desc {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1.4;
}

.viz-card canvas {
  border-radius: 8px;
  width: 100%;
  height: auto;
  display: block;
}

.viz-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: .75rem;
  color: var(--muted);
  margin-top: 4px;
}

.viz-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.viz-dot-eu      { background: #f9c846; border: 2px solid #fff; }
.viz-dot-vizinho { background: #6ec6ff; border: 2px solid #fff; }
.viz-dot-outro   { background: rgba(180,180,200,.45); }

.viz-heat-swatch {
  display: inline-block;
  width: 14px; height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ══ RESPONSIVO ═══════════════════════════════════════════════════ */

@media (max-width: 700px) {
  .viz-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .didatica-grid,
  .didatica-eixos-grid,
  .didatica-metricas {
    grid-template-columns: 1fr;
  }

  .filmes-grid { grid-template-columns: 1fr; }
  .catalogo-header { flex-direction: column; align-items: flex-start; }
  #app-header { padding: 0 16px; }
  #screen-catalogo, #screen-recomendacoes, #screen-adicionar { padding: 24px 16px 80px; }
  .form-row { grid-template-columns: 1fr; }
  .modal-card { padding: 20px 16px; }
}
