/* Split the Rectangle (js/arcade/splitrect.js). Every class starts with .sr- */

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

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

/* ---------- the sum, and the tip about where to cut ---------- */
.sr-goal { display: grid; justify-items: center; padding: 2px 16px 6px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-soft); }
.sr-q { font: 900 42px/1.15 var(--font-ui); color: var(--grape-d); letter-spacing: 0.02em; white-space: nowrap; }
.sr-tip { font: 700 15px/1.25 var(--font-read); color: var(--muted); text-align: center; }
.sr-tip[hidden] { display: block; visibility: hidden; }

/* ---------- the rectangle ---------- */
.sr-board { display: grid; justify-items: center; }
.sr-box { position: relative; width: min(100%, 400px); user-select: none; -webkit-user-select: none; }
.sr-box.sr-cutting { touch-action: none; cursor: ew-resize; }
.sr-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.sr-part { stroke: none; }
.sr-c0 { --p: var(--sky); --p-d: var(--sky-d); }
.sr-c1 { --p: var(--sun); --p-d: var(--sun-d); }
.sr-c2 { --p: var(--rose); --p-d: var(--rose-d); }
.sr-c3 { --p: var(--lime); --p-d: var(--lime-d); }
.sr-part { fill: color-mix(in srgb, var(--p) 45%, white); }
.sr-part.sr-now { fill: color-mix(in srgb, var(--p) 80%, white); }
.sr-gridline { fill: none; stroke: var(--card); stroke-width: 1.2; opacity: 0.85; }
.sr-five { stroke: var(--ink); stroke-width: 1.2; opacity: 0.4; }
.sr-edge { fill: none; stroke: var(--ink); stroke-width: 2.5; }
.sr-cut { stroke: var(--grape-d); stroke-width: 3.5; stroke-linecap: round; }
.sr-cut.sr-live { stroke-dasharray: 7 6; }
.sr-side { font: 900 17px var(--font-ui); fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.sr-in { font: 800 15px var(--font-ui); fill: var(--ink); text-anchor: middle; dominant-baseline: central; opacity: 0.75; }
.sr-in.sr-now { opacity: 1; }
.sr-in.sr-got { font-size: 19px; font-weight: 900; opacity: 1; }
/* the handle on a cut: a round grip 44 px across */
.sr-handle { position: absolute; width: 44px; height: 44px; margin: -22px 0 0 -22px; display: grid; place-items: center; cursor: grab; }
.sr-handle svg { width: 32px; height: 32px; 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; }

/* ---------- the sums under it: one for each part, then the adding ---------- */
.sr-eqs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
.sr-eq { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 3px 8px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow-soft); font: 800 19px/1 var(--font-ui); color: var(--ink); white-space: nowrap; border: 2px solid transparent; }
.sr-eq.sr-total { grid-column: 1 / -1; }
.sr-eq.sr-dim { opacity: 0.6; }
.sr-eq.sr-now { border-color: var(--grape); }
.sr-sw { width: 16px; height: 16px; border-radius: 5px; background: color-mix(in srgb, var(--p) 80%, white); box-shadow: inset 0 0 0 2px var(--p-d); flex: none; }
.sr-slot { min-width: 52px; min-height: 34px; padding: 2px 6px; display: inline-grid; place-items: center; border-radius: 10px; border: 2px dashed var(--tile-shadow); font: 900 21px/1 var(--font-ui); color: var(--muted); }
.sr-slot.sr-now { border: 2px solid var(--grape); color: var(--grape-d); background: color-mix(in srgb, var(--grape) 10%, white); }
.sr-slot.sr-got { border: 2px solid var(--green-d); color: var(--ink); background: color-mix(in srgb, var(--green) 22%, white); }
.sr-wrap.sr-right .sr-eq.sr-total { border-color: var(--green-d); background: color-mix(in srgb, var(--green) 16%, white); }

.sr-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: moving the cut, then the choices or the number pad ---------- */
.sr-cutbar { display: flex; justify-content: center; gap: 8px; }
.sr-cutbar[hidden], .sr-choices[hidden], .sr-pad[hidden] { display: none; }
.sr-nudge { min-width: 52px; min-height: 52px; padding: 8px; font-size: 24px; touch-action: manipulation; }
.sr-fix { flex: 1; max-width: 240px; padding: 12px 10px; white-space: nowrap; touch-action: manipulation; }
.sr-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sr-choice { min-height: 56px; padding: 8px 2px; font-size: 24px; touch-action: manipulation; }
.sr-choice.sr-out { opacity: 0.35; }
.sr-pad { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px 6px; }
.sr-key { min-height: 50px; padding: 6px 0; font-size: 24px; touch-action: manipulation; }
.sr-ok { color: var(--card); }

/* a wrong number: a little shake of the box it went in */
.sr-no { animation: sr-no 0.32s; }
@keyframes sr-no { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* iPad: more room */
@media (min-width: 700px) {
  .sr-wrap { gap: 12px; }
  .sr-q { font-size: 56px; }
  .sr-tip { font-size: 18px; }
  .sr-box { width: min(100%, 500px); }
  .sr-eq { font-size: 23px; min-height: 52px; }
  .sr-msg { font-size: 19px; }
  .sr-key { min-height: 58px; }
}

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