/* ================= VARIABLES / TEMAS ================= */
:root {
  --bg: #0b0d1a; --bg2: #11142a; --card: #171b35; --card2: #1e2342;
  --txt: #e9ebf8; --muted: #9ba1c6; --borde: rgba(255,255,255,.09);
  --acc: #8b6cff; --acc2: #22d3ee; --rosa: #f472b6; --ok: #22c55e; --bad: #f43f5e; --warn: #f59e0b;
  --sombra: 0 10px 40px rgba(0,0,0,.35);
  --radio: 18px;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --blk-a: .34; --blk-l: 62%;
}
:root[data-theme="light"] {
  --bg: #f5f6fc; --bg2: #eceefb; --card: #ffffff; --card2: #f3f4fd;
  --txt: #1a1d3a; --muted: #5b6188; --borde: rgba(20,20,60,.12);
  --sombra: 0 10px 30px rgba(40,40,100,.1); --blk-a: .3; --blk-l: 55%;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body { font-family: var(--sans); background: var(--bg); color: var(--txt); line-height: 1.6; overflow-x: hidden; transition: background .4s, color .4s; }
code, .mono { font-family: var(--mono); }
code { background: var(--card2); padding: .1em .4em; border-radius: 6px; font-size: .9em; }
button { font-family: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.mini { font-size: .82rem; }
b { font-weight: 700; }

/* ================= FONDO / PROGRESO ================= */
#fondo { position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%; }
#progreso { position: fixed; top: 0; left: 0; height: 3px; width: 0; z-index: 100; background: linear-gradient(90deg, var(--acc), var(--acc2), var(--rosa)); }

/* ================= BARRA ================= */
.barra { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 1rem; padding: .8rem clamp(1rem, 4vw, 3rem); background: color-mix(in srgb, var(--bg) 75%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--borde); }
.logo { font-weight: 700; font-size: 1.4rem; color: var(--txt); text-decoration: none; letter-spacing: -.02em; }
.logo span { background: linear-gradient(90deg, var(--acc), var(--acc2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
#menu { display: flex; gap: .2rem; margin-left: auto; flex-wrap: wrap; }
#menu a { color: var(--muted); text-decoration: none; font-size: .9rem; padding: .35rem .7rem; border-radius: 999px; transition: .25s; }
#menu a:hover { color: var(--txt); background: var(--card2); }
#menu a.activo { color: #fff; background: var(--acc); }
.acciones { display: flex; gap: .4rem; }
.icono-btn { background: var(--card); border: 1px solid var(--borde); color: var(--txt); width: 40px; height: 40px; border-radius: 12px; font-size: 1.1rem; transition: transform .2s; }
.icono-btn:hover { transform: rotate(-10deg) scale(1.08); }
#burger { display: none; }

/* ================= GENERALES ================= */
main { max-width: 1150px; margin: 0 auto; padding: 0 clamp(1rem, 4vw, 2rem); }
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .75rem 1.3rem; border-radius: 999px; border: none; background: linear-gradient(135deg, var(--acc), #6d4dff); color: #fff; font-weight: 600; font-size: .95rem; text-decoration: none; white-space: nowrap; box-shadow: 0 6px 20px color-mix(in srgb, var(--acc) 40%, transparent); transition: transform .2s, box-shadow .2s; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 28px color-mix(in srgb, var(--acc) 55%, transparent); }
.btn:active { transform: scale(.97); }
.btn.sec { background: var(--card); color: var(--txt); border: 1px solid var(--borde); box-shadow: none; }
.btn.peligro { background: linear-gradient(135deg, var(--bad), #e11d48); box-shadow: 0 6px 20px color-mix(in srgb, var(--bad) 35%, transparent); }
.btn.chico { padding: .45rem .9rem; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.panel { background: var(--card); border: 1px solid var(--borde); border-radius: var(--radio); padding: clamp(1rem, 3vw, 1.8rem); box-shadow: var(--sombra); }
.aviso { margin-top: 1rem; font-size: .85rem; color: var(--muted); }
input[type=number], input[type=text], select { width: 100%; background: var(--bg2); color: var(--txt); border: 1px solid var(--borde); border-radius: 12px; padding: .7rem 1rem; font: inherit; transition: border .2s, box-shadow .2s; }
input[type=number], input.mono { font-family: var(--mono); }
input:focus, select:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 25%, transparent); }
label { font-size: .9rem; color: var(--muted); }
.campo { display: flex; flex-direction: column; gap: .35rem; }
h4.tit { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--acc2); margin-bottom: .6rem; font-family: var(--mono); font-weight: 600; }
.fila { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.grid2 > * { min-width: 0; }

/* ================= HERO ================= */
.hero { min-height: calc(100vh - 70px); display: flex; flex-direction: column; justify-content: center; padding: 4rem 0; }
.kicker { font-family: var(--mono); font-size: .85rem; color: var(--acc2); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 1rem; animation: subir .8s both; }
.hero h1 { font-size: clamp(2.3rem, 6vw, 4.3rem); line-height: 1.05; letter-spacing: -.03em; max-width: 14ch; animation: subir .8s .1s both; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--acc), var(--acc2), var(--rosa), var(--acc)); background-size: 300%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: brillo 6s linear infinite; }
.lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--muted); max-width: 60ch; margin: 1.2rem 0 2rem; animation: subir .8s .2s both; }
.lead b { color: var(--txt); }
.hero-disco-box { padding: 1.1rem 1.2rem 1rem; border-radius: var(--radio); background: var(--card); border: 1px solid var(--borde); margin-bottom: 2rem; animation: subir .8s .3s both; }
.hero-cab { display: flex; justify-content: space-between; gap: 1rem; font-family: var(--mono); font-size: .78rem; color: var(--muted); margin-bottom: .6rem; }
.hero-disco { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; }
.hero-log { margin-top: .7rem; font-size: .85rem; color: var(--muted); min-height: 2.8em; }
.hero-log b { color: var(--txt); }
.cta { display: flex; gap: .8rem; flex-wrap: wrap; animation: subir .8s .4s both; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 2.5rem; animation: subir .8s .5s both; }
.stat { padding: 1rem 1.1rem; border-radius: 14px; background: var(--card); border: 1px solid var(--borde); }
.stat b { display: block; font-family: var(--mono); font-size: 1.6rem; color: var(--acc2); }
.stat span { font-size: .85rem; color: var(--muted); }
.scroll-ind { margin-top: 2rem; font-family: var(--mono); font-size: .8rem; color: var(--muted); animation: flotar 2s ease-in-out infinite; }

/* ================= BLOQUES DE DISCO ================= */
.bk { aspect-ratio: 1; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: .62rem; color: var(--muted); background: repeating-linear-gradient(135deg, transparent 0 6px, var(--borde) 6px 8px); border: 1px solid var(--borde); position: relative; transition: background .35s, transform .2s, box-shadow .2s; min-width: 0; }
.bk.oc { background: hsla(var(--h, 260), 85%, var(--blk-l), var(--blk-a)); border-color: hsla(var(--h, 260), 85%, var(--blk-l), .7); color: var(--txt); }
.bk.idx { box-shadow: inset 0 0 0 2px hsla(var(--h), 90%, var(--blk-l), 1); font-weight: 700; }
.bk.nuevo { animation: entrar .5s both; }
.bk.marcado { transform: scale(1.12); z-index: 2; box-shadow: 0 0 0 2px var(--acc2), 0 6px 16px rgba(0,0,0,.3); }
.bk.leido { animation: leer .6s both; }
.bk.sistema { background: color-mix(in srgb, var(--txt) 16%, var(--bg2)); color: var(--txt); font-weight: 700; }

/* ================= SECCIONES ================= */
.seccion { padding: 5rem 0 2rem; }
.sec-cab { display: grid; grid-template-columns: auto 1fr; gap: 1.2rem; align-items: start; margin-bottom: 1.6rem; }
.sec-num { font-family: var(--mono); font-size: clamp(2.5rem, 6vw, 3.6rem); font-weight: 600; line-height: 1; background: linear-gradient(180deg, var(--acc), transparent); -webkit-background-clip: text; background-clip: text; color: transparent; }
.pregunta { display: inline-block; font-family: var(--mono); font-size: .85rem; color: var(--acc2); background: color-mix(in srgb, var(--acc2) 10%, transparent); border: 1px solid color-mix(in srgb, var(--acc2) 30%, transparent); padding: .3rem .8rem; border-radius: 999px; margin-bottom: .6rem; }
.sec-cab h2 { font-size: clamp(1.7rem, 4vw, 2.5rem); letter-spacing: -.02em; line-height: 1.15; }
.intro { color: var(--muted); max-width: 75ch; margin-top: .6rem; }
.intro b { color: var(--txt); }
.analogia { display: grid; grid-template-columns: auto 1fr; gap: 1.1rem; align-items: start; padding: 1.3rem 1.4rem; border-radius: var(--radio); margin-bottom: 1.5rem; background: linear-gradient(135deg, color-mix(in srgb, var(--acc) 14%, var(--card)), var(--card)); border: 1px solid color-mix(in srgb, var(--acc) 30%, var(--borde)); }
.analogia .ico { font-size: 2.2rem; line-height: 1; }
.analogia small { font-family: var(--mono); font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; color: var(--acc); }
.analogia h3 { font-size: 1.15rem; margin-bottom: .3rem; }
.analogia p { color: var(--muted); }
.analogia p b { color: var(--txt); }
.sub { margin: 2.2rem 0 1rem; }
.sub h3 { font-size: 1.25rem; }
.sub p { color: var(--muted); max-width: 75ch; }
.sub p b { color: var(--txt); }
.revelar { opacity: 0; transform: translateY(24px); transition: opacity .7s, transform .7s; }
.revelar.visible { opacity: 1; transform: none; }

/* ================= ATRIBUTOS ================= */
.explorador { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 1.2rem; }
.lista-arch { display: flex; flex-direction: column; gap: .5rem; }
.item-arch { display: flex; align-items: center; gap: .8rem; text-align: left; padding: .75rem .9rem; border-radius: 12px; border: 1px solid var(--borde); background: var(--bg2); color: var(--txt); font-size: .95rem; transition: .2s; }
.item-arch:hover { border-color: var(--acc); }
.item-arch.activo { background: color-mix(in srgb, var(--acc) 18%, var(--bg2)); border-color: var(--acc); }
.item-arch .i { font-size: 1.4rem; }
.item-arch small { display: block; color: var(--muted); font-size: .75rem; font-family: var(--mono); }
.ficha dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; font-size: .92rem; }
.ficha dt { color: var(--muted); }
.ficha dd { font-family: var(--mono); font-size: .86rem; overflow-wrap: anywhere; }
.consola { background: #070914; color: #d7dcff; font-family: var(--mono); font-size: .82rem; border-radius: 12px; padding: .8rem 1rem; margin-top: 1rem; overflow-x: auto; white-space: pre; border: 1px solid var(--borde); }
:root[data-theme="light"] .consola { background: #1a1d3a; }
.consola .p { color: var(--acc2); }

/* ================= OPERACIONES ================= */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--borde); background: var(--bg2); color: var(--txt); font-family: var(--mono); font-size: .82rem; transition: .2s; }
.chip:hover, .chip.activo { border-color: var(--acc); background: color-mix(in srgb, var(--acc) 18%, var(--bg2)); }
.chip-desc { margin-top: .7rem; min-height: 3em; color: var(--muted); font-size: .92rem; }
.bytes { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 3px; margin: .9rem 0 .3rem; }
.byte { position: relative; text-align: center; font-family: var(--mono); font-size: .9rem; padding: .45rem 0; border-radius: 6px; background: var(--bg2); border: 1px solid var(--borde); transition: background .3s; }
.byte small { position: absolute; top: -1.2em; left: 0; right: 0; font-size: .6rem; color: var(--muted); }
.byte.leido { background: color-mix(in srgb, var(--acc2) 30%, var(--bg2)); }
.byte.escrito { background: color-mix(in srgb, var(--rosa) 35%, var(--bg2)); }
.byte.ptr { box-shadow: 0 0 0 2px var(--warn); }
.byte.ptr::after { content: "▲"; position: absolute; bottom: -1.3em; left: 0; right: 0; color: var(--warn); font-size: .7rem; }
.byte.vacio { color: var(--muted); }
.tabla-mini { width: 100%; border-collapse: collapse; font-size: .85rem; font-family: var(--mono); }
.tabla-mini th, .tabla-mini td { padding: .45rem .6rem; text-align: left; border-bottom: 1px solid var(--borde); }
.tabla-mini th { color: var(--muted); font-weight: 400; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.tabla-mini tr.click { cursor: pointer; transition: background .2s; }
.tabla-mini tr.click:hover { background: var(--card2); }
.tabla-mini tr.sel { background: color-mix(in srgb, var(--acc) 16%, transparent); }
.tabla-mini .sw { display: inline-block; width: .8em; height: .8em; border-radius: 3px; background: hsla(var(--h), 85%, var(--blk-l), .8); margin-right: .4em; vertical-align: -1px; }
.log { margin-top: .9rem; font-family: var(--mono); font-size: .82rem; color: var(--muted); min-height: 1.5em; }
.log b { color: var(--txt); }
.log .ok { color: var(--ok); } .log .bad { color: var(--bad); } .log .warn { color: var(--warn); }

/* ================= ACCESO ================= */
.carril { display: flex; gap: 4px; margin: .8rem 0; overflow-x: auto; padding: .4rem 0; }
.reg { flex: 1 0 34px; min-width: 34px; height: 44px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: .8rem; background: var(--bg2); border: 1px solid var(--borde); transition: background .2s, transform .2s; }
.reg.paso { background: color-mix(in srgb, var(--warn) 30%, var(--bg2)); }
.reg.meta { background: color-mix(in srgb, var(--ok) 40%, var(--bg2)); transform: translateY(-4px); }
.contadores { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: .6rem; }
.contador { padding: .6rem .9rem; border-radius: 12px; background: var(--bg2); border: 1px solid var(--borde); min-width: 120px; }
.contador b { display: block; font-family: var(--mono); font-size: 1.3rem; color: var(--acc2); }
.contador span { font-size: .78rem; color: var(--muted); }
.pulso { animation: pulso .5s; }

/* ================= ESTRUCTURAS DE DIRECTORIO ================= */
.estructuras { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.estructura { padding: 1.1rem; border-radius: 14px; background: var(--card); border: 1px solid var(--borde); }
.estructura h4 { font-size: 1rem; margin-bottom: .5rem; }
.estructura pre { font-family: var(--mono); font-size: .75rem; color: var(--acc2); background: var(--bg2); padding: .6rem .7rem; border-radius: 10px; margin-bottom: .6rem; overflow-x: auto; line-height: 1.45; }
.estructura p { font-size: .86rem; color: var(--muted); }

/* ================= TERMINAL ================= */
.term-wrap { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 1.2rem; }
.terminal { background: #070914; border-radius: 14px; border: 1px solid var(--borde); overflow: hidden; display: flex; flex-direction: column; height: 400px; }
:root[data-theme="light"] .terminal { background: #1a1d3a; }
.term-barra { display: flex; gap: 6px; padding: .55rem .8rem; background: rgba(255,255,255,.05); align-items: center; }
.term-barra i { width: 11px; height: 11px; border-radius: 50%; background: #f43f5e; }
.term-barra i:nth-child(2) { background: #f59e0b; } .term-barra i:nth-child(3) { background: #22c55e; }
.term-barra span { margin-left: .5rem; font-family: var(--mono); font-size: .72rem; color: #9ba1c6; }
.term-salida { flex: 1; overflow-y: auto; padding: .8rem 1rem; font-family: var(--mono); font-size: .84rem; color: #d7dcff; white-space: pre-wrap; word-break: break-word; }
.term-salida .p { color: #22d3ee; } .term-salida .err { color: #fb7185; } .term-salida .dir { color: #a78bfa; font-weight: 600; } .term-salida .ayuda { color: #9ba1c6; }
.term-linea { display: flex; align-items: center; gap: .5rem; padding: .6rem 1rem; border-top: 1px solid rgba(255,255,255,.08); font-family: var(--mono); font-size: .84rem; }
.term-linea .p { color: #22d3ee; white-space: nowrap; }
.term-linea input { background: transparent; border: none; color: #fff; padding: 0; border-radius: 0; font-family: var(--mono); font-size: .84rem; }
.term-linea input:focus { box-shadow: none; }
.arbol { font-family: var(--mono); font-size: .84rem; line-height: 1.7; max-height: 330px; overflow: auto; }
.arbol div { white-space: nowrap; }
.arbol .d { color: var(--acc); font-weight: 600; }
.arbol .cwd { background: color-mix(in srgb, var(--acc2) 22%, transparent); border-radius: 6px; padding: 0 .3rem; }
.ruta-actual { margin-top: .8rem; font-family: var(--mono); font-size: .8rem; color: var(--muted); }
.ruta-actual b { color: var(--acc2); }
.sugerencias { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .8rem; }

/* ================= ASIGNACIÓN ================= */
.tabs { display: inline-flex; gap: .25rem; padding: .25rem; border-radius: 999px; background: var(--bg2); border: 1px solid var(--borde); margin-bottom: 1rem; flex-wrap: wrap; }
.tab { padding: .5rem 1rem; border-radius: 999px; border: none; background: transparent; color: var(--muted); font-weight: 600; font-size: .9rem; transition: .2s; }
.tab.activo { background: var(--acc); color: #fff; }
.asig-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1.4rem; }
.disco { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 5px; }
.disco .bk { font-size: .7rem; cursor: default; }
.disco .bk .num { position: absolute; top: 2px; left: 4px; font-size: .55rem; color: var(--muted); }
.disco .bk .ptr { font-size: .62rem; position: absolute; bottom: 2px; right: 4px; color: var(--txt); opacity: .8; }
.detalle { margin-top: 1rem; padding: .9rem 1rem; border-radius: 12px; background: var(--bg2); border: 1px dashed var(--borde); font-size: .9rem; min-height: 4em; }
.detalle .cadena { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; font-family: var(--mono); font-size: .85rem; margin-top: .4rem; }
.detalle .cadena span { padding: .15rem .5rem; border-radius: 6px; background: hsla(var(--h), 85%, var(--blk-l), var(--blk-a)); }
.detalle .cadena i { color: var(--muted); font-style: normal; }
.leyenda { display: flex; flex-wrap: wrap; gap: .9rem; font-size: .78rem; color: var(--muted); margin-top: .8rem; }
.leyenda span { display: inline-flex; align-items: center; gap: .35rem; }
.leyenda .bk { width: 14px; height: 14px; aspect-ratio: auto; }

/* ================= ESPACIO LIBRE ================= */
.libre-disco { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 4px; }
.libre-disco .bk { cursor: pointer; font-size: .62rem; }
.libre-disco .bk:hover { transform: scale(1.1); }
.bits { font-family: var(--mono); font-size: 1rem; letter-spacing: .08em; word-break: break-all; line-height: 1.8; }
.bits span { padding: 0 1px; border-radius: 3px; }
.bits .uno { color: var(--rosa); } .bits .cero { color: var(--ok); }
.bits .primero { background: color-mix(in srgb, var(--ok) 30%, transparent); }
.bits .sep { margin-right: .5em; }
.lista-libre { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; font-family: var(--mono); font-size: .82rem; }
.lista-libre span { padding: .15rem .45rem; border-radius: 6px; background: color-mix(in srgb, var(--ok) 20%, var(--bg2)); }
.lista-libre i { font-style: normal; color: var(--muted); }

/* ================= PERMISOS ================= */
.perm-grid { display: grid; grid-template-columns: auto repeat(3, minmax(0, 1fr)); gap: .5rem; align-items: center; max-width: 520px; }
.perm-grid .cab { font-family: var(--mono); font-size: .75rem; color: var(--muted); text-align: center; text-transform: uppercase; }
.perm-grid .rot { font-size: .9rem; }
.perm-btn { padding: .7rem 0; border-radius: 12px; border: 1px solid var(--borde); background: var(--bg2); color: var(--muted); font-family: var(--mono); font-size: 1.05rem; font-weight: 600; transition: .2s; }
.perm-btn.on { background: color-mix(in srgb, var(--acc) 35%, var(--bg2)); border-color: var(--acc); color: var(--txt); }
.perm-out { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-top: 1.2rem; }
.perm-out div { padding: .8rem; border-radius: 12px; background: var(--bg2); border: 1px solid var(--borde); }
.perm-out small { display: block; font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.perm-out b { font-family: var(--mono); font-size: 1.35rem; color: var(--acc2); }
.octal-calc { font-family: var(--mono); font-size: .85rem; color: var(--muted); margin-top: .8rem; }
.verificar { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.veredicto { margin-top: .9rem; padding: .9rem 1rem; border-radius: 12px; font-weight: 600; }
.veredicto.si { background: color-mix(in srgb, var(--ok) 18%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 50%, transparent); }
.veredicto.no { background: color-mix(in srgb, var(--bad) 15%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 50%, transparent); }
.veredicto small { display: block; font-weight: 400; color: var(--muted); margin-top: .2rem; }

/* ================= JOURNALING ================= */
.jr-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.4rem; }
.switch { display: inline-flex; align-items: center; gap: .6rem; cursor: pointer; font-size: .95rem; color: var(--txt); }
.switch input { display: none; }
.switch .pista { width: 44px; height: 24px; border-radius: 999px; background: var(--card2); border: 1px solid var(--borde); position: relative; transition: .25s; }
.switch .pista::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: .25s; }
.switch input:checked + .pista { background: var(--acc); }
.switch input:checked + .pista::after { left: 22px; background: #fff; }
.pasos { list-style: none; display: flex; flex-direction: column; gap: .45rem; margin-top: 1rem; }
.pasos li { display: flex; gap: .7rem; align-items: center; padding: .6rem .8rem; border-radius: 10px; background: var(--bg2); border: 1px solid var(--borde); font-size: .9rem; transition: .3s; }
.pasos li .est { font-family: var(--mono); width: 1.6em; text-align: center; }
.pasos li.hecho { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.pasos li.actual { border-color: var(--warn); box-shadow: 0 0 0 2px color-mix(in srgb, var(--warn) 30%, transparent); }
.pasos li.journal { background: color-mix(in srgb, var(--acc) 12%, var(--bg2)); }
.pasos li.perdido { opacity: .5; text-decoration: line-through; }
.estado-fs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.estado-fs div { padding: .7rem .8rem; border-radius: 12px; background: var(--bg2); border: 1px solid var(--borde); font-size: .85rem; }
.estado-fs div b { display: block; font-family: var(--mono); font-size: .78rem; color: var(--muted); font-weight: 400; }
.estado-fs div.ok { border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.diagnostico { margin-top: 1rem; padding: .9rem 1rem; border-radius: 12px; background: var(--bg2); border: 1px solid var(--borde); font-size: .92rem; }
.diagnostico.bien { border-color: color-mix(in srgb, var(--ok) 55%, transparent); background: color-mix(in srgb, var(--ok) 10%, var(--bg2)); }
.diagnostico.mal { border-color: color-mix(in srgb, var(--bad) 55%, transparent); background: color-mix(in srgb, var(--bad) 10%, var(--bg2)); }
.apagon { animation: apagon .7s; }

/* ================= COMPARACIÓN ================= */
.tabla-wrap { overflow-x: auto; border-radius: var(--radio); border: 1px solid var(--borde); background: var(--card); margin-bottom: 1.5rem; }
.tabla-comp { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 640px; }
.tabla-comp th, .tabla-comp td { padding: .8rem 1rem; text-align: left; border-bottom: 1px solid var(--borde); vertical-align: top; }
.tabla-comp thead th { font-family: var(--mono); font-size: .8rem; color: var(--acc2); text-transform: uppercase; letter-spacing: .05em; background: var(--card2); }
.tabla-comp tbody th { color: var(--muted); font-weight: 500; white-space: nowrap; }
.tabla-comp tbody tr:last-child > * { border-bottom: none; }
.tabla-comp tbody tr:hover { background: var(--card2); }

/* ================= QUIZ ================= */
.quiz { max-width: 760px; }
.quiz-cab { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: .82rem; color: var(--muted); margin-bottom: .6rem; }
.quiz-barra { height: 6px; border-radius: 999px; background: var(--bg2); overflow: hidden; margin-bottom: 1.2rem; }
.quiz-barra i { display: block; height: 100%; background: linear-gradient(90deg, var(--acc), var(--acc2)); transition: width .4s; }
.quiz h3 { font-size: 1.25rem; margin-bottom: 1rem; }
.opciones { display: flex; flex-direction: column; gap: .5rem; }
.opcion { text-align: left; padding: .85rem 1rem; border-radius: 12px; border: 1px solid var(--borde); background: var(--bg2); color: var(--txt); font-size: .95rem; transition: .2s; }
.opcion:hover:not(:disabled) { border-color: var(--acc); transform: translateX(4px); }
.opcion.bien { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 18%, var(--bg2)); }
.opcion.mal { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 15%, var(--bg2)); }
.opcion:disabled { cursor: default; }
.explicacion { margin-top: 1rem; padding: .9rem 1rem; border-radius: 12px; background: var(--card2); color: var(--muted); font-size: .92rem; animation: subir .4s both; }
.explicacion b { color: var(--txt); }
.quiz-pie { display: flex; justify-content: flex-end; margin-top: 1rem; gap: .5rem; }
.resultado { text-align: center; padding: 1rem 0; }
.resultado .grande { font-size: 3rem; font-family: var(--mono); color: var(--acc2); }

/* ================= GLOSARIO ================= */
.glos-buscar { max-width: 420px; margin-bottom: 1.2rem; }
.glosario { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; }
.term { perspective: 900px; height: 150px; cursor: pointer; border: none; background: none; color: inherit; padding: 0; text-align: left; }
.term .in { position: relative; width: 100%; height: 100%; transition: transform .6s; transform-style: preserve-3d; }
.term.vuelta .in { transform: rotateY(180deg); }
.term .cara { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 14px; padding: 1rem; border: 1px solid var(--borde); background: var(--card); display: flex; flex-direction: column; justify-content: center; }
.term .cara h3 { font-size: 1.05rem; }
.term .cara small { font-family: var(--mono); font-size: .7rem; color: var(--muted); margin-top: .3rem; }
.term .atras { transform: rotateY(180deg); background: linear-gradient(135deg, color-mix(in srgb, var(--acc) 22%, var(--card)), var(--card)); font-size: .85rem; overflow-y: auto; justify-content: flex-start; }
.glos-vacio { color: var(--muted); }

/* ================= PIE ================= */
.pie { margin-top: 5rem; padding: 2.5rem clamp(1rem, 4vw, 3rem); border-top: 1px solid var(--borde); text-align: center; font-size: .9rem; display: flex; flex-direction: column; gap: .5rem; align-items: center; }
.pie a { color: var(--acc2); text-decoration: none; }
.pie .muted { max-width: 70ch; font-size: .8rem; }

/* ================= ANIMACIONES ================= */
@keyframes subir { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes brillo { to { background-position: 300% 0; } }
@keyframes flotar { 50% { transform: translateY(6px); } }
@keyframes entrar { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes leer { 40% { box-shadow: 0 0 0 3px var(--warn); transform: scale(1.15); } }
@keyframes pulso { 40% { transform: scale(1.2); color: var(--rosa); } }
@keyframes apagon { 0%, 60% { filter: brightness(.25); } 100% { filter: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } html { scroll-behavior: auto; } }

/* ================= RESPONSIVE ================= */
@media (max-width: 1000px) {
  #burger { display: block; }
  .acciones { margin-left: auto; }
  #menu { display: none; position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; padding: .8rem; background: var(--bg); border-bottom: 1px solid var(--borde); }
  #menu.abierto { display: flex; }
  #menu a { padding: .6rem .9rem; }
  .estructuras { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .explorador, .term-wrap, .asig-grid, .jr-grid, .grid2 { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: 1fr; }
  .hero-disco { grid-template-columns: repeat(12, 1fr); }
  .libre-disco { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .bytes { grid-template-columns: repeat(8, minmax(0, 1fr)); row-gap: 1.6rem; }
}
@media (max-width: 520px) {
  .estructuras { grid-template-columns: 1fr; }
  .sec-cab { grid-template-columns: 1fr; gap: .3rem; }
  .perm-out, .verificar { grid-template-columns: 1fr; }
  .estado-fs { grid-template-columns: 1fr; }
  .analogia { grid-template-columns: 1fr; }
  .terminal { height: 340px; }
}

/* ================= GUÍAS, NARRACIÓN Y DIAGRAMAS DE ORGANIZACIÓN ================= */
.guia { margin: 0 0 1rem; padding: 1rem 1.2rem; border-radius: 14px; background: color-mix(in srgb, var(--acc2) 7%, var(--card)); border: 1px solid color-mix(in srgb, var(--acc2) 28%, var(--borde)); }
.guia h4 { font-size: .95rem; margin-bottom: .5rem; }
.guia ol { padding-left: 1.3rem; display: flex; flex-direction: column; gap: .35rem; font-size: .92rem; color: var(--muted); }
.guia ol b, .guia .mirar b { color: var(--txt); }
.guia li::marker { color: var(--acc2); font-family: var(--mono); font-weight: 600; }
.guia .mirar { margin-top: .7rem; font-size: .9rem; color: var(--muted); padding-top: .6rem; border-top: 1px dashed var(--borde); }

.narr { padding: .95rem 1.1rem; border-radius: 12px; background: var(--bg2); border: 1px solid var(--borde); border-left: 4px solid var(--acc); font-size: .92rem; }
.narr > b:first-child { display: block; margin-bottom: .45rem; }
.narr ol { padding-left: 1.3rem; display: flex; flex-direction: column; gap: .35rem; color: var(--muted); }
.narr ol b, .narr p b { color: var(--txt); }
.narr li { animation: subir .4s calc(var(--i, 0) * .12s) both; }
.narr li::marker { color: var(--acc); font-family: var(--mono); font-weight: 600; }
.narr p { color: var(--muted); margin-top: .4rem; }
.narr.bien { border-left-color: var(--ok); }
.narr.mal { border-left-color: var(--bad); }
.narr .bad { color: var(--bad); font-weight: 600; }
.narr.aparecer { animation: subir .35s both; }

.metodo-expl { padding: .9rem 1.1rem; border-radius: 12px; background: color-mix(in srgb, var(--acc) 9%, var(--bg2)); border: 1px solid color-mix(in srgb, var(--acc) 25%, var(--borde)); font-size: .94rem; color: var(--muted); }
.metodo-expl b { color: var(--txt); }

.disco .bk { border-style: solid; padding: 0; color: var(--txt); font-family: var(--mono); }
.disco button.bk { cursor: pointer; }
.disco .bk .cen { font-size: .95rem; font-weight: 700; }
.disco .bk .cen sub { font-size: .65rem; font-weight: 600; }
.disco .bk.atenuado { opacity: .45; }
.disco .bk.leido, .disco .bk:not(.oc).leido { box-shadow: 0 0 0 3px var(--warn); }

.org { margin-top: 1.2rem; padding: 1.1rem 1.2rem; border-radius: 14px; border: 1px solid var(--borde); background: var(--card2); }
.org-paso { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .9rem; align-items: start; padding: .8rem 0; }
.org-paso + .org-paso { border-top: 1px dashed var(--borde); }
.org-paso p { color: var(--muted); font-size: .93rem; margin-bottom: .5rem; }
.org-paso p b { color: var(--txt); }
.org-n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--acc); color: #fff; font-family: var(--mono); font-weight: 600; font-size: .9rem; }
.org-ent { border-collapse: collapse; font-family: var(--mono); font-size: .88rem; background: var(--bg2); border-radius: 10px; overflow: hidden; }
.org-ent th { font-weight: 400; font-size: .72rem; color: var(--muted); text-transform: uppercase; padding: .4rem .9rem; border-bottom: 1px solid var(--borde); text-align: left; }
.org-ent td { padding: .5rem .9rem; font-weight: 600; }
.org-ent td + td, .org-ent th + th { border-left: 1px solid var(--borde); }
.org-fila { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.org-col { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.org-col small { font-size: .7rem; color: var(--muted); }
.org-celda { padding: .4rem .6rem; border-radius: 8px; font-family: var(--mono); font-size: .82rem; font-weight: 600; background: hsla(var(--h), 85%, var(--blk-l), var(--blk-a)); border: 1px solid hsla(var(--h), 85%, var(--blk-l), .7); white-space: nowrap; }
.org-nodo { display: grid; grid-template-columns: auto auto; border-radius: 10px; overflow: hidden; border: 1px solid hsla(var(--h), 85%, var(--blk-l), .8); font-family: var(--mono); font-size: .8rem; }
.org-nodo small { grid-column: 1 / -1; text-align: center; font-size: .68rem; color: var(--muted); padding: .15rem .4rem; background: var(--bg2); }
.org-nodo .d { padding: .35rem .55rem; background: hsla(var(--h), 85%, var(--blk-l), var(--blk-a)); font-weight: 600; }
.org-nodo .s { padding: .35rem .55rem; background: var(--bg2); border-left: 1px dashed var(--borde); color: var(--acc2); font-weight: 600; }
.org-fl { font-style: normal; color: var(--muted); font-size: 1.1rem; }
.org-idx { display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: flex-start; }
.org-tabla-idx { border: 2px solid hsla(var(--h), 90%, var(--blk-l), 1); border-radius: 10px; overflow: hidden; font-family: var(--mono); font-size: .82rem; min-width: 150px; }
.org-tabla-idx .cab { background: hsla(var(--h), 85%, var(--blk-l), var(--blk-a)); padding: .35rem .7rem; font-weight: 600; }
.org-tabla-idx div:not(.cab) { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem .7rem; border-top: 1px solid var(--borde); }
.org-tabla-idx div span { color: var(--muted); }

.libre-par { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 4px; }
.lb-celda { display: flex; flex-direction: column; gap: 3px; background: none; border: none; padding: 0; color: inherit; min-width: 0; }
.lb-celda .bk { width: 100%; font-size: .66rem; color: var(--txt); }
.lb-celda .bit { font-family: var(--mono); font-weight: 600; font-size: .85rem; text-align: center; border-radius: 5px; padding: .1rem 0; background: var(--bg2); border: 1px solid var(--borde); }
.lb-celda .bit.uno { color: var(--rosa); } .lb-celda .bit.cero { color: var(--ok); }
.lb-celda:hover .bk, .lb-celda.marcado .bk { box-shadow: 0 0 0 2px var(--acc2); }
.lb-celda:hover .bit, .lb-celda.marcado .bit { border-color: var(--acc2); }
.lista-libre .cabeza { background: color-mix(in srgb, var(--acc) 30%, var(--bg2)); font-weight: 600; }

.arbol .res { outline: 2px dashed var(--warn); border-radius: 4px; outline-offset: 1px; }
#t-expl { margin-top: 1rem; }
#t-expl code { font-size: .82em; }

@media (max-width: 820px) {
  .libre-par { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .disco .bk .cen { font-size: .75rem; }
  .disco .bk .num, .disco .bk .ptr { font-size: .48rem; }
}
