/* ═══════════════════════════════════════════════════════
   global.css — Game Platform Design System
   Dark mode first, modern gaming aesthetic
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&family=Inter:wght@300;400;500;600&display=swap');

/* ─── Design Tokens ─────────────────────────────────── */
:root {
  --bg-base: #0a0a0f;
  --bg-surface: #111118;
  --bg-elevated: #18181f;
  --bg-card: #1c1c26;
  --bg-hover: #22222e;

  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);

  --text-primary: #f0f0f8;
  --text-secondary: #a0a0b8;
  --text-muted: #60607a;

  --accent: #6c63ff;
  --accent-glow: rgba(108, 99, 255, 0.35);
  --accent-2: #00d4ff;
  --accent-3: #ff6b9d;
  --accent-4: #ffd700;

  --success: #00e676;
  --error: #ff5252;
  --warning: #ffab40;

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 48px rgba(0, 0, 0, 0.7);
  --shadow-accent: 0 0 32px var(--accent-glow);

  --font-display: 'Syne', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-body: 'Inter', sans-serif;

  --navbar-h: 64px;
  --sidebar-w: 260px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset & Base ───────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

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

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

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 99px;
}

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

/* ─── Grid Noise Texture Background ─────────────────── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(108, 99, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(108, 99, 255, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ─── Navbar ─────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--navbar-h);
  background: var(--bg-navbar, rgba(10, 10, 15, 0.85));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

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

.nav-logo .logo-dot {
  color: var(--accent-2);
}

.nav-search {
  flex: 1;
  max-width: 440px;
  position: relative;
}

.nav-search input {
  width: 100%;
  height: 40px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 16px 0 40px;
  color: var(--text-primary);
  font-size: 14px;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

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

.nav-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.nav-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.nav-links a,
.nav-links button {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: color var(--transition), background var(--transition);
}

.nav-links a:hover,
.nav-links button:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.nav-links .btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 8px 20px;
}

.nav-links .btn-primary:hover {
  background: #7c73ff;
  color: #fff;
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: background var(--transition);
}

.nav-toggle:hover {
  background: var(--bg-elevated);
}

/* ─── Search Dropdown ────────────────────────────────── */
.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: none;
  z-index: 200;
}

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

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  transition: background var(--transition);
  cursor: pointer;
}

.search-result-item:hover {
  background: var(--bg-hover);
}

.search-result-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--bg-card);
}

.search-result-info {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  font-weight: 600;
  font-size: 14px;
}

.search-result-cat {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Layout: Page ───────────────────────────────────── */
.page-layout {
  display: flex;
  min-height: calc(100vh - var(--navbar-h));
  position: relative;
  z-index: 1;
}

/* ─── Sidebar ────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  position: sticky;
  top: var(--navbar-h);
  height: calc(100vh - var(--navbar-h));
  overflow-y: auto;
  padding: 20px 12px;
  border-right: 1px solid var(--border);
  background: var(--bg-base);
}

.sidebar-section {
  margin-bottom: 24px;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 8px;
  margin-bottom: 6px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.sidebar-item:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.sidebar-item.active {
  color: var(--accent);
  background: rgba(108, 99, 255, 0.12);
}

.sidebar-item .item-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-item .item-count {
  margin-left: auto;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 2px 7px;
  border-radius: 99px;
}

/* ─── Main Content ───────────────────────────────────── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 32px 40px;
  max-width: 1200px;
}

/* ─── Section Headers ────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .title-accent {
  color: var(--accent);
}

.section-link {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  transition: opacity var(--transition);
}

.section-link:hover {
  opacity: 0.7;
}

/* ─── Game Cards ─────────────────────────────────────── */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  position: relative;
  text-decoration: none;
  color: inherit;
}

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

.game-card:hover .card-play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.card-thumb {
  position: relative;
  aspect-ratio: 16/9;
  overflow: hidden;
  background: var(--bg-elevated);
}

.card-thumb img,
.card-thumb svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

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

.card-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  width: 48px;
  height: 48px;
  background: rgba(108, 99, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition), transform var(--transition);
  backdrop-filter: blur(8px);
}

.card-play svg {
  margin-left: 3px;
}

.card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.card-body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-category {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
}

.card-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-top: 2px;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.card-rating {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--accent-4);
  display: flex;
  align-items: center;
  gap: 3px;
}

