/* ================================================
   Sprunki Hub — Lyanna's Pastel Pink & Purple Portal
   ================================================ */

:root {
  --pink-pale:    #ffe0f0;
  --pink-soft:    #ffb6d9;
  --pink-mid:     #f780bb;
  --pink-hot:     #e8509a;
  --lavender-pale:#f0e6ff;
  --lavender:     #d4aaff;
  --purple-mid:   #b06ee8;
  --purple-deep:  #8040c8;
  --purple-dark:  #5a1e98;
  --cream:        #fff8fc;
  --text-dark:    #4a1a72;
  --text-mid:     #8050b0;
  --shadow-pink:  rgba(232, 80, 154, 0.18);
  --shadow-purple:rgba(128, 64, 200, 0.20);
  --card-radius:  22px;
  --page-max:     960px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  background: linear-gradient(150deg, #ffe8f4 0%, #f5e0ff 35%, #e8d4ff 65%, #dce8ff 100%);
  background-attachment: fixed;
  font-family: -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  color: var(--text-dark);
  padding-bottom: 3rem;
  position: relative;
}

/* ---- Background blobs ---- */
.bg-blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  pointer-events: none;
  z-index: 0;
}
.blob-1 { width:500px; height:500px; background:radial-gradient(circle,#ffb6d9,transparent); top:-150px; left:-150px; animation:drift 12s ease-in-out infinite alternate; }
.blob-2 { width:400px; height:400px; background:radial-gradient(circle,#d4aaff,transparent); bottom:0; right:-100px; animation:drift 9s ease-in-out infinite alternate-reverse; }
.blob-3 { width:300px; height:300px; background:radial-gradient(circle,#a8d8ff,transparent); top:40%; left:50%; animation:drift 15s ease-in-out infinite alternate; }
@keyframes drift {
  from { transform:translate(0,0) scale(1); }
  to   { transform:translate(30px,20px) scale(1.08); }
}

/* ---- Floating character decorations ---- */
.char-float {
  position: fixed;
  z-index: 1;
  pointer-events: none;
  opacity: 0.55;
}
.char-float img { width: 90px; height: auto; filter: drop-shadow(0 4px 12px rgba(180,80,200,0.25)); }

.char-left-top  { top: 120px; left: -16px; animation: char-bob 5s ease-in-out infinite alternate; }
.char-right-top { top: 140px; right: -16px; animation: char-bob 6s ease-in-out infinite alternate-reverse; }
.char-left-bottom  { bottom: 80px; left: -16px; animation: char-bob 7s ease-in-out infinite alternate; }
.char-right-bottom { bottom: 60px; right: -16px; animation: char-bob 4.5s ease-in-out infinite alternate-reverse; }

@keyframes char-bob {
  from { transform: translateY(0px) rotate(-3deg); }
  to   { transform: translateY(-18px) rotate(3deg); }
}

@media (max-width: 600px) {
  .char-float img { width: 60px; }
  .char-left-top, .char-left-bottom { left: -20px; }
  .char-right-top, .char-right-bottom { right: -20px; }
}

/* ---- Header ---- */
.site-header {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 1.5rem 1rem 1rem;
}

/* Dancing GIF hero */
.hero-gif-wrap {
  margin: 0 auto 1rem;
  max-width: 480px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow:
    0 8px 32px rgba(232, 80, 154, 0.30),
    0 0 0 4px rgba(255,182,217,0.5),
    0 0 0 8px rgba(212,170,255,0.25);
  animation: gif-pulse 3s ease-in-out infinite alternate;
}
.hero-gif {
  width: 100%;
  display: block;
}
@keyframes gif-pulse {
  from { box-shadow: 0 8px 32px rgba(232,80,154,0.30), 0 0 0 4px rgba(255,182,217,0.5), 0 0 0 8px rgba(212,170,255,0.25); }
  to   { box-shadow: 0 12px 48px rgba(232,80,154,0.50), 0 0 0 6px rgba(255,142,197,0.7), 0 0 0 12px rgba(180,120,255,0.35); }
}

/* Lyanna's badge */
.owner-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  background: linear-gradient(135deg, #fff0f8, #f5e0ff);
  border: 2.5px solid #f780bb;
  border-radius: 50px;
  padding: 0.4rem 1.2rem;
  margin-bottom: 0.6rem;
  box-shadow: 0 4px 18px rgba(232,80,154,0.25), 0 0 0 4px rgba(247,128,187,0.1);
  font-family: -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  animation: badge-bounce 2s cubic-bezier(0.36,0.07,0.19,0.97) infinite;
}
@keyframes badge-bounce {
  0%,100% { transform: translateY(0px); }
  20%      { transform: translateY(-12px); }
  40%      { transform: translateY(-6px); }
  60%      { transform: translateY(-10px); }
  80%      { transform: translateY(-3px); }
}
.owner-name {
  font-size: clamp(1.1rem, 3.8vw, 1.4rem);
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #d4279a;
  font-family: -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
}
.owner-star {
  font-size: 1.1rem;
  display: inline-block;
  animation: spin-star 3s linear infinite;
}
.owner-star:last-child { animation-direction: reverse; animation-duration: 2.5s; }
@keyframes spin-star {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.4); }
  100% { transform: rotate(360deg) scale(1); }
}

/* Animated wave title */
.site-title {
  font-size: clamp(2.2rem, 8vw, 4rem);
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.title-letter {
  display: inline-block;
  background: linear-gradient(160deg, var(--pink-hot) 0%, var(--purple-mid) 40%, var(--purple-deep) 70%, var(--pink-mid) 100%);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: var(--pink-hot);
  animation:
    letter-wave 1.8s ease-in-out infinite alternate,
    rainbow-shift 4s ease-in-out infinite alternate;
  animation-delay: calc(var(--i) * 0.08s);
}
@keyframes letter-wave {
  0%   { transform: translateY(0px)  rotate(0deg)  scale(1); }
  50%  { transform: translateY(-8px) rotate(-3deg) scale(1.05); }
  100% { transform: translateY(2px)  rotate(2deg)  scale(0.97); }
}
@keyframes rainbow-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Wenda strip */
.wenda-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.4rem;
}
.wenda-img {
  height: clamp(48px, 8vw, 72px);
  width: auto;
  filter: drop-shadow(0 3px 10px rgba(212,39,154,0.35));
  animation: wenda-dance 1.2s ease-in-out infinite alternate;
}
.wenda-flip {
  transform: scaleX(-1);
  animation-direction: alternate-reverse;
}
@keyframes wenda-dance {
  from { transform: translateY(0px) rotate(-5deg); }
  to   { transform: translateY(-8px) rotate(5deg); }
}
.wenda-flip.wenda-dance, .wenda-flip {
  animation-name: wenda-dance-flip;
}
@keyframes wenda-dance-flip {
  from { transform: scaleX(-1) translateY(0px) rotate(-5deg); }
  to   { transform: scaleX(-1) translateY(-8px) rotate(5deg); }
}
.site-subtitle {
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  color: var(--text-mid);
  font-weight: 700;
}

/* ---- Loading ---- */
.loading-state {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  gap: 1rem; padding: 3rem;
  color: var(--text-mid); font-weight: 600; font-size: 1.1rem;
}
.loading-state.hidden { display: none; }
.spinner {
  width: 48px; height: 48px;
  border: 5px solid var(--lavender);
  border-top-color: var(--purple-mid);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Game Grid ---- */
.game-grid {
  position: relative; z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  padding: 0.5rem 1rem 1rem;
  max-width: var(--page-max);
  margin: 0 auto;
}
@media (min-width: 540px) {
  .game-grid { grid-template-columns: repeat(3, 1fr); gap: 1.2rem; padding: 0.5rem 1.5rem 1rem; }
}
@media (min-width: 780px) {
  .game-grid { gap: 1.5rem; padding: 0.5rem 2rem 1rem; }
}

/* ---- Game Card ---- */
.game-card {
  background: rgba(255,255,255,0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--card-radius);
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.9);
  box-shadow: 0 4px 20px var(--shadow-pink), 0 2px 8px var(--shadow-purple), inset 0 1px 0 rgba(255,255,255,0.8);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  user-select: none;
  -webkit-user-select: none;
}
.game-card:hover { transform: translateY(-3px); box-shadow: 0 8px 30px var(--shadow-pink), 0 4px 14px var(--shadow-purple); }
.game-card:active { transform: scale(0.95); box-shadow: 0 2px 10px var(--shadow-pink); }
.game-card.unavailable { opacity: 0.55; cursor: default; filter: grayscale(30%); }
.game-card.unavailable:hover, .game-card.unavailable:active { transform: none; }

.game-card-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2.8rem, 8vw, 4.5rem);
  position: relative;
  overflow: hidden;
}
.game-card-thumb::before {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.25) 0%, transparent 50%, rgba(255,255,255,0.10) 100%);
  z-index: 1;
}
.card-thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}
.game-card-body { padding: 0.75rem 0.9rem 0.9rem; }
.game-card-title {
  font-size: clamp(0.8rem, 2.6vw, 1rem);
  font-weight: 800; color: var(--text-dark);
  margin-bottom: 0.25rem; line-height: 1.2;
}
.game-card-desc { font-size: clamp(0.65rem, 2vw, 0.8rem); color: var(--text-mid); line-height: 1.4; }

