/* Kids' mini games. Loaded by games.html and the pages in games/, on top of
   styles.css and resources.css (which supplies the pond colors and cards). */

.game [hidden] {
  display: none !important;
}

.game {
  text-align: center;
}

main.page .game h1 {
  font-size: clamp(1.75rem, 6vw, 2.5rem);
  line-height: 1.15;
  margin: 0 0 6px;
}

main.page .game .game-lead {
  font-size: 1.0625rem;
  margin: 0 0 20px;
}

.game-board {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px 16px 24px;
}

.game-status {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--text-subtle);
  font-weight: 700;
  font-size: 0.9375rem;
  margin-bottom: 14px;
}

.game-levels {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.game button {
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.game button:disabled {
  cursor: default;
  opacity: 0.55;
}

.game-levels button {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--field-border);
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}

.game-levels button[aria-pressed='true'] {
  background: var(--action);
  border-color: var(--action);
  color: var(--action-text);
}

.game .button {
  border: 0;
  min-height: 48px;
  margin: 0;
}

.game .button.secondary {
  border: 1px solid var(--field-border);
}

.game-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

/* The thing being bought or sorted, floating on the water */
.game-item {
  background:
    radial-gradient(ellipse 34% 24% at 50% 72%, transparent 86%, var(--ripple) 89% 93%, transparent 96%),
    radial-gradient(ellipse 50% 38% at 50% 72%, transparent 90%, var(--ripple) 92% 94.5%, transparent 97%),
    linear-gradient(180deg, var(--water-top), var(--water-bottom));
  border-radius: 20px;
  padding: 18px 12px 20px;
}

.game-picture {
  display: block;
  font-size: 4.5rem;
  line-height: 1.2;
}

main.page .game .game-name {
  color: var(--text);
  font-size: 1.375rem;
  font-weight: 800;
  line-height: 1.3;
  margin: 6px 0 0;
}

.price-tag {
  display: inline-block;
  background: var(--sun);
  color: var(--reed);
  font-weight: 800;
  font-size: 1.5rem;
  border-radius: 999px;
  padding: 2px 20px;
  margin-top: 10px;
}

main.page .game .game-message {
  color: var(--text);
  font-size: 1.125rem;
  font-weight: 700;
  min-height: 3.2em;
  margin: 14px 0 0;
}

/* ---- Count the Coins ---- */

.coin-tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 8px;
  min-height: 96px;
  margin-top: 14px;
  padding: 12px;
  border: 2px dashed var(--field-border);
  border-radius: 20px;
}

main.page .game .tray-empty {
  color: var(--text-subtle);
  margin: 0;
}

.tray-total {
  font-weight: 800;
  font-size: 1.25rem;
  margin-top: 10px;
}

.coin-bank {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.coin {
  --size: 76px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--size);
  height: var(--size);
  padding: 0;
  border-radius: 50%;
  color: #1d2f27;
  font-weight: 800;
  border: 4px solid;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55), 0 4px 0 rgba(20, 43, 40, 0.25);
}

.game .coin {
  font-size: 1.25rem;
  font-weight: 800;
}

/* Copper penny, silver nickel, dime and quarter, sized like the real ones */
.coin-1 {
  --size: 68px;
  background: #e0a479;
  border-color: #b4744a;
}

.coin-5 {
  --size: 74px;
  background: #d5dad8;
  border-color: #9aa39f;
}

.coin-10 {
  --size: 62px;
  background: #e3e8ea;
  border-color: #8f9ca1;
}

.coin-25 {
  --size: 84px;
  background: #f1d58c;
  border-color: #c3973c;
}

.coin-tray .coin {
  --size: 54px;
}

.game .coin-tray .coin {
  font-size: 1rem;
}

/* Four coins in one row, and less scrolling to reach Pay, on a phone */
@media (max-width: 520px) {
  .game-picture {
    font-size: 3.25rem;
  }

  .game-item {
    padding: 10px 12px 12px;
  }

  .coin-bank {
    gap: 10px;
  }

  .coin-bank .coin-1 {
    --size: 62px;
  }

  .coin-bank .coin-5 {
    --size: 68px;
  }

  .coin-bank .coin-10 {
    --size: 56px;
  }

  .coin-bank .coin-25 {
    --size: 76px;
  }
}

/* ---- Need or Want? ---- */

.pad-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 6px;
}

.game .pad-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 104px;
  padding: 18px 8px;
  border: 3px solid var(--pad-edge);
  border-radius: 50%;
  background: var(--pad);
  color: #142b28;
  font-weight: 800;
  font-size: 1.5rem;
  line-height: 1.2;
  justify-content: center;
}

.pad-choice small {
  font-size: 0.875rem;
  font-weight: 700;
}

.game .pad-choice:disabled {
  opacity: 0.45;
}

.game .pad-choice.correct:disabled {
  opacity: 1;
  border-color: var(--text);
  box-shadow: 0 0 0 4px var(--sun);
}

/* ---- End of a game ---- */

.game-stars {
  font-size: 2.25rem;
  letter-spacing: 4px;
  margin: 8px 0;
}

.game-over img {
  width: 180px;
  height: auto;
}

main.page .game-tips {
  margin-top: 28px;
  text-align: left;
}

@media (prefers-reduced-motion: no-preference) {
  .game button:not(:disabled):active {
    transform: translateY(2px) scale(0.97);
  }

  .pop {
    animation: pop 0.35s ease-out;
  }

  @keyframes pop {
    from {
      transform: scale(0.6);
      opacity: 0;
    }

    70% {
      transform: scale(1.08);
    }
  }
}
