/* =====================================================================
   Tweaks (pages/tweaks.js) — "capas": órbita con un anillo por capa
   (Juego, Segundo plano, Interfaz), cada punto un ajuste (azul aplicado,
   violeta recomendado). A la derecha, la lista de la capa con interruptores.
   Lite (perf-lite): mismo diseño, sin animaciones, brillos ni degradados.
   ===================================================================== */
.tx-page {
  --tx-panel: rgba(12,12,13,.92);
  --tx-line: rgba(200,200,205,.13); --tx-line-2: rgba(200,200,205,.22);
  --tx-text: #f2f2f3; --tx-muted: rgba(245,245,247,.68); --tx-dim: rgba(245,245,247,.45);
  --tx-on: #e5e5e5; --tx-rec: #a78bfa; --tx-warn: #fbbf24; --tx-bad: #f87171; --tx-bg: #000000;
  color: var(--tx-text);
}
.tx-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.tx-head .page-title { margin: 0; }
.tx-sub { margin: 0; max-width: 60ch; }
.tx-tools { position: relative; display: flex; align-items: center; gap: 8px; }
.tx-search { display: flex; align-items: center; gap: 8px; width: 260px; height: 36px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--tx-line); background: rgba(255,255,255,.03); color: var(--tx-dim); }
.tx-search:focus-within { border-color: rgba(229,229,229,.45); }
.tx-search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--tx-text); font: inherit; font-size: 13px; }
.tx-search input::placeholder { color: var(--tx-dim); }
.tx-iconbtn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--tx-line); background: rgba(255,255,255,.03); color: var(--tx-muted); cursor: pointer; }
.tx-iconbtn:hover, .tx-iconbtn.active { color: var(--tx-text); border-color: var(--tx-line-2); }
.tx-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 290px; padding: 6px; border-radius: 12px; background: #171717; border: 1px solid var(--tx-line-2); box-shadow: 0 18px 40px rgba(0,0,0,.45); }
.tx-pop-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 10px; font-size: 13px; }
.tx-pop-link { display: block; width: 100%; text-align: left; padding: 9px 10px; margin-top: 2px; border: 0; border-top: 1px solid var(--tx-line); background: none; color: var(--tx-on); font: inherit; font-size: 13px; cursor: pointer; }

.tx-grid { position: relative; display: grid; grid-template-columns: 372px minmax(0, 1fr); gap: 18px; align-items: start; }
.tx-panel { background: var(--tx-panel); border: 1px solid var(--tx-line); border-radius: 18px; min-width: 0; }

