/* CSS Design System for Emotion Explorer */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300..700&family=Lexend:wght@300..600&display=swap');

:root {
  /* Dynamic Hue - will be overridden by JS for different emotional themes */
  --theme-hue: 220; /* Default neutral blue-ish */
  --theme-sat: 85%;
  --theme-light: 95%;
  
  /* HSL Palette based on current theme-hue */
  --bg-gradient-start: hsl(var(--theme-hue), var(--theme-sat), 96%);
  --bg-gradient-end: hsl(calc(var(--theme-hue) + 20), var(--theme-sat), 90%);
  --primary-color: hsl(var(--theme-hue), 85%, 45%);
  --primary-hover: hsl(var(--theme-hue), 85%, 38%);
  --primary-light: hsl(var(--theme-hue), 90%, 93%);
  --accent-color: hsl(calc(var(--theme-hue) - 30), 95%, 55%);
  --text-dark: hsl(var(--theme-hue), 60%, 15%);
  --text-light: #ffffff;
  --card-bg: rgba(255, 255, 255, 0.75);
  --card-border: rgba(255, 255, 255, 0.5);
  --card-shadow: 0 12px 32px rgba(var(--theme-hue), 20%, 30%, 0.12);
  --success-color: #2ec4b6;
  --danger-color: #e71d36;
  --warning-color: #ff9f1c;

  /* Font Families */
  --font-display: 'Fredoka', sans-serif;
  --font-body: 'Lexend', sans-serif;
  
  /* Animation speeds */
  --transition-speed: 0.4s;
}

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

body {
  font-family: var(--font-body);
  color: var(--text-dark);
  background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow-x: hidden;
  transition: background var(--transition-speed) ease, color var(--transition-speed) ease;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
}

/* Audio & Guide Toolbar */
.top-bar {
  width: 100%;
  max-width: 1000px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  position: absolute;
  top: 0;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-color);
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.8);
  cursor: pointer;
}

.brand span.emoji {
  font-size: 1.8rem;
  animation: float 3s ease-in-out infinite;
}

.controls-cluster {
  display: flex;
  gap: 12px;
}

