    :root {
      /* base oscura pero con tono índigo, más cálida y viva */
      --bg: #0b0e1a;
      --bg-soft: #12162a;
      --card: #181d33;
      --card-2: #1e2542;
      --line: #2b3355;
      --text: #f2f4fb;
      --muted: #9aa3c4;
      /* paleta vibrante coherente */
      --em: #2ee6a8;
      /* esmeralda  */
      --sky: #38bdf8;
      /* cielo      */
      --fu: #f472d0;
      /* fucsia     */
      --am: #fbbf24;
      /* ámbar      */
      --vi: #a78bfa;
      /* violeta    */
      --co: #fb7185;
      /* coral      */
      --accent: var(--em);
      --accent2: var(--sky);
      --accent3: var(--fu);
      --warn: var(--am);
      --radius: 18px;
      --sbw: 300px;
      --grad: linear-gradient(90deg, var(--em), var(--sky), var(--vi), var(--fu));
      --logo: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232ee6a8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cellipse cx='12' cy='5' rx='9' ry='3'/%3E%3Cpath d='M21 12c0 1.66-4 3-9 3s-9-1.34-9-3'/%3E%3Cpath d='M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5'/%3E%3C/svg%3E");
    }

    * {
      box-sizing: border-box;
    }

    html {
      scroll-behavior: smooth;
    }

    body {
      margin: 0;
      background: var(--bg);
      color: var(--text);
      font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
      line-height: 1.6;
      overflow-x: hidden;
    }

    ::selection {
      background: var(--em);
      color: #04140d;
    }

    code {
      font-family: 'Consolas', 'Courier New', monospace;
      background: rgba(56, 189, 248, .12);
      color: var(--sky);
      padding: 1px 6px;
      border-radius: 6px;
      font-size: .9em;
    }

    /* fondo animado con blobs de color */
    #bg-blobs {
      position: fixed;
      inset: 0;
      z-index: -1;
      overflow: hidden;
      pointer-events: none;
    }

    #bg-blobs span {
      position: absolute;
      border-radius: 50%;
      filter: blur(90px);
      opacity: .35;
      animation: blob 22s ease-in-out infinite;
    }

    #bg-blobs span:nth-child(1) {
      width: 420px;
      height: 420px;
      background: var(--em);
      top: -80px;
      left: -60px;
    }

    #bg-blobs span:nth-child(2) {
      width: 380px;
      height: 380px;
      background: var(--fu);
      bottom: -100px;
      right: -40px;
      animation-delay: -7s;
    }

    #bg-blobs span:nth-child(3) {
      width: 340px;
      height: 340px;
      background: var(--sky);
      top: 40%;
      left: 55%;
      animation-delay: -14s;
    }

    @keyframes blob {

      0%,
      100% {
        transform: translate(0, 0) scale(1);
      }

      33% {
        transform: translate(40px, -30px) scale(1.15);
      }

      66% {
        transform: translate(-30px, 40px) scale(.9);
      }
    }

    /* TOPBAR */
    #topbar {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: 58px;
      z-index: 1000;
      background: rgba(11, 14, 26, .82);
      backdrop-filter: blur(10px);
      border-bottom: 1px solid var(--line);
      display: flex;
      align-items: center;
      gap: 14px;
      padding: 0 18px;
    }

    #hamburger {
      display: none;
      background: none;
      border: 1px solid var(--line);
      color: var(--text);
      width: 38px;
      height: 38px;
      border-radius: 10px;
      cursor: pointer;
      font-size: 1.15rem;
      transition: .2s;
    }

    #hamburger:hover {
      border-color: var(--em);
      transform: scale(1.05);
    }

    #topbar .brand {
      font-weight: 800;
      font-size: 1rem;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    #topbar .brand .logo {
      width: 32px;
      height: 32px;
      display: inline-block;
      background: var(--logo) center/contain no-repeat;
      vertical-align: middle;
    }

    #topbar .brand span {
      background: var(--grad);
      background-size: 300% 100%;
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
      animation: grad 6s ease infinite;
      font-weight: 900;
    }

    @keyframes grad {

      0%,
      100% {
        background-position: 0% 50%;
      }

      50% {
        background-position: 100% 50%;
      }
    }

    #topbar .stepcount {
      margin-left: auto;
      color: var(--muted);
      font-size: .82rem;
    }

    #topbar-progress {
      position: absolute;
      bottom: -1px;
      left: 0;
      height: 3px;
      background: var(--grad);
      background-size: 200%;
      box-shadow: 0 0 12px var(--em);
      width: 0%;
      transition: width .45s cubic-bezier(.2, .8, .2, 1);
      animation: grad 4s linear infinite;
    }

    /* LAYOUT */
    .layout {
      display: flex;
      min-height: 100vh;
      padding-top: 58px;
    }

    #overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, .6);
      z-index: 899;
      backdrop-filter: blur(2px);
    }

    #overlay.show {
      display: block;
    }

    #sidebar {
      width: var(--sbw);
      flex-shrink: 0;
      border-right: 1px solid var(--line);
      background: rgba(18, 22, 42, .6);
      position: sticky;
      top: 58px;
      height: calc(100vh - 58px);
      overflow-y: auto;
      padding: 20px 0 60px;
    }

    #sidebar::-webkit-scrollbar {
      width: 8px;
    }

    #sidebar::-webkit-scrollbar-thumb {
      background: var(--line);
      border-radius: 8px;
    }

    .group-label {
      font-size: .7rem;
      text-transform: uppercase;
      letter-spacing: .12em;
      color: var(--muted);
      padding: 18px 22px 8px;
      font-weight: 800;
    }

    .group-label:first-child {
      padding-top: 6px;
    }

    .navitem {
      display: flex;
      align-items: center;
      gap: 10px;
      width: 100%;
      text-align: left;
      background: none;
      border: none;
      color: var(--muted);
      padding: 9px 22px;
      font-size: .85rem;
      cursor: pointer;
      border-left: 3px solid transparent;
      transition: all .22s;
      position: relative;
    }

    .navitem:hover {
      color: var(--text);
      background: rgba(255, 255, 255, .04);
      padding-left: 26px;
    }

    .navitem.active {
      color: var(--text);
      border-left-color: var(--em);
      background: linear-gradient(90deg, rgba(46, 230, 168, .14), transparent);
      font-weight: 700;
    }

    .navitem .bullet {
      width: 22px;
      height: 22px;
      border-radius: 50%;
      border: 1.5px solid var(--muted);
      flex-shrink: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: .65rem;
      color: var(--muted);
      transition: .25s;
    }

    .navitem.active .bullet {
      border-color: var(--em);
      color: var(--em);
      box-shadow: 0 0 0 4px rgba(46, 230, 168, .15);
      transform: scale(1.1);
    }

    .navitem.done .bullet {
      background: var(--em);
      border-color: var(--em);
      color: #04140d;
    }

    .navitem.done .bullet::before {
      content: '✓';
    }

    @media (max-width:860px) {
      #hamburger {
        display: block;
      }

      #sidebar {
        position: fixed;
        left: -320px;
        top: 58px;
        z-index: 900;
        box-shadow: 0 0 40px rgba(0, 0, 0, .6);
        transition: left .3s;
        background: var(--bg-soft);
      }

      #sidebar.open {
        left: 0;
      }
    }

    /* MAIN */
    main {
      flex: 1;
      min-width: 0;
      display: flex;
      justify-content: center;
      padding: 44px 24px 90px;
    }

    .step-panel {
      max-width: 960px;
      width: 100%;
      position: relative;
    }

    .step {
      position: absolute;
      left: -9999px;
      top: -9999px;
      opacity: 0;
      pointer-events: none;
      width: 100%;
      visibility: hidden;
    }

    .step.active {
      position: relative;
      left: 0;
      top: 0;
      opacity: 1;
      pointer-events: auto;
      visibility: visible;
    }

    /* entrada escalonada de los hijos del paso activo */
    .step.active>* {
      animation: fadeUp .5s both cubic-bezier(.2, .8, .2, 1);
    }

    .step.active>*:nth-child(1) {
      animation-delay: .02s;
    }

    .step.active>*:nth-child(2) {
      animation-delay: .08s;
    }

    .step.active>*:nth-child(3) {
      animation-delay: .14s;
    }

    .step.active>*:nth-child(4) {
      animation-delay: .20s;
    }

    .step.active>*:nth-child(5) {
      animation-delay: .26s;
    }

    .step.active>*:nth-child(6) {
      animation-delay: .32s;
    }

    .step.active>*:nth-child(7) {
      animation-delay: .38s;
    }

    .step.active>*:nth-child(8) {
      animation-delay: .44s;
    }

    @keyframes fadeUp {
      from {
        opacity: 0;
        transform: translateY(18px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    .tag {
      display: inline-block;
      font-size: .72rem;
      letter-spacing: .1em;
      text-transform: uppercase;
      color: #04140d;
      background: var(--em);
      padding: 5px 14px;
      border-radius: 30px;
      font-weight: 800;
      margin-bottom: 14px;
      box-shadow: 0 4px 16px rgba(46, 230, 168, .35);
    }

    .tag.tag2 {
      background: var(--sky);
      color: #022030;
      box-shadow: 0 4px 16px rgba(56, 189, 248, .35);
    }

    .tag.tag3 {
      background: var(--fu);
      color: #2b0a24;
      box-shadow: 0 4px 16px rgba(244, 114, 208, .35);
    }

    .tag.tag4 {
      background: var(--am);
      color: #231600;
      box-shadow: 0 4px 16px rgba(251, 191, 36, .35);
    }

    .tag.tag5 {
      background: var(--vi);
      color: #160a2e;
      box-shadow: 0 4px 16px rgba(167, 139, 250, .35);
    }

    h1.step-title {
      font-size: clamp(1.5rem, 3.6vw, 2.15rem);
      margin: 0 0 14px;
      font-weight: 900;
      line-height: 1.2;
    }

    h1.step-title.grad {
      background: var(--grad);
      background-size: 200%;
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
      animation: grad 6s ease infinite;
    }

    p.step-text {
      color: var(--muted);
      font-size: 1.02rem;
      margin: 0 0 18px;
    }

    p.step-text b {
      color: var(--text);
    }

    ul.step-list {
      color: var(--muted);
      font-size: .96rem;
      padding-left: 6px;
      margin: 0 0 18px;
      list-style: none;
    }

    ul.step-list li {
      margin-bottom: 9px;
      padding-left: 26px;
      position: relative;
    }

    ul.step-list li::before {
      content: '▹';
      position: absolute;
      left: 4px;
      color: var(--em);
      font-weight: 900;
    }

    ul.step-list b {
      color: var(--text);
    }

    .box {
      background: linear-gradient(180deg, var(--card), var(--bg-soft));
      border: 1px solid var(--line);
      border-radius: var(--radius);
      padding: 20px 22px;
      margin-bottom: 18px;
      transition: transform .25s, border-color .25s;
    }

    .box:hover {
      border-color: rgba(56, 189, 248, .5);
      transform: translateY(-2px);
    }

    .box h4 {
      margin: 0 0 8px;
      font-size: 1rem;
      color: var(--sky);
    }

    .callout {
      border-left: 4px solid var(--em);
      padding: 14px 18px;
      background: rgba(46, 230, 168, .09);
      border-radius: 0 12px 12px 0;
      font-size: .9rem;
      color: var(--text);
      margin-bottom: 18px;
    }

    .callout.warn {
      border-left-color: var(--am);
      background: rgba(251, 191, 36, .1);
    }

    .callout.ok {
      border-left-color: var(--em);
      background: rgba(46, 230, 168, .12);
    }

    /* desplegable de pistas (taller) */
    details.reveal {
      border: 1px dashed var(--sky);
      border-radius: 10px;
      overflow: hidden;
    }

    details.reveal summary {
      cursor: pointer;
      list-style: none;
      padding: 9px 14px;
      font-size: .85rem;
      font-weight: 700;
      color: var(--sky);
      background: rgba(56, 189, 248, .08);
      user-select: none;
    }

    details.reveal summary::-webkit-details-marker {
      display: none;
    }

    details.reveal summary::before {
      content: '▸ ';
    }

    details.reveal[open] summary::before {
      content: '▾ ';
    }

    details.reveal[open] summary {
      border-bottom: 1px dashed var(--sky);
    }

    details.reveal .reveal-body {
      padding: 12px 14px;
      font-size: .88rem;
      color: var(--text);
      animation: fadeUp .3s ease;
    }

    details.reveal .reveal-body u {
      color: var(--am);
      text-decoration-thickness: 2px;
    }

    /* welcome cards */
    .phase-cards {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 16px;
      margin: 18px 0 8px;
    }

    @media(max-width:680px) {
      .phase-cards {
        grid-template-columns: 1fr;
      }
    }

    .phase-card {
      position: relative;
      background: linear-gradient(180deg, var(--card-2), var(--card));
      border: 1px solid var(--line);
      border-radius: 16px;
      padding: 20px;
      cursor: pointer;
      transition: transform .25s, box-shadow .25s, border-color .25s;
      overflow: hidden;
    }

    .phase-card::before {
      content: '';
      position: absolute;
      inset: 0;
      background: radial-gradient(120px 80px at var(--mx, 50%) var(--my, 0%), rgba(56, 189, 248, .18), transparent 70%);
      opacity: 0;
      transition: opacity .3s;
    }

    .phase-card:hover {
      transform: translateY(-6px) scale(1.02);
      border-color: var(--em);
      box-shadow: 0 16px 40px rgba(0, 0, 0, .4);
    }

    .phase-card:hover::before {
      opacity: 1;
    }

    .phase-card .num {
      font-size: 1.7rem;
      font-weight: 900;
      background: var(--grad);
      background-size: 200%;
      -webkit-background-clip: text;
      background-clip: text;
      color: transparent;
    }

    .phase-card h3 {
      margin: 6px 0 6px;
      font-size: 1.05rem;
    }

    .phase-card p {
      color: var(--muted);
      font-size: .85rem;
      margin: 0;
    }

    /* ER DIAGRAM (SVG, notacion Chen) */
    .er-wrap {
      position: relative;
      background: radial-gradient(circle at 50% 30%, rgba(56, 189, 248, .06), transparent 60%), var(--bg-soft);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      padding: 24px;
    }

    .er-svg {
      width: 100%;
      height: auto;
      display: block;
    }

    .er-svg .conn {
      stroke: var(--sky);
      stroke-width: 2.2;
      stroke-dasharray: 7 7;
      opacity: .7;
      animation: dashFlow 1.1s linear infinite;
    }

    @keyframes dashFlow {
      to {
        stroke-dashoffset: -28;
      }
    }

    .er-svg .card-label text {
      fill: var(--am);
      font-size: 22px;
      font-weight: 900;
      text-anchor: middle;
      dominant-baseline: central;
      paint-order: stroke;
      stroke: #0b0e1a;
      stroke-width: 5px;
      stroke-linejoin: round;
    }

    .er-entity {
      fill: var(--card-2);
      stroke: var(--em);
      stroke-width: 2.5;
      cursor: pointer;
      transition: stroke-width .2s, filter .2s;
    }

    .er-entity:hover {
      filter: drop-shadow(0 0 8px rgba(46, 230, 168, .55));
    }

    .er-entity.active {
      stroke-width: 4;
      filter: drop-shadow(0 0 14px rgba(46, 230, 168, .8));
    }

    .er-entity-label {
      fill: var(--text);
      font-size: 17px;
      font-weight: 800;
      text-anchor: middle;
      pointer-events: none;
    }

    .er-attr {
      fill: var(--bg-soft);
      stroke: var(--sky);
      stroke-width: 2;
    }

    .er-attr-label {
      fill: var(--text);
      font-size: 12.5px;
      text-anchor: middle;
      pointer-events: none;
    }

    .er-attr-key-line {
      stroke: var(--am);
      stroke-width: 1.6;
      animation: keyGlow 2s ease-in-out infinite;
    }

    @keyframes keyGlow {

      0%,
      100% {
        opacity: .5;
      }

      50% {
        opacity: 1;
      }
    }

    .er-rel {
      fill: var(--card-2);
      stroke: var(--fu);
      stroke-width: 2.5;
      cursor: pointer;
      transition: filter .2s;
    }

    .er-rel:hover {
      filter: drop-shadow(0 0 8px rgba(244, 114, 208, .6));
    }

    .er-assoc-wrap {
      cursor: pointer;
      transition: filter .25s ease;
    }

    .er-assoc-wrap:hover {
      filter: drop-shadow(0 0 12px rgba(46, 230, 168, .55));
    }

    .er-assoc-diamond {
      fill: rgba(244, 114, 208, .16) !important;
      stroke: var(--fu);
      stroke-width: 2.2;
    }

    .er-rel-label {
      fill: var(--text);
      font-size: 12px;
      text-anchor: middle;
      pointer-events: none;
      font-weight: 700;
    }

    .er-legend {
      margin-top: 16px;
      font-size: .8rem;
      color: var(--muted);
      display: flex;
      flex-wrap: wrap;
      gap: 16px;
    }

    .er-legend span b {
      color: var(--text);
    }

    .pill {
      display: inline-block;
      padding: 3px 10px;
      border-radius: 7px;
      font-size: .72rem;
      margin-right: 6px;
      margin-top: 5px;
      font-weight: 600;
    }

    .pill.pk {
      background: var(--am);
      color: #231600;
      font-weight: 800;
    }

    .pill.fk {
      background: var(--sky);
      color: #022030;
      font-weight: 800;
    }

    .pill.attr {
      background: var(--line);
      color: var(--text);
    }

    /* SIMBOLOGIA MER */
    .symbol-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 16px;
    }

    @media(max-width:600px) {
      .symbol-grid {
        grid-template-columns: 1fr;
      }
    }

    .symbol-card {
      background: linear-gradient(180deg, var(--card-2), var(--card));
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 18px;
      text-align: center;
      transition: transform .25s, border-color .25s;
    }

    .symbol-card:hover {
      transform: translateY(-5px);
      border-color: var(--sky);
    }

    .shape-demo {
      height: 92px;
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 10px;
    }

    .symbol-card:hover .shape-demo>* {
      animation: wobble .6s ease;
    }

    @keyframes wobble {

      0%,
      100% {
        transform: var(--rot, rotate(0)) translateY(0);
      }

      25% {
        transform: var(--rot, rotate(0)) translateY(-6px);
      }

      75% {
        transform: var(--rot, rotate(0)) translateY(3px);
      }
    }

    .symbol-card h4 {
      margin: 0 0 4px;
      font-size: .92rem;
    }

    .symbol-card p {
      margin: 0;
      color: var(--muted);
      font-size: .78rem;
    }

    .shape-rect {
      width: 120px;
      height: 56px;
      border: 2.5px solid var(--em);
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: .72rem;
      background: var(--bg-soft);
      box-shadow: 0 0 14px rgba(46, 230, 168, .2);
    }

    .shape-rect-weak {
      padding: 5px;
      border: 2.5px solid var(--em);
      border-radius: 8px;
      background: var(--bg-soft);
    }

    .shape-rect-weak .inner {
      border: 2px solid var(--em);
      border-radius: 5px;
      padding: 8px 16px;
      font-size: .7rem;
    }

    .shape-oval {
      width: 126px;
      height: 58px;
      border-radius: 50%;
      border: 2.5px solid var(--sky);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: .72rem;
      background: var(--bg-soft);
      text-align: center;
      padding: 6px;
      box-shadow: 0 0 14px rgba(56, 189, 248, .2);
    }

    .shape-oval.key {
      text-decoration: underline;
      border-color: var(--am);
      font-weight: 700;
      box-shadow: 0 0 14px rgba(251, 191, 36, .25);
    }

    .shape-oval.derived {
      border-style: dashed;
    }

    .shape-oval-multi {
      padding: 5px;
      border-radius: 50%;
      border: 2.5px solid var(--sky);
      background: var(--bg-soft);
    }

    .shape-oval-multi .inner {
      border-radius: 50%;
      border: 2px solid var(--sky);
      padding: 10px 14px;
      font-size: .68rem;
    }

    .shape-diamond {
      --rot: rotate(45deg);
      width: 86px;
      height: 86px;
      background: var(--bg-soft);
      border: 2.5px solid var(--fu);
      transform: rotate(45deg);
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 0 14px rgba(244, 114, 208, .25);
    }

    .shape-diamond span {
      transform: rotate(-45deg);
      font-size: .68rem;
      text-align: center;
    }

    .shape-assoc {
      width: 120px;
      height: 58px;
      border: 2.5px solid var(--em);
      border-radius: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: var(--bg-soft);
      box-shadow: 0 0 14px rgba(46, 230, 168, .2);
      position: relative;
    }

    .shape-assoc .assoc-diamond {
      width: 38px;
      height: 38px;
      border: 2px solid var(--fu);
      background: rgba(244, 114, 208, .12);
      transform: rotate(45deg);
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 0 10px rgba(244, 114, 208, .2);
    }

    .shape-assoc .assoc-diamond span {
      transform: rotate(-45deg);
      font-size: .62rem;
      font-weight: 700;
      color: var(--text);
      text-align: center;
      line-height: 1;
    }

    .shape-line {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: .9rem;
      color: var(--text);
      font-weight: 700;
    }

    .shape-line .ln {
      width: 70px;
      height: 2px;
      background: var(--muted);
      position: relative;
    }

    /* logico transform */
    .transform-btn,
    .run-btn,
    .transform-btn {
      position: relative;
      overflow: hidden;
    }

    .transform-btn {
      background: var(--em);
      color: #04140d;
      border: none;
      padding: 12px 22px;
      border-radius: 30px;
      font-weight: 800;
      cursor: pointer;
      font-size: .92rem;
      transition: transform .2s, box-shadow .2s;
    }

    .transform-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 10px 28px rgba(46, 230, 168, .4);
    }

    .shine {
      position: relative;
      overflow: hidden;
    }

    .shine::after {
      content: '';
      position: absolute;
      top: 0;
      left: -120%;
      width: 60%;
      height: 100%;
      background: linear-gradient(120deg, transparent, rgba(255, 255, 255, .5), transparent);
      transform: skewX(-20deg);
      animation: shine 3s ease-in-out infinite;
    }

    @keyframes shine {
      0% {
        left: -120%;
      }

      60%,
      100% {
        left: 160%;
      }
    }

    .tables-wrap {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
      margin-top: 22px;
    }

    @media(max-width:600px) {
      .tables-wrap {
        grid-template-columns: 1fr;
      }
    }

    /* la demo de FK usa columnas cortas: tablas angostas para que la línea de relación se vea clara */
    .fk-demo .tables-wrap {
      grid-template-columns: repeat(2, minmax(0, 190px));
      justify-content: center;
      gap: 64px;
    }

    @media(max-width:600px) {
      .fk-demo .tables-wrap {
        grid-template-columns: minmax(0, 240px);
        gap: 16px;
        justify-content: center;
      }
    }

    .table-card {
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: 14px;
      overflow: hidden;
      opacity: 0;
      transform: translateY(20px) scale(.94);
      transition: opacity .5s, transform .5s cubic-bezier(.2, 1.4, .4, 1);
    }

    .table-card.show {
      opacity: 1;
      transform: translateY(0) scale(1);
    }

    .table-card .th {
      background: linear-gradient(90deg, var(--sky), var(--fu));
      color: #04140d;
      padding: 10px 12px;
      font-weight: 800;
      font-size: .86rem;
    }

    table {
      width: 100%;
      border-collapse: collapse;
      font-size: .77rem;
    }

    table td {
      padding: 8px 10px;
      border-top: 1px solid var(--line);
      color: var(--muted);
    }

    table td:first-child {
      color: var(--text);
      font-weight: 600;
    }

    .k {
      font-size: .62rem;
      padding: 2px 7px;
      border-radius: 6px;
      margin-left: 6px;
      font-weight: 800;
    }

    .k.pk {
      background: var(--am);
      color: #231600;
    }

    .k.fk {
      background: var(--sky);
      color: #022030;
    }

    /* animación llave foránea: copia volando de PK a FK */
    .fk-demo {
      position: relative;
    }

    .fk-demo #fk-play-btn {
      margin-top: 4px;
    }

    .fk-demo table {
      min-height: 1px;
    }

    .fk-demo .fk-row {
      display: none;
    }

    .fk-demo:not([data-step="0"]) .fk-row {
      display: table-row;
      animation: fadeUp .35s ease;
    }

    .fk-colname {
      font-weight: 600;
      color: var(--text);
    }

    .fk-badge-pk,
    .fk-badge-fk {
      opacity: 0;
      transform: scale(.5);
      transition: opacity .3s ease, transform .3s ease;
      display: inline-block;
    }

    .fk-demo[data-step="2"] .fk-badge-pk,
    .fk-demo[data-step="3"] .fk-badge-pk,
    .fk-demo[data-step="4"] .fk-badge-pk {
      opacity: 1;
      transform: scale(1);
    }

    .fk-dst-row.fk-final .fk-badge-fk {
      opacity: 1;
      transform: scale(1);
    }

    .fk-dst-row td {
      position: relative;
      min-height: 22px;
    }

    .fk-colname:empty::before {
      content: '';
      display: inline-block;
      width: 76px;
      height: 13px;
      border: 1.5px dashed var(--line);
      border-radius: 5px;
      vertical-align: middle;
    }

    .fk-dst-row.fk-final .fk-colname {
      color: var(--sky);
      font-weight: 800;
    }

    td.fk-pulse {
      animation: fkPulse 1.3s ease;
      border-radius: 4px;
    }

    @keyframes fkPulse {
      0% {
        background: rgba(56, 189, 248, .4);
      }

      100% {
        background: transparent;
      }
    }

    .fk-flyer {
      position: absolute;
      z-index: 6;
      top: 0;
      left: 0;
      background: var(--am);
      color: #231600;
      font-weight: 800;
      font-size: .76rem;
      padding: 4px 12px;
      border-radius: 20px;
      box-shadow: 0 8px 22px rgba(251, 191, 36, .5);
      pointer-events: none;
      transition: transform 1s cubic-bezier(.3, .65, .25, 1), opacity .3s ease .8s;
      white-space: nowrap;
    }

    .fk-rel-svg {
      position: absolute;
      left: 0;
      top: 0;
      pointer-events: none;
      z-index: 4;
      opacity: 0;
      transition: opacity .4s ease;
      overflow: visible;
    }

    .fk-demo[data-step="4"] .fk-rel-svg {
      opacity: 1;
    }

    .fk-explain {
      min-height: 42px;
      margin: 14px 0 4px;
      color: var(--muted);
      font-size: .88rem;
      background: var(--card);
      border: 1px solid var(--line);
      border-left: 3px solid var(--sky);
      border-radius: 0 10px 10px 0;
      padding: 10px 14px;
      transition: opacity .2s;
    }

    .fk-explain b {
      color: var(--text);
    }

    /* animación "entidad -> tabla" (Fase 2, paso 1) */
    .et-demo {
      position: relative;
    }

    .et-row {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 20px;
      flex-wrap: wrap;
      margin-top: 6px;
    }

    .et-mer-wrap,
    .et-table-wrap {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 8px;
      width: min(260px, 100%);
    }

    .et-mer-svg {
      width: 100%;
      max-width: 260px;
    }

    .et-label {
      font-size: .7rem;
      color: var(--muted);
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: .06em;
    }

    .et-arrow {
      font-size: 1.8rem;
      color: var(--sky);
      opacity: 0;
      transition: opacity .4s ease;
    }

    .et-table-wrap {
      opacity: 0;
      transition: opacity .4s ease;
    }

    .et-table-wrap .table-card {
      width: 100%;
    }

    .et-demo:not([data-step="0"]) .et-arrow,
    .et-demo:not([data-step="0"]) .et-table-wrap {
      opacity: 1;
    }

    .et-demo #et-play-btn {
      margin-top: 16px;
    }

    /* animación "llave -> PK" (Fase 2, paso 2): reutiliza el layout et-row/et-mer-wrap/et-table-wrap */
    .pk-demo {
      position: relative;
    }

    .pk-demo .et-arrow,
    .pk-demo .et-table-wrap {
      opacity: 1;
    }

    .pk-demo #pk-play-btn {
      margin-top: 16px;
    }

    .pk-demo #pk-play-btn:disabled {
      opacity: .6;
      cursor: not-allowed;
    }

    .pk-badge {
      opacity: 0;
      transform: scale(.4);
      transition: opacity .3s ease, transform .3s ease;
      display: inline-block;
    }

    .pk-demo[data-step="1"] .pk-badge {
      opacity: 1;
      transform: scale(1);
    }

    .pk-flyer {
      position: absolute;
      left: 0;
      top: 0;
      height: 4px;
      background: var(--am);
      border-radius: 2px;
      box-shadow: 0 4px 14px rgba(251, 191, 36, .5);
      pointer-events: none;
      z-index: 6;
      transition: left 1s cubic-bezier(.3, .65, .25, 1), top 1s cubic-bezier(.3, .65, .25, 1), width 1s cubic-bezier(.3, .65, .25, 1), height 1s cubic-bezier(.3, .65, .25, 1), border-radius .6s ease;
    }

    .pk-flyer.pk-flyer-morph {
      height: 20px;
      border-radius: 6px;
    }

    td.dup {
      animation: dupPulse 2s ease-in-out infinite;
      border-radius: 4px;
    }

    @keyframes dupPulse {

      0%,
      100% {
        background: transparent;
      }

      50% {
        background: rgba(251, 191, 36, .22);
      }
    }

    /* animación interactiva N:M (Fase 2, paso 4) */
    .nm-anim-demo {
      position: relative;
    }

    .nm-anim-demo #nm-play-btn {
      margin-top: 16px;
    }

    .nm-anim-demo #nm-play-btn:disabled {
      opacity: .6;
      cursor: not-allowed;
    }

    .nm-mer-card-wrap {
      display: flex;
      justify-content: center;
      margin-bottom: 14px;
    }

    .nm-mer-svg {
      width: 100%;
      max-width: 440px;
    }

    .nm-cross {
      opacity: 0;
      transition: opacity .4s ease, transform .4s ease;
      transform: scale(.5) rotate(-10deg);
      transform-origin: center;
    }

    .nm-anim-demo[data-step="1.5"] .nm-cross,
    .nm-anim-demo[data-step="2"] .nm-cross,
    .nm-anim-demo[data-step="3"] .nm-cross {
      opacity: 1;
      transform: scale(1) rotate(0deg);
    }

    .nm-mr-wrap {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      gap: 20px;
      flex-wrap: nowrap;
      opacity: 0;
      transition: opacity .5s ease;
      min-height: 160px;
      margin-top: 10px;
    }

    .nm-anim-demo:not([data-step="0"]) .nm-mr-wrap {
      opacity: 1;
    }

    .nm-mr-slot {
      width: min(230px, 31%);
      min-height: 140px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .nm-mr-slot .table-card {
      width: 100%;
      opacity: 0;
      transform: translateY(14px) scale(.95);
      transition: opacity .4s ease, transform .4s ease;
    }

    .nm-anim-demo:not([data-step="0"]) .nm-mr-slot-outer .table-card {
      opacity: 1;
      transform: translateY(0) scale(1);
    }

    .nm-anim-demo[data-step="2"] .nm-mr-slot-mid .table-card,
    .nm-anim-demo[data-step="3"] .nm-mr-slot-mid .table-card {
      opacity: 1;
      transform: translateY(0) scale(1);
    }

    .nm-morph-flyer {
      position: absolute;
      z-index: 12;
      background: linear-gradient(135deg, #f43f5e, #be123c);
      color: #fff;
      font-weight: 800;
      font-size: .82rem;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 10px 30px rgba(244, 63, 94, .6), 0 0 18px rgba(244, 63, 94, .4);
      border: 2px solid #fda4af;
      pointer-events: none;
      clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
      transition: left 1.1s cubic-bezier(.35, .68, .25, 1), top 1.1s cubic-bezier(.35, .68, .25, 1), width 1.1s cubic-bezier(.35, .68, .25, 1), height 1.1s cubic-bezier(.35, .68, .25, 1), clip-path .8s ease .2s, border-radius .8s ease .2s, background .8s ease .2s, opacity .3s ease 1s;
    }

    .nm-morph-flyer.nm-morphing {
      clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
      border-radius: 12px;
      background: linear-gradient(135deg, rgba(251, 113, 133, .95), rgba(251, 191, 36, .95));
    }

    .nm-rel-svg {
      position: absolute;
      left: 0;
      top: 0;
      pointer-events: none;
      z-index: 4;
      opacity: 0;
      transition: opacity .4s ease;
      overflow: visible;
    }

    .nm-anim-demo[data-step="3"] .nm-rel-svg {
      opacity: 1;
    }

    /* normalizacion */
    .norm-tables {
      display: flex;
      flex-direction: column;
      gap: 14px;
    }

    .norm-table-card {
      background: var(--bg-soft);
      border: 1px solid var(--line);
      border-radius: 14px;
      overflow: hidden;
    }

    .norm-table-card .th {
      background: linear-gradient(90deg, var(--em), var(--sky));
      color: #04140d;
      padding: 9px 12px;
      font-weight: 800;
      font-size: .82rem;
    }

    .norm-table-card table {
      font-size: .74rem;
    }

    .norm-table-card td {
      padding: 7px 9px;
    }

    .norm-table-card th {
      text-align: left;
      padding: 7px 9px;
      color: var(--sky);
      font-weight: 800;
      font-size: .72rem;
      border-bottom: 1px solid var(--line);
    }

    /* Modelo Relacional responsivo en Normalización (2FN / 3FN) */
    .norm-mr-container {
      margin: 16px 0;
    }

    .norm-rel-banner {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
      background: var(--bg-soft);
      border: 1px solid var(--line);
      border-radius: 10px;
      padding: 10px 14px;
      margin-bottom: 14px;
      font-size: .82rem;
      flex-wrap: wrap;
    }

    .norm-rel-chip {
      display: flex;
      align-items: center;
      gap: 6px;
      background: var(--card);
      border: 1px solid var(--line);
      padding: 5px 12px;
      border-radius: 16px;
      font-weight: 700;
      color: var(--sky);
      font-size: .76rem;
    }

    .norm-rel-chip b {
      color: var(--am);
    }

    .norm-mr-layout {
      display: flex;
      flex-wrap: nowrap;
      gap: 12px;
      justify-content: space-between;
      align-items: stretch;
    }

    @media(max-width:768px) {
      .norm-mr-layout {
        flex-wrap: wrap;
      }
    }

    .norm-mr-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 16px;
      width: 100%;
    }

    .norm-mr-grid .norm-mr-card {
      min-width: 0;
    }

    @media(max-width:680px) {
      .norm-mr-grid {
        grid-template-columns: 1fr;
      }
    }

    .norm-mr-card {
      flex: 1 1 0;
      min-width: 180px;
      background: var(--bg-soft);
      border: 1px solid var(--line);
      border-radius: 12px;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
      transition: transform .2s, border-color .2s;
    }

    .norm-mr-card:hover {
      transform: translateY(-3px);
      border-color: var(--sky);
    }

    .norm-mr-card .th {
      padding: 10px 12px;
      font-weight: 800;
      font-size: .82rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .norm-mr-card table {
      font-size: .78rem;
      width: 100%;
      border-collapse: collapse;
    }

    .norm-mr-card th {
      text-align: left;
      padding: 8px 10px;
      color: var(--sky);
      font-weight: 800;
      font-size: .72rem;
      border-bottom: 1px solid var(--line);
      background: rgba(0, 0, 0, .2);
    }

    .norm-mr-card td {
      padding: 8px 10px;
      border-bottom: 1px solid rgba(255, 255, 255, .04);
      white-space: nowrap;
    }

    .norm-mr-card td code {
      font-size: .68rem;
      color: var(--am);
    }

    /* fisico */
    .tabs {
      display: flex;
      gap: 8px;
      margin-bottom: 14px;
      flex-wrap: wrap;
    }

    .tab-btn {
      background: transparent;
      border: 1px solid var(--line);
      color: var(--muted);
      padding: 8px 16px;
      border-radius: 24px;
      cursor: pointer;
      font-size: .83rem;
      transition: .2s;
    }

    .tab-btn:hover {
      border-color: var(--fu);
      color: var(--text);
    }

    .tab-btn.active {
      background: var(--fu);
      color: #2b0a24;
      border-color: var(--fu);
      font-weight: 800;
    }

    .code-box {
      background: #080a14;
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 20px;
      font-family: 'Consolas', 'Courier New', monospace;
      font-size: .82rem;
      color: #c9d1d9;
      overflow-x: auto;
      white-space: pre;
      line-height: 1.75;
      box-shadow: inset 0 0 40px rgba(56, 189, 248, .05);
    }

    .code-box code {
      background: none;
      padding: 0;
      color: inherit;
    }

    .code-box .kw {
      color: var(--fu);
      font-weight: 600;
    }

    .code-box .type {
      color: var(--sky);
    }

    .code-box .str {
      color: var(--em);
    }

    .code-box .com {
      color: #6b7280;
      font-style: italic;
    }

    .run-btn {
      margin-top: 12px;
      background: var(--sky);
      color: #022030;
      border: none;
      padding: 10px 20px;
      border-radius: 10px;
      font-weight: 800;
      cursor: pointer;
      transition: transform .2s, box-shadow .2s;
    }

    .run-btn:hover {
      transform: translateY(-2px);
      box-shadow: 0 10px 24px rgba(56, 189, 248, .35);
    }

    .result-box {
      margin-top: 12px;
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: 12px;
      padding: 14px;
      font-size: .83rem;
      display: none;
    }

    .result-box.show {
      display: block;
      animation: fadeUp .45s ease;
    }

    .result-box th {
      text-align: left;
      padding: 7px 9px;
      color: var(--sky);
      border-bottom: 1px solid var(--line);
      font-size: .77rem;
    }

    .result-box td {
      padding: 7px 9px;
    }

    .result-box tr {
      opacity: 0;
      animation: rowIn .4s forwards;
    }

    .result-box tr:nth-child(2) {
      animation-delay: .15s;
    }

    .result-box tr:nth-child(3) {
      animation-delay: .3s;
    }

    @keyframes rowIn {
      from {
        opacity: 0;
        transform: translateX(-10px);
      }

      to {
        opacity: 1;
        transform: translateX(0);
      }
    }

    /* quiz */
    .quiz-card {
      background: linear-gradient(180deg, var(--card-2), var(--card));
      border: 1px solid var(--line);
      border-radius: var(--radius);
      padding: 22px;
      margin-bottom: 14px;
    }

    .quiz-card p.q {
      font-weight: 800;
      margin: 0 0 12px;
    }

    .opt {
      display: block;
      width: 100%;
      text-align: left;
      background: var(--bg-soft);
      border: 1px solid var(--line);
      color: var(--text);
      padding: 11px 15px;
      border-radius: 10px;
      margin-bottom: 8px;
      cursor: pointer;
      font-size: .88rem;
      transition: .18s;
    }

    .opt:hover {
      border-color: var(--sky);
      transform: translateX(4px);
    }

    .opt.correct {
      background: rgba(46, 230, 168, .18);
      border-color: var(--em);
    }

    .opt.wrong {
      background: rgba(251, 113, 133, .15);
      border-color: var(--co);
      animation: shake .4s;
    }

    @keyframes shake {

      0%,
      100% {
        transform: translateX(0);
      }

      20% {
        transform: translateX(-8px);
      }

      40% {
        transform: translateX(8px);
      }

      60% {
        transform: translateX(-5px);
      }

      80% {
        transform: translateX(5px);
      }
    }

    .quiz-score {
      text-align: center;
      color: var(--muted);
      margin-top: 8px;
      font-size: .9rem;
      font-weight: 700;
    }

    .quiz-celebrate {
      display: none;
      text-align: center;
      margin-top: 16px;
      padding: 22px;
      border-radius: 16px;
      background: linear-gradient(135deg, rgba(46, 230, 168, .15), rgba(244, 114, 208, .15));
      border: 1px solid var(--em);
    }

    .quiz-celebrate.show {
      display: block;
      animation: fadeUp .5s ease;
    }

    .quiz-celebrate h3 {
      margin: 0 0 6px;
      font-size: 1.3rem;
    }

    /* nav footer */
    .stepnav {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 36px;
      padding-top: 20px;
      border-top: 1px solid var(--line);
    }

    .navbtn {
      background: var(--card);
      border: 1px solid var(--line);
      color: var(--text);
      padding: 12px 22px;
      border-radius: 12px;
      cursor: pointer;
      font-size: .9rem;
      font-weight: 800;
      transition: all .2s;
    }

    .navbtn:hover:not(:disabled) {
      border-color: var(--em);
      transform: translateY(-2px);
    }

    .navbtn:disabled {
      opacity: .35;
      cursor: not-allowed;
    }

    .navbtn.primary {
      background: var(--em);
      color: #04140d;
      border-color: var(--em);
      box-shadow: 0 6px 20px rgba(46, 230, 168, .3);
    }

    .navbtn.primary:hover:not(:disabled) {
      box-shadow: 0 10px 28px rgba(46, 230, 168, .45);
    }

    .step-of {
      color: var(--muted);
      font-size: .82rem;
    }

    .kbd-hint {
      text-align: center;
      color: var(--muted);
      font-size: .72rem;
      margin-top: 10px;
      opacity: .7;
    }

    .kbd {
      display: inline-block;
      border: 1px solid var(--line);
      border-bottom-width: 2px;
      border-radius: 5px;
      padding: 1px 6px;
      font-size: .7rem;
      background: var(--bg-soft);
    }

    footer.credits {
      text-align: center;
      padding: 28px 20px 40px;
      color: var(--muted);
      font-size: .8rem;
    }

    footer.credits p {
      margin: 4px 0;
    }

    footer.credits .author {
      color: var(--text);
      font-size: .9rem;
      margin-top: 8px;
    }

    footer.credits .author b {
      color: var(--em);
    }

    /* video cards */
    .video-card {
      display: flex;
      align-items: center;
      gap: 14px;
      text-decoration: none;
      background: linear-gradient(90deg, rgba(251, 113, 133, .10), rgba(56, 189, 248, .07));
      border: 1px solid var(--line);
      border-left: 4px solid var(--co);
      border-radius: 14px;
      padding: 14px 16px;
      margin: 6px 0 18px;
      transition: transform .2s, border-color .2s, box-shadow .2s;
    }

    .video-card:hover {
      transform: translateY(-3px);
      box-shadow: 0 12px 28px rgba(0, 0, 0, .35);
    }

    .video-card .vplay {
      flex-shrink: 0;
      width: 46px;
      height: 46px;
      border-radius: 50%;
      background: #ff0033;
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.05rem;
      padding-left: 3px;
      animation: vpulse 2s infinite;
    }

    @keyframes vpulse {
      0% {
        box-shadow: 0 0 0 0 rgba(255, 0, 51, .45);
      }

      70% {
        box-shadow: 0 0 0 13px rgba(255, 0, 51, 0);
      }

      100% {
        box-shadow: 0 0 0 0 rgba(255, 0, 51, 0);
      }
    }

    .video-card .vinfo {
      display: flex;
      flex-direction: column;
      min-width: 0;
    }

    .video-card .vinfo b {
      color: var(--text);
      font-size: .9rem;
    }

    .video-card .vinfo small {
      color: var(--muted);
      font-size: .79rem;
    }

    .video-card .vyt {
      margin-left: auto;
      flex-shrink: 0;
      color: var(--co);
      font-size: .74rem;
      font-weight: 800;
      white-space: nowrap;
    }

    @media(max-width:520px) {
      .video-card .vyt {
        display: none;
      }
    }

    /* video embebido en su propia sección */
    .video-embed-wrap {
      position: relative;
      width: 100%;
      padding-top: 56.25%;
      border-radius: 16px;
      overflow: hidden;
      background: #000;
      border: 1px solid var(--line);
      margin-bottom: 18px;
      box-shadow: 0 14px 34px rgba(0, 0, 0, .4);
    }

    .video-embed-wrap iframe {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      border: 0;
    }

    /* N:M diagram (tabla intermedia) */
    .nm-diagram {
      display: grid;
      grid-template-columns: 1fr auto 1.25fr auto 1fr;
      align-items: center;
      gap: 10px;
      margin: 20px 0;
    }

    .nm-card {
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: 14px;
      overflow: hidden;
    }

    .nm-junction {
      border: 1.5px solid var(--fu);
      box-shadow: 0 0 26px rgba(244, 114, 208, .28);
    }

    .nm-card .th {
      background: linear-gradient(90deg, var(--em), var(--sky));
      color: #04140d;
      padding: 9px 12px;
      font-weight: 800;
      font-size: .8rem;
    }

    .nm-junction .th {
      background: linear-gradient(90deg, var(--fu), var(--vi));
      color: #160a2e;
    }

    .nm-card .th small {
      font-weight: 600;
      opacity: .85;
    }

    .nm-card table {
      font-size: .72rem;
    }

    .nm-card td {
      padding: 6px 9px;
    }

    .nm-link {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      color: var(--fu);
      font-weight: 900;
      font-size: 1rem;
    }

    .nm-link .nm-arrow {
      width: 42px;
      border-top: 2.5px dashed var(--fu);
      animation: keyGlow 1.5s ease-in-out infinite;
    }

    @media(max-width:640px) {
      .nm-diagram {
        grid-template-columns: 1fr;
        justify-items: center;
      }

      .nm-card {
        width: 100%;
        max-width: 340px;
      }

      .nm-link {
        flex-direction: row;
      }

      .nm-link .nm-arrow {
        width: 0;
        height: 26px;
        border-top: none;
        border-left: 2.5px dashed var(--fu);
      }
    }

    /* Botón flotante (FAB) para abrir la Pizarra */
    #fab-pizarra {
      position: fixed;
      right: 22px;
      bottom: 22px;
      z-index: 1200;
      display: flex;
      align-items: center;
      gap: 10px;
      background: var(--grad);
      background-size: 200%;
      color: #04140d;
      border: none;
      border-radius: 40px;
      padding: 14px 22px;
      font-size: .95rem;
      font-weight: 800;
      cursor: pointer;
      font-family: inherit;
      box-shadow: 0 10px 30px rgba(46, 230, 168, .4);
      animation: grad 6s ease infinite, fabIn .5s ease .4s both;
      transition: transform .2s, box-shadow .2s;
    }

    #fab-pizarra:hover {
      transform: translateY(-3px) scale(1.04);
      box-shadow: 0 16px 40px rgba(46, 230, 168, .55);
    }

    #fab-pizarra .fab-ic {
      font-size: 1.25rem;
      line-height: 1;
    }

    #fab-pizarra .fab-pulse {
      position: absolute;
      inset: 0;
      border-radius: 40px;
      box-shadow: 0 0 0 0 rgba(46, 230, 168, .5);
      animation: fabPulse 2.4s infinite;
      pointer-events: none;
    }

    @keyframes fabPulse {
      0% {
        box-shadow: 0 0 0 0 rgba(46, 230, 168, .45);
      }

      70% {
        box-shadow: 0 0 0 16px rgba(46, 230, 168, 0);
      }

      100% {
        box-shadow: 0 0 0 0 rgba(46, 230, 168, 0);
      }
    }

    @keyframes fabIn {
      from {
        opacity: 0;
        transform: translateY(20px) scale(.8);
      }

      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    @media(max-width:600px) {
      #fab-pizarra {
        right: 16px;
        bottom: 16px;
        padding: 13px 18px;
        font-size: .88rem;
      }

      #fab-pizarra .fab-txt {
        display: none;
      }
    }

    /* confeti */
    .confetti {
      position: fixed;
      top: -12px;
      width: 10px;
      height: 14px;
      z-index: 2000;
      pointer-events: none;
      border-radius: 2px;
    }

    @media (prefers-reduced-motion: reduce) {
      * {
        animation-duration: .001s !important;
        animation-iteration-count: 1 !important;
      }

      #bg-blobs span {
        animation: none;
      }
    }
    /* ========================================================
       STAGE SWITCHER & MULTI-PAGE NAVIGATION
       ======================================================== */
    .stage-nav {
      display: flex;
      gap: 8px;
      align-items: center;
      margin-left: 18px;
    }

    .stage-link {
      text-decoration: none;
      color: var(--muted);
      padding: 6px 14px;
      border-radius: 999px;
      font-size: .8rem;
      font-weight: 600;
      border: 1px solid var(--line);
      background: rgba(255, 255, 255, .03);
      transition: all .2s ease;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      white-space: nowrap;
    }

    .stage-link:hover {
      color: var(--text);
      background: rgba(255, 255, 255, .08);
      border-color: var(--sky);
      transform: translateY(-1px);
    }

    .stage-link.active {
      color: #0b0e1a;
      background: linear-gradient(90deg, var(--em), var(--sky));
      border-color: transparent;
      font-weight: 800;
      box-shadow: 0 0 16px rgba(56, 189, 248, .35);
    }

    @media (max-width: 980px) {
      .stage-nav {
        display: none;
      }
    }

    .sidebar-stages-block {
      padding: 12px 14px;
      margin-bottom: 12px;
      background: rgba(24, 29, 51, .75);
      border: 1px solid var(--line);
      border-radius: 12px;
    }

    .sidebar-stages-title {
      font-size: .72rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: .08em;
      color: var(--muted);
      margin-bottom: 8px;
    }

    .stage-sidebar-link {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 10px;
      border-radius: 8px;
      text-decoration: none;
      color: var(--muted);
      font-size: .83rem;
      font-weight: 600;
      transition: all .2s ease;
      margin-bottom: 4px;
    }

    .stage-sidebar-link:hover {
      color: var(--text);
      background: rgba(255, 255, 255, .05);
    }

    .stage-sidebar-link.active {
      background: rgba(56, 189, 248, .12);
      color: var(--sky);
      border-left: 3px solid var(--sky);
      font-weight: 700;
    }

    .stage-sidebar-link .s-num {
      width: 20px;
      height: 20px;
      border-radius: 6px;
      background: var(--card-2);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: .7rem;
      font-weight: 800;
      color: var(--muted);
    }

    .stage-sidebar-link.active .s-num {
      background: var(--sky);
      color: #0b0e1a;
    }

    /* ========================================================
       RESILIENT VIDEO PLAYER (PREVENTS ERROR 153)
       ======================================================== */
    .video-player-container {
      margin-bottom: 18px;
      width: 100%;
    }

    .video-preview-hero {
      position: relative;
      width: 100%;
      aspect-ratio: 16/9;
      border-radius: 16px;
      overflow: hidden;
      background-color: #060913;
      background-size: cover;
      background-position: center;
      border: 1px solid var(--line);
      box-shadow: 0 16px 36px rgba(0, 0, 0, .55);
    }

    .video-hero-overlay {
      position: absolute;
      inset: 0;
      background: linear-gradient(180deg, rgba(11, 14, 26, 0.45) 0%, rgba(11, 14, 26, 0.94) 90%);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 24px;
      text-align: center;
      z-index: 2;
    }

    .video-badge-pill {
      display: inline-flex;
      align-items: center;
      padding: 5px 14px;
      background: rgba(15, 23, 42, .85);
      border: 1px solid rgba(255, 255, 255, .15);
      border-radius: 999px;
      font-size: .75rem;
      font-weight: 700;
      color: var(--am);
      margin-bottom: 14px;
      backdrop-filter: blur(8px);
    }

    .video-hero-play {
      width: 68px;
      height: 68px;
      border-radius: 50%;
      background: #ff0000;
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.6rem;
      text-decoration: none;
      box-shadow: 0 0 0 10px rgba(255, 0, 0, .25), 0 12px 28px rgba(0, 0, 0, .6);
      transition: all .25s ease;
      cursor: pointer;
      margin-bottom: 14px;
    }

    .video-hero-play:hover {
      transform: scale(1.12);
      box-shadow: 0 0 0 16px rgba(255, 0, 0, .35), 0 16px 36px rgba(255, 0, 0, .45);
    }

    .video-hero-play span {
      margin-left: 4px;
    }

    .video-hero-title {
      font-size: 1.25rem;
      font-weight: 800;
      color: #fff;
      margin-bottom: 6px;
      text-shadow: 0 2px 10px rgba(0, 0, 0, .8);
    }

    .video-hero-sub {
      font-size: .86rem;
      color: var(--muted);
      max-width: 480px;
      margin-bottom: 16px;
      line-height: 1.4;
    }

    .video-actions-row {
      display: flex;
      gap: 12px;
      flex-wrap: wrap;
      justify-content: center;
    }

    .btn-yt-primary {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 10px 22px;
      background: #ff0000;
      color: #fff !important;
      font-weight: 700;
      font-size: .88rem;
      border-radius: 999px;
      text-decoration: none;
      box-shadow: 0 4px 16px rgba(255, 0, 0, .4);
      transition: all .2s ease;
    }

    .btn-yt-primary:hover {
      background: #e60000;
      transform: translateY(-1px);
      box-shadow: 0 6px 20px rgba(255, 0, 0, .55);
    }

    .btn-yt-secondary {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 10px 18px;
      background: rgba(255, 255, 255, .08);
      border: 1px solid var(--line);
      color: var(--text);
      font-weight: 600;
      font-size: .84rem;
      border-radius: 999px;
      cursor: pointer;
      transition: all .2s ease;
    }

    .btn-yt-secondary:hover {
      background: rgba(255, 255, 255, .15);
      border-color: var(--sky);
    }

    .local-file-notice {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      padding: 12px 16px;
      background: rgba(251, 191, 36, .08);
      border: 1px solid rgba(251, 191, 36, .35);
      border-radius: 12px;
      font-size: .84rem;
      color: #fde68a;
      margin-bottom: 14px;
      line-height: 1.45;
    }

    .local-file-notice b {
      color: var(--am);
    }

    /* Mejora en la cuadrícula de símbolos MER para 5 tarjetas */
    .symbol-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)) !important;
      gap: 16px;
    }

    /* DIAGRAMA MR INTERACTIVO (SVG) */
    .mr-filter-bar {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      margin-bottom: 14px;
    }

    .mr-btn-filter {
      background: var(--card);
      border: 1px solid var(--line);
      color: var(--muted);
      padding: 6px 14px;
      border-radius: 20px;
      font-size: .82rem;
      font-weight: 700;
      cursor: pointer;
      transition: all .2s ease;
    }

    .mr-btn-filter:hover {
      border-color: var(--sky);
      color: var(--text);
    }

    .mr-btn-filter.active {
      background: rgba(56, 189, 248, .18);
      border-color: var(--sky);
      color: var(--sky);
      box-shadow: 0 0 12px rgba(56, 189, 248, .3);
    }

    .mr-svg-table {
      cursor: pointer;
      transition: transform .25s ease, filter .25s ease, opacity .25s ease;
    }

    .mr-svg-table:hover {
      filter: drop-shadow(0 0 14px rgba(56, 189, 248, .55));
    }

    .mr-dimmed {
      opacity: 0.22 !important;
      transition: opacity .3s ease, filter .3s ease;
    }

    .mr-highlight {
      opacity: 1 !important;
      filter: drop-shadow(0 0 16px rgba(46, 230, 168, .7)) !important;
      transition: opacity .3s ease, filter .3s ease;
    }

    .mr-info-card {
      background: linear-gradient(180deg, var(--card-2), var(--card));
      border: 1px solid var(--line);
      border-radius: 14px;
      padding: 16px 20px;
      margin-top: 14px;
      animation: fadeUp .3s ease;
    }

    .mr-info-card h4 {
      margin: 0 0 6px;
      font-size: .98rem;
      color: var(--sky);
    }

    .mr-info-card p {
      margin: 0;
      color: var(--text);
      font-size: .88rem;
      line-height: 1.55;
    }

    /* ANIMACIONES DEL CAPITULO DE NORMALIZACION */
    .anom-btn-bar {
      display: flex;
      flex-wrap: wrap;
      gap: 10px;
      margin-bottom: 14px;
    }

    .anom-btn {
      padding: 8px 16px;
      border-radius: 20px;
      font-size: .84rem;
      font-weight: 700;
      border: 1px solid var(--line);
      background: var(--card);
      color: var(--text);
      cursor: pointer;
      transition: all .2s ease;
    }

    .anom-btn:hover {
      border-color: var(--sky);
      transform: translateY(-2px);
    }

    .anom-btn.active {
      background: rgba(244, 63, 94, .18);
      border-color: #f43f5e;
      color: #f43f5e;
      box-shadow: 0 0 12px rgba(244, 63, 94, .3);
    }

    .anom-banner-alert {
      padding: 12px 16px;
      border-radius: 10px;
      margin-top: 12px;
      font-size: .88rem;
      line-height: 1.5;
      animation: fadeUp .3s ease;
    }

    .anom-banner-alert.error {
      background: rgba(244, 63, 94, .12);
      border: 1px solid #f43f5e;
      color: #fecdd3;
    }

    .anom-banner-alert.warn {
      background: rgba(251, 191, 36, .12);
      border: 1px solid var(--am);
      color: #fde68a;
    }

    .anom-banner-alert.info {
      background: rgba(56, 189, 248, .12);
      border: 1px solid var(--sky);
      color: #bae6fd;
    }

    .row-shake {
      animation: shakeRow .45s ease-in-out infinite alternate;
      background: rgba(244, 63, 94, .25) !important;
    }

    @keyframes shakeRow {
      0% { transform: translateX(0); }
      25% { transform: translateX(-4px); }
      75% { transform: translateX(4px); }
      100% { transform: translateX(0); }
    }

    .row-fade-delete {
      animation: fadeDelete .6s forwards;
    }

    @keyframes fadeDelete {
      to {
        opacity: 0.15;
        filter: grayscale(1);
        text-decoration: line-through;
      }
    }

    .cell-highlight-bad {
      background: rgba(244, 63, 94, .35) !important;
      color: #fff !important;
      font-weight: 800;
      animation: pulseCell 1s infinite alternate;
    }

    .cell-highlight-good {
      background: rgba(46, 230, 168, .35) !important;
      color: #fff !important;
      font-weight: 800;
    }

    @keyframes pulseCell {
      from { box-shadow: 0 0 4px rgba(244, 63, 94, .4); }
      to { box-shadow: 0 0 14px rgba(244, 63, 94, .8); }
    }

    /* Animación 1FN: Desglose atómico */
    .atom-demo-wrap {
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      padding: 20px;
      margin: 16px 0;
    }

    .atom-table {
      width: 100%;
      border-collapse: collapse;
      margin: 10px 0;
    }

    .atom-split-cell {
      border: 2px dashed var(--am);
      border-radius: 6px;
      padding: 6px 10px;
      background: rgba(251, 191, 36, .1);
      display: inline-block;
      transition: all .4s ease;
    }

    .atom-split-cell.splitting {
      transform: scale(1.05);
      border-color: var(--em);
      background: rgba(46, 230, 168, .2);
    }

    /* Normalización Interactiva: Estilos para 1FN, 2FN y 3FN */
    .norm-sim-box {
      background: var(--card);
      border: 1px solid var(--line);
      border-radius: var(--radius);
      padding: 22px;
      margin: 18px 0;
      position: relative;
    }

    .norm-sim-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 14px;
      flex-wrap: wrap;
      gap: 10px;
    }

    .norm-step-badge {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-size: .8rem;
      font-weight: 800;
      padding: 5px 12px;
      border-radius: 20px;
      background: rgba(56, 189, 248, .12);
      border: 1px solid var(--sky);
      color: var(--sky);
    }

    .norm-interactive-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
      gap: 16px;
      margin: 14px 0;
    }

    .norm-anim-card {
      background: var(--bg);
      border: 1px solid var(--line);
      border-radius: 10px;
      overflow: hidden;
      transition: all .4s cubic-bezier(.4, 0, .2, 1);
    }

    .norm-anim-card.highlight-target {
      border-color: var(--em);
      box-shadow: 0 0 18px rgba(46, 230, 168, .25);
      transform: translateY(-3px);
    }

    .norm-anim-card.extracted {
      animation: extractPop .5s cubic-bezier(.175, .885, .32, 1.275) forwards;
      border-color: var(--sky);
    }

    @keyframes extractPop {
      0% { opacity: 0; transform: scale(.92) translateY(12px); }
      100% { opacity: 1; transform: scale(1) translateY(0); }
    }

    /* Diagrama de Dependencia Transitiva / Parcial */
    .dep-flow-bar {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 10px;
      padding: 14px;
      background: rgba(11, 14, 26, .85);
      border-radius: 10px;
      border: 1px solid var(--line);
      margin: 12px 0 16px;
      flex-wrap: wrap;
    }

    .dep-node {
      padding: 8px 14px;
      border-radius: 8px;
      font-weight: 700;
      font-size: .86rem;
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }

    .dep-node.pk {
      background: rgba(251, 191, 36, .18);
      border: 1.5px solid var(--am);
      color: #fde68a;
    }

    .dep-node.fk {
      background: rgba(56, 189, 248, .18);
      border: 1.5px solid var(--sky);
      color: #bae6fd;
    }

    .dep-node.transitive {
      background: rgba(244, 63, 94, .18);
      border: 1.5px dashed #f43f5e;
      color: #fecdd3;
      animation: pulseCell 1.2s infinite alternate;
    }

    .dep-node.resolved {
      background: rgba(46, 230, 168, .18);
      border: 1.5px solid var(--em);
      color: #a7f3d0;
    }

    .dep-arrow {
      font-size: 1.2rem;
      font-weight: 900;
      color: var(--txt3);
    }

    .dep-arrow.broken {
      color: #f43f5e;
      text-decoration: line-through;
    }

    .dep-arrow.direct {
      color: var(--em);
    }


