@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&display=swap');

:root {
  --font-main: 'Fredoka', 'Segoe UI', sans-serif;
  --bg-color: #110524;
  --purple-glow: #b794ff;
  --unicorn-gradient: linear-gradient(135deg, #ffd1f5, #b794ff);
  --mermaid-gradient: linear-gradient(135deg, #a8ffeb, #0a5a86);
  --narwhal-gradient: linear-gradient(135deg, #b8e3f2, #3f6f99);
  --sloth-gradient: linear-gradient(135deg, #fff7e8, #3f7d4a);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-color);
  font-family: var(--font-main);
  color: #ffffff;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Twinkle Star Background Layer */
.stars-bg {
  position: absolute;
  inset: 0;
  background-image: 
    radial-gradient(1px 1px at 20px 30px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 40px 70px, #fff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 150px 100px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 280px 120px, #ffd1f5, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 310px 240px, #fff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 450px 380px, #8ee8ff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 90px 420px, #fff, rgba(0,0,0,0)),
    radial-gradient(1.5px 1.5px at 200px 520px, #ffe3a3, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 550px 550px;
  opacity: 0.45;
  animation: bg-twinkle 4s infinite alternate ease-in-out;
  pointer-events: none;
  z-index: 0;
}

@keyframes bg-twinkle {
  from { opacity: 0.3; }
  to { opacity: 0.6; }
}

.container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 30px 20px 120px 20px;
  position: relative;
  z-index: 1;
}

/* Header design */
header {
  text-align: center;
  margin-bottom: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.logo-wrapper {
  width: 130px;
  height: 130px;
  background: radial-gradient(circle, rgba(183, 148, 255, 0.2) 0%, rgba(0,0,0,0) 70%);
  display: flex;
  justify-content: center;
  align-items: center;
  animation: logo-float 4s infinite ease-in-out;
}

.logo-icon {
  width: 90px;
  height: 90px;
  filter: drop-shadow(0 0 15px rgba(183, 148, 255, 0.6));
}

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

header h1 {
  font-size: clamp(32px, 8vw, 48px);
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #ffd1f5, #b794ff, #8ee8ff, #ffd1f5);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 20px rgba(183, 148, 255, 0.35);
  animation: rainbow-text 10s infinite linear;
  margin-top: 10px;
}

@keyframes rainbow-text {
  0% { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

.tagline {
  font-size: clamp(14px, 4.5vw, 18px);
  color: #e2d9ff;
  opacity: 0.9;
  margin-top: 8px;
}

/* Connection status badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  transition: all 0.3s ease;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.badge.checking .badge-dot { background-color: #ffe3a3; animation: pulse 1s infinite alternate; }
.badge.online .badge-dot { background-color: #6bffb8; box-shadow: 0 0 8px #6bffb8; }
.badge.offline .badge-dot { background-color: #ff9eb5; box-shadow: 0 0 8px #ff9eb5; }

@keyframes pulse {
  from { opacity: 0.4; }
  to { opacity: 1; }
}

/* Games grid card layout */
.games-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 600px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.game-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s ease, border-color 0.25s ease;
  min-height: 200px;
  justify-content: space-between;
}

.card-glow {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 0;
}

.game-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
}

.game-card:hover .card-glow {
  opacity: 0.15;
}

.game-card:active {
  transform: translateY(-2px) scale(0.99);
}

.card-icon {
  font-size: 56px;
  margin-bottom: 15px;
  transition: transform 0.3s ease;
  z-index: 1;
  display: inline-block;
  width: fit-content;
}

.game-card:hover .card-icon {
  transform: scale(1.15) rotate(5deg);
}

.card-info {
  z-index: 1;
}

.card-info h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}

.card-info p {
  font-size: 14px;
  line-height: 1.4;
  color: #cbc3e3;
  margin-bottom: 20px;
}

.play-btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 99px;
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
  width: 100%;
}

/* Card-Specific Themes */
.unicorn-card .card-glow { background: radial-gradient(circle at 10% 10%, #ffd1f5, #b794ff); }
.unicorn-card:hover { box-shadow: 0 10px 25px rgba(183, 148, 255, 0.25); }
.unicorn-card .card-info h2 { color: #ffd1f5; }
.unicorn-card .play-btn {
  background: linear-gradient(135deg, #ffe3a3, #ffb6e6);
  color: #2a0e44;
  box-shadow: 0 4px 12px rgba(255, 182, 230, 0.3);
}

.mermaid-card .card-glow { background: radial-gradient(circle at 10% 10%, #a8ffeb, #0a5a86); }
.mermaid-card:hover { box-shadow: 0 10px 25px rgba(47, 214, 196, 0.25); }
.mermaid-card .card-info h2 { color: #a8ffeb; }
.mermaid-card .play-btn {
  background: linear-gradient(135deg, #ffe9f4, #ffc4e2);
  color: #04263b;
  box-shadow: 0 4px 12px rgba(255, 196, 226, 0.3);
}

.narwhal-card .card-glow { background: radial-gradient(circle at 10% 10%, #b8e3f2, #3f6f99); }
.narwhal-card:hover { box-shadow: 0 10px 25px rgba(126, 200, 227, 0.25); }
.narwhal-card .card-info h2 { color: #bdeaff; }
.narwhal-card .play-btn {
  background: linear-gradient(135deg, #ffd9c0, #ffd9a0);
  color: #234a63;
  box-shadow: 0 4px 12px rgba(255, 217, 192, 0.3);
}

.sloth-card .card-glow { background: radial-gradient(circle at 10% 10%, #fff7e8, #3f7d4a); }
.sloth-card:hover { box-shadow: 0 10px 25px rgba(95, 174, 90, 0.25); }
.sloth-card .card-info h2 { color: #ffe6ac; }
.sloth-card .play-btn {
  background: linear-gradient(135deg, #e8b04b, #ffe9ac);
  color: #2c2118;
  box-shadow: 0 4px 12px rgba(232, 176, 75, 0.3);
}

/* PWA Install Banner styling */
.install-banner {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  background: rgba(32, 13, 58, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: slide-up 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

@keyframes slide-up {
  from { transform: translateY(120%); }
  to { transform: translateY(0); }
}

.install-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.install-sparkle {
  font-size: 26px;
  animation: twinkle 1s infinite alternate;
}

@keyframes twinkle {
  from { opacity: 0.5; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1.1); }
}

.install-text h3 {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}

.install-text p {
  font-size: 12px;
  color: #cbc3e3;
}

.install-action-btn {
  background: linear-gradient(135deg, #ffd1f5, #b794ff);
  border: none;
  padding: 10px 20px;
  border-radius: 99px;
  color: #2a0e44;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(183, 148, 255, 0.4);
  transition: transform 0.1s ease;
}

.install-action-btn:active {
  transform: scale(0.95);
}

.install-close-btn {
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 22px;
  cursor: pointer;
  opacity: 0.6;
  padding: 0 5px;
}

.install-close-btn:hover {
  opacity: 1;
}

/* iOS instructions guide style */
.ios-guide {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 101;
  backdrop-filter: blur(4px);
}

.ios-guide-content {
  background: #200d3a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 24px;
  padding: 24px;
  width: 100%;
  max-width: 380px;
  position: relative;
  box-shadow: 0 15px 40px rgba(0,0,0,0.6);
  animation: scale-up 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

@keyframes scale-up {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.ios-close-btn {
  position: absolute;
  top: 15px;
  right: 18px;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 26px;
  cursor: pointer;
  opacity: 0.6;
}

.ios-close-btn:hover {
  opacity: 1;
}

.ios-guide-content h3 {
  font-size: 18px;
  font-weight: 700;
  color: #ffd1f5;
  margin-bottom: 16px;
}

.ios-guide-content ol {
  padding-left: 20px;
  color: #cbc3e3;
}

.ios-guide-content li {
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 12px;
}

.share-icon, .add-icon {
  background: rgba(255,255,255,0.1);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
}

.hidden {
  display: none !important;
}
