:root {
    --bg: #111317;
    --surface: #1b1e24;
    --surface-2: #252932;
    --text: #e8e9ec;
    --muted: #9aa0ab;
    --accent: #f5576c;
    --live: #3ccf6e;
    --radius: 10px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: inherit; text-decoration: none; }

main { max-width: 1400px; margin: 0 auto; padding: 16px; }

/* Barra superior */
.topbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px;
    padding: 12px 16px; background: var(--surface); position: sticky; top: 0; z-index: 10;
}
.logo { font-weight: 800; font-size: 20px; color: var(--accent); }
.genders { display: flex; gap: 4px; flex-wrap: wrap; }
.genders a { padding: 6px 12px; border-radius: 999px; color: var(--muted); }
.genders a:hover, .genders a.active { background: var(--surface-2); color: var(--text); }
.search { margin-left: auto; flex: 1 1 220px; max-width: 320px; }
.search input {
    width: 100%; padding: 8px 12px; border: 1px solid var(--surface-2); border-radius: 999px;
    background: var(--bg); color: var(--text); font: inherit;
}

/* Filtro de edad */
.age-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 10px; }
.age-filter span { color: var(--muted); font-size: 13px; margin-right: 2px; }
.age-filter .filter-sep { margin-left: 14px; }
.age-filter a { padding: 4px 12px; border-radius: 999px; border: 1px solid var(--surface-2); font-size: 13px; color: var(--muted); }
.age-filter a:hover, .age-filter a.active { border-color: var(--accent); color: var(--text); background: var(--surface-2); }

