/* ==========================================================================
   Phonics Wonderland Stylesheet
   Design Language: Rounded, Vibrant, Glassmorphic, and Highly Interactive
   ========================================================================== */

/* --- Custom Variables & Theme --- */
:root {
  --font-family: 'Fredoka', sans-serif;
  
  /* Color Palette */
  --bg-sky-start: #a1c4fd;
  --bg-sky-end: #c2e9fb;
  --color-primary: #764ba2;
  --color-primary-light: #8e62c4;
  --color-secondary: #ff758c;
  --color-secondary-light: #ff8fa3;
  --color-accent: #f6d365;
  --color-accent-light: #ffe082;
  --color-correct: #43e97b;
  --color-wrong: #ff6b6b;
  --color-text-dark: #3e3857;
  --color-text-light: #ffffff;
  --color-card-bg: rgba(255, 255, 255, 0.88);
  
  /* Borders and Shadows */
  --border-radius-lg: 28px;
  --border-radius-md: 18px;
  --border-radius-sm: 12px;
  --box-shadow-3d: 0 10px 0px rgba(0, 0, 0, 0.15);
  --box-shadow-soft: 0 12px 30px rgba(62, 56, 87, 0.12);
  --card-border: 4px solid #ffffff;
}

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

body {
  font-family: var(--font-family);
  color: var(--color-text-dark);
  background: linear-gradient(180deg, var(--bg-sky-start) 0%, var(--bg-sky-end) 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Base cloud vector background using CSS generated shapes */
body::before {
  content: "";
  position: absolute;
  top: 10%;
  left: -5%;
  width: 250px;
  height: 90px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 100px;
  filter: blur(10px);
  animation: floatCloud 40s infinite linear;
  z-index: -1;
}

body::after {
  content: "";
  position: absolute;
  bottom: 15%;
  right: -5%;
  width: 300px;
  height: 110px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 100px;
  filter: blur(12px);
  animation: floatCloudReverse 45s infinite linear;
  z-index: -1;
}

@keyframes floatCloud {
  0% { transform: translateX(0); }
  100% { transform: translateX(110vw); }
}

@keyframes floatCloudReverse {
  0% { transform: translateX(0); }
  100% { transform: translateX(-110vw); }
}

/* --- Container App Viewport --- */
#app-container {
  width: 95vw;
  max-width: 900px;
  height: 92vh;
  max-height: 750px;
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(15px);
  border: 6px solid rgba(255, 255, 255, 0.8);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow-soft);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1;
}

/* --- Global Header --- */
#game-header {
  height: 70px;
  min-height: 70px;
  padding: 10px 25px;
  background: rgba(255, 255, 255, 0.7);
  border-bottom: 3px solid rgba(255, 255, 255, 0.9);
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
}

.header-btn {
  font-size: 1.8rem;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 50%;
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.header-btn:hover {
  transform: scale(1.2) rotate(8deg);
}

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

.header-avatar {
  background: white;
  padding: 6px 14px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--color-primary-light);
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  font-weight: 600;
  font-size: 0.95rem;
}

#star-counter {
  background: linear-gradient(135deg, #fff 0%, #fffdf0 100%);
  padding: 6px 18px;
  border-radius: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 3px solid var(--color-accent);
  box-shadow: 0 4px 10px rgba(246, 211, 101, 0.25);
  font-weight: bold;
  font-size: 1.3rem;
  animation: pulseStar 2.5s infinite ease-in-out;
}

