/* Define CSS variables with adjusted colors for a refined look */
:root {
  --primary: #00b8e6; /* Softer cyan */
  --secondary: #ffca28; /* Warmer gold */
  --accent: #ff5062; /* Slightly deeper pink */
  --background: #0a0220; /* Darker, richer background */
  --card-bg: #16114a; /* Softer card background */
  --text: #f5f5f5; /* Off-white for better contrast */
  --text-secondary: #a5b4bc; /* Lighter secondary text */
  --light-bg: #e3f2fd; /* Softer light background */
  --light-card: #fafafa; /* Slightly off-white card */
  --light-text: #0d1b24; /* Darker light mode text */
  --shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
  --glow: 0 0 12px rgba(0, 184, 230, 0.3); /* Adjusted for primary color */
  --glass-bg: rgba(10, 2, 32, 0.75);
  --glass-light-bg: rgba(255, 255, 255, 0.75);
  --ribbon-new-bg: #0069d9; /* Deeper blue */
  --ribbon-updated-bg: #f89406; /* Warmer orange */
  --ribbon-popular-bg: #5a32a3; /* Richer purple */
  --ribbon-exclusive-bg: #219653; /* Deeper green */
  --ribbon-text-color: #f5f5f5;
}

/* Global styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Poppins', sans-serif;
  scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px; /* Reduced corner radius */
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--secondary);
}

/* Body and theme styles */
body {
  background: linear-gradient(180deg, var(--background), #18094e);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

body.light-mode {
  background: linear-gradient(180deg, var(--light-bg), #4fc3f7);
  color: var(--light-text);
}

/* Starfield canvas */
canvas#starfield {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  opacity: 0.5;
}

/* Layout */
.container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  background: var(--card-bg);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 500;
  transition: transform 0.3s ease;
}

body.light-mode .sidebar {
  background: var(--light-card);
}

/* Sidebar logo */
.sidebar .logo-container {
  margin-bottom: 1.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: transform 0.2s;
}

.sidebar .logo-container:hover {
  transform: scale(1.05);
}

@keyframes logo-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

.sidebar .logo-container img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  animation: logo-pulse 3s infinite ease-in-out;
}

.sidebar .logo-container h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
}

body.light-mode .sidebar .logo-container h1 {
  color: var(--light-text);
}

/* Sidebar navigation */
.sidebar-nav {
  flex-grow: 1;
}

.sidebar .category-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.sidebar .category-item {
  padding: 0.7rem 1rem;
  background: transparent;
  border: 2px solid var(--secondary);
  color: var(--text);
  border-radius: 12px; /* Reduced corner radius */
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

body.light-mode .sidebar .category-item {
  color: var(--light-text);
  border-color: var(--light-text);
}

.sidebar .category-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--glow);
}

.sidebar .category-item.active {
  background: var(--accent);
  color: var(--light-text);
  border-color: var(--accent);
}

.sidebar-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Main content */
.main-content {
  margin-left: 280px;
  flex-grow: 1;
  padding-top: 70px;
}

header {
  position: fixed;
  top: 0;
  left: 280px;
  right: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 1000;
  box-shadow: var(--shadow);
}

body.light-mode header {
  background: var(--glass-light-bg);
}

/* Header elements */
.header-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.level-display-nav {
  background: rgba(0, 0, 0, 0.2);
  padding: 6px 12px;
  border-radius: 10px; /* Reduced corner radius */
  display: flex;
  align-items: center;
  gap: 8px;
}

body.light-mode .level-display-nav {
  background: rgba(255, 255, 255, 0.2);
}

/* Level info */
.level-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.level {
  color: var(--accent);
  font-weight: bold;
  font-size: 1.1em;
}

.exp-bar {
  width: 120px;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px; /* Reduced corner radius */
  overflow: hidden;
}

.exp-progress {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
}

.exp-text {
  color: var(--text);
  font-size: 0.75em;
}

/* Search bar */
.search-bar {
  flex-grow: 1;
  max-width: 500px;
  position: relative;
}

