:root {
  /* Default (neutral) palette — overridden by theme */
  --bg-1: #fef6ff;
  --bg-2: #e8f4ff;
  --primary: #6c4cf1;
  --primary-dark: #4a2fc7;
  --accent: #ff7a9c;
  --accent-2: #ffd166;
  --text: #1f1b2e;
  --text-soft: #5b5575;
  --card: rgba(255, 255, 255, 0.92);
  --card-border: rgba(255, 255, 255, 0.6);
  --shadow: 0 10px 30px rgba(76, 47, 199, 0.18);
  --radius: 22px;
  --particle-color: #ffd166;
  --bg-image: none;
}

/* === DeVaughn — Pandora theme === */
[data-theme="pandora"] {
  --bg-1: #050420;
  --bg-2: #07304a;
  --primary: #5fb8ff;
  --primary-dark: #2a6fa5;
  --accent: #7be3ff;
  --accent-2: #b58cff;
  --text: #eaf6ff;
  --text-soft: #b9d2e6;
  --card: rgba(10, 26, 48, 0.78);
  --card-border: rgba(123, 227, 255, 0.45);
  --shadow: 0 10px 40px rgba(123, 227, 255, 0.25);
  --particle-color: #7be3ff;
  --bg-image: url('../assets/themes/pandora-bg.svg');
}

/* === DeVynn-Rose — Wolf Pack theme === */
[data-theme="wolfpack"] {
  --bg-1: #ffe9b8;
  --bg-2: #ffd4e3;
  --primary: #ff5c9c;
  --primary-dark: #c43874;
  --accent: #ffb347;
  --accent-2: #5b78a3;
  --text: #2a1a3a;
  --text-soft: #6b4f6e;
  --card: rgba(255, 255, 255, 0.92);
  --card-border: rgba(255, 92, 156, 0.35);
  --shadow: 0 10px 30px rgba(196, 56, 116, 0.25);
  --particle-color: #ff5c9c;
  --bg-image: url('../assets/themes/wolfpack-bg.svg');
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Comic Sans MS', 'Trebuchet MS', system-ui, sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, var(--bg-1) 0%, var(--bg-2) 100%);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Themed scenic background layer */
.scene {
  position: fixed;
  inset: 0;
  background-image: var(--bg-image);
  background-size: cover;
  background-position: center bottom;
  background-repeat: no-repeat;
  z-index: -2;
  opacity: 1;
  transition: opacity 0.5s ease;
}

/* Floating particles canvas (sparkles / spores / paws) */
.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.particle {
  position: absolute;
  bottom: -40px;
  font-size: 1.4rem;
  opacity: 0.85;
  animation: float-up linear infinite;
  filter: drop-shadow(0 0 6px var(--particle-color));
  user-select: none;
}

@keyframes float-up {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); opacity: 0; }
  10%  { opacity: 0.9; }
  50%  { transform: translateY(-50vh) translateX(20px) rotate(180deg); }
  90%  { opacity: 0.9; }
  100% { transform: translateY(-110vh) translateX(-20px) rotate(360deg); opacity: 0; }
}

/* Header */
.hub-header {
  text-align: center;
  padding: 2.5rem 1rem 1rem;
  position: relative;
}

.hub-title {
  font-size: clamp(2rem, 6vw, 4.2rem);
  margin: 0;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  gap: 0.2em;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
}

.title-line {
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: title-glow 4s ease-in-out infinite;
  padding-bottom: 0.1em;
}

.title-line.accent {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 1.25em;
  animation: title-bounce 3s ease-in-out infinite;
}

@keyframes title-glow {
  0%, 100% { filter: drop-shadow(0 0 8px var(--primary)); }
  50%      { filter: drop-shadow(0 0 18px var(--accent)); }
}

@keyframes title-bounce {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50%      { transform: translateY(-6px) rotate(1deg); }
}

.hub-subtitle {
  margin-top: 1rem;
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  color: var(--text);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.25);
  font-weight: 600;
}

main { max-width: 1100px; margin: 0 auto; padding: 1rem; position: relative; z-index: 1; }

/* Top-bar with current kid + switch button */
.top-bar {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 5;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.who-chip {
  background: var(--card);
  border: 2px solid var(--card-border);
  border-radius: 999px;
  padding: 0.45rem 1rem;
  font-weight: 700;
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.switch-btn {
  background: var(--card);
  border: 2px solid var(--card-border);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  transition: transform 0.15s ease;
}
.switch-btn:hover { transform: translateY(-2px); }

/* Filters */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin: 1rem 0 2rem;
}

.filter-btn {
  background: var(--card);
  border: 3px solid transparent;
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.filter-btn:hover { transform: translateY(-2px); }

.filter-btn.active {
  border-color: var(--primary);
  color: var(--primary-dark);
  background: var(--card);
}

/* Game cards */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.5rem;
}

.game-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  border: 3px solid var(--card-border);
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;
}

