
/* =========================================================================
 * MODAL VE DİNAMİK ARAYÜZ GÜVENLİK KURALLARI (CANLI ENJEKSİYON İZOLASYONU)
 * ========================================================================= */
.hidden,
[hidden] {
  display: none !important;
}

#mesa-teacher-admin-modal,
#mesa-ai-modal,
#mesa-lucky-wheel-modal,
#mesa-av-modal,
#mesa-quests-modal,
#mesa-qm-modal,
#mesa-store-modal,
#mesa-teacher-modal,
#mesa-protege-modal,
#mesa-socratic-modal,
#mesa-synapse-modal,
#mesa-diagnostic-modal,
#mesa-stage-map-modal,
#mesa-victory-modal,
#mesa-tutorial-modal {
  display: none;
}

#mesa-teacher-admin-modal:not(.hidden),
#mesa-ai-modal:not(.hidden),
#mesa-lucky-wheel-modal:not(.hidden),
#mesa-av-modal:not(.hidden),
#mesa-quests-modal:not(.hidden),
#mesa-qm-modal:not(.hidden),
#mesa-store-modal:not(.hidden),
#mesa-teacher-modal:not(.hidden),
#mesa-protege-modal:not(.hidden),
#mesa-socratic-modal:not(.hidden),
#mesa-synapse-modal:not(.hidden),
#mesa-diagnostic-modal:not(.hidden),
#mesa-stage-map-modal:not(.hidden),
#mesa-victory-modal:not(.hidden),
#mesa-tutorial-modal:not(.hidden) {
  display: flex;
}

/**
 * =========================================================================
 * POKI ARCADE THEME & JUICE STYLES (v2.0)
 * AAA Web Game Feel: 3D Pushable Buttons, Squishy Physics, Floating Points
 * =========================================================================
 */

/* ── 1. Poki Tarzı 3D Basılabilir Butonlar ── */
.poki-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-weight: 800;
  border-radius: 16px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.08s ease, filter 0.15s ease, box-shadow 0.08s ease;
  touch-action: manipulation;
  border: none;
  text-decoration: none;
}

.poki-btn:active {
  transform: translateY(4px) !important;
  box-shadow: 0 0 0 0 transparent !important;
}

/* Renk Varyantları (4px 3D Alt Gölgeli) */
.poki-btn-green {
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  color: #ffffff;
  box-shadow: 0 5px 0 0 #15803d, 0 8px 15px rgba(22, 163, 74, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.poki-btn-green:hover {
  filter: brightness(1.08);
}

.poki-btn-blue {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  color: #ffffff;
  box-shadow: 0 5px 0 0 #0369a1, 0 8px 15px rgba(2, 132, 199, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.poki-btn-blue:hover {
  filter: brightness(1.08);
}

.poki-btn-amber {
  background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
  color: #ffffff;
  box-shadow: 0 5px 0 0 #b45309, 0 8px 15px rgba(217, 119, 6, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.poki-btn-amber:hover {
  filter: brightness(1.08);
}

.poki-btn-purple {
  background: linear-gradient(180deg, #a855f7 0%, #7e22ce 100%);
  color: #ffffff;
  box-shadow: 0 5px 0 0 #6b21a8, 0 8px 15px rgba(126, 34, 206, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.poki-btn-purple:hover {
  filter: brightness(1.08);
}

.poki-btn-rose {
  background: linear-gradient(180deg, #f43f5e 0%, #e11d48 100%);
  color: #ffffff;
  box-shadow: 0 5px 0 0 #be123c, 0 8px 15px rgba(225, 29, 72, 0.4);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.poki-btn-rose:hover {
  filter: brightness(1.08);
}

/* ── 2. Squishy Fizik ve Yaylanma Animasyonları ── */
@keyframes pokiPop {
  0% { transform: scale(0.85); opacity: 0; }
  60% { transform: scale(1.12); opacity: 1; }
  85% { transform: scale(0.96); }
  100% { transform: scale(1); }
}
.poki-pop {
  animation: pokiPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes pokiWobble {
  0% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg) scale(1.06); }
  50% { transform: rotate(4deg) scale(1.04); }
  75% { transform: rotate(-2deg); }
  100% { transform: rotate(0deg); }
}
.poki-wobble {
  animation: pokiWobble 0.4s ease-in-out;
}

/* ── 3. Yüzen Puan Metni (Floating Points: +100 Puan!) ── */
@keyframes floatUpFade {
  0% {
    transform: translateY(0px) scale(0.8);
    opacity: 0;
  }
  20% {
    transform: translateY(-15px) scale(1.2);
    opacity: 1;
  }
  75% {
    transform: translateY(-45px) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-70px) scale(0.85);
    opacity: 0;
  }
}
.poki-floating-score {
  position: absolute;
  pointer-events: none;
  font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
  font-weight: 900;
  font-size: 1.25rem;
  z-index: 10000;
  animation: floatUpFade 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}

/* ── 4. Neon Parlayan Kartlar & Alanlar ── */
.poki-card {
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid #e2e8f0;
  border-radius: 24px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.dark .poki-card {
  background: rgba(15, 23, 42, 0.88);
  border-color: rgba(51, 65, 85, 0.8);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}
.poki-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.12);
}

