/* ===========================================================
   Nia's Star Academy — styles.css
   ONE stylesheet = the brand for EVERY page (HTML-3 idea).
   Change a color here and all 4 pages change at once.
   =========================================================== */

/* ---- Brand colors (her favorites) ---- */
:root {
  --pink: #ff6fb5;
  --pink-soft: #ffe3f1;
  --purple: #9b5de5;
  --purple-soft: #efe4ff;
  --red: #f15bb5;      /* a rosy red so it stays "girly" */
  --true-red: #e63946;
  --blue: #4cc9f0;
  --blue-soft: #dff6ff;
  --yellow: #ffd93d;
  --yellow-soft: #fff6c7;
  --white: #ffffff;
  --ink: #3d2c5c;      /* dark purple text, easier on eyes than black */
  --radius: 22px;
  --shadow: 0 6px 0 rgba(61, 44, 92, 0.15);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Fredoka", "Comic Sans MS", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 10%, var(--yellow-soft) 0 80px, transparent 81px),
    radial-gradient(circle at 90% 30%, var(--blue-soft) 0 120px, transparent 121px),
    linear-gradient(180deg, var(--pink-soft), var(--purple-soft));
  background-attachment: fixed;
  min-height: 100vh;
  font-size: 18px;
  line-height: 1.5;
}

/* ---- One menu, copied to every page ---- */
/* Three neat parts: logo (left) · menu (middle) · sound + stars (right) */
.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;      /* name sits dead center */
  grid-template-areas: ". logo tools" "nav nav nav";
  align-items: center;
  gap: 6px 16px;
  padding: 8px 20px 10px;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(6px);
  border-bottom: 5px solid var(--pink);
  box-shadow: 0 4px 0 rgba(155, 93, 229, .12);
  position: sticky;
  top: 0;
  z-index: 10;
}
.logo {
  grid-area: logo;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 2px 22px 4px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--pink-soft), var(--purple-soft) 50%, var(--blue-soft));
  box-shadow: inset 0 0 0 3px var(--white), 0 3px 0 rgba(155, 93, 229, .15);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--purple);
  text-decoration: none;
  white-space: nowrap;
  transition: transform .2s;
}
.logo:hover { transform: scale(1.04) rotate(-1deg); }
.logo-words { text-shadow: 0 2px 0 var(--white); letter-spacing: .5px; }
.logo-words span { color: var(--pink); }
.logo-icon { font-size: 1.7rem; display: inline-block; animation: logo-bob 3s ease-in-out infinite; }
.logo-icon.flip { animation-delay: -1.5s; }
@keyframes logo-bob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-3px) rotate(6deg); } }

.site-header nav { grid-area: nav; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
nav a {
  display: inline-block;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--purple-soft);
  color: var(--purple);
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .15s, background .15s;
}
nav a:hover { transform: translateY(-3px) rotate(-2deg); background: var(--yellow); }
nav a.active { background: var(--pink); color: var(--white); box-shadow: 0 3px 0 rgba(61, 44, 92, .18); }

