/* ============ Splash ============ */
.splash {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  cursor: pointer;
  text-align: center;
  min-height: 78dvh;
}

.splash__glow {
  position: relative;
  display: grid;
  place-items: center;
}
.splash__glow::before {
  content: "";
  position: absolute;
  width: min(320px, 82vw);
  height: min(320px, 82vw);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .95), rgba(255, 255, 255, 0) 68%);
  animation: halo 3.2s ease-in-out infinite;
}
@keyframes halo {
  0%, 100% { transform: scale(1); opacity: .85; }
  50% { transform: scale(1.12); opacity: 1; }
}

/* Static rainbow ring — it pops in, then just breathes gently. */
.splash__ring {
  position: relative;
  border-radius: 50%;
  padding: 9px;
  background: conic-gradient(from 210deg, var(--sun), var(--pink), var(--grape), var(--blue), var(--mint), var(--sun));
  box-shadow: 0 18px 36px rgba(42, 53, 87, .32);
  animation: pop .7s var(--bounce) both, float-y 3.6s ease-in-out .7s infinite;
}

.splash__welcome {
  font-size: clamp(1.9rem, 8.5vw, 2.7rem);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 3px 0 var(--blue-deep), 0 8px 18px rgba(42, 53, 87, .35);
  animation: welcome-in .55s var(--bounce) .3s both;
}
@keyframes welcome-in {
  from { opacity: 0; transform: translateY(16px) scale(.9); }
}
.splash__heart {
  display: inline-block;
  /* No text-shadow on the emoji — it muddies the glyph. */
  text-shadow: none;
  animation: heartbeat 1.6s ease-in-out infinite;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  15% { transform: scale(1.22); }
  30% { transform: scale(1); }
  45% { transform: scale(1.15); }
  60% { transform: scale(1); }
}

.splash__hint {
  font-size: .95rem;
  font-weight: 500;
  color: var(--ink);
  background: rgba(255, 255, 255, .7);
  padding: 5px 16px;
  border-radius: var(--r-pill);
  animation: fade-in .8s ease 1.3s both;
}

/* ============ Home ============ */
.home__hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
  padding: 8px 0 4px;
}
.home__mascot {
  cursor: pointer;
  animation: float-y 3s ease-in-out infinite;
}
.home__title {
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: #fff;
  text-shadow: 0 3px 0 var(--blue-deep), 0 6px 14px rgba(42, 53, 87, .3);
}
.home__tagline {
  font-size: 1rem;
  font-weight: 500;
  color: var(--ink);
  background: rgba(255, 255, 255, .7);
  padding: 4px 14px;
  border-radius: var(--r-pill);
}

.home__sections {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 400px) {
  .home__sections { grid-template-columns: 1fr; }
}

.statstrip {
  display: flex;
  gap: 10px;
}
.statstrip__item {
  flex: 1;
  background: rgba(255, 255, 255, .9);
  border-radius: var(--r-md);
  padding: 10px 6px;
  text-align: center;
  box-shadow: var(--lift-1);
}
.statstrip__value {
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.statstrip__label { font-size: .74rem; color: var(--ink-soft); }

/* ============ Menus ============ */
.menu-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  text-align: center;
}
.menu-head__emoji { font-size: 2.8rem; animation: wiggle 3.5s ease-in-out infinite; }
.menu-head__title { font-size: 1.75rem; font-weight: 700; }
.menu-head__sub { color: var(--ink); opacity: .75; font-size: .95rem; }

.menu-list { display: grid; gap: 12px; }

.level-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .74rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  background: var(--paper-tint);
  color: var(--ink-soft);
  margin-top: 5px;
}

/* ============ Play screen (shared game chrome) ============ */
.play {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.play__question {
  background: var(--paper);
  border-radius: var(--r-xl);
  padding: 26px 18px;
  text-align: center;
  box-shadow: var(--lift-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: q-in .35s var(--bounce) both;
}
@keyframes q-in {
  from { opacity: 0; transform: scale(.9) translateY(10px); }
}

.play__prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .16em;
  font-size: clamp(2.2rem, 11vw, 3.4rem);
  font-weight: 700;
  letter-spacing: .02em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.play__prompt .op { color: var(--grape); padding: 0 .08em; }
.play__prompt .blank {
  display: inline-block;
  min-width: 1.4em;
  border-bottom: 6px solid var(--sun);
  color: var(--sun-deep);
}
.play__instruction {
  font-size: .95rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.play__footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ============ Counting ============ */
.count-grid {
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr));
  gap: 6px 4px;
  justify-items: center;
  width: 100%;
  padding: 2px 0;
}
.count-obj {
  /* Sized off the grid's own width so 20 objects still fit a phone.
     The plain value first is the fallback if container units are missing. */
  font-size: 2rem;
  font-size: min(3.2rem, calc(62cqw / var(--cols, 5)));
  line-height: 1.1;
  animation: obj-in .32s var(--bounce) both;
}
@keyframes obj-in {
  from { opacity: 0; transform: scale(.4); }
}
@media (prefers-reduced-motion: reduce) {
  .count-obj { animation: none; }
}

/* ============ Results ============ */
.results {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  text-align: center;
  padding-top: 10px;
}
.results__emoji { font-size: 5rem; animation: pop .6s var(--bounce) both; }
.results__title { font-size: 2rem; font-weight: 700; }
.results__sub { color: var(--ink-soft); }

.results__score {
  display: flex;
  gap: 12px;
  width: 100%;
}
.results__cell {
  flex: 1;
  background: var(--paper);
  border-radius: var(--r-lg);
  padding: 14px 8px;
  box-shadow: var(--lift-1);
}
.results__cell-value {
  font-size: 1.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.results__cell-label { font-size: .78rem; color: var(--ink-soft); }

.results__stars {
  font-size: 2.2rem;
  letter-spacing: .1em;
  min-height: 2.6rem;
}
.results__stars span {
  display: inline-block;
  animation: pop .5s var(--bounce) both;
}

.results__actions {
  margin-top: auto;
  display: grid;
  gap: 12px;
  width: 100%;
}

.badge-new {
  display: inline-block;
  background: var(--sun);
  color: var(--ink);
  font-size: .78rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: var(--r-pill);
  box-shadow: var(--lift-1);
  animation: wiggle 1.6s ease-in-out infinite;
}
