/* ==========================================================================
   H5PlayArena - Main Stylesheet
   Light-themed HTML5 Gaming Portal
   ========================================================================== */

/* ==========================================================================
   1. Design Tokens
   ========================================================================== */

:root {
  --bg-primary: #f5f6fa;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.8);
  --bg-card-hover: rgba(255, 255, 255, 1);
  --bg-glass: rgba(0, 0, 0, 0.03);
  --bg-glass-strong: rgba(0, 0, 0, 0.06);
  --border-glass: rgba(0, 0, 0, 0.08);
  --border-glass-hover: rgba(0, 0, 0, 0.15);
  --text-primary: #1a1a2e;
  --text-secondary: rgba(26, 26, 46, 0.6);
  --text-muted: rgba(26, 26, 46, 0.35);
  --accent-1: #7c3aed;
  --accent-2: #0891b2;
  --accent-3: #e11d48;
  --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #06b6d4 50%, #e11d48 100%);
  --accent-gradient-2: linear-gradient(135deg, #7c3aed, #a855f7);
  --shadow-card: 0 2px 16px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 30px rgba(124, 58, 237, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --content-max: 1400px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --focus-ring: 0 0 0 2px var(--bg-secondary), 0 0 0 4px rgba(124, 58, 237, 0.4);
}

/* ==========================================================================
   2. Reset & Base
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-2);
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
  color: inherit;
}

::selection {
  background: rgba(124, 58, 237, 0.15);
  color: #1a1a2e;
}

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

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.12);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.2);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.12) var(--bg-primary);
}

/* ==========================================================================
   3. Background Orbs
   ========================================================================== */

.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  will-change: transform;
}

.orb-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.08), rgba(6, 182, 212, 0.04));
  top: -200px;
  left: -100px;
  animation: float-1 20s ease-in-out infinite;
}

.orb-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(225, 29, 72, 0.06), rgba(124, 58, 237, 0.03));
  bottom: -150px;
  right: -100px;
  animation: float-2 25s ease-in-out infinite;
}

.orb-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.06), rgba(34, 197, 94, 0.02));
  top: 50%;
  left: 50%;
  animation: float-3 30s ease-in-out infinite;
}

@keyframes float-1 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(100px, 50px); }
  66% { transform: translate(-50px, 100px); }
}

@keyframes float-2 {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(-80px, -60px); }
  66% { transform: translate(60px, -80px); }
}

@keyframes float-3 {
  0%, 100% { transform: translate(-50%, -50%); }
  33% { transform: translate(calc(-50% + 80px), calc(-50% + 40px)); }
  66% { transform: translate(calc(-50% - 60px), calc(-50% - 40px)); }
}

/* ==========================================================================
   4. Navbar
   ========================================================================== */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glass);
  padding: 0 24px;
}

.nav-content {
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 64px;
  gap: 16px;
}

.logo {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: -1px;
  white-space: nowrap;
  color: var(--text-primary);
}

.logo span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.search-wrap {
  flex: 1;
  max-width: 400px;
  display: flex;
  align-items: center;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 0 16px;
  gap: 8px;
  transition: var(--transition);
}

.search-wrap:focus-within {
  border-color: rgba(124, 58, 237, 0.3);
  box-shadow: var(--shadow-glow);
  background: var(--bg-secondary);
}

.search-wrap svg {
  width: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 14px;
  padding: 10px 0;
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-kbd {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-secondary);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-glass);
  white-space: nowrap;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  transition: var(--transition);
  position: relative;
}

.nav-btn:hover {
  background: var(--bg-glass-strong);
  color: var(--text-primary);
  border-color: var(--border-glass-hover);
}

.nav-btn svg {
  width: 20px;
  height: 20px;
}

.settings-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px;
  min-width: 200px;
  box-shadow: var(--shadow-card);
  display: none;
  z-index: 10;
}

.settings-panel.active {
  display: block;
}

.settings-panel h4 {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 12px;
  font-weight: 600;
}

.col-options {
  display: flex;
  gap: 6px;
}

.col-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
}

.col-btn:hover,
.col-btn.active {
  background: rgba(124, 58, 237, 0.1);
  color: var(--accent-1);
  border-color: rgba(124, 58, 237, 0.3);
}

.lang-dropdown {
  position: relative;
}

.lang-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  transition: var(--transition);
  position: relative;
  font-size: 14px;
  font-weight: 500;
}

.lang-btn:hover {
  background: var(--bg-glass-strong);
  color: var(--text-primary);
  border-color: var(--border-glass-hover);
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 8px 0;
  min-width: 160px;
  box-shadow: var(--shadow-card);
  display: none;
  z-index: 10;
}

.lang-menu.active {
  display: block;
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  width: 100%;
  text-align: left;
  font-size: 14px;
  transition: var(--transition-fast);
}