@keyframes pulseStar {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.star-icon {
  animation: spinStar 6s infinite linear;
}

@keyframes spinStar {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.header-controls {
  display: flex;
  gap: 8px;
}

.hidden {
  display: none !important;
}

/* --- Game Viewport Main --- */
#game-viewport {
  flex: 1;
  position: relative;
  overflow: hidden;
}

/* --- Screens Styling --- */
.game-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 25px;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.game-screen.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

/* --- Core Buttons (3D Premium Feel) --- */
.btn {
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 1.3rem;
  padding: 14px 28px;
  border: 3px solid #ffffff;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  position: relative;
  transition: all 0.15s ease-out;
  outline: none;
  user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, #12c2e9 0%, #c471ed 50%, #f64f59 100%);
  color: var(--color-text-light);
  box-shadow: 0 8px 0px #913a80, 0 15px 25px rgba(196, 113, 237, 0.4);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 0px #913a80, 0 18px 28px rgba(196, 113, 237, 0.5);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(6px);
  box-shadow: 0 2px 0px #913a80, 0 8px 10px rgba(196, 113, 237, 0.3);
}

.btn-secondary {
  background: linear-gradient(135deg, #a8ff78 0%, #78ffd6 100%);
  color: var(--color-text-dark);
  box-shadow: 0 8px 0px #4eab70, 0 12px 20px rgba(120, 255, 214, 0.3);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 0px #4eab70, 0 15px 22px rgba(120, 255, 214, 0.4);
}

.btn-secondary:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0px #4eab70, 0 6px 8px rgba(120, 255, 214, 0.2);
}

.btn-accent {
  background: linear-gradient(135deg, #fda085 0%, #f6d365 100%);
  color: var(--color-text-dark);
  box-shadow: 0 8px 0px #d88151, 0 12px 20px rgba(253, 160, 133, 0.3);
}

.btn-accent:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 0px #d88151, 0 15px 22px rgba(253, 160, 133, 0.4);
}

.btn-accent:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0px #d88151, 0 6px 8px rgba(253, 160, 133, 0.2);
}

.btn-danger {
  background: linear-gradient(135deg, #ff9966 0%, #ff5e62 100%);
  color: var(--color-text-light);
  box-shadow: 0 6px 0px #b53c3f;
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 0px #b53c3f;
}

.btn-danger:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0px #b53c3f;
}

.btn.disabled, .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  border-color: #ccc;
  background: #ccc;
  color: #666;
}

.btn-bounce {
  animation: btnBounce 2s infinite ease-in-out;
}

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

/* --- Card Base --- */
.card {
  background: var(--color-card-bg);
  border: var(--card-border);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow-soft);
  padding: 20px;
  position: relative;
}

/* --- SCREEN 1: WELCOME --- */
.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  height: 100%;
}

.logo-container {
  margin-bottom: 15px;
}

.logo-title {
  font-size: 4.8rem;
  letter-spacing: 2px;
  color: var(--color-primary);
  text-shadow: 3px 3px 0px #fff, 6px 6px 0px var(--color-primary-light), 0px 10px 15px rgba(0,0,0,0.1);
  display: flex;
  gap: 5px;
  justify-content: center;
}

.logo-title .letter {
  display: inline-block;
  cursor: pointer;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.logo-title .letter:hover {
  transform: scale(1.3) translateY(-10px) rotate(15deg);
  color: var(--color-secondary);
}

.logo-subtitle {
  font-size: 2.2rem;
  color: var(--color-secondary);
  text-shadow: 2px 2px 0px #fff;
  margin-top: -10px;
  font-weight: 800;
}

/* Float Animations for Welcome Screen */
.float-1 { animation: floatY 3s infinite ease-in-out; }
.float-2 { animation: floatY 3.5s infinite ease-in-out; }
.float-3 { animation: floatY 4s infinite ease-in-out; }
.float-reverse { animation: floatYRev 4s infinite ease-in-out; }

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

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

.welcome-graphic {
  font-size: 4.5rem;
  margin: 15px 0 25px 0;
  display: flex;
  gap: 15px;
  position: relative;
}

.welcome-graphic .graphic-emoji {
  display: inline-block;
}

.element-cloud {
  animation: floatCloudAnim 5s infinite ease-in-out;
}

.element-star {
  animation: pulseStarAnim 2s infinite ease-in-out;
  font-size: 2.5rem;
  position: absolute;
  top: -15px;
  right: -25px;
}

@keyframes floatCloudAnim {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-8px) scale(1.05); }
}

@keyframes pulseStarAnim {
  0%, 100% { transform: scale(0.9) rotate(0deg); filter: drop-shadow(0 0 0px var(--color-accent)); }
  50% { transform: scale(1.15) rotate(18deg); filter: drop-shadow(0 0 10px var(--color-accent)); }
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 300px;
}

.welcome-footer {
  margin-top: 25px;
  font-weight: 500;
  color: rgba(62, 56, 87, 0.7);
  font-size: 1rem;
}

/* --- SCREEN 2: AVATAR SELECTOR --- */
.screen-title {
  font-size: 2.5rem;
  color: var(--color-primary);
  text-shadow: 2px 2px 0px #fff;
  margin-bottom: 8px;
  text-align: center;
}

