* { box-sizing: border-box; }

/* Dark mode (default) */
:root {
  --bg-primary: #0f172a;
  --bg-gradient-1: rgba(59, 130, 246, 0.1);
  --bg-gradient-2: rgba(139, 92, 246, 0.1);
  --text-primary: #ffffff;
  --text-secondary: #94a3b8;
  --accent-color: #3b82f6;
  --accent-color-rgb: 59, 130, 246;
  --dot-color: rgba(59, 130, 246, 0.3);
  --card-bg: rgba(255, 255, 255, 0.05);
  --card-bg-hover: rgba(255, 255, 255, 0.1);
  --card-border: rgba(255, 255, 255, 0.1);
  --card-border-hover: rgba(59, 130, 246, 0.5);
  --card-shadow: rgba(59, 130, 246, 0.3);
  --button-bg: rgba(59, 130, 246, 0.2);
  --button-bg-hover: rgba(59, 130, 246, 0.4);
  --button-border: rgba(59, 130, 246, 0.4);
  --button-border-hover: rgba(59, 130, 246, 0.6);
  --button-text: #60a5fa;
  --button-text-hover: #ffffff;
  --globe-gradient-1: #3b82f6;
  --globe-gradient-2: #8b5cf6;
  --ring-color: rgba(59, 130, 246, 0.3);
}

/* Light mode */
html.light-mode,
body.light-mode {
  --bg-primary: linear-gradient(to bottom, #f8fafc 0%, #e2e8f0 100%);
  --bg-gradient-1: rgba(59, 130, 246, 0.05);
  --bg-gradient-2: rgba(139, 92, 246, 0.05);
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --accent-color: #2563eb;
  --accent-color-rgb: 37, 99, 235;
  --dot-color: rgba(100, 116, 139, 0.15);
  --card-bg: rgba(255, 255, 255, 0.9);
  --card-bg-hover: rgba(255, 255, 255, 1);
  --card-border: rgba(0, 0, 0, 0.08);
  --card-border-hover: rgba(37, 99, 235, 0.4);
  --card-shadow: rgba(0, 0, 0, 0.1);
  --button-bg: rgba(37, 99, 235, 0.1);
  --button-bg-hover: rgba(37, 99, 235, 0.2);
  --button-border: rgba(37, 99, 235, 0.3);
  --button-border-hover: rgba(37, 99, 235, 0.5);
  --button-text: #2563eb;
  --button-text-hover: #1e40af;
  --globe-gradient-1: #1e3a8a;
  --globe-gradient-2: #581c87;
  --ring-color: rgba(59, 130, 246, 0.2);
}

body {
  margin: 0;
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

html {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* Animated world map background */
.map-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(circle at 20% 50%, var(--bg-gradient-1) 0%, transparent 50%),
    radial-gradient(circle at 80% 50%, var(--bg-gradient-2) 0%, transparent 50%);
  z-index: 0;
}

.map-dots {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    radial-gradient(circle, var(--dot-color) 1px, transparent 1px);
  background-size: 50px 50px;
  opacity: 0.3;
  animation: map-float 20s ease-in-out infinite;
}

@keyframes map-float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-20px, -20px); }
}

.content {
  position: relative;
  z-index: 1;
  max-width: 1500px;
  margin: 0 auto;
  padding: 40px 24px;
}

.header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 36px;
  position: relative;
}

.globe-container {
  position: relative;
  flex-shrink: 0;
}

.globe-icon {
  width: 88px;
  height: 88px;
  display: block;
  position: relative;
}

.globe-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100px;
  height: 100px;
  border: 2px solid var(--ring-color);
  border-radius: 50%;
  animation: pulse-ring 2s ease-in-out infinite;
  pointer-events: none;
}

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

h1 {
  font-size: 42px;
  font-weight: 800;
  margin: 0;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.1;
  white-space: nowrap;
}

html.light-mode h1 {
  background: linear-gradient(135deg, #1e3a8a 0%, #581c87 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Globe SVG gradient — light mode override */
html.light-mode #globe-grad stop:first-child { stop-color: #1e3a8a; }
html.light-mode #globe-grad stop:last-child { stop-color: #581c87; }

.subtitle {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 17px;
  color: var(--text-primary);
  opacity: 0.75;
  line-height: 1.5;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-align: center;
  pointer-events: none;
  font-style: italic;
}

/* Menu button flows inside header on index page */
.header .menu-btn {
  position: static;
  flex-shrink: 0;
  margin-left: auto;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 24px;
}

.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  padding: 24px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.glass-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg,
    rgba(var(--accent-color-rgb), 0.15) 0%,
    rgba(var(--accent-color-rgb), 0.05) 100%);
  opacity: 0;
  transition: opacity 0.4s;
}

.glass-card:hover {
  transform: translateY(-8px) scale(1.02);
  background: var(--card-bg-hover);
  border-color: var(--card-border-hover);
  box-shadow: 0 20px 60px var(--card-shadow);
}

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

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

.pin-marker {
  font-size: 50px;
  display: block;
  margin-bottom: 15px;
  animation: pin-bounce 2s ease-in-out infinite;
}

.game-icon {
  font-size: 48px;
  line-height: 1;
  text-align: center;
  display: block;
  margin: 0 auto 15px;
  transition: transform 0.3s ease;
}

.glass-card:hover .game-icon {
  transform: scale(1.1);
}

@keyframes pin-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.card-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

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

.play-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  padding: 10px 20px;
  background: var(--button-bg);
  border: 1px solid var(--button-border);
  border-radius: 12px;
  color: var(--button-text);
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s;
}

.glass-card:hover .play-button {
  background: var(--button-bg-hover);
  border-color: var(--button-border-hover);
  color: var(--button-text-hover);
}

@media (max-width: 1000px) and (min-width: 641px) {
  .subtitle {
    position: static;
    transform: none;
    flex: 1;
    text-align: center;
    font-size: 14px;
    line-height: 1.4;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 20px 14px;
  }

  .header {
    gap: 10px;
    margin-bottom: 16px;
  }

  .globe-icon {
    width: 48px;
    height: 48px;
  }

  .globe-ring {
    width: 56px;
    height: 56px;
    border-width: 1.5px;
  }

  h1 {
    font-size: 24px;
  }

  .subtitle {
    position: static;
    transform: none;
    flex: 1;
    text-align: center;
    font-size: 11px;
    line-height: 1.3;
  }

  .header .menu-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  .games-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 12px;
  }

  .glass-card {
    padding: 14px;
    border-radius: 16px;
  }

  .card-content {
    display: grid;
    grid-template-columns: 44px 1fr;
    grid-template-rows: auto auto auto;
    gap: 8px 12px;
    grid-template-areas:
      "icon title"
      "desc desc"
      "button button";
  }

  .game-icon {
    grid-area: icon;
    font-size: 36px;
    line-height: 1;
    text-align: center;
    margin: 0;
    align-self: center;
  }

  .card-title {
    grid-area: title;
    font-size: 16px;
    margin: 0;
    align-self: center;
  }

  .card-description {
    grid-area: desc;
    font-size: 12px;
    line-height: 1.5;
    margin: 0;
  }

  .play-button {
    grid-area: button;
    margin: 0;
    padding: 6px 12px;
    font-size: 12px;
    justify-self: start;
    width: auto;
  }

  .pin-marker {
    font-size: 36px;
    margin-bottom: 10px;
  }
}