.search-bar input {
  width: 100%;
  padding: 0.8rem 1.2rem 0.8rem 3rem;
  border: none;
  border-radius: 15px; /* Reduced corner radius */
  background: rgba(255, 255, 255, 0.9);
  color: var(--light-text);
  font-size: 1rem;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
}

.search-bar input:focus {
  outline: none;
  box-shadow: var(--glow);
  background: #fff;
}

.search-bar::before {
  content: '\f002';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--light-text);
  font-size: 1.2rem;
}

.search-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--glass-bg);
  backdrop-filter: blur(8px);
  border-radius: 8px; /* Reduced corner radius */
  max-height: 300px;
  overflow-y: auto;
  display: none;
  z-index: 1000;
  box-shadow: var(--shadow);
  margin-top: 0.5rem;
}

body.light-mode .search-suggestions {
  background: var(--glass-light-bg);
}

.search-suggestion {
  display: flex;
  align-items: center;
  padding: 0.8rem 1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.search-suggestion:hover {
  background: rgba(255, 255, 255, 0.15);
}

.search-suggestion img {
  width: 40px;
  height: 40px;
  border-radius: 6px; /* Reduced corner radius */
  margin-right: 0.8rem;
}

.search-suggestion span {
  font-size: 0.95rem;
  font-weight: 500;
}

.search-suggestion-ribbon {
  font-size: 0.65em;
  padding: 0.1em 0.3em;
  border-radius: 2px; /* Reduced corner radius */
  margin-left: 0.4em;
  color: var(--ribbon-text-color);
}

/* Theme toggle */
.theme-toggle {
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: transform 0.3s ease;
}

.theme-toggle:hover {
  transform: scale(1.15);
}

/* Hamburger menu */
.hamburger {
  display: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.3s;
}

.hamburger:hover {
  transform: rotate(90deg);
}

body.light-mode .hamburger {
  color: var(--light-text);
}

/* Main content area */
main {
  padding: 2.5rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* Branding section */
.branding-section {
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  color: var(--light-text);
  padding: 1.5rem;
  border-radius: 8px; /* Reduced corner radius */
  text-align: center;
  margin-bottom: 2.5rem;
  box-shadow: var(--glow);
  animation: pulse 2s infinite alternate;
}

@keyframes pulse {
  0% { box-shadow: var(--glow); }
  100% { box-shadow: 0 0 20px rgba(0, 184, 230, 0.5); }
}

.branding-section h2 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.7rem;
}

.branding-section p {
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 0.8rem;
}

.branding-features {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 1.1rem;
}

.branding plant-features span {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.branding-features i {
  font-size: 1.3rem;
}

/* Loading and error states */
.loading {
  text-align: center;
  font-size: 1.2rem;
  padding: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  color: var(--text-secondary);
}

.loader {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(to right, var(--primary), var(--secondary));
  animation: pulse-ring 1.25s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.33); opacity: 0.9; }
  80%, 100% { transform: scale(1); opacity: 0; }
}

.error {
  text-align: center;
  font-size: 1.2rem;
  padding: 2.5rem;
  color: var(--accent);
}

/* Category section */
.category-section {
  margin-bottom: 3rem;
  scroll-margin-top: 80px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease-out;
}

.category-section.visible {
  opacity: 1;
  transform: translateY(0);
}

.category-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.category-header h2 {
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--secondary);
}

body.light-mode .category-header h2 {
  color: var(--light-text);
}

/* Games grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.game-card {
  background: var(--card-bg);
  border-radius: 10px; /* Reduced corner radius */
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.light-mode .game-card {
  background: var(--light-card);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.game-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--glow);
}

.game-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.game-card:hover img {
  transform: scale(1.05);
}

.game-card-info {
  padding: 1.2rem;
  text-align: center;
}

.game-card h3 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.game-card-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
  min-height: 35px;
  margin-bottom: 0.5rem;
}

body.light-mode .game-card h3 {
  color: var(--light-text);
}

