/* ── Reset & Variables ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f0f0f;
  --surface:   #1a1a1a;
  --surface2:  #242424;
  --border:    #2e2e2e;
  --text:      #e8e8e8;
  --muted:     #888;
  --accent:    #ff4444;
  --accent-h:  #ff2020;
  --radius:    8px;
  --font:      'Inter', system-ui, -apple-system, sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 60px;
}

.logo {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
}

.logo span { color: var(--text); }

.search-wrap {
  flex: 1;
  max-width: 520px;
  position: relative;
}

.search-wrap input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 40px 8px 16px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}

.search-wrap input:focus { border-color: var(--accent); }

.search-wrap .search-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.header-nav { display: flex; gap: 8px; margin-left: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .15s, color .15s;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-h); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn-danger { background: #7f1d1d; color: #fca5a5; }
.btn-danger:hover { background: #991b1b; }

/* ── Filters bar ───────────────────────────────────────────────────────────── */
.filters {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}

.filters-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filter-label {
  font-size: 12px;
  color: var(--muted);
  margin-right: 4px;
}

.filter-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  color: var(--text);
}

.filter-chip:hover,
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.filter-select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 10px;
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.filter-select:focus { border-color: var(--accent); }

/* ── Page title section ────────────────────────────────────────────────────── */
.page-hero {
  padding: 32px 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.page-hero h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.page-hero .meta {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--muted);
}

/* ── Reactions Grid ────────────────────────────────────────────────────────── */
.section { padding: 28px 0; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.reactions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.reaction-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
}

.reaction-card:hover {
  transform: translateY(-2px);
  border-color: #444;
}

.reaction-thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: #111;
}

.reaction-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}

.reaction-card:hover .reaction-thumb img { transform: scale(1.04); }

.play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.3);
  opacity: 0;
  transition: opacity .2s;
}

.reaction-card:hover .play-overlay { opacity: 1; }

.play-btn {
  width: 52px;
  height: 52px;
  background: rgba(255,68,68,.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.duration-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,.8);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
}

.lang-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0,0,0,.75);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
}

.reaction-info {
  padding: 12px;
}

.reaction-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reaction-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.reactor-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--muted);
  transition: color .15s;
}

.reactor-link:hover { color: var(--text); }

.reactor-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface2);
}

.topic-link {
  color: var(--accent);
  font-size: 11px;
  transition: opacity .15s;
}
.topic-link:hover { opacity: .75; }

/* ── Empty state ───────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  grid-column: 1 / -1;
}

.empty-state svg { margin: 0 auto 16px; opacity: .3; }
.empty-state p { font-size: 14px; }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(12px);
  transition: transform .2s;
}

.modal-backdrop.open .modal { transform: translateY(0); }

.modal-video {
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
}

.modal-video iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.modal-body { padding: 20px; }

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.4;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.modal-meta a { color: var(--accent); }
.modal-meta a:hover { text-decoration: underline; }

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0,0,0,.6);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #fff;
  font-size: 18px;
  z-index: 10;
}

.modal-wrap { position: relative; }

/* ── Reactor / Topic hero ──────────────────────────────────────────────────── */
.entity-hero {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 28px 0;
}

.entity-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface2);
  flex-shrink: 0;
}

.entity-avatar-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  flex-shrink: 0;
}

.entity-info h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.entity-info p  { font-size: 13px; color: var(--muted); }

/* ── Topic cover grid ──────────────────────────────────────────────────────── */
.topic-cover {
  width: 56px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--surface2);
  flex-shrink: 0;
}

/* ── Admin panel ───────────────────────────────────────────────────────────── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.admin-sidebar .logo {
  padding: 0 20px 20px;
  display: block;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  font-size: 14px;
  color: var(--muted);
  transition: all .15s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: var(--surface2);
  color: var(--text);
}

.sidebar-nav a.active { color: var(--accent); }

.admin-content { flex: 1; padding: 28px; overflow-x: hidden; }

.admin-content h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
}

/* ── Table ─────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
  background: var(--surface2);
  white-space: nowrap;
}

tr:hover td { background: rgba(255,255,255,.02); }

td .thumb-xs {
  width: 64px;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 4px;
}

/* ── Form ──────────────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }

label { font-size: 13px; color: var(--muted); font-weight: 500; }

input[type="text"],
input[type="url"],
input[type="date"],
input[type="password"],
select,
textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color .2s;
  width: 100%;
}

input:focus, select:focus, textarea:focus { border-color: var(--accent); }

textarea { resize: vertical; min-height: 80px; }

.form-actions { margin-top: 8px; display: flex; gap: 10px; }

.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
}
.alert-success { background: #14532d; color: #86efac; border: 1px solid #166534; }
.alert-error   { background: #7f1d1d; color: #fca5a5; border: 1px solid #991b1b; }

/* ── Login ─────────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 36px;
  width: 100%;
  max-width: 360px;
}

.login-box h1 { font-size: 1.3rem; margin-bottom: 24px; }

/* ── Pagination ────────────────────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 28px 0 8px;
  flex-wrap: wrap;
}

.pagination a,
.pagination span {
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination span.current { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Stats bar ─────────────────────────────────────────────────────────────── */
.stats-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0;
}

