/* ============ Home ============ */
#screen-home {
  justify-content: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}
.game-title {
  margin: 0;
  font-size: clamp(2.2rem, 7vw, 4rem);
  line-height: 1.1;
  color: var(--tomato);
  text-shadow: 3px 3px 0 #ffd9a8;
}
.tagline {
  margin: 0 0 12px;
  font-size: clamp(1rem, 3vw, 1.4rem);
}
#home-mascot svg { width: min(46vw, 220px); height: auto; }

/* Language switcher pills (home screen). */
#lang-switch { display: flex; gap: 10px; justify-content: center; }
.lang-btn {
  font: inherit;
  font-size: clamp(1rem, 2.6vw, 1.2rem);
  font-weight: 700;
  color: var(--ink);
  background: #fff;
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  min-height: 44px;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(74, 47, 27, 0.28);
}
.lang-btn.active { background: var(--tomato); color: #fff; box-shadow: 0 3px 0 var(--tomato-dark); }

/* ============ Level map ============ */
#screen-map { justify-content: center; gap: 28px; padding-top: 70px; }
#level-list {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(20px, 6vw, 60px);
  justify-content: center;
  padding: 0 16px;
}
.plate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
}
.plate-disc {
  width: min(42vw, 230px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 10px #f3e3c8, 0 8px 0 rgba(74, 47, 27, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}
.plate:active .plate-disc { transform: scale(0.95); }
.plate svg.pizza { width: 78%; height: auto; }
.plate-label {
  font-size: clamp(1.1rem, 3.6vw, 1.5rem);
  font-weight: 700;
  background: #fff;
  padding: 8px 20px;
  border-radius: 16px;
  box-shadow: 0 4px 0 rgba(74, 47, 27, 0.18);
}
.plate-stars {
  font-size: 1.3rem;
  letter-spacing: 4px;
  color: var(--cheese-deep);
  min-height: 1.4em;
}

/* ============ Play screen ============ */
#screen-play {
  justify-content: space-between;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
#stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 3vw, 40px);
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
}
#mascot-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
#play-mascot svg { width: min(34vw, 200px); height: auto; }
/* The pizza is the tap surface — keep it as big as the stage allows. */
#pizza-area svg.pizza {
  width: min(78vw, 540px); /* fallback for browsers without dvh */
  width: min(78vw, calc(100dvh - 230px), 540px);
  height: auto;
}

/* Portrait & narrow screens (phones, portrait tablets): stack mascot over pizza. */
@media (max-width: 900px) {
  #stage { flex-direction: column; gap: 6px; }
  #play-mascot svg { width: min(30vw, 120px); }
  #pizza-area svg.pizza { width: min(88vw, 460px); }
}

/* ============ Controls ============ */
#controls {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(10px, 2.5vw, 20px);
  justify-content: center;
  align-items: center;
  padding: 8px 0 4px;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
}
.cut-btn {
  font: inherit;
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 800;
  width: clamp(64px, 16vw, 88px);
  min-height: 64px;
  border-radius: 20px;
  border: none;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(74, 47, 27, 0.28);
}
.cut-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(74, 47, 27, 0.28); }

.yesno { display: flex; gap: 18px; }
.yesno .big-btn { min-width: 140px; font-size: clamp(1.2rem, 4vw, 1.6rem); }

.opt-card {
  font: inherit;
  width: clamp(84px, 22vw, 120px);
  min-height: 96px;
  border-radius: 20px;
  border: none;
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 5px 0 rgba(74, 47, 27, 0.28);
}
.opt-card:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(74, 47, 27, 0.28); }

/* L3 "Make it!": the target fraction card (pizza is the answer surface). */
.target-card {
  background: #fff;
  border-radius: 20px;
  padding: 8px 24px;
  box-shadow: 0 5px 0 rgba(74, 47, 27, 0.28);
}
.target-card .frac { font-size: clamp(2rem, 7vw, 2.8rem); }

/* "Put it in the oven!" — the commit button that checks the pizza (L3). */
.bake-btn {
  font: inherit;
  font-size: clamp(1.1rem, 4vw, 1.5rem);
  font-weight: 800;
  min-width: clamp(150px, 36vw, 230px);
  min-height: 64px;
  border-radius: 20px;
  border: none;
  background: var(--tomato);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(74, 47, 27, 0.28);
}
.bake-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(74, 47, 27, 0.28); }

/* Fraction number: red numerator over green denominator (consistent color-coding). */
.frac {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.05;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  font-weight: 800;
}
.frac .top { color: #d94f31; }
.frac .bar { width: 1.6em; height: 4px; background: var(--ink); border-radius: 2px; margin: 2px 0; }
.frac .bot { color: #35855c; }

/* Word form under each L2 answer card: symbol by eye, name by ear. */
.opt-words {
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(74, 47, 27, 0.65);
  text-align: center;
}

/* Progress dots */
#progress-dots { display: flex; gap: 8px; margin-top: 6px; }
.dot { width: 14px; height: 14px; border-radius: 50%; background: #e8d5b5; }
.dot.done { background: var(--cheese); box-shadow: 0 0 0 3px #ffe29a; }

/* ============ Complete overlay ============ */
#overlay {
  position: fixed;
  inset: 0;
  background: rgba(74, 47, 27, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}
#overlay.hidden { display: none; }
.overlay-card {
  background: var(--paper);
  border-radius: 28px;
  padding: 32px 40px;
  text-align: center;
  max-width: min(90vw, 440px);
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.18);
  animation: card-pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes card-pop { from { transform: scale(0.6); opacity: 0; } }
.overlay-card h2 {
  margin: 0 0 8px;
  color: var(--tomato);
  font-size: clamp(1.6rem, 6vw, 2.2rem);
}
#stars {
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  letter-spacing: 8px;
  margin: 8px 0 16px;
  min-height: 1.2em;
}
.star { color: #e8d5b5; display: inline-block; animation: star-pop 0.5s backwards; }
.star.on { color: var(--cheese); text-shadow: 2px 2px 0 #f0c26a; }
.star:nth-child(2) { animation-delay: 0.15s; }
.star:nth-child(3) { animation-delay: 0.3s; }
@keyframes star-pop {
  from { transform: scale(0); }
  70% { transform: scale(1.3); }
}
.overlay-btns { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ============ Confetti canvas ============ */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 50; }