.game-card::before {
  content: "";
  position: absolute;
  inset: -50% -50% auto auto;
  width: 140%;
  height: 140%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.game-card:hover, .game-card:focus-visible {
  transform: translateY(-8px) scale(1.04);
  border-color: var(--primary);
  outline: none;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}
.game-card:hover::before { opacity: 0.15; }

.game-icon {
  font-size: 4rem;
  line-height: 1;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
}

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

.game-name {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary-dark);
}

.game-desc {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.game-age {
  margin-top: auto;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  color: white;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.loading, .empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text);
  padding: 2rem;
  background: var(--card);
  border-radius: var(--radius);
}

.hub-footer {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

/* === Character picker modal === */
.picker-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 4, 32, 0.75);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 1rem;
}

.picker-overlay.hidden { display: none; }

.picker-card {
  background: rgba(255, 255, 255, 0.96);
  border-radius: var(--radius);
  padding: 2rem;
  max-width: 720px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.picker-card h2 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  color: #1f1b2e;
  background: linear-gradient(90deg, #6c4cf1, #ff7a9c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.picker-card p {
  color: #5b5575;
  margin: 0 0 1.5rem;
}

.picker-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.picker-choice {
  border: none;
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  color: white;
  font-size: 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s ease;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.picker-choice:hover { transform: translateY(-6px) scale(1.03); }

.picker-choice .emoji {
  font-size: 3.2rem;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.picker-choice .sub {
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.9;
}

.picker-choice.pandora {
  background: linear-gradient(135deg, #050420 0%, #2a6fa5 60%, #7be3ff 100%);
}

.picker-choice.wolfpack {
  background: linear-gradient(135deg, #ff5c9c 0%, #ffb347 60%, #ffe680 100%);
  color: #2a1a3a;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.4);
}

/* === Shared "How to Play" help modal (used by every game) === */
.help-btn {
  font: inherit;
  font-weight: 800;
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  border: 2px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  font-size: 1rem;
  transition: transform 0.15s ease;
}
.help-btn:hover { transform: translateY(-2px) scale(1.05); }

.help-modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 4, 32, 0.7);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
  animation: fade-in 0.25s ease;
}

.help-modal.hidden { display: none; }

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.help-modal-card {
  background: white;
  color: #1f1b2e;
  border-radius: var(--radius);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: pop-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pop-in {
  0%   { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}

.help-modal-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.8rem;
  background: linear-gradient(90deg, #6c4cf1, #ff7a9c);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding-bottom: 0.1em;
}

.help-modal-card .help-goal {
  background: linear-gradient(90deg, #fff5d6, #ffe680);
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-weight: 700;
  margin: 0.75rem 0 1.25rem;
  color: #6b4500;
}

.help-modal-card h3 {
  margin: 1rem 0 0.5rem;
  color: #4a2fc7;
  font-size: 1.1rem;
}

.help-modal-card ol,
.help-modal-card ul {
  padding-left: 1.5rem;
  margin: 0.5rem 0;
  line-height: 1.6;
}

.help-modal-card ol li,
.help-modal-card ul li {
  margin-bottom: 0.4rem;
}

.help-modal-card .help-tips {
  background: #f5efff;
  border-left: 4px solid #6c4cf1;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-top: 1rem;
}

.help-modal-card .help-tips h3 { margin-top: 0; }

.help-modal-card .help-close {
  display: block;
  margin: 1.5rem auto 0;
  font: inherit;
  font-weight: 800;
  padding: 0.7rem 2rem;
  border-radius: 999px;
  border: none;
  background: linear-gradient(90deg, #6c4cf1, #ff7a9c);
  color: white;
  cursor: pointer;
  font-size: 1.1rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  box-shadow: 0 6px 16px rgba(108, 76, 241, 0.4);
  transition: transform 0.15s ease;
}
.help-modal-card .help-close:hover { transform: translateY(-2px) scale(1.05); }

/* Shared "back to corner" button used inside individual games */
.back-link {
  display: inline-block;
  margin: 1rem;
  padding: 0.5rem 1rem;
  background: var(--card);
  border: 2px solid var(--card-border);
  border-radius: 999px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 2;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .particles { display: none; }
}

@media (max-width: 600px) {
  .top-bar { top: auto; bottom: 1rem; right: 1rem; left: 1rem; justify-content: center; }
  .who-chip, .switch-btn { font-size: 0.9rem; padding: 0.4rem 0.8rem; }
}
