/* ================= 🎯 PHÒNG TẬP TRUNG (FOCUS LAB) ================= */
/* Mọi lớp mới đều có tiền tố fl- ; tái sử dụng game-card, game-header,
   game-badge, voice-btn, section-instruction, game-hint, feedback-msg,
   bounce-in, pop-in từ games.css */

.fl-card {
  overflow: hidden;
  max-width: 100%;
}

.fl-card * {
  box-sizing: border-box;
}

.fl-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  min-height: 230px;
  width: 100%;
}

.fl-instruction {
  margin-bottom: 14px;
}

.fl-hidden {
  display: none !important;
}

/* ---------- Dòng trạng thái ---------- */
.fl-status {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: #7A4A00;
  background: #FFF6E6;
  border: 2px solid #FFE1A8;
  border-radius: 20px;
  padding: 8px 18px;
  text-align: center;
  max-width: 100%;
  line-height: 1.4;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fl-status-pop {
  animation: flPop 0.35s ease-out;
}

/* ---------- Chip thông tin ---------- */
.fl-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.fl-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #F1F8FF;
  color: #0F5C8C;
  border: 2px solid #C5E4FB;
  border-radius: 16px;
  padding: 6px 13px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.3;
  text-align: center;
}

.fl-rule-chip {
  background: #FFF0F4;
  color: #9B2C45;
  border-color: #FFC9D7;
}

.fl-jar-chip {
  background: #EDFBF4;
  color: #0A6A4A;
  border-color: #A7EBCE;
}

.fl-jar-pop {
  animation: flPop 0.4s ease-out;
}

.fl-rule-flash {
  animation: flRuleFlash 0.9s ease-out;
}

/* ---------- Nút ---------- */
.fl-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.fl-actions:empty,
.fl-next-wrap:empty {
  display: none;
}

.fl-next-wrap {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.fl-big-btn,
.fl-soft-btn {
  min-height: 56px;
  padding: 12px 26px;
  border-radius: 22px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  cursor: pointer;
  border: 3px solid transparent;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  touch-action: manipulation;
}

.fl-big-btn {
  background: var(--primary-orange);
  color: #fff;
  border-color: #E8860C;
  box-shadow: 0 6px 0 #C96F00;
}

.fl-soft-btn {
  background: #fff;
  color: #8A5200;
  border-color: #FFDFA8;
  box-shadow: 0 6px 0 #FFDFA8;
}

.fl-big-btn:hover,
.fl-soft-btn:hover {
  transform: translateY(-2px);
}

.fl-big-btn:active,
.fl-soft-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #C96F00;
}

/* ---------- Tổng kết ván ---------- */
.fl-detail {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.45;
}

.fl-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.75);
  border: 2px solid rgba(0, 0, 0, 0.07);
  border-radius: 14px;
  padding: 5px 11px;
  font-size: 0.9rem;
}

.fl-tag-soft {
  opacity: 0.85;
}

/* =========================================================
   1. BẮT BƯỚM ĐỪNG BẮT ONG (GO / NO-GO)
   ========================================================= */
