/* Play games: goals, progress, end screens and the drag-and-place games (play.js).
   Loaded after home.css. Uses the wattle palette: greens, golds and warm browns. */
:root {
  --play-gold: #e0a21c;
  --play-gold-bg: #fdf0c4;
  --play-green: #2f6b3a;
  --play-green-bg: #e3f3e8;
  --play-brown: #5a3e1b;
  --play-wrong-bg: #fbebe5;
  --play-wrong: #c5684b;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.world-game,
.play-card {
  min-width: 0;
  max-width: 100%;
}
.play-card {
  overflow-wrap: anywhere;
}
.play-card button {
  min-height: 48px;
  touch-action: manipulation;
}

/* Goal, position and progress */
.play-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
}
.play-top .pill {
  margin: 0;
}
.play-count {
  margin: 0;
  font-weight: 800;
  color: var(--play-brown);
}
.play-goal {
  margin: 10px 0 6px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--play-gold-bg);
  border-left: 4px solid var(--play-gold);
}
.progress.play-progress {
  margin: 8px 0 18px;
  height: 10px;
}
.play-progress span {
  background: var(--play-green);
}
.play-tag {
  display: inline-block;
  margin: 2px 6px;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--play-gold);
  background: var(--play-gold-bg);
  color: var(--play-brown);
  font-size: 13px;
  font-weight: 750;
  vertical-align: middle;
}
.play-tag.ok {
  border-color: var(--play-green);
  background: var(--play-green-bg);
  color: #18492f;
}
.play-mark {
  display: inline-block;
  min-width: 1.2em;
  font-weight: 900;
  margin-right: 4px;
}
.task-option.correct .play-mark,
.sort-bins .correct .play-mark {
  color: #18492f;
}
.task-option.wrong .play-mark,
.sort-bins .wrong .play-mark {
  color: #6e2b16;
}
/* Correct and wrong answers differ by border style as well as colour. */
.play-card .task-option.wrong,
.play-card .sort-bins .wrong {
  border-style: dashed;
}
.play-card .task-option.correct,
.play-card .sort-bins .correct {
  border-width: 2px;
}

