* { box-sizing: border-box; margin: 0; padding: 0; }

/* iJeeto brand palette — sampled from the star logo. Copied per game rather
   than shared, so each game folder stays self-contained (guidelines 9.1). */
:root {
  --purple: #4A1A63;
  --purple-soft: #6B3A85;
  --amber: #FFC42E;
  --orange: #FF7A2F;
  --orange-dark: #DD5E15;
  --teal: #2FAFAF;
  --teal-dark: #218A8A;
  --cream: #FFF7EA;
  --cream-2: #FCEBD2;
  --font-brand: ui-rounded, "SF Pro Rounded", Nunito, Quicksand,
                "Hiragino Maru Gothic ProN", "Trebuchet MS", system-ui, sans-serif;

  --bg: var(--cream);
  --ink: var(--purple);
  --accent: var(--teal);
  --accent-dark: var(--teal-dark);
  --card: #fff;
  --bad: #d4564f;
  --shadow-soft: #e6d8c2;
}

html, body {
  height: 100%;
  font-family: var(--font-brand);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}

.brand-mark { width: clamp(84px, 22vw, 116px); height: auto; display: block; margin: 0 auto; }

#app { height: 100%; display: flex; flex-direction: column; }
.screen { display: none; flex: 1; min-height: 0; flex-direction: column; }
.screen.active { display: flex; }
.hidden { display: none !important; }

/* ---------- menus ---------- */

.menu-screen { align-items: center; padding: 20px 16px; overflow-y: auto; }
.logo { font-size: clamp(26px, 6.5vw, 42px); margin-top: 4vh; text-align: center; }
.tagline { font-size: clamp(14px, 3vw, 18px); margin: 12px 0 26px; text-align: center; line-height: 1.6; }
.menu-buttons { display: flex; flex-direction: column; gap: 14px; width: min(340px, 92vw); }

.big-btn {
  min-height: 54px; border: 0; border-radius: 14px;
  background: var(--accent); color: #fff;
  font-family: inherit; font-size: 18px; font-weight: 700;
  cursor: pointer; padding: 10px 18px; box-shadow: 0 4px 0 var(--accent-dark);
}
.big-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-dark); }
.big-btn:disabled { opacity: .55; box-shadow: none; }
.big-btn.ghost { background: #fff; color: var(--ink); box-shadow: 0 4px 0 var(--shadow-soft); }
.big-btn.danger { background: var(--bad); box-shadow: 0 4px 0 #a53b36; }

.portal-link {
  margin-top: 22px; padding: 12px 20px; min-height: 44px;
  display: inline-flex; align-items: center;
  font-size: 14px; color: var(--ink); text-decoration: none;
  background: #fff; border-radius: 999px; box-shadow: 0 2px 0 var(--shadow-soft);
}
.build { margin-top: 14px; font-size: 12px; color: var(--purple-soft); }

.menu-header {
  display: flex; align-items: center; gap: 12px;
  width: min(720px, 100%); margin-bottom: 10px;
}
.menu-header h2 { font-size: clamp(18px, 4vw, 24px); }
.back-btn, .hud-btn {
  min-width: 44px; min-height: 44px; border: 0; border-radius: 12px;
  background: #fff; color: var(--ink); font-size: 18px; cursor: pointer;
  box-shadow: 0 2px 0 var(--shadow-soft);
}
.map-progress { width: min(720px, 100%); font-size: 14px; margin-bottom: 12px; color: var(--purple-soft); }

/* ---------- stage list ---------- */

.stage-grid { width: min(720px, 100%); display: flex; flex-direction: column; gap: 12px; }
.stage {
  display: flex; align-items: center; gap: 14px; text-align: left;
  min-height: 76px; padding: 14px 16px; border: 0; border-radius: 16px;
  background: var(--card); color: inherit; font-family: inherit;
  cursor: pointer; box-shadow: 0 3px 0 var(--shadow-soft);
}
.stage:disabled { cursor: default; opacity: .55; }
.stage.cleared { box-shadow: 0 3px 0 var(--amber); }
.stage-num {
  flex: none; width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--cream-2); font-size: 19px; font-weight: 800;
}
.stage-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stage-name { font-size: 17px; font-weight: 700; }
.stage-blurb { font-size: 13px; color: var(--purple-soft); line-height: 1.4; }
.stage-progress { margin-left: auto; flex: none; font-size: 13px; font-weight: 700; color: var(--purple-soft); }

/* ---------- game screen ----------
   Everything above this line is the shared iJeeto shell and should not need
   changing. Everything below is yours: replace it with what THIS game needs.  */

#game-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; width: 100%;
}
#stage-label { flex: 1; text-align: center; font-size: 14px; font-weight: 700; color: var(--purple-soft); }

.prompt {
  padding: 0 16px 8px; text-align: center;
  font-size: clamp(15px, 3.6vw, 19px); line-height: 1.5;
}
.prompt b { color: var(--orange-dark); }

