/* 
 * สไตล์สำหรับมินิเกมทั้ง 12 เกม (games.css)
 * ปรับปรุงเพื่อรองรับการสัมผัสบนสมาร์ทโฟนและแท็บเล็ต 100%
 */

.game-box {
  background: white;
  border-radius: 18px;
}

/* Option Buttons in Quiz & Fill-in-Blank */
.option-btn, .quiz-opt, .rebus-btn {
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.option-btn:active, .quiz-opt:active, .rebus-btn:active {
  transform: scale(0.97);
}

/* Memory Match Cards */
.memory-card {
  perspective: 1000px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.memory-card:active {
  transform: scale(0.95);
}

.memory-card.flipped {
  border-color: #FFA000 !important;
}

.memory-card.matched {
  border-color: #2E7D32 !important;
  opacity: 0.9;
  cursor: default;
}

/* Rhythm Tapper Hero */
.hit-target {
  transition: transform 0.08s ease, background-color 0.08s ease;
  border: 3px solid #FFF8E1 !important;
  touch-action: manipulation;
}

.hit-target:active {
  transform: scale(0.88);
  background-color: #FFA000 !important;
}

/* Trash sorting bins */
.bin-btn {
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 2px solid rgba(255,255,255,0.4);
  touch-action: manipulation;
}

.bin-btn:active {
  transform: scale(0.94);
}

/* Simon Says Bells */
.bell-pad {
  transition: transform 0.12s ease, filter 0.12s ease;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.bell-pad:active, .bell-pad.scale-up {
  transform: scale(1.06) !important;
  filter: brightness(1.25) !important;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.7) !important;
}

/* Game 12: Speed Tap Holes */
.reflex-hole {
  transition: transform 0.1s ease, background-color 0.15s ease;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.reflex-hole:active {
  transform: scale(0.92);
}

/* Stars Badge */
.stars-badge {
  letter-spacing: -2px;
}

/* ==================================================== */
/* Game 5: Word Search Swipe & Highlight Styles        */
/* ==================================================== */
.ws-container {
  position: relative;
  touch-action: none !important; /* ป้องกันหน้าจอเลื่อนขณะลากป้ายคำบนมือถือ */
  -webkit-user-select: none;
  user-select: none;
}

.ws-grid-table {
  border-collapse: separate;
  border-spacing: 5px;
  margin: 0 auto;
  touch-action: none;
}

.ws-cell {
  width: 40px;
  height: 40px;
  text-align: center;
  vertical-align: middle;
  font-weight: bold;
  font-size: 1.05rem;
  background: #FFFFFF;
  border: 1.5px solid #CFD8DC;
  border-radius: 10px;
  cursor: pointer;
  touch-action: none !important;
  -webkit-user-select: none;
  user-select: none;
  transition: background-color 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

@media (max-width: 480px) {
  .ws-grid-table {
    border-spacing: 3px;
  }
  .ws-cell {
    width: 36px;
    height: 36px;
    font-size: 0.92rem;
    border-radius: 8px;
  }
}

/* แถบสีขณะกำลังลากป้ายคำ */
.ws-cell.ws-selecting {
  background-color: #FFE082 !important;
  border-color: #FFA000 !important;
  color: #E65100 !important;
  transform: scale(1.08);
  box-shadow: 0 0 10px rgba(255, 160, 0, 0.45);
  z-index: 2;
}

/* แถบสีเขียวเมื่อค้นพบคำศัพท์ถูกต้อง */
.ws-cell.ws-found {
  background-color: #C8E6C9 !important;
  border-color: #4CAF50 !important;
  color: #1B5E20 !important;
  box-shadow: inset 0 0 4px rgba(76, 175, 80, 0.4);
}

/* แถบสีแดงสั่นเมื่อป้ายคำไม่ถูกต้อง */
.ws-cell.ws-invalid {
  background-color: #FFCDD2 !important;
  border-color: #E53935 !important;
  color: #B71C1C !important;
  animation: wsShake 0.3s ease;
}

@keyframes wsShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* กล่องเด้งแจ้งเตือนเมื่อพบคำศัพท์ (Toast Pop-up) */
.ws-toast-box {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  pointer-events: none;
  width: 90%;
  max-width: 340px;
  animation: wsPopIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes wsPopIn {
  0% { transform: translate(-50%, -15px) scale(0.85); opacity: 0; }
  100% { transform: translate(-50%, 0) scale(1); opacity: 1; }
}

.animate-pop {
  animation: wsBadgePop 0.4s ease-out;
}

@keyframes wsBadgePop {
  0% { transform: scale(0.7); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* ==================================================== */
/* Game 5: จริงหรือหลอก ท้าดวลสายฟ้า (True or False)    */
/* ==================================================== */
.tf-card {
  background: #FFFFFF !important;
  border-radius: 20px !important;
  border: 2px solid #E0E7FF !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
  transition: all 0.25s ease;
}

.tf-btn {
  border-radius: 20px !important;
  font-weight: 700;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  touch-action: manipulation !important;
  -webkit-user-select: none;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.tf-btn:active {
  transform: scale(0.93) !important;
}

.tf-btn-true {
  background: linear-gradient(135deg, #10B981, #059669) !important;
  color: white !important;
  border: 2.5px solid #047857 !important;
  box-shadow: 0 5px 15px rgba(16, 185, 129, 0.35) !important;
}

.tf-btn-true:hover, .tf-btn-true:focus {
  background: linear-gradient(135deg, #059669, #047857) !important;
  color: white !important;
}

.tf-btn-false {
  background: linear-gradient(135deg, #EF4444, #DC2626) !important;
  color: white !important;
  border: 2.5px solid #B91C1C !important;
  box-shadow: 0 5px 15px rgba(239, 68, 68, 0.35) !important;
}

.tf-btn-false:hover, .tf-btn-false:focus {
  background: linear-gradient(135deg, #DC2626, #B91C1C) !important;
  color: white !important;
}

.tf-feedback-box {
  animation: tfSlideDown 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes tfSlideDown {
  0% { transform: translateY(-10px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.tf-streak-badge {
  animation: tfPulse 1.2s infinite;
}

@keyframes tfPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
