/* Array Garden (js/arcade/arraygarden.js). Every class starts with .ag- */

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

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

/* ---------- what to plant, and the beds found so far ---------- */
.ag-goal { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px; padding: 6px 14px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-soft); }
.ag-ask { font: 700 21px/1.25 var(--font-read); color: var(--ink); text-align: center; }
.ag-ask b { font: 900 34px/1 var(--font-ui); color: var(--grape-d); padding: 0 2px; }
.ag-found { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.ag-found[hidden] { display: none; }
.ag-chip { min-width: 44px; padding: 3px 9px; border-radius: 12px; border: 2px dashed var(--tile-shadow); font: 800 16px/1.3 var(--font-ui); font-style: normal; color: var(--muted); text-align: center; }
.ag-chip.ag-got { border: 2px solid var(--green-d); background: color-mix(in srgb, var(--green) 22%, white); color: var(--ink); animation: ag-pop 0.4s; }

/* ---------- the garden: empty squares, and the bed of flowers on them ---------- */
.ag-plot { display: grid; justify-items: center; padding: 6px; border-radius: var(--radius); background: color-mix(in srgb, var(--lime) 26%, white); box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--lime) 60%, white), var(--shadow-soft); }
.ag-box { position: relative; width: min(100%, 44vh, 400px); aspect-ratio: 1; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.ag-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ag-earth { fill: var(--card); }
.ag-dot { fill: var(--tile-shadow); }
.ag-soil { fill: color-mix(in srgb, var(--green) 55%, white); stroke: var(--green-d); stroke-width: 1.2; }
.ag-petal { fill: var(--rose); stroke: var(--rose-d); stroke-width: 0.35; }
.ag-heart { fill: var(--sun); stroke: var(--sun-d); stroke-width: 0.35; }
.ag-num { font-family: var(--font-ui); font-weight: 900; fill: var(--grape-d); text-anchor: middle; dominant-baseline: central; }
.ag-bed { transform-box: fill-box; transform-origin: 0 0; }
.ag-bed.ag-turned { animation: ag-turn 0.4s ease-out; }
@keyframes ag-turn { from { transform: matrix(0, 1, 1, 0, 0, 0); } }
/* the handle on the bed's far corner: a round grip 44 px across */
.ag-handle { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; display: grid; place-items: center; cursor: grab; }
.ag-handle svg { width: 30px; height: 30px; padding: 5px; border-radius: 50%; background: var(--grape); box-shadow: 0 3px 0 var(--grape-d), 0 0 0 2px var(--card); fill: none; stroke: var(--card); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.ag-plot.ag-right { box-shadow: inset 0 0 0 4px var(--green-d), var(--shadow-soft); background: color-mix(in srgb, var(--green) 30%, white); }
.ag-plot.ag-yes { animation: ag-yes 0.5s; }
@keyframes ag-yes { 40% { box-shadow: inset 0 0 0 5px var(--green-d), var(--shadow-soft); } }

/* the bed read out loud on the page: 3 rows of 4 = 12 */
.ag-read { margin: 0; text-align: center; font: 900 26px/1.15 var(--font-ui); color: var(--ink); }
.ag-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); }

/* ---------- the buttons ---------- */
.ag-grow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ag-step { min-height: 46px; padding: 8px 2px; font-size: 16px; white-space: nowrap; touch-action: manipulation; }
.ag-acts { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.ag-turn { color: var(--ink); padding: 12px 8px; touch-action: manipulation; }
.ag-check { padding: 12px 8px; touch-action: manipulation; }
.ag-check.ag-off { opacity: 0.45; }

/* a step that can't be made, and a Check that is not right yet: a little shake */
.ag-no { animation: ag-no 0.32s; }
@keyframes ag-no { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* iPad: more room */
@media (min-width: 700px) {
  .ag-wrap { gap: 12px; }
  .ag-ask { font-size: 26px; }
  .ag-ask b { font-size: 44px; }
  .ag-read { font-size: 34px; }
  .ag-msg { font-size: 19px; }
  .ag-box { width: min(100%, 48vh, 480px); }
  .ag-step { font-size: 19px; min-height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  .ag-star.ag-full, .ag-chip.ag-got, .ag-bed.ag-turned, .ag-plot.ag-yes, .ag-no { animation: none; }
}
