/* === RESET & BIẾN MÀU SẮC === */
:root {
  --bg-main: #1e1e24;
  /* Xám đậm nền chính */
  --bg-card: #2b2b36;
  /* Xám nhạt cho thẻ game và header */
  --text-main: #ffffff;
  --text-muted: #a0a0a0;
  --accent-color: #facc15;
  /* Vàng chủ đạo */
  --accent-hover: #eab308;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

html, body {
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
}

/* === HEADER & ĐIỀU HƯỚNG === */
header {
  background-color: var(--bg-card);
  padding: 15px 5%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #3a3a48;
  position: relative;
}

.logo {
  font-size: 24px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.logo i {
  color: var(--accent-color);
}

.logo .highlight {
  color: var(--accent-color);
}

nav {
  display: flex;
  gap: 30px;
}

nav a {
  text-decoration: none;
  color: var(--text-main);
  font-weight: 600;
  font-size: 14px;
  transition: 0.3s;
}

nav a:hover,
nav a.active {
  color: var(--accent-color);
  border-bottom: 2px solid var(--accent-color);
  padding-bottom: 5px;
}

.menu-toggle {
  display: none;
  cursor: pointer;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}

.menu-toggle .bar {
  display: block;
  width: 25px;
  height: 3px;
  background-color: var(--accent-color);
  border-radius: 3px;
  transition: all 0.3s ease-in-out;
}

.menu-toggle.active .bar:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
}

.menu-toggle.active .bar:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active .bar:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
}

.btn {
  background-color: var(--accent-color);
  color: #000;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.3s;
  text-transform: uppercase;
  font-size: 14px;
}

.btn:hover {
  background-color: var(--accent-hover);
}

/* === HERO SECTION (PHẦN GIỚI THIỆU) === */
.hero {
  text-align: center;
  padding: 60px 20px;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 15px;
  letter-spacing: 1px;
}

.hero p {
  color: var(--text-muted);
  margin-bottom: 30px;
  font-size: 1.1rem;
}

/* === GAMES GRID (DANH SÁCH GAME) === */
.games-section {
  padding: 0 5% 60px 5%;
}

.games-section h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  border-left: 4px solid var(--accent-color);
  padding-left: 10px;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 25px;
}

/* === GAME CARD === */
.game-card {
  background-color: var(--bg-card);
  border-radius: 12px;
  padding: 15px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.game-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.game-card img {
  width: 100%;
  border-radius: 8px;
  aspect-ratio: 16/9;
  object-fit: cover;
  background-color: #444;
  /* Fallback color */
}

.game-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.game-title {
  font-size: 1.1rem;
  font-weight: bold;
  text-transform: uppercase;
}

.game-rating {
  font-size: 0.9rem;
  color: #ffd700;
  /* Màu vàng cho sao */
  display: flex;
  align-items: center;
  gap: 5px;
}

.game-rating span {
  color: var(--text-main);
}

.game-author {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -8px;
}

.game-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-grow: 1;
  /* Đẩy nút play xuống dưới cùng */
}

.btn-play {
  width: 100%;
  margin-top: auto;
}

/* === FOOTER === */
/* === GAME SWITCH ANIMATION === */
@keyframes fade-in {
  from { opacity: 0.5; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in-anim {
  animation: fade-in 0.4s ease-out forwards;
}

footer {
  text-align: center;
  padding: 20px;
  background-color: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.9rem;
  border-top: 1px solid #3a3a48;
}

/* === GAME PLAYER CONTAINER === */
#game-player-wrapper {
  background-color: var(--bg-card);
  margin: 0 5% 40px 5%;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 1px solid #3a3a48;
  padding-bottom: 10px;
}

.game-header h2 {
  color: var(--accent-color);
  font-size: 1.5rem;
}

.canvas-container {
  display: flex;
  justify-content: center;
  position: relative;
  background-color: #111;
  border-radius: 8px;
  overflow: hidden;
  max-width: 800px;
  margin: 0 auto;
}

#gameCanvas {
  display: block;
  width: 100%;
  max-width: 800px;
  height: auto;
}

#game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

#game-message {
  color: #fff;
  font-size: 1.5rem;
  font-weight: bold;
  text-align: center;
}

.score-board {
  text-align: center;
  margin-top: 15px;
  font-size: 1.2rem;
  font-weight: bold;
  color: var(--accent-color);
}

.draft {
  display: none !important;
}

/* === RESPONSIVE (MOBILE) === */
@media (max-width: 600px) {
  .menu-toggle {
    display: flex;
  }
  
  nav {
    display: none;
  }
  
  .nav-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--bg-card);
    flex-direction: column;
    align-items: center;
    gap: 0;
    display: none;
    border-bottom: 1px solid #3a3a48;
    z-index: 1000;
  }

  .nav-menu.active {
    display: flex;
    animation: slideDown 0.3s ease;
  }

  .nav-menu a {
    padding: 15px;
    width: 100%;
    text-align: center;
    border-bottom: 1px solid #3a3a48;
  }
  
  .nav-menu a:hover,
  .nav-menu a.active {
    border-bottom: 1px solid #3a3a48;
    background-color: rgba(250, 204, 21, 0.1);
  }

  @keyframes slideDown {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .grid-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  
  .game-card {
    padding: 10px;
    gap: 8px;
  }
  
  .game-title {
    font-size: 0.9rem;
  }
  
  .game-rating {
    font-size: 0.8rem;
  }
  
  .game-desc {
    font-size: 0.75rem;
  }
  
  .btn-play {
    padding: 6px 10px;
    font-size: 12px;
  }
}
