/* ==========================================================================
   Diagramas para memorizar
   ========================================================================== */
.dg { margin: 6px 0 1.6em; padding: 20px; border-radius: 22px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm); position: relative; overflow: hidden; }
.dg::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--c); opacity: .85; }
.dg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 16px; }
.dg-head h4 { flex: 1 1 100%; order: 2; margin: 0; font-family: var(--display); font-size: 1.15rem; font-weight: 700; }
.dg-tag { order: 1; display: inline-flex; gap: 6px; align-items: center; font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--c); }
.dg-rec { order: 1; margin-left: auto; display: inline-flex; gap: 6px; align-items: center; border: 1.5px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 99px; padding: 5px 12px; font-size: .8rem; font-weight: 650; transition: all .25s; }
.dg-rec:hover { border-color: var(--c); color: var(--text); }
.dg.recall .dg-rec { background: var(--c); border-color: var(--c); color: #fff; }
.dg-hint { display: none; margin: 14px 0 0; font-size: .82rem; color: var(--muted); }
.dg.recall .dg-hint { display: block; }
.dg.recall .dg-hide:not(.shown) { filter: blur(6px); opacity: .55; cursor: pointer; user-select: none; transition: filter .3s, opacity .3s; }
.dg .dg-hide.shown { animation: unblur .45s var(--ease); }
@keyframes unblur { from { filter: blur(6px); opacity: .5; } to { filter: none; opacity: 1; } }
.dg-body { position: relative; }
/* entrada escalonada al aparecer */
.dg [style*="--i"]:not(path) { opacity: 0; transform: translateY(10px); transition: opacity .55s var(--ease), transform .6s var(--spring); transition-delay: calc(var(--i) * 90ms + 120ms); }
.dg.in [style*="--i"]:not(path) { opacity: 1; transform: none; }
.dg .mm-rama[style*="--i"] { transform: translate(-50%, -50%) scale(.85); }
.dg.in .mm-rama[style*="--i"] { transform: translate(-50%, -50%); }
.dg .cy-n[style*="--i"] { transform: translate(-50%, -50%) scale(.8); }
.dg.in .cy-n[style*="--i"] { transform: translate(-50%, -50%); }

/* ── Mapa mental ── */
.mm-radial { position: relative; height: 520px; }
.mm-radial.n3 { height: 430px; } .mm-radial.n4 { height: 480px; } .mm-radial.n5, .mm-radial.n6 { height: 560px; }
.mm-radial.n5 .mm-rama, .mm-radial.n6 .mm-rama { width: min(34%, 260px); }
.mm-radial.n5 .mm-centro, .mm-radial.n6 .mm-centro { max-width: 150px; }
.mm-radial svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.mm-radial path { fill: none; stroke: var(--c); stroke-width: .5; stroke-linecap: round; opacity: .55; stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset .9s var(--ease), opacity .3s; transition-delay: calc(var(--i) * 90ms); }
.dg.in .mm-radial path { stroke-dashoffset: 0; }
.mm-radial path.dim { opacity: .12; }
.mm-centro { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--c); color: #fff; font-family: var(--display); font-weight: 800; font-size: 1.15rem; padding: 16px 22px; border-radius: 22px; text-align: center; max-width: 190px; box-shadow: 0 10px 30px -10px var(--c); z-index: 2; animation: none; }
.dg.in .mm-centro { animation: pop .6s var(--spring); }
.mm-rama { position: absolute; width: min(29%, 230px); background: var(--surface); border: 1.5px solid color-mix(in srgb, var(--c) 35%, var(--border)); border-radius: 16px; padding: 10px 12px; z-index: 1; box-shadow: var(--shadow-sm); transition: opacity .55s var(--ease), transform .6s var(--spring), box-shadow .25s, border-color .25s; }
.mm-rama b { display: block; font-size: .92rem; color: var(--c); margin-bottom: 4px; }
.mm-rama ul, .mm-l ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; }
.mm-rama li, .mm-l li { font-size: .82rem; line-height: 1.35; color: var(--text-2); padding-left: 12px; position: relative; }
.mm-rama li::before, .mm-l li::before { content: ""; position: absolute; left: 0; top: .55em; width: 5px; height: 5px; border-radius: 50%; background: var(--c); }
.dg.focus .mm-rama:not(.hot) { opacity: .45; }
.mm-rama.hot { border-color: var(--c); box-shadow: var(--shadow); z-index: 3; }
.mm-lista { display: none; }
.mm-centro-l { background: var(--c); color: #fff; font-family: var(--display); font-weight: 800; padding: 12px 16px; border-radius: 16px; text-align: center; margin-bottom: 10px; }
.mm-l { border-left: 3px solid var(--c); margin-left: 14px; padding: 6px 0 10px 14px; position: relative; }
.mm-l::before { content: ""; position: absolute; left: -9px; top: 10px; width: 15px; height: 15px; border-radius: 50%; background: var(--surface); border: 3px solid var(--c); }
.mm-l b { color: var(--c); display: block; margin-bottom: 4px; }
@media (max-width: 760px) { .mm-radial { display: none; } .mm-lista { display: block; } }

/* ── Flujo ── */
.fl-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 14px; counter-reset: f; }
.fl-steps li { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 16px; background: var(--surface-2); }
.fl-steps li:not(:last-child)::after { content: ""; position: absolute; right: -14px; top: 30px; width: 14px; height: 2px; background: var(--c); }
.fl-steps li:not(:last-child)::before { content: ""; position: absolute; right: -15px; top: 26px; border: 5px solid transparent; border-left-color: var(--c); z-index: 1; }
.fl-n { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--c); color: #fff; font-family: var(--display); font-weight: 800; font-size: .9rem; flex: none; }
.fl-steps b { font-size: .95rem; margin-top: 4px; }
.fl-steps span:not(.fl-n) { font-size: .86rem; color: var(--text-2); line-height: 1.4; }
@media (max-width: 760px) {
  .fl-steps { grid-auto-flow: row; }
  .fl-steps li { padding-left: 56px; }
  .fl-steps li .fl-n { position: absolute; left: 14px; top: 14px; }
  .fl-steps li:not(:last-child)::after { right: auto; left: 28px; top: auto; bottom: -14px; width: 2px; height: 14px; }
  .fl-steps li:not(:last-child)::before { right: auto; left: 24px; top: auto; bottom: -15px; border-left-color: transparent; border-top-color: var(--c); }
}