.lang-option:hover {
  background: var(--bg-glass);
}

.lang-option.active {
  color: var(--accent-1);
}

.game-count {
  background: var(--accent-gradient);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
}

/* ==========================================================================
   5. Hero Section
   ========================================================================== */

.hero {
  text-align: center;
  padding: 80px 24px 60px;
  position: relative;
  overflow: hidden;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: 30px;
  padding: 8px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.hero-badge::before {
  content: '';
  width: 8px;
  height: 8px;
  background: var(--accent-1);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.2); }
}

.hero h1 {
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1.1;
  margin: 0 0 16px;
  color: var(--text-primary);
}

.hero h1 span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  font-size: clamp(15px, 2vw, 18px);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

.hero-btns {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-gradient-2);
  color: white;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: var(--radius-lg);
  border: none;
  transition: var(--transition);
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.35);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 600;
  padding: 14px 28px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-glass);
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.btn-secondary:hover {
  background: var(--bg-glass-strong);
  border-color: var(--border-glass-hover);
  transform: translateY(-2px);
}

.hero-cards {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.hero-card {
  position: absolute;
  width: 100px;
  height: 130px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  animation: hero-float 6s ease-in-out infinite;
  opacity: 0.7;
}

.hero-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-card:nth-child(1) {
  top: 10%;
  left: 5%;
  animation-delay: 0s;
}

.hero-card:nth-child(2) {
  top: 15%;
  right: 5%;
  animation-delay: 1.5s;
}

.hero-card:nth-child(3) {
  bottom: 10%;
  left: 10%;
  animation-delay: 3s;
}

.hero-card:nth-child(4) {
  bottom: 15%;
  right: 10%;
  animation-delay: 4.5s;
}

@keyframes hero-float {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-20px) rotate(3deg); }
}

/* ==========================================================================
   6. Recently Played
   ========================================================================== */

.recent-section {
  padding: 0 24px 32px;
  max-width: var(--content-max);
  margin: 0 auto;
  display: none;
}

.recent-section.active {
  display: block;
}

.recent-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.recent-header h2 {
  font-size: clamp(18px, 2.5vw, 22px);
  font-weight: 800;
  letter-spacing: -0.5px;
}

.recent-clear {
  font-size: 13px;
  color: var(--text-muted);
  background: none;
  transition: var(--transition);
}

.recent-clear:hover {
  color: var(--accent-3);
}

.recent-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.recent-strip::-webkit-scrollbar {
  display: none;
}

.recent-card {
  min-width: 120px;
  max-width: 120px;
  cursor: pointer;
  flex-shrink: 0;
  transition: var(--transition);
}

.recent-card:hover {
  transform: translateY(-4px);
}

.recent-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.recent-card .recent-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   7. Categories
   ========================================================================== */

.categories {
  padding: 0 24px 32px;
  max-width: var(--content-max);
  margin: 0 auto;
}

.categories h2 {
  font-size: clamp(18px, 2.5vw, 22px);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}

.cat-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.cat-bar::-webkit-scrollbar {
  display: none;
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 30px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: var(--transition);
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.cat-chip:hover {
  background: var(--bg-glass-strong);
  color: var(--text-primary);
  border-color: var(--border-glass-hover);
}

.cat-chip.active {
  background: var(--accent-gradient-2);
  color: white;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(124, 58, 237, 0.25);
}

.cat-chip .cat-icon {
  font-size: 16px;
}

.cat-chip .cat-count {
  font-size: 11px;
  opacity: 0.6;
  margin-left: 2px;
}

/* ==========================================================================
   8. Games Grid
   ========================================================================== */

.games-section {
  padding: 0 24px 60px;
  max-width: var(--content-max);
  margin: 0 auto;
}

.grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.grid-header h2 {
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 800;
  letter-spacing: -0.5px;
}

.sort-select {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  cursor: pointer;
}

.sort-select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

#gamesGrid {
  display: grid;
  grid-template-columns: repeat(var(--user-grid-cols, 6), 1fr);
  gap: 16px;
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.game-card:hover {
  transform: translateY(-4px);
  background: var(--bg-card-hover);
  border-color: var(--border-glass-hover);
  box-shadow: var(--shadow-card);
}

.game-card-img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.4s ease;
}

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

.card-body {
  padding: 10px 12px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0 0 4px;
}

.card-genre {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.card-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  transition: var(--transition);
  z-index: 2;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.card-fav:hover {
  background: rgba(255, 255, 255, 0.95);
  color: var(--accent-3);
}

.card-fav.active {
  color: var(--accent-3);
}

.no-results {
  text-align: center;
  padding: 80px 24px;
  display: none;
}

.no-results.active {
  display: block;
}

.no-results h3 {
  font-size: 20px;
  margin: 0 0 8px;
  color: var(--text-primary);
}

.no-results p {
  color: var(--text-secondary);
  font-size: 15px;
}

#scrollSentinel {
  height: 1px;
}

