/* ProfeJuegos — Ahorcado */
.pjah-wrap {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  max-width: 1000px;
  margin: 0 auto;
  padding: 12px;
  box-sizing: border-box;
  color: #1a1a2e;
}
.pjah-wrap * { box-sizing: border-box; }

.pjah-wrap button:focus-visible,
.pjah-wrap input:focus-visible,
.pjah-wrap textarea:focus-visible,
.pjah-wrap select:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 3px;
}

.pjah-wrap:fullscreen {
  max-width: none;
  width: 100vw;
  min-height: 100vh;
  padding: 18px;
  background: #fff;
  overflow: auto;
}

.pjah-wrap:fullscreen .pjah-game-layout {
  grid-template-columns: minmax(220px, 320px) 1fr;
  align-items: center;
}

.pjah-wrap:fullscreen .pjah-svg-box svg {
  max-width: 280px;
}

.pjah-wrap:fullscreen .pjah-letter-ch {
  font-size: 2.1rem;
  min-width: 34px;
}

.pjah-wrap:fullscreen .pjah-key {
  height: 48px;
  font-size: 1rem;
}

.pjah-high-contrast {
  color: #000;
}

.pjah-high-contrast .pjah-card,
.pjah-high-contrast .pjah-controls,
.pjah-high-contrast .pjah-svg-box,
.pjah-high-contrast .pjah-timer-box,
.pjah-high-contrast .pjah-race-box {
  border-color: #000 !important;
  background: #fff !important;
  box-shadow: none !important;
}

.pjah-high-contrast .pjah-btn,
.pjah-high-contrast .pjah-key {
  border: 2px solid #000 !important;
}

.pjah-high-contrast .pjah-letter-line {
  background: #000;
}

.pjah-high-contrast .pjah-key.hit {
  background: #d1fae5 !important;
  color: #064e3b !important;
}

.pjah-high-contrast .pjah-key.miss {
  background: #fee2e2 !important;
  color: #7f1d1d !important;
}

.pjah-big-controls .pjah-key {
  max-width: 48px;
  min-width: 34px;
  height: 52px;
  font-size: 1.05rem;
}

.pjah-big-controls .pjah-btn {
  min-height: 44px;
  font-size: 1rem;
}

.pjah-big-controls .pjah-letter-ch {
  font-size: 2.05rem;
  min-width: 34px;
}

.pjah-reduce-motion *,
.pjah-reduce-motion *::before,
.pjah-reduce-motion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

@media (prefers-reduced-motion: reduce) {
  .pjah-wrap *,
  .pjah-wrap *::before,
  .pjah-wrap *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ── Layout Principal (Juego + Panel Estudiantes) ── */
.pjah-app-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 850px) {
  .pjah-app-layout { grid-template-columns: 1fr; }
}

/* ── Tarjeta ── */
.pjah-card {
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 2px 14px rgba(0,0,0,.07);
  margin-bottom: 12px;
}