.fl-gng-stage {
  position: relative;
  width: 100%;
  max-width: 420px;
  min-height: 170px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(170deg, #EFFBF1 0%, #DFF4FF 100%);
  border: 4px solid #CFEBD8;
  border-radius: 28px;
  padding: 12px;
}

.fl-creature {
  width: 120px;
  height: 120px;
  min-width: 120px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 6px 16px rgba(60, 100, 80, 0.14);
  font-size: 4.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 0.15s ease, background 0.15s ease;
  padding: 0;
}

.fl-creature.fl-blank {
  opacity: 0.45;
  font-size: 2.6rem;
  cursor: default;
  box-shadow: none;
}

.fl-creature-in {
  animation: flCreatureIn 0.26s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Nút vợt: to, dễ bấm, sáng lên khi tới lượt */
.fl-net-btn {
  min-height: 72px;
  min-width: 200px;
  padding: 14px 30px;
  border-radius: 26px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.5rem;
  color: #fff;
  background: #B6BFCC;
  border: 4px solid #9AA5B4;
  box-shadow: 0 7px 0 #828D9C;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s ease, background 0.15s ease, box-shadow 0.12s ease;
}

.fl-net-btn.fl-net-ready {
  background: var(--primary-coral);
  border-color: #E8476A;
  box-shadow: 0 7px 0 #C93659;
  animation: flNetReady 1.1s ease-in-out infinite;
}

.fl-net-btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #C93659;
}

.fl-net-btn:disabled {
  cursor: default;
}

/* Phản hồi tức thì, dịu dàng */
.fl-good-flash {
  animation: flGoodFlash 0.5s ease-out;
  border-color: #38D39F !important;
}

.fl-ok-flash {
  animation: flOkFlash 0.5s ease-out;
}

.fl-oops-flash {
  animation: flOopsFlash 0.5s ease-out;
}

.fl-soft-shake {
  animation: flSoftShake 0.42s ease-in-out;
}

/* Bảng thông báo đổi luật */
.fl-flip-banner {
  position: absolute;
  inset: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 252, 240, 0.96);
  border: 4px solid var(--primary-yellow);
  border-radius: 24px;
  z-index: 3;
  padding: 10px;
}

.fl-flip-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.5rem;
  color: #A3480A;
  text-align: center;
  line-height: 1.25;
}

.fl-flip-icon {
  font-size: 2.4rem;
  animation: flSpin 1.2s ease-in-out infinite;
}

.fl-flip-sub {
  font-size: 1.1rem;
  font-weight: 800;
  color: #6B4A12;
}

/* =========================================================
   2. ĐỔI LUẬT THẦN TỐC (DCCS)
   ========================================================= */
.fl-rule-board {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  max-width: 420px;
  min-height: 62px;
  padding: 10px 18px;
  border-radius: 24px;
  background: #FFF0F4;
  border: 4px solid #FFC2D3;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.45rem;
  color: #9B2C45;
  text-align: center;
  line-height: 1.2;
}

.fl-rule-board.fl-rule-shape {
  background: #EEF4FF;
  border-color: #BFD5FF;
  color: #1E4894;
}

.fl-rule-board.fl-rule-size {
  background: #F3EEFF;
  border-color: #D7C6FF;
  color: #5A2FA8;
}

.fl-rule-icon {
  font-size: 1.7rem;
  line-height: 1;
}

.fl-sw-cardwrap {
  display: flex;
  justify-content: center;
  width: 100%;
}

.fl-sw-card {
  width: 128px;
  height: 150px;
  border-radius: 22px;
  background: #fff;
  border: 4px solid #E6EDF7;
  box-shadow: 0 8px 18px rgba(70, 90, 130, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
}

.fl-sw-card.fl-blank {
  opacity: 0.5;
}

.fl-card-in {
  animation: flCardIn 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fl-glyph {
  font-size: 3.6rem;
  line-height: 1;
  display: inline-block;
  /* Hình khối phẳng, không dùng emoji nên luôn hiển thị đúng màu */
  font-family: 'Segoe UI Symbol', 'Arial Unicode MS', var(--font-body), sans-serif;
}

.fl-glyph.fl-g-big {
  font-size: 4.4rem;
}

.fl-glyph.fl-g-small {
  font-size: 2.6rem;
}

.fl-boxes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 440px;
}

.fl-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 140px;
  padding: 10px 6px;
  border-radius: 22px;
  background: #FBFDFF;
  border: 4px dashed #C9D9EC;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.14s ease, border-color 0.15s ease, background 0.15s ease;
}

.fl-box:hover:not(:disabled) {
  transform: translateY(-3px);
  border-color: var(--primary-blue);
  background: #F3FAFF;
}

.fl-box:disabled {
  cursor: default;
  opacity: 0.75;
}

.fl-box-label {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  color: #3D5370;
}

