/* minigames.css
   Phase 2, Theme 5: mini-games. Styles for the flag-gated mini-games hub and the
   ten game screens (rune match, longship rowing, troll stack, word scramble,
   spot the difference, fjord fishing, join the stars, quiz blitz, finger maze,
   daily challenge). Child-first (large tap targets, one primary action), and
   every animation is pinned under reduce-motion so nothing essential moves for a
   motion-sensitive player; each timed game also has a stepped, tap-only path in
   the wiring. Colours reuse the existing CSS variables; nothing here is themed
   pack content. */

/* ---- shared ------------------------------------------------------------- */
.mg-status {
  margin: 0.5rem 0;
  padding: 0.35rem 0.6rem;
  border-radius: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  color: var(--gold-bright, #ffe08a);
  font-size: 1rem;
  min-height: 1.4rem;
  text-align: center;
}
.mg-status.right { color: var(--forest, #2d7a2d); }
.mg-status.wrong { color: var(--amber, #f5a623); }
.mg-best {
  text-align: center;
  color: var(--gold, #c9a84c);
  font-size: 0.9rem;
  min-height: 1.1rem;
}
.mg-result {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--gold-bright, #ffe08a);
  margin: 0.8rem 0;
}

/* ---- mini-games hub ----------------------------------------------------- */
.mg-hub-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.6rem;
  margin-top: 0.8rem;
}
.mg-hub-tile {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem 0.7rem;
  min-height: 4.5rem;
  border: 1px solid var(--gold-dim, #6b5a2a);
  border-radius: 0.7rem;
  background: rgba(10, 14, 46, 0.6);
  color: #fff;
  text-align: left;
  cursor: pointer;
}
.mg-hub-tile-label { font-weight: 700; color: var(--gold-bright, #ffe08a); }
.mg-hub-tile-sub { font-size: 0.8rem; opacity: 0.85; }

/* ---- 50. daily challenge card ------------------------------------------ */
.mg-daily-card {
  display: block;
  width: 100%;
  margin: 0.8rem 0;
  padding: 0.8rem 0.9rem;
  border: 1px solid var(--gold, #c9a84c);
  border-radius: 0.8rem;
  background: linear-gradient(120deg, rgba(201, 168, 76, 0.2), rgba(74, 144, 217, 0.18));
  color: #fff;
  text-align: left;
  cursor: pointer;
}
.mg-daily-head { font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--gold, #c9a84c); }
.mg-daily-game { font-size: 1.25rem; font-weight: 700; color: var(--gold-bright, #ffe08a); }
.mg-daily-sub { font-size: 0.8rem; opacity: 0.85; }

/* ---- 41. rune match ----------------------------------------------------- */
.mg-runematch-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(4rem, 1fr));
  gap: 0.5rem;
  margin: 0.6rem 0;
}
.mg-card {
  position: relative;
  aspect-ratio: 3 / 4;
  min-height: 64px;
  border: 2px solid var(--gold-dim, #6b5a2a);
  border-radius: 0.5rem;
  background: rgba(10, 14, 46, 0.85);
  cursor: pointer;
  padding: 0;
  overflow: hidden;
}
.mg-card-back {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  color: var(--gold, #c9a84c);
}
.mg-card-face {
  position: absolute;
  inset: 12%;
  width: 76%;
  height: 76%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.mg-card.up .mg-card-back, .mg-card.done .mg-card-back { opacity: 0; }
.mg-card.up .mg-card-face, .mg-card.done .mg-card-face { opacity: 1; }
.mg-card.done { border-color: var(--forest, #2d7a2d); background: rgba(45, 122, 45, 0.25); }

/* ---- 42. longship rowing ----------------------------------------------- */
.mg-rowing-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  justify-content: center;
  margin: 0.8rem 0;
}
.mg-rowing-dot {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  transition: transform 0.15s ease, background 0.15s ease;
}
.mg-rowing-dot.lit {
  background: var(--amber, #f5a623);
  transform: scale(1.5);
}
.mg-rowing-oar {
  display: block;
  width: 100%;
  min-height: 5rem;
  margin: 0.6rem 0;
  border: 0;
  border-radius: 0.8rem;
  background: var(--rune-red, #8b1a1a);
  color: #fff;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
}
.mg-rowing-oar:disabled { opacity: 0.5; }

/* ---- 43. troll stack ---------------------------------------------------- */
.mg-stack-tower {
  position: relative;
  height: 16rem;
  margin: 0.6rem 0;
  border-bottom: 3px solid var(--gold-dim, #6b5a2a);
  background: rgba(0, 0, 0, 0.2);
  border-radius: 0.4rem;
}
.mg-stack-block {
  position: absolute;
  height: 1.5rem;
  border-radius: 0.3rem;
  background: var(--forest, #2d7a2d);
  border: 1px solid rgba(0, 0, 0, 0.4);
}
.mg-stack-block.placed { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
.mg-stack-mover {
  position: relative;
  display: block;
  width: 100%;
  height: 3rem;
  margin: 0.4rem 0;
  border: 0;
  background: none;
  cursor: pointer;
}
.mg-stack-mover .mg-stack-block.moving {
  position: absolute;
  bottom: 0.5rem;
  background: var(--amber, #f5a623);
  transition: left 0.06s linear;
}

/* ---- 44. word scramble -------------------------------------------------- */
.mg-scramble-jumble {
  font-family: var(--font-rune, 'MedievalSharp', Georgia, serif);
  font-size: 2rem;
  letter-spacing: 0.3rem;
  text-align: center;
  color: var(--gold-bright, #ffe08a);
  margin: 0.6rem 0;
  text-transform: uppercase;
}
.mg-scramble-hint { text-align: center; opacity: 0.85; margin-bottom: 0.5rem; }
.mg-scramble-progress { text-align: center; font-size: 0.85rem; opacity: 0.8; }

/* ---- 45. spot the difference ------------------------------------------- */
.mg-spot-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.5rem 0;
}
.mg-spot-frame {
  position: relative;
  aspect-ratio: 3 / 4;
  border: 1px solid var(--gold-dim, #6b5a2a);
  border-radius: 0.5rem;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
}
.mg-spot-frame:last-child { cursor: crosshair; }
.mg-spot-img { width: 100%; height: 100%; object-fit: cover; }
.mg-spot-mark {
  position: absolute;
  width: 2.2rem;
  height: 2.2rem;
  transform: translate(-50%, -50%);
  border: 3px solid var(--amber, #f5a623);
  border-radius: 50%;
  pointer-events: none;
}

/* ---- 46. fjord fishing -------------------------------------------------- */
.mg-fishing-pond {
  position: relative;
  height: 18rem;
  margin: 0.6rem 0;
  border-radius: 0.6rem;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(74, 144, 217, 0.4), rgba(10, 14, 46, 0.8));
  cursor: pointer;
}
.mg-fish {
  position: absolute;
  width: 3rem;
  height: 3rem;
  transform: translate(-50%, -50%);
  border-radius: 50% 50% 50% 0;
  background: var(--sky, #4a90d9);
  border: 0;
  min-width: 44px;
  min-height: 44px;
  cursor: pointer;
  color: transparent;
}
.mg-fish.kind-herring { background: #9ec7e8; }
.mg-fish.kind-cod { background: var(--sky, #4a90d9); width: 3.4rem; height: 3.4rem; }
.mg-fish.kind-salmon { background: #e8896b; width: 2.7rem; height: 2.7rem; }
.mg-fish-skip { position: absolute; bottom: 0.4rem; left: 50%; transform: translateX(-50%); }

/* ---- 47. join the stars ------------------------------------------------- */
.mg-constellation-stage { margin: 0.6rem 0; }
.mg-sky {
  position: relative;
  height: 18rem;
  border-radius: 0.6rem;
  background: radial-gradient(circle at 50% 30%, rgba(74, 144, 217, 0.2), rgba(6, 8, 15, 0.95));
  border: 1px solid var(--gold-dim, #6b5a2a);
}
.mg-star {
  position: absolute;
  width: 2.4rem;
  height: 2.4rem;
  min-width: 44px;
  min-height: 44px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid var(--gold, #c9a84c);
  background: rgba(255, 224, 138, 0.25);
  color: var(--gold-bright, #ffe08a);
  font-weight: 700;
  cursor: pointer;
}
.mg-star.picked { background: var(--amber, #f5a623); color: #06080f; }

/* ---- 48. quiz blitz ----------------------------------------------------- */
.mg-blitz-timer {
  text-align: center;
  font-weight: 700;
  color: var(--amber, #f5a623);
  min-height: 1.3rem;
}
.mg-blitz-progress { text-align: center; font-size: 0.85rem; opacity: 0.8; }
.mg-blitz-q { font-size: 1.2rem; font-weight: 700; text-align: center; margin: 0.6rem 0; color: var(--gold-bright, #ffe08a); }
.mg-blitz-opts { display: grid; gap: 0.5rem; }
.mg-blitz-opt, .mg-scramble + button {
  min-height: 3rem;
}
.mg-blitz-opt {
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--gold-dim, #6b5a2a);
  border-radius: 0.6rem;
  background: rgba(10, 14, 46, 0.6);
  color: #fff;
  font-size: 1.05rem;
  cursor: pointer;
}

/* ---- 49. finger maze ---------------------------------------------------- */
.mg-maze-grid {
  display: grid;
  gap: 0;
  margin: 0.6rem auto;
  max-width: 22rem;
  aspect-ratio: 1 / 1;
}
.mg-maze-cell {
  position: relative;
  border: 2px solid transparent;
  background: rgba(10, 14, 46, 0.4);
  cursor: pointer;
  min-width: 0;
  min-height: 0;
  padding: 0;
}
.mg-maze-cell.on-path { background: rgba(245, 166, 35, 0.4); }
.mg-maze-cell.start { background: rgba(45, 122, 45, 0.5); }
.mg-maze-cell.exit::after {
  content: '';
  position: absolute;
  inset: 25%;
  border-radius: 50%;
  background: var(--gold-bright, #ffe08a);
}

/* ---- reduce-motion: pin every transition; the wiring uses stepped paths -- */
body.reduce-motion .mg-card-face,
body.reduce-motion .mg-rowing-dot,
body.reduce-motion .mg-stack-block.moving {
  transition: none;
}
@media (prefers-reduced-motion: reduce) {
  .mg-card-face,
  .mg-rowing-dot,
  .mg-stack-block.moving {
    transition: none;
  }
}
