/* Pengar – only what is special to the money games: the coin disk, the sort button and "▢ kr". The game box, menu,
   number pad, result, effects, red-pen rings and the hologram around the task are every school game's: css/skolspel.css. */

/* As wide as a disk with a table of money on it; one width through a round, so the pad never moves */
.pg-holo {
  width: min(31rem, 100%);
  min-width: 20rem;
}

/* The counter (js/coin-disk.js draws the money; its shape is the disk's world, 100 x 62) */
.pg-disk {
  display: block;
  width: 30rem;                  /* a set width: the hologram around it is as wide as its content */
  max-width: 100%;
  aspect-ratio: 100 / 62;
  touch-action: none;            /* a finger drags the money, it never scrolls the page */
  cursor: default;
}

.pg-disk.is-over {
  cursor: grab;
}

.pg-disk.is-dragging {
  cursor: grabbing;
}

.pg-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 0.35rem;
}

/* The answer: big, "▢ kr" */
.pg-fact {
  margin: 0;
  font-size: clamp(2rem, 5.5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.2;
  color: #f2feff;
  text-shadow: 0 0 1px currentColor, 0 0 0.45em rgba(94, 240, 255, 0.4);
  white-space: nowrap;
}

.pg-box {
  display: inline-block;
  min-width: 4.4ch;              /* four digits (1000) from the start: the square never grows while typing */
  padding: 0 0.12em;
  color: var(--yellow);
  text-align: center;
  border: 3px solid rgba(94, 240, 255, 0.45);
}

.pg-box.is-empty::after {
  content: "\00a0";
}

.pg-box.is-active {
  border-color: var(--yellow);
  box-shadow: 0 0 14px rgba(255, 233, 77, 0.6);
}

.pg-box.is-active.is-empty {
  animation: pg-breathe 1.1s ease-in-out infinite;
}

@keyframes pg-breathe {
  50% { box-shadow: 0 0 24px rgba(255, 233, 77, 1); }
}

.pg-box.is-right {
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(94, 240, 255, 0.7);
}

.pg-box.is-wrong {
  color: var(--magenta);
  border-color: rgba(255, 63, 180, 0.6);
}

/* The sort button: a picture (two notes over three coins), lit while the money is sorted */
.pg-sort {
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  padding: 0;
  color: var(--cyan);
  background: rgba(94, 240, 255, 0.08);
  border: 2px solid rgba(94, 240, 255, 0.5);
  border-radius: 0.5rem;
  cursor: pointer;
}

.pg-sort svg {
  width: 1.8rem;
  height: 1.8rem;
  fill: currentColor;
}

.pg-sort:hover,
.pg-sort:focus-visible {
  background: rgba(94, 240, 255, 0.18);
  box-shadow: 0 0 12px rgba(94, 240, 255, 0.5);
}

.pg-sort.is-on {
  color: #0d0628;
  background: var(--cyan);
  box-shadow: 0 0 14px rgba(94, 240, 255, 0.7);
}

/* The first task of a round: the button breathes a few times (here is a tool) */
.pg-sort.is-hinting {
  animation: pg-hint 1.2s ease-in-out 3;
}

@keyframes pg-hint {
  50% { box-shadow: 0 0 20px rgba(94, 240, 255, 0.95); transform: scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .pg-sort.is-hinting,
  .pg-box.is-active.is-empty {
    animation: none;
  }
}

/* Phones held upright: the disk as wide as the box */
@media (max-width: 480px) {
  .pg-holo {
    min-width: 0;
    width: 100%;
  }

  /* A little narrower than the box, so the disk, the answer and the pad fit one screen held upright */
  .pg-disk {
    width: min(100%, 14.5rem);
    margin-inline: auto;
  }

  .pg-row {
    margin-top: 0.2rem;
  }

  .pg-fact {
    font-size: 1.8rem;
  }

  .pg-sort {
    width: 2.6rem;
    height: 2.6rem;
  }
}

/* Phones held upright AND tall enough: the disk takes the whole width (it was ~230 px and the coins ~20 px –
   /pedagoger round 1). On a lower phone (375 x 667) the wider disk made the page scroll, so it keeps its size there. */
@media (max-width: 480px) and (min-height: 760px) {
  .pg-holo {
    width: 100%;
    min-width: 0;
  }

  .pg-disk {
    width: 100%;
  }
}