body.light-mode .game-card-description {
  color: var(--light-text);
  opacity: 0.8;
}

/* Game card meta */
.game-card-meta {
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-top: 0.8rem;
}

.game-card-meta .rating {
  color: var(--secondary);
}

.game-card-meta .favorite {
  font-size: 1.3rem;
  cursor: pointer;
  transition: transform 0.2s ease-in-out;
}

.game-card-meta .favorite:hover {
  transform: scale(1.15);
}

@keyframes favorite-pop {
  0% { transform: scale(1); }
  50% { transform: scale(1.25); color: var(--accent); }
  100% { transform: scale(1); }
}

.game-card-meta .favorite.favorited::before {
  content: '\f004';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: var(--accent);
}

.game-card-meta .favorite:not(.favorited)::before {
  content: '\f004';
  font-family: 'Font Awesome 6 Free';
  font-weight: 400;
  color: var(--text-secondary);
}

.game-card-meta .favorite.favorited {
  animation: favorite-pop 0.4s ease-in-out;
}

/* Ribbon badges */
.ribbon-badge {
  display: inline-block;
  padding: 0.3em 0.8em;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ribbon-text-color);
  border-radius: 3px; /* Reduced corner radius */
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.ribbon-badge.ribbon-new { background-color: var(--ribbon-new-bg); }
.ribbon-badge.ribbon-updated { background-color: var(--ribbon-updated-bg); }
.ribbon-badge.ribbon-popular { background-color: var(--ribbon-popular-bg); }
.ribbon-badge.ribbon-astragames-exclusive { background-color: var(--ribbon-exclusive-bg); }

.search-suggestion-ribbon.ribbon-new { background-color: var(--ribbon-new-bg); }
.search-suggestion-ribbon.ribbon-updated { background-color: var(--ribbon-updated-bg); }
.search-suggestion-ribbon.ribbon-popular { background-color: var(--ribbon-popular-bg); }
.search-suggestion-ribbon.ribbon-astragames-exclusive { background-color: var(--ribbon-exclusive-bg); }

/* Game page */
.game-page {
  display: none;
  padding: 2.5rem 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
  transform: translateX(100%);
  transition: transform 0.5s ease-in-out;
}

.game-page.active {
  display: block;
  transform: translateX(0);
}

.game-content {
  display: flex;
  gap: 2rem;
}

.game-main {
  flex: 3;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: 10px; /* Reduced corner radius */
  box-shadow: var(--shadow);
}

body.light-mode .game-main {
  background: var(--glass-light-bg);
}

#game-title-container {
  text-align: center;
  margin-bottom: 0.8rem;
}

.game-main h2 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--secondary);
  margin: 0.5rem 0 0;
}

.game-title-ribbon {
  display: inline-block;
  padding: 0.3em 0.7em;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ribbon-text-color);
  border-radius: 3px; /* Reduced corner radius */
  text-transform: uppercase;
  margin-bottom: 0.6rem;
}

.game-title-ribbon.ribbon-new { background-color: var(--ribbon-new-bg); }
.game-title-ribbon.ribbon-updated { background-color: var(--ribbon-updated-bg); }
.game-title-ribbon.ribbon-popular { background-color: var(--ribbon-popular-bg); }
.game-title-ribbon.ribbon-astragames-exclusive { background-color: var(--ribbon-exclusive-bg); }

body.light-mode .game-main h2 {
  color: var(--light-text);
}

/* Game meta */
.game-meta {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}

.game-tags span {
  background: var(--primary);
  color: var(--light-text);
  padding: 0.4rem 1rem;
  border-radius: 12px; /* Reduced corner radius */
  font-size: 0.9rem;
  font-weight: 500;
  margin-right: 0.4rem;
  transition: transform 0.2s ease-in-out;
}

.game-tags span:hover {
  transform: translateY(-2px);
}

.game-rating span {
  color: var(--secondary);
  font-size: 1.4rem;
}

.favorite-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.8rem;
  transition: transform 0.2s ease-in-out;
}

