/* KILLINCHO AVENTURAS · estilo de las ventanas y los botones.
 * Colores de aguayo sobre un azul de noche andina. */
:root {
  --kk-bajo: 0px;
  --tinta: #1b1830;
  --panel: #241f3d;
  --panel2: #2f2850;
  --borde: #3d3566;
  --oro: #f2c230;
  --oro2: #ffd95e;
  --texto: #f6f2ff;
  --suave: #b9b0d9;
  --bien: #2fae5a;
  --mal: #e0573a;
  --aguayo: repeating-linear-gradient(90deg, #e2245b 0 14px, #f7931e 14px 28px, #f2c230 28px 42px, #2fae5a 42px 56px, #2b6fd6 56px 70px, #7b3fb8 70px 84px);
  --letra: 'Baloo 2', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #10121c; color: var(--texto);
  font-family: var(--letra); -webkit-user-select: none; user-select: none;
  touch-action: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
#kk-lienzo { position: fixed; inset: 0; display: block; image-rendering: pixelated; }

/* ── Botones de arriba (solo jugando) ────────────────────────────────── */
#kk-arriba { position: fixed; top: max(6px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); display: none; gap: 6px; z-index: 3; }
#kk-nivel-nombre { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.kk-en-juego #kk-arriba { display: flex; }
.kk-icono {
  width: 40px; height: 40px; border-radius: 12px; border: 2px solid rgba(255,255,255,.35);
  background: rgba(20,16,40,.55); color: #fff; font-size: 18px; line-height: 1; cursor: pointer;
}
.kk-icono:active { transform: scale(.94); }

/* ── Botones táctiles ────────────────────────────────────────────────── */
#kk-tactiles { display: none; }
.kk-tactil.kk-en-juego #kk-tactiles { display: block; }
.kk-cruz { position: fixed; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); display: flex; gap: 14px; z-index: 3; }
.kk-t {
  width: 72px; height: 72px; border-radius: 50%; border: 3px solid rgba(255,255,255,.5);
  background: rgba(20,16,40,.42); color: rgba(255,255,255,.92); font-size: 26px; font-family: var(--letra);
  touch-action: none; -webkit-user-select: none; user-select: none; cursor: pointer;
}
.kk-t.on { background: rgba(242,194,48,.6); border-color: #fff; transform: scale(.95); }
.kk-t-salto { position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); width: 88px; height: 88px; font-size: 30px; z-index: 3; }
@media (orientation: portrait) {
  .kk-t { width: 80px; height: 80px; }
  .kk-t-salto { width: 96px; height: 96px; }
}

/* ── Capa de ventanas ────────────────────────────────────────────────── */
#kk-capa {
  position: fixed; inset: 0; display: none; align-items: center; justify-content: center;
  padding: max(10px, env(safe-area-inset-top)) 12px 10px; background: rgba(10, 8, 22, .5); z-index: 5;
  touch-action: auto;
}
#kk-capa.on { display: flex; }
.kk-ventana {
  position: relative; width: 100%; max-width: 520px; max-height: 100%; overflow: auto;
  background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 2px solid var(--borde);
  border-radius: 18px; padding: 22px 20px 18px; box-shadow: 0 18px 50px rgba(0,0,0,.5);
  -webkit-user-select: text; user-select: text; touch-action: pan-y; animation: kk-entra .18s ease-out;
}
.kk-ventana::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 7px; background: var(--aguayo);
  border-radius: 16px 16px 0 0;
}
.kk-ventana.kk-ancha { max-width: 760px; }
@keyframes kk-entra { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.kk-ventana h2 { margin: 2px 0 10px; font-size: 26px; line-height: 1.1; color: var(--oro2); font-weight: 800; }
.kk-ventana p { margin: 6px 0; font-size: 17px; line-height: 1.35; }
.kk-nota { color: var(--suave); font-size: 15px !important; }

/* Portada */
.kk-portada { text-align: center; background: linear-gradient(180deg, rgba(47,40,80,.9), rgba(36,31,61,.92)); }
.kk-titulo { margin: 4px 0 0; line-height: .9; font-weight: 800; letter-spacing: .5px; }
.kk-titulo span {
  display: block; font-size: clamp(38px, 9vw, 64px); color: var(--oro);
  text-shadow: 0 3px 0 #b5790a, 0 6px 0 #6e4304, 0 10px 18px rgba(0,0,0,.5);
}
.kk-titulo small { display: block; font-size: clamp(20px, 4.6vw, 30px); color: #fff; letter-spacing: 6px; margin-top: 8px; text-shadow: 0 2px 0 #7b3fb8; }
.kk-sub { color: var(--suave); margin: 8px 0 12px !important; font-size: 15px !important; }
.kk-quien { background: rgba(0,0,0,.22); border-radius: 12px; padding: 8px 12px; font-size: 15px; margin: 6px 0 12px; }
.kk-quien b { color: var(--oro2); }

/* Botones */
.kk-botones { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 14px; }
.kk-botones.col { flex-direction: column; align-items: stretch; }
.kk-b {
  font-family: var(--letra); font-size: 17px; font-weight: 700; color: #fff; cursor: pointer;
  background: #3a3266; border: 2px solid #574c94; border-radius: 12px; padding: 9px 16px; min-height: 46px;
}
.kk-b:hover, .kk-b:focus-visible { background: #463d7a; outline: none; border-color: var(--oro); }
.kk-b:active { transform: translateY(1px); }
.kk-b.grande { background: linear-gradient(180deg, #ffd95e, #f2b51a); color: #3a2400; border-color: #a86d00; font-size: 20px; padding: 10px 22px; box-shadow: 0 4px 0 #8a5600; }
.kk-b.grande:hover, .kk-b.grande:focus-visible { background: linear-gradient(180deg, #ffe58a, #f7c23a); }
.kk-b:disabled { opacity: .55; cursor: default; }
.kk-mini { font-family: var(--letra); font-size: 13px; background: none; border: 1px solid rgba(255,255,255,.3); color: var(--suave); border-radius: 8px; padding: 1px 8px; margin-left: 6px; cursor: pointer; }
.kk-lista { margin: 0; padding-left: 20px; font-size: 16px; line-height: 1.4; }
.kk-lista li { margin: 5px 0; }
.kk-lista b { color: var(--oro2); }

/* DNI */
.kk-entrada {
  display: block; width: 100%; max-width: 280px; margin: 12px auto 4px; padding: 10px 14px;
  font-family: var(--letra); font-size: 30px; letter-spacing: 6px; text-align: center; font-weight: 700;
  border-radius: 12px; border: 3px solid var(--borde); background: #15122a; color: #fff; -webkit-user-select: text; user-select: text;
}
.kk-entrada:focus { outline: none; border-color: var(--oro); }
.kk-error { color: #ff9a85; min-height: 22px; text-align: center; font-size: 16px; }
.kk-tarjeta { background: #15122a; border: 2px solid var(--oro); border-radius: 14px; padding: 14px; text-align: center; font-size: 18px; color: var(--suave); }
.kk-tarjeta-nom { font-size: 30px; font-weight: 800; color: #fff; }

/* Mapa de niveles */
.kk-mundos { display: flex; flex-direction: column; gap: 10px; }
.kk-mundo-nom { font-weight: 700; color: var(--oro2); margin-bottom: 4px; font-size: 16px; }
.kk-celdas { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; }
.kk-celda {
  position: relative; aspect-ratio: 1; min-width: 0; border-radius: 9px; border: 2px solid #574c94; background: #3a3266;
  color: #fff; font-family: var(--letra); font-weight: 800; font-size: 16px; cursor: pointer; padding: 0;
}
.kk-celda.hecho { background: #1f6b3d; border-color: #2fae5a; }
.kk-celda.cerrado { background: #1d1934; border-color: #2c2650; color: #6d6699; cursor: default; }
.kk-celda:not(.cerrado):hover { border-color: var(--oro); }
.kk-celda i { position: absolute; left: 0; right: 0; bottom: 1px; font-style: normal; font-size: 9px; font-weight: 600; color: #bdf0cf; }
@media (max-width: 520px) { .kk-celdas { grid-template-columns: repeat(5, 1fr); } }

/* Preguntas */
.kk-pregunta { max-width: 640px; }
.kk-preg-cab { font-size: 14px; color: var(--suave); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; }
.kk-preg-txt { font-size: clamp(20px, 3.4vw, 26px); line-height: 1.25; font-weight: 700; margin: 8px 0 14px; color: #fff; }
.kk-alts { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
@media (max-width: 560px) { .kk-alts { grid-template-columns: 1fr; } }
.kk-alt {
  display: flex; align-items: center; gap: 10px; text-align: left; font-family: var(--letra);
  font-size: 18px; font-weight: 600; line-height: 1.2; color: #fff; background: #3a3266;
  border: 2px solid #574c94; border-radius: 12px; padding: 10px 12px; min-height: 54px; cursor: pointer;
}
.kk-alt span { flex: none; width: 30px; height: 30px; border-radius: 8px; background: var(--oro); color: #3a2400; display: grid; place-items: center; font-weight: 800; }
.kk-alt:hover:not(:disabled), .kk-alt:focus-visible { border-color: var(--oro); background: #463d7a; outline: none; }
.kk-alt:disabled { cursor: default; }
.kk-alt.elegida { border-color: #fff; }
.kk-alt.bien { background: #1f6b3d; border-color: var(--bien); }
.kk-alt.bien span { background: var(--bien); color: #fff; }
.kk-alt.mal { background: #6e2a1f; border-color: var(--mal); }
.kk-alt.mal span { background: var(--mal); color: #fff; }
.kk-preg-pie { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 12px; min-height: 46px; font-size: 18px; }
.kk-preg-pie .ok { color: #7ee3a0; } .kk-preg-pie .no { color: #ffab95; }

/* Cuenta de puntos y ranking */
.kk-cuenta { width: 100%; border-collapse: collapse; font-size: 17px; }
.kk-cuenta td { padding: 5px 4px; border-bottom: 1px dashed rgba(255,255,255,.12); }
.kk-cuenta td:last-child { text-align: right; font-weight: 700; color: var(--oro2); }
.kk-cuenta td:nth-child(2) { color: var(--suave); text-align: right; }
.kk-cuenta tr.tot td { font-size: 21px; border-bottom: 0; padding-top: 8px; font-weight: 800; color: #fff; }
.kk-record { color: var(--oro2); font-weight: 800; text-align: center; font-size: 19px !important; }
.kk-fin { font-size: 18px; } .kk-fin b { color: var(--oro2); }
.kk-select { font-family: var(--letra); font-size: 16px; padding: 6px 10px; border-radius: 10px; background: #15122a; color: #fff; border: 2px solid var(--borde); margin-bottom: 8px; }
.kk-tabla-caja { max-height: min(46vh, 420px); overflow: auto; border-radius: 12px; border: 1px solid var(--borde); }
.kk-tabla { width: 100%; border-collapse: collapse; font-size: 16px; }
.kk-tabla th { position: sticky; top: 0; background: #1b1732; color: var(--suave); font-weight: 700; text-align: left; padding: 7px 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.kk-tabla td { padding: 7px 8px; border-top: 1px solid rgba(255,255,255,.06); }
.kk-tabla td:first-child { width: 40px; text-align: center; font-weight: 800; }
.kk-tabla td:last-child, .kk-tabla th:last-child { text-align: right; font-weight: 800; color: var(--oro2); }
.kk-tabla td:nth-child(4), .kk-tabla th:nth-child(4) { text-align: center; }
.kk-tabla tr.yo td { background: rgba(242,194,48,.18); }
.kk-vacio { text-align: center; color: var(--suave); padding: 18px !important; }
.kk-aviso { position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); background: #6e2a1f; color: #fff; padding: 8px 14px; border-radius: 10px; font-size: 15px; z-index: 9; }
.kk-pie { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: space-between; margin-top: 16px; font-size: 14px; }
.kk-pie a { color: var(--suave); text-decoration: none; }
.kk-pie a:hover { color: var(--oro2); }
.kk-mundo-nuevo { font-size: 12px; color: var(--suave); margin: -2px 0 6px; }
.kk-pie .kk-version { color: var(--suave); opacity: .55; font-size: 12px; align-self: center; }

/* ── Versión 5: registro, reloj, banderas, repaso y dos rankings ─────── */
.kk-oculto { display: none !important; }
.kk-gris { color: var(--suave); font-weight: 400; }
.kk-b small { display: block; font-size: 13px; font-weight: 600; opacity: .8; margin-top: 2px; }
.kk-b.grande small { color: #5a3a00; }
.kk-b.grande.kk-b-oro { background: linear-gradient(180deg, #7ee3a0, #2fae5a); color: #08331a; border-color: #1f6b3d; box-shadow: 0 4px 0 #165a31; }
.kk-b.grande.kk-b-oro small { color: #0d4224; }
.kk-b.kk-b-oro:not(.grande) { border-color: var(--bien); margin-top: 8px; }
.kk-etq { display: block; font-size: 15px; font-weight: 700; color: var(--suave); text-align: left; }
.kk-form { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 14px; margin-top: 8px; }
@media (max-width: 560px) { .kk-form { grid-template-columns: 1fr; } }
.kk-form .kk-entrada { max-width: none; font-size: 20px; letter-spacing: 1px; margin: 4px 0 6px; text-align: left; }
.kk-form .kk-pin, .kk-entrada.kk-pin { letter-spacing: 10px; text-align: center; }
#kk-pin-caja { text-align: center; margin-top: 6px; }
#kk-pin-caja .kk-etq { text-align: center; color: var(--oro2); }
.kk-estrellas { float: right; color: var(--oro); letter-spacing: 1px; text-transform: none; }
.kk-repaso { background: rgba(43,111,214,.25); border: 1px solid #2b6fd6; color: #cfe0ff; border-radius: 10px; padding: 5px 10px; margin: 8px 0 0; font-size: 15px; font-weight: 700; }
.kk-reloj { position: relative; height: 22px; margin: 10px 0 0; border-radius: 11px; background: #15122a; border: 2px solid var(--borde); overflow: hidden; }
.kk-reloj i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #2fae5a, #f2c230); transition: width .1s linear; }
.kk-reloj span { position: relative; display: block; text-align: center; font-size: 14px; line-height: 18px; font-weight: 800; color: #fff; text-shadow: 0 1px 2px #000; }
.kk-reloj.poco { border-color: var(--mal); animation: kk-latido .5s ease-in-out infinite alternate; }
.kk-reloj.poco i { background: linear-gradient(90deg, #e0573a, #f7931e); }
@keyframes kk-latido { from { transform: scale(1); } to { transform: scale(1.02); } }
.kk-preg-img { display: block; width: min(240px, 60vw); aspect-ratio: 4 / 3; margin: 0 auto 14px; border-radius: 8px; border: 3px solid #fff; box-shadow: 0 6px 18px rgba(0,0,0,.45); background: #fff; object-fit: cover; }
@media (max-height: 520px) { .kk-preg-img { width: 150px; margin-bottom: 8px; } }
.kk-preg-pie .kk-nota { flex-basis: 100%; order: 3; margin: 0; }
.kk-pestanas { display: flex; gap: 6px; margin: 2px 0 10px; flex-wrap: wrap; }
.kk-pest { font-family: var(--letra); font-size: 16px; font-weight: 700; cursor: pointer; color: var(--suave); background: #15122a; border: 2px solid var(--borde); border-radius: 10px; padding: 6px 12px; }
.kk-pest.on { color: #3a2400; background: var(--oro); border-color: #a86d00; }

/* v6: el mundo final, con los colores de la insignia (azul y amarillo) */
.kk-mundo.final { background: linear-gradient(160deg, #0b4f9c, #063a78); border: 3px solid #f6c700; border-radius: 14px; padding: 10px 12px 12px; box-shadow: 0 0 0 2px #7a5a00 inset; }
.kk-mundo.final .kk-mundo-nom { color: #ffd84a; font-size: 18px; letter-spacing: .3px; }
.kk-mundo.final .kk-mundo-nom::before { content: '🛡️ '; }
.kk-mundo.final .kk-mundo-nuevo { color: #d7e6ff; }
.kk-mundo.final .kk-celda { background: #0d63c4; border-color: #f6c700; }
.kk-mundo.final .kk-celda.hecho { background: #1f6b3d; border-color: #ffd84a; }
.kk-mundo.final .kk-celda.cerrado { background: #0a2f5e; border-color: #2a4f86; color: #7f9ccc; }

/* v6.2: la semana y los puntos para las casas */
.kk-casa { display: inline-block; padding: 0 8px; border-radius: 8px; background: var(--c, #888); color: #fff; font-weight: 800; font-size: 13px; letter-spacing: .6px; line-height: 20px; text-shadow: 0 1px 1px rgba(0,0,0,.45); vertical-align: 1px; white-space: nowrap; }
.kk-sem { background: rgba(47,174,90,.13); border: 1px solid rgba(47,174,90,.55); border-radius: 12px; padding: 7px 12px; font-size: 15px; line-height: 1.35; margin: -4px 0 12px; }
.kk-sem b { color: var(--oro2); }
.kk-sem small { display: block; color: var(--suave); font-size: 13px; margin-top: 2px; }
.kk-sem-ok { text-align: center; font-size: 19px !important; font-weight: 800; color: #7ee3a0; }
.kk-sem-ok b { color: #7ee3a0; }
.kk-sem-info { font-size: 14px !important; color: var(--suave); margin: 0 0 8px !important; }
.kk-sem-info b { color: var(--oro2); }
.kk-pest.kk-pest-sem:not(.on) { border-color: rgba(47,174,90,.7); color: #bdf0cf; }
.kk-tsem td small { display: block; font-size: 12px; color: var(--suave); font-weight: 400; line-height: 1.1; }
.kk-tsem td:nth-child(4), .kk-tsem th:nth-child(4) { text-align: right; white-space: nowrap; }
.kk-tsem td:nth-child(3), .kk-tsem th:nth-child(3) { text-align: center; }
.kk-tsem td:last-child { color: #7ee3a0; white-space: nowrap; }
.kk-tsem td:nth-child(4) { color: var(--oro2); font-weight: 700; }
.kk-pasada { margin-top: 12px; background: rgba(0,0,0,.18); border-radius: 12px; padding: 6px 10px; }
.kk-pasada summary { cursor: pointer; font-weight: 700; color: var(--oro2); font-size: 16px; padding: 4px 0; }
.kk-pasada .kk-tabla-caja { margin-top: 6px; max-height: min(34vh, 320px); }
@media (max-width: 520px) { .kk-tsem { font-size: 14px; } .kk-tsem td, .kk-tsem th { padding: 6px 5px; } }
.kk-tsem td.kk-vacio { white-space: normal; color: var(--suave); font-weight: 400; }
.kk-tsem td:nth-child(2) { white-space: nowrap; }
.kk-casa-pts { display: inline-block; white-space: nowrap; margin: 2px 8px 2px 0; color: var(--oro2); font-weight: 700; }
p.kk-vacio { background: rgba(0,0,0,.18); border-radius: 12px; }
p.kk-vacio b { color: var(--oro2); }