/* ==========================================================================
   9. Modal
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  width: 100%;
  max-width: 520px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: 20px;
  overflow: hidden;
  transform: scale(0.92);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-hero {
  position: relative;
  height: 240px;
  overflow: hidden;
}

.modal-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.08);
  transition: transform 8s ease-out;
}

.modal-overlay.active .modal-hero img {
  transform: scale(1);
}

.modal-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: linear-gradient(transparent, var(--bg-secondary));
  pointer-events: none;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  border-radius: 50%;
  color: #1a1a2e;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 2;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.1);
}

.modal-body {
  padding: 0 24px 24px;
  margin-top: -40px;
  position: relative;
  z-index: 1;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.modal-tag {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(124, 58, 237, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.15);
  border-radius: 20px;
  padding: 4px 12px;
  color: var(--accent-1);
}

#modalTitle {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 8px;
}

#modalDesc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 20px;
}

.modal-actions {
  display: grid;
  gap: 10px;
}

.modal-actions .btn-play {
  grid-column: 1 / -1;
}

.btn-play {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent-gradient-2);
  color: white;
  font-size: 16px;
  font-weight: 700;
  padding: 16px;
  border-radius: var(--radius-md);
  border: none;
  transition: var(--transition);
  text-decoration: none;
}

.btn-play:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.3);
}

.btn-save,
.btn-qr {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  transition: var(--transition);
}

.btn-save:hover,
.btn-qr:hover {
  background: var(--bg-glass-strong);
}

.btn-save.saved {
  color: var(--accent-3);
  border-color: rgba(225, 29, 72, 0.2);
}

.modal-qr {
  text-align: center;
  padding: 16px 0;
  border-top: 1px solid var(--border-glass);
  margin-top: 16px;
}

.modal-qr canvas {
  margin: 0 auto;
}

/* ==========================================================================
   10. Footer
   ========================================================================== */

.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-glass);
  padding: 48px 24px 24px;
  margin-top: 60px;
}

.footer-content {
  max-width: var(--content-max);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}

.footer-brand {
  font-size: 20px;
  font-weight: 900;
  color: var(--text-primary);
}

.footer-brand span {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.footer-tagline {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.footer h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a {
  font-size: 14px;
  color: var(--text-secondary);
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--accent-1);
}

.footer-bottom {
  max-width: var(--content-max);
  margin: 24px auto 0;
  padding-top: 24px;
  border-top: 1px solid var(--border-glass);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

/* ==========================================================================
   11. Scroll-to-top
   ========================================================================== */

#scrollTop {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  background: var(--accent-gradient-2);
  color: white;
  border-radius: 50%;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.25);
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
  z-index: 50;
  cursor: pointer;
}

#scrollTop.visible {
  opacity: 1;
  visibility: visible;
}

#scrollTop:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(124, 58, 237, 0.35);
}

/* ==========================================================================
   12. Toast
   ========================================================================== */

.toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-card);
  animation: toast-in 0.3s ease-out;
  white-space: nowrap;
}

.toast.fade-out {
  animation: toast-out 0.3s ease-in forwards;
}

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

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

/* ==========================================================================
   13. Skeleton Loading
   ========================================================================== */

.skeleton {
  background: rgba(0, 0, 0, 0.04);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.03), transparent);
  animation: skeleton-shimmer 1.5s infinite;
}

@keyframes skeleton-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.skeleton-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-glass);
}

.skeleton-card .skeleton-img {
  width: 100%;
  aspect-ratio: 4 / 3;
}

.skeleton-card .skeleton-body {
  padding: 10px 12px;
}

.skeleton-card .skeleton-title {
  height: 14px;
  width: 80%;
  margin-bottom: 6px;
  border-radius: 4px;
}

.skeleton-card .skeleton-genre {
  height: 10px;
  width: 50%;
  border-radius: 4px;
}

[data-skel].cat-chip {
  width: 80px;
  height: 36px;
  background: rgba(0, 0, 0, 0.04);
}

/* ==========================================================================
   14. Utilities
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ==========================================================================
   15. Legal Page Specific Styles
   ========================================================================== */

.legal-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 100px 24px 60px;
}

.legal-page h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 900;
  margin-bottom: 32px;
  letter-spacing: -1.5px;
}

.legal-page h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 40px 0 16px;
  color: var(--text-primary);
}

.legal-page p,
.legal-page li {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text-secondary);
}

.legal-page ul {
  padding-left: 24px;
}

.legal-page a {
  color: var(--accent-1);
}

.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  transition: var(--transition);
}

