/* ==========================================================================
   NUMBER ROCKET
   Everything is drawn with CSS and emoji, like the other children's games:
   no image files, so nothing extra to download and it all works offline.
   The cream page, buttons and settings come from kids-common.css; this file
   adds the night sky, the answer stars, the rocket and the sticker book.
   ========================================================================= */

/* ===================== Menu ===================== */

.rocket-hero {
  display: inline-block;
  animation: rocket-hover 2.4s ease-in-out infinite;
}

@keyframes rocket-hover {
  0%, 100% { transform: translateY(0) rotate(-45deg); }
  50% { transform: translateY(-7px) rotate(-45deg); }
}

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

.topic-btn {
  border: none;
  border-radius: 18px;
  padding: 12px 8px;
  min-height: 104px;
  color: #fff;
  font-family: inherit;
  font-weight: 900;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.18);
}

.topic-btn:active {
  transform: translateY(2px) scale(0.97);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.topic-emoji {
  font-size: 2rem;
  line-height: 1.1;
}

.topic-age {
  font-size: 0.75rem;
  font-weight: 800;
  opacity: 0.92;
}

.topic-bonds { background: #1d9e75; }
.topic-doubles { background: #d9534a; }
.topic-halves { background: #e07c1f; }
.topic-times { background: #3f6fd9; }
.topic-division { background: #7a4fc9; }
.topic-squares { background: #23899f; }

/* ===================== Choices ===================== */

.seg {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.seg-btn {
  flex: 1;
  border: 3px solid var(--kids-border);
  background: var(--kids-card);
  border-radius: 14px;
  padding: 8px 6px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 900;
  color: #8a86b8;
  cursor: pointer;
  line-height: 1.2;
}

.seg-btn small {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  opacity: 0.85;
}

.seg-btn.on {
  border-color: var(--kids-lilac);
  background: #eeecff;
  color: var(--kids-ink-soft);
}

.choice-heading {
  text-align: left;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--kids-ink-soft);
  margin: 14px 4px 6px;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.choice-list.tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.choice-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 2px solid var(--kids-border);
  border-radius: 14px;
  background: var(--kids-card);
  padding: 10px 14px;
  font-family: inherit;
  color: var(--kids-ink);
  text-align: left;
  cursor: pointer;
}

.choice-btn:active {
  transform: scale(0.98);
  background: #f6f4ff;
}

.choice-text {
  flex: 1;
  min-width: 0;
}

.choice-name {
  display: block;
  font-size: 1rem;
  font-weight: 900;
}

.choice-note {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--kids-muted);
}

.choice-best {
  font-weight: 900;
  font-size: 0.95rem;
  color: var(--kids-amber);
  white-space: nowrap;
}

.tiles .choice-btn {
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-height: 64px;
  padding: 8px 2px;
  text-align: center;
}

.tiles .choice-text {
  flex: none;
}

.tiles .choice-name {
  font-size: 1.3rem;
}

.tiles .choice-best {
  font-size: 0.78rem;
  min-height: 1em;
}

/* ===================== Play: fuel, streak and trip ===================== */

#scr-play {
  padding: 10px 4px;
}

#scr-play .top-bar {
  margin-bottom: 8px;
}

/* One line, so the sky never jumps down on a narrow phone. The full name is
   on the end-of-round screen. */
#scr-play .top-bar h2 {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  margin-bottom: 6px;
}

.fuel {
  flex: 1;
  position: relative;
  height: 26px;
  border-radius: 13px;
  background: #e8e4f6;
  overflow: hidden;
}

.fuel-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  border-radius: 13px;
  background: linear-gradient(90deg, #f5a800, #ffd84d);
}

.fuel.low .fuel-fill {
  background: linear-gradient(90deg, #d94a3d, #ff7a59);
  animation: fuel-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes fuel-pulse {
  to { opacity: 0.65; }
}

.fuel-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 900;
  color: var(--kids-ink);
  font-variant-numeric: tabular-nums;
}

.finish-btn {
  flex: 1;
  background: var(--kids-lilac-pale);
  color: var(--kids-ink-soft);
  border: none;
  border-radius: 12px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 900;
  cursor: pointer;
}

.streak {
  min-width: 58px;
  text-align: right;
  font-weight: 900;
  font-size: 1rem;
  color: #e0573b;
}

.trip {
  position: relative;
  height: 32px;
  margin: 0 16px 6px;
}

.trip-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
  background: repeating-linear-gradient(90deg, #cfc9ef 0 6px, transparent 6px 10px);
}

.trip-planet {
  position: absolute;
  top: 50%;
  font-size: 1.1rem;
  line-height: 1;
  transform: translate(-50%, -50%);
  filter: grayscale(1);
  opacity: 0.5;
  transition: transform 0.3s, opacity 0.3s, filter 0.3s;
}

.trip-planet.passed {
  filter: none;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.2);
}

.trip-rocket {
  position: absolute;
  top: 50%;
  z-index: 1;
  font-size: 1.5rem;
  line-height: 1;
  transform: translate(-50%, -50%) rotate(45deg);
  filter: drop-shadow(0 2px 2px rgba(40, 30, 90, 0.35));
  transition: left 0.35s ease-out;
}

/* ===================== Play: the sky ===================== */

.sky {
  position: relative;
  flex-shrink: 0;
  height: clamp(232px, 46vh, 400px);
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(180deg, #0a1238 0%, #1b1a5c 62%, #3a2a78 100%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.07);
  touch-action: manipulation;
}

/* Two layers of little dots that slide down as the rocket climbs, the far
   layer more slowly, so it feels like flying up through them. */
.field {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: background-position 0.45s ease-out;
}

.field.near {
  background-image:
    radial-gradient(1.6px 1.6px at 22px 30px, #fff 60%, transparent 70%),
    radial-gradient(1.2px 1.2px at 96px 64px, #fff 60%, transparent 70%),
    radial-gradient(1.8px 1.8px at 132px 18px, #fff7c2 60%, transparent 70%),
    radial-gradient(1.2px 1.2px at 58px 112px, #fff 60%, transparent 70%),
    radial-gradient(1.4px 1.4px at 118px 128px, #d9f2ff 60%, transparent 70%);
  background-size: 150px 150px;
}

.field.far {
  opacity: 0.6;
  background-image:
    radial-gradient(1px 1px at 12px 12px, #fff 60%, transparent 70%),
    radial-gradient(1px 1px at 52px 44px, #fff 60%, transparent 70%),
    radial-gradient(1px 1px at 80px 8px, #fff 60%, transparent 70%),
    radial-gradient(1px 1px at 30px 76px, #fff 60%, transparent 70%);
  background-size: 92px 92px;
}

/* ===================== Answer stars =====================
   Six fixed places in two gentle arcs over the rocket. The places never move
   between questions, so a quick finger is not chasing a button. */

.star {
  position: absolute;
  z-index: 2;
  width: 86px;
  height: 86px;
  margin: -43px 0 0 -43px;
  padding: 0;
  border: none;
  background: none;
  font-family: inherit;
  cursor: pointer;
}

.star[disabled] {
  cursor: default;
}

.slot-0 { left: 18%; top: 21%; }
.slot-1 { left: 50%; top: 15%; }
.slot-2 { left: 82%; top: 21%; }
.slot-3 { left: 18%; top: 56%; }
.slot-4 { left: 50%; top: 50%; }
.slot-5 { left: 82%; top: 56%; }

.star-body {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 0 6px rgba(255, 214, 90, 0.75));
  animation: star-bob 2.8s ease-in-out infinite;
}

.slot-1 .star-body { animation-duration: 3.1s; animation-delay: -0.6s; }
.slot-2 .star-body { animation-duration: 2.6s; animation-delay: -1.3s; }
.slot-3 .star-body { animation-duration: 3.3s; animation-delay: -0.9s; }
.slot-4 .star-body { animation-duration: 2.9s; animation-delay: -1.8s; }
.slot-5 .star-body { animation-duration: 3s; animation-delay: -0.3s; }

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

/* A chubby five-pointed star, so a three- or four-digit answer still fits
   across its middle. */
.star-body::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 40% 36%, #fffbe0 0%, #ffe066 45%, #f2b100 100%);
  clip-path: polygon(50% 0%, 67.6% 25.7%, 97.6% 34.5%, 78.5% 59.3%, 79.4% 90.5%,
                     50% 80%, 20.6% 90.5%, 21.5% 59.3%, 2.4% 34.5%, 32.4% 25.7%);
}

.star-label {
  position: relative;
  margin-top: 6px;
  font-size: 1.55rem;
  font-weight: 900;
  color: #5a3900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.star.mid .star-label { font-size: 1.3rem; }
.star.long .star-label { font-size: 1.08rem; }

/* Find the question: the options are sums like "12 × 12", too wide for a
   star, so they ride on little comets instead. */
.star.capsule {
  width: 92px;
  height: 58px;
  margin: -29px 0 0 -46px;
}

.star.capsule .star-body::before {
  clip-path: none;
  border-radius: 29px;
  background: radial-gradient(ellipse at 40% 30%, #fffbe0 0%, #ffe066 50%, #f2b100 100%);
}

.star.capsule .star-body::after {
  content: "";
  position: absolute;
  right: 92%;
  top: 28%;
  width: 26px;
  height: 44%;
  border-radius: 50%;
  background: linear-gradient(270deg, rgba(255, 224, 102, 0.7), rgba(255, 224, 102, 0));
}

.star.capsule .star-label {
  margin-top: 0;
  font-size: 1.05rem;
}

.star.appear {
  animation: star-appear 0.22s ease-out;
}

@keyframes star-appear {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.star.zapped {
  animation: star-zap 0.3s ease-out forwards;
}

@keyframes star-zap {
  to { transform: scale(1.6); opacity: 0; }
}

.star.wrong {
  animation: kids-shake 0.4s;
}

.star.wrong .star-body {
  filter: drop-shadow(0 0 6px rgba(255, 110, 90, 0.8));
}

.star.wrong .star-body::before {
  background: radial-gradient(circle at 40% 36%, #ffe1dc 0%, #f27f72 50%, #d94a3d 100%);
}

.star.show-right {
  animation: star-glow 0.45s ease-in-out 2 alternate;
}

.star.show-right .star-body {
  filter: drop-shadow(0 0 12px rgba(110, 255, 180, 0.95));
}

.star.show-right .star-body::before {
  background: radial-gradient(circle at 40% 36%, #eafff4 0%, #74e3a9 50%, #1d9e75 100%);
}

.star.show-right .star-label {
  color: #063d2a;
}

@keyframes star-glow {
  to { transform: scale(1.15); }
}

/* ===================== The rocket ===================== */

.rocket {
  position: absolute;
  left: 50%;
  bottom: 6px;
  z-index: 1;
  width: 60px;
  height: 72px;
  margin-left: -30px;
  pointer-events: none;
}

/* The emoji points up and to the right; turned a quarter back it points up. */
.rocket-body {
  position: absolute;
  left: 50%;
  top: 0;
  font-size: 46px;
  line-height: 1;
  transform: translateX(-50%) rotate(-45deg);
}

.flame {
  position: absolute;
  left: 50%;
  top: 46px;
  width: 16px;
  height: 22px;
  margin-left: -8px;
  border-radius: 50% 50% 50% 50% / 30% 30% 70% 70%;
  background: radial-gradient(ellipse at 50% 0%, #fff7b0 0%, #ffb02e 45%, rgba(255, 80, 40, 0) 75%);
  transform-origin: 50% 0;
  animation: flame-flicker 0.12s ease-in-out infinite alternate;
}

@keyframes flame-flicker {
  from { transform: scaleY(0.85); }
  to { transform: scaleY(1.1); }
}

.rocket.turbo .flame {
  width: 22px;
  height: 38px;
  margin-left: -11px;
  background: radial-gradient(ellipse at 50% 0%, #ffffff 0%, #8ee8ff 35%, #3d7bff 62%, rgba(60, 90, 255, 0) 82%);
}

.rocket.boost {
  animation: rocket-boost 0.35s ease-out;
}

@keyframes rocket-boost {
  40% { transform: translateY(-14px); }
  100% { transform: translateY(0); }
}

/* ===================== Effects ===================== */

.laser {
  position: absolute;
  z-index: 1;
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
  transform-origin: 0 50%;
  background: linear-gradient(90deg, rgba(120, 255, 240, 0.25), #9ffcff 40%, #ffffff);
  box-shadow: 0 0 8px #7ff;
  pointer-events: none;
  animation: laser-fade 0.3s ease-out forwards;
}

@keyframes laser-fade {
  to { opacity: 0; }
}

.plus {
  position: absolute;
  z-index: 3;
  font-size: 1.25rem;
  font-weight: 900;
  color: #fff59d;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: plus-up 0.7s ease-out forwards;
}

@keyframes plus-up {
  from { transform: translate(-50%, -50%); opacity: 1; }
  to { transform: translate(-50%, -170%); opacity: 0; }
}

.flyby {
  position: absolute;
  top: -80px;
  z-index: 0;
  font-size: 66px;
  line-height: 1;
  pointer-events: none;
  animation: flyby 2.6s linear forwards;
}

@keyframes flyby {
  to { top: 110%; }
}

.countdown {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(10, 18, 56, 0.35);
}

.countdown.on {
  display: flex;
}

.count-n {
  font-size: 5rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 4px 0 rgba(0, 0, 0, 0.35);
  animation: count-pop 0.8s ease-out;
}

.countdown.go .count-n {
  font-size: 2.6rem;
  color: #ffe066;
}

@keyframes count-pop {
  from { transform: scale(1.8); opacity: 0; }
  30% { transform: scale(1); opacity: 1; }
}

/* ===================== The console ===================== */

.console {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 360px;
  min-height: 78px;
  margin: -12px auto 0;
  padding: 10px 14px 8px;
  border-radius: 18px;
  background: linear-gradient(180deg, #2f2b74, #1d1a4e);
  box-shadow: 0 4px 0 #120f38, inset 0 0 0 3px #4b45a8;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.console-q {
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1.15;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.console-q.long {
  font-size: 1.7rem;
}

.console-hint {
  min-height: 1.1em;
  font-size: 0.9rem;
  font-weight: 800;
  color: #bcb6ff;
}

#scr-play .feedback {
  min-height: 34px;
  margin: 6px 0 2px;
}

/* ===================== End of a round ===================== */

.scr-done {
  align-items: center;
  text-align: center;
  gap: 8px;
}

.scr-done .top-bar {
  width: 100%;
}

.done-emoji {
  font-size: 4.4rem;
  line-height: 1.1;
  animation: done-float 2.4s ease-in-out infinite;
}

@keyframes done-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.done-title {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--kids-ink);
}

.done-what {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--kids-ink-soft);
}

.done-score {
  font-size: 1.35rem;
  font-weight: 900;
  color: var(--kids-amber);
}

.done-detail,
.done-medal {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--kids-muted);
}

.done-medal {
  font-weight: 900;
  color: var(--kids-ink-soft);
}

.done-stickers {
  padding: 8px 14px;
  border-radius: 14px;
  background: var(--kids-amber-pale);
  font-weight: 800;
  color: #7a4c0a;
}

.done-medal:empty,
.done-stickers:empty {
  display: none;
}

.scr-done .big-btn {
  margin-top: 4px;
}

/* ===================== Sticker book and flight log ===================== */

.sticker-lead {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--kids-muted);
  margin-bottom: 10px;
  text-align: center;
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.sticker {
  min-height: 92px;
  padding: 8px 4px;
  border-radius: 16px;
  background: linear-gradient(180deg, #1b1a5c, #0a1238);
  box-shadow: inset 0 0 0 3px #4b45a8;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-align: center;
}

.sticker .s-emoji {
  font-size: 2rem;
  line-height: 1.1;
}

.sticker.locked .s-emoji {
  filter: grayscale(1) brightness(0.55);
  opacity: 0.5;
}

.sticker.got {
  box-shadow: inset 0 0 0 3px #ffd84d;
}

.sticker .s-name {
  font-size: 0.78rem;
  font-weight: 900;
}

.sticker .s-note {
  font-size: 0.64rem;
  font-weight: 700;
  opacity: 0.75;
}

.log-title {
  text-align: left;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--kids-ink);
  margin: 0 2px 8px;
}

.log-empty {
  color: var(--kids-muted);
  font-weight: 700;
}

.log-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 2px solid var(--kids-border);
  border-radius: 12px;
  background: var(--kids-card);
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--kids-ink);
  text-align: left;
}

.log-date {
  min-width: 48px;
  font-size: 0.76rem;
  color: var(--kids-muted);
}

.log-what {
  flex: 1;
  min-width: 0;
}

.log-score {
  white-space: nowrap;
  color: var(--kids-amber);
}

/* ===================== Small phones ===================== */

@media (max-width: 360px) {
  .star {
    width: 76px;
    height: 76px;
    margin: -38px 0 0 -38px;
  }

  .star-label { font-size: 1.35rem; }
  .star.mid .star-label { font-size: 1.15rem; }
  .star.long .star-label { font-size: 0.95rem; }

  .star.capsule {
    width: 84px;
    margin-left: -42px;
  }

  .star.capsule .star-label { font-size: 0.95rem; }

  .console-q { font-size: 1.9rem; }
  .console-q.long { font-size: 1.5rem; }

  .tiles .choice-name { font-size: 1.15rem; }

  /* The arrow alone, so the name of the round has room. */
  #scr-play .back-word { display: none; }
}

/* ===================== Less movement ===================== */

@media (prefers-reduced-motion: reduce) {
  .rocket-hero,
  .star-body,
  .flame,
  .done-emoji,
  .fuel.low .fuel-fill {
    animation: none;
  }

  .rocket-hero {
    transform: rotate(-45deg);
  }

  .flyby {
    display: none;
  }

  .field {
    transition: none;
  }
}
