/* ============================================================
   PLAY AT WORK — Global Design System
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

/* --- CSS Custom Properties --- */
:root {
  /* Colors — Dark Theme */
  --bg-primary: #0a0a1a;
  --bg-secondary: #111128;
  --bg-tertiary: #1a1a3e;
  --bg-card: rgba(26, 26, 62, 0.6);
  --bg-card-hover: rgba(40, 40, 90, 0.8);
  --bg-glass: rgba(255, 255, 255, 0.05);
  --bg-glass-hover: rgba(255, 255, 255, 0.1);

  /* Accent Colors */
  --accent-primary: #7c3aed;
  --accent-primary-light: #a78bfa;
  --accent-secondary: #06b6d4;
  --accent-tertiary: #10b981;
  --accent-warning: #f59e0b;
  --accent-danger: #ef4444;
  --accent-pink: #ec4899;

  /* Gradients */
  --gradient-hero: linear-gradient(135deg, #0a0a1a 0%, #1e1b4b 50%, #0a0a1a 100%);
  --gradient-card: linear-gradient(145deg, rgba(124, 58, 237, 0.1), rgba(6, 182, 212, 0.1));
  --gradient-accent: linear-gradient(135deg, #7c3aed, #06b6d4);
  --gradient-warm: linear-gradient(135deg, #ec4899, #f59e0b);
  --gradient-cool: linear-gradient(135deg, #06b6d4, #10b981);

  /* Text */
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #a78bfa;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-light: rgba(255, 255, 255, 0.1);
  --border-accent: rgba(124, 58, 237, 0.3);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Border Radius */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.3);
  --shadow-glow-cyan: 0 0 20px rgba(6, 182, 212, 0.3);

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Outfit', 'Inter', sans-serif;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  /* Layout */
  --max-width: 1400px;
  --header-height: 72px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Animated background */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--gradient-hero);
  z-index: -2;
}

body::after {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 20% 50%, rgba(124, 58, 237, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(6, 182, 212, 0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 50% 80%, rgba(236, 72, 153, 0.05) 0%, transparent 50%);
  z-index: -1;
  animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(-2%, -1%); }
  66% { transform: translate(1%, 2%); }
}

a {
  color: var(--accent-primary-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-secondary);
}

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

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  outline: none;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-primary);
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 var(--space-xl);
}

.header-inner {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  flex-shrink: 0;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--gradient-accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: var(--shadow-glow);
  transition: transform var(--transition-base);
}

.logo:hover .logo-icon {
  transform: rotate(-10deg) scale(1.1);
}

.logo-text {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.4rem;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Search */
.search-container {
  flex: 1;
  max-width: 480px;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.8rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-body);
  transition: all var(--transition-base);
}

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

.search-input:focus {
  background: var(--bg-glass-hover);
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.95rem;
  pointer-events: none;
}

/* Mobile menu toggle */
.mobile-menu-btn {
  display: none;
  background: var(--bg-glass);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  color: var(--text-primary);
  font-size: 1.3rem;
}

/* ============================================================
   CATEGORY NAVIGATION
   ============================================================ */
.category-nav {
  max-width: var(--max-width);
  margin: var(--space-lg) auto 0;
  padding: 0 var(--space-xl);
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x mandatory;
}

.category-nav::-webkit-scrollbar {
  display: none;
}

.category-pill {
  flex-shrink: 0;
  padding: 0.5rem 1.2rem;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-base);
  scroll-snap-align: start;
  white-space: nowrap;
}

.category-pill:hover,
.category-pill.active {
  background: var(--accent-primary);
  color: #fff;
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
}

/* ============================================================
   FEATURED HERO
   ============================================================ */
.featured-hero {
  max-width: var(--max-width);
  margin: var(--space-xl) auto;
  padding: 0 var(--space-xl);
}