/* ---- Game Overlay ---- */
.game-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: #000;
  display: flex; flex-direction: column;
}
.game-overlay.hidden { display: none; }

#game-frame { flex: 1; width: 100%; height: 100%; border: none; display: block; }

/* Control bar — auto-hides after a few seconds */
.overlay-controls {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 9001;
  display: flex;
  gap: 0.5rem;
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.overlay-controls.controls-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
}

/* Always-visible mini home tab */
.controls-tab {
  position: absolute;
  top: 10px; left: 10px;
  z-index: 9002;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,0.6);
  background: rgba(232, 80, 154, 0.55);
  backdrop-filter: blur(6px);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s ease, transform 0.3s ease;
  box-shadow: 0 2px 12px rgba(0,0,0,0.35);
}
.controls-tab:active { transform: scale(0.88); }
.controls-tab.tab-hidden {
  opacity: 0;
  pointer-events: none;
}

.ctrl-btn {
  color: #fff;
  border: 3px solid rgba(255,255,255,0.5);
  border-radius: 50px;
  padding: 0.6rem 1.1rem;
  font-size: clamp(0.9rem, 2.8vw, 1.05rem);
  font-weight: 800;
  font-family: -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  cursor: pointer;
  min-height: 48px;
  touch-action: manipulation;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.ctrl-btn:active { transform: scale(0.90); }

.home-btn {
  background: linear-gradient(135deg, #e8509a, #8040c8);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5), 0 0 0 2px rgba(255,255,255,0.2);
}
.fs-btn {
  background: linear-gradient(135deg, #5cc8ff, #8040c8);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 0 2px rgba(255,255,255,0.15);
}
.fs-btn.is-fullscreen {
  background: linear-gradient(135deg, #ff9a3c, #e8509a);
}
