/* Fill the Box (js/arcade/fillbox.js, and its 3D picture js/arcade-3d/fillbox3d.js). Every class starts with .fx- */

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

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

/* ---------- the question ---------- */
.fx-q { margin: 0; padding: 8px 14px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-soft); text-align: center; font: 700 18px/1.25 var(--font-read); color: var(--grape-d); text-wrap: balance; }

/* ---------- the box: a 3D picture she can turn, or the flat drawing ---------- */
.fx-stage { position: relative; border-radius: var(--radius); background: color-mix(in srgb, var(--sky) 14%, white); box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--sky) 45%, white), var(--shadow-soft); }
.fx-view { position: relative; height: clamp(180px, 29vh, 300px); height: clamp(180px, 29dvh, 300px); overflow: hidden; border-radius: var(--radius); }
.fx-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; outline-offset: -4px; }
.fx-gl.is-held { cursor: grabbing; }
.fx-tags { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fx-tag { position: absolute; left: 0; top: 0; min-width: 26px; padding: 0 7px; border-radius: 12px; background: var(--card); box-shadow: 0 1px 4px rgba(46, 42, 71, 0.25); text-align: center; font: 800 17px/1.45 var(--font-ui); color: var(--ink); white-space: nowrap; will-change: transform; }
.fx-tag-ask { background: var(--grape); color: var(--card); }
.fx-tag-name { background: none; box-shadow: none; color: var(--grape-d); font-size: 20px; text-shadow: 0 0 3px var(--card), 0 0 3px var(--card); }
.fx-flat { position: absolute; inset: 0; display: grid; place-items: center; padding: 6px; }
.fx-3d .fx-flat { display: none; }
.fx-iso { display: block; width: 100%; height: 100%; }
.fx-floor { fill: var(--line); }
.fx-edge { stroke: var(--sky-d); stroke-width: 2.4; stroke-linecap: round; }
.fx-far { opacity: 0.45; }
.fx-glass { fill: color-mix(in srgb, var(--sky) 12%, transparent); stroke: var(--sky-d); stroke-width: 2.4; stroke-linejoin: round; }
.fx-cube { --k: var(--sun); --k-d: var(--sun-d); stroke: rgba(46, 42, 71, 0.5); stroke-width: 1.6; stroke-linejoin: round; }
.fx-cube.fx-p1 { --k: var(--rose); --k-d: var(--rose-d); }
.fx-top { fill: color-mix(in srgb, var(--k) 78%, white); }
.fx-a { fill: var(--k); }
.fx-b { fill: var(--k-d); }
.fx-alt .fx-top { fill: color-mix(in srgb, var(--k) 92%, white); }
.fx-alt .fx-a { fill: color-mix(in srgb, var(--k) 86%, var(--ink)); }
.fx-alt .fx-b { fill: color-mix(in srgb, var(--k-d) 86%, var(--ink)); }
.fx-new { animation: fx-drop 0.34s var(--d, 0ms) ease-in backwards; }
@keyframes fx-drop { from { transform: translateY(-90px); opacity: 0; } }
.fx-iso-tag { font: 800 22px var(--font-ui); fill: var(--ink); text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: var(--card); stroke-width: 7px; stroke-linejoin: round; }
.fx-iso-ask { fill: var(--grape-d); font-size: 26px; }
.fx-iso-name { fill: var(--grape-d); }
.fx-stage.fx-right { box-shadow: inset 0 0 0 4px var(--green-d), var(--shadow-soft); background: color-mix(in srgb, var(--green) 20%, white); }

/* Turn and Turn back sit in the top corners of the picture, clear of the numbers on the box's bottom edges */
.fx-turns { position: absolute; left: 8px; right: 8px; top: 8px; display: flex; justify-content: space-between; pointer-events: none; }
.fx-turn { pointer-events: auto; min-height: 44px; min-width: 64px; padding: 6px 14px; border: 0; border-radius: 22px; background: var(--card); box-shadow: 0 3px 0 var(--tile-shadow); font: 700 15px var(--font-ui); color: var(--ink); touch-action: manipulation; cursor: pointer; }
.fx-turn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--tile-shadow); }

/* ---------- the sum the cubes show, building as the box fills ---------- */
.fx-sum { display: grid; align-content: center; justify-items: center; min-height: 46px; gap: 0; }
.fx-line { font: 700 16px/1.3 var(--font-read); color: var(--muted); white-space: nowrap; }
.fx-line.fx-last { font-size: 19px; color: var(--green-d); }

.fx-fill { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.fx-add { min-height: 46px; padding: 8px 6px; font-size: 16px; color: var(--ink); white-space: nowrap; touch-action: manipulation; }
.fx-add.ghost { padding: 8px 14px; }
.fx-off { opacity: 0.45; }

.fx-msg { min-height: 42px; margin: 0; display: grid; place-items: center; text-align: center; font: 700 16px/1.3 var(--font-read); color: var(--ink); text-wrap: balance; }

/* ---------- the number pad: ten digits, then rub out, her answer, Check ---------- */
.fx-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.fx-key { min-height: 46px; border: 0; border-radius: 14px; background: var(--card); box-shadow: 0 3px 0 var(--tile-shadow); font: 800 22px var(--font-ui); color: var(--ink); touch-action: manipulation; cursor: pointer; }
.fx-key:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--tile-shadow); }
.fx-entry { grid-column: span 2; display: grid; place-items: center; min-height: 50px; border-radius: 14px; background: var(--card); box-shadow: inset 0 0 0 3px var(--grape); font: 900 28px var(--font-ui); color: var(--grape-d); }
.fx-entry.fx-blank::after { content: '?'; color: var(--tile-shadow); }
.fx-check { grid-column: span 2; min-height: 50px; padding: 6px 4px; white-space: nowrap; touch-action: manipulation; }

/* fx5: two boxes to choose from */
.fx-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fx-choice { min-height: 56px; justify-content: center; text-align: center; font-size: 22px; color: var(--card); touch-action: manipulation; }

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

/* iPad: more room */
@media (min-width: 700px) {
  .fx-wrap { gap: 12px; }
  .fx-q { font-size: 24px; }
  .fx-view { height: clamp(300px, 38vh, 440px); }
  .fx-line { font-size: 19px; }
  .fx-line.fx-last { font-size: 23px; }
  .fx-msg { font-size: 19px; }
  .fx-key { min-height: 54px; }
  .fx-tag { font-size: 20px; }
}

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