.stats-inner {
  display: flex;
  align-items: center;
  gap: 0;
  height: 48px;
  overflow-x: auto;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px;
  text-decoration: none;
  color: var(--muted);
  transition: color .15s;
  white-space: nowrap;
  line-height: 1.2;
}

.stat-item:hover, .stat-item.active { color: var(--text); }
.stat-item.active .stat-num { color: var(--accent); }

.stat-num {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}

.stat-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}

.btn-surprise {
  margin-left: auto;
  background: linear-gradient(135deg, #ff4444, #ff8c00);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s, transform .1s;
  flex-shrink: 0;
}
.btn-surprise:hover { opacity: .88; transform: scale(1.03); }

/* ── Filters bar (nueva versión) ───────────────────────────────────────────── */
.filters-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  position: sticky;
  top: 60px;
  z-index: 90;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-chips, .cat-chips, .topic-chips, .sort-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.lang-chip {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.lang-chip:hover, .lang-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.cat-chip {
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.cat-chip:hover { border-color: #555; background: #2a2a2a; }
.cat-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.cat-chip.browse-chip { color: var(--accent); border-color: transparent; background: transparent; }
.cat-chip.browse-chip:hover { background: var(--surface2); }

.topic-row {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.topic-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  transition: all .15s;
  white-space: nowrap;
}
.topic-chip:hover, .topic-chip.active {
  background: #2a1a1a;
  border-color: var(--accent);
  color: var(--text);
}
.topic-chip.active { background: var(--accent); color: #fff; }

.topic-count {
  background: rgba(255,255,255,.12);
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
}

.sort-chip {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
  text-decoration: none;
  transition: all .15s;
}
.sort-chip:hover, .sort-chip.active {
  background: var(--surface);
  border-color: #666;
  color: var(--text);
}
.sort-chip.active { color: var(--accent); border-color: var(--accent); }

/* ── Section header mejorado ───────────────────────────────────────────────── */
.count-badge {
  display: inline-block;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-left: 8px;
  vertical-align: middle;
}

/* ── Browse page ───────────────────────────────────────────────────────────── */
.browse-section { margin-bottom: 40px; }

.browse-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.browse-section-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.topic-card {
  display: block;
  text-decoration: none;
  color: var(--text);
  transition: transform .15s;
}
.topic-card:hover { transform: translateY(-2px); }

.topic-card-img {
  position: relative;
  aspect-ratio: 2/3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface2);
  margin-bottom: 6px;
}

.topic-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.topic-card-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  background: var(--surface2);
}

.topic-card-count {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,.8));
  padding: 16px 8px 6px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  text-align: center;
}

.topic-card-name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Modal mejorado ────────────────────────────────────────────────────────── */
.modal-backdrop.open .modal { transform: translateY(0); box-shadow: 0 24px 80px rgba(0,0,0,.6); }

/* ── Topic Hero ────────────────────────────────────────────────────────────── */
.topic-hero {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
  padding: 32px 0 24px;
}
.topic-hero-inner {
  display: flex;
  align-items: center;
  gap: 24px;
}
.topic-hero-img {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
  border: 2px solid var(--border);
}
.topic-hero-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 12px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  flex-shrink: 0;
}
.topic-hero-breadcrumb {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.topic-hero-breadcrumb a { color: var(--muted); }
.topic-hero-breadcrumb a:hover { color: var(--text); }
.topic-hero-info h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1.2;
}
.topic-hero-stats {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

/* ── Type Tabs ─────────────────────────────────────────────────────────────── */
.type-tabs-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 60px;
  z-index: 90;
}
.type-tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 10px 0;
}
.type-tabs::-webkit-scrollbar { display: none; }
.type-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: color .15s, background .15s;
}
.type-tab:hover { background: var(--surface2); color: var(--text); }
.type-tab.active {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.type-tab-count {
  background: rgba(255,255,255,.15);
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 12px;
}
.type-tab.active .type-tab-count { background: rgba(255,255,255,.25); }

/* ── Topic Body Layout (sidebar + main) ────────────────────────────────────── */
.topic-body {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  padding-top: 28px;
  padding-bottom: 48px;
  align-items: start;
}

/* ── Reactors Sidebar ──────────────────────────────────────────────────────── */
.reactors-sidebar {
  position: sticky;
  top: 120px;
}
.reactors-sidebar h3 {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 10px;
}
.reactor-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.reactor-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background .15s;
  cursor: pointer;
}
.reactor-item:hover { background: var(--surface2); }
.reactor-item.active {
  background: var(--surface2);
  outline: 1px solid var(--accent);
}
.reactor-avatar-wrap {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
}
.reactor-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.reactor-avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}
.reactor-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}
.reactor-item-name {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.reactor-item-count {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface2);
  padding: 1px 7px;
  border-radius: 20px;
  flex-shrink: 0;
}
.reactor-item.active .reactor-item-count { background: var(--border); }

