/* Juegos del día (home): crucigrama + sudoku. Lo maneja js/juegos.js */
.juegos[hidden] { display: none !important; }
.jg-cinta {
  background: var(--navy); color: #fff; border-radius: 4px;
  padding: 16px 22px; margin-bottom: 20px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap;
}
.jg-cinta-saludo { font-family: 'Oswald', sans-serif; font-size: 22px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; margin: 0; line-height: 1.2; }
.jg-cinta-fecha { margin: 2px 0 0; font-size: 14px; opacity: .85; }
.jg-racha { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.jg-cinta-der { display: flex; align-items: center; gap: 12px 30px; flex-wrap: wrap; }
.jg-col { display: grid; gap: 20px; min-width: 0; }
.jg-pts { font-size: 14px; color: #444; }
.jg-pts b { font-family: 'Oswald', sans-serif; font-size: 20px; color: var(--crimson); }
.sube { animation: jg-sube .45s ease-out; display: inline-block; }
@keyframes jg-sube { 0% { transform: scale(1.5); } 100% { transform: scale(1); } }
.jg-mas {
  position: absolute; z-index: 6; pointer-events: none; transform: translateX(-50%);
  font-family: 'Oswald', sans-serif; font-weight: 700; font-size: 22px; color: #23713c;
  text-shadow: 0 1px 0 #fff, 0 0 6px #fff; animation: jg-mas 1.4s ease-out forwards;
}
@keyframes jg-mas { 0% { opacity: 0; margin-top: 0; } 15% { opacity: 1; } 100% { opacity: 0; margin-top: -48px; } }
.jg-msj.aviso { color: #7a5a00; }

/* --- ranking --- */
.rk-lista { list-style: none; margin: 14px 0 0; padding: 0; }
.rk-lista li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 10px; border-bottom: 1px solid #ececec; font-size: 15px; }
.rk-lista li.yo { background: #fde6ee; border-radius: 3px; font-weight: 600; }
.rk-pos { font-family: 'Oswald', sans-serif; font-weight: 700; color: var(--crimson); font-size: 18px; }
.rk-lista li:nth-child(1) .rk-pos { color: #b98a00; }
.rk-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-dias { color: #888; font-size: 12.5px; }
.rk-pts { font-family: 'Oswald', sans-serif; font-weight: 600; font-size: 17px; color: var(--navy); min-width: 52px; text-align: right; }
.rk-vacio, .rk-mi { margin: 14px 0 0; font-size: 14px; color: #555; }
.rk-form { margin-top: 18px; padding-top: 14px; border-top: 1px solid #ececec; }
.rk-etiqueta { font-weight: 600; font-size: 14px; margin: 0 0 8px; }
.rk-form-fila { display: flex; gap: 8px; }
.rk-form-fila select { flex: 1; min-width: 0; padding: 10px 8px; border: 1px solid #b9bfc7; border-radius: 3px; font-size: 15px; font-family: inherit; background: #fff; }
.rk-form-botones { margin-top: 10px; flex-wrap: wrap; }
.rk-nota { margin: 10px 0 0; font-size: 12.5px; color: #6b6b6b; line-height: 1.45; }
.rk-juegas { margin: 16px 0 0; font-size: 14px; }
.jg-racha-n { font-family: 'Oswald', sans-serif; font-size: 34px; font-weight: 700; line-height: 1; }
.jg-racha-t { opacity: .9; max-width: 120px; line-height: 1.25; }

.jg-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.jg-card { position: relative; overflow: hidden; background: #fff; border: 1px solid var(--border); border-radius: 4px; padding: 22px; min-width: 0; }

/* --- reacciones --- */
@keyframes jg-ola {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.22); background-color: #9fd8b0; box-shadow: 0 0 0 3px rgba(61,139,87,.35); }
  100% { transform: scale(1); }
}
.cr-celda.acierto, .su-celda.acierto {
  animation: jg-ola .5s ease-out both;
  animation-delay: calc(var(--i, 0) * var(--p, 55ms));
  z-index: 2;
}
.jg-toast {
  position: absolute; left: 50%; top: 14px; z-index: 5; pointer-events: none;
  transform: translate(-50%, -12px); opacity: 0;
  background: #23713c; color: #fff; border-radius: 30px; padding: 9px 20px;
  font-family: 'Oswald', sans-serif; font-size: 17px; font-weight: 600; letter-spacing: .4px;
  box-shadow: 0 6px 18px rgba(0,0,0,.2); white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis;
  transition: opacity .25s, transform .25s;
}
.jg-toast.grande { font-size: 22px; padding: 12px 26px; background: var(--crimson); top: 40%; }
.jg-toast.ver { opacity: 1; transform: translate(-50%, 0); }
.jg-confeti { position: absolute; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.jg-confeti i {
  position: absolute; top: -14px; width: 8px; height: 13px; border-radius: 2px; opacity: .95;
  animation-name: jg-caer; animation-timing-function: cubic-bezier(.3,.6,.5,1); animation-fill-mode: forwards;
}
@keyframes jg-caer {
  0%   { transform: translate(0, 0) rotate(0); opacity: 1; }
  100% { transform: translate(var(--x, 0), 105vh) rotate(var(--giro, 360deg)); opacity: 0; }
}
/* Quien pide menos movimiento no ve el papel picado; los saltitos y las olas
   son breves y suaves, así que se mantienen para que igual vea que acertó. */
@media (prefers-reduced-motion: reduce) {
  .jg-confeti { display: none; }
  .jg-toast { transition: none; }
  /* style.css apaga todas las animaciones en estos equipos; acá se devuelven
     solo las reacciones breves de acierto (el id gana en especificidad). */
  #juegos .su-celda.salto input, #juegos .cr-celda.salto-cr input { animation-duration: .55s !important; }
  #juegos .jg-mas { animation-duration: 1.4s !important; }
  #juegos .sube { animation-duration: .45s !important; }
}
.jg-card h3 { font-size: 22px; margin: 0 0 4px; color: var(--navy); }
.jg-sub { margin: 0 0 16px; color: #666; font-size: 14px; }
.jg-tema { color: var(--crimson); font-weight: 700; }
.jg-acciones { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-top: 16px; }
.jg-btn {
  font-family: 'Oswald', sans-serif; text-transform: uppercase; letter-spacing: .5px; font-size: 13px; font-weight: 600;
  background: var(--crimson); color: #fff; border: 0; border-radius: 3px; padding: 10px 18px; cursor: pointer;
}
.jg-btn:hover { background: var(--crimson-dark); }
.jg-btn:disabled { background: #b9b9b9; cursor: default; }
.jg-link { background: none; border: 0; padding: 6px 0; cursor: pointer; color: #6b6b6b; font-size: 13px; text-decoration: underline; font-family: inherit; }
.jg-cuenta { color: #6b6b6b; font-size: 13px; }
.jg-msj { margin: 12px 0 0; min-height: 1.5em; font-weight: 600; font-size: 15px; }
.jg-msj.bien { color: #23713c; }
.jg-msj.mal { color: var(--crimson); }

/* --- crucigrama --- */
.cr-actual { background: #f3f5f8; border-left: 4px solid var(--crimson); padding: 10px 14px; margin-bottom: 14px; font-size: 15px; min-height: 46px; }
.cr-grilla { display: grid; gap: 2px; width: 100%; margin: 0 auto; }
.cr-vacia { aspect-ratio: 1; }
.cr-celda { position: relative; aspect-ratio: 1; background: #fff; border: 1.5px solid var(--navy); border-radius: 2px; }
.cr-celda input {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; margin: 0;
  background: transparent; text-align: center; text-transform: uppercase; color: #1d2733;
  font-family: 'Oswald', sans-serif; font-weight: 600; font-size: clamp(13px, 3.4vw, 21px); caret-color: var(--crimson);
  border-radius: 0;
}
.cr-celda input:focus { outline: none; }
.cr-num { position: absolute; top: 1px; left: 2px; font-size: 9px; line-height: 1; color: #555; pointer-events: none; z-index: 1; font-family: 'Open Sans', sans-serif; }
.cr-celda.ok { background: #e3f2e7; border-color: #3d8b57; }
.cr-celda.ok input { color: #1d5c31; }
.cr-celda.sel { background: #fde6ee; }
.cr-celda.ok.sel { background: #d3ecd9; }
.cr-celda:focus-within { background: #f7b9cd; }
.cr-celda.pista input { color: var(--crimson); }
.cr-celda.pista::after { content: ""; position: absolute; right: 2px; top: 2px; width: 5px; height: 5px; border-radius: 50%; background: var(--crimson); }
.cr-celda.mal { background: #ffd6d6; }
.cr-celda.bien { background: #e3f2e7; border-color: #3d8b57; }
.cr-defs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; margin-top: 18px; }
.cr-defs h4 { font-family: 'Oswald', sans-serif; text-transform: uppercase; font-size: 15px; letter-spacing: .5px; margin: 0 0 6px; color: var(--navy); }
.cr-defs ol { list-style: none; margin: 0; padding: 0; }
.cr-defs li { padding: 5px 8px; border-radius: 3px; cursor: pointer; font-size: 14px; line-height: 1.4; }
.cr-defs li:hover { background: #f3f5f8; }
.cr-defs li.sel { background: #fde6ee; }
.cr-defs li.ok { color: #8a8a8a; text-decoration: line-through; }
.cr-defs li b { color: var(--crimson); }

/* --- sudoku --- */
.su-niveles { display: flex; gap: 6px; margin-bottom: 14px; }
.su-niveles button {
  flex: 1; font-family: 'Oswald', sans-serif; text-transform: uppercase; font-size: 13px; letter-spacing: .5px;
  background: #fff; border: 1px solid var(--navy); color: var(--navy); padding: 8px 6px; border-radius: 3px; cursor: pointer;
}
.su-niveles button[aria-pressed="true"] { background: var(--navy); color: #fff; }
.su-grilla { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); max-width: 420px; margin: 0 auto; border: 2.5px solid var(--navy); }
.su-celda { position: relative; aspect-ratio: 1; border-right: 1px solid #c9ced6; border-bottom: 1px solid #c9ced6; background: #fff; }
.su-celda:nth-child(9n) { border-right: 0; }
.su-celda:nth-child(n+73) { border-bottom: 0; }
.su-celda.bd { border-right: 2.5px solid var(--navy); }
.su-celda.bb { border-bottom: 2.5px solid var(--navy); }
.su-celda input {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; padding: 0; margin: 0; background: transparent;
  text-align: center; font-family: 'Oswald', sans-serif; font-size: clamp(16px, 4.2vw, 23px); color: var(--crimson); caret-color: transparent;
  border-radius: 0;
}
.su-celda input:focus { outline: none; }
.su-celda.fija input { color: #1d2733; font-weight: 600; }
/* El fondo verde de lo completado va ANTES de zona / igual / sel, así el gris de
   "filas y columnas que bloquea" y el número seleccionado lo tapan. */
.su-celda.hecha { background: #eef7f0; }
.su-celda.zona { background: #f1f3f7; }
.su-celda.igual { background: #dfe6f0; }
.su-celda.sel { background: #f7b9cd; }
.su-celda.pista input { color: #6b7a8c; }
.su-celda.pista::after { content: ""; position: absolute; right: 3px; top: 3px; width: 5px; height: 5px; border-radius: 50%; background: var(--crimson); }
@keyframes jg-salto { 0% { transform: scale(.4); } 60% { transform: scale(1.4); } 100% { transform: scale(1); } }
.su-celda.salto input {
  animation: jg-salto .55s cubic-bezier(.3, 1.6, .5, 1) both;
  animation-delay: calc(var(--i, 0) * var(--p, 40ms));
}
.su-celda.hecha input { color: #23713c; }
/* crucigrama: las letras de la palabra saltan en cadena */
.cr-celda.salto-cr input {
  animation: jg-salto .55s cubic-bezier(.3, 1.6, .5, 1) both;
  animation-delay: calc(var(--i, 0) * var(--p, 90ms));
}
.su-celda.choque input { color: #d0021b; text-decoration: underline; }
.su-celda.mal { background: #ffd6d6; }
.su-celda.bien { background: #e3f2e7; }

@media (max-width: 900px) {
  .jg-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .jg-card { padding: 16px 12px; }
  .cr-defs { grid-template-columns: 1fr; }
  .cr-grilla { gap: 1px; }
  .cr-num { font-size: 7px; }
  .jg-cinta-saludo { font-size: 19px; }
}
@media (prefers-reduced-motion: no-preference) {
  .cr-celda, .su-celda { transition: background-color .15s; }
}