.featured-card {
  position: relative;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--gradient-card);
  border: 1px solid var(--border-light);
  padding: var(--space-3xl);
  display: flex;
  align-items: center;
  gap: var(--space-2xl);
  cursor: pointer;
  transition: all var(--transition-slow);
  min-height: 280px;
}

.featured-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(6, 182, 212, 0.1));
  opacity: 0;
  transition: opacity var(--transition-slow);
}

.featured-card:hover::before {
  opacity: 1;
}

.featured-card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.featured-badge {
  position: absolute;
  top: var(--space-lg);
  left: var(--space-lg);
  padding: 0.3rem 0.9rem;
  background: var(--gradient-warm);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
}

.featured-content {
  flex: 1;
  z-index: 1;
}

.featured-title {
  font-family: var(--font-heading);
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: var(--space-sm);
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.featured-desc {
  color: var(--text-secondary);
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: var(--space-lg);
  max-width: 550px;
}

.featured-play-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.8rem 2rem;
  background: var(--gradient-accent);
  border-radius: var(--radius-full);
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  transition: all var(--transition-base);
  box-shadow: var(--shadow-glow);
}

.featured-play-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(124, 58, 237, 0.5);
}

.featured-thumbnail {
  width: 220px;
  height: 220px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  border: 2px solid var(--border-light);
  box-shadow: var(--shadow-lg);
  z-index: 1;
  flex-shrink: 0;
}

/* ============================================================
   GAME GRID
   ============================================================ */
.section-header {
  max-width: var(--max-width);
  margin: var(--space-2xl) auto var(--space-lg);
  padding: 0 var(--space-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

.game-grid {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-xl);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

/* --- Game Card --- */
.game-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.game-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-card);
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: 0;
}

.game-card:hover {
  transform: translateY(-6px);
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-glow);
}

.game-card:hover::before {
  opacity: 1;
}

.game-card-thumb {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
  z-index: 1;
}

.game-card-body {
  padding: var(--space-md);
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.game-card-category {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  background: rgba(124, 58, 237, 0.2);
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--accent-primary-light);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: var(--space-sm);
  width: fit-content;
}

.game-card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
  transition: color var(--transition-fast);
}

.game-card:hover .game-card-title {
  color: var(--accent-primary-light);
}

.game-card-desc {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.5;
  flex: 1;
}

/* Play overlay on hover */
.game-card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(124, 58, 237, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-base);
  z-index: 2;
  backdrop-filter: blur(4px);
}

.game-card:hover .game-card-overlay {
  opacity: 1;
}

.game-card-overlay span {
  background: #fff;
  color: var(--accent-primary);
  padding: 0.6rem 1.8rem;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: var(--shadow-md);
}

/* ============================================================
   AD PLACEHOLDERS
   ============================================================ */
.ad-container {
  max-width: var(--max-width);
  margin: var(--space-2xl) auto;
  padding: 0 var(--space-xl);
}

.ad-slot {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  overflow: hidden;
  position: relative;
}

.ad-slot::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.03), rgba(6, 182, 212, 0.03));
  pointer-events: none;
}

.ad-slot-banner {
  height: 90px;
  width: 100%;
  max-width: 728px;
  margin: 0 auto;
}

.ad-slot-rect {
  width: 300px;
  height: 250px;
}

.ad-slot-mobile {
  display: none;
  height: 100px;
  width: 320px;
  margin: 0 auto;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  max-width: var(--max-width);
  margin: var(--space-3xl) auto 0;
  padding: var(--space-2xl) var(--space-xl);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.footer-brand-icon {
  width: 28px;
  height: 28px;
  background: var(--gradient-accent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.footer-brand-text {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-secondary);
}

.footer-links {
  display: flex;
  gap: var(--space-lg);
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: color var(--transition-fast);
}

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

.footer-copy {
  color: var(--text-muted);
  font-size: 0.8rem;
  width: 100%;
  text-align: center;
  margin-top: var(--space-md);
}

/* ============================================================
   LOADING / SKELETON
   ============================================================ */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-card-hover) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-xl);
}

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