.favorite-btn:hover {
  transform: scale(1.15);
}

.favorite-btn.favorited::before {
  content: '\f004';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  color: var(--accent);
}

.favorite-btn:not(.favorited)::before {
  content: '\f004';
  font-family: 'Font Awesome 6 Free';
  font-weight: 400;
  color: var(--text);
}

body.light-mode .favorite-btn:not(.favorited)::before {
  color: var(--light-text);
}

.favorite-btn.favorited {
  animation: favorite-pop 0.4s ease-in-out;
}

/* Game controls */
.game-controls {
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.fullscreen-btn,
.refresh-btn {
  padding: 0.8rem 2rem;
  border: none;
  border-radius: 15px; /* Reduced corner radius */
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.fullscreen-btn {
  background: var(--secondary);
  color: var(--light-text);
}

.fullscreen-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow);
}

.refresh-btn {
  background: var(--accent);
  color: var(--light-text);
}

.refresh-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--glow);
}

.back-to-home {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
  color: var(--primary);
  font-size: 1rem;
  font-weight: 500;
  transition: color 0.3s, transform 0.2s ease-in-out;
}

.back-to-home:hover {
  color: var(--secondary);
  transform: translateX(-4px);
}

/* Game frame */
#game-frame-container {
  position: relative;
  width: 100%;
  height: 600px;
  border-radius: 8px; /* Reduced corner radius */
  overflow: hidden;
  background-color: #08041c;
  margin-bottom: 1.2rem;
}

#game-frame-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: var(--game-bg-image);
  background-size: cover;
  background-position: center;
  filter: blur(8px) brightness(0.6);
  z-index: 1;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
  pointer-events: none;
}

#game-frame-container.show-blur-bg::before {
  opacity: 1;
}

#game-play-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 3;
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 8px; /* Reduced corner radius */
  display: none;
}

#play-game-btn {
  background-color: var(--primary);
  color: var(--light-text);
  border: none;
  border-radius: 50%;
  width: 80px;
  height: 80px;
  font-size: 2.5rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 5px 15px rgba(0, 184, 230, 0.5);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#play-game-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 8px 25px rgba(0, 184, 230, 0.7);
}

#game-loader-container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: rgba(11, 2, 32, 0.85);
  z-index: 4;
  color: var(--text);
  border-radius: 8px; /* Reduced corner radius */
}

#game-loader-container .loader {
  border: 5px solid var(--text-secondary);
  border-top: 5px solid var(--primary);
  width: 50px;
  height: 50px;
  margin-bottom: 1.2rem;
}

#game-loader-container span {
  font-size: 1.1rem;
  font-weight: 500;
}

.game-main iframe#game-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: none;
  position: relative;
  z-index: 2;
  border-radius: 8px; /* Reduced corner radius */
}

.game-main p#game-description {
  margin: 1.5rem 0;
  line-height: 1.6;
  color: var(--text-secondary);
  font-size: 1rem;
}

body.light-mode .game-main p#game-description {
  color: #2e3b44;
}

/* Similar games */
.similar-games {
  flex: 1;
  background: var(--glass-bg);
  backdrop-filter: blur(10px);
  padding: 2rem;
  border-radius: 10px; /* Reduced corner radius */
  box-shadow: var(--shadow);
}

body.light-mode .similar-games {
  background: var(--glass-light-bg);
}

.similar-games h3 {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 1.5rem;
}

body.light-mode .similar-games h3 {
  color: var(--light-text);
}

.similar-game {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  cursor: pointer;
  padding: 0.8rem;
  border-radius: 8px; /* Reduced corner radius */
  transition: all 0.3s ease;
}

.similar-game:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.similar-game img {
  width: 80px;
  height: 80px;
  border-radius: 8px; /* Reduced corner radius */
}

/* Toast and achievement */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: var(--light-text);
  padding: 0.7rem 1.5rem;
  border-radius: 12px; /* Reduced corner radius */
  z-index: 2000;
  opacity: 0;
  transition: opacity 0.4s ease;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
}