.fl-box-desc {
  font-size: 0.78rem;
  font-weight: 700;
  color: #6B7C94;
  line-height: 1.25;
  text-align: center;
}

.fl-box .fl-glyph.fl-g-big {
  font-size: 3.1rem;
}

.fl-box .fl-glyph.fl-g-small {
  font-size: 1.9rem;
}

.fl-show-answer {
  animation: flShowAnswer 1.2s ease-out;
  border-color: #38D39F !important;
  border-style: solid !important;
}

/* =========================================================
   3. TÌM NHANH TRONG ĐÁM ĐÔNG
   ========================================================= */
.fl-timebar {
  width: 100%;
  max-width: 420px;
  height: 16px;
  border-radius: 10px;
  background: #EAF1F8;
  border: 2px solid #D4E2F0;
  overflow: hidden;
}

.fl-timebar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #6FD6A8, #38D39F);
  border-radius: 8px;
  transition: width 0.12s linear;
}

.fl-timebar.fl-time-low > span {
  background: linear-gradient(90deg, #FFB870, #FF8A8A);
}

/* Lưới hình: KHÔNG dùng định vị tuyệt đối để không hình nào bị che */
.fl-field {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 7px;
  width: 100%;
  padding: 10px;
  background: #FCFBFF;
  border: 4px solid #E7E0FA;
  border-radius: 24px;
}

.fl-sitem {
  min-width: 48px;
  min-height: 52px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.85rem;
  line-height: 1;
  border-radius: 14px;
  background: #fff;
  border: 2px solid #ECECF4;
  cursor: pointer;
  touch-action: manipulation;
  padding: 0;
  transition: transform 0.12s ease, background 0.15s ease, opacity 0.2s ease;
}

.fl-sitem:hover:not(:disabled) {
  transform: scale(1.08);
  background: #FFF9E8;
}

.fl-field-locked .fl-sitem {
  opacity: 0.55;
  cursor: default;
}

.fl-sitem.fl-found {
  background: #DEF7EC;
  border-color: #84E1BC;
  opacity: 1 !important;
  animation: flFound 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.fl-sitem.fl-reveal {
  background: #FFF3CD;
  border-color: var(--primary-yellow);
  opacity: 1 !important;
  animation: flRevealPulse 1s ease-in-out 2;
}

.fl-find-chip {
  background: #FFF3CD;
  color: #7A5B00;
  border-color: #FFE8A8;
}

.fl-found-chip {
  background: #EDFBF4;
  color: #0A6A4A;
  border-color: #A7EBCE;
}

/* =========================================================
   HIỆU ỨNG
   ========================================================= */
@keyframes flPop {
  0% { transform: scale(0.88); }
  60% { transform: scale(1.07); }
  100% { transform: scale(1); }
}

@keyframes flCreatureIn {
  0% { transform: scale(0.5) rotate(-12deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes flCardIn {
  0% { transform: translateY(-14px) scale(0.85); opacity: 0; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes flNetReady {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes flGoodFlash {
  0% { background: rgba(56, 211, 159, 0.15); }
  35% { background: rgba(56, 211, 159, 0.55); transform: scale(1.06); }
  100% { background: rgba(255, 255, 255, 0.78); transform: scale(1); }
}

@keyframes flOkFlash {
  0% { box-shadow: 0 0 0 0 rgba(56, 211, 159, 0.5); }
  100% { box-shadow: 0 0 0 16px rgba(56, 211, 159, 0); }
}

@keyframes flOopsFlash {
  0% { background: rgba(255, 184, 112, 0.2); }
  40% { background: rgba(255, 184, 112, 0.5); }
  100% { background: rgba(255, 255, 255, 0.78); }
}

@keyframes flSoftShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px) rotate(-2deg); }
  45% { transform: translateX(5px) rotate(2deg); }
  70% { transform: translateX(-3px) rotate(-1deg); }
}

@keyframes flRuleFlash {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 209, 59, 0.75); }
  40% { transform: scale(1.05); box-shadow: 0 0 0 12px rgba(255, 209, 59, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 209, 59, 0); }
}

@keyframes flShowAnswer {
  0%, 100% { background: #FBFDFF; }
  30%, 70% { background: #DEF7EC; }
}

@keyframes flFound {
  0% { transform: scale(1); }
  45% { transform: scale(1.3) rotate(8deg); }
  100% { transform: scale(1) rotate(0deg); }
}

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

@keyframes flSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* =========================================================
   MÁY TÍNH: rộng rãi hơn
   ========================================================= */
@media (min-width: 768px) {
  .fl-gng-stage {
    max-width: 520px;
    min-height: 210px;
  }

  .fl-creature {
    width: 148px;
    height: 148px;
    min-width: 148px;
    font-size: 5.2rem;
  }

  .fl-rule-board,
  .fl-timebar {
    max-width: 520px;
  }

  .fl-boxes {
    max-width: 520px;
  }

  .fl-field {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: 10px;
    max-width: 760px;
  }

  .fl-sitem {
    font-size: 2.1rem;
    min-height: 60px;
  }
}

/* =========================================================
   ĐIỆN THOẠI NHỎ (360px vẫn không tràn ngang)
   ========================================================= */
@media (max-width: 480px) {
  .fl-stage {
    gap: 10px;
    min-height: 190px;
  }

  .fl-status {
    font-size: 0.98rem;
    padding: 7px 12px;
  }

  .fl-chip {
    font-size: 0.82rem;
    padding: 5px 10px;
  }

  .fl-gng-stage {
    min-height: 140px;
    border-radius: 22px;
    padding: 8px;
  }

  .fl-creature {
    width: 100px;
    height: 100px;
    min-width: 100px;
    font-size: 3.4rem;
  }

  .fl-net-btn {
    min-height: 64px;
    min-width: 170px;
    font-size: 1.3rem;
    padding: 12px 22px;
  }

  .fl-flip-inner {
    font-size: 1.2rem;
  }

  .fl-flip-icon {
    font-size: 2rem;
  }

  .fl-flip-sub {
    font-size: 0.95rem;
  }

  .fl-rule-board {
    font-size: 1.15rem;
    min-height: 54px;
    padding: 8px 12px;
    border-width: 3px;
  }

  .fl-rule-icon {
    font-size: 1.4rem;
  }

  .fl-sw-card {
    width: 108px;
    height: 126px;
  }

  .fl-glyph {
    font-size: 3rem;
  }

  .fl-glyph.fl-g-big {
    font-size: 3.6rem;
  }

  .fl-glyph.fl-g-small {
    font-size: 2.2rem;
  }

  .fl-boxes {
    gap: 9px;
  }

  .fl-box {
    min-height: 124px;
    border-width: 3px;
    padding: 8px 4px;
  }

  .fl-box-label {
    font-size: 0.95rem;
  }

  .fl-box-desc {
    font-size: 0.7rem;
  }

  .fl-box .fl-glyph.fl-g-big {
    font-size: 2.6rem;
  }

  .fl-box .fl-glyph.fl-g-small {
    font-size: 1.6rem;
  }

  .fl-field {
    grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
    gap: 6px;
    padding: 7px;
    border-width: 3px;
    border-radius: 18px;
  }

  .fl-sitem {
    font-size: 1.6rem;
    min-height: 48px;
    border-radius: 12px;
  }

  .fl-big-btn,
  .fl-soft-btn {
    font-size: 1.05rem;
    padding: 10px 18px;
  }

  .fl-detail {
    font-size: 0.86rem;
    gap: 6px;
  }

  .fl-tag {
    font-size: 0.8rem;
    padding: 4px 9px;
  }
}

/* Máy rất nhỏ (<=340px): lưới tìm kiếm co thêm nhưng vẫn >=44px */
@media (max-width: 340px) {
  .fl-field {
    grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  }

  .fl-sitem {
    min-width: 44px;
    min-height: 44px;
    font-size: 1.45rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fl-card *:not(.fl-timebar > span) {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
