/* GoofyTales v10 Style Config */
/* Styles same as v4 plus new classes */
:root{--pink:#ff99cc;--yellow:#fff07c;--blue:#8ecfff}
*{box-sizing:border-box}
body{margin:0;font-family:"Comic Sans MS",sans-serif;background:linear-gradient(135deg,var(--pink),var(--yellow),var(--blue));background-size:600% 600%;animation:gradientShift 20s ease infinite;text-align:center;color:#333;}
@keyframes gradientShift{0%{background-position:0% 50%}50%{background-position:100% 50%}100%{background-position:0% 50%}}
header{background: rgba(255,255,255,0.8);
  padding: 1rem;
  /* position: sticky;  <-- remove or comment out */
  /* top: 0; */
  /* z-index: 100; */
  position: static; /* or just remove the position property */}
header h1{margin:0.2em;font-size:3rem;display:inline-block}
#mascot {
  position: absolute;
  width: 100px;
  height: auto;
  top: 20px;
  right: 20px;
}

@media (max-width: 768px) {
  #mascot {
    position: relative;
    width: 50px;
    height: auto;
    margin-left: 10px;
    display: inline-block;
    top: auto;   /* reset */
    right: auto; /* reset */
  }
}
nav{display:flex;justify-content:center;gap:1rem;margin:0.5rem 0}
nav a{text-decoration:none;padding:0.5rem 1rem;border-radius:10px;transition:0.3s;color:#333}
nav a.active,nav a:hover{background:var(--yellow)}
main{max-width:900px;margin:1rem auto;padding:1rem}
.story-img{width:60%;max-width:600px;border-radius:20px;box-shadow:0 8px 16px rgba(0,0,0,0.2)}
.bounce{animation:bounce 3s infinite}@keyframes bounce{0%,20%,50%,80%,100%{transform:translateY(0)}40%{transform:translateY(-20px)}60%{transform:translateY(-12px)}}
.story-prompt{font-size:1.4rem;background:rgba(255,255,255,0.8);padding:1rem;border-radius:15px;margin:1rem auto;width:95%}
.controls{display:flex;justify-content:center;flex-wrap:wrap;gap:0.5rem;margin:1rem 0}
.dropdown{font-size:1rem;padding:0.5rem;border-radius:10px;border:2px solid #fff;box-shadow:0 4px 8px rgba(0,0,0,0.1);cursor:pointer}
.buttons{display:flex;justify-content:center;flex-wrap:wrap;gap:1rem;margin-top:1rem}
button{font-size:1rem;padding:0.6rem 1.2rem;border:none;border-radius:12px;cursor:pointer;transition:0.2s}
.primary{background:#4caf50;color:#fff}.secondary{background:#2196f3;color:#fff}
button:hover{transform:scale(1.05);box-shadow:0 4px 8px rgba(0,0,0,0.2)}
.hidden{display:none}.feedback{font-size:1.5rem;font-weight:bold;min-height:2rem}
.confetti {
  position: fixed;
  top: 50%;
  left: 50%;
  background: hsl(var(--hue), 100%, 50%);
  opacity: 0.9;
  pointer-events: none;
  border-radius: 2px;
  animation-name: explode;
  animation-timing-function: ease-out;
  animation-fill-mode: forwards;
  animation-duration: 1.5s;
  animation-iteration-count: 1;
  transform-origin: center center;
  will-change: transform, opacity;
}

@keyframes explode {
  to {
    transform: translate(var(--x), var(--y)) rotate(var(--rotate, 720deg));
    opacity: 0;
  }
}
.fade-in{animation:fadeIn 1s ease-out}@keyframes fadeIn{from{opacity:0}to{opacity:1}}
.progress-bar-bg{width:80%;height:20px;background:#eee;border-radius:10px;margin:0.5rem auto}
.progress-bar-fill{height:100%;background:#4caf50;border-radius:10px;width:0}
.badges,img.badge-icon{width:50px;margin:0.2rem}
.vocab-section{background:rgba(255,255,255,0.9);margin:1rem 0;padding:0.8rem;border-radius:10px;box-shadow:0 4px 8px rgba(0,0,0,0.1);}
.vocab-icon{width:60px;margin-right:1rem}

/* ===== Badges & Pop-up Styles ===== */
.badge { display: inline-flex; align-items: center; justify-content: center; width: 60px; height: 60px; border-radius: 50%; background: linear-gradient(135deg, #ffe066 60%, #ffb347 100%); box-shadow: 0 4px 10px rgba(255, 195, 0, 0.3); border: 3px solid #fff176; margin: 0 10px 20px 0; position: relative; font-size: 2rem; font-weight: bold; color: #ff5722; transition: transform 0.2s; }
.badge .star { position: absolute; top: -8px; right: -8px; font-size: 1.2rem; color: #ffd700; text-shadow: 1px 1px 0 #fff; }
@keyframes pop-badge { 0% { transform: scale(0.2); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }
.badge.pop { animation: pop-badge 0.5s ease; }
.badges-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }
.badge-popup { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(70, 84, 130, 0.45); z-index: 1000; display: flex; align-items: center; justify-content: center; animation: popup-fade-in 0.3s; }
@keyframes popup-fade-in { from { opacity: 0; } to { opacity: 1; } }
.popup-inner { background: #fff9c4; border-radius: 1.5em; box-shadow: 0 6px 24px #ffd60088; padding: 2em 2.5em; text-align: center; max-width: 340px; animation: pop-badge 0.7s cubic-bezier(0.5,1.3,0.7,1.01); }
.popup-badge { font-size: 3.5em; margin-bottom: 0.7em; animation: pop-badge 0.7s cubic-bezier(0.5,1.3,0.7,1.01); }
.popup-close { margin-top: 1.2em; padding: 0.7em 2em; font-size: 1.1em; background: linear-gradient(90deg,#ffd600,#f48c06); color:#fff; border:none; border-radius:2em; font-weight:bold; cursor:pointer; box-shadow:0 2px 8px #ffd60044; transition:background 0.2s,transform 0.13s; }
.popup-close:hover { background: linear-gradient(90deg,#f48c06,#ffd600); transform: scale(1.08); }
/* ===== Word of the Day Styles ===== */
.wotd-tip { background:#f1f7ff; color:#3253a8; border-left:6px solid #5e60ce; padding:12px 18px; border-radius:1em; margin-bottom:18px; font-size:1.1em; }
.wotd-streak { font-size:1.25em; background:#ffe066; border-radius:1.2em; display:inline-block; padding:10px 26px; font-weight:bold; color:#ff8800; margin-bottom:22px; box-shadow:0 1px 4px #ffd60060; }
.wotd-feedback { font-size:1.3em; font-weight:bold; margin:16px 0 6px; padding:12px; border-radius:1em; display:none; transition:background 0.2s; }
.wotd-feedback.correct { background:#c0ffc0; color:#057d27; box-shadow:0 2px 8px #4ecb7640; display:block; }
.wotd-feedback.incorrect { background:#ffd2d2; color:#a60b0b; box-shadow:0 2px 8px #e5646440; display:block; }
.wotd-explanation { font-size:1em; margin:10px 0 0; color:#333; background:#fffde4; padding:10px 18px; border-radius:1em; display:none; }

.btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Fun Kid-Friendly Button Styles Override */
.btn {
  background: linear-gradient(90deg, #A0E7FF 60%, #67D6F7 100%);
  background: linear-gradient(90deg, #ff9a9e 0%, #fad0c4 100%);
  color: #fff;
  border: none;
  padding: 14px 32px;
  border-radius: 2.5em;
  font-size: 1.3em;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
  margin: 0.5em;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.btn:hover {
  transform: scale(1.05);
}
.btn:active {
  transform: scale(0.95);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.btn::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255,255,255,0.4) 10%, transparent 10%);
  background-position: center;
  background-repeat: no-repeat;
  background-size: 0% 0%;
  transition: background-size 0.3s;
}
.btn:hover::after {
  background-size: 200% 200%;
}

/* ===== Button Styles ===== */
.btn {
  background: linear-gradient(90deg, #A0E7FF 60%, #67D6F7 100%);
  color: #fff;
  border: none;
  padding: 12px 30px;
  border-radius: 2em;
  font-size: 1.2em;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  margin: 10px 5px;
  transition: background 0.3s, transform 0.15s;
}
.btn:hover {
  transform: scale(1.05);
}

/* Larger Word of the Day display */
.wotd-word-display #wotdWord {
  font-size: 3em;
  font-weight: bold;
  color: #3253a8;
  margin-bottom: 10px;
}
.wotd-word-display p#votdDefinition, .wotd-word-display p#votdExample {
  font-size: 1.1em;
}


/* ===== Spelling Page Styles ===== */

.spelling-wrapper {
  display: flex;
  flex-direction: row;
  margin-top: 20px;
}

/* Sidebar for levels */
.spelling-sidebar {
  width: 100px;
  margin-right: 20px;
}
.spelling-sidebar h3 {
  text-align: center;
  margin-bottom: 10px;
}
.level-item {
  width: 80px;
  height: 40px;
  margin: 5px auto;
  background: #ddd;
  border-radius: 10px;
  line-height: 40px;
  text-align: center;
  font-weight: bold;
  color: #555;
  cursor: pointer;
  transition: background 0.3s;
}
.level-item.completed {
  background: #A0E7FF;
  color: #005f7f;
}
.level-item.active {
  border: 2px solid #67D6F7;
}

/* Main content area */
.spelling-content {
  flex: 1;
}
.spelling-word {
  font-size: 2.5em;
  font-weight: bold;
  margin-bottom: 10px;
}
.spelling-input-area {
  margin-bottom: 15px;
}
.spelling-feedback {
  font-size: 1.3em;
  margin: 10px 0;
  padding: 10px;
  border-radius: 10px;
  display: none;
}
.spelling-feedback.correct {
  background: #c0ffc0;
  color: #057d27;
  box-shadow: 0 2px 8px #4ecb7640;
}
.spelling-feedback.incorrect {
  background: #ffd2d2;
  color: #a60b0b;
  box-shadow: 0 2px 8px #e5646440;
}

/* Modal for level up */
.levelup-modal {
  position: fixed;
  top:0; left:0; right:0; bottom:0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.levelup-content {
  background: #fff9c4;
  border-radius: 20px;
  padding: 20px;
  text-align: center;
  max-width: 300px;
  animation: pop-badge 0.7s ease;
}
.levelup-content img {
  max-width: 100%;
  height: auto;
  margin-bottom: 10px;
}


/* Spelling Page Styles */
.spelling-container {
  display: flex;
  gap: 20px;
  margin-top: 20px;
}
.spelling-sidebar {
  width: 150px;
  background: #e0f7fa;
  border-radius: 1em;
  padding: 10px;
}
.spelling-sidebar h3 {
  text-align: center;
  margin-bottom: 10px;
  font-size: 1.2em;
  color: #006064;
}
.level {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #b2ebf2;
  margin: 5px 0;
  padding: 6px 10px;
  border-radius: 0.8em;
  font-weight: bold;
  color: #004d40;
}
.level.locked {
  opacity: 0.4;
}
.level.current {
  background: #4dd0e1;
  color: #00251a;
}
.level.completed {
  background: #80deea;
  color: #004d40;
}
.prompt-area {
  flex: 1;
  background: #f1f8e9;
  border-radius: 1em;
  padding: 20px;
}
.prompt-image {
  display: block;
  margin: 0 auto 20px auto;
  max-width: 200px;
  border: 4px solid #aed581;
  border-radius: 1em;
  background: #fff;
}
.prompt-input {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.prompt-input input {
  font-size: 1.2em;
  padding: 6px 10px;
  border-radius: 0.5em;
  border: 2px solid #aed581;
}
.prompt-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}
.prompt-feedback {
  text-align: center;
  font-size: 1.3em;
  margin-bottom: 10px;
}
.level-progress {
  text-align: center;
  font-size: 1.1em;
  margin-bottom: 10px;
}

/* Center the spelling challenge title */
.spelling-title {
  text-align: center;
  display: block;
  margin: 0 auto 20px auto;
}

/* Ensure Prev Level button spacing */
#prevLevelBtn {
  margin-left: 10px;
}

/* ===== Spelling Modal Styles ===== */
.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.hidden {
  display: none;
}
.modal-content {
  background: #fff;
  padding: 2em;
  text-align: center;
  border-radius: 1em;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  animation: pop-badge 0.5s ease-out;
}
.spelling-title {
  text-align: center;
  display: block;
  margin: 20px auto;
}


/* Center the Spelling Challenge title */
.spelling-title {
  text-align: center;
  margin: 0 auto 20px auto;
  display: block;
  font-size: 2.5em;
}

/* Previous buttons spacing */
#prevRoundBtn, #prevLevelBtn {
  margin-left: 10px;
}

/* Level Up Popup */
#levelUpPopup {
  position: fixed;
  top:0; left:0; right:0; bottom:0;
  background: rgba(0,0,0,0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
#levelUpPopup .popup-content {
  background: #fffbe6;
  border-radius: 2em;
  padding: 2em;
  text-align: center;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  animation: bounceIn 0.8s;
}
@keyframes bounceIn {
  0% { transform: scale(0.3); opacity:0; }
  50% { transform: scale(1.1); opacity:1; }
  70% { transform: scale(0.9); }
  100% { transform: scale(1); }
}
#levelUpPopup .popup-content img {
  max-width: 100px;
  margin-bottom: 1em;
}
#levelUpPopup .popup-content .btn {
  margin-top: 1em;
}


/* Spelling Page Sidebar */
#levelSidebar {
  list-style: none;
  padding: 0;
  margin: 0;
  width: 150px;
  background: #E0F7FA;
  border-radius: 8px;
}
#levelSidebar li {
  padding: 10px;
  margin: 5px;
  background: #B2EBF2;
  border-radius: 5px;
  text-align: center;
  cursor: pointer;
  transition: background 0.3s, transform 0.2s;
}
#levelSidebar li.current {
  background: #00BCD4;
  font-weight: bold;
  transform: scale(1.05);
}
#levelSidebar li.completed {
  background: #4DD0E1;
}
#levelSidebar li:hover {
  background: #81D4FA;
}

/* Modal for level-up */
#levelUpModal {
  position: fixed;
  top: 0; left: 0; right:0; bottom:0;
  background: rgba(0,0,0,0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
#levelUpModal.open {
  display: flex;
}
.modal-content {
  background: #FFF8E1;
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  animation: pop-badge 0.6s ease-out;
  max-width: 300px;
}
#levelUpGif {
  width: 100px;
  height: 100px;
  object-fit: contain;
}
#levelUpPun {
  font-size: 1.1em;
  margin: 10px 0;
}

/* Button fun hover */
.btn {
  box-shadow: 0 4px #999;
  transition: all 0.2s;
}
.btn:active {
  box-shadow: 0 2px #666;
  transform: translateY(2px);
}

/* Center Spelling Challenge Title */
.spelling-title {
  text-align: center;
  display: block;
  margin: 0 auto 20px;
  font-size: 2em;
}
/* Level Up Popup Styles */
.levelup-popup {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 120, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.levelup-popup .popup-inner {
  background: #fff;
  border-radius: 1em;
  padding: 2em;
  text-align: center;
  max-width: 80%;
  animation: popup-zoom 0.6s ease;
}
@keyframes popup-zoom {
  0% { transform: scale(0.2); opacity: 0; }
  60% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}
.popup-message {
  font-size: 1.8em;
  margin-bottom: 0.5em;
  color: #ff5722;
}
.popup-pun {
  font-size: 1.2em;
  margin-bottom: 1em;
  color: #333;
}
.popup-gif {
  max-width: 100px;
  margin-bottom: 1em;
}

/* Big kid-friendly badge styles */
#badgesRow {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-top: 20px;
}

.badge {
  width: 80px;
  height: 80px;
  border: 2px solid #FFD54F;
  border-radius: 12px;
  background: #FFF8E1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.2s;
}

.badge:hover {
  transform: scale(1.1) rotate(-5deg);
}

.badge svg {
  width: 70px;
  height: 70px;
}
@keyframes spinScale {
  0% {
    transform: translate(-50%, -50%) scale(0.5) rotate(0deg);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  80% {
    transform: translate(-50%, -50%) scale(1.5) rotate(360deg);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1.5) rotate(360deg);
    opacity: 1;
  }
}

#mascot.center-spin {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 300px;       /* bigger size */
  height: auto;
  z-index: 9999;
  transform-origin: center center;
  animation: spinScale 3s ease forwards;
  pointer-events: none; /* so it doesn't block clicks */
}

@media (max-width: 768px) {
  .nav-tabs {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  .nav-tab {
    flex: 1 1 auto;
    min-width: 80px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .spelling-challenge-container form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  input[type="text"] {
    flex: 1 1 100%; /* full width on small screens */
    min-width: 0;
  }

  button {
    flex: 1 1 auto;
    min-width: 100px;
  }
}


.tagline {
  font-size: 1rem;
  font-weight: normal;
}

.tagline span, .tagline strong, .tagline em {
  font-size: inherit;
  font-weight: inherit;
}

/* Mobile portrait layout fixes */
@media (max-width: 480px) {
  /* Stack navigation tabs vertically and center */
  nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0;
    margin: 0 auto 1rem auto;
  }

  nav a {
    min-width: auto !important;
    font-size: 0.85rem;
    padding: 8px 12px;
    text-align: center;
    display: inline-block;
  }

  /* Mascot smaller and centered */
  #mascot {
    display: block !important;
    position: relative !important;
    width: 50px !important;
    height: auto;
    margin: 0 auto 15px auto;
    top: auto !important;
    right: auto !important;
  }

  /* Reduce main content padding */
  main {
    padding: 0.5rem 1rem;
    max-width: 100%;
  }

  /* Adjust story images for mobile */
  .story-img {
    width: 90% !important;
    max-width: none !important;
  }

  /* Make spelling challenge container fluid and scrollable if needed */
  .spelling-challenge-container {
    max-width: 100% !important;
    overflow-x: auto !important;
  }

  /* Navigation tabs container if used */
  .nav-tabs {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 8px !important;
  }

  /* Navigation tabs items */
  .nav-tab {
    flex: none !important;
    min-width: auto !important;
    font-size: 0.85rem !important;
  }
}

.title-container {
  white-space: nowrap;      /* prevent letters from wrapping */
  display: flex;
  justify-content: center;
  gap: 20px;                 /* space between letters */
  font-size: 3rem;          /* desktop font size */
}

@media (max-width: 480px) {
  .title-container {
    font-size: 1.8rem;      /* smaller font size on phones */
    padding: 0 10px;        /* some side padding */
    overflow-x: auto;       /* allow horizontal scroll if too narrow */
  }
  
  /* Optional: prevent letters from shrinking */
  .title-container .letter {
    flex-shrink: 0;
  }
}
@media (max-width: 480px) {
  /* Stack spelling container vertically on small screens */
  .spelling-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 1rem;
  }

  /* Sidebar full width below the prompt area */
  .spelling-sidebar {
    width: 100%;
    margin-top: 1rem;
  }

  /* Prompt area full width */
  .prompt-area {
    width: 100%;
  }

  /* Buttons smaller inside prompt area */
  .prompt-buttons button {
      white-space: nowrap;      /* prevent line wrapping */
  text-align: center;       /* center text horizontally */
  display: flex;            /* use flexbox for centering */
  justify-content: center;  /* center content */
  align-items: center;      /* center vertically */
    margin-right: 0.5rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  }

  /* Input full width */
  .prompt-input input[type="text"] {
    width: 100%;
    margin-bottom: 1rem;
  }
}

@media (max-width: 480px) {
  .spelling-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    padding: 0 1rem !important;
  }

  .spelling-sidebar {
    width: 100% !important;
    margin-top: 1rem !important;
    order: 2;  /* Moves sidebar below prompt area */
  }

  .prompt-area {
    width: 100% !important;
    order: 1;  /* Moves prompt area first */
  }
}

@media (max-width: 480px) {
  .prompt-buttons button {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15) !important; /* force consistent shadow */
    transition: box-shadow 0.2s ease;
  }
  
  .prompt-buttons button:hover,
  .prompt-buttons button:focus {
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.25) !important;
  }
}

@media (max-width: 480px) {
  .prompt-buttons button {
    flex: 1 1 auto;          /* Let buttons size naturally */
    min-width: 90px;         /* Minimum width to fit text */
    max-width: none;         /* Remove max-width to avoid clipping */
    padding: 0.5rem 1rem;    /* More horizontal padding */
    border-radius: 12px;     /* Slightly less rounded corners */
    white-space: normal;     /* Allow text to wrap if needed */
    text-align: center;      /* Center the button text */
  }
}