.screen-instruction {
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 25px;
  text-align: center;
  color: rgba(62, 56, 87, 0.8);
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  width: 100%;
  max-width: 780px;
  margin-bottom: 30px;
}

.avatar-card {
  background: white;
  border: 4px solid #ffffff;
  border-radius: var(--border-radius-lg);
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.05);
  padding: 20px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.avatar-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 22px rgba(62, 56, 87, 0.15);
  border-color: var(--color-primary-light);
}

.avatar-card.selected {
  border-color: var(--color-secondary);
  background: linear-gradient(135deg, #fff 0%, #fff0f3 100%);
  transform: translateY(-8px) scale(1.03);
  box-shadow: 0 15px 30px rgba(255, 117, 140, 0.25);
}

.avatar-card.selected::after {
  content: "⭐ Selected";
  position: absolute;
  top: -12px;
  background: var(--color-secondary);
  color: white;
  font-weight: bold;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.75rem;
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
  border: 2px solid white;
}

.avatar-emoji {
  font-size: 3.8rem;
  margin-bottom: 12px;
  transition: transform 0.3s ease;
}

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

.avatar-name {
  font-size: 1.3rem;
  margin-bottom: 5px;
  color: var(--color-text-dark);
}

.avatar-tag {
  font-size: 0.8rem;
  color: #7b7393;
  font-weight: 500;
  text-align: center;
}

.screen-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.screen-actions {
  width: 100%;
  display: flex;
  justify-content: center;
}

/* --- SCREEN 3: LEVEL MAP --- */
.map-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.map-path {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 100%;
  max-width: 800px;
  margin: 30px auto;
  position: relative;
  padding: 0 20px;
}

.map-node {
  background: white;
  border: 5px solid #fff;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow-soft);
  width: 200px;
  padding: 20px 15px;
  text-align: center;
  cursor: pointer;
  position: relative;
  z-index: 2;
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.map-node.active:hover {
  transform: translateY(-8px) scale(1.05);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12);
  border-color: var(--color-primary-light);
}

.map-node.locked {
  background: #e4e2eb;
  cursor: not-allowed;
  border-color: #d1ceda;
}

.map-node.locked .node-icon,
.map-node.locked .node-title,
.map-node.locked .node-desc,
.map-node.locked .node-stars {
  filter: grayscale(1);
  opacity: 0.6;
}

.node-badge {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary);
  color: white;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 2px solid white;
}

.map-node.locked .node-badge {
  background: #8b879b;
}

.node-icon {
  font-size: 2.8rem;
  margin: 10px 0;
}

.node-title {
  font-size: 1.2rem;
  color: var(--color-text-dark);
  margin-bottom: 3px;
}

.node-desc {
  font-size: 0.85rem;
  color: #7b7393;
  font-weight: 500;
  margin-bottom: 10px;
}

.node-stars {
  font-size: 1.1rem;
  letter-spacing: 2px;
}

.lock-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  background: rgba(255,255,255,0.85);
  width: 70px;
  height: 70px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  border: 3px solid #ccc;
  z-index: 3;
}

.map-connector {
  flex: 1;
  height: 10px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 5px;
  margin: 0 -15px;
  z-index: 1;
  position: relative;
}

.map-node.active + .map-connector {
  background: linear-gradient(90deg, var(--color-correct) 0%, rgba(255,255,255,0.7) 100%);
}

/* --- GAME SCREEN LAYOUTS --- */
.game-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 650px;
  height: 100%;
  justify-content: space-between;
}

.game-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.6);
  padding: 10px 20px;
  border-radius: 20px;
  border: 2px solid white;
  margin-bottom: 15px;
}

.level-indicator {
  font-weight: bold;
  font-size: 1rem;
}

.progress-container {
  flex: 1;
  height: 16px;
  background: rgba(0,0,0,0.06);
  border-radius: 10px;
  margin: 0 15px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.8);
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #43e97b 0%, #38f9d7 100%);
  border-radius: 10px;
  transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.score-display {
  font-weight: 800;
  font-size: 1.1rem;
}

