/* ==============================================================================
   QTable 2.0 – Kompletny arkusz stylów (Kosmiczna Przygoda / OVH Production)
   Paleta: #0B1026 | #211A4A | #35216A | #35B9D7 | #E4499B | #FFCB38 | #E9F5FF
   ============================================================================== */

.hidden { display: none !important; }
* { -webkit-tap-highlight-color: transparent; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
input, textarea, select, code, pre { user-select: text; -webkit-user-select: text; }
html, body {
  overscroll-behavior: none;
  touch-action: manipulation;
  margin: 0;
  padding: 0;
  min-height: 100dvh;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #E9F5FF;
}
#starfield { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }

/* === ANIMACJE PODSTAWOWE === */
@keyframes popIn { 0% { transform: scale(0.88); opacity: 0; } 70% { transform: scale(1.03); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes levelUpZoom { 0% { transform: scale(0.3) rotate(-12deg); opacity: 0; } 50% { transform: scale(1.12) rotate(3deg); opacity: 1; } 75% { transform: scale(0.96) rotate(-1deg); } 100% { transform: scale(1) rotate(0deg); opacity: 1; } }
@keyframes raysSpin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-10px) rotate(-2deg); } 40% { transform: translateX(10px) rotate(2deg); } 60% { transform: translateX(-8px) rotate(-1deg); } 80% { transform: translateX(8px) rotate(1deg); } }
@keyframes monsterHit { 0% { transform: scale(1) rotate(0deg); } 20% { transform: scale(0.78, 1.18) translateX(12px) rotate(12deg); filter: brightness(1.5); } 55% { transform: scale(1.14, 0.86) translateX(-5px) rotate(-8deg); } 100% { transform: scale(1) rotate(0deg); } }
@keyframes monsterDefeat { 0% { transform: scale(1) rotate(0deg); opacity: 1; filter: brightness(1.2); } 25% { transform: scale(1.18) rotate(-25deg); filter: brightness(1.8); } 65% { transform: scale(0.7) rotate(380deg); opacity: 0.85; } 100% { transform: scale(0.05) rotate(720deg); opacity: 0; } }
@keyframes monsterEnter { 0% { transform: scale(0.55) translateY(-28px); opacity: 0; } 65% { transform: scale(1.06) translateY(4px); opacity: 1; } 100% { transform: scale(1) translateY(0); opacity: 1; } }
@keyframes monsterAttack { 0%, 100% { transform: translateX(0) scale(1); } 35% { transform: translateX(-16px) scale(1.08) rotate(-5deg); } 70% { transform: translateX(5px) scale(0.97); } }
@keyframes monsterWeak { 0%, 100% { transform: translateY(0) rotate(-1.5deg); opacity: 0.92; } 50% { transform: translateY(4px) rotate(1.5deg); opacity: 1; } }
@keyframes dizzySpin { 0% { transform: rotate(0deg) scale(0.8); opacity: 0; } 30% { transform: rotate(120deg) scale(1.2); opacity: 1; } 100% { transform: rotate(360deg) scale(1); opacity: 1; } }
@keyframes avatarRecoil { 0% { transform: translateX(0) scale(1); } 30% { transform: translateX(-9px) scale(1.1); filter: brightness(1.3); } 100% { transform: translateX(0) scale(1); } }
@keyframes avatarHurt { 0%, 100% { transform: translateX(0); filter: none; } 25% { transform: translateX(-8px) rotate(-8deg); filter: drop-shadow(0 0 12px #f43f5e) brightness(1.4); } 60% { transform: translateX(6px) rotate(6deg); } }
@keyframes laserShoot { 0% { transform: translateX(0) scaleX(0.4); opacity: 1; } 60% { transform: translateX(95px) scaleX(1.4); opacity: 1; } 100% { transform: translateX(160px) scaleX(0.2); opacity: 0; } }
@keyframes enemyLaserShoot { 0% { transform: translateX(140px) scaleX(0.4); opacity: 1; } 60% { transform: translateX(45px) scaleX(1.35); opacity: 1; } 100% { transform: translateX(-15px) scaleX(0.2); opacity: 0; } }
@keyframes superBeam { 0% { transform: translateX(0) scaleX(0.2) scaleY(1); opacity: 1; } 50% { transform: translateX(70px) scaleX(2.4) scaleY(2.2); opacity: 1; } 100% { transform: translateX(150px) scaleX(0.6) scaleY(0.5); opacity: 0; } }
@keyframes impactBurst { 0% { transform: scale(0.3) rotate(0deg); opacity: 1; } 60% { transform: scale(1.35) rotate(25deg); opacity: 1; } 100% { transform: scale(1.7) rotate(45deg); opacity: 0; } }
@keyframes flamePulse { 0%, 100% { transform: scale(1) rotate(-2deg); filter: drop-shadow(0 0 8px rgba(249,115,22,0.8)); } 50% { transform: scale(1.14) rotate(2deg); filter: drop-shadow(0 0 18px rgba(234,179,8,1)); } }
@keyframes floatSlow { 0%, 100% { transform: translateY(0px) rotate(-1deg); } 50% { transform: translateY(-6px) rotate(1.5deg); } }
@keyframes dmgFloat { 0% { transform: translateY(0) scale(0.85); opacity: 1; } 100% { transform: translateY(-42px) scale(1.25); opacity: 0; } }
@keyframes announcerPop { 0% { transform: scale(0.4) rotate(-6deg); opacity: 0; } 25% { transform: scale(1.18) rotate(2deg); opacity: 1; } 75% { transform: scale(1.0) rotate(0deg); opacity: 1; } 100% { transform: scale(1.12) translateY(-14px); opacity: 0; } }

/* === ANIMACJE KONSTELACJI 2.0 I HOLOGRAMÓW BESTIARIUSZA === */
@keyframes starTwinkle { 0%, 100% { opacity: 0.75; transform: scale(1); } 50% { opacity: 1; transform: scale(1.22); } }
@keyframes constellationReveal {
  0% { filter: brightness(0.4) saturate(0.2); transform: scale(0.95); }
  45% { filter: brightness(1.65) saturate(1.4) drop-shadow(0 0 26px rgba(53, 185, 215, 0.85)); transform: scale(1.03); }
  100% { filter: brightness(1) saturate(1); transform: scale(1); }
}
@keyframes holoScan { 0% { transform: translateY(-100%); } 100% { transform: translateY(260%); } }
@keyframes holoGlitch {
  0%, 92%, 100% { transform: translate(0, 0); opacity: 0.92; }
  94% { transform: translate(-2px, 1px); opacity: 0.78; }
  96% { transform: translate(2px, -1px); opacity: 0.96; }
  98% { transform: translate(-1px, 0); opacity: 0.82; }
}
@keyframes bossRevealScan {
  0% { filter: hue-rotate(150deg) brightness(1.8) blur(3px); transform: scale(0.92); }
  50% { filter: hue-rotate(40deg) brightness(1.35) blur(0.5px); transform: scale(1.04); }
  100% { filter: none; transform: scale(1); }
}
@keyframes chronoSpin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.animate-pop { animation: popIn 0.25s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.animate-levelup { animation: levelUpZoom 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.animate-rays { animation: raysSpin 12s linear infinite; }
.animate-shake { animation: shake 0.38s ease-in-out; }
.animate-monster-hit { animation: monsterHit 0.48s ease-out; }
.animate-monster-defeat { animation: monsterDefeat 1.15s cubic-bezier(0.4, 0, 0.2, 1) forwards; }
.animate-monster-enter { animation: monsterEnter 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.animate-monster-attack { animation: monsterAttack 0.42s ease-out; }
.animate-monster-weak { animation: monsterWeak 1.6s ease-in-out infinite; }
.animate-dizzy { animation: dizzySpin 0.8s ease-out infinite; }
.animate-avatar-recoil { animation: avatarRecoil 0.28s ease-out; }
.animate-avatar-hurt { animation: avatarHurt 0.42s ease-out; }
.animate-laser { animation: laserShoot 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-enemy-laser { animation: enemyLaserShoot 0.36s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.animate-super-beam { animation: superBeam 0.6s ease-out forwards; }
.animate-impact { animation: impactBurst 0.42s ease-out forwards; }
.animate-flame { animation: flamePulse 0.65s ease-in-out infinite; }
.animate-float { animation: floatSlow 2.6s ease-in-out infinite; }
.animate-dmg { animation: dmgFloat 0.75s ease-out forwards; }
.animate-announcer { animation: announcerPop 1.35s ease-out forwards; }
.constellation-reveal-anim { animation: constellationReveal 0.85s ease-out forwards; }
.boss-reveal-scan { animation: bossRevealScan 0.95s ease-out forwards; }
.hologram-glitch { animation: holoGlitch 3.8s infinite; }
.hologram-scanline {
  position: absolute;
  inset-x: 0;
  height: 36%;
  background: linear-gradient(180deg, transparent 0%, rgba(53, 185, 215, 0.28) 50%, transparent 100%);
  animation: holoScan 2.8s linear infinite;
  pointer-events: none;
}

.btn-press { transition: transform 0.06s ease, box-shadow 0.06s ease, background-color 0.12s ease; }
.btn-press:active, .btn-press.is-pressed { transform: translateY(3px) scale(0.97); }

/* === SKÓRKI RZADKOŚCI === */
body.skin-cosmic { background: radial-gradient(circle at 38% 42%, #35216A 0%, #211A4A 38%, #0B1026 85%); color: #E9F5FF; }
body.skin-uncommon { background: radial-gradient(circle at 20% 20%, #064e3b 0%, #0f172a 55%, #022c22 100%); }
body.skin-uncommon .cosmic-card { border-color: rgba(52, 211, 153, 0.45) !important; box-shadow: 0 0 22px rgba(16, 185, 129, 0.12); }
body.skin-rare { background: radial-gradient(circle at 20% 20%, #0c4a6e 0%, #0f172a 55%, #082f49 100%); }
body.skin-rare .cosmic-card { border-color: rgba(56, 189, 248, 0.5) !important; box-shadow: 0 0 24px rgba(14, 165, 233, 0.15); }
body.skin-epic { background: radial-gradient(circle at 25% 20%, #581c87 0%, #1e1b4b 55%, #0f0720 100%); }
body.skin-epic .cosmic-card { border-color: rgba(217, 70, 239, 0.52) !important; box-shadow: 0 0 26px rgba(192, 38, 211, 0.16); }
body.skin-legendary { background: radial-gradient(circle at 25% 15%, #78350f 0%, #3b1d5e 50%, #090d1f 100%); }
body.skin-legendary .cosmic-card { border-color: rgba(250, 204, 21, 0.58) !important; box-shadow: 0 0 28px rgba(250, 204, 21, 0.18); }
body.skin-mythic { background: radial-gradient(circle at 20% 20%, #701a75 0%, #311042 40%, #092230 80%, #020617 100%); }
body.skin-mythic .cosmic-card { border-color: rgba(244, 114, 182, 0.65) !important; box-shadow: 0 0 30px rgba(34, 211, 238, 0.2), inset 0 0 14px rgba(250, 204, 21, 0.1); }

#app {
  padding-top: max(0.5rem, env(safe-area-inset-top));
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  padding-left: max(0.65rem, env(safe-area-inset-left));
  padding-right: max(0.65rem, env(safe-area-inset-right));
}

/* === LOBBY WARIANT A === */
.qtable-topbar {
  background: linear-gradient(180deg, rgba(33, 26, 74, 0.88) 0%, rgba(11, 16, 38, 0.92) 100%);
  border: 1.5px solid rgba(53, 185, 215, 0.45);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}
.qtable-lobby-stage {
  background: radial-gradient(circle at 42% 48%, rgba(53, 33, 106, 0.55) 0%, rgba(11, 16, 38, 0.25) 70%);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.qtable-menu-pill {
  background: linear-gradient(90deg, rgba(33, 26, 74, 0.92) 0%, rgba(22, 19, 58, 0.86) 100%);
  border: 1.5px solid rgba(233, 245, 255, 0.18);
  color: #E9F5FF;
  transition: transform 0.12s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.qtable-menu-pill:hover, .qtable-menu-pill:focus-visible {
  transform: translateX(-4px);
  border-color: #35B9D7;
  box-shadow: 0 0 18px rgba(53, 185, 215, 0.35);
  background: linear-gradient(90deg, rgba(53, 33, 106, 0.96) 0%, rgba(33, 26, 74, 0.94) 100%);
  outline: none;
}
.qtable-menu-pill.is-primary {
  background: linear-gradient(90deg, rgba(21, 94, 117, 0.92) 0%, rgba(33, 26, 74, 0.94) 100%);
  border: 2px solid #35B9D7;
  box-shadow: 0 0 24px rgba(53, 185, 215, 0.45), inset 0 0 12px rgba(53, 185, 215, 0.2);
}
.qtable-menu-pill.is-primary:hover { box-shadow: 0 0 30px rgba(53, 185, 215, 0.7); filter: brightness(1.08); }
.qtable-menu-icon {
  width: 38px; height: 38px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; flex-shrink: 0;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.25), 0 2px 8px rgba(0, 0, 0, 0.35);
}
.qtable-bottom-dock {
  background: linear-gradient(180deg, rgba(33, 26, 74, 0.86) 0%, rgba(11, 16, 38, 0.95) 100%);
  border: 1.5px solid rgba(53, 185, 215, 0.35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.qtable-dock-chip {
  background: rgba(11, 16, 38, 0.65);
  border: 1px solid rgba(233, 245, 255, 0.16);
  transition: border-color 0.15s ease, transform 0.12s ease, background 0.15s ease;
}
.qtable-dock-chip:hover { border-color: #35B9D7; background: rgba(53, 33, 106, 0.65); transform: translateY(-2px); }

/* === KONSTELACJE 2.0 – DUŻE PIONOWE KARTY KOLEKCJONERSKIE === */
.constellation-card {
  position: relative;
  border-radius: 1.25rem;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  background: linear-gradient(165deg, rgba(33, 26, 74, 0.92) 0%, rgba(11, 16, 38, 0.98) 100%);
  border: 2px solid rgba(233, 245, 255, 0.14);
}
.constellation-card:hover { transform: translateY(-4px); border-color: rgba(53, 185, 215, 0.65); }
.constellation-card.is-selected {
  border-color: #35B9D7;
  box-shadow: 0 0 0 2px rgba(53, 185, 215, 0.35), 0 12px 28px rgba(0, 0, 0, 0.5);
}
.constellation-card.is-active {
  border-color: #FFCB38;
  box-shadow: 0 0 22px rgba(255, 203, 56, 0.35), inset 0 0 16px rgba(53, 185, 215, 0.18);
}
.constellation-card.is-locked {
  background: linear-gradient(170deg, rgba(15, 20, 44, 0.95) 0%, rgba(7, 10, 24, 0.98) 100%);
  border-color: rgba(148, 163, 184, 0.2);
}
.constellation-card.is-unlocked::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(125deg, rgba(53, 185, 215, 0.1) 0%, transparent 45%, rgba(228, 73, 155, 0.1) 100%);
}

/* === BESTIARIUSZ 2.0 – GALERIA RPG + HOLOGRAM === */
.bestiary-item {
  background: rgba(11, 16, 38, 0.72);
  border: 1.5px solid rgba(233, 245, 255, 0.14);
  transition: transform 0.12s ease, border-color 0.18s ease, background 0.18s ease;
}
.bestiary-item:hover { border-color: rgba(228, 73, 155, 0.65); background: rgba(53, 33, 106, 0.6); }
.bestiary-item.is-selected {
  border-color: #35B9D7;
  background: linear-gradient(90deg, rgba(53, 33, 106, 0.92), rgba(33, 26, 74, 0.92));
  box-shadow: 0 0 18px rgba(53, 185, 215, 0.35);
}
.bestiary-stage-panel {
  background: radial-gradient(circle at 50% 35%, rgba(53, 33, 106, 0.78) 0%, rgba(33, 26, 74, 0.92) 55%, rgba(11, 16, 38, 0.98) 100%);
  border: 2px solid rgba(53, 185, 215, 0.42);
}

/* === RESPONSIVE & LANDSCAPE === */
@media (max-width: 767px) {
  body.in-game #appHeader { margin-bottom: 0.35rem; }
  body.in-game #screenGame { gap: 0.45rem; }
}
@media (orientation: landscape) and (max-height: 560px) {
  body.in-game #appHeader { display: none; }
  body.in-game #screenGame { gap: 0.35rem; }
  body.in-game #gameMainGrid { grid-template-columns: repeat(12, minmax(0, 1fr)) !important; gap: 0.5rem !important; }
  body.in-game #questionCard, body.in-game #numpadCard { grid-column: span 6 / span 6 !important; padding: 0.5rem !important; }
  body.in-game #bossArena { padding: 0.35rem !important; margin-bottom: 0.25rem !important; }
  body.in-game #playerAvatarShooter { width: 2.75rem !important; height: 2.75rem !important; }
  body.in-game #bossSpriteWrap { width: 3rem !important; height: 3rem !important; }
  body.in-game #equationDisplay { font-size: 1.85rem !important; line-height: 2.1rem !important; margin: 0.1rem 0 !important; }
  body.in-game #answerBox { min-height: 2.6rem !important; font-size: 1.65rem !important; margin-top: 0.15rem !important; }
  body.in-game #feedbackBanner { min-height: 1.25rem !important; margin-top: 0.15rem !important; font-size: 0.7rem !important; padding: 0.1rem 0.5rem !important; }
  body.in-game .numpad-btn { min-height: 2.5rem !important; font-size: 1.35rem !important; }
}

/* === PREFERS-REDUCED-MOTION (DOSTĘPNOŚĆ I SŁABSZE TELEFONY) === */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .hologram-scanline { display: none !important; }
}
