/* =============== Go Fish: phone =============== */
#gofish.screen { height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; padding: 10px 12px 8px; gap: 6px; }
#gofish .bj-status { flex-shrink: 0; font-size: 15px; min-height: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#gofish .header .chips { white-space: nowrap; }
.gf-body {
  flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; gap: 6px; padding: 8px;
  border-radius: 22px; border: 5px solid var(--rail); background: radial-gradient(ellipse at 50% 40%, var(--felt-1), var(--felt-2) 90%);
  box-shadow: inset 0 0 22px rgba(0, 0, 0, 0.5); overflow: hidden;
}
/* the other players: a row of buttons, tap one to ask them */
.gf-opps { display: flex; gap: 5px; justify-content: center; flex-shrink: 0; }
.gf-opp {
  flex: 1 1 0; min-width: 0; max-width: 110px; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 5px 3px; border-radius: 12px; border: 2px solid rgba(255, 255, 255, 0.12); background: rgba(0, 0, 0, 0.22);
  color: var(--text); font: inherit; box-shadow: none; width: auto; min-height: 0; transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.gf-opp-name { font-weight: 900; font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gf-opp-cards { font-size: 12px; font-weight: 800; display: flex; align-items: center; gap: 3px; }
.gf-mini-back { display: inline-block; width: 9px; height: 13px; border-radius: 2px; background: #b3202c; border: 1px solid #fff; }
.gf-opp-books { font-size: 11px; color: var(--accent); font-weight: 800; }
.gf-opp.turn { border-color: rgba(245, 197, 66, 0.6); }
.gf-opp.can { border-color: rgba(255, 255, 255, 0.45); cursor: pointer; animation: gf-nudge 1.6s ease-in-out infinite; }
.gf-opp.picked { border-color: var(--accent); background: rgba(245, 197, 66, 0.22); animation: none; transform: translateY(-2px); }
.gf-opp.asked { border-color: #ff8a80; background: rgba(255, 138, 128, 0.18); }
.gf-opp.out { opacity: 0.4; }
@keyframes gf-nudge { 50% { border-color: rgba(255, 255, 255, 0.8); } }
.reduce-motion .gf-opp.can { animation: none; }

/* the middle: pond on the left, what just happened in the middle, your books on the right */
.gf-center { flex: 1 1 0; min-height: 70px; display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; gap: 4px; }
.gf-pond { display: flex; flex-direction: column; align-items: center; gap: 3px; border-radius: 10px; padding: 3px; }
.gf-pond-stack { position: relative; width: 38px; height: calc(38px * 1.4 + 8px); }
.gf-pond-stack .card { --w: 38px; position: absolute; left: calc(var(--i, 0) * 2px); bottom: calc(var(--i, 0) * 2px); }
.gf-pond-count { font-size: 11px; font-weight: 800; color: rgba(255, 255, 255, 0.8); white-space: nowrap; }
.gf-pond.fishing { cursor: pointer; box-shadow: 0 0 0 2px var(--accent), 0 0 16px rgba(245, 197, 66, 0.6); animation: gf-fish 1.1s ease-in-out infinite; }
@keyframes gf-fish { 50% { transform: translateY(-4px); } }
.reduce-motion .gf-pond.fishing { animation: none; }
.gf-stage { display: flex; align-items: center; justify-content: center; min-width: 0; height: 100%; }
.gf-show { display: flex; justify-content: center; }
.gf-show .card { --w: min(15vw, 58px); margin-left: -18px; }
.gf-show .card:first-child { margin-left: 0; }
.gf-show .card:nth-child(2) { animation-delay: 0.12s; }
.gf-show .card:nth-child(3) { animation-delay: 0.24s; }
.gf-show.to-me .card { animation: gf-in-mine 0.55s ease-out both; }
.gf-show.from-me .card { animation: gf-out-mine 0.6s ease-in 0.7s forwards; }
.gf-show.lucky .card { box-shadow: 0 0 0 3px #7ee08a, 0 0 22px rgba(126, 224, 138, 0.8); }
@keyframes gf-in-mine { from { transform: translateY(-40px) scale(0.6); opacity: 0; } }
@keyframes gf-out-mine { to { transform: translateY(-60px) scale(0.5); opacity: 0; } }
.reduce-motion .gf-show .card { animation: none !important; }
.gf-asking { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; }
.gf-asking .gf-q { font-size: 12px; font-weight: 800; color: rgba(255, 255, 255, 0.8); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gf-asking b { font-size: 22px; font-weight: 900; color: var(--accent); }
.gf-mybooks { display: flex; flex-wrap: wrap; gap: 2px; justify-content: center; align-content: center; max-height: 100%; overflow: hidden; }
.gf-mybooks.none { font-size: 11px; color: rgba(255, 255, 255, 0.6); font-weight: 700; text-align: center; }
.gf-book { min-width: 18px; height: 22px; padding: 0 2px; border-radius: 4px; background: #fff; color: #1a1a1a; font-weight: 900; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }

/* your hand: a fan that always fits the row. gofish-phone.js places every group and card with `translate`
   (they ease into place); --cw is the card width. Room on top for the pills and the raised cards */
.gf-hand {
  --cw: min(16vw, 60px);
  position: relative; flex: 0 0 auto; height: calc(var(--cw) * 1.4 + 40px); margin: 0 -4px; overflow: visible;
  touch-action: none; cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.gf-group {
  position: absolute; left: 0; bottom: 4px; width: var(--cw); height: calc(var(--cw) * 1.4);
  --pick: 0px; --lift: 0px; --grow: 1;
  transform: translateY(calc(-1 * (var(--pick) + var(--lift)))) scale(var(--grow)); transform-origin: 50% 100%;
  transition: translate 0.18s ease-out, transform 0.18s ease-out;
}
.gf-group .card { --w: var(--cw); position: absolute; left: 0; bottom: 0;
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.35), 0 3px 6px rgba(0, 0, 0, 0.35); transition: translate 0.18s ease-out; }
.gf-hand.instant .gf-group, .gf-hand.instant .gf-group .card { transition: none; }
/* while you slide your finger, follow it closely (a shorter ease) */
.gf-hand.holding .gf-group, .gf-hand.holding .gf-group .card { transition-duration: 0.09s; }
.reduce-motion .gf-group, .reduce-motion .gf-group .card { transition: none; }
/* how the cards under your finger stand out (gfFanStyle): raised, bigger, or both */
.gf-hand.holding[data-fan="lift"] .gf-group { --lift: calc(var(--near) * 16px); }
.gf-hand.holding[data-fan="grow"] .gf-group { --grow: calc(1 + var(--near) * 0.14); }
.gf-hand.holding[data-fan="both"] .gf-group { --lift: calc(var(--near) * 10px); --grow: calc(1 + var(--near) * 0.1); }
/* in your hand the rank and suit sit in the top left corner, so they show when the cards overlap */
.gf-hand .card:not(.back) { align-items: flex-start; justify-content: flex-start; padding: calc(var(--w) * 0.05) 0 0 calc(var(--w) * 0.06); gap: 0; }
.gf-hand .card .rank { font-size: calc(var(--w) * 0.3); font-weight: 900; letter-spacing: -0.04em; }
.gf-hand .card .suit { font-size: calc(var(--w) * 0.26); padding-left: 0.04em; }
.gf-group.picked, .gf-group.asked { --pick: 12px; }
.gf-group.picked .card { box-shadow: 0 0 0 3px var(--accent), 0 6px 12px rgba(0, 0, 0, 0.5); }
.gf-group.asked .card { box-shadow: 0 0 0 3px #ff8a80, 0 6px 12px rgba(0, 0, 0, 0.5); }
/* the pill sits centred above its group; --gw is the group's width as drawn (set by gofish-phone.js) */
.gf-badge { position: absolute; top: -11px; left: calc(var(--gw, 100%) / 2); transform: translateX(-50%); z-index: 3; font-size: 10px; font-weight: 900; padding: 1px 5px; border-radius: 8px; background: var(--accent); color: #2a1e00; white-space: nowrap; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
/* while you hold, the pills and tags of the squeezed groups far from your finger fade out so they don't crowd */
.gf-hand.holding .gf-badge, .gf-hand.holding .gf-hint { opacity: calc(var(--near) * 3); transition: opacity 0.12s; }
/* who asked for it: a tag across the bottom of the group */
.gf-hint { position: absolute; bottom: 3px; left: 3px; width: calc(var(--gw, 100%) - 6px); min-width: 34px; z-index: 3; font-size: 9px; font-weight: 800; padding: 1px 3px; border-radius: 6px; background: #4fb3e8; color: #062030; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; box-sizing: border-box; }
.gf-empty { flex: 1; text-align: center; font-weight: 800; color: rgba(255, 255, 255, 0.7); padding: 20px 0; align-self: center; }

/* the right of the middle: your books, and under them the Tap to hide circle (always in the same spot) */
.gf-side { position: relative; align-self: stretch; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 4px; min-height: 0; }
.gf-side .gf-mybooks { flex: 1 1 0; min-height: 0; }
.gf-hide {
  flex-shrink: 0; width: 54px; height: 54px; min-height: 0; border-radius: 50%; padding: 4px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  background: rgba(0, 0, 0, 0.35); border: 2px solid rgba(255, 255, 255, 0.35); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 1.15; white-space: normal; text-align: center;
}
.gf-hide.on { border-color: var(--accent); color: var(--accent); }

.gf-dock { flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; }
.gf-line { text-align: center; font-weight: 700; font-size: 14px; min-height: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gf-line b { color: var(--accent); }
#gfBtn { height: 72px; font-size: 26px; font-weight: 900; border-radius: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#gfBtn[data-kind="gofish"] { background: #4fb3e8; color: #062030; }
#gfBtn[data-kind="fish"] { background: #4fb3e8; color: #062030; }
.gf-clock { text-align: center; font-size: 12px; color: var(--muted); font-weight: 700; min-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* =============== Go Fish: TV =============== */
.gf-tv { display: flex; flex-direction: column; overflow: hidden; }
.gf-table {
  flex: 1; margin: 0 1.5vw 1.5vh; border-radius: 3vw; border: 1vw solid var(--rail); min-height: 0;
  background: radial-gradient(ellipse at 50% 40%, var(--felt-1), var(--felt-2) 85%); box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5);
  display: grid; grid-template-columns: 1fr 21vw; gap: 1.5vw; padding: 2vh 2vw;
}
.gf-tv-main { display: flex; flex-direction: column; gap: 1.5vh; min-height: 0; min-width: 0; }
.gf-tv-seats { display: grid; gap: 1vw; flex-shrink: 0; }
.gf-seat {
  display: flex; flex-direction: column; align-items: center; gap: 0.6vh; border-radius: 1.5vw; padding: 1vh 0.5vw; min-width: 0;
  border: 0.25vw solid transparent; background: rgba(0, 0, 0, 0.18); transition: border-color 0.3s, box-shadow 0.3s;
}
.gf-seat.turn { border-color: var(--accent); box-shadow: 0 0 2.2vw rgba(245, 197, 66, 0.5); }
.gf-seat.asked { border-color: #ff8a80; box-shadow: 0 0 2vw rgba(255, 138, 128, 0.45); }
.gf-seat.out { opacity: 0.4; }
.gf-seat-name { font-size: 1.6vw; font-weight: 900; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gf-seat-fan { display: flex; justify-content: center; height: calc(3.4vw * 1.4); align-items: flex-end; }
.gf-seat-fan .card { --w: 3.4vw; margin-left: -2.6vw; transform: rotate(calc((var(--i) - var(--mid)) * 4deg)); transform-origin: 50% 120%; }
.gf-seat-fan .card:first-child { margin-left: 0; }
.gf-seat-count { font-size: 1.2vw; font-weight: 800; color: rgba(255, 255, 255, 0.8); }
/* the books in one row: each slot shrinks to fit the seat, so the cards overlap more as books pile up */
.gf-seat-books { display: flex; justify-content: center; min-height: calc(2.4vw * 1.4); width: 100%; padding-right: 2.4vw; }
.gf-bk { flex: 0 1 2.6vw; min-width: 0.5vw; }
.gf-seat-books .card { --w: 2.4vw; }
.gf-seat-books .card.gf-pairbook { box-shadow: 0.35vw -0.35vw 0 -0.05vw #e8e4d8, 0.35vw -0.35vw 0 0.05vw rgba(0, 0, 0, 0.35), 0 0.3vw 0.6vw rgba(0, 0, 0, 0.4); }
.gf-seat-books .card.new { animation: gf-book-in 0.6s ease-out both; }
@keyframes gf-book-in { from { transform: scale(1.8); opacity: 0; } }
.gf-seat-score { font-size: 1.2vw; font-weight: 900; color: var(--accent); }

.gf-tv-stage { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2vh; }
.gf-msg { text-align: center; font-size: 2.8vw; font-weight: 900; min-height: 3.6vw; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); }
.gf-msg .sub { display: block; font-size: 1.3vw; color: rgba(255, 255, 255, 0.75); font-weight: 700; }
.gf-msg .rank { color: var(--accent); }
.gf-tv-row { display: flex; align-items: center; justify-content: center; gap: 4vw; min-height: calc(7vw * 1.4); }
.gf-tv-pond { display: flex; flex-direction: column; align-items: center; gap: 0.8vh; }
.gf-tv-pond .gf-pond-stack { width: 6vw; height: calc(5vw * 1.4 + 1.5vw); }
.gf-tv-pond .gf-pond-stack .card { --w: 5vw; left: calc(var(--i, 0) * 0.3vw); bottom: calc(var(--i, 0) * 0.3vw); }
.gf-tv-pond .gf-pond-count { font-size: 1.3vw; }
.gf-tv-pond.fishing .gf-pond-stack { animation: gf-fish 1.1s ease-in-out infinite; }
.reduce-motion .gf-tv-pond.fishing .gf-pond-stack { animation: none; }
.gf-tv-show { display: flex; justify-content: center; min-width: 7vw; }
.gf-tv-show:empty { display: none; }
.gf-tv-show .card { --w: 7vw; margin-left: -3vw; }
.gf-tv-show .card:first-child { margin-left: 0; }
.gf-tv-show .card:nth-child(2) { animation-delay: 0.15s; }
.gf-tv-show .card:nth-child(3) { animation-delay: 0.3s; }
.gf-tv-show.lucky .card { box-shadow: 0 0 0 0.3vw #7ee08a, 0 0 2.4vw rgba(126, 224, 138, 0.8); }
/* the cards handed over fly from the giver's seat to the asker's (--fx/--fy and --tx/--ty set by gofish-tv.js) */
.gf-tv-show.fly .card { animation: gf-tv-fly 1.4s ease-in-out both; }
.gf-tv-show.flown .card { animation: none; opacity: 0; }
@keyframes gf-tv-fly {
  0% { transform: translate(var(--fx, 0), var(--fy, -20vh)) scale(0.4); opacity: 0; }
  30%, 65% { transform: none; opacity: 1; }
  100% { transform: translate(var(--tx, 0), var(--ty, -20vh)) scale(0.35); opacity: 0; }
}
.reduce-motion .gf-tv-show.fly .card { animation: none; }
.gf-tv-timer { flex-shrink: 0; width: 60%; align-self: center; }

/* stops above the scan-to-join box in the bottom right corner */
.gf-tv-side { display: flex; flex-direction: column; gap: 1vh; min-height: 0; margin-bottom: 20vh; background: rgba(0, 0, 0, 0.22); border-radius: 1.5vw; padding: 1.5vh 1vw; overflow: hidden; }
.gf-side-title { font-size: 1.3vw; font-weight: 900; color: var(--accent); text-transform: uppercase; letter-spacing: 0.1vw; }
.gf-history { display: flex; flex-direction: column; gap: 0.8vh; min-height: 0; }
.gf-hist { font-size: 1.15vw; font-weight: 700; line-height: 1.3; padding: 0.7vh 0.6vw; border-radius: 0.8vw; background: rgba(255, 255, 255, 0.06); }
.gf-hist:first-child { background: rgba(255, 255, 255, 0.14); }
.gf-hist b { font-weight: 900; }
.gf-hist .r { color: var(--accent); font-weight: 900; }
.gf-hist .res { display: block; font-size: 1vw; color: rgba(255, 255, 255, 0.7); }
.gf-hist .res.gave { color: #7ee08a; }
.gf-hist .res.lucky { color: #7ee08a; }
.gf-hist.none { color: rgba(255, 255, 255, 0.55); background: none; }
.gf-info { font-size: 1.2vw; color: var(--muted); font-weight: 700; }

/* ---------- TV: the house frame (tv-frame.js). The seats along the top are a name pill over the cards (no box); the
   game's name is printed in the middle; the pond under it. The ask history is the side panel's extra. ---------- */
.gf-tv .gf-table { margin: 0; display: flex; position: relative; }
.gf-tv .gf-tv-main { flex: 1; }
.gf-tv .gf-seat { background: none; border: 0; box-shadow: none; }
.gf-tv .gf-seat .hf-name { font-size: 1.5vw; max-width: 100%; }
.gf-tv .gf-seat.turn > .hf-name { box-shadow: 0 0 0 0.2vw var(--accent), 0 0 1.2vw rgba(245, 197, 66, 0.8); }
.gf-tv .gf-seat.asked > .hf-name { box-shadow: 0 0 0 0.2vw #ff8a80, 0 0 1.2vw rgba(255, 138, 128, 0.7); }
.gf-tv .gf-seat-count { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }
.gf-tv .hf-felt-name { top: 40%; --hf-name: 3.6vw; }
.gf-tv .gf-tv-stage { justify-content: flex-end; padding-bottom: 2vh; }
.gf-tv .hf-extra .gf-hist { font-size: 0.95vw; color: var(--text); padding: 0.5vh 0.5vw; margin-bottom: 0.5vh; }
.gf-tv .hf-extra .gf-hist .res { display: inline; font-size: 0.85vw; }
