/* ==========================================================================
   Accepting Differences — Children's Literature Thematic Project
   Shell stylesheet: title screen, stage frame, PowerPoint-style slide decks.
   No external assets — colors, gradients and emoji only.
   ========================================================================== */

:root {
  --sky:    #54c6ff;
  --sun:    #ffd93d;
  --coral:  #ff6b6b;
  --grass:  #6bcb77;
  --grape:  #9b5de5;
  --teal:   #00a8c6;
  --ink:    #3a3360;
  --paper:  #fffdf6;
  --cream:  #fff3c4;
  --lav:    #efeaff;

  --font-head: "Comic Sans MS", "Comic Neue", "Chalkboard SE", "Segoe Print", cursive;
  --font-body: "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-body);
  color: var(--ink);
  /* Sky gradient + polka dots, pure CSS */
  background-color: #aee3ff;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.6) 12px, transparent 13px),
    radial-gradient(rgba(255, 255, 255, 0.35) 8px, transparent 9px),
    linear-gradient(180deg, #8fd8ff 0%, #d8f3ff 55%, #fff7d6 100%);
  background-size: 96px 96px, 58px 58px, 100% 100%;
  background-position: 0 0, 30px 34px, 0 0;
  background-attachment: fixed;
}

/* ============================ Top progress bar ========================== */

#topbar {
  padding: 10px 12px 4px;
  display: flex;
  justify-content: center;
}

.progress {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 960px;
}

.pill {
  font-size: 0.78rem;
  font-weight: bold;
  padding: 4px 12px;
  border-radius: 999px;
  border: 2px solid rgba(58, 51, 96, 0.35);
  background: rgba(255, 255, 255, 0.55);
  color: rgba(58, 51, 96, 0.65);
  transition: transform 0.15s ease, background 0.15s ease;
}

.pill.done {
  background: var(--grass);
  border-color: var(--ink);
  color: #fff;
}

.pill.active {
  background: var(--sun);
  border-color: var(--ink);
  color: var(--ink);
  transform: scale(1.12);
  box-shadow: 0 3px 0 rgba(58, 51, 96, 0.4);
}

/* Already-visited pills are buttons: show they're clickable. */
.pill.clickable {
  cursor: pointer;
}

.pill.clickable:hover,
.pill.clickable:focus-visible {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
  outline: none;
  transform: scale(1.08);
}

.pill.active.clickable:hover,
.pill.active.clickable:focus-visible {
  background: var(--sun);
  color: var(--ink);
  transform: scale(1.12);
}

/* ================================ Layout ================================ */

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 16px 20px;
  width: 100%;
}

/* ============================== Title screen ============================ */

#title-screen {
  position: relative;
  text-align: center;
  max-width: 920px;
  padding: 34px 40px 30px;
  background: rgba(255, 253, 246, 0.92);
  border: 5px solid var(--ink);
  border-radius: 28px;
  box-shadow: 0 10px 0 rgba(58, 51, 96, 0.25);
}

.kicker {
  display: inline-block;
  margin: 0 0 6px;
  padding: 5px 18px;
  font-size: 0.85rem;
  font-weight: bold;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--lav);
  border: 2px dashed var(--grape);
  border-radius: 999px;
}

.game-title {
  margin: 8px 0 4px;
  font-family: var(--font-head);
  font-size: 3.4rem;
  line-height: 1.05;
  color: var(--ink);
  text-shadow: 3px 3px 0 var(--sun);
}

.game-title span { color: var(--coral); }

.thesis {
  max-width: 700px;
  margin: 14px auto 20px;
  font-size: 1.08rem;
  line-height: 1.6;
  background: var(--cream);
  border-left: 8px solid var(--sun);
  border-radius: 12px;
  padding: 14px 20px;
  text-align: left;
}

/* The three books, shown as scrapbook cards */
.book-cards {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin: 0 0 24px;
  padding: 0;
}

.card {
  width: 190px;
  padding: 16px 12px 14px;
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 16px;
  box-shadow: 0 5px 0 rgba(58, 51, 96, 0.3);
  transition: transform 0.15s ease;
}

.card:hover { transform: rotate(0deg) scale(1.05) !important; }

.card.c1 { transform: rotate(-2deg);  border-color: var(--coral); }
.card.c2 { transform: rotate(1.5deg); border-color: var(--grape); }
.card.c3 { transform: rotate(-1deg);  border-color: var(--teal);  }

