/* Mystery Machine (js/arcade/mysterymachine.js). Every class starts with .mym- */

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

/* ---------- HUD: the machine she is on, the stars she can win, the score ---------- */
.mym-hud { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 14px; font: 700 14px var(--font-ui); color: var(--muted); }
.mym-hud b { color: var(--ink); font-size: 19px; }
.mym-stars { display: inline-flex; gap: 3px; }
.mym-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));
}
.mym-star.mym-half { --f: 50%; }
.mym-star.mym-full { --f: 100%; animation: mym-star 0.45s; }
@keyframes mym-star { 0% { transform: scale(0.6); } 60% { transform: scale(1.25); } 100% { transform: none; } }

/* ---------- the machine ---------- */
.mym-machine { padding: 4px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-soft); }
.mym-machine svg { display: block; width: 100%; height: auto; overflow: visible; }
.mym-body { fill: var(--grape); stroke: var(--grape-d); stroke-width: 3; }
.mym-hopper { fill: var(--sky); stroke: var(--sky-d); stroke-width: 3; stroke-linejoin: round; }
.mym-leg { stroke: var(--grape-d); stroke-width: 7; stroke-linecap: round; }
.mym-pipe { stroke: var(--tile-shadow); stroke-width: 12; stroke-linecap: round; }
.mym-arrow { fill: none; stroke: var(--muted); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.mym-cog circle, .mym-cog rect { fill: var(--sun); stroke: var(--sun-d); stroke-width: 1.5; }
.mym-cog .mym-hub { fill: var(--card); }
.mym-cog.mym-spin { animation: mym-spin 0.6s ease-in-out; }
@keyframes mym-spin { to { transform: rotate(180deg); } }
.mym-light { fill: var(--green); stroke: var(--card); stroke-width: 1.5; }
.mym-light2 { fill: var(--rose); }
.mym-window { fill: var(--card); stroke: var(--grape-d); stroke-width: 2; }
.mym-rule { font: 900 22px var(--font-ui); fill: var(--grape-d); text-anchor: middle; dominant-baseline: central; }
.mym-rule.mym-long { font-size: 13.500px; }
.mym-ball { stroke-width: 3; }
.mym-ball-in { fill: color-mix(in srgb, var(--sky) 35%, white); stroke: var(--sky-d); }
.mym-ball-out { fill: color-mix(in srgb, var(--sun) 40%, white); stroke: var(--sun-d); }
.mym-n { font: 900 24px var(--font-ui); fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.mym-cap { font: 700 13px var(--font-read); fill: var(--muted); text-anchor: middle; }
.mym-in.mym-drop { animation: mym-drop 0.4s ease-in; }
@keyframes mym-drop { 0% { transform: translateX(-30px); opacity: 0; } 100% { transform: none; opacity: 1; } }
.mym-out.mym-pop { animation: mym-out 0.55s ease-out; }
@keyframes mym-out { 0%, 45% { transform: translateX(-50px); opacity: 0; } 100% { transform: none; opacity: 1; } }

/* ---------- the numbers she can drop in ---------- */
.mym-feed { display: grid; gap: 4px; }
.mym-feed[hidden] { display: none; }
.mym-ask { margin: 0; text-align: center; font: 700 15px/1.2 var(--font-read); color: var(--muted); }
.mym-chips { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.mym-chip {
  min-height: 46px; padding: 0; border: 0; border-radius: 50px; background: color-mix(in srgb, var(--sky) 35%, white); color: var(--ink);
  font: 800 20px var(--font-ui); box-shadow: 0 4px 0 var(--sky-d); cursor: pointer; touch-action: manipulation;
}
.mym-chip:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--sky-d); }
.mym-chip.mym-fed { background: var(--card); box-shadow: 0 4px 0 var(--tile-shadow); color: var(--muted); }

/* ---------- the table: in and out as two bars on one scale ---------- */
.mym-table { display: grid; gap: 3px; }
.mym-table:empty { display: none; }
.mym-row { display: grid; grid-template-columns: 34px 1fr 34px 1fr; align-items: center; gap: 6px; min-height: 22px; }
.mym-head { min-height: 0; font: 700 13px/1 var(--font-read); color: var(--muted); text-align: right; }
.mym-v { font: 800 17px/1 var(--font-ui); color: var(--ink); text-align: right; }
.mym-track { display: block; height: 14px; border-radius: 7px; background: var(--card); overflow: hidden; }
.mym-bar { display: block; height: 100%; border-radius: 7px; }
.mym-bar-in { background: var(--sky); }
.mym-bar-out { background: var(--sun); }
.mym-row.mym-fresh .mym-bar { animation: mym-grow 0.4s ease-out; transform-origin: left; }
@keyframes mym-grow { from { transform: scaleX(0); } }

.mym-msg { min-height: 44px; margin: 0; display: grid; place-items: center; text-align: center; font: 700 16px/1.3 var(--font-read); color: var(--ink); }
.mym-msg.mym-yes { color: var(--green-d); }

/* ---------- the question, and the four answers ---------- */
.mym-goal { margin: 0; text-align: center; font: 700 18px/1.3 var(--font-read); color: var(--ink); }
.mym-goal:empty { display: none; }
.mym-goal b { font: 900 26px/1 var(--font-ui); color: var(--grape-d); }
.mym-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mym-picks:empty { display: none; }
.mym-picks.mym-four { grid-template-columns: repeat(4, 1fr); }
.mym-picks.mym-wait .mym-pick { opacity: 0.45; }
.mym-pick {
  min-height: 50px; padding: 4px; border: 0; border-radius: 14px; background: var(--card); color: var(--ink); font: 800 22px var(--font-ui);
  box-shadow: 0 4px 0 var(--tile-shadow); cursor: pointer; touch-action: manipulation; white-space: nowrap;
}
.mym-pick.mym-long { font-size: 18px; }
.mym-pick:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--tile-shadow); }
.mym-foot { display: grid; justify-items: center; }
.mym-next { min-width: 220px; touch-action: manipulation; }

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

/* iPad: more room */
@media (min-width: 700px) {
  .mym-wrap { gap: 12px; }
  .mym-msg { font-size: 19px; }
  .mym-goal { font-size: 22px; }
  .mym-chip, .mym-pick { min-height: 56px; }
  .mym-row { min-height: 28px; }
  .mym-track { height: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .mym-star.mym-full, .mym-no, .mym-cog.mym-spin, .mym-in.mym-drop, .mym-out.mym-pop, .mym-row.mym-fresh .mym-bar { animation: none; }
}
