/* --- Chispa y Gota --- */
.coop { --night: #120c16; }
.coop canvas.ico { display: block; image-rendering: crisp-edges; image-rendering: pixelated; flex: none; }

/* HUD: stickers con fuente pixel */
.coop-hud { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin: 0 auto 18px; }
.coop .chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 8px; min-height: 42px;
  font-family: var(--pixel); font-size: 1.25rem; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap;
  background: var(--sheet); border: var(--stroke); border-radius: 10px; box-shadow: var(--shadow);
}
.coop .chip.lvl { background: var(--sun); transform: rotate(-2deg); font-size: 1.35rem; padding-right: 14px; }
.coop .chip.gem { background: #ffd6de; }
.coop .chip.skull { background: #e7defa; }
.coop .chips { display: flex; gap: 10px; flex-wrap: wrap; }
.coop .chips .chip:nth-child(2) { transform: rotate(1.5deg); }
.coop .chip.bump { animation: coop-bump .45s var(--ease-pop); }
@keyframes coop-bump { 40% { transform: scale(1.18) rotate(-4deg); } }

.coop .duo { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.coop .tag {
  display: inline-flex; align-items: center; gap: 8px; padding: 3px 14px 3px 6px; min-height: 42px;
  border: var(--stroke); border-radius: 10px; box-shadow: var(--shadow);
}
.coop .tag.fire { background: #ffd0c4; transform: rotate(-1deg); }
.coop .tag.water { background: #cdd9ff; transform: rotate(1deg); }
.coop .tag small { display: block; font-family: var(--pixel); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; line-height: 1; color: var(--ink-soft); }
.coop .tag b { display: block; max-width: 13ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.15; }
.coop .tag.me { outline: 3px dashed var(--ink); outline-offset: 3px; }

/* marco del escenario: sticker con cinta */
.coop .stage { display: flex; justify-content: center; }
.coop .frame {
  position: relative; line-height: 0; background: var(--night);
  border: 4px solid var(--ink); border-radius: 8px; box-shadow: var(--shadow-lg);
}
.coop .frame::before, .coop .frame::after {
  content: ''; position: absolute; top: -14px; width: 92px; height: 26px; z-index: 2; pointer-events: none;
  background: #ffe28acc; border-left: 2px dashed #0002; border-right: 2px dashed #0002;
}
.coop .frame::before { left: -24px; transform: rotate(-24deg); }
.coop .frame::after { right: -24px; transform: rotate(22deg); background: #ffc2ddcc; }
.coop canvas.view {
  display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 4px;
  image-rendering: crisp-edges; image-rendering: pixelated;
}

.coop .banner {
  position: absolute; left: 50%; top: 40%; z-index: 3; pointer-events: none; white-space: nowrap;
  font-family: var(--pixel); font-size: clamp(1.4rem, 3.6vw, 2.6rem); line-height: 1.1; letter-spacing: .02em;
  padding: 10px 26px 12px; border: 4px solid var(--ink); border-radius: 10px; box-shadow: 6px 6px 0 var(--ink);
  transform: translate(-50%, -50%) rotate(-3deg); animation: coop-pop .5s var(--ease-pop) both;
}
.coop .banner.win { background: var(--sun); color: var(--ink); }
.coop .banner.dead { background: var(--tomato); color: #fff; transform: translate(-50%, -50%) rotate(2deg); }
.coop .banner.lvl { background: var(--sheet); color: var(--ink); top: 22%; transform: translate(-50%, -50%) rotate(-1.5deg); }
.coop .banner[hidden] { display: none; }
@keyframes coop-pop { from { transform: translate(-50%, -50%) scale(.4) rotate(-12deg); opacity: 0; } }

/* ayuda: rol + teclas como teclitas */
.coop .help { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 22px; margin: 22px auto 0; max-width: 940px; text-align: center; }
.coop .role {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 14px 4px 6px; min-height: 40px; font-weight: 800;
  background: var(--sheet); border: var(--stroke); border-radius: 10px; box-shadow: var(--shadow);
}
.coop .role.fire { background: #ffd0c4; }
.coop .role.water { background: #cdd9ff; }
.coop .role.spec { padding-left: 14px; }
.coop .keys { display: inline-flex; align-items: center; flex-wrap: wrap; justify-content: center; gap: 5px; font-weight: 700; }
.coop .keys em { font-style: normal; color: var(--ink-soft); margin: 0 6px; }
.coop kbd {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 7px;
  font-family: var(--pixel); font-size: 1rem; line-height: 1;
  background: var(--sheet); border: 2px solid var(--ink); border-bottom-width: 5px; border-radius: 7px;
}
.coop kbd.wide { min-width: 76px; }
.coop .hint { flex-basis: 100%; color: var(--ink-soft); font-size: .95rem; }

.coop-stats { list-style: none; padding: 0; margin: 0 0 20px; font-size: 1.15rem; line-height: 1.8; }

@media (max-width: 760px) {
  .coop-hud { justify-content: center; }
  .coop .frame::before, .coop .frame::after { display: none; }
}

/* --- controles táctiles (tablet) --- */
.coop .tc-toggle { padding: 6px 12px; font-size: .85rem; box-shadow: 2px 2px 0 var(--ink); }
.coop .tc-toggle[aria-pressed="true"] { background: var(--sun); }
.coop.spec .tc-toggle, .coop.spec .tpad { display: none !important; }
.coop.touch { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.coop.touch .stage, .coop.touch canvas.view { touch-action: none; }
.coop.touch .stage { max-width: none; } /* la regla global de .stage (pintar) achica de más en tablet */
.coop.touch .help .keys { display: none; }
.coop .tpad { display: none; }
.coop.touch .tpad {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 18px auto 0; max-width: 980px;
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
/* horizontal: un pulgar a cada lado, pegados abajo */
.coop.touch.land .tpad {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; margin: 0; max-width: none; pointer-events: none;
  padding: 0 max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}
.coop.touch.land .tpad > * { pointer-events: auto; }
.coop .tp-move { display: flex; gap: 12px; padding: 6px; margin: -6px; touch-action: none; }
.coop .tp-key {
  position: relative; width: 84px; height: 84px; display: grid; place-items: center; color: var(--sheet); touch-action: none;
  background: color-mix(in srgb, var(--sheet) 82%, transparent); border: var(--stroke); border-radius: var(--r); box-shadow: var(--shadow);
  transition: transform .08s, box-shadow .08s, background-color .08s;
}
.coop .tp-key:nth-child(1) { transform: rotate(-2deg); }
.coop .tp-key:nth-child(2) { transform: rotate(1.5deg); }
.coop .tp-key svg { width: 44px; height: 44px; pointer-events: none; }
.coop .tp-key.on { background: var(--sun); box-shadow: 0 0 0 var(--ink); transform: translate(4px, 4px); }
.coop .tp-jump { width: 104px; height: 104px; border-radius: 50%; gap: 0; align-content: center; background: color-mix(in srgb, var(--tomato) 85%, transparent); transform: rotate(3deg); }
.coop .tp-jump svg { width: 46px; height: 46px; }
.coop .tp-jump small { font-family: var(--pixel); font-size: .85rem; line-height: 1; color: #fff; pointer-events: none; }
.coop .tp-jump.on { background: var(--tomato); transform: translate(4px, 4px) scale(.96); }
.coop .tp-rot {
  display: none; margin: 0 0 6px; padding: 6px 12px; font-weight: 800; font-size: .92rem; text-align: center; max-width: 260px;
  background: var(--sun); border: var(--stroke); border-radius: var(--r-sm); box-shadow: var(--shadow); transform: rotate(-2deg);
}
.coop.touch:not(.land) .tp-rot { display: block; animation: coop-rot .5s var(--ease-pop) both; }
@keyframes coop-rot { from { transform: scale(.5) rotate(-10deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .coop .tp-key { transition: none; }
  .coop.touch:not(.land) .tp-rot { animation: none; }
}