/* The play area is whatever this game is. It gets the space between the
   prompt and the footer, and scrolls if it needs to. */
.play-area {
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 8px 16px;
}

.game-footer { padding: 4px 16px 16px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
/* Feedback is never red. A wrong answer is a nudge, not a failure (§8). */
.feedback {
  min-height: 20px; font-size: 14px; line-height: 1.45; text-align: center;
  color: var(--purple-soft);
}
.feedback.nudge { color: var(--orange-dark); font-weight: 700; }
.feedback.good { color: var(--teal-dark); font-weight: 700; }
.check-btn { width: min(340px, 92vw); background: var(--orange); box-shadow: 0 4px 0 var(--orange-dark); }
.check-btn:active { box-shadow: 0 1px 0 var(--orange-dark); }

/* ---------- opposites board ---------- */

.opp-board {
  width: min(520px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.prompt-card {
  width: min(220px, 70vw);
  min-height: 120px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 4px 0 var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px;
}

.prompt-emoji { font-size: clamp(40px, 12vw, 56px); line-height: 1; }
.prompt-word {
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 800;
  text-transform: capitalize;
}

.option-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.option-btn {
  min-height: 72px;
  border: 0;
  border-radius: 16px;
  background: #fff;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  touch-action: manipulation;
}

.option-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--shadow-soft);
}

.option-btn:disabled { cursor: default; }
.option-btn.is-answer {
  box-shadow: 0 3px 0 var(--teal);
  background: #e8f8f8;
}
.option-btn.is-miss { opacity: 0.55; }
.option-emoji { font-size: 28px; line-height: 1; }
.option-word {
  font-size: 15px;
  font-weight: 700;
  text-transform: capitalize;
}

.try-shake { animation: try-shake 0.4s ease; }
@keyframes try-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ---------- contrast reveal ----------
   The learning moment: both poles appear and animate their difference.
   Scale, height, temperature tint, weight sink/float — not colour alone. */

.pair-reveal {
  width: min(520px, 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 0;
}

.reveal-vs {
  font-size: 28px;
  font-weight: 800;
  color: var(--orange);
  flex: none;
}

.reveal-card {
  flex: 1;
  min-height: 130px;
  max-width: 180px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 4px 0 var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 10px;
  transform-origin: center bottom;
}

.reveal-emoji { font-size: clamp(36px, 10vw, 48px); line-height: 1; }
.reveal-word {
  font-size: clamp(16px, 4vw, 20px);
  font-weight: 800;
  text-transform: capitalize;
}

.contrast-play.contrast-scale.is-more,
.contrast-play.contrast-height.is-more,
.contrast-play.contrast-length.is-more,
.contrast-play.contrast-width.is-more,
.contrast-play.contrast-fill.is-more {
  animation: grow-more 0.9s ease both;
}

.contrast-play.contrast-scale.is-less,
.contrast-play.contrast-height.is-less,
.contrast-play.contrast-length.is-less,
.contrast-play.contrast-width.is-less,
.contrast-play.contrast-fill.is-less {
  animation: grow-less 0.9s ease both;
}

/* pole-a / pole-b fallbacks when word-class is missing */
.contrast-play.contrast-scale.pole-a:not(.is-less),
.contrast-play.contrast-height.pole-a:not(.is-less) {
  animation: grow-more 0.9s ease both;
}
.contrast-play.contrast-scale.pole-b:not(.is-more),
.contrast-play.contrast-height.pole-b:not(.is-more) {
  animation: grow-less 0.9s ease both;
}

@keyframes grow-more {
  0% { transform: scale(1); }
  50% { transform: scale(1.35); }
  100% { transform: scale(1.25); }
}
@keyframes grow-less {
  0% { transform: scale(1); }
  50% { transform: scale(0.65); }
  100% { transform: scale(0.72); }
}

.contrast-play.contrast-temp.is-warm,
.contrast-play.contrast-temp.pole-a:not(.is-cool) {
  animation: warm-glow 0.9s ease both;
}
.contrast-play.contrast-temp.is-cool,
.contrast-play.contrast-temp.pole-b:not(.is-warm) {
  animation: cool-glow 0.9s ease both;
}

@keyframes warm-glow {
  0% { background: #fff; transform: scale(1); }
  100% { background: #ffe4c4; transform: scale(1.08); box-shadow: 0 4px 0 #f0b060; }
}
@keyframes cool-glow {
  0% { background: #fff; transform: scale(1); }
  100% { background: #d9f0ff; transform: scale(0.92); box-shadow: 0 4px 0 #8ec8e8; }
}

.contrast-play.contrast-weight.is-strong,
.contrast-play.contrast-weight.pole-a:not(.is-gentle) {
  animation: heavy-sink 0.9s ease both;
}
.contrast-play.contrast-weight.is-gentle,
.contrast-play.contrast-weight.pole-b:not(.is-strong) {
  animation: light-float 0.9s ease both;
}

@keyframes heavy-sink {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(14px) scale(1.1); }
}
@keyframes light-float {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-14px) scale(0.9); }
}

.contrast-play.contrast-volume.is-strong,
.contrast-play.contrast-volume.pole-a:not(.is-gentle),
.contrast-play.contrast-speed.is-strong,
.contrast-play.contrast-speed.pole-a:not(.is-gentle) {
  animation: shake-loud 0.9s ease both;
}
.contrast-play.contrast-volume.is-gentle,
.contrast-play.contrast-volume.pole-b:not(.is-strong),
.contrast-play.contrast-speed.is-gentle,
.contrast-play.contrast-speed.pole-b:not(.is-strong) {
  animation: still-quiet 0.9s ease both;
}

@keyframes shake-loud {
  0%, 100% { transform: translateX(0) scale(1.1); }
  20% { transform: translateX(-5px) scale(1.1); }
  40% { transform: translateX(5px) scale(1.1); }
  60% { transform: translateX(-4px) scale(1.1); }
  80% { transform: translateX(4px) scale(1.1); }
}
@keyframes still-quiet {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(0.88); opacity: 0.85; }
}

.contrast-play.contrast-daynight.is-warm,
.contrast-play.contrast-daynight.pole-a:not(.is-cool) {
  animation: day-bright 0.9s ease both;
}
.contrast-play.contrast-daynight.is-cool,
.contrast-play.contrast-daynight.pole-b:not(.is-warm) {
  animation: night-dark 0.9s ease both;
}

@keyframes day-bright {
  0% { background: #fff; }
  100% { background: #fff6c8; box-shadow: 0 4px 0 #e8c84a; transform: scale(1.08); }
}
@keyframes night-dark {
  0% { background: #fff; }
  100% { background: #e4e0f5; box-shadow: 0 4px 0 #8a7ab8; transform: scale(0.92); }
}

.contrast-play.contrast-mood.is-up,
.contrast-play.contrast-mood.pole-a:not(.is-down) {
  animation: mood-up 0.9s ease both;
}
.contrast-play.contrast-mood.is-down,
.contrast-play.contrast-mood.pole-b:not(.is-up) {
  animation: mood-down 0.9s ease both;
}

@keyframes mood-up {
  0% { transform: translateY(0); }
  40% { transform: translateY(-12px); }
  100% { transform: translateY(-6px) scale(1.08); background: #e8f8f0; }
}
@keyframes mood-down {
  0% { transform: translateY(0); }
  40% { transform: translateY(10px); }
  100% { transform: translateY(6px) scale(0.92); background: #f0e8f8; }
}

.contrast-play.contrast-open.pole-a { animation: grow-more 0.9s ease both; }
.contrast-play.contrast-open.pole-b { animation: grow-less 0.9s ease both; }
.contrast-play.contrast-texture.pole-a { animation: heavy-sink 0.9s ease both; }
.contrast-play.contrast-texture.pole-b { animation: light-float 0.9s ease both; }
.contrast-play.contrast-wet.pole-a { animation: cool-glow 0.9s ease both; }
.contrast-play.contrast-wet.pole-b { animation: warm-glow 0.9s ease both; }
.contrast-play.contrast-time.pole-a { animation: day-bright 0.9s ease both; }
.contrast-play.contrast-time.pole-b { animation: night-dark 0.9s ease both; }
.contrast-play.contrast-clean.is-up,
.contrast-play.contrast-clean.pole-a:not(.is-down) { animation: mood-up 0.9s ease both; }
.contrast-play.contrast-clean.is-down,
.contrast-play.contrast-clean.pole-b:not(.is-up) { animation: mood-down 0.9s ease both; }

@media (prefers-reduced-motion: reduce) {
  .contrast-play,
  .try-shake {
    animation: none !important;
  }
  .reveal-card.is-more { transform: scale(1.2); }
  .reveal-card.is-less { transform: scale(0.75); }
}

/* ---------- overlays ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  background: rgba(74, 26, 99, 0.45);
}
.card {
  width: min(380px, 100%); background: var(--card);
  border-radius: 20px; padding: 22px 20px; text-align: center;
  display: flex; flex-direction: column; gap: 12px;
}
.card h2 { font-size: 22px; }
.complete-line { font-size: 16px; line-height: 1.5; }
.complete-lesson {
  font-size: 14px; line-height: 1.5; color: var(--purple-soft);
  background: var(--cream); border-radius: 12px; padding: 10px 12px;
}
.card-buttons { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.setting-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; min-height: 44px; text-align: left;
}
.setting-row input { width: 22px; height: 22px; }

/* Room to breathe on a laptop without stretching the play area. */
@media (min-width: 620px) {
  .play-area { width: min(640px, 100%); margin: 0 auto; }
}