.card-plays {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

/* ─── Hero Section ───────────────────────────────────── */
.hero {
  position: relative;
  padding: 60px 0 40px;
  overflow: hidden;
  margin-bottom: 40px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 80% at 70% 50%, rgba(108, 99, 255, 0.15) 0%, transparent 70%),
    radial-gradient(ellipse 40% 60% at 20% 80%, rgba(0, 212, 255, 0.08) 0%, transparent 60%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 16px;
}

.hero-eyebrow::before {
  content: '';
  width: 24px;
  height: 2px;
  background: var(--accent);
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1.5px;
  margin-bottom: 16px;
}

.hero h1 em {
  font-style: normal;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 520px;
  margin-bottom: 32px;
  line-height: 1.7;
}

.hero-stats {
  display: flex;
  gap: 32px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -1px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Trending Strip ─────────────────────────────────── */
.trending-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  margin-bottom: 40px;
}

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

.trending-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.trending-chip:hover {
  border-color: var(--accent);
  background: rgba(108, 99, 255, 0.1);
  transform: translateY(-2px);
}

.trending-chip img,
.trending-chip .chip-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-elevated);
}

.chip-title {
  font-weight: 600;
  font-size: 14px;
}

.chip-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.chip-fire {
  color: var(--accent-3);
  font-size: 16px;
}

/* ─── Category Pills ─────────────────────────────────── */
.category-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.cat-pill {
  padding: 7px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.cat-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.cat-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ─── Featured Cards ─────────────────────────────────── */
.featured-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 16px;
  margin-bottom: 40px;
}

.featured-card-large {
  grid-column: 1;
  grid-row: 1 / 3;
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  aspect-ratio: 1/1.1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.featured-card-large:hover {
  transform: scale(1.015);
  box-shadow: var(--shadow-lg), var(--shadow-accent);
}

.featured-card-sm {
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
}

.featured-card-sm:hover {
  border-color: var(--border-strong);
  background: var(--bg-hover);
  transform: translateX(4px);
}

.featured-card-sm .sm-thumb {
  width: 64px;
  height: 64px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  flex-shrink: 0;
  overflow: hidden;
}

.featured-card-sm .sm-thumb img,
.featured-card-sm .sm-thumb svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.featured-bg {
  position: absolute;
  inset: 0;
  object-fit: cover;
}

.featured-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.3) 50%, transparent 100%);
}

.featured-body {
  position: relative;
  padding: 20px;
  z-index: 1;
}

.featured-card-mini {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 1.2/1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.featured-card-mini:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-md), var(--shadow-accent);
}

.featured-card-mini .mini-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.featured-card-mini:hover .mini-bg {
  transform: scale(1.05);
}

.featured-card-mini .mini-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.2) 60%, transparent 100%);
}

.featured-card-mini .mini-body {
  position: relative;
  padding: 12px;
  z-index: 1;
}

/* ─── Buttons ────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  transition: all var(--transition);
  cursor: pointer;
}

.btn-accent {
  background: var(--accent);
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(108, 99, 255, 0.4);
}

.btn-accent:hover {
  background: #7c73ff;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(108, 99, 255, 0.5);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

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

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

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

.btn-icon.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ─── Game Page Layout ───────────────────────────────── */
.game-page-layout {
  display: flex;
  gap: 24px;
  padding: 24px;
  max-width: 1400px;
  margin: 0 auto;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.game-page-layout input,
.game-page-layout textarea {
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

.game-sidebar {
  width: 240px;
  flex-shrink: 0;
  position: sticky;
  top: calc(var(--navbar-h) + 24px);
  max-height: calc(100vh - var(--navbar-h) - 48px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.game-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.game-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.game-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.game-container-wrap {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  order: -1;
}

.game-canvas-area {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  touch-action: none;
}

.game-canvas-area canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  touch-action: none;
}

.game-controls-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
}

.controls-left {
  display: flex;
  gap: 6px;
}

.controls-right {
  display: flex;
  gap: 6px;
  margin-left: auto;
}

.game-score-bar {
  display: flex;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.score-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.score-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.score-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ─── Info Panel ─────────────────────────────────────── */
.info-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

.info-panel h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ─── Sidebar mini game list ─────────────────────────── */
.mini-game-item {
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
  color: inherit;
}

.mini-game-item:hover {
  background: var(--bg-elevated);
}

.mini-game-item.active {
  background: rgba(108, 99, 255, 0.1);
}

.mini-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--bg-elevated);
  overflow: hidden;
  flex-shrink: 0;
}

.mini-thumb img,
.mini-thumb svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-info {
  flex: 1;
  min-width: 0;
}

.mini-title {
  font-size: 13px;
  font-weight: 600;
}

.mini-cat {
  font-size: 11px;
  color: var(--text-muted);
}

/* ─── Toast ──────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  transform: translateX(120%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-lg);
  max-width: 320px;
}

.toast.toast-visible {
  transform: translateX(0);
}

.toast-success {
  border-color: var(--success);
}

.toast-error {
  border-color: var(--error);
}

/* ─── Loading Screen ─────────────────────────────────── */
.game-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  gap: 16px;
  z-index: 10;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ─── Footer ─────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 40px 40px 24px;
  margin-top: 80px;
}