.toast.show {
  opacity: 1;
}

.achievement {
  position: fixed;
  top: 15px;
  right: -280px;
  background: linear-gradient(45deg, var(--primary), var(--secondary));
  color: #fff;
  padding: 0.8rem 1.5rem;
  border-radius: 8px; /* Reduced corner radius */
  display: flex;
  align-items: center;
  gap: 0.8rem;
  box-shadow: var(--shadow);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 2000;
}

.achievement-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.achievement-title {
  font-weight: bold;
  font-size: 1rem;
}

.achievement-desc {
  font-size: 0.85rem;
  opacity: 0.9;
}

.achievement.show {
  transform: translateX(-300px);
}

.achievement i {
  font-size: 1.3rem;
  color: #ffca28;
}

/* Back to top */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--primary);
  color: var(--light-text);
  padding: 0.8rem;
  border-radius: 50%;
  cursor: pointer;
  display: none;
  z-index: 1000;
  transition: all 0.3s ease;
  box-shadow: var(--shadow);
}

.back-to-top:hover {
  transform: scale(1.1);
  box-shadow: var(--glow);
}

/* Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 900;
  display: none;
}

.overlay.active {
  display: block;
}

/* Media queries */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
  }

  .game-frame-container {
    height: 50vh !important;
  }

  .search-bar {
    width: 100%;
    max-width: none;
  }

  .header-right {
    gap: 0.5rem;
  }

  .game-card {
    margin: 0.5rem;
  }

  .branding-section {
    margin: 1rem;
    padding: 1.2rem;
  }

  .search-bar input {
    font-size: 0.95rem;
    padding: 0.6rem 1rem 0.6rem 2.8rem;
  }

  .category-header h2 {
    font-size: 1.7rem;
    margin-left: 1rem;
  }

  .games-grid {
    gap: 1rem;
    padding: 0.5rem;
  }

  .sidebar {
    transform: translateX(-100%);
    z-index: 1100;
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding-top: 60px;
  }

  header {
    left: 0;
    padding: 0.7rem 1.2rem;
  }

  .hamburger {
    display: block;
  }

  main {
    padding: 2rem 1.2rem;
  }

  .search-bar {
    max-width: calc(100% - 50px);
  }

  .games-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  .ribbon-badge {
    font-size: 0.7rem;
    padding: 0.25em 0.6em;
  }

  .game-content {
    flex-direction: column;
  }

  .game-main {
    padding: 1.2rem;
  }

  .game-main h2 {
    font-size: 2rem;
  }

  .game-title-ribbon {
    font-size: 0.85rem;
  }

  #game-frame-container {
    height: 400px;
  }

  .game-card img {
    height: 160px;
  }

  .branding-section h2 {
    font-size: 1.8rem;
  }

  .branding-section p {
    font-size: 1rem;
  }

  .branding-features {
    gap: 0.8rem;
    font-size: 0.95rem;
  }

  .branding-features i {
    font-size: 1.1rem;
  }
}

@media (max-width: 480px) {
  .games-grid {
    grid-template-columns: 1fr;
  }

  .game-card-info {
    padding: 0.8rem;
  }

  .ribbon-badge {
    font-size: 0.65rem;
  }

  .game-card h3 {
    font-size: 1.2rem;
  }

  .game-card-description {
    font-size: 0.8rem;
    min-height: 25px;
  }

  .game-card img {
    height: 140px;
  }

  #game-frame-container {
    height: 300px;
  }

  main {
    padding: 1.2rem 0.8rem;
  }

  .category-header h2 {
    font-size: 1.8rem;
  }

  .game-main h2 {
    font-size: 1.6rem;
  }

  .game-title-ribbon {
    font-size: 0.75rem;
  }

  .branding-section h2 {
    font-size: 1.6rem;
  }

  .branding-section p {
    font-size: 0.9rem;
  }

  .branding-features {
    flex-direction: column;
    align-items: center;
  }
}
