/* ==========================================================================
   /config — pagina de ajustes
   Misma paleta que el overlay: hueso y carmesi salidos del logo.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

/* display:flex/grid ganan a [hidden] si no se fuerza. */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    background: #000;
    color: var(--bone);
    font-family: 'Archivo', 'Segoe UI', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.mono { font-family: 'JetBrains Mono', Consolas, monospace; }
svg { display: block; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

.page { max-width: 1120px; margin: 0 auto; padding: 0 24px 64px; }

/* --- cabecera ------------------------------------------------------------ */

.app-head {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    background: rgba(0, 0, 0, 0.94);
    backdrop-filter: blur(8px);
    z-index: 50;
}

.wordmark { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 800; letter-spacing: -0.2px; }
.wordmark img { width: 26px; height: 26px; image-rendering: pixelated; display: block; }

.status {
    margin-left: auto;
    display: flex; align-items: center; gap: 8px;
    font-size: 12px; font-weight: 500; color: var(--dim);
    background: var(--surf-2); border: 1px solid var(--line-2);
    padding: 6px 13px; border-radius: 999px;
    white-space: nowrap;
}
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.status[data-state="ok"]         .dot { background: var(--red); animation: livePulse 2.2s ease-out infinite; }
.status[data-state="connecting"] .dot { background: var(--amber); }
.status[data-state="error"]      .dot { background: var(--amber); }

.btn-save {
    background: var(--red); color: var(--bone);
    font-weight: 700; font-size: 13px; padding: 10px 20px; border-radius: 6px;
    display: flex; align-items: center; gap: 8px;
    transition: background 150ms ease, transform 90ms ease;
}
.btn-save:hover  { background: var(--red-hi); }
.btn-save:active { transform: scale(0.97); }
.btn-save[data-state="busy"] { background: var(--red-mid); color: rgba(254, 243, 217, 0.72); }
.btn-save[data-state="done"] { background: var(--surf-2); color: var(--dim); box-shadow: inset 0 0 0 1px var(--line-2); }

/* --- avisos -------------------------------------------------------------- */

.banner {
    display: none;
    align-items: center; gap: 12px;
    background: var(--surf-2);
    border: 1px solid var(--line-2);
    border-left: 3px solid var(--faint);
    border-radius: 6px;
    padding: 12px 14px;
    margin-top: 20px;
}
.banner.is-on { display: flex; }
.banner[data-kind="warn"] { border-left-color: var(--amber); }
.banner b { font-size: 12.5px; font-weight: 600; }
.banner small { display: block; margin-top: 2px; font-size: 11px; color: var(--faint); }

/* --- cuerpo -------------------------------------------------------------- */

.app-body { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: 38px; padding-top: 26px; }

/* --- navegacion lateral --------------------------------------------------- */

.side {
    position: sticky;
    top: 84px;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.side-h {
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 10px; letter-spacing: 1.8px; text-transform: uppercase;
    color: var(--faint);
    padding: 0 0 10px 11px;
}

.tab {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 13px; font-weight: 500;
    color: var(--dim);
    text-align: left;
    transition: background 150ms ease, color 150ms ease;
}
.tab svg { flex: none; opacity: 0.75; }
.tab span { flex: 1; min-width: 0; }
.tab:hover { background: var(--surf-2); color: var(--bone); }
.tab.is-on { background: var(--surf-2); color: var(--bone); font-weight: 700; box-shadow: inset 2px 0 0 var(--red); }
.tab.is-on svg { opacity: 1; color: var(--red); }

/* el punto rojo del directo: dice que hay algo sonando sin cambiar de pestana */
.tab .pip { width: 6px; height: 6px; border-radius: 50%; background: var(--red); flex: none; animation: livePulse 2.2s ease-out infinite; }

.side-foot {
    margin-top: 22px; padding: 14px 12px 0;
    border-top: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 4px;
    font-size: 11px; color: var(--faint);
}
.side-foot b { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 11px; font-weight: 500; color: var(--dim); }

/* --- paneles -------------------------------------------------------------- */

.panels { min-width: 0; }
.panel { display: flex; flex-direction: column; gap: 26px; min-width: 0; }

.panel-head { display: flex; flex-direction: column; gap: 7px; }
.panel-head h1 { margin: 0; font-size: 23px; font-weight: 800; letter-spacing: -0.5px; }
.panel-head p { margin: 0; font-size: 13px; color: var(--dim); line-height: 1.6; max-width: 66ch; }

.panel-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 38px; align-items: start; }
.panel-main { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.panel-side { min-width: 0; }

@media (max-width: 980px) {
    .app-body { grid-template-columns: minmax(0, 1fr); gap: 22px; }
    .side { position: static; flex-direction: row; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
    .side-h, .side-foot { display: none; }
    .tab { white-space: nowrap; }
    .panel-grid { grid-template-columns: minmax(0, 1fr); gap: 26px; }
}

/* interruptor maestro */
.master {
    display: flex; align-items: center; gap: 15px;
    background: var(--surf-2);
    border: 1px solid var(--line-2);
    border-left: 3px solid var(--red);
    border-radius: 6px;
    padding: 14px 16px;
}
.master .txt { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.master b { font-size: 14px; font-weight: 700; }
.master small { font-size: 11.5px; color: var(--faint); }

.sect { display: flex; flex-direction: column; gap: 15px; }
.sect-head { display: flex; align-items: center; gap: 12px; }
.sect-head h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.1px; }
.sect-head hr { flex: 1; border: none; border-top: 1px solid var(--line); margin: 0; }

/* --- campos -------------------------------------------------------------- */

.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.f { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.f > label { font-size: 12px; color: var(--dim); font-weight: 500; }
.f small { font-size: 11px; color: var(--faint); line-height: 1.45; }

.box {
    display: flex; align-items: center; gap: 8px;
    background: var(--surf-2);
    border: 1px solid var(--line-2);
    border-radius: 6px;
    padding: 0 12px;
    height: 40px;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
.box:focus-within { border-color: var(--red); box-shadow: 0 0 0 3px rgba(243, 33, 70, 0.14); }
.box[data-state="bad"] { border-color: var(--amber); }
.box.tall { height: 48px; }

.box input {
    flex: 1; min-width: 0;
    background: none; border: none; outline: none;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 14px; color: var(--bone);
}
.box.tall input { font-size: 16px; }
.box input::placeholder { color: var(--faint); }
.box .unit { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 11px; color: var(--faint); flex: none; }
.box .at   { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 15px; color: var(--faint); flex: none; }

/* estado de la busqueda de canal */
.lookup { display: flex; align-items: center; gap: 7px; flex: none; font-size: 12px; font-weight: 600; }
.lookup[data-state="ok"]  { color: var(--red); }
.lookup[data-state="bad"] { color: var(--amber); }
.spin {
    width: 13px; height: 13px; border-radius: 50%;
    border: 2px solid var(--line-2); border-top-color: var(--red);
    animation: spin 0.7s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.field-msg { font-size: 11px; color: var(--amber); display: flex; align-items: center; gap: 6px; }
.field-note { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 11px; color: var(--faint); }

/* --- volumen ------------------------------------------------------------- */

.vol { display: flex; flex-direction: column; gap: 10px; }
.vol .top { display: flex; align-items: center; gap: 10px; }
.vol .top label { flex: 1; font-size: 12px; color: var(--dim); font-weight: 500; }
.vol .top b { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 13px; font-weight: 500; }

input[type="range"] {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 4px; border-radius: 2px;
    background: var(--line); outline: none; margin: 0;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--bone); border: 3px solid #000; cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--bone); border: 3px solid #000; cursor: pointer;
}

/* --- interruptores ------------------------------------------------------- */

.toggles { display: flex; flex-direction: column; }
.tg {
    display: flex; align-items: center; gap: 14px;
    padding: 13px 0; border-bottom: 1px solid var(--surf-2);
    cursor: pointer;
}
.tg:last-child { border-bottom: none; }
.tg .txt { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.tg b { font-size: 13px; font-weight: 500; }
.tg small { font-size: 11px; color: var(--faint); }

.sw { width: 38px; height: 21px; border-radius: 999px; background: var(--line-2); position: relative; flex: none; transition: background 260ms ease; }
.sw::after {
    content: ""; position: absolute; left: 3px; top: 3px;
    width: 15px; height: 15px; border-radius: 50%; background: var(--faint);
    transition: transform 280ms var(--ease-back), background 260ms ease;
}
.sw[aria-checked="true"] { background: var(--red); }
.sw[aria-checked="true"]::after { transform: translateX(17px); background: var(--bone); }
.sw:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; }

/* --- comandos ------------------------------------------------------------ */

.cmd-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 34px; max-width: 760px; }
@media (max-width: 760px) { .cmd-groups { grid-template-columns: minmax(0, 1fr); } }
.cmd-group { display: flex; flex-direction: column; gap: 9px; }
.cmd { display: flex; align-items: baseline; gap: 10px; }
.cmd code {
    font-family: 'JetBrains Mono', Consolas, monospace; font-size: 11.5px;
    color: var(--red-hi); background: #1A0509; border: 1px solid var(--crimson-lo);
    border-radius: 4px; padding: 2px 7px; white-space: nowrap;
}
.cmd span { font-size: 11.5px; color: var(--faint); }

/* --- panel lateral ------------------------------------------------------- */

.aside-h { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 10px; letter-spacing: 1.8px; text-transform: uppercase; color: var(--faint); }

.preview {
    margin-top: 10px;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0A0A0A;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    overflow: hidden;
}
#preview-mount { position: absolute; inset: 0; }
.preview .idle {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: var(--faint); text-align: center; padding: 12px; pointer-events: none;
}
.preview.is-live .idle { display: none; }

/* Fuera de OBS el navegador exige un gesto: se lo pedimos aqui. */
.unblock {
    position: absolute; inset: 0; z-index: 40;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    background: rgba(6, 5, 4, 0.92);
    color: var(--dim); font-size: 11px; line-height: 1.5; text-align: center; padding: 14px;
}
.unblock b { color: var(--bone); font-weight: 700; }
.unblock svg { color: var(--red); }
.unblock:hover { background: rgba(6, 5, 4, 0.97); }

.urlbox {
    margin-top: 10px;
    background: var(--surf-2); border: 1px solid var(--line-2); border-radius: 6px;
    padding: 11px 12px;
    font-family: 'JetBrains Mono', Consolas, monospace; font-size: 11px;
    color: var(--dim); line-height: 1.6; word-break: break-all;
}
.urlbox b { color: var(--red); font-weight: 500; }

.btn-ghost {
    margin-top: 10px; width: 100%;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    border: 1px solid var(--line-2); border-radius: 6px; padding: 9px;
    font-size: 12px; color: var(--dim);
    transition: border-color 150ms ease, color 150ms ease;
}
.btn-ghost:hover { border-color: var(--red); color: var(--red); }
.btn-ghost.is-done { border-color: var(--red); color: var(--red); }

.aside-note { margin-top: 8px; font-size: 11px; color: var(--faint); line-height: 1.5; }

.now {
    margin-top: 10px;
    background: var(--surf-2); border: 1px solid var(--line-2); border-radius: 6px;
    padding: 13px; display: flex; flex-direction: column; gap: 9px;
}
.now .top { display: flex; align-items: center; gap: 8px; font-family: 'JetBrains Mono', Consolas, monospace; font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase; color: var(--red); }
.now .top i { width: 7px; height: 7px; border-radius: 50%; background: var(--red); display: block; animation: livePulse 2.2s ease-out infinite; }
.now b { font-size: 14px; font-weight: 700; }
.now .bar { height: 3px; background: rgba(243, 33, 70, 0.22); border-radius: 2px; position: relative; }
.now .bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--red); border-radius: 2px; display: block; }
.now small { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 10px; color: var(--faint); }
.now.is-idle { color: var(--faint); }

.qlist { margin-top: 10px; display: flex; flex-direction: column; }
.qlist li { display: flex; align-items: center; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--surf-2); list-style: none; }
.qlist li:last-child { border-bottom: none; }
.qlist .pos { font-family: 'JetBrains Mono', Consolas, monospace; font-size: 10px; color: var(--faint); width: 14px; flex: none; }
.qlist .who { flex: 1; font-size: 12px; font-weight: 500; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qlist .del { color: #3C3A33; padding: 2px 4px; border-radius: 4px; }
.qlist .del:hover { color: var(--amber); }

.qempty {
    margin-top: 10px;
    border: 1px dashed var(--line-2); border-radius: 6px;
    padding: 16px; text-align: center; font-size: 11.5px; color: var(--faint);
}

.row-btns { display: flex; gap: 10px; margin-top: 10px; }
.row-btns .btn-ghost { margin-top: 0; }

@keyframes livePulse {
    0%   { box-shadow: 0 0 0 0 rgba(243, 33, 70, 0.5); }
    70%  { box-shadow: 0 0 0 8px rgba(243, 33, 70, 0); }
    100% { box-shadow: 0 0 0 0 rgba(243, 33, 70, 0); }
}

/* --- ranking -------------------------------------------------------------- */

.sect-lead {
    margin: -4px 0 2px;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--dim);
    max-width: 62ch;
}
.sect-lead b { color: var(--bone); font-weight: 600; }

/* control segmentado: dos opciones, se ven las dos a la vez */
.seg {
    display: inline-flex;
    align-self: flex-start;
    background: var(--surf-2);
    border: 1px solid var(--line-2);
    border-radius: 6px;
    padding: 3px;
    gap: 3px;
}
.seg button {
    padding: 7px 15px;
    border-radius: 4px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--dim);
    transition: background 160ms ease, color 160ms ease;
}
.seg button:hover { color: var(--bone); }
.seg button[aria-checked="true"] { background: var(--red); color: var(--bone); font-weight: 700; }
.seg button:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

.rank-preview {
    margin-top: 10px;
    background: #0A0A0A;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    padding: 12px;
    min-height: 220px;
    display: flex;
}
#rank-mount { width: 100%; }

/* En la vista previa el panel se ve siempre, aunque este vacio: si no, el
   interruptor de esconderlo pareceria que ha roto algo. */
.rank-preview .rk.is-gone .rk-panel { opacity: 0.35; transform: none; }

/* --- emotes --------------------------------------------------------------- */

.em-preview {
    margin-top: 10px;
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background:
        repeating-conic-gradient(#121110 0% 25%, #0A0A0A 0% 50%) 0 0 / 18px 18px;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    overflow: hidden;
}
/* El damero recuerda que el fondo es transparente: en OBS va encima de todo. */
#em-mount { position: absolute; inset: 0; }

/* --- piezas de los paneles ------------------------------------------------ */

.steps { display: flex; flex-direction: column; gap: 11px; }
.step { display: flex; align-items: flex-start; gap: 12px; font-size: 12.5px; color: var(--dim); line-height: 1.55; }
.step b {
    flex: none;
    width: 21px; height: 21px; border-radius: 50%;
    background: var(--surf-2); box-shadow: inset 0 0 0 1px var(--line-2);
    font-family: 'JetBrains Mono', Consolas, monospace; font-size: 10px; font-weight: 500;
    color: var(--red);
    display: flex; align-items: center; justify-content: center;
}
.step span b { display: inline; width: auto; height: auto; background: none; box-shadow: none; font-family: inherit; font-size: inherit; font-weight: 600; color: var(--bone); }

.note-card {
    display: flex; flex-direction: column; gap: 5px;
    background: var(--surf-2);
    border: 1px solid var(--line-2);
    border-left: 3px solid var(--crimson);
    border-radius: 6px;
    padding: 13px 15px;
}
.note-card b { font-size: 12.5px; font-weight: 600; }
.note-card small { font-size: 11.5px; color: var(--faint); line-height: 1.6; }

/* atajos a las otras pestanas, desde Tu canal */
.srcs { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.src {
    display: flex; flex-direction: column; gap: 3px; text-align: left;
    background: var(--surf-2); border: 1px solid var(--line-2); border-radius: 6px;
    padding: 12px 14px;
    transition: border-color 150ms ease, transform 90ms ease;
}
.src:hover { border-color: var(--red); }
.src:active { transform: scale(0.99); }
.src b { font-size: 13px; font-weight: 700; }
.src small { font-size: 11px; color: var(--faint); line-height: 1.5; }

.qhead {
    margin-top: 20px;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 10px; letter-spacing: 1.8px; text-transform: uppercase;
    color: var(--faint);
}

.seg.wrap { flex-wrap: wrap; }

/* --- contador ------------------------------------------------------------- */

.colors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 620px) { .colors { grid-template-columns: minmax(0, 1fr); } }

.col {
    display: flex; align-items: center; gap: 11px;
    background: var(--surf-2); border: 1px solid var(--line-2); border-radius: 6px;
    padding: 8px 12px; cursor: pointer;
    transition: border-color 150ms ease;
}
.col:hover { border-color: var(--red); }
.col span { font-size: 12px; color: var(--dim); }

/* El selector nativo trae un marco feo: lo dejamos como una pastilla de color. */
.col input[type="color"] {
    -webkit-appearance: none; appearance: none;
    width: 30px; height: 24px; padding: 0;
    background: none; border: none; border-radius: 5px;
    cursor: pointer; flex: none;
}
.col input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.col input[type="color"]::-webkit-color-swatch { border: 1px solid var(--line-2); border-radius: 5px; }
.col input[type="color"]::-moz-color-swatch { border: 1px solid var(--line-2); border-radius: 5px; }

/* Damero: recuerda que el fondo de la fuente es transparente. */
.tm-preview {
    margin-top: 10px;
    display: flex;
    min-height: 190px;
    background: repeating-conic-gradient(#121110 0% 25%, #0A0A0A 0% 50%) 0 0 / 18px 18px;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    overflow: hidden;
}
#tm-mount { width: 100%; }

/* La marca: el 09 en hueso y la X en rojo. Va en un solo span porque
   .wordmark es flex y el gap separaría las dos mitades del nombre. */
.wordmark .mark { font-size: 17px; font-weight: 900; letter-spacing: -0.8px; font-style: normal; }
.wordmark .mark i { color: var(--red); font-style: normal; }
