/* ====== GAME STUDIO PREMIUM VARIABLES ====== */
:root {
  --bg-gradient: linear-gradient(135deg, #1e0b36 0%, #3a1c71 50%, #d76d77 100%);
  --card-bg: rgba(255, 255, 255, 0.95);
  --text-dark: #2d3436;
  --text-light: #b2bec3;
  --accent: #ff4757;
  --accent-hover: #ff6b81;
  --dare-color: #ff9f43;
  --truth-color: #1dd1a1;
  --radius: 24px;
  --font-game: 'Fredoka', sans-serif;
  --game-border: 4px solid #1e272e;
  --question-bg: #f1f2f6;
  --question-border: #dfe4ea;
  --question-text: #2d3436;
  --question-muted: #636e72;
  --nav-btn-bg: #ffffff;
  --nav-btn-text: #1e272e;
}

/* Dark Theme */
body.dark-theme {
  --bg-gradient: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 50%, #16213e 100%);
  --card-bg: rgba(30, 30, 50, 0.95);
  --text-dark: #e0e0e0;
  --text-light: #8888aa;
  --question-bg: #1a1a2e;
  --question-border: #2a2a4a;
  --question-text: #e0e0e0;
  --question-muted: #8888aa;
  --nav-btn-bg: #2a2a4a;
  --nav-btn-text: #e0e0e0;
}

/* ====== ANIMATED MAGICAL BACKGROUND ====== */
html {
  height: 100%;
  background: var(--bg-gradient);
  background-size: 300% 300%;
}
body {
  margin: 0;
  font-family: var(--font-game);
  background: inherit;
  background-size: 300% 300%;
  animation: magicalBackground 12s ease infinite;
  color: #ffffff;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

@keyframes magicalBackground {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

#app-container {
  width: 100%;
  max-width: 500px;
  padding: 24px;
  position: relative;
  box-sizing: border-box;
}

/* Desktop side ads — only on wide screens */
.side-ad {
  display: none;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
}
@media (min-width: 1300px) {
  .side-ad { display: block; }
  .side-ad.left  { left: calc(50% - 640px); }
  .side-ad.right { right: calc(50% - 640px); }
}

/* ====== TYPOGRAPHY ====== */
.section-title { font-size: 2.2rem; font-weight: 700; margin: 0 0 8px 0; text-align: center; text-shadow: 2px 2px 0 #000; }
.subtitle { font-size: 1.1rem; text-align: center; margin-bottom: 28px; text-shadow: 1px 1px 0 #000; }
.text-white { color: #ffffff !important; }
.text-white-muted { color: rgba(255, 255, 255, 0.8) !important; }
.text-dark { color: var(--text-dark) !important; }
.text-dark-muted { color: var(--text-light) !important; }
.hidden { display: none !important; }

/* ====== SCREEN MANAGEMENT ====== */
.screen { display: none !important; animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; }
.screen.screen-active { display: block !important; }

@keyframes popIn {
  from { opacity: 0; transform: scale(0.9) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ====== HEADER NAV ====== */
.header-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; padding-top: 12px; }
.nav-btn {
  background: var(--nav-btn-bg);
  border: 3px solid #1e272e;
  color: var(--nav-btn-text);
  font-family: var(--font-game);
  font-size: 1rem;
  font-weight: 700;
  padding: 8px 20px;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 4px 0 #1e272e;
  transition: all 0.1s ease;
}
.nav-btn:active { transform: translateY(4px); box-shadow: 0 0 0 #1e272e; }
.exit-btn { background: #ff4757; color: white; }

/* ====== LOADING OVERLAY ====== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: #1a1a2e;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    gap: 16px;
    transition: opacity 0.5s;
}
.loading-overlay:not(.active) {
    opacity: 0;
    pointer-events: none;
}
.loading-spinner {
    width: 48px; height: 48px;
    border: 4px solid rgba(255,255,255,0.15);
    border-top: 4px solid #ff4757;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.loading-overlay p {
    color: rgba(255,255,255,0.6);
    font-size: 14px;
}
.loading-error {
    font-size: 14px;
    display: none;
}
.loading-error.show { display: block; color: #ff6b6b; }
.loading-retry-btn {
    font-family: var(--font-game);
    font-size: 1rem;
    font-weight: 700;
    padding: 12px 32px;
    background: var(--accent);
    color: white;
    border: 3px solid #1e272e;
    border-radius: 18px;
    cursor: pointer;
    box-shadow: 0 4px 0 #1e272e;
    transition: all 0.1s ease;
    margin-top: 8px;
}
.loading-retry-btn:active { transform: translateY(4px); box-shadow: 0 0 0 #1e272e; }
.loading-retry-btn.hidden { display: none; }
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ====== WELCOME SCREEN ====== */
#welcomeScreen { height: 80vh; }
#welcomeScreen.screen-active { display: flex !important; align-items: center; justify-content: center; }
.welcome-content { text-align: center; }
.logo-emoji { font-size: 6rem; margin-bottom: 16px; animation: floatIcon 3s ease-in-out infinite; filter: drop-shadow(0 10px 10px rgba(0,0,0,0.3)); }
.app-title { font-size: 3.5rem; font-weight: 700; margin: 0 0 12px 0; color: white; text-shadow: 4px 4px 0 #1e272e; line-height: 1.1; }
.app-tagline { font-size: 1.2rem; font-weight: 500; margin-bottom: 28px; text-shadow: 2px 2px 0 #1e272e; }

/* Offline party game explanation — tells first-time visitors it's not an online game */
.how-it-works {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 32px;
}
.hiw-step {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
    justify-content: center;
}
.hiw-icon {
    font-size: 1.5rem;
    filter: drop-shadow(1px 2px 0 rgba(0,0,0,0.3));
}

/* ====== HOMEPAGE BANNER AD ====== */
.homepage-ad-wrapper {
  margin-top: 32px;
  text-align: center;
  min-height: 90px;
}

/* ====== CHUNKY 3D BUTTONS ====== */
.massive-btn {
  width: 100%;
  padding: 20px;
  font-family: var(--font-game);
  font-size: 1.4rem;
  font-weight: 700;
  color: white;
  background: var(--accent);
  border: var(--game-border);
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 8px 0 #1e272e;
  transition: all 0.1s ease;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.massive-btn:active:not(:disabled) { transform: translateY(8px); box-shadow: 0 0 0 #1e272e; }

.grid-container { display: flex; flex-direction: column; gap: 18px; }
.location-btn, .category-card, .pack-card {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--card-bg);
  border: var(--game-border);
  padding: 20px;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 6px 0 #1e272e;
  transition: all 0.1s ease;
}
.location-btn:active, .category-card:active, .pack-card:active {
  transform: translateY(6px);
  box-shadow: 0 0 0 #1e272e;
}

.btn-icon, .card-icon { font-size: 2.5rem; margin-right: 16px; filter: drop-shadow(2px 4px 0 rgba(0,0,0,0.2)); }
.btn-text, .card-title { font-size: 1.4rem; font-weight: 700; margin: 0; color: var(--text-dark); }
.card-description { font-size: 1rem; color: #636e72; margin: 4px 0 0 0; font-weight: 500; text-align: center; }
.pack-card { flex-direction: column; align-items: center; text-align: center; }
.pack-card .card-icon { margin-bottom: 12px; margin-right: 0; }

/* ====== FLOATING GAME CARD ====== */
.game-board { margin-top: 10px; }
.game-card {
  background: var(--card-bg);
  border: var(--game-border);
  border-radius: 30px;
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  padding: 24px;
  position: relative;
  box-shadow: 0 15px 0 rgba(0, 0, 0, 0.2), inset 0 0 20px rgba(0,0,0,0.05);
  animation: floatCard 6s ease-in-out infinite; /* The floating magic effect */
}

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

@keyframes floatIcon {
  0%, 100% { transform: translateY(0) rotate(-5deg); }
  50% { transform: translateY(-15px) rotate(5deg); }
}

.question-type {
  font-size: 1.4rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 0 0 15px 0;
  color: var(--question-muted);
  text-align: center;
}

#questionText {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--question-text);
  margin: 10px 0;
  padding: 20px;
  background-color: var(--question-bg);
  border-radius: 20px;
  border: 3px solid var(--question-border);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  box-shadow: inset 0 4px 8px rgba(0,0,0,0.05);
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Timer */
#timerDisplay { font-size: 4rem; font-weight: 700; color: #1dd1a1; text-align: center; margin: 15px 0; text-shadow: 2px 2px 0 #1e272e; }

/* Ad Wrapper */
.ad-wrapper { margin: 10px 0; min-height: 60px; display: flex; justify-content: center; align-items: center; }

/* Controls */
.controls { margin-top: auto; position: sticky; bottom: 10px; width: 100%; }
.choice-container { display: flex; gap: 15px; width: 100%; }

.truth-btn { background: var(--truth-color); }
.dare-btn { background: var(--dare-color); }
#nextBtn { background-color: var(--accent) !important; color: white; width: 100%; }

/* Disabled AdSense Protection */
#nextBtn:disabled {
  background-color: #b2bec3 !important;
  color: #636e72 !important;
  cursor: not-allowed;
  transform: translateY(8px);
  box-shadow: 0 0 0 #1e272e;
}

/* ====== MODALS (The missing pop-up styles!) ====== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(30, 11, 54, 0.9); /* Deep purple transparent background */
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.modal-overlay.show { 
  display: flex; 
  animation: popIn 0.3s ease; 
}

.modal-content {
  background: var(--card-bg);
  border: var(--game-border);
  padding: 32px;
  border-radius: 30px;
  width: 85%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 15px 0 rgba(0, 0, 0, 0.3);
  position: relative;
}

.modal-icon { 
  font-size: 4rem; 
  margin-bottom: 12px; 
  filter: drop-shadow(0 4px 4px rgba(0,0,0,0.2)); 
}

.modal-content h3 { 
  margin: 0 0 10px 0; 
  font-size: 1.8rem; 
  font-family: var(--font-game); 
  font-weight: 700; 
  color: var(--text-dark); 
}

.modal-content p { 
  margin-bottom: 24px; 
  line-height: 1.4; 
  font-size: 1.1rem; 
  color: #636e72; 
  font-weight: 500; 
}

.modal-actions { display: flex; gap: 15px; }

.modal-actions button {
  flex: 1; 
  padding: 15px; 
  font-family: var(--font-game); 
  font-size: 1.1rem; 
  font-weight: 700;
  border-radius: var(--radius); 
  border: var(--game-border); 
  cursor: pointer;
  box-shadow: 0 6px 0 #1e272e; 
  transition: all 0.1s ease;
}

.modal-actions button:active { 
  transform: translateY(6px); 
  box-shadow: 0 0 0 #1e272e; 
}

.secondary-btn { background: #f1f2f6; color: var(--text-dark); }
.primary-btn { background: var(--accent); color: white; }

/* ====== QUESTION ANIMATIONS ====== */
@keyframes shuffleText {
  0%, 100% { opacity: 1; transform: translateY(0); }
  25% { opacity: 0.3; transform: translateY(-5px); }
  50% { opacity: 0.7; transform: translateY(5px); }
  75% { opacity: 0.4; transform: translateY(-3px); }
}

.shuffling-text {
  animation: shuffleText 0.3s ease infinite;
  color: var(--text-light) !important;
}

@keyframes revealPop {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

.reveal-pop {
  animation: revealPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* ====== HOW TO PLAY MODAL ====== */
.how-to-play-steps {
  text-align: left;
  margin: 20px 0;
  padding: 0;
  list-style: none;
}

.how-to-play-steps li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 2px solid #f1f2f6;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-dark);
  line-height: 1.4;
}

.how-to-play-steps li:last-child {
  border-bottom: none;
}

.how-to-play-steps .step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.how-to-play-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: var(--game-border);
  background: #f1f2f6;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-dark);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 0 #1e272e;
  transition: all 0.1s ease;
  z-index: 10;
}

.how-to-play-close:active {
  transform: translateY(3px);
  box-shadow: 0 0 0 #1e272e;
}

/* ====== 18+ ADULT BADGE ====== */
.adult-badge {
  display: inline-block;
  background: #ff4757;
  color: white;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 8px;
  margin-left: 8px;
  vertical-align: middle;
  border: 2px solid #1e272e;
  box-shadow: 0 2px 0 #1e272e;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ====== MAIN HEADER LINKS ====== */
.main-header-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    padding-top: 10px;
    margin-bottom: 30px;
    z-index: 50;
}

.main-header-links a {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s ease;
}

.main-header-links a:hover {
    color: #ffffff;
    transform: translateY(-2px);
    text-shadow: 0 2px 0 #1e272e;
}

/* ====== HEADER ICON BUTTONS (Theme & Sound Toggle) ====== */
.header-icon-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.25);
  color: white;
  font-size: 1.1rem;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.header-icon-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.header-icon-btn:active {
  transform: translateY(1px);
}

/* ====== SHUFFLE BUTTON ====== */
.action-container {
  display: flex;
  gap: 12px;
  width: 100%;
}

.action-container .action-btn {
  flex: 1;
}

.shuffle-btn {
  flex: 0 0 auto;
  width: auto;
  padding: 16px 24px;
  font-family: var(--font-game);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
  background: var(--question-bg);
  border: var(--game-border);
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 0 6px 0 #1e272e;
  transition: all 0.1s ease;
  white-space: nowrap;
}

.shuffle-btn:active:not(:disabled) {
  transform: translateY(6px);
  box-shadow: 0 0 0 #1e272e;
}

.shuffle-btn:disabled {
  background: #dfe4ea;
  color: #b2bec3;
  cursor: not-allowed;
  box-shadow: 0 0 0 #1e272e;
}

/* ====== MOBILE RESPONSIVE (max-width: 480px) ====== */
@media (max-width: 480px) {
  #app-container {
    padding: 12px;
  }

  /* Welcome screen */
  .logo-emoji { font-size: 4.5rem; }
  .app-title { font-size: 2.5rem; }
  .app-tagline { font-size: 1rem; margin-bottom: 20px; }
  .how-it-works { gap: 6px; margin-bottom: 24px; }
  .hiw-step { font-size: 0.95rem; gap: 8px; }
  .hiw-icon { font-size: 1.2rem; }
  .homepage-ad-wrapper { margin-top: 24px; min-height: 70px; }

  /* Location / Category / Pack buttons */
  .location-btn, .category-card, .pack-card {
    padding: 14px;
  }
  .btn-icon, .card-icon { font-size: 2rem; margin-right: 12px; }
  .btn-text, .card-title { font-size: 1.2rem; }
  .card-description { font-size: 0.9rem; }

  /* Section titles */
  .section-title { font-size: 1.7rem; }
  .subtitle { font-size: 0.95rem; margin-bottom: 20px; }

  /* Game card — the main fix */
  .game-card {
    min-height: auto;
    padding: 16px;
    border-radius: 24px;
    animation: none; /* disable float on mobile for stability */
  }

  /* Question text */
  .question-type { font-size: 1.1rem; letter-spacing: 1px; margin-bottom: 10px; }
  #questionText {
    font-size: 1.3rem;
    padding: 14px;
    min-height: 120px;
    border-radius: 16px;
  }

  /* Timer */
  #timerDisplay { font-size: 2.8rem; margin: 10px 0; }

  /* Buttons — smaller and tighter */
  .massive-btn {
    padding: 14px;
    font-size: 1.1rem;
    border-radius: 18px;
    box-shadow: 0 6px 0 #1e272e;
  }
  .massive-btn:active:not(:disabled) {
    transform: translateY(6px);
    box-shadow: 0 0 0 #1e272e;
  }

  /* Truth/Dare choice buttons */
  .choice-container { gap: 10px; }

  /* Action container — shuffle + next player */
  .action-container {
    flex-direction: column;
    gap: 8px;
  }
  .action-container .action-btn {
    flex: none;
    width: 100%;
  }
  .shuffle-btn {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.95rem;
    border-radius: 18px;
    box-shadow: 0 4px 0 #1e272e;
  }

  /* Ad wrapper — smaller on mobile */
  .ad-wrapper { min-height: 40px; margin: 6px 0; }

  /* Nav buttons */
  .header-nav { margin-bottom: 16px; padding-top: 8px; }
  .nav-btn { padding: 6px 14px; font-size: 0.85rem; }

  /* Header links */
  .main-header-links { gap: 12px; margin-bottom: 16px; }
  .main-header-links a { font-size: 0.75rem; }
  .header-icon-btn { width: 32px; height: 32px; font-size: 0.95rem; }

  /* Modals */
  .modal-content { padding: 24px; width: 90%; border-radius: 24px; }
  .modal-icon { font-size: 3rem; }
  .modal-content h3 { font-size: 1.4rem; }
  .modal-content p { font-size: 0.95rem; }
  .modal-actions button { padding: 12px; font-size: 1rem; border-radius: 18px; }
  .how-to-play-steps li { padding: 10px 0; font-size: 0.95rem; gap: 10px; }
  .how-to-play-steps .step-num { min-width: 30px; height: 30px; font-size: 0.85rem; }

  /* Cards and backgrounds */
  .location-btn, .category-card, .pack-card {
    box-shadow: 0 4px 0 #1e272e;
  }
}