.legal-back:hover {
  color: var(--accent-1);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.stat-card .stat-num {
  font-size: 36px;
  font-weight: 900;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-card .stat-label {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.values-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.value-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.value-card h3 {
  font-size: 16px;
  margin: 0 0 8px;
}

.contact-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.contact-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.contact-card h3 {
  font-size: 16px;
  margin: 0 0 8px;
}

.contact-card a {
  color: var(--accent-1);
  font-size: 15px;
}

.faq-category {
  margin-bottom: 32px;
}

.faq-category h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--accent-1);
}

details {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

details summary {
  padding: 16px 20px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

details summary::-webkit-details-marker {
  display: none;
}

details summary::after {
  content: '+';
  font-size: 20px;
  color: var(--text-muted);
  transition: var(--transition);
}

details[open] summary::after {
  content: '-';
  transform: rotate(180deg);
}

details[open] summary {
  color: var(--accent-1);
}

details .faq-answer {
  padding: 0 20px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.gdpr-rights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.right-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.right-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--accent-1);
}

.right-card p {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.6;
}

.legal-basis-table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
}

.legal-basis-table th,
.legal-basis-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-glass);
  font-size: 14px;
}

.legal-basis-table th {
  color: var(--text-primary);
  font-weight: 600;
  background: var(--bg-glass);
}

.legal-basis-table td {
  color: var(--text-secondary);
}

.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 40px 24px;
}

.error-page h1 {
  font-size: clamp(60px, 10vw, 120px);
  font-weight: 900;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 0;
}

.error-page h2 {
  font-size: clamp(20px, 3vw, 28px);
  margin: 16px 0 12px;
}

.error-page p {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.error-btns {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ==========================================================================
   16. Responsive Breakpoints
   ========================================================================== */

@media (max-width: 1100px) {
  .hero-card:nth-child(4) {
    display: none;
  }

  #gamesGrid {
    grid-template-columns: repeat(min(var(--user-grid-cols, 5), 5), 1fr);
  }

  .search-wrap {
    max-width: 300px;
  }
}

@media (max-width: 900px) {
  #gamesGrid {
    grid-template-columns: repeat(min(var(--user-grid-cols, 4), 4), 1fr);
  }

  .hero-card:nth-child(3),
  .hero-card:nth-child(4) {
    display: none;
  }

  .footer-content {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero h1 {
    letter-spacing: -1px;
  }
}

@media (max-width: 768px) {
  #gamesGrid {
    grid-template-columns: repeat(3, 1fr);
  }

  .hero-cards {
    display: none;
  }

  .hero {
    padding: 60px 24px 40px;
  }

  .footer-content {
    grid-template-columns: 1fr;
  }

  .footer-content > div:not(:first-child) {
    display: flex;
    flex-wrap: wrap;
    gap: 0 24px;
  }
}

@media (max-width: 640px) {
  #gamesGrid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  .hero h1 {
    font-size: clamp(28px, 6vw, 36px);
  }

  .hero-sub {
    font-size: 14px;
  }

  .card-body {
    padding: 8px 10px;
  }

  .card-title {
    font-size: 12px;
  }
}

@media (max-width: 600px) {
  .modal {
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    margin-top: auto;
  }

  .modal-overlay {
    align-items: flex-end;
  }

  .modal-hero {
    height: 200px;
  }

  .modal-body {
    padding: 0 20px 20px;
  }
}

@media (max-width: 480px) {
  #gamesGrid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .hero-btns .btn-secondary {
    display: none;
  }

  .search-wrap {
    max-width: 200px;
  }

  .search-kbd {
    display: none;
  }

  .nav-content {
    gap: 8px;
  }

  .game-count {
    display: none;
  }
}

@media (max-width: 380px) {
  .logo {
    font-size: 0;
    width: 40px;
    height: 40px;
    background: var(--accent-gradient-2);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .logo::after {
    content: 'H5';
    font-size: 16px;
    font-weight: 900;
    -webkit-text-fill-color: white;
  }

  .lang-dropdown {
    display: none;
  }

  .nav-content {
    gap: 4px;
  }

  .search-wrap {
    max-width: 160px;
  }
}

@media (max-width: 280px) {
  #gamesGrid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 40px 16px 24px;
  }

  .hero h1 {
    font-size: 24px;
  }

  .categories {
    padding: 0 16px 16px;
  }

  .games-section {
    padding: 0 16px 40px;
  }

  .cat-chip {
    font-size: 12px;
    padding: 6px 12px;
  }

  .btn-primary,
  .btn-secondary {
    padding: 12px 20px;
    font-size: 14px;
  }
}

/* ==========================================================================
   17. Accessibility
   ========================================================================== */

*:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

*:focus:not(:focus-visible) {
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .orb {
    display: none;
  }

  html {
    scroll-behavior: auto;
  }
}