.card-emoji { display: block; font-size: 2.6rem; margin-bottom: 6px; }
.card b { display: block; font-family: var(--font-head); font-size: 1.05rem; }
.card i { display: block; margin-top: 3px; font-size: 0.85rem; color: #6d6899; }

.title-buttons {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.howto  { margin: 18px 0 4px; font-size: 0.95rem; font-weight: bold; color: #6d6899; }
.credits { margin: 4px 0 0; font-size: 0.85rem; color: #9a95c0; }

/* Floating emoji decorations on the title screen */
.floaties { position: absolute; inset: 0; pointer-events: none; }
.floaty { position: absolute; font-size: 2rem; animation: bob 3s ease-in-out infinite; }
.floaty.f1 { top: 14px;    left: 22px;  }
.floaty.f2 { top: 20px;    right: 26px; animation-delay: 0.6s; }
.floaty.f3 { bottom: 18px; left: 34px;  animation-delay: 1.1s; }
.floaty.f4 { bottom: 26px; right: 30px; animation-delay: 1.6s; }

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

/* ================================ Buttons =============================== */

.btn {
  font-family: var(--font-head);
  font-size: 1.05rem;
  font-weight: bold;
  color: var(--ink);
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 10px 24px;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(58, 51, 96, 0.45);
  transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.15s ease;
}

.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 7px 0 rgba(58, 51, 96, 0.45); }
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 rgba(58, 51, 96, 0.45); }

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

.btn-big   { background: var(--grass); color: #fff; font-size: 1.5rem; padding: 14px 40px; }
.btn-ghost { background: #fff; }
.btn-cta   { background: var(--sun); font-size: 1.15rem; }
.btn-nav   { background: #fff; font-size: 0.95rem; padding: 8px 18px; }

/* Pressed state for toggle-style nav buttons (the 📱 Touch toggle). */
.btn-nav[aria-pressed="true"] { background: var(--grass); color: #fff; }

/* ============================ Stage (games) ============================= */

#stage-shell {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: auto;
  padding: 6px 0;
}

/* Author display rules beat the UA [hidden] style — restore hiding. */
#stage-shell[hidden],
#game-bar[hidden] { display: none; }

#stage {
  position: relative;
  flex: 0 0 auto;
  width: 860px;
  /* Games render a taller instruction chip above their canvas, so the stage
     grows to fit them; decks/splash keep the 520px frame via min-height. */
  min-height: 520px;
  background: var(--paper);
  border: 6px solid var(--ink);
  border-radius: 22px;
  box-shadow: 0 10px 0 rgba(58, 51, 96, 0.3);
  overflow: hidden;
}

/* ==================== Pre-game splash & game control bar ================ */

.splash {
  height: 100%;
  min-height: 508px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  padding: 18px 30px;
  background:
    radial-gradient(rgba(84, 198, 255, 0.25) 8px, transparent 9px),
    var(--lav);
  background-size: 44px 44px;
}

.splash-emoji { font-size: 3rem; }

.splash h2 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 2.1rem;
  color: var(--ink);
  text-shadow: 3px 3px 0 var(--sun); /* main.js tints this per level */
}

.splash-book {
  margin: 0;
  font-size: 0.95rem;
  font-weight: bold;
  color: #6d6899;
}

.splash-blurb {
  margin: 2px 0 4px;
  max-width: 600px;
  font-size: 1.02rem;
  line-height: 1.5;
}

.splash-howto {
  margin: 2px 0 10px;
  padding: 10px 28px 12px;
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 rgba(58, 51, 96, 0.3);
  text-align: left;
}

.splash-howto h3 {
  margin: 0 0 4px;
  font-family: var(--font-head);
  font-size: 1.1rem;
}

.splash-howto ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.splash-howto li {
  position: relative;
  padding-left: 28px;
  font-size: 1.15rem; /* ~18px bold dark-on-cream, one control per line */
  font-weight: bold;
  line-height: 1.55;
  color: var(--ink);
}

.splash-howto li::before {
  content: "🎮";
  position: absolute;
  left: 0;
  font-size: 1rem;
}

#game-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding-top: 12px;
}

/* ===================== Slide deck (PowerPoint look) ===================== */

.deck {
  height: 100%;
  min-height: 508px; /* fills the 520px stage frame (minus its 6px borders) */
  display: flex;
  flex-direction: column;
  padding: 14px 18px 12px;
  background:
    radial-gradient(rgba(58, 51, 96, 0.08) 6px, transparent 7px),
    #dfeefb;
  background-size: 34px 34px;
}

.slide-holder {
  flex: 1;
  display: flex;
  min-height: 0;
}

.slide-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 6px 0 rgba(58, 51, 96, 0.25);
  overflow: hidden;
  animation: slide-in 0.28s ease;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateX(26px); }
  to   { opacity: 1; transform: translateX(0); }
}