.circle-btn {
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  border-radius: 50%;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.circle-btn:hover {
  transform: scale(1.1) rotate(5deg);
  background: #ffffff;
  border-color: var(--primary-color);
}

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

/* Main Container Shell */
.game-container {
  width: 100%;
  max-width: 1000px;
  min-height: calc(100vh - 80px);
  margin-top: 70px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Screens & Views */
.screen {
  display: none;
  width: 100%;
  animation: fadeIn 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Cards & Panels */
.card-panel {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid var(--card-border);
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--card-shadow);
  width: 100%;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

/* Header Text Styles */
.title-banner h1 {
  font-size: 2.8rem;
  margin-bottom: 8px;
  color: var(--primary-color);
  text-shadow: 2px 2px 0px #ffffff;
}

.title-banner p {
  font-size: 1.2rem;
  color: var(--text-dark);
  opacity: 0.9;
  margin-bottom: 24px;
}

/* Beautiful Interactive Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  padding: 14px 28px;
  border-radius: 18px;
  border: none;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.btn-primary {
  background: var(--primary-color);
  color: var(--text-light);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-4px) scale(1.03);
  box-shadow: 0 10px 20px rgba(var(--theme-hue), 40%, 30%, 0.2);
}

.btn-primary:active {
  transform: translateY(-1px) scale(0.98);
}

.btn-secondary {
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  color: var(--primary-color);
}

.btn-secondary:hover {
  background: #ffffff;
  border-color: var(--primary-color);
  transform: translateY(-3px);
}

/* Companion Selector */
.companion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
  width: 100%;
  margin: 32px 0;
}

.companion-card {
  background: rgba(255, 255, 255, 0.6);
  border: 3px solid transparent;
  border-radius: 20px;
  padding: 24px 16px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.companion-card:hover {
  transform: translateY(-8px);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 12px 24px rgba(0,0,0,0.06);
}

.companion-card.selected {
  border-color: var(--primary-color);
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(var(--theme-hue), 40%, 30%, 0.15);
  transform: scale(1.05) translateY(-5px);
}

.companion-emoji {
  font-size: 4rem;
  animation: float-slow 4s ease-in-out infinite;
}

.companion-card.selected .companion-emoji {
  animation: bounce-playful 1s infinite alternate;
}

.companion-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}

.companion-trait {
  font-size: 0.85rem;
  opacity: 0.75;
  background: var(--primary-light);
  color: var(--primary-color);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 500;
}

.input-group {
  margin: 24px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.input-label {
  font-family: var(--font-display);
  font-size: 1.2rem;
}

.kids-input {
  width: 100%;
  max-width: 320px;
  padding: 14px 20px;
  border-radius: 16px;
  border: 3px solid var(--card-border);
  font-family: var(--font-body);
  font-size: 1.1rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.85);
  transition: all 0.2s ease;
  color: var(--text-dark);
}

.kids-input:focus {
  outline: none;
  border-color: var(--primary-color);
  background: #ffffff;
  box-shadow: 0 0 12px rgba(var(--theme-hue), 50%, 50%, 0.2);
}

/* Map Screen styling */
.map-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

.map-header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  align-items: center;
  background: var(--card-bg);
  border: 2px solid var(--card-border);
  padding: 12px 24px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.avatar-badge-mini {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-counter {
  background: var(--warning-color);
  color: #fff;
  font-weight: bold;
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 0.9rem;
}

.map-canvas-container {
  width: 100%;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.4) 100%);
  border-radius: 28px;
  padding: 40px 20px;
  box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  align-items: center;
  gap: 30px;
  position: relative;
  min-height: 400px;
}

.level-node {
  width: 140px;
  height: 140px;
  background: #ffffff;
  border: 4px solid var(--card-border);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  text-decoration: none;
}

.level-node:hover:not(.locked) {
  transform: translateY(-8px) scale(1.08);
  box-shadow: 0 16px 32px rgba(var(--theme-hue), 30%, 40%, 0.15);
  border-color: var(--primary-color);
}

.level-node.locked {
  background: #e9ecef;
  cursor: not-allowed;
  opacity: 0.7;
}

.level-node.locked .node-emoji {
  filter: grayscale(1);
}

.level-node.completed {
  border-color: var(--success-color);
}

.level-node.completed::after {
  content: '✓';
  position: absolute;
  top: -5px;
  right: -5px;
  background: var(--success-color);
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.1rem;
  border: 3px solid white;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.node-emoji {
  font-size: 3.2rem;
  margin-bottom: 4px;
}

.node-title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  text-align: center;
  max-width: 110px;
  color: var(--text-dark);
}

.node-lock {
  position: absolute;
  background: rgba(0,0,0,0.6);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2.2rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.level-node.locked:hover .node-lock {
  opacity: 1;
}

.lock-icon-mini {
  color: #6c757d;
  font-size: 1.4rem;
}

/* MINIGAME 1: Feeling Detective (Matching game) */
.detective-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
}

.progress-pill-bar {
  width: 100%;
  max-width: 500px;
  height: 12px;
  background: rgba(0,0,0,0.06);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-pill-fill {
  height: 100%;
  width: 0%;
  background: var(--primary-color);
  border-radius: 10px;
  transition: width 0.4s ease;
}

.scenario-card-zone {
  width: 100%;
  max-width: 520px;
  min-height: 240px;
  perspective: 1000px;
}

.scenario-card {
  background: #ffffff;
  border: 3px solid var(--primary-light);
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-height: 240px;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  cursor: grab;
}

.scenario-card:active {
  cursor: grabbing;
}

.scenario-badge {
  background: var(--primary-light);
  color: var(--primary-color);
  font-family: var(--font-display);
  font-size: 0.9rem;
  padding: 6px 14px;
  border-radius: 30px;
  font-weight: 700;
}

.scenario-text {
  font-size: 1.3rem;
  line-height: 1.5;
  font-weight: 500;
  text-align: center;
}

.emotion-choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 600px;
  margin-top: 10px;
}

.emotion-bucket {
  background: rgba(255, 255, 255, 0.7);
  border: 3px dashed var(--card-border);
  border-radius: 20px;
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.emotion-bucket:hover {
  background: #ffffff;
  border-color: var(--primary-color);
  transform: scale(1.03);
}

.emotion-bucket.hovered {
  background: var(--primary-light);
  border-color: var(--primary-color);
  transform: scale(1.05);
}

.bucket-emoji {
  font-size: 2.8rem;
  transition: transform 0.2s ease;
}

.emotion-bucket:hover .bucket-emoji {
  transform: scale(1.2) rotate(8deg);
}

.bucket-label {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-dark);
}

/* MINIGAME 2: Body Clues styling */
.clues-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  width: 100%;
  align-items: center;
}

@media (max-width: 768px) {
  .clues-grid {
    grid-template-columns: 1fr;
  }
}

.body-avatar-zone {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 420px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 24px;
  border: 2px solid var(--card-border);
  overflow: hidden;
}

.body-silhouette-svg {
  width: 100%;
  height: 100%;
  padding: 20px;
  color: var(--primary-light);
}

.avatar-body-path {
  fill: var(--primary-light);
  stroke: var(--primary-color);
  stroke-width: 2;
  transition: fill 0.3s ease;
}