/* ============================================================
   RESPONSIVE — TABLET
   ============================================================ */
@media (max-width: 1024px) {
  .game-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .featured-card {
    padding: var(--space-2xl);
  }

  .featured-title {
    font-size: 1.8rem;
  }

  .featured-thumbnail {
    width: 180px;
    height: 180px;
  }
}

/* ============================================================
   RESPONSIVE — MOBILE
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --header-height: 60px;
  }

  .site-header {
    padding: 0 var(--space-md);
  }

  .header-inner {
    gap: var(--space-sm);
  }

  .logo-text {
    font-size: 1.1rem;
  }

  .search-container {
    display: none;
  }

  .search-container.mobile-open {
    display: block;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    padding: var(--space-md);
    background: rgba(10, 10, 26, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    max-width: 100%;
  }

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

  .category-nav {
    padding: 0 var(--space-md);
    margin-top: var(--space-md);
  }

  .featured-hero {
    padding: 0 var(--space-md);
    margin: var(--space-lg) auto;
  }

  .featured-card {
    flex-direction: column;
    padding: var(--space-xl);
    min-height: auto;
    text-align: center;
  }

  .featured-badge {
    top: var(--space-md);
    left: var(--space-md);
  }

  .featured-title {
    font-size: 1.5rem;
  }

  .featured-desc {
    font-size: 0.9rem;
  }

  .featured-thumbnail {
    width: 140px;
    height: 140px;
    order: -1;
  }

  .section-header {
    padding: 0 var(--space-md);
  }

  .game-grid {
    grid-template-columns: repeat(2, 1fr);
    padding: 0 var(--space-md);
    gap: var(--space-md);
  }

  .ad-container {
    padding: 0 var(--space-md);
  }

  .ad-slot-banner {
    display: none;
  }

  .ad-slot-mobile {
    display: flex;
  }

  .site-footer {
    padding: var(--space-xl) var(--space-md);
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  /* Collapse header buttons to icon-only */
  .site-header .btn-text {
    display: none;
  }

  .site-header button {
    padding: 0.45rem 0.55rem !important;
    gap: 0 !important;
    min-width: 34px;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .game-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-sm);
  }

  .game-card-body {
    padding: var(--space-sm);
  }

  .game-card-title {
    font-size: 0.9rem;
  }

  .game-card-desc {
    font-size: 0.7rem;
  }

  .featured-card {
    padding: var(--space-lg);
  }

  .featured-title {
    font-size: 1.3rem;
  }
}

/* ============================================================
   NATIVE FULLSCREEN OVERRIDES (DESKTOP & MOBILE)
   ============================================================ */
body.mobile-fullscreen .site-header,
body.mobile-fullscreen .site-footer,
body.mobile-fullscreen .ad-container,
body.mobile-fullscreen .game-sidebar,
body.mobile-fullscreen .game-leaderboard-btn,
body.mobile-fullscreen .game-back-btn,
body.mobile-fullscreen .game-title-area,
body.mobile-fullscreen .game-info {
  display: none !important;
}

body.mobile-fullscreen .game-page {
  padding: 0 !important;
  margin: 0 auto !important;
  max-width: none !important;
  width: 100% !important;
}

body.mobile-fullscreen .game-layout {
  padding: 0 !important;
  margin: 0 !important;
  height: 100vh !important;
  height: 100dvh !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

body.mobile-fullscreen .game-main {
  width: 100%;
  height: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

body.mobile-fullscreen .game-canvas-wrapper {
  margin: 0;
  border-radius: 0;
  border: none;
  height: 100%;
  flex: 1;
}

body.mobile-fullscreen .game-container,
body.mobile-fullscreen [class*="-board-container"],
body.mobile-fullscreen [class*="-game-area"] {
  border-radius: 0 !important;
  height: 100% !important;
  width: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
}

body.mobile-fullscreen canvas {
  max-width: none !important;
  max-height: none !important;
}