/* ── Ciclo ── */
.cy { position: relative; height: 440px; max-width: 560px; margin: 0 auto; color: var(--c); }
.cy svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cy-ring { fill: none; stroke: color-mix(in srgb, var(--c) 18%, transparent); stroke-width: 1.4; }
.cy-run { fill: none; stroke: var(--c); stroke-width: 1.4; stroke-dasharray: 18 82; transform: rotate(-90deg); transform-origin: 50% 50%; }
.dg.in .cy-run { animation: cyRun 6s linear infinite; }
@keyframes cyRun { to { stroke-dashoffset: -100; } }
.cy-c { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-family: var(--display); font-weight: 800; font-size: 1.2rem; color: var(--c); text-align: center; max-width: 140px; }
.cy-n { position: absolute; width: min(36%, 180px); background: var(--surface); border: 1.5px solid color-mix(in srgb, var(--c) 30%, var(--border)); border-radius: 16px; padding: 10px 12px; color: var(--text); display: flex; flex-direction: column; gap: 3px; box-shadow: var(--shadow-sm); }
.cy-n .fl-n { width: 24px; height: 24px; font-size: .78rem; border-radius: 8px; }
.cy-n b { font-size: .9rem; } .cy-n span:not(.fl-n) { font-size: .8rem; color: var(--text-2); line-height: 1.35; }
.cy-lista { display: none; }
@media (max-width: 760px) { .cy { display: none; } .cy-lista { display: grid; grid-auto-flow: row; } .cy-lista li { padding-left: 56px; } .cy-lista li .fl-n { position: absolute; left: 14px; top: 14px; } .cy-lista li:last-child::after { content: "↺ vuelve a empezar"; position: static; width: auto; height: auto; background: none; color: var(--c); font-size: .78rem; font-weight: 700; } }