.buddy-speech-bubble {
  background: #fff;
  border: 3px solid var(--color-primary-light);
  border-radius: 20px;
  padding: 10px 20px;
  position: relative;
  text-align: center;
  font-weight: 600;
  font-size: 1.1rem;
  max-width: 90%;
  margin: 0 auto 15px auto;
  box-shadow: 0 4px 6px rgba(0,0,0,0.02);
}

.buddy-speech-bubble::after {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 15px 12px 0;
  border-style: solid;
  border-color: #fff transparent;
  display: block;
  width: 0;
  z-index: 1;
}

.buddy-speech-bubble::before {
  content: "";
  position: absolute;
  bottom: -19px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 16px 13px 0;
  border-style: solid;
  border-color: var(--color-primary-light) transparent;
  display: block;
  width: 0;
  z-index: 0;
}

/* --- GAME 1: SOUND SAFARI CARD --- */
.safari-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 25px;
  margin-bottom: 20px;
  flex: 1;
  justify-content: center;
}

.safari-target {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 10px 0;
}

.target-emoji {
  font-size: 6.5rem;
  filter: drop-shadow(0 6px 12px rgba(0,0,0,0.1));
}

.bounce-loop {
  animation: targetBounce 3s infinite ease-in-out;
}

@keyframes targetBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px) scale(1.03); }
}

.target-word {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--color-primary);
  margin-top: 5px;
  border-bottom: 4px dashed var(--color-primary-light);
  padding: 0 10px;
}

.btn-audio {
  background: white;
  border: 3px solid var(--color-primary-light);
  font-family: var(--font-family);
  font-weight: 700;
  border-radius: 30px;
  padding: 8px 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1rem;
  color: var(--color-primary);
  box-shadow: 0 4px 0 var(--color-primary-light);
  transition: all 0.1s;
}

.btn-audio:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 0 var(--color-primary-light);
}

.btn-audio:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--color-primary-light);
}

.btn-audio.small {
  padding: 6px 15px;
  font-size: 0.9rem;
}

.options-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 10px;
}

.option-btn {
  font-family: var(--font-family);
  font-size: 2.5rem;
  font-weight: 800;
  background: white;
  border: 4px solid #fff;
  border-radius: var(--border-radius-md);
  color: var(--color-text-dark);
  padding: 15px 0;
  cursor: pointer;
  box-shadow: var(--box-shadow-3d);
  transition: all 0.15s ease-out;
}

.option-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 0 rgba(0,0,0,0.15);
  border-color: var(--color-accent);
}

.option-btn:active {
  transform: translateY(6px);
  box-shadow: 0 4px 0 rgba(0,0,0,0.15);
}

/* Feedback states for buttons */
.option-btn.correct {
  background: linear-gradient(135deg, #a8ff78 0%, #78ffd6 100%) !important;
  color: white !important;
  border-color: #fff !important;
  box-shadow: 0 4px 0 #4eab70 !important;
  transform: translateY(4px) !important;
  animation: popCorrect 0.5s ease;
}

.option-btn.wrong {
  background: linear-gradient(135deg, #ff9966 0%, #ff5e62 100%) !important;
  color: white !important;
  border-color: #fff !important;
  box-shadow: 0 4px 0 #b53c3f !important;
  transform: translateY(4px) !important;
  animation: shakeWrong 0.5s ease;
}

@keyframes popCorrect {
  0% { transform: scale(1) translateY(0); }
  50% { transform: scale(1.15) translateY(-8px); }
  100% { transform: scale(1) translateY(4px); }
}

@keyframes shakeWrong {
  0%, 100% { transform: translateX(0) translateY(4px); }
  20%, 60% { transform: translateX(-8px) translateY(4px); }
  40%, 80% { transform: translateX(8px) translateY(4px); }
}

/* --- GAME 2: CVC WORD BUILDER --- */
.builder-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  flex: 1;
  justify-content: center;
}

.builder-target-container {
  margin: 10px 0;
}

.letter-slots-container {
  display: flex;
  gap: 15px;
  margin: 15px 0 20px 0;
}

.letter-slot {
  width: 65px;
  height: 65px;
  border: 4px dashed rgba(62, 56, 87, 0.3);
  border-radius: var(--border-radius-sm);
  background: rgba(0,0,0,0.03);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2.2rem;
  font-weight: bold;
  color: var(--color-primary);
  transition: all 0.2s;
  cursor: pointer;
}

.letter-slot.filled {
  border: 4px solid var(--color-primary);
  background: white;
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  animation: popCorrect 0.3s ease;
}

.builder-controls-row {
  display: flex;
  gap: 15px;
}

.letters-pool-container {
  background: rgba(255,255,255,0.7);
  border: 3px solid white;
  border-radius: var(--border-radius-md);
  padding: 15px;
  margin-top: 10px;
}

.pool-instruction {
  font-size: 0.9rem;
  font-weight: bold;
  text-align: center;
  margin-bottom: 8px;
  color: #7b7393;
}

.tiles-pool {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.letter-tile {
  font-family: var(--font-family);
  width: 60px;
  height: 60px;
  font-size: 2rem;
  font-weight: 800;
  background: white;
  border: 3px solid #fff;
  border-radius: var(--border-radius-sm);
  color: var(--color-text-dark);
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.15s;
}

.letter-tile:hover:not(:disabled) {
  transform: translateY(-3px);
  box-shadow: 0 9px 0 rgba(0,0,0,0.1);
  border-color: var(--color-secondary-light);
}

.letter-tile:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.1);
}