.body-glow-dot {
  position: absolute;
  width: 24px;
  height: 24px;
  background: var(--accent-color);
  border: 4px solid #ffffff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-color);
  animation: pulse-glow 1.5s infinite;
  transform: translate(-50%, -50%);
  z-index: 10;
}

/* Key anatomical dot spots */
.dot-brain { top: 12%; left: 50%; }
.dot-heart { top: 35%; left: 50%; }
.dot-stomach { top: 50%; left: 50%; }
.dot-hands { top: 48%; left: 18%; }
.dot-hands-r { top: 48%; left: 82%; }

.body-clues-interactive {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
}

.clue-interaction-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 16px 20px;
  border-left: 6px solid var(--primary-color);
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.clue-interaction-card h3 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.clue-interactive-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.body-symptom-tag {
  background: var(--primary-light);
  color: var(--primary-color);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 2px solid transparent;
}

.body-symptom-tag:hover {
  background: #ffffff;
  border-color: var(--primary-color);
  transform: scale(1.05);
}

.body-symptom-tag.matched {
  background: var(--success-color);
  color: #ffffff;
  cursor: default;
}

/* MINIGAME 3: Calm Down Toolbox */
.toolbox-tabs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
  width: 100%;
}

.toolbox-tab-btn {
  padding: 10px 20px;
  border-radius: 14px;
  background: var(--primary-light);
  color: var(--primary-color);
  font-family: var(--font-display);
  font-weight: 700;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
}

.toolbox-tab-btn.active {
  background: var(--primary-color);
  color: #ffffff;
  transform: scale(1.05);
}

.toolbox-content-container {
  min-height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.toolbox-subview {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
  animation: fadeIn 0.4s ease forwards;
}

.toolbox-subview.active {
  display: flex;
}

/* Breathing exercise balloon style */
.breathing-balloon-holder {
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin: 20px 0;
}

.breathing-balloon {
  width: 120px;
  height: 120px;
  background: radial-gradient(circle at 35% 35%, #ffffff 0%, var(--primary-color) 70%, var(--primary-hover) 100%);
  border-radius: 50%;
  box-shadow: 0 10px 30px rgba(var(--theme-hue), 50%, 30%, 0.25);
  transition: width 4s cubic-bezier(0.4, 0, 0.2, 1), height 4s cubic-bezier(0.4, 0, 0.2, 1), background-color 1s ease;
  position: relative;
}

.breathing-balloon::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: calc(50% - 6px);
  width: 12px;
  height: 10px;
  background: var(--primary-hover);
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

.balloon-expanded {
  width: 220px;
  height: 220px;
}

.balloon-held {
  transform: scale(1.03);
  animation: jitter 2s infinite ease-in-out;
}

.breathing-text-instruction {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-top: 16px;
  min-height: 40px;
  text-shadow: 1px 1px 0px #fff;
}

.breathing-cycle-counter {
  font-size: 0.95rem;
  margin-top: 6px;
  opacity: 0.75;
}

/* Bubble popping game style */
.bubble-arena {
  width: 100%;
  max-width: 550px;
  height: 320px;
  background: rgba(255, 255, 255, 0.4);
  border: 3px dashed var(--card-border);
  border-radius: 20px;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.03);
}

.arena-overlay-intro {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  text-align: center;
  z-index: 20;
}

.worry-bubble {
  position: absolute;
  width: 65px;
  height: 65px;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.9) 0%, rgba(var(--theme-hue), 85%, 45%, 0.3) 60%, rgba(var(--theme-hue), 85%, 35%, 0.4) 100%);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 50%;
  box-shadow: inset 0 0 12px rgba(255,255,255,0.8), 0 4px 10px rgba(0,0,0,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transform: translate(-50%, -50%);
  transition: transform 0.1s ease-out;
  animation: float-bubbles 6s linear infinite;
}

.worry-bubble:hover {
  transform: translate(-50%, -50%) scale(1.08);
}

.worry-bubble.popping {
  animation: bubble-pop-animation 0.2s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
  pointer-events: none;
}

/* MINIGAME 4: Scenario Quest styling */
.quest-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 680px;
}

.quest-character-dialogue {
  background: #ffffff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.03);
  display: flex;
  align-items: flex-start;
  gap: 16px;
  border: 2px solid var(--primary-light);
  width: 100%;
}

.dialogue-avatar {
  font-size: 3.5rem;
  line-height: 1;
  background: var(--primary-light);
  padding: 10px;
  border-radius: 50%;
  animation: float-slow 3s ease-in-out infinite;
}

