/* =========================================================================
   MODULE "GAME DU LICH" - trang danh sach (game_du_lich.html) + trang choi
   (game_choi.html), dung chung style cho ca 4 dang game (trivia/memory/
   wordsearch/hangman) qua may choi static/js/game-du-lich.js.
   ========================================================================= */

.hero-game .hero-inner { background: linear-gradient(120deg, var(--navy-deep) 0%, var(--navy) 55%, var(--teal) 100%); }

/* ---------- Thanh tien do "da choi X/30" ---------- */
.game-progress-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.1rem;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--sky);
  box-shadow: 0 6px 16px -10px rgba(12, 74, 110, 0.2);
  margin-bottom: 1rem;
}
.game-progress-track {
  flex: 1 1 220px;
  min-width: 160px;
  height: 10px;
  border-radius: 999px;
  background: var(--sky);
  overflow: hidden;
}
.game-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-dark));
  border-radius: 999px;
  transition: width 0.4s ease;
}
.game-progress-text {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy-deep);
  white-space: nowrap;
}
.game-progress-text i { color: var(--gold-dark); }

/* ---------- Chu thich 4 dang game ---------- */
.game-type-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.game-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.76rem;
  font-weight: 700;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  color: #fff;
}
.game-type-chip-trivia { background: linear-gradient(120deg, #0ea5e9, #0c4a6e); }
.game-type-chip-memory { background: linear-gradient(120deg, #c084fc, #7e22ce); }
.game-type-chip-wordsearch { background: linear-gradient(120deg, #22d3ee, #0e7490); }
.game-type-chip-hangman { background: linear-gradient(120deg, #fb923c, #c2410c); }

/* ---------- The game (danh sach) ---------- */
.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 1.35rem 1.25rem 1.15rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--sky);
  text-decoration: none;
  color: inherit;
  box-shadow: 0 8px 18px -12px rgba(12, 74, 110, 0.22);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.game-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 30px -12px rgba(12, 74, 110, 0.32);
  color: inherit;
}
.game-card-icon {
  width: 46px; height: 46px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  color: #fff;
  margin-bottom: 0.7rem;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
}
.game-card-trivia .game-card-icon { background: linear-gradient(135deg, #0ea5e9, #0c4a6e); }
.game-card-memory .game-card-icon { background: linear-gradient(135deg, #c084fc, #7e22ce); }
.game-card-wordsearch .game-card-icon { background: linear-gradient(135deg, #22d3ee, #0e7490); }
.game-card-hangman .game-card-icon { background: linear-gradient(135deg, #fb923c, #c2410c); }
.game-card-type {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--navy-light);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 0.3rem;
}
.game-card-title { font-size: 1rem; color: var(--navy-deep); margin-bottom: 0.3rem; line-height: 1.3; }
.game-card-desc { font-size: 0.82rem; color: #64748b; flex-grow: 1; margin-bottom: 0.85rem; }
.game-card-cta {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--gold-dark);
  display: inline-flex; align-items: center; gap: 0.3rem;
}
.game-card-done-badge {
  position: absolute;
  top: 0.85rem; right: 0.85rem;
  color: #16a34a;
  font-size: 1.15rem;
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.game-card-da-choi .game-card-done-badge { opacity: 1; transform: scale(1); }
.game-card-da-choi { border-color: #86efac; }

.game-card-sm { padding: 1rem; flex-direction: row; align-items: center; gap: 0.7rem; }
.game-card-sm .game-card-icon { width: 38px; height: 38px; font-size: 1.05rem; margin-bottom: 0; flex-shrink: 0; }
.game-card-sm .game-card-title { font-size: 0.86rem; margin: 0; }

/* ---------- Header trang choi ---------- */
.game-play-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  border-radius: 16px;
  background: linear-gradient(120deg, var(--sky) 0%, #e0f4ff 100%);
  margin-bottom: 1.25rem;
}
.game-play-header-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
}
.game-type-trivia .game-play-header-icon { background: linear-gradient(135deg, #0ea5e9, #0c4a6e); }
.game-type-memory .game-play-header-icon { background: linear-gradient(135deg, #c084fc, #7e22ce); }
.game-type-wordsearch .game-play-header-icon { background: linear-gradient(135deg, #22d3ee, #0e7490); }
.game-type-hangman .game-play-header-icon { background: linear-gradient(135deg, #fb923c, #c2410c); }
.game-play-header-text h1 { font-size: 1.3rem; margin: 0.1rem 0; color: var(--navy-deep); }
.game-play-header-type { font-size: 0.72rem; font-weight: 700; color: var(--navy-light); text-transform: uppercase; }

.game-play-shell {
  padding: 1.25rem;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--sky);
  box-shadow: 0 8px 20px -14px rgba(12, 74, 110, 0.25);
  min-height: 320px;
}
.game-loading { text-align: center; padding: 3rem 0; color: #64748b; }

/* ---------- TRIVIA ---------- */
.game-trivia-progress { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1rem; }
.game-trivia-progress-track { flex: 1; height: 6px; border-radius: 999px; background: var(--sky); overflow: hidden; }
.game-trivia-progress-fill { height: 100%; background: linear-gradient(90deg, var(--navy), var(--teal)); border-radius: 999px; transition: width 0.3s ease; }
.game-trivia-progress span { font-size: 0.78rem; font-weight: 700; color: var(--navy-deep); white-space: nowrap; }
.game-trivia-question { font-size: 1.15rem; color: var(--navy-deep); margin-bottom: 1.1rem; }
.game-trivia-options { display: grid; gap: 0.65rem; }
@media (min-width: 576px) { .game-trivia-options { grid-template-columns: 1fr 1fr; } }
.game-trivia-opt {
  text-align: left;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  border: 1.5px solid var(--sky);
  background: #f8fbfd;
  font-weight: 600;
  color: var(--navy-deep);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.game-trivia-opt:hover:not(:disabled) { border-color: var(--navy-light); background: #fff; }
.game-trivia-opt:disabled { cursor: default; }
.game-trivia-opt-dung { background: #dcfce7 !important; border-color: #16a34a !important; color: #166534 !important; }
.game-trivia-opt-sai { background: #fee2e2 !important; border-color: #dc2626 !important; color: #991b1b !important; }

/* ---------- MEMORY ---------- */
.game-memory-meta { display: flex; gap: 1.25rem; margin-bottom: 1rem; font-size: 0.85rem; color: var(--navy-deep); font-weight: 600; }
.game-memory-meta i { color: var(--teal); }
.game-memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}
@media (min-width: 576px) { .game-memory-grid { grid-template-columns: repeat(4, 1fr); gap: 0.85rem; } }
.game-memory-card {
  aspect-ratio: 3/4;
  border: none;
  background: transparent;
  perspective: 800px;
  cursor: pointer;
  padding: 0;
}
.game-memory-card-inner {
  position: relative;
  width: 100%; height: 100%;
  display: block;
  transform-style: preserve-3d;
  transition: transform 0.4s ease;
  border-radius: 10px;
}
.game-memory-card-mo .game-memory-card-inner,
.game-memory-card-ghep .game-memory-card-inner { transform: rotateY(180deg); }
.game-memory-card-back, .game-memory-card-front {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 10px;
  backface-visibility: hidden;
}
.game-memory-card-back {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: #fff;
  font-size: 1.4rem;
}
.game-memory-card-front {
  background: #fff;
  border: 2px solid var(--sky);
  transform: rotateY(180deg);
  font-size: 1.6rem;
  gap: 0.2rem;
  padding: 0.3rem;
  text-align: center;
}
.game-memory-card-front small { font-size: 0.6rem; color: var(--navy-deep); font-weight: 700; line-height: 1.1; }
.game-memory-card-ghep .game-memory-card-front { border-color: #16a34a; background: #f0fdf4; }

/* ---------- WORDSEARCH ---------- */
.game-ws-hint { font-size: 0.8rem; color: #64748b; margin-bottom: 0.9rem; }
.game-ws-layout { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; }
.game-wordsearch-grid {
  display: grid;
  grid-template-columns: repeat(var(--co-hoc), 1fr);
  gap: 2px;
  width: min(420px, 100%);
  aspect-ratio: 1/1;
  background: var(--sky);
  border-radius: 10px;
  padding: 4px;
  flex: 1 1 320px;
}
.game-ws-cell {
  border: none;
  background: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--navy-deep);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  border-radius: 2px;
  aspect-ratio: 1/1;
  padding: 0;
}
.game-ws-cell:hover { background: #eafbff; }
.game-ws-cell-dang-chon { background: var(--gold) !important; color: #fff !important; }
.game-ws-cell-da-tim { background: #bbf7d0 !important; color: #166534 !important; }
.game-ws-wordlist { list-style: none; margin: 0; padding: 0; flex: 1 1 200px; display: flex; flex-direction: column; gap: 0.5rem; }
.game-ws-wordlist li { display: flex; flex-direction: column; font-size: 0.85rem; color: var(--navy-deep); }
.game-ws-wordlist li strong { display: flex; align-items: center; gap: 0.4rem; }
.game-ws-wordlist li i { color: var(--sky); }
.game-ws-wordlist li small { color: #64748b; margin-left: 1.3rem; }
.game-ws-word-da-tim { opacity: 0.55; text-decoration: line-through; }
.game-ws-word-da-tim i { color: #16a34a !important; }

/* ---------- HANGMAN ---------- */
.game-hm-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.9rem; flex-wrap: wrap; gap: 0.5rem; }
.game-hm-round { font-size: 0.85rem; font-weight: 700; color: var(--navy-deep); }
.game-hm-lives { font-size: 1.1rem; color: var(--gold-dark); letter-spacing: 0.2rem; }
.game-hm-hint { font-size: 0.9rem; color: #64748b; margin-bottom: 1rem; }
.game-hm-hint i { color: var(--gold); }
.game-hm-word { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.3rem; }
.game-hm-o {
  min-width: 26px; height: 34px;
  border-bottom: 3px solid var(--navy-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 800; color: var(--navy-deep);
  text-transform: uppercase;
}
.game-hm-o-cach { border-bottom: none; min-width: 14px; }
.game-hm-o-lo { border-bottom-color: #16a34a; }
.game-hm-keyboard { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.game-hm-key {
  min-width: 38px; height: 38px;
  border-radius: 8px;
  border: 1.5px solid var(--sky);
  background: #f8fbfd;
  font-weight: 700;
  color: var(--navy-deep);
  cursor: pointer;
}
.game-hm-key:hover:not(:disabled) { border-color: var(--navy-light); }
.game-hm-key:disabled { cursor: default; opacity: 0.6; }
.game-hm-key-dung { background: #dcfce7 !important; border-color: #16a34a !important; }
.game-hm-key-sai { background: #fee2e2 !important; border-color: #dc2626 !important; }

/* ---------- Man hinh KET QUA (dung chung ca 4 dang) ---------- */
.game-result { text-align: center; padding: 1.5rem 0.5rem; }
.game-result-icon { font-size: 2.6rem; color: var(--gold); margin-bottom: 0.5rem; }
.game-result-title { color: var(--navy-deep); margin-bottom: 0.3rem; }
.game-result-score { font-size: 2rem; font-weight: 800; color: var(--navy); margin-bottom: 0.2rem; }
.game-result-note { color: #64748b; font-size: 0.9rem; margin-bottom: 0.4rem; }
.game-result-best { font-size: 0.85rem; color: var(--gold-dark); font-weight: 700; margin-bottom: 1.1rem; }
.game-result-actions { display: flex; gap: 0.6rem; justify-content: center; flex-wrap: wrap; margin-bottom: 1.1rem; }
.game-result-cta {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--navy), var(--navy-light));
  color: #fff;
  font-weight: 700;
  font-size: 0.86rem;
  text-decoration: none;
}
.game-result-cta:hover { color: #fff; filter: brightness(1.08); }

@media (max-width: 576px) {
  .game-play-header { flex-direction: column; text-align: center; }
  .game-ws-layout { flex-direction: column; }
  .game-hm-o { min-width: 20px; height: 28px; font-size: 1rem; }
}