/* ── Árbol de decisión ── */
.tr { display: grid; gap: 12px; }
.tr-path { display: grid; gap: 6px; }
.tr-done { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 8px 12px; border-radius: 12px; background: var(--surface-2); font-size: .86rem; color: var(--text-2); animation: rise .35s var(--ease); }
.tr-done b { font-size: .78rem; padding: 2px 10px; border-radius: 99px; flex: none; }
.tr-done b.si { background: var(--ok-soft); color: var(--ok); } .tr-done b.no { background: var(--surface-3); color: var(--text-2); }
.tr-q, .tr-res { display: flex; gap: 12px; align-items: center; padding: 16px; border-radius: 16px; border: 1.5px solid color-mix(in srgb, var(--c) 35%, var(--border)); background: color-mix(in srgb, var(--c) 6%, var(--surface)); }
.tr-q b, .tr-res b { font-size: 1.02rem; line-height: 1.35; }
.tr-ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--c); color: #fff; flex: none; }
.tr-res.ok { border-color: var(--ok); background: var(--ok-soft); } .tr-res.ok .tr-ic { background: var(--ok); }
.tr-res.bad { border-color: var(--bad); background: var(--bad-soft); } .tr-res.bad .tr-ic { background: var(--bad); }
.tr-btns { display: flex; gap: 10px; margin-top: 10px; }
.tr-btns .btn { min-width: 110px; }
.tr-now .tr-reset { margin-top: 10px; }

/* ── Escala ── */
.sc { padding-top: 6px; }
.sc-marks { position: relative; height: 44px; }
.sc-marks span { position: absolute; bottom: 4px; transform: translateX(-50%); text-align: center; line-height: 1.1; white-space: nowrap; }
.sc-marks span::after { content: ""; display: block; width: 2px; height: 8px; background: var(--text); margin: 3px auto 0; }
.sc-marks b { font-family: var(--display); font-size: .92rem; display: block; } .sc-marks small { font-size: .7rem; color: var(--muted); font-weight: 600; }
.sc-bar { position: relative; display: flex; height: 22px; border-radius: 99px; overflow: visible; background: var(--surface-3); }
.sc-bar i { display: block; height: 100%; transform-origin: left; }
.sc-bar i:first-child { border-radius: 99px 0 0 99px; } .sc-bar i:last-of-type { border-radius: 0 99px 99px 0; }
.dg .sc-bar i[style*="--i"] { opacity: 1; transform: scaleX(0); transition: transform .5s var(--ease); transition-delay: calc(var(--i) * 160ms + 150ms); }
.dg.in .sc-bar i[style*="--i"] { transform: scaleX(1); }
.sc-ptr { position: absolute; top: -6px; width: 6px; height: 34px; margin-left: -3px; border-radius: 4px; background: var(--text); box-shadow: 0 0 0 3px var(--surface); transition: left .15s; }
.sc-labs { display: flex; margin-top: 8px; }
.sc-labs span { font-size: .76rem; font-weight: 700; text-align: center; padding: 0 2px; line-height: 1.25; }
.sc-ticks { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); margin-top: 4px; }
.sc-try { display: flex; gap: 14px; align-items: center; margin-top: 14px; padding: 10px 12px; border-radius: 14px; background: var(--surface-2); flex-wrap: wrap; }
.sc-try input { flex: 1; min-width: 160px; }
.sc-try output { font-size: .9rem; min-width: 160px; }

/* ── Pirámide ── */
.py { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.py-l { width: var(--w); min-width: 220px; max-width: 100%; text-align: center; padding: 10px 16px; border-radius: 14px; color: #fff; background: color-mix(in srgb, var(--c) calc(100% - var(--k) * 45%), #8d8577); display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; }
.py-l b { font-size: .95rem; } .py-l small { font-size: .78rem; opacity: .92; line-height: 1.3; }
.py-n { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.22); font-size: .72rem; font-weight: 800; display: grid; place-items: center; }
.py-arrow { font-size: .74rem; color: var(--muted); font-weight: 600; display: inline-flex; gap: 4px; align-items: center; margin-top: 4px; }
.py-arrow .ic { transform: rotate(90deg); }

/* ── Línea de tiempo ── */
.tl { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; padding-top: 4px; }
.tl-track { position: absolute; left: 4%; right: 4%; top: 40px; height: 4px; border-radius: 4px; background: var(--surface-3); }
.tl-track i { display: block; height: 100%; width: 0; border-radius: 4px; background: var(--c); transition: width 1.4s var(--ease) .2s; }
.dg.in .tl-track i { width: 100%; }
.tl-h { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; }
.tl-k { font-family: var(--display); font-weight: 800; font-size: .95rem; color: var(--c); height: 26px; display: flex; align-items: end; }
.tl-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 4px solid var(--c); z-index: 1; margin: 2px 0 6px; }
.tl-h b { font-size: .9rem; } .tl-h small { font-size: .8rem; color: var(--text-2); line-height: 1.35; }
@media (max-width: 760px) {
  .tl { grid-auto-flow: row; padding-left: 26px; }
  .tl-track { left: 7px; right: auto; top: 8px; bottom: 8px; width: 4px; height: auto; }
  .tl-track i { width: 100%; height: 0; transition: height 1.4s var(--ease) .2s; } .dg.in .tl-track i { height: 100%; width: 100%; }
  .tl-h { align-items: flex-start; text-align: left; } .tl-k { height: auto; }
  .tl-dot { position: absolute; left: -26px; top: 2px; margin: 0; }
}