/* ── Mapa ── */
.tx-map { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; }
.tx-orbit-wrap { position: relative; width: 100%; max-width: 310px; margin: 0 auto; aspect-ratio: 1; }
.tx-orbit { display: block; width: 100%; height: 100%; overflow: visible; }
.tx-spoke { stroke: rgba(200,200,205,.05); stroke-width: 1; }
.tx-outer { fill: none; stroke: rgba(200,200,205,.10); stroke-width: 1; }
.tx-scale { stroke: rgba(200,200,205,.16); stroke-width: 1; }
.tx-scale.major { stroke: rgba(200,200,205,.32); }
.tx-core { transition: opacity .3s ease; }
.tx-track { fill: none; stroke: rgba(200,200,205,.12); stroke-width: 1; transition: stroke .2s ease; }
.tx-ring.hov .tx-track, .tx-ring.sel .tx-track { stroke: rgba(200,200,205,.30); }
.tx-arc { fill: none; stroke-width: 3; stroke-linecap: round; transition: opacity .2s ease; }
.tx-ring:not(.sel) .tx-arc { opacity: .45; }
.tx-ring:not(.sel) .tx-tick { opacity: .55; }
.tx-ring.hov .tx-tick { opacity: 1; }
.tx-hit { fill: none; stroke: transparent; stroke-width: 26; cursor: pointer; }
.tx-tick { cursor: pointer; transition: fill .25s ease, stroke .25s ease, opacity .2s ease; }
.tx-tick.on { fill: #dbeafe; stroke: var(--tx-on); stroke-width: 1.4; }
.tx-tick.rec { fill: var(--tx-bg); stroke: var(--tx-rec); stroke-width: 1.7; }
.tx-tick.off { fill: #242424; stroke: rgba(200,200,205,.3); stroke-width: 1; }
.tx-tick.hl { stroke-width: 2.8; }
.tx-tick.busy { stroke: #fff; stroke-width: 2.4; }
.tx-rlabel { font-size: 10.5px; fill: var(--tx-dim); font-weight: 600; cursor: pointer; transition: fill .2s ease; }
.tx-ring.sel .tx-rlabel, .tx-ring.hov .tx-rlabel { fill: var(--tx-text); }
.tx-c-num { font-size: 40px; font-weight: 700; fill: var(--tx-text); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.tx-c-den { font-size: 16px; font-weight: 600; fill: var(--tx-dim); }
.tx-c-lab { font-size: 12px; fill: var(--tx-muted); font-weight: 600; }
.tx-c-tot { font-size: 10.5px; fill: var(--tx-dim); }
.tx-tip { position: absolute; pointer-events: none; transform: translate(-50%, calc(-100% - 12px)); background: #171717; border: 1px solid var(--tx-line-2); border-radius: 8px; padding: 6px 9px; font-size: 12px; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; opacity: 0; transition: opacity .12s ease; z-index: 3; }
.tx-tip.show { opacity: 1; }
.tx-tip i { font-style: normal; color: var(--tx-dim); margin-left: 6px; }

/* Animaciones de la órbita (solo Full con animaciones activadas) */
.animations-on:not(.perf-lite) .tx-orbit.is-anim .tx-ring.sel .tx-arc { filter: drop-shadow(0 0 4px rgba(229,229,229,.55)); }
.animations-on:not(.perf-lite) .tx-orbit.is-anim .tx-outer, .animations-on:not(.perf-lite) .tx-orbit.is-anim .tx-scale { transform-origin: 170px 170px; animation: txSpin 120s linear infinite; }
.animations-on:not(.perf-lite) .tx-orbit.is-anim .tx-tick.busy { animation: txPulse .9s ease-in-out infinite; }
.animations-on:not(.perf-lite) .tx-orbit.is-anim.is-applying .tx-core { animation: txBreathe 1.6s ease-in-out infinite; }
@keyframes txSpin { to { transform: rotate(360deg); } }
@keyframes txPulse { 50% { stroke-width: 4; } }
@keyframes txBreathe { 50% { opacity: .35; } }

/* Capas */
.tx-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.tx-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 8px 11px; border-radius: 10px; border: 1px solid var(--tx-line); background: rgba(255,255,255,.02); color: var(--tx-muted); font: inherit; font-size: 12px; cursor: pointer; text-align: left; }
.tx-chip b { font-weight: 600; font-size: 13px; color: var(--tx-text); }
.tx-chip span { font-variant-numeric: tabular-nums; }
.tx-profiles { grid-template-columns: repeat(2, 1fr); }
.tx-chip.sel { border-color: rgba(229,229,229,.45); background: rgba(245,245,245,.10); }
.tx-chip:hover { border-color: var(--tx-line-2); }

/* Recomendados */
.tx-cta { display: flex; flex-direction: column; gap: 10px; padding-top: 14px; border-top: 1px solid var(--tx-line); }
.tx-cta p { margin: 0; color: var(--tx-muted); font-size: 13px; min-height: 2.9em; overflow: hidden; text-overflow: ellipsis; }
.tx-cta p strong { color: var(--tx-text); font-weight: 600; }
.tx-apply { width: 100%; }
.tx-apply.is-busy { cursor: progress; }
.tx-link { background: none; border: 0; color: var(--tx-dim); font: inherit; font-size: 12.5px; cursor: pointer; padding: 0; align-self: center; }
.tx-link:hover { color: var(--tx-text); }

/* ── Lista ── */
.tx-list-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--tx-line); }
.tx-list-head h2 { margin: 0 0 3px; font-size: 17px; font-weight: 650; display: flex; justify-content: space-between; gap: 12px; }
.tx-list-head h2 span { font-weight: 500; color: var(--tx-muted); font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx-list-head p { margin: 0; color: var(--tx-muted); font-size: 13px; }
.tx-rows { max-height: calc(100vh - 250px); min-height: 360px; overflow: auto; }
.tx-row { display: flex; gap: 14px; align-items: center; padding: 12px 20px; border-bottom: 1px solid rgba(200,200,205,.07); transition: background .2s ease; }
.tx-row:last-child { border-bottom: 0; }
.tx-row:hover, .tx-row.hl { background: rgba(229,229,229,.06); }
.tx-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: #242424; border: 1px solid rgba(200,200,205,.3); }
.tx-row.is-on .tx-dot { background: #dbeafe; border: 1.4px solid var(--tx-on); }
.tx-row.is-rec .tx-dot { background: none; border: 1.6px solid var(--tx-rec); }
.tx-info { flex: 1; min-width: 0; }
.tx-t { font-weight: 600; font-size: 13.5px; }
.tx-d { color: var(--tx-muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 2px; }
.tx-tags { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px; font-size: 11.5px; color: var(--tx-dim); }
.tx-tags .r { color: var(--tx-rec); }
.tx-tags .w { color: var(--tx-warn); }
.tx-tags .b { color: var(--tx-bad); }
.tx-empty { padding: 28px 20px; color: var(--tx-dim); }
.tx-sw { position: relative; width: 38px; height: 22px; flex: none; border-radius: 999px; border: 1px solid var(--tx-line-2); background: rgba(255,255,255,.05); cursor: pointer; padding: 0; }
.tx-sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #94a3b8; transition: transform .2s ease, background .2s ease; }
.tx-sw.on { background: rgba(245,245,245,.3); border-color: rgba(229,229,229,.6); }
.tx-sw.on::after { transform: translateX(16px); background: var(--tx-on); }
.tx-sw:disabled { cursor: default; opacity: .6; }
.tx-sw.loading::after { background: #fff; animation: txPulseKnob .8s ease-in-out infinite; }
@keyframes txPulseKnob { 50% { opacity: .35; } }
.tx-sw:focus-visible, .tx-chip:focus-visible, .tx-iconbtn:focus-visible { outline: 2px solid var(--tx-on); outline-offset: 2px; }

/* Esqueleto / Free bloqueado */
.tx-locked { min-height: 420px; }
.tx-sk-sub { display: block; width: 340px; max-width: 70vw; height: 14px; border-radius: 6px; margin-top: 6px; }
.tx-sk-orbit { display: block; width: 260px; height: 260px; border-radius: 50%; margin: 10px auto 0; }
.tx-sk-btn { display: block; height: 42px; border-radius: 10px; }
.tx-sk-t { display: block; width: 45%; height: 13px; border-radius: 5px; }
.tx-sk-d { display: block; width: 75%; height: 11px; border-radius: 5px; margin-top: 7px; }
.tx-sk-sw { display: block; width: 38px; height: 22px; border-radius: 999px; flex: none; }

/* Vista previa Free: estado real de cada ajuste, sin nombres */
.tx-pv-lock { display: flex; align-items: center; gap: 10px; padding: 12px 20px; font-size: 12.5px; color: var(--tx-muted); background: rgba(167,139,250,.06); border-bottom: 1px solid var(--tx-line); cursor: pointer; }
.tx-pv-lock svg { flex: none; color: var(--tx-rec); }
.tx-pv-row { cursor: pointer; }
.tx-pv-row .tx-sw { cursor: pointer; }
.tx-pv-row:nth-child(3n) .tx-sk-t { width: 38%; }
.tx-pv-row:nth-child(3n+1) .tx-sk-t { width: 52%; }
.tx-pv-row:nth-child(4n) .tx-sk-d { width: 64%; }

/* Responsive */
@media (max-width: 1080px) {
  .tx-grid { grid-template-columns: 320px minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .tx-grid { grid-template-columns: 1fr; }
  .tx-map { position: static; }
  .tx-rows { max-height: none; }
}

/* Lite: paneles lisos y sin animaciones */
.perf-lite .tx-panel { background: #111111; }
.perf-lite .tx-page * { transition: none !important; animation: none !important; }
.perf-lite .tx-apply::after { display: none; }
@media (prefers-reduced-motion: reduce) { .tx-page * { animation: none !important; } }