/* Tags */
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.tags a { padding: 3px 10px; border-radius: 999px; background: var(--surface); color: var(--muted); font-size: 13px; }
.tags a:hover, .tags a.active { background: var(--accent); color: #fff; }
.tags .count { opacity: .6; font-size: 11px; margin-left: 2px; }

.summary { color: var(--muted); margin: 0 0 12px; }
.empty { text-align: center; color: var(--muted); padding: 48px 0; }

/* Rejilla de cámaras */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.card { background: var(--surface); border-radius: var(--radius); overflow: hidden; transition: transform .15s; }
.card:hover { transform: translateY(-2px); }
.thumb { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.blurred { overflow: hidden; }
.thumb.blurred img { filter: blur(10px) brightness(.55); transform: scale(1.1); }
.show-overlay {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    padding: 6px 16px; border: 1px solid rgba(255, 255, 255, .5); border-radius: 999px;
    background: rgba(0, 0, 0, .45); color: #fff; font-weight: 700; font-size: 14px;
    letter-spacing: .08em; text-transform: uppercase; white-space: nowrap;
}
.badge {
    position: absolute; top: 8px; padding: 1px 7px; border-radius: 4px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; color: #fff;
}
.badge.new { left: 8px; background: var(--live); }
.badge.hd { right: 8px; background: rgba(0, 0, 0, .65); }
.badge.viewers {
    left: 8px; bottom: 8px; top: auto; display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; background: rgba(0, 0, 0, .65); font-size: 12px; text-transform: none;
}
.badge.viewers svg { color: var(--accent); }
.info { padding: 8px 10px 10px; position: relative; }
.name { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.name span { color: var(--muted); white-space: nowrap; }
.gender-icon { margin-left: 3px; font-weight: 700; font-family: "Segoe UI Symbol", "DejaVu Sans", system-ui, sans-serif; }
.gender-icon.g-f { color: #ff6b9a; }
.gender-icon.g-m { color: #4da3ff; }
.gender-icon.g-c { color: #b57bff; }
.gender-icon.g-t { color: #5ad1e6; }
.info .subject { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; min-height: 2.7em; overflow: hidden; }

.shared-tags { margin: 3px 0 0; font-size: 12px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Paginación */
.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin: 24px 0; color: var(--muted); }
.pagination a { padding: 8px 16px; background: var(--surface); border-radius: var(--radius); color: var(--text); }
.pagination a:hover { background: var(--accent); }

/* Sala */
.room { max-width: 1000px; margin: 0 auto 32px; }
.room-head { display: flex; align-items: center; gap: 12px; }
.room-head h1 { margin: 8px 0; font-size: 26px; }
.live { color: var(--live); font-weight: 700; }
.offline { color: var(--muted); }
.player { position: relative; aspect-ratio: 850 / 528; background: #000; border-radius: var(--radius); overflow: hidden; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.offline-box { display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--muted); }
.offline-box img { max-width: 360px; width: 60%; opacity: .5; border-radius: var(--radius); }
.cta {
    display: inline-block; margin: 14px 0; padding: 10px 20px; border-radius: var(--radius);
    background: var(--accent); color: #fff; font-weight: 700;
}
.room .subject { color: var(--muted); }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; background: var(--surface); padding: 14px 16px; border-radius: var(--radius); }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
.section-title { max-width: 1000px; margin: 0 auto 12px; font-size: 18px; }
.section-title.wide { max-width: none; margin-top: 28px; }

/* Estadísticas */
.stats h1 { margin: 8px 0 12px; font-size: 24px; }
.stats h2 { margin: 28px 0 10px; font-size: 18px; }
.stats .genders { margin-bottom: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpis div { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; color: var(--muted); }
.kpis span { display: block; font-size: 26px; font-weight: 800; color: var(--text); }
.table-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); }
.stats table { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats th, .stats td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--surface-2); white-space: nowrap; }
.stats th { color: var(--muted); font-weight: 600; }
.stats td a { color: var(--accent); }
.stats .cam { display: flex; align-items: center; gap: 10px; }
.stats .cam img { width: 48px; height: 36px; object-fit: cover; border-radius: 4px; }
.stats .ua { color: var(--muted); max-width: 320px; overflow: hidden; text-overflow: ellipsis; }

/* Aviso 18+ */
body.gated { overflow: hidden; }
body.gated > header, body.gated > main, body.gated > footer { filter: blur(14px); pointer-events: none; user-select: none; }
.age-gate {
    position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
    padding: 16px; background: rgba(0, 0, 0, .7);
}
.age-gate-box {
    max-width: 460px; width: 100%; padding: 28px 24px; text-align: center;
    background: var(--surface); border-radius: 14px; box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}
.age-gate-badge {
    display: inline-flex; align-items: center; justify-content: center; width: 64px; height: 64px;
    border: 3px solid var(--accent); border-radius: 50%; color: var(--accent); font-weight: 800; font-size: 22px;
}
.age-gate-box h2 { margin: 14px 0 8px; font-size: 22px; }
.age-gate-box p { color: #c9ccd3; margin: 0 0 18px; }
.age-gate-actions { display: flex; flex-direction: column; gap: 10px; }
.age-gate-actions .cta { margin: 0; }
.age-gate-leave { color: var(--muted); padding: 6px; }
.age-gate-leave:hover { color: var(--text); }
.age-gate-box .age-gate-links { margin: 16px 0 0; font-size: 13px; color: var(--muted); }
.age-gate-links a { text-decoration: underline; }

/* Gráfico de clics (stats) */
.chart { --chart-bar: #ef4f67; background: var(--surface); border-radius: var(--radius); padding: 18px 16px 10px 44px; }
.chart-plot { position: relative; height: 200px; }
.chart-grid { position: absolute; left: 0; right: 0; border-top: 1px solid var(--surface-2); }
.chart-grid span { position: absolute; right: calc(100% + 8px); top: -8px; font-size: 11px; color: var(--muted); }
.chart-cols, .chart-x { position: absolute; inset: 0; display: flex; gap: 2px; }
.chart-x { position: static; margin-top: 6px; }
.chart-col { position: relative; flex: 1; height: 100%; outline: none; cursor: default; }
.chart-bar {
    position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: min(24px, 100%); height: var(--h); min-height: 2px;
    background: var(--chart-bar); border-radius: 4px 4px 0 0;
}
.chart-col:hover .chart-bar, .chart-col:focus-visible .chart-bar { filter: brightness(1.2); }
.chart-peak {
    position: absolute; left: 50%; bottom: calc(var(--h) + 4px); transform: translateX(-50%);
    font-size: 11px; font-weight: 700; color: var(--text); white-space: nowrap;
}
.chart-tip {
    display: none; position: absolute; z-index: 2; left: 50%; bottom: calc(var(--h) + 22px); transform: translateX(-50%);
    padding: 6px 10px; border-radius: 6px; background: #0b0c0f; border: 1px solid var(--surface-2);
    font-size: 12px; color: var(--muted); white-space: nowrap; pointer-events: none;
}
.chart-tip strong { display: block; color: var(--text); font-size: 13px; }
.chart-col.edge-left .chart-tip { left: 0; transform: none; }
.chart-col.edge-right .chart-tip { left: auto; right: 0; transform: none; }
.chart-col:hover .chart-tip, .chart-col:focus-visible .chart-tip { display: block; }
.chart-x span { flex: 1; font-size: 11px; color: var(--muted); text-align: center; white-space: nowrap; overflow: visible; }
.chart-table { margin-top: 8px; font-size: 13px; color: var(--muted); }
.chart-table summary { cursor: pointer; margin-bottom: 8px; }

/* Páginas legales */
.legal { max-width: 760px; margin: 0 auto 32px; }
.legal h1 { font-size: 26px; }
.legal h2 { font-size: 18px; margin-top: 28px; }
.legal p, .legal li { color: #c9ccd3; }
.legal a { color: var(--accent); }
.legal .pending { color: #f5a623; }
.legal .updated { margin-top: 32px; font-size: 13px; color: var(--muted); }

.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px; }
.footer p { margin: 4px 0; }
.footer a { color: var(--text); text-decoration: underline; }

@media (max-width: 600px) {
    .grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .search { max-width: none; margin-left: 0; }
}