/* ── Topic Main ────────────────────────────────────────────────────────────── */
.topic-main { min-width: 0; }
.topic-main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.topic-main-header h2 { font-size: 1.2rem; font-weight: 700; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .topic-body { grid-template-columns: 1fr; gap: 16px; }
  .reactors-sidebar { position: static; }
  .reactor-list { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .reactor-item { padding: 6px 12px; background: var(--surface); border-radius: 20px; border: 1px solid var(--border); }
  .reactor-item.active { outline: none; border-color: var(--accent); }
  .reactor-item-count { background: none; padding: 0; }
}
@media (max-width: 700px) {
  .search-wrap { max-width: 100%; }
  .header-nav { display: none; }
  .reactions-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; }
  .stats-inner { height: auto; padding: 8px 0; }
  .btn-surprise { margin-left: 0; }
  .filter-right { margin-left: 0; width: 100%; }
  .topic-hero-info h1 { font-size: 1.3rem; }
  .topic-body { padding-top: 16px; }
}

/* ── Topic language selector ───────────────────────────────────────────────── */
.lang-selector-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}
.lang-selector-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.lang-selector-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-right: 4px;
}

/* ── Page hero sub ─────────────────────────────────────────────────────────── */
.page-hero-sub {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

/* ── Modal Episode Nav ─────────────────────────────────────────────────────── */
.modal-ep-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.modal-ep-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 16px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
}
.modal-ep-btn:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.modal-ep-btn:disabled { opacity: .35; cursor: default; }

.modal-ep-pos {
  flex: 1;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
}

/* ── Trending Page ─────────────────────────────────────────────────────────── */
.overview-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 28px 0 8px;
}

.overview-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
}

.overview-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 6px;
}

.overview-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

.trending-section {
  padding: 32px 0 8px;
}

.trending-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.trending-head h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

/* Trending topics grid */
.trending-topics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.trending-topic-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s, transform .1s;
  overflow: hidden;
}
.trending-topic-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.ttc-rank {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,.7);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.ttc-img {
  width: 52px;
  height: 72px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}

.ttc-placeholder {
  width: 52px;
  height: 72px;
  border-radius: 6px;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.ttc-info { flex: 1; min-width: 0; }

.ttc-name {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ttc-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
}

/* Two column layout */
.trending-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  padding-bottom: 8px;
}

/* Leaderboard */
.leaderboard {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lb-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: background .15s;
}
.lb-row:hover { background: var(--surface2); }

.lb-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  flex-shrink: 0;
  background: var(--surface2);
  color: var(--muted);
}
.lb-rank-1 { background: #f59e0b; color: #000; }
.lb-rank-2 { background: #94a3b8; color: #000; }
.lb-rank-3 { background: #cd7c45; color: #000; }

.lb-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
}
.lb-avatar img { width: 100%; height: 100%; object-fit: cover; }
.lb-avatar-ph {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.lb-info { flex: 1; min-width: 0; }
.lb-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-sub  { font-size: 11px; color: var(--muted); }
.lb-count { font-size: 13px; font-weight: 700; color: var(--accent); flex-shrink: 0; }

/* Bar charts */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bc-row { display: flex; flex-direction: column; gap: 4px; }

.bc-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.bc-pct   { color: var(--muted); font-size: 12px; }
.bc-count { font-size: 11px; color: var(--muted); }

.bc-track {
  height: 6px;
  background: var(--surface2);
  border-radius: 999px;
  overflow: hidden;
}

.bc-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .8s ease;
  min-width: 2px;
}
.bc-anime       { background: #f59e0b; }
.bc-series      { background: #3b82f6; }
.bc-peliculas   { background: #8b5cf6; }
.bc-musica      { background: #ec4899; }
.bc-videojuegos { background: #10b981; }
.bc-deportes    { background: #f97316; }

/* Responsive trending */
@media (max-width: 900px) {
  .trending-two-col { grid-template-columns: 1fr; gap: 0; }
  .overview-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 500px) {
  .overview-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .trending-topics-grid { grid-template-columns: 1fr 1fr; }
}
