/* Steen, papier, schaar (Rock, Paper, Scissors): home tile, the menu (the rules picture, the length,
   the count, the friends), the scores, the arena with both hands and the count, the picture of who
   wins and why, and the three big hands. Shared look lives in css/style.css. */

/* ---------- home tile and menu ---------- */
#tile-sps .tile-art { display: flex; align-items: center; justify-content: center; }
.sps-tile-svg { width: 100%; height: 100%; max-width: 118px; display: block; }
.sps-rules { display: flex; justify-content: center; margin: 0 0 var(--bz-space-2); }
.sps-rules-svg { width: min(100%, 360px); height: auto; display: block; }
.sps-ov { display: inline-flex; width: 110px; height: 110px; }
.sps-ov svg { width: 100%; height: 100%; }
.ov-art .sps-rules-svg { width: min(100%, 300px); }

/* ---------- the match ---------- */
#sps-stage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 10px 12px;
}
.sps-scores { flex: none; width: min(100%, 560px); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sps-side { display: flex; align-items: center; gap: 8px; }
.sps-side.friend { flex-direction: row-reverse; }
.sps-who { display: flex; flex-direction: column; gap: 2px; }
.sps-side.friend .sps-who { align-items: flex-end; }
.sps-name { font-size: var(--bz-text-m); font-weight: var(--bz-weight-head); color: var(--bz-ink); }
.sps-pips { display: flex; gap: 5px; }
.sps-pips i { width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--bz-star-edge); background: transparent; }
.sps-pips i.on { background: var(--bz-star); }
#sps-friend-face { display: flex; width: 64px; height: 64px; }
#sps-friend-face svg { width: 100%; height: 100%; }
.sps-kid-mark { display: flex; width: 48px; height: 48px; }
.sps-kid-mark svg { width: 100%; height: 100%; }

#sps-arena {
  flex: 1 1 auto;
  min-height: 0;
  width: min(100%, 560px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  justify-items: center;
  gap: 4px;
  max-height: 260px;
}
.sps-slot {
  width: min(100%, 190px, 30vh);
  aspect-ratio: 1;
  border-radius: 28px;
  background: var(--bz-surface);
  box-shadow: var(--bz-shadow-s);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}
.sps-slot:empty { background: transparent; box-shadow: inset 0 0 0 3px var(--bz-brand-edge); }
.sps-slot svg { width: 86%; height: 86%; }
#sps-friend-hand svg { transform: scaleX(-1); }
.sps-say { min-width: 2.6em; text-align: center; font-size: var(--bz-text-xl); font-weight: var(--bz-weight-brand); color: var(--bz-group-ink); }
#sps-arena.won #sps-kid-hand, #sps-arena.lost #sps-friend-hand { box-shadow: 0 0 0 5px var(--bz-star), var(--bz-shadow-s); transform: scale(1.03); }
#sps-arena.won #sps-friend-hand, #sps-arena.lost #sps-kid-hand { opacity: 0.5; filter: grayscale(0.6); transform: scale(0.88); }
.sps-slot { position: relative; }
.sps-won-star { position: absolute; top: -18px; right: -14px; width: 54px; height: 54px; animation: sps-star 0.45s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.sps-won-star svg { width: 100%; height: 100%; fill: var(--bz-star); stroke: var(--bz-star-edge); stroke-width: 1.2; stroke-linejoin: round; filter: drop-shadow(0 3px 0 #e0a100); }
@keyframes sps-star { from { transform: scale(0.2) rotate(-30deg); } to { transform: none; } }
.sps-slot.shake { animation: sps-shake 0.43s ease-in-out; }
@keyframes sps-shake { 30% { transform: translateY(-18px) rotate(-6deg); } 60% { transform: translateY(4px); } }

.sps-result { flex: none; width: min(100%, 560px); display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 84px; }
#sps-why { flex: none; display: flex; width: 80px; height: 80px; }
#sps-why:empty { display: none; }
#sps-why svg { width: 100%; height: 100%; }
.sps-status { margin: 0; font-size: var(--bz-text-m); font-weight: var(--bz-weight-head); line-height: 1.3; color: var(--bz-ink); text-wrap: balance; }
#sps-arena.won ~ .sps-result .sps-status { color: var(--bz-group-ink); }

.sps-hands { flex: none; width: min(100%, 560px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sps-hands .btn { flex-direction: column; min-height: 112px; padding: 6px 4px; gap: 0; font-size: var(--bz-text-m); font-weight: var(--bz-weight-head); }
.sps-hand-art { display: flex; width: 78px; height: 78px; }
.sps-hand-art svg { width: 100%; height: 100%; }
.sps-hands .btn.picked { background: var(--bz-group-tint); color: var(--bz-group-ink); box-shadow: 0 0 0 3px var(--bz-group-acc), var(--bz-shadow-s); }
.sps-hands .btn:disabled { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .sps-slot, .sps-slot.shake, .sps-won-star { animation: none; transition: none; }
}

/* short sideways phones: the hands to pick in a column on the right */
@media (orientation: landscape) and (max-height: 520px) {
  #screen-sps { flex-direction: row; }
  #sps-stage { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 1fr auto; align-items: center; padding: 0 10px 6px; gap: 4px 12px; }
  .sps-scores { grid-column: 1; grid-row: 1; width: 100%; }
  #sps-arena { grid-column: 1; grid-row: 2; width: 100%; max-height: none; }
  .sps-slot { width: min(30vh, 150px); }
  .sps-result { grid-column: 1; grid-row: 3; min-height: 56px; width: 100%; }
  #sps-why { width: 56px; height: 56px; }
  .sps-hands { grid-column: 2; grid-row: 1 / span 3; width: auto; grid-template-columns: 1fr; gap: 6px; }
  .sps-hands .btn { flex-direction: row; min-height: 0; height: min(29vh, 96px); padding: 0 12px 0 6px; gap: 4px; }
  .sps-hand-art { width: min(24vh, 64px); height: min(24vh, 64px); }
  #sps-friend-face { width: 48px; height: 48px; }
}