/* ── Panel Lateral Estudiantes ── */
.pjah-sidebar {
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 2px 14px rgba(0,0,0,.07);
}
.pjah-sb-title { text-align: center; color: #1d4ed8; font-weight: 900; margin-bottom: 15px; font-size: 1.1rem; }
.pjah-sb-active { background: #eff6ff; border: 2px solid #3b82f6; border-radius: 10px; padding: 15px; text-align: center; margin-bottom: 12px; }
.pjah-sb-lbl { font-size: 0.75rem; font-weight: 800; color: #3b82f6; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.05em; }
.pjah-sb-name { font-size: 1.6rem; font-weight: 900; color: #1e3a8a; }
.pjah-sb-btn { width: 100%; background: #3b82f6; color: #fff; justify-content: center; margin-bottom: 15px; }
.pjah-sb-btn:hover { background: #2563eb; }
.pjah-sb-list { display: flex; flex-direction: column; gap: 8px; max-height: 400px; overflow-y: auto; padding-right: 4px; }
.pjah-sb-card { border: 1px solid #ddd; border-radius: 8px; padding: 12px; display: flex; justify-content: space-between; align-items: center; background: #fff; transition: all 0.2s; }
.pjah-sb-card.is-active { border-color: #3b82f6; background: #f8fafc; }
.pjah-sb-card-name { font-weight: 800; color: #333; font-size: 0.95rem; display: flex; align-items: center; gap: 6px; }
.pjah-sb-card.is-active .pjah-sb-card-name { color: #3b82f6; }
.pjah-sb-card-sub { font-size: 0.7rem; color: #888; margin-top: 4px; font-weight: 700; }
.pjah-sb-stats { text-align: right; font-size: 0.75rem; font-weight: 800; }
.pjah-sb-stat-y { color: #16a34a; background: #dcfce7; padding: 2px 6px; border-radius: 4px; display: inline-block; }
.pjah-sb-stat-n { color: #dc2626; background: #fee2e2; padding: 2px 6px; border-radius: 4px; display: inline-block; margin-top: 4px; }

/* ── Hero ── */
.pjah-hero {
  text-align: center;
  padding: 22px 16px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  border-radius: 14px;
  color: #fff;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(37,99,235,.24);
}
.pjah-hero h2 { margin: 0 0 6px; font-size: 2.35rem; font-weight: 900; }
.pjah-hero p  { margin: 0; opacity: .95; font-size: 1.35rem; font-weight: 800; }

/* ── Botones ── */
.pjah-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 24px; border: none; border-radius: 100px;
  font-family: inherit; font-size: .95rem; font-weight: 800;
  cursor: pointer; transition: transform .1s, box-shadow .1s;
}
.pjah-btn:hover { transform: translateY(-2px); }
.pjah-btn-red   { background: #2563eb; color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,.24); }
.pjah-btn-green { background: #16a34a; color: #fff; box-shadow: 0 4px 12px rgba(22,163,74,.25); }
.pjah-btn-gray  { background: #f0f0f0; color: #333; }
.pjah-btn-gray:hover { background: #e0e0e0; }

/* ── Setup ── */
.pjah-label {
  display: block; font-size: .78rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em;
  color: #888; margin-bottom: 5px;
}
.pjah-input, .pjah-textarea, .pjah-select {
  width: 100%; padding: 9px 12px;
  border: 2px solid #e2e2e2; border-radius: 9px;
  font-family: inherit; font-size: .95rem;
  color: #1a1a2e; background: #fafafa;
  transition: border-color .2s;
}
.pjah-input:focus, .pjah-textarea:focus, .pjah-select:focus { outline: none; border-color: #3b82f6; }
.pjah-field  { margin-bottom: 14px; }
.pjah-help { margin: -4px 0 14px; color: #666; font-size: .9rem; font-weight: 700; }

.pjah-config-section {
  padding: 16px 0;
  border-bottom: 1px solid #eef2f7;
}

.pjah-config-section:first-child {
  padding-top: 0;
}

.pjah-config-section:last-of-type {
  border-bottom: none;
}

.pjah-config-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.pjah-config-head > span {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #2563eb;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .9rem;
  font-weight: 900;
  flex: 0 0 auto;
}

.pjah-config-head strong {
  display: block;
  color: #1a1a2e;
  font-size: 1.05rem;
  font-weight: 900;
}

.pjah-config-head small {
  display: block;
  color: #64748b;
  font-size: .86rem;
  font-weight: 800;
  line-height: 1.3;
  margin-top: 2px;
}

.pjah-start-row {
  display: flex;
  justify-content: center;
  padding-top: 16px;
}

.pjah-import-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.pjah-import-tools .pjah-btn {
  padding: 7px 12px;
  font-size: .82rem;
}

.pjah-template-select {
  width: auto;
  min-width: 170px;
  padding: 7px 12px;
  font-size: .82rem;
}

.pjah-import-tools span {
  color: #64748b;
  font-size: .82rem;
  font-weight: 800;
  line-height: 1.35;
  flex: 1 1 260px;
}

.pjah-import-notice {
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 8px;
  font-size: .86rem;
  font-weight: 800;
  line-height: 1.35;
}

.pjah-import-notice.is-error {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
}

.pjah-import-notice.is-ok {
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.pjah-import-notice.is-loaded {
  display: block;
  padding: 16px 18px;
  border: 2px solid #86efac;
  border-radius: 12px;
  color: #14532d;
  background: #dcfce7;
  font-size: 1.2rem;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.3;
  margin-top: 10px;
}

.pjah-rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

@media (max-width: 760px) {
  .pjah-rules-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Menú de modos ── */
.pjah-mode-menu {
  display: block;
}

.pjui-back-track {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  margin: 0 0 16px;
}

.pjah-game-back-track {
  margin: 0 0 14px;
}

.pjui-back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 2px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
  color: #2563eb;
  font: inherit;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, transform .12s ease;
}

.pjui-back-link:hover {
  background: #dbeafe;
  border-color: #93c5fd;
  transform: translateY(-1px);
}

.pjah-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.pjah-mode-card {
  min-height: 142px;
  padding: 18px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  color: #1a1a2e;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,.05);
  transition: border-color .15s, transform .15s, box-shadow .15s;
}

.pjah-mode-card:hover:not(:disabled),
.pjah-mode-card.is-selected {
  border-color: #2563eb;
  background: #eff6ff;
  color: #0f172a;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(37,99,235,.16);
}

.pjah-mode-card:hover:not(:disabled) strong,
.pjah-mode-card.is-selected strong {
  color: #1d4ed8;
}

.pjah-mode-card:hover:not(:disabled) small,
.pjah-mode-card.is-selected small {
  color: #334155;
}

.pjah-mode-card strong {
  color: #1d4ed8;
  font-size: 1.2rem;
  font-weight: 900;
}

.pjah-mode-card small {
  color: #666;
  font-size: .92rem;
  line-height: 1.35;
  font-weight: 700;
}

.pjah-mode-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.pjah-mode-card.is-disabled {
  opacity: .62;
  cursor: not-allowed;
  background: #fafafa;
}

.pjah-setup-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.pjah-mode-pill {
  background: #f8f8f8;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  padding: 8px 12px;
  color: #666;
  font-size: .9rem;
  font-weight: 800;
}

.pjah-mode-pill strong {
  color: #1d4ed8;
}

.pjah-setup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-left: auto;
}

.pjah-activity-card {
  margin-bottom: 12px;
}

.pjah-activity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.pjah-activity-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

@media (max-width: 680px) {
  .pjah-mode-grid {
    grid-template-columns: 1fr;
  }

  .pjah-setup-actions {
    width: 100%;
    margin-left: 0;
  }

  .pjah-setup-actions .pjah-btn,
  .pjah-activity-actions .pjah-btn {
    flex: 1 1 100%;
    justify-content: center;
  }

  .pjah-activity-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Layout del gioco interno ── */
.pjah-game-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 600px) {
  .pjah-game-layout { grid-template-columns: 1fr; }
}

/* ── SVG ── */
.pjah-svg-box { background: #fafafa; border: 1px solid #eee; border-radius: 10px; padding: 8px; text-align: center; }
.pjah-svg-box svg { width: 100%; max-width: 180px; }

/* ── Errores ── */
.pjah-err-info { text-align: center; font-size: .9rem; color: #888; margin-top: 6px; font-weight: 700; }
.pjah-err-info strong { color: #e63946; font-size: 1.15rem; }

.pjah-timer-box {
  margin: 10px auto 0;
  max-width: 180px;
  padding: 9px;
  border: 1px solid #dbeafe;
  border-radius: 9px;
  background: #eff6ff;
}

.pjah-timer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #1e3a8a;
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.pjah-timer-head strong {
  color: #2563eb;
  font-size: 1rem;
}

.pjah-timer-track {
  height: 8px;
  margin-top: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: #dbeafe;
}

.pjah-timer-bar {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #2563eb;
  transition: width .25s linear, background .2s;
}

.pjah-timer-box.is-urgent {
  border-color: #fecaca;
  background: #fef2f2;
}

.pjah-timer-box.is-urgent .pjah-timer-head,
.pjah-timer-box.is-urgent .pjah-timer-head strong {
  color: #b91c1c;
}

.pjah-timer-box.is-urgent .pjah-timer-track {
  background: #fee2e2;
}

.pjah-timer-box.is-urgent .pjah-timer-bar {
  background: #e63946;
}

/* ── Palabra ── */
.pjah-word { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-bottom: 20px; min-height: 56px; align-items: center; }
.pjah-letter { display: flex; flex-direction: column; align-items: center; }
.pjah-letter-ch { font-size: 1.7rem; font-weight: 900; min-width: 28px; text-align: center; min-height: 34px; line-height: 1; }
.pjah-letter-ch.revealed { animation: pjah-pop .2s ease; }
@keyframes pjah-pop { from { transform: scale(0); } to { transform: scale(1); } }
.pjah-letter-line { width: 100%; height: 3px; background: #2563eb; border-radius: 2px; margin-top: 4px; }
.pjah-space { width: 18px; }

/* ── Pistas ── */
.pjah-clue-box {
  text-align: center;
  margin: 0 auto 16px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #eff6ff;
}

.pjah-clue-box .pjah-btn {
  padding: 8px 16px;
  font-size: .88rem;
}

.pjah-context-box {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0 auto 16px;
}

.pjah-context-item {
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f8fbff;
  text-align: center;
}

.pjah-context-item span {
  display: block;
  margin-bottom: 4px;
  color: #64748b;
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.pjah-context-item strong {
  display: block;
  color: #1d4ed8;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.3;
}

@media (max-width: 600px) {
  .pjah-context-box {
    grid-template-columns: 1fr;
  }
}

.pjah-clue-text {
  color: #1e3a8a;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.35;
}

/* ── Teclado ── */
/* ── Teclado Corregido ── */
.pjah-kb { 
  display: flex; 
  flex-direction: column; 
  align-items: center; 
  gap: 6px; 
  width: 100%;
}

.pjah-kb-row { 
  display: flex; 
  gap: 4px; 
  justify-content: center; 
  flex-wrap: nowrap; /* Esto es la clave: evita que las letras caigan solas */
  width: 100%;
  max-width: 420px; /* Evita que el teclado se estire demasiado en monitores grandes */
}

.pjah-key { 
  flex: 1 1 auto; /* Permite que las teclas se encojan si falta espacio */
  max-width: 38px;
  min-width: 18px; /* Un mínimo más pequeño para que quepan en móviles */
  height: 42px; 
  padding: 0; 
  border: 2px solid #ddd; 
  border-radius: 8px; 
  background: #f8f8f8; 
  font-family: inherit; 
  font-size: .9rem; 
  font-weight: 800; 
  cursor: pointer; 
  color: #333; 
  transition: all .1s; 
  display: flex;
  align-items: center;
  justify-content: center;
}

.pjah-key:hover:not(:disabled) { 
  background: #dbeafe; 
  color: #1e3a8a; 
  border-color: #60a5fa; 
  transform: translateY(-2px); 
}

.pjah-key:disabled { 
  cursor: default; 
}

.pjah-key.hit { 
  background: #dcfce7 !important; 
  color: #15803d !important; 
  border-color: #86efac !important; 
}

.pjah-key.miss { 
  background: #fee2e2 !important; 
  color: #b91c1c !important; 
  border-color: #fca5a5 !important; 
  text-decoration: line-through; 
}

/* ── Controles ── */
.pjah-controls {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  padding: 12px 14px;
  background: #f8f8f8;
  border-radius: 10px;
  margin-bottom: 14px;
}

.pjah-controls-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pjah-controls-bottom {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pjah-ctrl-label {
  font-size: .86rem;
  font-weight: 900;
  color: #475569;
  white-space: nowrap;
}

.pjah-err-btns {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.pjah-access-help {
  margin: -6px 0 12px;
  color: #64748b;
  font-size: .86rem;
  font-weight: 800;
  text-align: center;
}

/* ── Overlay ── */
.pjah-overlay { display: none; position: fixed; inset: 0; background: rgba(255,255,255,.98); border-radius: 0; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px 20px; z-index: 9999; overflow: hidden; }
.pjah-overlay.show { display: flex; animation: pjah-fade .25s; }
@keyframes pjah-fade { from { opacity: 0; } to { opacity: 1; } }
.pjah-ov-icon  { font-size: 3rem; margin-bottom: 8px; line-height: 1; }
.pjah-ov-title { font-size: 1.6rem; font-weight: 900; margin-bottom: 8px; line-height: 1.15; }
.pjah-ov-word  { color: #666; margin-bottom: 18px; font-size: 1rem; font-weight: 800; line-height: 1.35; }
.pjah-ov-btns  { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; flex: 0 0 auto; }

/* ── Ranking final ── */
.pjah-final-ranking {
  width: min(620px, 100%);
}

.pjah-round-ranking {
  width: min(560px, 100%);
  margin: 0 auto 16px;
  min-height: 0;
}

.pjah-final-subtitle {
  color: #666;
  font-weight: 800;
  margin-bottom: 14px;
}

.pjah-results-summary {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 14px;
}

.pjah-results-summary span {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 7px 10px;
  color: #475569;
  font-weight: 800;
}

.pjah-final-rank-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: min(46vh, 360px);
  overflow-y: auto;
}

.pjah-history-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  max-height: min(30vh, 220px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.pjah-history-list li {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  text-align: left;
  font-weight: 800;
}

.pjah-history-list li span {
  color: #64748b;
  font-size: .82rem;
  font-weight: 900;
  white-space: normal;
}

.pjah-history-empty {
  justify-content: center !important;
  color: #64748b;
}

.pjah-final-rank-row {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.pjah-final-rank-row:nth-child(1) { border-color: #facc15; background: #fefce8; }
.pjah-final-rank-row:nth-child(2) { border-color: #cbd5e1; background: #f8fafc; }
.pjah-final-rank-row:nth-child(3) { border-color: #fdba74; background: #fff7ed; }

.pjah-final-medal {
  font-size: 1.7rem;
  line-height: 1;
  text-align: center;
}

.pjah-final-place {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
  font-size: .9rem;
  font-weight: 900;
}

.pjah-final-rank-row strong {
  color: #1a1a2e;
  font-weight: 900;
}

.pjah-final-rank-row span:last-child {
  color: #3b82f6;
  font-size: .82rem;
  font-weight: 900;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .pjah-final-rank-row {
    grid-template-columns: 40px 1fr;
  }

  .pjah-final-rank-row span:last-child {
    grid-column: 2;
    white-space: normal;
  }

  .pjah-history-list li {
    flex-direction: column;
  }

  .pjah-history-list li span {
    white-space: normal;
  }
}

/* ── Carrera de estudiantes ── */
.pjah-race-box {
  margin-top: 18px;
}

.pjah-race-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pjah-race-head h3 {
  margin: 0;
  color: #1d4ed8;
  font-size: 1.15rem;
  font-weight: 900;
}

.pjah-race-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: .85rem;
  font-weight: 800;
  color: #666;
}

.pjah-race-select {
  width: auto;
  min-width: 116px;
  padding: 7px 10px;
}

.pjah-race-actions .pjah-btn {
  padding: 8px 14px;
  font-size: .82rem;
}

.pjah-race-empty {
  display: none;
  color: #888;
  text-align: center;
  padding: 12px;
  font-weight: 700;
}

.pjah-race-result {
  margin-bottom: 14px;
  padding: 18px;
  border: 3px solid #16a34a;
  border-radius: 10px;
  background: #f0fdf4;
  text-align: center;
  box-shadow: 0 8px 24px rgba(22,163,74,.18);
}

.pjah-race-box.is-complete {
  border-color: #16a34a;
}

.pjah-race-winner {
  color: #166534;
  font-size: 1.15rem;
  font-weight: 900;
  margin-bottom: 10px;
}

.pjah-race-ranking {
  list-style: none;
  margin: 0 auto 12px;
  padding: 0;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.pjah-race-ranking li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #dcfce7;
  color: #333;
  font-weight: 800;
}

.pjah-race-ranking li span {
  color: #3b82f6;
  font-size: .82rem;
  font-weight: 900;
  white-space: nowrap;
}

.pjah-race-tracks {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pjah-race-row {
  display: grid;
  grid-template-columns: minmax(80px, 150px) 1fr minmax(120px, auto);
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid #eee;
  border-radius: 10px;
  background: #fbfbfb;
  transition: border-color .2s, background .2s;
}

.pjah-race-row.is-active {
  border-color: #3b82f6;
  background: #eff6ff;
}

.pjah-race-row.is-finished {
  border-color: #16a34a;
  background: #f0fdf4;
}

.pjah-race-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 900;
  color: #333;
}

.pjah-race-lane {
  position: relative;
  height: 28px;
  min-width: 160px;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, #f1f1f1 0 18px, #e7e7e7 18px 20px);
  border: 1px solid #ddd;
  overflow: hidden;
}

.pjah-race-progress {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, rgba(59,130,246,.16), rgba(22,163,74,.2));
  transition: width .25s ease;
}

.pjah-race-car {
  position: absolute;
  top: 50%;
  left: 0;
  z-index: 2;
  transform: translate(-6px, -50%);
  font-size: 1.2rem;
  line-height: 1;
  transition: left .25s ease;
}

.pjah-race-finish {
  position: absolute;
  top: 50%;
  right: 5px;
  z-index: 3;
  transform: translateY(-50%);
  font-size: 1rem;
}

.pjah-race-stats {
  color: #3b82f6;
  font-size: .78rem;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .pjah-race-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .pjah-race-stats {
    text-align: left;
  }

  .pjah-race-lane {
    min-width: 0;
    width: 100%;
  }

  .pjah-race-ranking li {
    align-items: flex-start;
    flex-direction: column;
  }

  .pjah-race-ranking li span {
    white-space: normal;
  }
}


.pjah-source-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.pjah-source-card { min-height: 170px; }
.pjah-auto-options { padding: 12px; margin-bottom: 14px; border: 2px solid #dbeafe; border-radius: 8px; background: #f8fbff; }
.pjah-auto-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.pjah-textarea.is-readonly { background: #f8fafc; border-color: #dbeafe; }
@media (max-width: 760px) { .pjah-source-grid { grid-template-columns: 1fr; } }

/* Refuerzo contra estilos globales del tema */
.pjah-wrap .pjah-hero {
  text-align: center !important;
  padding: 22px 16px !important;
  background: linear-gradient(135deg, #2563eb, #0ea5e9) !important;
  color: #fff !important;
  border-radius: 14px !important;
  margin-bottom: 16px !important;
}

.pjah-wrap .pjah-hero h2 {
  margin: 0 0 4px !important;
  color: #fff !important;
  font-size: 1.8rem !important;
  font-weight: 900 !important;
  line-height: 1.2 !important;
}

.pjah-wrap .pjah-hero p {
  margin: 0 !important;
  color: #fff !important;
  opacity: .9 !important;
  font-size: 1.4rem !important;
  font-weight: 800 !important;
  line-height: 1.35 !important;
}

.pjah-wrap .pjah-mode-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 14px !important;
}

.pjah-wrap .pjah-source-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
}

.pjah-wrap .pjah-mode-card {
  appearance: none !important;
  -webkit-appearance: none !important;
  width: 100% !important;
  min-height: 142px !important;
  padding: 18px !important;
  border: 2px solid #e5e7eb !important;
  border-radius: 10px !important;
  background: #fff !important;
  color: #1a1a2e !important;
  text-align: left !important;
  cursor: pointer !important;
  font-family: inherit !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: 8px !important;
  box-shadow: 0 2px 12px rgba(0,0,0,.05) !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  line-height: 1.35 !important;
}

.pjah-wrap .pjah-source-card {
  min-height: 170px !important;
}

.pjah-wrap .pjah-mode-card:hover:not(:disabled),
.pjah-wrap .pjah-mode-card.is-selected {
  border-color: #2563eb !important;
  background: #eff6ff !important;
  color: #0f172a !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 18px rgba(37,99,235,.16) !important;
}

.pjah-wrap .pjah-mode-card strong {
  color: #1d4ed8 !important;
  font-size: 1.2rem !important;
  font-weight: 900 !important;
}

.pjah-wrap .pjah-mode-card small {
  color: #666 !important;
  font-size: .92rem !important;
  line-height: 1.35 !important;
  font-weight: 700 !important;
}

.pjah-wrap .pjah-mode-card:hover:not(:disabled) small,
.pjah-wrap .pjah-mode-card.is-selected small {
  color: #334155 !important;
}

.pjah-wrap .pjui-choice-card.is-selected {
  border-color: #2563eb !important;
  background: #eff6ff !important;
  color: #0f172a !important;
  transform: translateY(-2px) !important;
  box-shadow: 0 6px 18px rgba(37,99,235,.16) !important;
}

.pjah-wrap .pjui-choice-card.is-selected strong {
  color: #1d4ed8 !important;
}

.pjah-wrap .pjui-choice-card.is-selected small {
  color: #334155 !important;
}

.pjah-wrap .pjui-choice-card.is-selected .pjui-choice-tag {
  color: #1d4ed8 !important;
}

/* Refuerzo final para la configuracion del ahorcado */
.pjah-wrap .pjah-card {
  background: #fff !important;
  border: 1px solid #dbe7f5 !important;
  border-radius: 16px !important;
  padding: 22px !important;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08) !important;
  color: #1a1a2e !important;
}

.pjah-wrap .pjui-back-track {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: flex-start !important;
  gap: 12px !important;
  margin: 0 0 18px !important;
}

.pjah-wrap .pjui-back-link {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 46px !important;
  padding: 10px 18px !important;
  border: 2px solid #bfdbfe !important;
  border-radius: 10px !important;
  background: #eff6ff !important;
  color: #2563eb !important;
  font-size: 1rem !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
  text-decoration: none !important;
  box-shadow: none !important;
}

.pjah-wrap .pjui-back-link:hover {
  background: #dbeafe !important;
  border-color: #93c5fd !important;
  color: #1d4ed8 !important;
  transform: translateY(-1px) !important;
}

.pjah-wrap .pjah-setup-top {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  flex-wrap: wrap !important;
  margin: 0 0 16px !important;
}

.pjah-wrap .pjah-mode-pill {
  display: none !important;
  background: #f8fafc !important;
  border: 1px solid #dbe7f5 !important;
  border-radius: 10px !important;
  padding: 9px 12px !important;
  color: #475569 !important;
  font-size: .92rem !important;
  font-weight: 800 !important;
  line-height: 1.35 !important;
}

.pjah-wrap .pjah-mode-pill strong {
  color: #1d4ed8 !important;
  font-weight: 900 !important;
}

.pjah-wrap .pjah-setup-actions {
  display: none !important;
  flex-wrap: wrap !important;
  gap: 10px !important;
  margin-left: auto !important;
}

.pjah-wrap .pjah-config-section {
  padding: 18px 0 !important;
  border-bottom: 1px solid #e8eef7 !important;
}

.pjah-wrap .pjah-config-section:first-child {
  padding-top: 0 !important;
}

.pjah-wrap .pjah-config-section:last-of-type {
  border-bottom: none !important;
}

.pjah-wrap .pjah-config-head {
  display: flex !important;
  align-items: flex-start !important;
  gap: 12px !important;
  margin: 0 0 16px !important;
}

.pjah-wrap .pjah-config-head > span {
  width: 30px !important;
  height: 30px !important;
  flex: 0 0 30px !important;
  border-radius: 9px !important;
  background: #2563eb !important;
  color: #fff !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: .95rem !important;
  font-weight: 900 !important;
}

.pjah-wrap .pjah-config-head strong {
  display: block !important;
  margin: 0 0 4px !important;
  color: #0f172a !important;
  font-size: 1.08rem !important;
  font-weight: 900 !important;
  line-height: 1.2 !important;
}

.pjah-wrap .pjah-config-head small {
  display: block !important;
  margin: 0 !important;
  color: #64748b !important;
  font-size: .92rem !important;
  font-weight: 700 !important;
  line-height: 1.45 !important;
}

.pjah-wrap .pjah-label {
  display: block !important;
  margin: 0 0 6px !important;
  color: #334155 !important;
  font-size: .8rem !important;
  font-weight: 800 !important;
  letter-spacing: .04em !important;
  text-transform: uppercase !important;
}

.pjah-wrap .pjah-field {
  margin-bottom: 14px !important;
}

.pjah-wrap .pjah-input,
.pjah-wrap .pjah-textarea,
.pjah-wrap .pjah-select {
  width: 100% !important;
  min-height: 46px !important;
  padding: 10px 12px !important;
  border: 2px solid #dbe7f5 !important;
  border-radius: 10px !important;
  background: #f8fafc !important;
  color: #0f172a !important;
  font-size: 1rem !important;
  box-shadow: none !important;
}

.pjah-wrap .pjah-textarea {
  min-height: 140px !important;
}

.pjah-wrap .pjah-input:focus,
.pjah-wrap .pjah-textarea:focus,
.pjah-wrap .pjah-select:focus {
  border-color: #60a5fa !important;
  background: #fff !important;
}

.pjah-wrap .pjah-help {
  margin: -4px 0 14px !important;
  color: #64748b !important;
  font-size: .9rem !important;
  font-weight: 700 !important;
  line-height: 1.45 !important;
}

.pjah-wrap .pjah-auto-options {
  padding: 16px !important;
  margin: 0 0 14px !important;
  border: 2px solid #dbeafe !important;
  border-radius: 12px !important;
  background: #f8fbff !important;
}

.pjah-wrap .pjah-btn.pjah-btn-green {
  background: #16a34a !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 6px 16px rgba(22, 163, 74, 0.24) !important;
}

.pjah-wrap .pjah-btn.pjah-btn-green:hover {
  background: #15803d !important;
}