/* ── Acrónimo ── */
.ac { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.ac-l { padding: 16px; border-radius: 18px; background: color-mix(in srgb, var(--c) 8%, var(--surface)); border: 1.5px solid color-mix(in srgb, var(--c) 25%, var(--border)); display: flex; flex-direction: column; gap: 4px; }
.ac-big { font-family: var(--display); font-weight: 800; font-size: 2.6rem; line-height: 1; color: var(--c); }
.dg.in .ac-big { animation: letterIn .7s var(--spring) both; animation-delay: calc(var(--i) * 140ms + 200ms); }
@keyframes letterIn { from { transform: rotateX(90deg) scale(.6); opacity: 0; } }
.ac-l b { font-size: 1rem; } .ac-l small { font-size: .84rem; color: var(--text-2); line-height: 1.35; }

/* ── Comparar ── */
.cp { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: stretch; }
.cp.n3 { grid-template-columns: 1fr auto 1fr auto 1fr; }
.cp-vs { align-self: center; font-family: var(--display); font-weight: 800; font-size: .8rem; color: var(--muted); background: var(--surface-2); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; }
.cp-c { border-radius: 18px; padding: 14px 16px; background: color-mix(in srgb, var(--t) 7%, var(--surface)); border: 1.5px solid color-mix(in srgb, var(--t) 30%, var(--border)); }
.cp-c h5 { margin: 0 0 8px; font-family: var(--display); font-size: 1.02rem; display: flex; gap: 6px; align-items: center; color: var(--t); }
.cp-c ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.cp-c li { font-size: .88rem; line-height: 1.35; padding-left: 14px; position: relative; color: var(--text); }
.cp-c li::before { content: ""; position: absolute; left: 0; top: .5em; width: 6px; height: 6px; border-radius: 2px; background: var(--t); }
@media (max-width: 760px) { .cp, .cp.n3 { grid-template-columns: 1fr; } .cp-vs { justify-self: center; } }

/* Página de esquemas */
.dg-filter { position: sticky; top: 60px; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); padding: 10px 0; margin-bottom: 8px; }
.dg-group-title { display: flex; gap: 12px; align-items: center; margin: 30px 0 12px; }
.dg-group-title .u-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--c); color: #fff; }
.dg-group-title h2 { margin: 0; font-size: 1.35rem; }
.dg-from { font-size: .78rem; color: var(--muted); margin: -8px 0 14px; }

.lesson .dg ul { margin: 0; }
.lesson .dg ul li { margin-bottom: 0; padding-left: 14px; }
.lesson .dg ul li::before { transform: none; left: 0; top: .55em; width: 6px; height: 6px; border-radius: 50%; }
.lesson .dg .cp-c li::before { border-radius: 2px; background: var(--t); }
.lesson .dg ol { margin: 0; }

/* Acabado de los mapas mentales */
.mm-radial path { stroke-width: .65; opacity: .7; }
.mm-rama { border: 1px solid var(--border); border-top: 4px solid var(--c); padding: 11px 14px 12px; border-radius: 14px; }
.mm-rama b { font-size: .98rem; margin-bottom: 6px; }
.mm-rama li { font-size: .86rem; }
.mm-centro { font-size: 1.25rem; padding: 18px 24px; border-radius: 26px; box-shadow: 0 0 0 8px color-mix(in srgb, var(--c) 12%, transparent), 0 14px 30px -12px var(--c); }