/* ── 5. ATEŞ MODU / FEVER MODE (Neon Alevli Ekran Çerçevesi) ── */
@keyframes feverBorderGlow {
  0% {
    box-shadow: inset 0 0 30px rgba(239, 68, 68, 0.6), 0 0 25px rgba(245, 158, 11, 0.5);
    border-color: #f97316;
  }
  50% {
    box-shadow: inset 0 0 60px rgba(245, 158, 11, 0.85), 0 0 45px rgba(239, 68, 68, 0.8);
    border-color: #ef4444;
  }
  100% {
    box-shadow: inset 0 0 30px rgba(239, 68, 68, 0.6), 0 0 25px rgba(245, 158, 11, 0.5);
    border-color: #f97316;
  }
}

.fever-mode-active {
  position: relative;
}
.fever-mode-active::after {
  content: '';
  position: fixed;
  inset: 0;
  border: 8px solid #f97316;
  pointer-events: none;
  z-index: 99990;
  animation: feverBorderGlow 0.8s infinite ease-in-out;
  border-radius: 4px;
}

/* ── 6. EKRAN SARSINTISI (SCREEN SHAKE) ── */
@keyframes screenShakeFast {
  0% { transform: translate(0, 0) rotate(0deg); }
  20% { transform: translate(-4px, 3px) rotate(-0.5deg); }
  40% { transform: translate(4px, -3px) rotate(0.5deg); }
  60% { transform: translate(-3px, -2px) rotate(-0.3deg); }
  80% { transform: translate(3px, 2px) rotate(0.3deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}
.mesa-screen-shake {
  animation: screenShakeFast 0.35s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

/* ── 7. ÇİZGİ ROMAN TARZI POP-UP YAZILAR (COMIC BURST) ── */
@keyframes comicBurstAnim {
  0% {
    transform: translate(-50%, -50%) scale(0.2) rotate(-15deg);
    opacity: 0;
  }
  40% {
    transform: translate(-50%, -50%) scale(1.3) rotate(5deg);
    opacity: 1;
  }
  70% {
    transform: translate(-50%, -50%) scale(1.05) rotate(-2deg);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -80px) scale(0.8) rotate(0deg);
    opacity: 0;
  }
}

.mesa-comic-burst {
  position: fixed;
  top: 45%;
  left: 50%;
  pointer-events: none;
  z-index: 100005;
  font-family: 'Fredoka', 'Outfit', sans-serif;
  font-weight: 900;
  font-size: 2.2rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #fbbf24;
  -webkit-text-stroke: 3px #1e1b4b;
  text-shadow: 4px 6px 0px #0f172a, 0 0 25px rgba(245, 158, 11, 0.9);
  animation: comicBurstAnim 1s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  white-space: nowrap;
}

/* ── 8. IŞIK YANSIMASI (SHINE SWEEP) ── */
@keyframes shineSweepAnim {
  0% { left: -100%; }
  100% { left: 200%; }
}
.mesa-shine-box {
  position: relative;
  overflow: hidden;
}
.mesa-shine-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-25deg);
  pointer-events: none;
}
.mesa-shine-box:hover::before {
  animation: shineSweepAnim 0.75s ease-in-out;
}

/* ── 9. SINIF İÇİ HALAT ÇEKME TANSİYON BARI (TUG-OF-WAR) ── */
.mesa-tug-bar {
  position: relative;
  height: 12px;
  border-radius: 9999px;
  background: #e2e8f0;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
  display: flex;
}
.mesa-tug-red {
  background: linear-gradient(90deg, #ef4444, #dc2626);
  height: 100%;
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mesa-tug-blue {
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
  height: 100%;
  transition: width 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}


/* ==========================================================================
   VIRTUAL D-PAD & TOUCH ARCADE CONTROLS (Mobile & Smartboard)
   ========================================================================== */
.mesa-virtual-dpad {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.mesa-dpad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px;
  border-radius: 26px;
  border: 2px solid #bae6fd;
  box-shadow: 0 12px 30px -4px rgba(2, 132, 199, 0.35);
}

.mesa-dpad-middle-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.mesa-dpad-btn {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  color: #0f172a;
  font-size: 22px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
}

.mesa-dpad-btn:active {
  transform: scale(0.90);
  background: #e0f2fe;
  border-color: #0284c7;
  box-shadow: 0 0 15px rgba(2, 132, 199, 0.4);
}

.dpad-btn-action {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  border-color: #f59e0b;
}

  @media (max-width: 640px) {
  .mesa-virtual-dpad {
    bottom: max(16px, env(safe-area-inset-bottom, 16px));
    right: max(12px, env(safe-area-inset-right, 12px));
  }
  .mesa-dpad-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
    border-radius: 12px;
  }
}

/* ==========================================================================
   MOBILE SAFE AREA & TOUCH ERGONOMICS (v3.5 Poki & Toca Boca Standard)
   ========================================================================== */
:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

* {
  -webkit-tap-highlight-color: transparent;
}

.touch-manipulation {
  touch-action: manipulation;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Netflix / Poki Horizontal Swipeable Rails */
.poki-shelf-container {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  gap: 12px;
  padding: 6px 4px 14px 4px;
}

.poki-shelf-item {
  flex: 0 0 155px;
  scroll-snap-align: start;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@media (min-width: 640px) {
  .poki-shelf-item {
    flex: 0 0 210px;
  }
}
.poki-shelf-item:active {
  transform: scale(0.95);
}

/* Mobile Responsive Canvas Fitting */
@media (max-width: 768px) {
  .game-canvas-responsive {
    width: 100% !important;
    height: auto !important;
    max-height: 55vh !important;
    touch-action: none;
    border-radius: 16px;
  }
  .mobile-drawer-bottom {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 45vh;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
    z-index: 50;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}