.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand .nav-logo {
  font-size: 20px;
  margin-bottom: 12px;
}

.footer-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 240px;
}

.footer-col h4 {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.footer-col a {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  transition: color var(--transition);
}

.footer-col a:hover {
  color: var(--text-primary);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

/* ─── Mobile Menu ────────────────────────────────────── */
.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
}

.mobile-menu.open {
  display: flex;
}

.mobile-menu-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.mobile-menu-panel {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 280px;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  overflow-y: auto;
  animation: slideIn 0.25s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(-100%);
  }
}

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar {
    display: none;
  }

  .main-content {
    padding: 20px 20px;
  }

  .featured-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .featured-card-large {
    grid-column: 1;
    grid-row: auto;
    aspect-ratio: 16/7;
  }

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

@media (max-width: 768px) {
  .nav-search {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    display: none;
  }

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

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

  .hero-stats {
    gap: 20px;
  }

  .stat-value {
    font-size: 22px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .footer {
    padding: 24px 20px 16px;
  }

  .game-page-layout {
    flex-direction: column;
    padding: 16px;
  }

  .game-sidebar {
    width: 100%;
    position: static;
    max-height: none;
  }

  .game-main {
    order: -1;
  }
}

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

  .main-content {
    padding: 16px;
  }

  .trending-chip {
    padding: 8px 12px 8px 8px;
  }
}

/* ─── Animations ─────────────────────────────────────── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-up {
  animation: fadeUp 0.4s ease both;
}

.fade-up-1 {
  animation-delay: 0.05s;
}

.fade-up-2 {
  animation-delay: 0.1s;
}

.fade-up-3 {
  animation-delay: 0.15s;
}

.fade-up-4 {
  animation-delay: 0.2s;
}

/* ─── Utility ────────────────────────────────────────── */
.text-accent {
  color: var(--accent);
}

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

.text-sm {
  font-size: 13px;
}

.text-mono {
  font-family: var(--font-mono);
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.mt-40 {
  margin-top: 40px;
}

.mb-4 {
  margin-bottom: 4px;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-24 {
  margin-bottom: 24px;
}

.mb-40 {
  margin-bottom: 40px;
}

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

/* ─── Theme Selector ───────────────────────────────── */
.theme-select,
.lang-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
  font-family: var(--font-body);
}

.theme-select:hover,
.lang-select:hover {
  border-color: var(--accent);
}

/* ─── Light Mode Overrides ─────────────────────────── */
html[data-theme="light"] {
  --bg-base: #f5f6fa;
  --bg-surface: #ffffff;
  --bg-elevated: #eaedf4;
  --bg-card: #e1e5f0;
  --bg-hover: #d6dbec;
  --bg-navbar: rgba(255, 255, 255, 0.85);

  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.16);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --accent-glow: rgba(108, 99, 255, 0.15);
  --accent-2: #008fb3;
  --accent-3: #db2777;
  --accent-4: #b59000;
}

/* ─── Profile Menu & Dropdown ────────────────────────── */
.user-profile-menu {
  position: relative;
  display: inline-block;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 140px;
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  padding: 4px 0;
  z-index: 100;
  margin-top: 6px;
}

.user-dropdown a,
.user-dropdown button {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text-primary);
  text-decoration: none;
  text-align: left;
  border: none;
  background: none;
  width: 100%;
  cursor: pointer;
  display: block;
}