.dialogue-speech {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.dialogue-speech h4 {
  color: var(--primary-color);
  font-size: 1.15rem;
}

.dialogue-speech p {
  font-size: 1.1rem;
  line-height: 1.45;
}

.quest-options-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.quest-option-card {
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid var(--card-border);
  border-radius: 16px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.quest-option-card:hover {
  background: #ffffff;
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.quest-option-badge {
  width: 32px;
  height: 32px;
  background: var(--primary-light);
  color: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  flex-shrink: 0;
}

.quest-option-card:hover .quest-option-badge {
  background: var(--primary-color);
  color: white;
}

.quest-option-text {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
}

/* Feedback message popup overlay in game */
.feedback-toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  background: #ffffff;
  border: 3px solid var(--success-color);
  box-shadow: 0 16px 40px rgba(0,0,0,0.15);
  border-radius: 24px;
  padding: 24px 36px;
  text-align: center;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.feedback-toast.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.feedback-toast.error {
  border-color: var(--danger-color);
}

.feedback-emoji {
  font-size: 4rem;
  animation: bounce-playful 0.5s infinite alternate;
}

.feedback-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--success-color);
}

.feedback-toast.error .feedback-title {
  color: var(--danger-color);
}

.feedback-desc {
  font-size: 1.05rem;
  color: var(--text-dark);
}

/* Celebrations / Certificate Screen */
.badge-gallery {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 20px;
  margin: 24px 0;
}

.badge-item {
  background: #ffffff;
  border: 3px solid var(--card-border);
  border-radius: 20px;
  padding: 16px;
  width: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.03);
}

.badge-item.unlocked {
  border-color: var(--warning-color);
  animation: pulse-glow-badge 2s infinite;
}

.badge-art {
  font-size: 3rem;
  filter: grayscale(1);
  opacity: 0.5;
  transition: all 0.4s ease;
}

.badge-item.unlocked .badge-art {
  filter: grayscale(0);
  opacity: 1;
  transform: scale(1.1);
  animation: float 3s ease-in-out infinite;
}

.badge-name {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
}

/* Certificate Generator Printable Card */
.certificate-preview-box {
  background: #ffffff;
  border: 8px double var(--primary-color);
  border-radius: 20px;
  padding: 30px;
  width: 100%;
  max-width: 580px;
  margin: 24px 0;
  box-shadow: 0 8px 30px rgba(0,0,0,0.05);
  position: relative;
  text-align: center;
}

.cert-corner-flower {
  position: absolute;
  font-size: 1.5rem;
}
.cert-tl { top: 10px; left: 10px; }
.cert-tr { top: 10px; right: 10px; }
.cert-bl { bottom: 10px; left: 10px; }
.cert-br { bottom: 10px; right: 10px; }

.certificate-preview-box h3 {
  font-family: var(--font-display);
  color: var(--primary-color);
  font-size: 1.8rem;
  margin-bottom: 12px;
}

.cert-text {
  font-size: 1.1rem;
  margin: 8px 0;
  line-height: 1.5;
}

.cert-player-name {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--accent-color);
  text-decoration: underline;
  margin: 12px 0;
  font-weight: 700;
}

.cert-coping-pillbox {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.cert-coping-pill {
  background: var(--primary-light);
  color: var(--primary-color);
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
}

/* Footer Info */
.footer-note {
  margin-top: 24px;
  font-size: 0.85rem;
  opacity: 0.6;
}

/* Print CSS Media */
@media print {
  body * {
    visibility: hidden;
  }
  .certificate-preview-box, .certificate-preview-box * {
    visibility: visible;
  }
  .certificate-preview-box {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    max-width: 100%;
    border: 8px double #4a90e2 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 40px !important;
  }
}

/* Emojis wiggle & bouncy Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes float {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(3deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes float-slow {
  0% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(-3deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

@keyframes bounce-playful {
  0% { transform: translateY(0); }
  100% { transform: translateY(-12px); }
}

@keyframes pulse-glow {
  0% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 0 rgba(255, 159, 28, 0.7); }
  70% { transform: translate(-50%, -50%) scale(1.15); box-shadow: 0 0 0 12px rgba(255, 159, 28, 0); }
  100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 0 0 rgba(255, 159, 28, 0); }
}

@keyframes pulse-glow-badge {
  0% { box-shadow: 0 0 0 0 rgba(255, 159, 28, 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(255, 159, 28, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 159, 28, 0); }
}

@keyframes jitter {
  0%, 100% { transform: scale(1.03) translate(0, 0); }
  20% { transform: scale(1.03) translate(-1px, 1px); }
  40% { transform: scale(1.03) translate(1px, -1px); }
  60% { transform: scale(1.03) translate(-1px, -1px); }
  80% { transform: scale(1.03) translate(1px, 1px); }
}

@keyframes float-bubbles {
  0% { bottom: -70px; }
  100% { bottom: 330px; }
}

@keyframes bubble-pop-animation {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  50% { transform: translate(-50%, -50%) scale(1.4); opacity: 0.6; }
  100% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
}
