/* Simulador "Inversión de giro con enclavamiento" (Ejemplo 4, publicación 140). Prefijo ej4- */
.ej4 { background: #fff; color: #0b1f33; border: 1px solid #cfdae6; border-radius: 8px; padding: 16px; margin: 26px 0; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ej4 * { box-sizing: border-box; }
.ej4-head { display: flex; flex-direction: column; gap: 2px; }
.ej4-head strong { font-size: 1.1rem; color: #0b1f33; }
.ej4-head span { color: #4a5d70; font-size: .92rem; line-height: 1.5; }
.ej4 button, .ej4 select { font: inherit; font-weight: 600; font-size: .9rem; padding: 9px 12px; border-radius: 4px; border: 1px solid #0b1f33; background: #0b1f33; color: #fff; cursor: pointer; min-height: 42px; line-height: 1.25; }
.ej4 select { background: #fff; color: #0b1f33; font-weight: 500; }
.ej4 button.ghost { background: transparent; color: #0b1f33; }
.ej4 button:disabled { opacity: .45; cursor: not-allowed; }
.ej4 [hidden] { display: none !important; }
.ej4 button:focus-visible, .ej4 input:focus-visible, .ej4 select:focus-visible, .ej4 summary:focus-visible { outline: 3px solid #e0731a; outline-offset: 2px; }
.ej4-esc { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 760px) { .ej4-esc { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ej4-esc button { background: #eef2f6; color: #0b1f33; border-color: #cfdae6; font-size: .84rem; }
.ej4-esc button[aria-pressed="true"] { background: #0b1f33; color: #fff; border-color: #0b1f33; }
.ej4-now { border: 1px solid #cfdae6; border-left: 5px solid #e0731a; border-radius: 4px; background: #fff7ef; color: #0b1f33; padding: 10px 14px; }
.ej4-ct { font-weight: 700; color: #7a3d08; text-transform: uppercase; letter-spacing: .04em; font-size: .78rem; margin-bottom: 6px; }
.ej4-now-main { margin: 0; font-size: 1rem; line-height: 1.55; font-weight: 600; color: #0b1f33; min-height: 3.1em; }
.ej4-now-last { margin: 6px 0 0; font-size: .84rem; color: #4a5d70; min-height: 1.2em; }
.ej4-demo { display: flex; flex-direction: column; gap: 8px; }
.ej4-btns { display: flex; flex-wrap: wrap; gap: 8px; }
.ej4-demo-b, .ej4-next { background: #1a7f4b !important; border-color: #1a7f4b !important; color: #fff !important; }
.ej4-demostep { margin: 0; padding: 10px 14px; border-radius: 4px; background: #eaf3fc; border-left: 5px solid #2a6fb0; color: #0b1f33; font-size: .95rem; line-height: 1.55; }
.ej4-hl { outline: 4px solid #e0731a; outline-offset: 3px; border-radius: 4px; animation: ej4-pulse 1.1s ease-in-out infinite; }
svg .ej4-hl { outline: none; filter: drop-shadow(0 0 5px #e0731a) drop-shadow(0 0 2px #e0731a); }
@keyframes ej4-pulse { 50% { outline-color: #f6c28b; } }
@media (prefers-reduced-motion: reduce) { .ej4-hl { animation: none; } }
.ej4-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.ej4-fig { background: #f4f9ff; border: 1px solid #cfdae6; border-radius: 6px; padding: 6px; min-width: 0; }
.ej4-fig svg { display: block; width: 100%; height: auto; }
.ej4-panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-width: 0; }
@media (min-width: 720px) { .ej4-panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .ej4-pbs, .ej4-rearm { grid-column: 1 / -1; } .ej4-chart { align-self: stretch; } }
.ej4-pbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ej4-pbs button { min-height: 58px; font-size: .95rem; }
.ej4-s0 { background: #b42318 !important; border-color: #b42318 !important; }
.ej4-s1 { background: #1a7f4b !important; border-color: #1a7f4b !important; }
.ej4-s2 { background: #2a6fb0 !important; border-color: #2a6fb0 !important; }
.ej4-rearm { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ej4-rearm button { background: #eef2f6; color: #0b1f33; border-color: #cfdae6; font-size: .82rem; }
.ej4-read { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ej4-tile { border: 1px solid #cfdae6; border-radius: 6px; padding: 8px 10px; background: #eef2f6; color: #0b1f33; min-width: 0; }
.ej4-tile small { display: block; color: #4a5d70; font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; }
.ej4-tile b { font-size: 1.05rem; overflow-wrap: anywhere; }
.ej4-tile.on { background: #fff7ef; border-color: #e0731a; }
.ej4-tile.bad { background: #fdecea; border-color: #b42318; color: #b42318; }
.ej4-chart { background: #fff; border: 1px solid #cfdae6; border-radius: 6px; padding: 4px; }
.ej4-chart svg { display: block; width: 100%; height: auto; }
.ej4-adv { border: 1px solid #cfdae6; border-radius: 6px; padding: 8px 12px; background: #fff; }
.ej4-adv summary { cursor: pointer; font-weight: 700; color: #0b1f33; min-height: 32px; }
.ej4-adv-in { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin-top: 10px; }
@media (max-width: 700px) { .ej4-adv-in { grid-template-columns: minmax(0, 1fr); } }
.ej4-adv label { display: flex; align-items: center; gap: 8px; font-size: .92rem; color: #0b1f33; line-height: 1.35; min-height: 32px; }
.ej4-adv label.col { flex-direction: column; align-items: stretch; gap: 4px; }
.ej4-adv input[type=checkbox] { width: 20px; height: 20px; flex: none; }
.ej4-adv select { min-height: 38px; width: 100%; }
.ej4-adv p { grid-column: 1 / -1; margin: 0; font-size: .85rem; color: #4a5d70; }
.ej4-fig { overflow-x: auto; }
.ej4-fig svg { min-width: 620px; }
