/* ══ Trivia (static/trivia.js) ══ */
#trivia-root { display: none; }
body.modo-trivia #trivia-root { display: block; }
.tv { color: var(--ink); font-family: var(--G); max-width: 620px; margin: 0 auto; }

.tv-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 4px 0 14px; border-bottom: 1px solid var(--rule); }
.tv-eyebrow { font-family: var(--M); font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint); }
.tv-title { font-family: var(--S); font-style: italic; font-weight: 400; font-size: 30px; line-height: 1; margin: 4px 0 0; }
.tv-marcas { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 13px; color: var(--ink-soft); }
.tv-racha b { font-family: var(--S); font-size: 20px; color: var(--purple); font-weight: 400; }
.tv-racha small { color: var(--ink-faint); }
.tv-fav { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--purple); border-radius: 999px;
  background: none; color: var(--purple); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.tv-fav svg { width: 15px; height: 15px; }

/* El feed: una tarjeta por pantalla, se desliza hacia arriba */
.tv-feed { overflow-y: auto; scroll-snap-type: y proximity; overscroll-behavior: contain; margin-top: 10px; scrollbar-width: none; }
.tv-feed::-webkit-scrollbar { display: none; }
/* Sin scroll propio: si la tarjeta no cabe, crece y se lee con el scroll del feed */
.tv-card { min-height: 100%; scroll-snap-align: start; display: flex; padding: 6px 0 14px; }
.tv-card-in { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; padding: 22px 20px;
  border: 1px solid var(--rule); border-radius: 18px; background: var(--paper); }
.tv-card.es-ok .tv-card-in { border-color: var(--purple); }
/* Centrado vertical que no recorta: si la tarjeta no cabe, empieza arriba y se desplaza */
.tv-card-in > :first-child { margin-top: auto; }
.tv-card-in > :last-child { margin-bottom: auto; }
.tv, .tv-feed, .tv-card { max-width: 100%; }
.tv-q, .tv-respuesta, .tv-contexto { overflow-wrap: anywhere; }
.tv-tipo { font-family: var(--M); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--purple); }
.tv-q { font-family: var(--S); font-weight: 400; font-size: 24px; line-height: 1.25; margin: 0; }

.tv-datos { width: 100%; border-collapse: collapse; font-size: 14px; }
.tv-datos th, .tv-datos td { padding: 7px 6px; border-bottom: 1px solid var(--rule-soft, var(--rule)); text-align: left; font-weight: 400; }
.tv-datos thead th { font-family: var(--M); font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }
.tv-datos td { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; width: 22%; }
.tv-datos thead th:not(:first-child) { text-align: right; }
.tv-datos-nombres thead th:not(:first-child) { letter-spacing: .04em; font-size: 10px; line-height: 1.25; vertical-align: bottom; overflow-wrap: anywhere; }
.tv-datos-nombres td { width: 26%; }

.tv-ops { display: grid; gap: 8px; }
.tv-op { min-height: 48px; padding: 10px 14px; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper);
  color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; text-align: left; cursor: pointer; transition: border-color .15s, background .15s; }
.tv-op:hover:not(:disabled) { border-color: var(--purple); }
.tv-op:disabled { cursor: default; opacity: .55; }
.tv-op.correcta { opacity: 1; border-color: var(--purple); background: var(--purple); color: var(--paper); }
.tv-op.incorrecta { opacity: 1; border-color: #8d393a; color: #8d393a; text-decoration: line-through; }

.tv-rev { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--rule); padding-top: 14px; }
.tv-veredicto { font-family: var(--M); font-size: 11px; letter-spacing: .16em; text-transform: uppercase; }
.es-ok .tv-veredicto { color: var(--purple); }
.es-mal .tv-veredicto { color: #8d393a; }
.tv-respuesta { margin: 0; font-size: 15px; font-weight: 600; line-height: 1.45; }
.tv-contexto { margin: 0; font-size: 14px; line-height: 1.55; color: var(--ink-soft); }
.tv-acciones { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.tv-link { border: 0; background: none; padding: 0; color: var(--purple); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.tv-nogusta { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 0; color: var(--ink-faint);
  font: inherit; font-size: 12px; cursor: pointer; }
.tv-nogusta svg { width: 15px; height: 15px; }
.tv-nogusta:hover { color: var(--purple); }
.tv-motivos { display: flex; flex-wrap: wrap; gap: 6px; }
.tv-motivos button, .tv-chips button { padding: 6px 12px; border: 1px solid var(--rule); border-radius: 999px; background: none;
  color: var(--ink-soft); font: inherit; font-size: 12px; cursor: pointer; }
.tv-motivos button:hover, .tv-chips button:hover { border-color: var(--purple); color: var(--purple); }
.tv-gracias { margin: 0; font-size: 12px; color: var(--ink-faint); }
.tv-sig { display: flex; flex-direction: column; align-items: center; gap: 6px; font-family: var(--M); font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-soft); text-align: center; }
.tv-sig svg { width: 18px; height: 13px; fill: var(--purple); animation: tv-baja 1.6s ease-in-out infinite; }
@keyframes tv-baja { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .tv-sig svg { animation: none; } }
.tv-aviso { padding: 40px 10px; text-align: center; color: var(--ink-faint); font-size: 14px; scroll-snap-align: start; }

/* Favoritos */
.tv-prefs { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; background: rgba(23, 22, 30, .45); padding: 16px; }
.tv-prefs.open { display: flex; }
.tv-prefs-box { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; padding: 22px; border-radius: 16px; background: var(--paper); color: var(--ink); }
.tv-prefs-box h2 { font-family: var(--S); font-style: italic; font-weight: 400; font-size: 24px; margin: 0 0 6px; }
.tv-sub { margin: 0; font-size: 13px; color: var(--ink-soft); line-height: 1.45; }
.tv-grupo { margin: 18px 0 8px; font-family: var(--M); font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--purple); }
.tv-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tv-chips button.on { border-color: var(--purple); background: var(--purple); color: var(--paper); }
.tv-chips small { color: var(--ink-faint); margin-left: 4px; }
.tv-buscar { width: 100%; margin: 0 0 8px; padding: 9px 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper);
  color: var(--ink); font: inherit; font-size: 14px; }
.tv-buscar:focus { outline: none; border-color: var(--purple); }
.tv-resultados:empty { display: none; }
.tv-prefs-acc { display: flex; justify-content: flex-end; align-items: center; gap: 16px; margin-top: 20px; }
.tv-guardar { padding: 9px 18px; border: 0; border-radius: 999px; background: var(--purple); color: var(--paper); font: inherit; font-weight: 600; cursor: pointer; }

@media (max-width: 768px) {
  .tv-title { font-size: 24px; }
  .tv-q { font-size: 21px; }
  .tv-card-in { padding: 18px 16px; }
}

/* El atributo hidden tiene que ganarle a los display de arriba */
.tv [hidden], .tv-prefs [hidden] { display: none !important; }
