/* Times Table Weave (js/arcade/weave.js). Every class starts with .wv- */

.wv-wrap { display: grid; gap: 8px; width: min(100%, 560px); margin: 0 auto; padding-bottom: 14px; }

/* ---------- HUD: the round she is on, the stars she can win, the score ---------- */
.wv-hud { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 14px; font: 700 14px var(--font-ui); color: var(--muted); }
.wv-hud b { color: var(--ink); font-size: 19px; }
.wv-stars { display: inline-flex; gap: 3px; }
.wv-star {
  --f: 0%; width: 24px; height: 24px;
  clip-path: polygon(50% 2%, 62% 36%, 98% 37%, 69% 59%, 80% 94%, 50% 73%, 20% 94%, 31% 59%, 2% 37%, 38% 36%);
  background: linear-gradient(90deg, var(--sun) var(--f), var(--tile-shadow) var(--f));
}
.wv-star.wv-half { --f: 50%; }
.wv-star.wv-full { --f: 100%; animation: wv-pop 0.45s; }
@keyframes wv-pop { 0% { transform: scale(0.6); } 60% { transform: scale(1.25); } 100% { transform: none; } }

/* ---------- the question ---------- */
.wv-goal { margin: 0; padding: 6px 12px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-soft); text-align: center; font: 700 18px/1.3 var(--font-read); color: var(--ink); }
.wv-goal b { font: 900 24px/1 var(--font-ui); color: var(--grape-d); }

/* which colour is which table (two tables on one square) */
.wv-key { display: flex; justify-content: center; gap: 18px; min-height: 0; font: 700 15px/1.2 var(--font-read); color: var(--ink); }
.wv-key:empty { display: none; }
.wv-sw { display: inline-flex; align-items: center; gap: 6px; }
.wv-dot { width: 20px; height: 20px; border-radius: 6px; box-shadow: inset 0 0 0 2px var(--ink); }
.wv-dot-a { background: var(--sky); }
.wv-dot-b { background: var(--sun); }

/* ---------- the number square: ten to a row ---------- */
.wv-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 3px; padding: 5px; border-radius: 14px; background: var(--tile-shadow); }
.wv-cell {
  min-width: 0; min-height: 44px; padding: 0; border: 0; border-radius: 7px; background: var(--card); color: var(--ink);
  font: 800 16px var(--font-ui); cursor: pointer; touch-action: manipulation;
}
.wv-cell.wv-a { background: var(--sky); }
.wv-cell.wv-b { background: var(--sun); }
.wv-cell.wv-ab { background: linear-gradient(135deg, var(--sky) 50%, var(--sun) 50%); }
.wv-cell.wv-on { box-shadow: inset 0 0 0 4px var(--green-d); font-weight: 900; }
.wv-cell.wv-glow { box-shadow: 0 0 0 3px var(--sun), 0 0 10px 3px var(--sun); position: relative; z-index: 1; animation: wv-glow 0.9s ease-in-out infinite alternate; }
@keyframes wv-glow { from { box-shadow: 0 0 0 2px var(--sun), 0 0 4px 1px var(--sun); } to { box-shadow: 0 0 0 3px var(--sun), 0 0 12px 4px var(--sun); } }
.wv-done .wv-cell, .wv-still .wv-cell { pointer-events: none; }

/* three numbers past the end of the square */
.wv-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.wv-choices[hidden] { display: none; }
.wv-choice {
  min-height: 52px; border: 0; border-radius: 14px; background: var(--card); color: var(--ink); font: 800 24px var(--font-ui);
  box-shadow: 0 4px 0 var(--tile-shadow); cursor: pointer; touch-action: manipulation;
}
.wv-choice:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--tile-shadow); }
.wv-done .wv-choice { opacity: 0.5; pointer-events: none; }

.wv-msg { min-height: 48px; margin: 0; display: grid; place-items: center; text-align: center; font: 700 16px/1.35 var(--font-read); color: var(--ink); }
.wv-msg.wv-yes { color: var(--green-d); }
.wv-foot { display: grid; justify-items: center; min-height: 54px; }
.wv-next { min-width: 200px; touch-action: manipulation; }

/* a wrong try: a little shake */
.wv-no { animation: wv-no 0.32s; }
@keyframes wv-no { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }

/* iPad: more room */
@media (min-width: 700px) {
  .wv-wrap { gap: 12px; }
  .wv-goal { font-size: 22px; }
  .wv-goal b { font-size: 30px; }
  .wv-cell { min-height: 50px; font-size: 20px; }
  .wv-msg { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  .wv-star.wv-full, .wv-no, .wv-cell.wv-glow { animation: none; }
}
