/* Fact Family House (js/arcade/factfamily.js). Every class starts with .ff- */

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

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

/* ---------- the house: a roof with the family's three numbers, and a room with their picture and their sums ---------- */
.ff-house { display: grid; }
.ff-roof svg { display: block; width: 100%; height: auto; }
.ff-chimney { fill: var(--grape); stroke: var(--grape-d); stroke-width: 3; }
.ff-tiles { fill: var(--rose); stroke: var(--rose-d); stroke-width: 5; stroke-linejoin: round; }
.ff-win { fill: var(--card); stroke: var(--rose-d); stroke-width: 3; }
.ff-win.ff-gap { fill: color-mix(in srgb, var(--sun) 55%, white); stroke: var(--sun-d); stroke-dasharray: 5 4; }
.ff-wnum { font: 900 21px var(--font-ui); fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.ff-body { display: grid; gap: 4px; margin: -3px 0 0; padding: 6px 6px 8px; min-width: 0; border: 3px solid var(--rose-d); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); background: var(--card); box-shadow: var(--shadow-soft); }
.ff-house.ff-right .ff-body { border-color: var(--green-d); background: color-mix(in srgb, var(--green) 12%, white); }
.ff-pic { display: grid; justify-items: center; }
.ff-dots { display: block; width: min(100%, 290px); height: auto; }
.ff-dot { fill: var(--sky); stroke: var(--sky-d); stroke-width: 1.2; }
.ff-ring { fill: color-mix(in srgb, var(--sun) 30%, white); stroke: var(--sun-d); stroke-width: 2; }
.ff-ring.ff-group { fill: color-mix(in srgb, var(--lime) 30%, white); stroke: var(--lime-d); }
.ff-pic.ff-redraw { animation: ff-pop 0.45s; }
.ff-cap { margin: 0; min-height: 22px; text-align: center; font: 700 16px/1.3 var(--font-read); color: var(--ink); }
.ff-ask { margin: 6px 0; text-align: center; font: 700 19px/1.3 var(--font-read); color: var(--grape-d); }
.ff-ask[hidden], .ff-frames[hidden], .ff-tray[hidden], .ff-choices[hidden] { display: none; }

/* the frames: one for each sum; the one she is on has a ring */
.ff-frames { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.ff-frames.ff-two { grid-template-columns: minmax(0, 200px); justify-content: center; }
.ff-frame { display: flex; align-items: center; justify-content: center; gap: 0; padding: 3px 2px; min-width: 0; border-radius: 14px; border: 2px solid transparent; background: color-mix(in srgb, var(--tile-shadow) 30%, white); cursor: pointer; }
.ff-frame.ff-now { border-color: var(--grape); background: color-mix(in srgb, var(--grape) 9%, white); }
.ff-frame.ff-done { border-color: var(--green-d); background: color-mix(in srgb, var(--green) 20%, white); cursor: default; }
.ff-frame.ff-bad { border-color: var(--danger); animation: ff-no 0.32s; }
.ff-frame i { flex: none; width: 12px; font: 900 20px/1 var(--font-ui); font-style: normal; color: var(--ink); text-align: center; }
.ff-slot { flex: 1 1 0; min-width: 0; max-width: 56px; height: 46px; padding: 0; border-radius: 10px; border: 2px dashed var(--muted); background: var(--card); font: 900 20px/1 var(--font-ui); color: var(--ink); touch-action: manipulation; }
.ff-slot.ff-in { border-style: solid; border-color: var(--sky-d); background: color-mix(in srgb, var(--sky) 25%, white); }
.ff-slot.ff-aim { border-style: solid; border-color: var(--grape); box-shadow: 0 0 0 3px color-mix(in srgb, var(--grape) 30%, white); }
.ff-done .ff-slot { border-color: transparent; background: none; }

.ff-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 number tiles, and the choices for the first question ---------- */
.ff-tray { display: flex; justify-content: center; gap: 14px; }
.ff-tile { min-width: 72px; height: 60px; padding: 0 10px; border: 0; border-radius: 16px; background: var(--sky); box-shadow: 0 5px 0 var(--sky-d); font: 900 28px/1 var(--font-ui); color: var(--ink); touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.ff-tile:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--sky-d); }
.ff-tile.ff-used { opacity: 0.35; }
.ff-tile.ff-ghost { position: fixed; z-index: 50; display: grid; place-items: center; margin: -30px 0 0 -36px; pointer-events: none; opacity: 0.92; }
.ff-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ff-choice { min-height: 56px; padding: 8px 2px; font-size: 24px; touch-action: manipulation; }
.ff-choice.ff-out { opacity: 0.35; }

/* a sum that is not true, a tile that can't go: a little shake */
.ff-no { animation: ff-no 0.32s; }
@keyframes ff-no { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* iPad: more room */
@media (min-width: 700px) {
  .ff-wrap { gap: 12px; }
  .ff-dots { width: min(100%, 340px); }
  .ff-cap { font-size: 19px; }
  .ff-ask { font-size: 23px; }
  .ff-frames { gap: 10px; }
  .ff-frame { padding: 6px 4px; }
  .ff-frame i { width: 20px; }
  .ff-slot { height: 52px; font-size: 24px; }
  .ff-frame i { font-size: 24px; }
  .ff-msg { font-size: 19px; }
  .ff-tile { min-width: 88px; height: 68px; font-size: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  .ff-star.ff-full, .ff-pic.ff-redraw, .ff-frame.ff-bad, .ff-no { animation: none; }
}