.letter-tile:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  background: #eee;
  border-color: #ddd;
}

/* Feedback statuses for slots */
.letter-slots-container.correct .letter-slot {
  border-color: var(--color-correct);
  background: #eafff0;
  color: #2baf57;
  animation: popCorrect 0.5s ease;
}

.letter-slots-container.wrong .letter-slot {
  border-color: var(--color-wrong);
  background: #ffebeb;
  color: #b53c3f;
  animation: shakeWrong 0.5s ease;
}

/* --- GAME 3: RHYME POPPER --- */
.popper-game-container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.timer-container {
  font-size: 1.1rem;
  font-weight: 800;
  background: white;
  border-radius: 12px;
  padding: 3px 10px;
  border: 2px solid var(--color-secondary);
}

.popper-instructions {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 10px;
}

.buddy-speech-bubble.small {
  font-size: 0.95rem;
  padding: 5px 15px;
  margin-bottom: 8px;
}

.buddy-speech-bubble.small::after {
  border-width: 10px 8px 0;
  bottom: -10px;
}
.buddy-speech-bubble.small::before {
  border-width: 11px 9px 0;
  bottom: -12px;
}

.rhyme-target-box {
  background: white;
  border: 4px solid var(--color-secondary);
  border-radius: 20px;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 4px 10px rgba(255, 117, 140, 0.15);
}

.mini-emoji {
  font-size: 2.2rem;
}

.target-word-styled {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--color-secondary);
  letter-spacing: 2px;
}

.btn-audio-mini {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.1s;
}

.btn-audio-mini:hover {
  transform: scale(1.2);
}

/* Floating bubble arena */
.bubble-play-area {
  flex: 1;
  background: rgba(255,255,255,0.4);
  border-radius: var(--border-radius-lg);
  border: 3px dashed rgba(255,255,255,0.8);
  position: relative;
  overflow: hidden;
  margin-top: 5px;
}

.game-start-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255,255,255,0.85);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 15px;
  z-index: 5;
}

.game-start-overlay p {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--color-primary);
}

/* Bubble styling */
.bubble {
  position: absolute;
  bottom: -80px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.9) 0%, rgba(135,206,250,0.6) 60%, rgba(30,144,255,0.4) 100%);
  border: 2px solid rgba(255,255,255,0.8);
  box-shadow: inset -5px -5px 15px rgba(0,0,0,0.05), 0 5px 10px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  user-select: none;
  z-index: 3;
  animation: floatBubble 6s linear forwards;
}

.bubble:hover {
  transform: scale(1.05);
}

.bubble-text {
  font-size: 0.95rem;
  font-weight: 800;
  color: #1a4f82;
  text-shadow: 1px 1px 0px white;
  pointer-events: none;
}

.bubble-emoji {
  font-size: 1.8rem;
  margin-bottom: 2px;
  pointer-events: none;
}

@keyframes floatBubble {
  0% {
    transform: translateY(0) translateX(0) rotate(0deg);
  }
  33% {
    transform: translateY(-25%) translateX(15px) rotate(3deg);
  }
  66% {
    transform: translateY(-60%) translateX(-15px) rotate(-3deg);
  }
  100% {
    transform: translateY(-110vh) translateX(0) rotate(0deg);
  }
}