.header-tools { grid-area: tools; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.star-counter {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, var(--yellow), #ffe98a);
  padding: 6px 16px 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1.15rem;
  border: 3px solid var(--white);
  box-shadow: 0 0 0 2px var(--yellow), var(--shadow);
  white-space: nowrap;
}
.star-counter .star-icon { font-size: 1.4rem; display: inline-block; animation: star-twinkle 2.4s ease-in-out infinite; }
.star-counter small { font-size: .85rem; font-weight: 600; }
@keyframes star-twinkle { 0%, 100% { transform: rotate(0) scale(1); } 50% { transform: rotate(18deg) scale(1.15); } }

@media (max-width: 760px) {
  .site-header { grid-template-columns: 1fr auto; grid-template-areas: "logo tools" "nav nav"; padding: 6px 12px 8px; }
  .logo { justify-self: start; font-size: 1.3rem; padding: 2px 14px; gap: 6px; }
  .logo-icon { font-size: 1.2rem; }
  .site-header nav { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 4px; }
}

main { max-width: 1050px; margin: 0 auto; padding: 24px; }

h1, h2, h3 { line-height: 1.2; }
h1 { font-size: 2.6rem; color: var(--purple); margin: .3em 0; }
h2 { color: var(--pink); }

/* ---- Hero banner ---- */
.hero {
  text-align: center;
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px 20px;
  box-shadow: var(--shadow);
  border: 4px dashed var(--pink);
}
.hero .emoji-row { font-size: 2.4rem; letter-spacing: 8px; }

/* ---- Cards (reused everywhere: one box = one component) ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin: 24px 0;
}
.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border-top: 10px solid var(--purple);
}
.card:nth-child(4n+1) { border-top-color: var(--pink); }
.card:nth-child(4n+2) { border-top-color: var(--blue); }
.card:nth-child(4n+3) { border-top-color: var(--yellow); }
.card .big { font-size: 3rem; }
.card.done { outline: 4px solid var(--yellow); }
.card.done::after { content: " ⭐ Done!"; font-weight: 700; color: var(--purple); }

/* ---- Buttons ---- */
.btn {
  font: inherit;
  font-weight: 700;
  border: none;
  cursor: pointer;
  padding: 10px 20px;
  border-radius: 999px;
  background: var(--pink);
  color: var(--white);
  box-shadow: var(--shadow);
  transition: transform .12s;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { transform: scale(1.06); }
.btn:active { transform: scale(.96); }
.btn.purple { background: var(--purple); }
.btn.blue { background: var(--blue); color: var(--ink); }
.btn.yellow { background: var(--yellow); color: var(--ink); }
.btn.ghost { background: var(--white); color: var(--purple); border: 3px solid var(--purple); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---- Code snippets in lessons ---- */
code, .code {
  font-family: "Courier New", monospace;
  background: var(--ink);
  color: var(--yellow);
  border-radius: 8px;
  padding: 2px 8px;
}
pre.code {
  padding: 14px;
  overflow-x: auto;
  font-size: 1rem;
  line-height: 1.6;
}
.code .tag { color: var(--pink); }
.code .attr { color: var(--blue); }
.code .val { color: #b8f2a0; }

/* ---- Lesson sections ---- */
.lesson {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  margin: 28px 0;
  box-shadow: var(--shadow);
  border-left: 12px solid var(--blue);
}
.lesson .simple {
  background: var(--yellow-soft);
  border-radius: 14px;
  padding: 12px 16px;
}
.choices { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.feedback { font-weight: 700; min-height: 1.6em; }
.feedback.good { color: var(--purple); }
.feedback.bad { color: var(--true-red); }

/* Head vs Body sorting game */
.sort-area { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
.bucket {
  border: 4px dashed var(--purple);
  border-radius: 16px;
  min-height: 120px;
  padding: 10px;
}
.bucket h3 { margin: 0 0 8px; }
.bucket.head { background: var(--blue-soft); }
.bucket.body { background: var(--pink-soft); }
.chip {
  display: inline-block;
  margin: 4px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--yellow);
  font-family: "Courier New", monospace;
  cursor: pointer;
  border: 3px solid transparent;
}
.chip.selected { border-color: var(--pink); transform: scale(1.08); }

/* One-stylesheet demo: three tiny "pages" share one color */
.mini-pages { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.mini-page {
  flex: 1 1 140px;
  border-radius: 12px;
  border: 3px solid var(--ink);
  overflow: hidden;
  background: var(--white);
}
.mini-page .bar { background: var(--demo-color, var(--pink)); color: var(--white); padding: 6px 10px; font-weight: 700; transition: background .3s; }
.mini-page p { margin: 8px 10px; font-size: .9rem; }

/* ---- ABC page ---- */
.abc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
}
.letter {
  font: inherit;
  font-size: 2.2rem;
  font-weight: 700;
  aspect-ratio: 1;
  border: none;
  border-radius: 18px;
  cursor: pointer;
  color: var(--white);
  box-shadow: var(--shadow);
  transition: transform .12s;
}
.letter:hover { transform: scale(1.1) rotate(3deg); }
.letter:nth-child(6n+1) { background: var(--pink); }
.letter:nth-child(6n+2) { background: var(--purple); }
.letter:nth-child(6n+3) { background: var(--blue); }
.letter:nth-child(6n+4) { background: var(--yellow); color: var(--ink); }
.letter:nth-child(6n+5) { background: var(--true-red); }
.letter:nth-child(6n+6) { background: var(--red); }
.letter-show {
  text-align: center;
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0;
  box-shadow: var(--shadow);
}
.letter-show .huge { font-size: 6rem; font-weight: 700; color: var(--pink); line-height: 1; }
.letter-show .pic { font-size: 4rem; }

/* ---- Rewards / coupons ---- */
.coupon {
  background: var(--white);
  border: 4px dashed var(--pink);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  position: relative;
}
.coupon .cost { font-weight: 700; color: var(--purple); }
.ticket {
  display: none;
  margin-top: 20px;
  background: linear-gradient(135deg, var(--yellow), var(--pink));
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  border: 6px dotted var(--white);
  box-shadow: var(--shadow);
}
.ticket.show { display: block; animation: pop .4s ease-out; }

/* Star Catch mini game */
.game-box {
  position: relative;
  height: 320px;
  background: linear-gradient(180deg, var(--purple), var(--pink));
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 12px;
  display: none;
}
.game-box.show { display: block; }
.falling {
  position: absolute;
  font-size: 2.4rem;
  cursor: pointer;
  user-select: none;
}
.game-hud {
  position: absolute;
  top: 8px; left: 12px; right: 12px;
  display: flex; justify-content: space-between;
  color: var(--white); font-weight: 700;
  pointer-events: none;
}

/* ---- Birthday sticky note ---- */
.sticky {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 230px;
  padding: 18px;
  background: var(--yellow);
  color: var(--ink);
  font-size: 1.15rem;
  font-weight: 600;
  transform: rotate(4deg);
  box-shadow: 4px 8px 14px rgba(0, 0, 0, .25);
  z-index: 50;
  display: none;
}
.sticky.show { display: block; animation: pop .5s ease-out; }
.sticky::before {               /* a little piece of tape */
  content: "";
  position: absolute;
  top: -12px; left: 50%;
  width: 80px; height: 24px;
  transform: translateX(-50%) rotate(-3deg);
  background: rgba(255, 255, 255, .65);
}
.sticky button { float: right; border: none; background: none; font-size: 1.2rem; cursor: pointer; }

/* Confetti burst when a star is earned */
.confetti {
  position: fixed;
  top: -20px;
  font-size: 1.6rem;
  pointer-events: none;
  animation: fall 1.8s linear forwards;
  z-index: 100;
}

@keyframes pop { from { transform: scale(.6); opacity: 0; } to { opacity: 1; } }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: .8; } }

footer {
  text-align: center;
  padding: 24px;
  color: var(--purple);
  font-size: .95rem;
}
footer button { font: inherit; background: none; border: none; color: var(--pink); text-decoration: underline; cursor: pointer; }

@media (max-width: 640px) {
  h1 { font-size: 2rem; }
  .sort-area { grid-template-columns: 1fr; }
  .sticky { width: 180px; right: 12px; bottom: 12px; }
}
