/* Course map, medals, points, player course bar, toasts, end-of-session celebration, «Caso real» and the
   fault simulator. Tokens: tokens.css. */

/* ======================================================================
   Course page: sticky summary column + route
   ====================================================================== */
.course-layout { display: grid; gap: 28px; }
.course-side { min-width: 0; }
.course-summary { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-xl); padding: 24px; box-shadow: var(--shadow); }
.course-summary h1 { font-size: clamp(26px, 2.4vw, 32px); margin: 0; }
.course-sub { color: var(--ink-2); margin: 8px 0 0; font-size: 15px; }
.course-summary .chips { margin: 14px 0 18px; }
.chip.ai { background: var(--accent-soft); color: var(--accent-ink); }
.chip.fresh { background: var(--ok-soft); color: var(--ok-ink); border-color: var(--ok-line); }
.course-progress { display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center; padding: 16px; border-radius: var(--r); background: var(--paper); border: 1px solid var(--line); }
.ring { --p: 0; width: 84px; height: 84px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0); display: grid; place-items: center; position: relative; flex: none; }
.ring::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: var(--card); }
.ring b { position: relative; font-family: var(--font-display); font-size: 22px; letter-spacing: -.03em; font-weight: 800; line-height: 1; text-align: center; }
.ring b small { font-size: 11px; color: var(--dim); display: block; text-align: center; letter-spacing: 0; font-weight: 700; margin-top: 2px; }
.course-progress p { margin: 0; font-size: 14px; color: var(--ink-2); }
.course-progress p b { color: var(--ink); font-size: 15px; display: block; font-family: var(--font-display); letter-spacing: -.01em; }
.course-next { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.course-next .btn { width: 100%; }
.course-summary .notice { margin: 16px 0 0; }
.course-aside { margin-top: 18px; display: grid; gap: 10px; }
.course-aside details { border: 1px solid var(--line); border-radius: var(--r); background: var(--card); padding: 0 16px; }
.course-aside summary { list-style: none; cursor: pointer; min-height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 700; font-size: 14.5px; border-radius: var(--r-xs); }
.course-aside summary::-webkit-details-marker { display: none; }
.course-aside summary::after { content: "+"; font-family: var(--font-display); color: var(--accent-ink); font-size: 20px; line-height: 1; }
.course-aside details[open] summary::after { content: "–"; }
.course-aside ul { padding: 0 0 14px 18px; margin: 0; list-style: disc; color: var(--ink-2); font-size: 14px; }
.course-aside ul li { margin-bottom: 4px; }
.course-aside p { margin: 0; padding: 0 0 14px; color: var(--ink-2); font-size: 14px; }
.course-aside .course-safety { border-color: var(--amber-line); background: var(--amber-soft); }
.course-aside .course-safety summary, .course-aside .course-safety summary::after { color: var(--amber-ink); }
.course-aside .course-safety .notice { margin: 0 0 14px; padding: 0; border: 0; background: none; max-height: 9.5em; overflow: auto; overscroll-behavior: contain; }
.course-aside .course-safety .notice::before { display: none; }

.cmap-wrap { margin: 0 0 28px; min-width: 0; }
.cmap-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 20px; margin-bottom: 16px; }
.cmap-head h2 { font-size: clamp(24px, 2.6vw, 34px); margin: 0; font-weight: 800; }
.cmap-sub { margin: 4px 0 0; color: var(--dim); font-weight: 600; font-size: 14px; }
.cmap-note { margin: 0; color: var(--ink-2); font-size: 14px; max-width: 520px; }
.cmap-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.cmap-stats .stat { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill); background: var(--card); border: 1px solid var(--line); font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.cmap-stats .stat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.cmap-stats .stat b { color: var(--ink); font-family: var(--font-display); font-size: 15px; }
.medals-box { margin: 0 0 22px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 0 16px; box-shadow: var(--shadow-sm); }
.medals-box > summary { list-style: none; cursor: pointer; min-height: 56px; display: flex; align-items: center; gap: 12px; font-weight: 700; }
.medals-box > summary::-webkit-details-marker { display: none; }
.medals-box > summary::after { content: "+"; margin-left: auto; font-family: var(--font-display); font-size: 20px; color: var(--accent-ink); }
.medals-box[open] > summary::after { content: "–"; }
.medals-count { color: var(--dim); font-weight: 600; font-size: 14px; }
.medals-stars { display: flex; gap: 2px; font-size: 15px; line-height: 1; color: var(--line-3); }
.medals-stars .on { color: #E0A416; }
.medals { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.medal { display: flex; align-items: center; gap: 9px; padding: 6px 12px 6px 6px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--card); color: var(--dim); max-width: 320px; }
.medal .medal-ico { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--paper-2); color: var(--line-3); font-size: 14px; }
.medal-text { display: grid; line-height: 1.2; }
.medal-text b { font-size: 13px; }
.medal-text small { font-size: 12px; }
.medal.earned { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber-ink); }
.medal.earned .medal-ico { background: linear-gradient(135deg, #F0B429, #FFD66B); color: #fff; }

/* ---------- the route ---------- */
.cmap { list-style: none; margin: 0; padding: 0; position: relative; }
.cmap::before { content: ""; position: absolute; top: 30px; bottom: 30px; left: 25px; width: 3px; border-radius: 3px; background: repeating-linear-gradient(180deg, var(--line-2) 0 8px, transparent 8px 14px); }
.station { position: relative; padding: 0 0 14px; }
.st-node { position: relative; display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; border-radius: var(--r-lg); padding: 0; outline-offset: 3px; }
a.st-node:hover { text-decoration: none; }
a.st-node:hover .st-text { border-color: var(--line-3); transform: translateY(-1px); }
.st-dot { position: relative; z-index: 1; flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 17px; background: var(--card); border: 3px dashed var(--line-2); color: var(--dim); }
.st-text { display: grid; min-width: 0; padding: 14px 18px; border-radius: var(--r-lg); background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); flex: 1; transition: border-color var(--dur-fast), transform var(--dur-fast); }
.st-text b { font-family: var(--font-display); font-size: 16.5px; line-height: 1.3; letter-spacing: -.015em; margin-top: 3px; }
.st-kicker { font-size: 12px; font-weight: 800; color: var(--dim); text-transform: uppercase; letter-spacing: var(--track-caps); }
.st-label { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: var(--fs-sm); font-weight: 600; color: var(--dim); }
.st-label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); flex: none; }
.st-label.tag-queued { color: var(--amber-ink); background: none; padding: 0; }
.st-label.tag-queued::before { background: var(--amber); }
.st-label.tag-running { color: var(--info); background: none; padding: 0; }
.st-label.tag-running::before { background: var(--info); }
.st-more { margin: 8px 0 0 66px; font-size: 14px; color: var(--ink-2); }
.st-more summary { cursor: pointer; min-height: var(--tap); display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--accent-ink); list-style: none; }
.st-more summary::-webkit-details-marker { display: none; }
.st-more summary::before { content: "+"; font-family: var(--font-display); font-size: 18px; line-height: 1; }
.st-more[open] summary::before { content: "–"; }
.st-more ul { margin: 6px 0 8px; padding-left: 18px; }
.st-more .chips { margin: 4px 0 0; }
.station .adapted-note { margin-left: 66px; }
.station.st-done .st-dot { background: var(--ink); border: 3px solid var(--ink); color: var(--on-ink); }
.station.st-done .st-label { color: var(--ok); }
.station.st-done .st-label::before { background: var(--ok); }
.station.st-current .st-dot { background: var(--accent); border: 3px solid var(--accent); color: var(--ink); animation: st-pulse 2s ease-out infinite; }
.station.st-current .st-text { border-color: rgba(255, 90, 31, .5); background: linear-gradient(180deg, #FFF6F0, var(--card) 60%); box-shadow: 0 12px 36px -12px rgba(255, 90, 31, .35); }
.station.st-current .st-label { color: var(--accent-ink); }
.station.st-current .st-label::before { background: var(--accent); }
.station.st-open .st-dot, .station.st-available .st-dot, .station.st-progress .st-dot { border-style: solid; border-color: var(--accent); color: var(--accent-ink); }
.station.st-next .st-text { border-style: dashed; border-color: var(--line-2); }
.station.st-locked .st-text, .station.st-soon .st-text { background: var(--paper-2); box-shadow: none; color: var(--ink-2); }
.station.st-locked .st-text b, .station.st-soon .st-text b { color: var(--ink-2); }
.station.st-locked .st-dot, .station.st-soon .st-dot { background: var(--paper-2); }
.station.featured .st-text { border-color: rgba(255, 90, 31, .45); }
.station.k-diagnosis .st-dot { border-radius: 16px; background: var(--amber-soft); border: 3px solid #F0B429; color: var(--amber-ink); }
.station.k-diagnosis.st-done .st-dot { background: #F0B429; color: #fff; }
.station.k-diagnosis.st-locked .st-dot { background: var(--paper-2); border: 3px dashed var(--line-2); color: var(--dim); }
.station.k-diagnosis.st-available .st-dot, .station.k-diagnosis.st-progress .st-dot { background: #F0B429; border-color: #F0B429; color: #fff; animation: st-pulse-amber 2.2s ease-out infinite; }
.station.k-exam .st-dot { border-radius: 16px; background: var(--violet-soft); border: 3px solid var(--violet-line); color: var(--violet); }
.station.k-exam.st-available .st-dot, .station.k-exam.st-progress .st-dot { background: var(--violet); border-color: var(--violet); color: #fff; animation: st-pulse-violet 2.2s ease-out infinite; }
.station.k-exam.st-done .st-dot { background: var(--violet); border-color: var(--violet); color: #fff; }
.station.k-exam.st-failed .st-dot { background: var(--amber-soft); border-color: #F0B429; color: var(--amber-ink); }
.station.k-exam.st-failed .st-label { color: var(--amber-ink); }
.station.k-exam.st-done .st-label { color: var(--violet-ink); }
.station.k-taller .st-dot { border-radius: 16px; background: var(--teal-soft); border: 3px solid var(--teal); color: var(--teal-ink); font-size: 20px; }
.station.k-taller .st-text { border-style: dashed; }
@keyframes st-pulse-violet { 0% { box-shadow: 0 0 0 0 rgba(109, 74, 219, .4); } 80%, 100% { box-shadow: 0 0 0 12px rgba(109, 74, 219, 0); } }
@keyframes st-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 90, 31, .45); } 80%, 100% { box-shadow: 0 0 0 16px rgba(255, 90, 31, 0); } }
@keyframes st-pulse-amber { 0% { box-shadow: 0 0 0 0 rgba(240, 180, 41, .45); } 80%, 100% { box-shadow: 0 0 0 12px rgba(240, 180, 41, 0); } }

@media (min-width: 980px) {
  .course-layout { grid-template-columns: 360px minmax(0, 1fr); gap: 36px; align-items: start; }
  .course-side { position: sticky; top: calc(var(--topbar-h) + 20px); }
}
@media (min-width: 1200px) { .course-layout { grid-template-columns: 380px minmax(0, 1fr); gap: 44px; } }

/* wide desktop: zigzag around a central path */
@media (min-width: 1280px) {
  .cmap::before { left: calc(50% - 1.5px); }
  .station { width: 50%; }
  .station:nth-child(odd) { padding-right: 40px; }
  .station:nth-child(even) { margin-left: 50%; padding-left: 40px; }
  .station:not(:first-child) { margin-top: -14px; }
  .station .st-dot { position: absolute; top: 50%; margin-top: -26px; }
  .station:nth-child(odd) .st-dot { right: -66px; }
  .station:nth-child(even) .st-dot { left: -66px; }
  .station:nth-child(odd) .st-text { text-align: right; }
  .station:nth-child(odd) .st-label { justify-self: end; }
  .st-more, .station .adapted-note { margin-left: 0; }
  .station:nth-child(odd) .st-more { text-align: right; }
  .station:nth-child(odd) .st-more summary { justify-content: flex-end; }
  .station:nth-child(odd) .st-more .chips { justify-content: flex-end; }
}
@media (max-width: 700px) {
  .st-text { padding: 12px 14px; }
  .st-more, .station .adapted-note { margin-left: 0; }
}

/* ======================================================================
   Mis cursos
   ====================================================================== */
.my-progress { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0; }
.my-dots { list-style: none; margin: 0; padding: 0; display: flex; gap: 5px; flex-wrap: wrap; }
.my-dots li { width: 12px; height: 12px; border-radius: 50%; background: var(--line); }
.my-dots li.d-done { background: var(--ink); }
.my-dots li.d-current { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.my-points { font-size: 13px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 3px 11px; border-radius: var(--r-pill); }

/* ======================================================================
   Player: course bar + toasts
   ====================================================================== */
.course-bar { display: flex; gap: 3px; align-items: center; width: min(420px, 100%); height: 18px; margin-top: 6px; border-radius: 6px; text-decoration: none; position: relative; }
.course-bar::after { content: ""; position: absolute; inset: -13px 0; }
.course-bar.hidden { display: none; }
.course-bar .seg { flex: 1; height: 6px; border-radius: 3px; background: var(--line); transition: height .2s; }
.course-bar .seg.k-diagnosis { flex: .45; background: var(--amber-soft); }
.course-bar .seg.k-exam { flex: .45; background: var(--violet-soft); }
.course-bar .seg.k-taller { flex: .45; background: var(--teal-soft); }
.course-bar .seg.k-exam.st-done { background: var(--violet); }
.course-bar .seg.st-done { background: var(--ink); }
.course-bar .seg.k-diagnosis.st-done { background: #F0B429; }
.course-bar .seg.st-current { background: #FFB38F; }
.course-bar .seg.here { background: var(--accent); height: 10px; }
.course-bar:hover .seg, .course-bar:focus-visible .seg { height: 10px; }
.course-bar:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.game-toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 90; display: grid; gap: 6px; justify-items: center; pointer-events: none; }
.game-toast .toast { padding: 9px 18px; border-radius: var(--r-pill); background: var(--ink); color: var(--on-ink); font-weight: 700; font-size: 14px; box-shadow: 0 10px 28px -8px rgba(28, 26, 23, .5); opacity: 0; transform: translateY(10px); transition: opacity .25s, transform .25s; }
.game-toast .toast.in { opacity: 1; transform: none; }
.game-toast .toast.points { background: var(--ok); }
.game-toast .toast.medal { background: linear-gradient(135deg, #B7791F, #F0B429); }

/* ======================================================================
   End-of-session celebration
   ====================================================================== */
.next-card.celebrate { left: 50%; right: auto; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow-y: auto; padding: 18px 20px; gap: 10px; text-align: center; align-items: stretch; border-radius: var(--r-xl); }
.cel-head b { font-family: var(--font-display); font-size: 22px; letter-spacing: -.02em; }
.cel-map { position: relative; height: 44px; margin: 4px 22px; }
.cel-line { position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -1.5px; background: var(--line-2); border-radius: 3px; }
.cel-stop { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 2px solid var(--line-2); font: 800 12px var(--font-display); color: var(--dim); }
.cel-stop.k-diagnosis { border-radius: 6px; transform: translate(-50%, -50%) rotate(45deg); width: 22px; height: 22px; border-color: #F0B429; }
.cel-stop.k-diagnosis i { transform: rotate(-45deg); }
.cel-stop i { font-style: normal; }
.cel-stop.done { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.cel-marker { position: absolute; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; border: 3px solid var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); transition: left 1.2s cubic-bezier(.45, 0, .2, 1); }
.cel-score { font-size: 14.5px; color: var(--ink-2); }
.cel-points { font-family: var(--font-display); font-size: 26px; color: var(--ok); letter-spacing: -.02em; }
.cel-medal { display: flex; align-items: center; gap: 10px; text-align: left; padding: 8px 12px; border-radius: var(--r-sm); background: var(--amber-soft); border: 1px solid var(--amber-line); color: var(--amber-ink); }
.cel-medal .medal-ico { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: linear-gradient(135deg, #F0B429, #FFD66B); color: #fff; font-size: 18px; }
.cel-medal span:last-child { display: grid; }
.cel-medal small { font-size: 12.5px; }
.cel-medal.pop { animation: medal-pop .6s .8s both var(--ease-spring); }
@keyframes medal-pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
.cel-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: flex-start; }
.cel-actions.hidden { display: none; }
.cel-next { display: grid; gap: 4px; text-align: left; justify-items: start; }
@media (max-width: 860px) {
  .stage-wrap.celebrating:not(.immersive) .stage { aspect-ratio: auto; min-height: 430px; }
}
@media (max-width: 600px) {
  .next-card.celebrate { left: 8px; right: 8px; top: 8px; bottom: 8px; transform: none; width: auto; max-height: none; padding: 12px; }
  .cel-actions { flex-direction: column; align-items: stretch; }
  .cel-actions .btn { width: 100%; }
}

/* ======================================================================
   Caso real (beginner-first: case, plain actions, readable results, history)
   ====================================================================== */
.page-dx .page { padding-top: var(--s4); }
.dx { max-width: 1180px; margin: 0 auto; }
.dx-crumbs { margin-bottom: 2px; }
.dx-crumbs a { display: inline-flex; align-items: center; min-height: var(--tap); font-weight: 600; color: var(--ink-2); }
.dx-crumbs a:hover { color: var(--ink); }
.dx-eyebrow { display: block; color: var(--accent-ink); font-weight: 700; font-size: 13px; line-height: 1.4; }
.dx-head h1 { font-size: clamp(26px, 4.2vw, 34px); margin: 4px 0 8px; }
.dx-lead { font-size: 16.5px; line-height: 1.5; color: var(--ink-2); margin: 0 0 12px; max-width: 72ch; }
.dx-howto { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 0 16px; margin: 0 0 14px; max-width: 860px; }
.dx-howto summary { cursor: pointer; min-height: 48px; display: flex; align-items: center; justify-content: space-between; font-weight: 700; color: var(--ink); list-style: none; }
.dx-howto summary::-webkit-details-marker { display: none; }
.dx-howto summary::after { content: "+"; font-family: var(--font-display); color: var(--accent-ink); font-size: 20px; }
.dx-howto[open] summary::after { content: "–"; }
.dx-howto ol { margin: 0 0 14px; padding-left: 22px; display: grid; gap: 6px; font-size: 15px; color: var(--ink-2); }
.dx-howto ol b { color: var(--ink); }
.dx-cases { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.dx-cases .chip { display: inline-flex; align-items: center; min-height: var(--tap); text-decoration: none; border: 1px solid var(--line); background: var(--card); }
.dx-cases .chip.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.dx-step { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 8px; border-radius: 50%; background: var(--accent); color: var(--ink); font-family: var(--font-display); font-size: 13px; font-weight: 800; vertical-align: 2px; flex: none; }
.dx-sub { color: var(--ink-2) !important; font-size: 14px; margin: 0 0 10px !important; }

/* the case */
.dx-story { margin-bottom: 16px; border-left: 5px solid var(--amber); }
.dx-kicker { display: flex; align-items: center; margin: 0 0 4px !important; font-size: 12.5px; font-weight: 800; text-transform: uppercase; letter-spacing: var(--track-caps); color: var(--dim) !important; }
.dx-story h2 { font-size: clamp(20px, 3.4vw, 26px); margin: 0 0 10px; }
.dx-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; margin: 0 0 10px; font-size: 15.5px; }
.dx-facts dt { font-weight: 700; color: var(--dim); }
.dx-facts dd { margin: 0; color: var(--ink); }
.dx-facts.small { font-size: 14px; gap: 4px 12px; }
.dx-quote { margin: 0; }
.dx-quote figcaption { font-size: 13px; font-weight: 700; color: var(--dim); margin-bottom: 4px; }
.dx-quote blockquote { margin: 0; padding: 10px 14px; border-left: 4px solid var(--amber); background: var(--amber-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0; font-size: 16px; font-style: italic; color: var(--ink); }
.dx-mode { font-size: 13.5px; color: var(--ink-2) !important; margin: 10px 0 0 !important; }

/* actions */
.dx-grid { display: grid; gap: 16px; }
.dx-actions h2, .dx-notebook h2, .dx-finish h2, .dx-result h2 { display: flex; align-items: center; font-size: 18px; margin: 0 0 6px; }
.dx-group { margin-top: 14px; }
.dx-cat { font-size: 16px; margin: 0 0 2px; color: var(--ink); }
.dx-cat-text { margin: 0 0 8px; font-size: 13.5px; color: var(--ink-2); }
.dx-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.dx-card { position: relative; width: 100%; display: grid; gap: 3px; text-align: left; min-height: 56px; padding: 12px 14px 12px 34px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--card); cursor: pointer; box-shadow: var(--shadow-sm); color: var(--ink); font: inherit; transition: border-color var(--dur-fast), transform var(--dur-fast); }
.dx-card::before { content: ""; position: absolute; left: 14px; top: 19px; width: 10px; height: 10px; border-radius: 50%; background: var(--line-3); }
.dx-card.g-observe::before { background: var(--ink-2); }
.dx-card.g-measure::before { background: #E0A416; }
.dx-card.g-test::before { background: var(--teal); }
.dx-card.risky { border-color: var(--danger-line); background: #FFFBFA; }
.dx-card.risky::before { background: var(--danger); }
.dx-card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.dx-card-title b { font-size: 15.5px; line-height: 1.35; }
.dx-done { flex: none; font-size: 12.5px; font-weight: 800; color: var(--ok); }
.dx-desc { font-size: 14px; color: var(--ink-2); line-height: 1.45; }
.dx-card small { color: var(--dim); font-size: 12.5px; }
.dx-risk { display: inline-flex; align-items: center; gap: 4px; justify-self: start; margin-top: 3px; padding: 2px 10px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 700; color: var(--danger-ink); background: var(--danger-soft); }
.dx-risk.warn { color: var(--amber-ink); background: var(--amber-soft); }
.dx-risk.ok { color: var(--ok-ink); background: var(--ok-soft); }
.dx-card:hover { border-color: var(--ink); transform: translateY(-1px); }
.dx-card:disabled { opacity: .6; cursor: progress; transform: none; }
.dx-card.taken { background: var(--paper); box-shadow: none; }
.dx-inline { margin: 4px 0 2px 20px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--paper); border: 1px dashed var(--line-3); font-size: 14px; }
.dx-inline p { margin: 0; }
.dx-inline p + p { margin-top: 4px; }
.dx-inline.unsafe { background: var(--danger-soft); border-color: var(--danger-line); }
.dx-inline.fresh { animation: dx-fresh 1.2s ease-out; }
.dx-val { font: 700 16px var(--mono); margin-right: 8px; }
.dx-verdict { display: inline-block; font-weight: 700; font-size: 13.5px; }
.dx-verdict.ok { color: var(--ok-ink); }
.dx-verdict.bad { color: var(--danger); }
.dx-verdict.big { display: block; font-size: 16px; margin: 8px 0; padding: 8px 12px; border-radius: var(--r-sm); }
.dx-verdict.big.ok { background: var(--ok-soft); }
.dx-verdict.big.bad { background: var(--danger-soft); }

/* side: result, history, diagnosis */
.dx-side { display: grid; gap: 14px; align-content: start; }
.dx-side .card { padding: 16px 18px; }
.dx-meter { display: grid; gap: 2px; padding: 12px 16px; border-radius: var(--r); background: #2A2722; color: #F3EEE6; }
.dx-meter-name { font-size: 13px; color: var(--on-ink-2); font-weight: 600; }
.dx-meter-val { font: 700 clamp(34px, 6vw, 44px)/1.1 var(--mono); color: var(--amber); letter-spacing: .02em; }
.dx-meter-val small { font-size: .5em; color: #E7E1D6; }
.dx-result-label { font-weight: 700; color: var(--ink) !important; margin: 0 0 2px !important; }
.dx-result-text { color: var(--ink) !important; font-size: 15px; margin: 8px 0 0 !important; padding: 8px 12px; background: var(--paper-2); border-radius: var(--r-sm); }
.dx-count { font-size: 14px; font-weight: 600; color: var(--dim); margin-left: 6px; }
.dx-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; max-height: 420px; overflow-y: auto; overscroll-behavior: contain; }
.dx-log li { padding: 8px 10px; border-radius: var(--r-sm); background: var(--paper-2); border-left: 4px solid var(--line-2); display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; font-size: 14px; }
.dx-log li b { display: block; line-height: 1.35; }
.dx-log li p { margin: 2px 0 0; color: var(--ink-2); }
.dx-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--card); border: 1px solid var(--line-2); font-size: 12px; font-weight: 800; color: var(--dim); }
.dx-log li.unsafe { border-left-color: var(--danger); background: var(--danger-soft); }
.dx-log li.fresh { animation: dx-fresh 1.2s ease-out; }
@keyframes dx-fresh { from { background: var(--amber-soft); } }
.dx-warn { color: var(--danger-ink); font-size: 13.5px; margin: 4px 0 0; }
.dx-warn:empty { display: none; }

/* bottom bar (all sizes): the main button is always one tap away */
.page-dx .page { padding-bottom: calc(96px + var(--safe-b)); }
.dx-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding: 10px max(16px, var(--safe-r)) max(10px, var(--safe-b)) max(16px, var(--safe-l));
  background: rgba(250, 247, 242, .92); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); border-top: 1px solid var(--line); box-shadow: 0 -4px 18px rgba(28, 26, 23, .08); }
.dx-bar-in { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 10px; }
.dx-bar-text { flex: 1; display: flex; align-items: center; margin: 0; font-size: 14.5px; color: var(--ink-2); font-weight: 600; }
.dx-bar .btn { min-height: 48px; }
.dx-bar .btn-primary { font-size: 16px; padding-inline: 22px; }

/* diagnosis dialog */
.dx-dialog { width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 0; border-radius: var(--r-xl); box-shadow: 0 20px 60px rgba(28, 26, 23, .35); color: var(--ink); background: var(--card); }
.dx-dialog::backdrop { background: rgba(28, 26, 23, .5); }
.dx-dialog .dx-form { padding: 18px 18px 0; margin: 0; }
.dx-dialog h2 { font-size: 21px; margin: 0; }
.dx-form { display: grid; gap: 12px; margin-top: 12px; }
.dx-form fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px 12px; margin: 0; display: grid; gap: 6px; }
.dx-form legend { font-weight: 700; padding: 0 4px; }
.dx-opt { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 8px 10px; border-radius: var(--r-sm); border: 1px solid var(--line-2); cursor: pointer; background: var(--card); }
.dx-opt input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--accent); }
.dx-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.dx-form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.dx-dialog .dx-form-actions { position: sticky; bottom: 0; justify-content: flex-end; flex-wrap: nowrap; background: var(--card); padding: 10px 0 max(16px, var(--safe-b)); margin: 0; border-top: 1px solid var(--line); }

/* debrief */
.dx-debrief { margin-top: 16px; display: grid; gap: 12px; }
.dx-debrief h2 { font-size: clamp(22px, 2.6vw, 28px); font-weight: 800; margin: 0; outline: none; }
.dx-debrief.is-win { border-color: var(--ok-line); background: linear-gradient(180deg, var(--ok-soft), var(--card) 120px); }
.dx-debrief.is-miss { border-color: var(--accent-soft-2); background: linear-gradient(180deg, var(--accent-soft), var(--card) 120px); }
.dx-debrief p { color: var(--ink); margin: 0; }
.dx-score { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; padding: 16px; border-radius: var(--r); background: var(--paper-2); }
.dx-total { --p: 0; position: relative; width: 132px; height: 132px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--line) 0); display: grid; align-content: center; justify-items: center; line-height: 1; gap: 4px; flex: none; justify-self: center; }
.dx-total::before { content: ""; position: absolute; inset: 10px; border-radius: 50%; background: var(--card); }
.dx-total > * { position: relative; }
.dx-debrief.is-win .dx-total { background: conic-gradient(var(--ok) calc(var(--p) * 1%), var(--line) 0); }
.dx-total b { font-family: var(--font-display); font-size: 48px; letter-spacing: -.04em; color: var(--ink); }
.dx-total span { font-size: 12.5px; color: var(--dim); text-align: center; font-weight: 600; max-width: 84px; }
.dx-parts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.dx-part-head { display: flex; justify-content: space-between; gap: 10px; font-size: 15px; font-weight: 600; }
.dx-part-bar { height: 8px; border-radius: var(--r-pill); background: var(--line); overflow: hidden; margin: 4px 0; }
.dx-part-bar i { display: block; height: 100%; background: var(--accent); border-radius: var(--r-pill); }
.dx-part p { font-size: 13.5px; color: var(--ink-2) !important; }
.dx-points { font-weight: 800; color: var(--ok); }
.dx-insight { padding: 10px 12px; border-radius: var(--r); background: var(--accent-soft); border: 1px solid var(--accent-soft-2); }
.dx-compare { font-size: 17px; margin: 6px 0 0; }
.dx-paths { display: grid; gap: 14px; }
.dx-paths h3 { font-size: 16px; margin: 0 0 6px; }
.dx-path { margin: 0; padding-left: 22px; display: grid; gap: 8px; font-size: 14px; }
.dx-path li p { margin: 2px 0; }
.dx-path li small { color: var(--dim); display: block; }
.dx-tag { display: inline-block; margin-left: 6px; padding: 0 8px; border-radius: var(--r-pill); font-size: 12px; font-weight: 700; background: var(--paper-2); color: var(--ink-2); }
.dx-tag.miss { background: var(--amber-soft); color: var(--amber-ink); }
.dx-path li.t-key .dx-tag, .dx-path.expert li.done .dx-tag { background: var(--ok-soft); color: var(--ok-ink); }
.dx-path li.t-useful .dx-tag { background: var(--info-soft); color: var(--info); }
.dx-path li.t-extra .dx-tag { background: var(--paper-2); color: var(--dim); }
.dx-path li.t-risk .dx-tag { background: var(--danger-soft); color: var(--danger-ink); }
.dx-repair { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
.dx-repair li small { display: block; color: var(--dim); }
.dx-repair li.ok { color: var(--ok-ink); font-weight: 700; }
.dx-repair li.chosen { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
@media (min-width: 900px) {
  .dx-grid { grid-template-columns: minmax(0, 1.35fr) minmax(320px, 1fr); align-items: start; }
  .dx-side { position: sticky; top: calc(var(--topbar-h) + 16px); max-height: calc(100vh - 168px); max-height: calc(100dvh - 168px); overflow-y: auto; overscroll-behavior: contain; padding-bottom: 4px; }
  .dx-side .dx-log { max-height: 260px; }
  .dx-paths { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 899px) {
  .dx-bar-text { display: none; }
  .dx-bar .btn-primary { flex: 1; }
  .dx-score { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .dx-story, .dx-side .card { padding: 14px; }
  .dx-facts { grid-template-columns: 1fr; gap: 0; }
  .dx-facts dd { margin-bottom: 6px; }
  .dx-dialog { width: 100vw; max-width: none; max-height: 92dvh; margin: auto 0 0; border-radius: var(--r-xl) var(--r-xl) 0 0; }
  .dx-dialog .dx-form-actions .btn { flex: 1; min-height: 48px; padding-inline: 10px; }
}

/* ======================================================================
   Simulador de fallas (Taller + exámenes): reuses the diagnosis components, adds budget, tiers, exam flow
   ====================================================================== */
.sim-pick { display: grid; gap: 10px; margin-top: 14px; }
.sim-pick h2 { font-size: 18px; margin: 0; }
.sim-tiers { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.sim-tier { width: 100%; display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center; text-align: left; padding: 12px 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--card); cursor: pointer; font: inherit; color: var(--ink); box-shadow: var(--shadow-sm); min-height: 64px; transition: border-color var(--dur-fast), transform var(--dur-fast); }
.sim-tier:hover { border-color: var(--ink); transform: translateY(-1px); }
.sim-tier:disabled { opacity: .6; cursor: progress; }
.sim-tier .sim-tier-n { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; font-family: var(--font-display); font-weight: 800; font-size: 18px; color: #fff; background: var(--teal); }
.sim-tier.t-2 .sim-tier-n { background: var(--ink); }
.sim-tier.t-3 .sim-tier-n { background: #D97706; }
.sim-tier.t-4 .sim-tier-n { background: var(--danger); }
.sim-tier b { display: block; font-size: 15.5px; }
.sim-tier small { color: var(--ink-2); font-size: 13.5px; line-height: 1.4; }
.sim-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.sim-stats .chip { display: inline-flex; align-items: center; min-height: var(--tap); }
.sim-machine { margin: 0; color: var(--ink-2); font-size: 14px; }
.sim-safety { padding: 10px 12px; border-radius: var(--r); background: var(--amber-soft); border: 1px solid var(--amber-line); color: var(--amber-ink); font-size: 14px; }

/* scenario header: tier, seed, persona, budget and current state */
.sim-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.sim-meta .chip { display: inline-flex; align-items: center; min-height: 30px; }
.sim-meta .chip.tier { background: var(--teal-soft); color: var(--teal-ink); }
.sim-meta .chip.exam { background: var(--violet-soft); color: var(--violet-ink); }
.dx-quote.extra blockquote { border-left-color: var(--line-3); background: var(--paper-2); margin-top: 6px; }
.sim-budget { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; margin: 10px 0 0; font-size: 14px; color: var(--ink-2); }
.sim-budget b { color: var(--ink); font-variant-numeric: tabular-nums; }
.sim-flags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.sim-flags .chip { background: var(--ok-soft); color: var(--ok-ink); font-size: 12.5px; }
.sim-flags .chip.none { background: var(--paper-2); color: var(--ink-2); }
.sim-banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r); font-size: 14.5px; margin: 0 0 12px; border: 1px solid; }
.sim-banner.danger { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-ink); }
.sim-banner.info { background: var(--info-soft); border-color: #C5D6F5; color: #1E3F7A; }
.sim-banner.hint { background: var(--amber-soft); border-color: var(--amber-line); color: var(--amber-ink); }
.sim-banner b { display: block; }
.sim-banner.fresh { animation: dx-fresh 1.2s ease-out; }

/* cards: five categories, locked cards, cost line */
.dx-card.g-prepare::before { background: var(--violet); }
.dx-card.g-repair::before { background: #BE185D; }
.dx-card.locked { background: var(--paper); color: var(--ink-2); border-style: dashed; }
.dx-card.locked .dx-card-title b { color: var(--ink-2); }
.dx-need { display: inline-flex; align-items: center; gap: 4px; justify-self: start; margin-top: 3px; padding: 2px 10px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 700; color: var(--violet-ink); background: var(--violet-soft); }
.dx-cost { color: var(--dim); font-size: 12.5px; }
.sim-consequence { color: var(--danger-ink); font-size: 13.5px; margin: 4px 0 0; }
.sim-hint-btn { min-height: 44px; }
.sim-hints { display: grid; gap: 8px; }
.sim-hint { padding: 8px 12px; border-radius: var(--r-sm); background: var(--amber-soft); border: 1px solid var(--amber-line); font-size: 14px; color: var(--amber-ink); }
.sim-hint small { display: block; color: var(--amber-ink); font-size: 12px; font-weight: 700; margin-bottom: 2px; }

/* diagnosis dialog: grouped fault list with a filter */
.sim-filter { width: 100%; min-height: 44px; padding: 8px 14px; border-radius: var(--r-pill); border: 1.5px solid var(--line-2); font: inherit; background: var(--card); color: var(--ink); }
.sim-filter:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
.sim-group { display: grid; gap: 6px; }
.sim-group h4 { margin: 8px 0 2px; font-size: 12.5px; text-transform: uppercase; letter-spacing: var(--track-caps); color: var(--dim); font-family: var(--font); font-weight: 800; }
.sim-group.hidden, .dx-opt.hidden { display: none; }
.sim-max { font-size: 13px; color: var(--dim); margin: 0; }

/* exam flow */
.sim-exam-head { display: grid; gap: 10px; margin-bottom: 14px; }
.sim-progress { display: flex; gap: 6px; align-items: center; }
.sim-progress .seg { flex: 1; height: 10px; border-radius: 6px; background: var(--line); position: relative; }
.sim-progress .seg.done { background: var(--ok); }
.sim-progress .seg.fail { background: var(--danger); }
.sim-progress .seg.here { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sim-progress-text { font-size: 14px; color: var(--ink-2); font-weight: 600; margin: 0; }
.sim-intro { display: grid; gap: 12px; }
.sim-intro ul { margin: 0; padding-left: 20px; color: var(--ink-2); }
.sim-verdict { display: grid; gap: 12px; }
.sim-verdict .sim-avg { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: var(--r); }
.sim-verdict .sim-avg b { font-family: var(--font-display); font-size: 48px; line-height: 1; letter-spacing: -.04em; }
.sim-verdict .sim-avg.pass { background: var(--ok-soft); border: 1px solid var(--ok-line); color: var(--ok-ink); }
.sim-verdict .sim-avg.fail { background: var(--danger-soft); border: 1px solid var(--danger-line); color: var(--danger-ink); }
.sim-cases { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sim-cases li { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 12px; border-radius: var(--r-sm); background: var(--paper-2); font-size: 14px; }
.sim-cases .sim-case-n { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; font-family: var(--font-display); font-weight: 800; color: #fff; background: var(--line-3); }
.sim-cases li.ok .sim-case-n { background: var(--ok); }
.sim-cases li.bad .sim-case-n { background: var(--danger); }
.sim-cases .sim-case-total { font: 700 18px var(--font-display); }
.sim-cases small { display: block; color: var(--dim); }
.sim-best { font-size: 14px; color: var(--ink-2); margin: 0; }
.dx-paths .t-pista .dx-tag { background: var(--amber-soft); color: var(--amber-ink); }
.dx-paths .t-prep .dx-tag { background: var(--violet-soft); color: var(--violet-ink); }
.dx-paths .t-fix .dx-tag { background: var(--ok-soft); color: var(--ok-ink); }
.dx-paths .t-part .dx-tag { background: #FCE7F3; color: #9D174D; }
.dx-path li p.told { color: var(--ink-2); font-size: 13px; }
@media (min-width: 700px) {
  .sim-tiers { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .sim-cases li { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .sim-verdict .sim-avg b { font-size: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  .station.k-exam.st-available .st-dot, .station.k-exam.st-progress .st-dot { animation: none; }
  .station.st-current .st-dot, .station.k-diagnosis.st-available .st-dot, .station.k-diagnosis.st-progress .st-dot { animation: none; box-shadow: 0 0 0 4px var(--accent-soft); }
  .cel-marker { transition: none; }
  .cel-medal.pop, .dx-log li.fresh { animation: none; }
  .game-toast .toast { transition: none; }
}

/* ======================================================================
   Case card: two columns on wide screens (facts left, what the client says right)
   ====================================================================== */
@media (min-width: 900px) {
  .dx-story:not(:has(.dx-quote.extra)) { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); column-gap: var(--s6); }
  .dx-story:not(:has(.dx-quote.extra)) > * { grid-column: 1; }
  .dx-story:not(:has(.dx-quote.extra)) > .dx-quote { grid-column: 2; grid-row: 1 / span 6; align-self: center; }
}

/* Long simulator action lists: each category folds */
details.dx-group > summary { list-style: none; cursor: pointer; min-height: var(--tap); display: flex; align-items: center; gap: 8px; }
details.dx-group > summary::-webkit-details-marker { display: none; }
details.dx-group > summary .dx-cat { margin: 0; }
details.dx-group > summary::after { content: "+"; margin-left: auto; font-family: var(--font-display); font-size: 20px; color: var(--accent-ink); }
details.dx-group[open] > summary::after { content: "–"; }
.dx-cat-n { color: var(--dim); font-size: 13.5px; font-weight: 700; }
.sim-intro h2 { font-size: var(--fs-lg); margin: 0; }
.sim-intro .sim-verdict { box-shadow: none; }
.sim-intro .sim-verdict h2 { font-size: 17px; margin: 0; }

/* Web research: «Fuentes» list of a course on a fast-changing topic */
.course-aside .sources-count { margin-left: auto; font-size: var(--fs-xs); font-weight: 700; color: var(--dim); }
.course-aside .sources-note { padding-bottom: 10px; }
.course-sources ul { list-style: none; padding-left: 0; }
.course-sources li { margin-bottom: 10px; overflow-wrap: anywhere; }
.course-sources a { color: var(--accent-ink); font-weight: 700; }
.course-sources small { display: block; color: var(--dim); font-size: var(--fs-xs); }
.course-sources .source-official { color: var(--accent-ink); font-weight: 700; }