/* Pop burst animation style */
.bubble.popped {
  animation: none;
  transform: scale(1.3);
  opacity: 0;
  transition: all 0.15s ease-out;
  pointer-events: none;
}

/* Canvas Confetti layer */
#confetti-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 100;
}

/* --- SCREEN 7: VICTORY / RESULTS --- */
.victory-content {
  width: 100%;
  max-width: 600px;
}

.victory-banner {
  text-align: center;
  margin-bottom: 15px;
}

.trophy-emoji {
  font-size: 5rem;
  display: inline-block;
  animation: waveTrophy 2s infinite ease-in-out;
}

@keyframes waveTrophy {
  0%, 100% { transform: rotate(0) scale(1); }
  50% { transform: rotate(10deg) scale(1.1); }
}

#victory-title {
  font-size: 3rem;
  color: var(--color-accent);
  text-shadow: 2px 2px 0px #9f610a, 4px 4px 0px white;
  margin-top: 5px;
}

.victory-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 25px;
  width: 100%;
}

.victory-avatar-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: white;
  border: 4px solid var(--color-primary);
  font-size: 4rem;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  margin-top: -65px;
  margin-bottom: 15px;
}

.victory-message-text {
  font-size: 1.25rem;
  text-align: center;
  font-weight: 500;
  margin-bottom: 15px;
  color: var(--color-text-dark);
}

.stars-display {
  display: flex;
  gap: 15px;
  margin: 10px 0 20px 0;
}

.victory-star {
  font-size: 3.5rem;
  opacity: 0.2;
  transform: scale(0.5);
  transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.victory-star.active {
  opacity: 1;
  transform: scale(1.1);
  text-shadow: 0 0 10px var(--color-accent);
}

.animated-star {
  display: inline-block;
}

/* Simple animation delay triggers for stars */
.victory-star.active.star-1 { transition-delay: 0.2s; }
.victory-star.active.star-2 { transition-delay: 0.5s; }
.victory-star.active.star-3 { transition-delay: 0.8s; }

.stats-box {
  background: rgba(0,0,0,0.03);
  border-radius: var(--border-radius-sm);
  padding: 12px 25px;
  width: 100%;
  max-width: 350px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  margin: 5px 0;
  font-size: 1.1rem;
}

.stat-label {
  color: #7b7393;
  font-weight: 500;
}

.stat-value {
  font-weight: bold;
  color: var(--color-text-dark);
}

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

/* --- HELP MODAL --- */
.modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(5px);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  width: 90%;
  max-width: 480px;
  max-height: 80%;
  overflow-y: auto;
  padding: 30px;
  animation: modalPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

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

.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 2rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #9c97b2;
}

.close-btn:hover {
  color: var(--color-text-dark);
}

.modal-content h3 {
  font-size: 1.8rem;
  color: var(--color-primary);
  margin-bottom: 20px;
  text-align: center;
}

.help-section {
  margin-bottom: 18px;
}

.help-section h4 {
  font-size: 1.1rem;
  color: var(--color-secondary);
  margin-bottom: 5px;
}

.help-section p {
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--color-text-dark);
}

/* --- RESPONSIVE LAYOUTS --- */
@media (max-width: 768px) {
  #app-container {
    height: 98vh;
    border-radius: var(--border-radius-md);
    border-width: 4px;
  }
  
  .avatar-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    max-width: 400px;
  }
  
  .map-path {
    flex-direction: column;
    gap: 20px;
    padding: 20px 0;
  }
  
  .map-connector {
    width: 8px;
    height: 30px;
    margin: -10px 0;
  }
  
  .map-node {
    width: 240px;
    padding: 12px 10px;
  }
  
  .node-icon {
    font-size: 2.2rem;
    margin: 5px 0;
  }
  
  .logo-title {
    font-size: 3.5rem;
  }
  
  .logo-subtitle {
    font-size: 1.8rem;
  }
}

@media (max-height: 600px) {
  #game-header {
    height: 55px;
    min-height: 55px;
    padding: 5px 15px;
  }
  
  .welcome-graphic {
    margin: 5px 0 10px 0;
    font-size: 3rem;
  }
  
  .welcome-actions {
    gap: 10px;
  }
}
