/* Shape Spotter (js/arcade/shapespotter.js). Every class starts with .sp- */

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

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

/* ---------- the question ---------- */
.sp-goal { display: grid; justify-items: center; gap: 2px; padding: 8px 14px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-soft); text-align: center; }
.sp-q { font: 800 22px/1.25 var(--font-read); color: var(--grape-d); }
.sp-note { font: 400 13px/1.3 var(--font-read); color: var(--muted); }

/* ---------- the stage: the solid she turns ---------- */
.sp-stage { position: relative; height: clamp(220px, 36vh, 400px); border-radius: var(--radius); background: color-mix(in srgb, var(--sky) 12%, white); box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--sky) 45%, white), var(--shadow-soft); overflow: hidden; }
.sp-table-level .sp-stage { height: clamp(150px, 22vh, 320px); }
.sp-table-level { padding-bottom: 64px; }
.sp-stage.sp-empty { display: none; }
.sp-stage.sp-right { box-shadow: inset 0 0 0 4px var(--green-d), var(--shadow-soft); background: color-mix(in srgb, var(--green) 16%, white); }
.sp-gl { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
.sp-flatbox { position: absolute; inset: 0; }
.sp-flat { display: block; width: 100%; height: 100%; }
.sp-drag { display: none; position: absolute; left: 10px; bottom: 6px; font: 700 12px var(--font-ui); color: var(--muted); pointer-events: none; }
.sp-3d .sp-drag { display: block; }
.sp-3d .sp-flatbox, .sp-3d .sp-turns { display: none; }

/* the flat drawing: only the kind of part she is asked for takes a tap */
.sp-part { pointer-events: none; }
.sp-face { fill: var(--sky); stroke: var(--ink); stroke-width: 5; stroke-linejoin: round; }
.sp-face.sp-lit { fill: var(--sun); }
.sp-face.sp-hint { fill: var(--green); }
.sp-shine { fill: none; stroke: var(--card); stroke-width: 4; opacity: 0.5; }
.sp-line { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }
.sp-fat { fill: none; stroke: transparent; stroke-width: 74; stroke-linecap: round; }
.sp-corner .sp-fat { fill: transparent; stroke: none; }
.sp-lit .sp-line { stroke: var(--danger); stroke-width: 15; }
.sp-hint .sp-line { stroke: var(--green-d); stroke-width: 15; }
.sp-dot { fill: var(--ink); opacity: 0; }
.sp-ask-corners .sp-dot { opacity: 1; }
.sp-lit .sp-dot { opacity: 1; fill: var(--danger); r: 19px; stroke: var(--card); stroke-width: 4; }
.sp-hint .sp-dot { opacity: 1; fill: var(--green-d); r: 19px; }
.sp-ask-faces .sp-face { pointer-events: auto; cursor: pointer; }
.sp-ask-edges .sp-edge .sp-fat { pointer-events: stroke; cursor: pointer; }
.sp-ask-corners .sp-corner .sp-fat { pointer-events: all; cursor: pointer; }

.sp-turns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sp-turn { padding: 8px 6px; white-space: nowrap; touch-action: manipulation; }

/* ---------- the counts of this solid ---------- */
.sp-tally { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sp-tile { display: grid; justify-items: center; padding: 4px 6px 2px; border-radius: 16px; background: var(--card); box-shadow: var(--shadow-soft); color: var(--muted); }
.sp-tile small { font: 700 13px var(--font-ui); }
.sp-tile b { font: 900 30px/1.1 var(--font-ui); color: var(--green-d); }
.sp-tile.sp-now { box-shadow: inset 0 0 0 3px var(--sun), var(--shadow-soft); }
.sp-tile.sp-now b { color: var(--grape-d); }

/* ---------- the table of the last level ---------- */
.sp-rows { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-soft); font: 400 14px/1.2 var(--font-read); color: var(--ink); }
.sp-rows th { font: 700 12px var(--font-ui); color: var(--muted); padding: 6px 4px; }
.sp-rows td { padding: 5px 4px; text-align: center; border-top: 2px solid var(--line); font-weight: 700; }
.sp-rows td:first-child { text-align: left; padding-left: 10px; font-weight: 400; }
.sp-rows .sp-sum { color: var(--green-d); font: 900 18px var(--font-ui); }

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

/* ---------- Done, and the number pad ---------- */
.sp-done { justify-self: center; min-width: 200px; touch-action: manipulation; }
.sp-pad { display: none; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.sp-padding .sp-pad { display: grid; }
.sp-padding .sp-done, .sp-padding .sp-tally { display: none; }
.sp-entry { grid-column: 1 / -1; justify-self: center; min-width: 96px; padding: 2px 14px; border-radius: 14px; background: var(--card); box-shadow: inset 0 0 0 3px var(--sun), var(--shadow-soft); text-align: center; font: 900 32px/1.2 var(--font-ui); color: var(--grape-d); }
.sp-key { padding: 8px 0; min-width: 0; min-height: 48px; font-size: 22px; touch-action: manipulation; }

.sp-no { animation: sp-no 0.32s; }
@keyframes sp-no { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

@media (min-width: 700px) {
  .sp-wrap { gap: 12px; }
  .sp-q { font-size: 28px; }
  .sp-note { font-size: 15px; }
  .sp-msg { font-size: 19px; }
  .sp-rows { font-size: 17px; }
  .sp-rows th { font-size: 14px; }
}

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