.user-dropdown a:hover,
.user-dropdown button:hover {
  background: var(--bg-hover);
}

.user-dropdown .logout-item {
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.user-profile-menu:hover .user-dropdown {
  display: flex;
}

/* ─── Modal Backdrop & Registration Prompt ────────────── */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg), var(--shadow-accent);
  text-align: center;
  animation: scaleUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleUp {
  from {
    transform: scale(0.9);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-card h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.modal-subtext {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.modal-card .input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 12px;
  transition: border-color var(--transition);
}

.modal-card .input-wrap:focus-within {
  border-color: var(--accent);
}

.modal-card .input-prefix {
  color: var(--accent);
  font-weight: bold;
  font-family: var(--font-mono);
  margin-right: 4px;
}

.modal-card input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  width: 100%;
  font-size: 14px;
}

.modal-card .error-msg {
  color: #ff5252;
  font-size: 12px;
  min-height: 18px;
  margin-bottom: 16px;
  text-align: left;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-actions button {
  width: 100%;
  justify-content: center;
}

/* ─── Compact & Arcade Layout Variations ────────────────── */
.page-layout.layout-compact .sidebar,
.page-layout.layout-arcade .sidebar {
  display: none;
}

.page-layout.layout-compact .main-content,
.page-layout.layout-arcade .main-content {
  max-width: 1300px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Center Category pills styling for non-sidebar layouts */
.layout-compact .category-pills,
.layout-arcade .category-pills {
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}

/* Arcade Mode Game Strips */
.games-strip-container {
  position: relative;
  display: flex;
  flex-direction: column;
}

.games-strip-wrapper {
  position: relative;
  width: 100%;
}

.games-strip {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 10px 4px;
  width: 100%;
}

.games-strip .game-card {
  flex: 0 0 220px;
  min-width: 220px;
  max-width: 220px;
}

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

.games-strip {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.strip-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  background: rgba(10, 10, 15, 0.85);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 50%;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all var(--transition);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

.strip-nav-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 0 15px var(--accent);
}

.strip-nav-btn.prev {
  left: -20px;
}

.strip-nav-btn.next {
  right: -20px;
}

/* Hide navigation buttons on mobile touch devices */
@media (max-width: 768px) {
  .strip-nav-btn {
    display: none;
  }
}

/* ─── Settings Cog Menu ────────────────────────────── */
.settings-menu-container {
  position: relative;
  display: inline-block;
  margin-left: 8px;
}

.settings-toggle-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  padding: 0 !important
}

.settings-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.settings-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  width: 200px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 100;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.settings-dropdown.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.settings-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-item label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.settings-item select {
  width: 100%;
}

/* --- Theme Segment Control --- */
.theme-options-group {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.theme-opt-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  padding: 6px 0;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
}

.theme-opt-btn:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.theme-opt-btn.active {
  background: var(--accent);
  color: #fff;
}

/* Standard Native Fullscreen styling */
.game-container-wrap:fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 999999 !important;
  background: var(--bg-surface) !important;
  border: none !important;
  border-radius: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}
.game-container-wrap:fullscreen .game-canvas-area {
  flex: 1 1 auto !important;
  height: 0 !important;
  aspect-ratio: unset !important;
}
.game-container-wrap:fullscreen .game-canvas-area canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Webkit Native Fullscreen styling (Chrome, Safari, Opera) */
.game-container-wrap:-webkit-full-screen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 999999 !important;
  background: var(--bg-surface) !important;
  border: none !important;
  border-radius: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}
.game-container-wrap:-webkit-full-screen .game-canvas-area {
  flex: 1 1 auto !important;
  height: 0 !important;
  aspect-ratio: unset !important;
}
.game-container-wrap:-webkit-full-screen .game-canvas-area canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Pseudo Fullscreen Fallback styling (iOS Safari) */
.game-container-wrap.pseudo-fullscreen {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  z-index: 999999 !important;
  background: var(--bg-surface) !important;
  border: none !important;
  border-radius: 0 !important;
  display: flex !important;
  flex-direction: column !important;
}
.game-container-wrap.pseudo-fullscreen .game-canvas-area {
  flex: 1 1 auto !important;
  height: 0 !important;
  aspect-ratio: unset !important;
}
.game-container-wrap.pseudo-fullscreen .game-canvas-area canvas {
  width: 100% !important;
  height: 100% !important;
}