.slide-title-band {
  padding: 12px 24px;
  background: var(--coral); /* main.js overrides per deck */
  border-bottom: 4px solid var(--ink);
}

.slide-title-band h2 {
  margin: 0;
  font-family: var(--font-head);
  font-size: 1.55rem;
  color: #fff;
  text-shadow: 2px 2px 0 rgba(58, 51, 96, 0.55);
}

.slide-bullets {
  margin: 0;
  padding: 18px 34px 10px 30px;
  list-style: none;
  overflow-y: auto;
  font-size: 1.04rem;
  line-height: 1.55;
}

.slide-bullets li {
  position: relative;
  margin-bottom: 13px;
  padding-left: 34px;
}

.slide-bullets li::before {
  position: absolute;
  left: 0;
  top: 0;
  font-size: 1.1rem;
}

/* Rotating playful bullet markers */
.slide-bullets li:nth-child(4n+1)::before { content: "🖍️"; }
.slide-bullets li:nth-child(4n+2)::before { content: "⭐"; }
.slide-bullets li:nth-child(4n+3)::before { content: "📌"; }
.slide-bullets li:nth-child(4n+4)::before { content: "✏️"; }

/* Placeholder bullets the student still has to write */
.slide-bullets li.is-placeholder {
  background: #fffbe0;
  border-radius: 8px;
  padding-top: 4px;
  padding-bottom: 4px;
}

.edit-tag {
  display: inline-block;
  margin-right: 5px;
  padding: 0 7px;
  font-size: 0.72rem;
  font-weight: bold;
  letter-spacing: 0.04em;
  color: #fff;
  background: var(--coral);
  border-radius: 6px;
  vertical-align: 2px;
}

.slide-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  padding: 7px 22px;
  font-size: 0.8rem;
  color: #8b87b0;
  border-top: 2px dashed #d8d4ec;
  background: #fbf9ff;
}

/* Toolbar under the slide */
.deck-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 12px;
}

.slide-counter {
  min-width: 120px;
  text-align: center;
  font-weight: bold;
  font-size: 0.95rem;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 7px 16px;
}

.kbd-hint {
  font-size: 0.78rem;
  color: #6d6899;
}

/* ==================== Missing game / deck placeholder =================== */

.missing-box {
  height: 100%;
  min-height: 508px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 30px;
  background:
    radial-gradient(rgba(255, 107, 107, 0.12) 8px, transparent 9px),
    var(--cream);
  background-size: 40px 40px;
}

.missing-emoji { font-size: 3.6rem; }

.missing-box h2 {
  margin: 4px 0;
  font-family: var(--font-head);
  font-size: 1.8rem;
  color: var(--coral);
}

.missing-box p { margin: 2px 0; max-width: 560px; font-size: 1rem; }
.missing-box .missing-note { font-size: 0.85rem; color: #8b87b0; }
.missing-box .btn { margin-top: 14px; }

/* ================================ Footer ================================ */

#footer {
  padding: 8px 12px 14px;
  text-align: center;
  font-size: 0.8rem;
  color: rgba(58, 51, 96, 0.7);
}

/* ============================ Small screens ============================= */

@media (max-width: 940px) {
  #stage-shell { align-items: center; overflow-x: visible; }
  /* Let the stage and any game canvas shrink to fit small viewports. */
  #stage { width: 100%; }
  #stage canvas { max-width: 100%; height: auto; }
  #game-bar { flex-wrap: wrap; }
  .game-title { font-size: 2.4rem; }
  #title-screen { padding: 24px 18px; }

  /* Modest small-screen typography/spacing for slide decks and splashes. */
  .slide-title-band { padding: 10px 14px; }
  .slide-title-band h2 { font-size: 1.2rem; }
  .slide-bullets { font-size: 0.95rem; padding: 12px 18px 8px 16px; }
  .slide-bullets li { padding-left: 26px; margin-bottom: 9px; }
  .slide-counter { min-width: 0; font-size: 0.85rem; padding: 6px 12px; }
  .kbd-hint { display: none; }
  .deck { padding: 10px; }
  .deck-toolbar { flex-wrap: wrap; }
  .splash { padding: 14px; }
  .splash h2 { font-size: 1.5rem; }
  .splash-howto li { font-size: 1rem; }
}