/* End screen */
.play-end h2 {
  margin-top: 8px;
}
.play-stamp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 8px;
  padding: 8px 14px;
  border: 2px dashed var(--play-gold);
  border-radius: 999px;
  background: var(--play-gold-bg);
  color: var(--play-brown);
  font-weight: 800;
  transform: rotate(-1.5deg);
}
.play-stamp span {
  color: var(--play-gold);
  font-size: 20px;
}
.play-score {
  font-weight: 650;
}
.play-learned-title {
  margin: 16px 0 6px;
  font-size: 18px;
}
.play-learned {
  margin: 0 0 16px;
  padding-left: 22px;
  display: grid;
  gap: 6px;
}
.play-swap {
  margin: 0 0 10px;
  color: var(--muted, #5a6573);
  font-size: 15px;
}
.play-end-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.play-harder {
  border: 2px solid var(--play-green);
  background: #fff;
  color: var(--play-green);
  border-radius: 10px;
  font-weight: 800;
  padding: 0 18px;
}
.play-harder:hover {
  background: var(--play-green-bg);
}

/* Draggable cards (each one is also a tap-to-select button) */
.play-tray {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
  padding: 12px;
  border-radius: 12px;
  background: #f4ecd2;
  border: 1px solid var(--line, #e3dccd);
}
.play-chip {
  min-height: 52px;
  padding: 8px 14px;
  border: 2px solid var(--line-strong, #cfc5b1);
  border-radius: 12px;
  background: #fff;
  color: var(--ink, #1d2a3a);
  font-weight: 750;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 2px 0 rgba(90, 62, 27, 0.15);
}
.play-chip.small {
  min-height: 44px;
  padding: 4px 10px;
  font-size: 14px;
}
.play-chip.selected {
  border-color: var(--play-green);
  border-style: double;
  border-width: 4px;
  background: #edf3e6;
  transform: translateY(-2px);
}
.play-chip.selected::before {
  content: "➜ ";
  color: var(--play-green);
}
.play-chip:focus-visible,
.play-zone-btn:focus-visible,
.web-node:focus-visible {
  outline: 3px solid var(--play-gold);
  outline-offset: 2px;
}
.play-chip.dragging {
  opacity: 0.35;
}
.play-ghost.play-ghost.play-ghost {
  position: fixed;
  margin: 0;
  z-index: 1000;
  pointer-events: none;
  transform: translate(-50%, -60%) rotate(-3deg);
  opacity: 0.95;
  box-shadow: 0 12px 24px -8px rgba(29, 42, 58, 0.45);
}

/* Drop boxes */
.play-zones {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}
.play-zones.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.play-zones.five {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}
.play-zone {
  min-width: 0;
  border: 2px dashed var(--line-strong, #cfc5b1);
  border-radius: 12px;
  background: #fffdf8;
  padding: 6px;
  transition: background 0.15s, border-color 0.15s;
}
.play-zone.zone-good {
  background: #f3f8ee;
}
.play-zone.zone-poor {
  background: #fbf5ef;
}
.play-zone.filled {
  border-style: solid;
  border-color: var(--play-green);
}
.play-zone.drop-hover {
  border-style: solid;
  border-color: var(--play-gold);
  background: var(--play-gold-bg);
}
.play-zone-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-height: 64px;
  padding: 6px;
  border: 0;
  background: none;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
}
.play-zone-btn small {
  color: var(--muted, #5a6573);
  font-size: 13px;
}
.play-zone-cta {
  font-size: 12px;
  font-weight: 800;
  color: var(--play-brown);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.play-zone-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
}
.play-placed {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--play-green);
  background: var(--play-green-bg);
  color: #18492f;
  font-weight: 700;
  font-size: 14px;
}
.play-job {
  display: grid;
  gap: 2px;
  margin: 6px 0 4px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--chem-bg, #eaf2e3);
  border: 1px solid #c9dcbc;
}
.play-job-label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--play-green);
}
.play-job b {
  font-size: 20px;
}
.play-need {
  margin: 6px 0;
}

/* Food web board */
.web-wrap {
  display: grid;
  gap: 14px;
  align-items: start;
}
@media (min-width: 760px) {
  .web-wrap {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  }
}
.web-board {
  position: relative;
  width: 100%;
  max-width: 520px;
  aspect-ratio: 320 / 300;
  border-radius: 14px;
  background: linear-gradient(#f3f8ee, #f4ecd2);
  border: 1px solid var(--line, #e3dccd);
}
.web-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.web-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 94px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  border: 2px solid var(--line-strong, #cfc5b1);
  border-radius: 12px;
  background: #fff;
  color: var(--ink, #1d2a3a);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.15;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  overflow-wrap: normal;
}
.web-node span {
  font-size: 20px;
}
.web-node:disabled {
  opacity: 1;
  cursor: default;
}
.web-node.selected {
  border: 4px double var(--play-green);
  background: #edf3e6;
}
.web-node.drop-hover {
  border-color: var(--play-gold);
  background: var(--play-gold-bg);
}
.web-node.fx-up {
  border: 3px solid var(--play-green);
  background: var(--play-green-bg);
}
.web-node.fx-down {
  border: 3px dashed var(--play-wrong);
  background: var(--play-wrong-bg);
}
.web-fx {
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}
.web-clues {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}
.web-clues li {
  padding: 6px 10px;
  border-radius: 10px;
  background: #fffdf8;
  border: 1px solid var(--line, #e3dccd);
  font-size: 15px;
}
.web-clues li.selected {
  border: 2px solid var(--play-green);
  background: #edf3e6;
}

/* Shadow clock */
.shadow-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px;
}
.shadow-pic {
  width: 84px;
  height: 84px;
  display: block;
}
.shadow-pic.small {
  width: 40px;
  height: 40px;
}
.shadow-pair {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 8px 0;
}
.shadow-pair figure {
  margin: 0;
  text-align: center;
  font-weight: 700;
}
.shadow-pair .shadow-pic {
  width: 110px;
  height: 110px;
}

/* Magnet test */
.magnet-bar {
  display: flex;
  width: min(260px, 100%);
  height: 34px;
  margin: 6px 0 4px;
  border-radius: 8px;
  overflow: hidden;
  font-weight: 900;
  color: #fff;
}
.magnet-bar span {
  flex: 1;
  display: grid;
  place-items: center;
  background: #b23a2a;
}
.magnet-bar span + span {
  background: #2d5f8a;
}
.magnet-results {
  margin: 8px 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.magnet-results li {
  display: grid;
  gap: 2px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line, #e3dccd);
  background: #fffdf8;
}
.magnet-results li.stuck {
  border: 2px solid var(--play-green);
  animation: play-stick 0.5s ease-out;
}
.magnet-obj {
  font-weight: 800;
}
.magnet-results small {
  color: var(--muted, #5a6573);
}
@keyframes play-stick {
  0% {
    transform: translateY(14px);
  }
  60% {
    transform: translateY(-4px);
  }
  100% {
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .magnet-results li.stuck,
  .play-chip.selected {
    animation: none;
    transform: none;
  }
}

/* Phones: keep everything inside the screen */
@media (max-width: 520px) {
  .play-zones.two {
    grid-template-columns: 1fr 1fr;
  }
  .play-zones.five {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .play-job b {
    font-size: 18px;
  }
  .web-node {
    width: 88px;
    padding: 2px;
    font-size: 11.5px;
    letter-spacing: -0.01em;
  }
  .shadow-pic {
    width: 70px;
    height: 70px;
  }
}
