/* Фантазиум — on top of quiz/css/style.css (shared layout, lobby, toasts, timer bar).
   This file is loaded only on Фантазиум pages, so :root recolours the shared Quiz styles:
   emerald night with gold, like the emblem — the Quiz is violet, it must not look the same. */

:root {
  --bg: #051311;
  --bg-grad: radial-gradient(120% 80% at 20% 0%, #0f4c43 0%, #0a2622 45%, #051311 100%);
  --head-bg: rgba(10, 38, 34, .96);
  --violet: #059669;        /* buttons, sliders */
  --violet-soft: #6ee7b7;   /* scores, focus */
  --indigo: #0d9488;
  --blue: #2dd4bf;          /* focus outlines, timer bar */
  --fz-gold: #fcd34d;       /* highlights: clue, timer, chosen deck */
  --fz-mint: #6ee7b7;       /* the player's own token */
}
.fz .logo-title, .tv-wrap.fz .tv-logo {
  background: linear-gradient(135deg, var(--fz-gold), #fde68a 40%, var(--fz-mint));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
body.fz-noscroll { overflow: hidden; }

/* ── Phone game ────────────────────────────────────── */
.fz-topbar-right { display: inline-flex; align-items: center; gap: .5rem; }
.fz-music {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: transparent;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  filter: grayscale(1);
  opacity: .6;
}
.fz-music.on { filter: none; opacity: 1; box-shadow: 0 0 0 2px var(--fz-gold); }
.fz-timer {
  min-width: 2.2rem;
  text-align: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--fz-gold);
}
.fz-timer.urgent { color: var(--red-soft); }
.fz-kick {
  margin-left: auto;
  min-width: 36px;
  min-height: 36px;
  border: none;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}
.fz-add-bot { width: 100%; margin-top: .6rem; }
.fz-banner { color: var(--muted); font-size: .95rem; margin: .6rem 0 .4rem; }
.fz-banner b { color: var(--text); }
.fz-round { color: var(--fz-gold); font-weight: 700; }
.fz-clue {
  margin: .3rem 0 .8rem;
  padding: .9rem 1rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(252, 211, 77, .16), rgba(13, 148, 136, .16));
  box-shadow: inset 0 0 0 1px rgba(252, 211, 77, .35);
  font-size: 1.35rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.fz-aloud { font-size: 1rem; font-weight: 600; color: var(--muted); }
.fz-status { line-height: 1.45; margin-bottom: .8rem; }
.fz-status b { color: var(--fz-gold); }
.fz-outcome { text-align: center; color: var(--muted); margin-bottom: .9rem; line-height: 1.4; }
.fz-mine { width: 100%; display: flex; flex-direction: column; align-items: center; gap: .4rem; margin-bottom: 1rem; cursor: zoom-in; }
.fz-mine-label { font-size: .85rem; color: var(--muted); }
.fz-art.fz-mine-img { width: 42%; max-width: 200px;
  box-shadow: 0 0 0 2px var(--fz-gold), 0 8px 24px rgba(0, 0, 0, .4); }
.fz-grid-title { font-size: .85rem; color: var(--muted); margin-bottom: .45rem; }
.fz-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .55rem;
  margin-bottom: 1.2rem;
}
.fz-grid-reveal { grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.fz-card {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 12px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}
/* A card: its picture in the frame of its deck. The window of every frame is 6% from each edge,
   so the whole 2:3 picture is shown; docs/art/codex_frames.py makes the frames. */
.fz-art {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: 6% / 4%;
  background: #0f3a35;
}
.fz-art > img {
  position: absolute;
  left: 6%;
  top: 6%;
  width: 88%;
  height: 88%;
  object-fit: cover;
}
@supports not (aspect-ratio: 2 / 3) {   /* old TV WebViews */
  .fz-art { height: 0; padding-top: 150%; }
}
.fz-art::after {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: center / 100% 100% no-repeat;
  pointer-events: none;
}
.fz-art[data-deck='dreams']::after { background-image: url('../img/frames/dreams.webp'); }
.fz-art[data-deck='fantasy']::after { background-image: url('../img/frames/fantasy.webp'); }
.fz-art[data-deck='games']::after { background-image: url('../img/frames/games.webp'); }
.fz-art[data-deck='kino']::after { background-image: url('../img/frames/kino.webp'); }
.fz-art[data-deck='night']::after { background-image: url('../img/frames/night.webp'); }
.fz-art[data-deck='memes']::after { background-image: url('../img/frames/memes.webp'); }
.fz-art[data-deck='everyday']::after { background-image: url('../img/frames/everyday.webp'); }
.fz-art[data-deck='ny_films']::after { background-image: url('../img/frames/ny_films.webp'); }
.fz-art[data-deck='ny_ages']::after { background-image: url('../img/frames/ny_ages.webp'); }
.fz-art[data-deck='memes_faces']::after { background-image: url('../img/frames/memes_faces.webp'); }
.fz-card-img { box-shadow: 0 4px 14px rgba(0, 0, 0, .35); }
.fz-card.active .fz-card-img { box-shadow: 0 0 0 2px rgba(252, 211, 77, .55), 0 4px 14px rgba(0, 0, 0, .35); }
.fz-card.active:active { transform: scale(.97); }
.fz-card.own .fz-card-img { opacity: .55; }
.fz-card.voted .fz-card-img { box-shadow: 0 0 0 3px var(--mint), 0 4px 14px rgba(0, 0, 0, .35); }
.fz-card.story .fz-card-img { box-shadow: 0 0 0 3px var(--amber), 0 0 22px rgba(251, 191, 36, .45); }
.fz-num {
  position: absolute;
  top: .35rem;
  left: .35rem;
  min-width: 1.7rem;
  height: 1.7rem;
  padding: 0 .35rem;
  border-radius: 999px;
  background: rgba(5, 19, 17, .85);
  font-weight: 800;
  font-size: .95rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.fz-tag {
  position: absolute;
  bottom: .35rem;
  left: 50%;
  transform: translateX(-50%);
  padding: .1rem .5rem;
  border-radius: 999px;
  background: rgba(5, 19, 17, .85);
  font-size: .75rem;
  white-space: nowrap;
}
.fz-tag-vote { color: var(--mint); }
.fz-owner { margin-top: .35rem; font-weight: 700; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fz-card.own .fz-owner { color: var(--fz-gold); }
.fz-card.revealed.own .fz-card-img { opacity: 1; }
.fz-voters { display: flex; flex-wrap: wrap; gap: .15rem; min-height: 1.6rem; align-items: center; }
.fz-novote { font-size: .78rem; color: var(--faint); }
.fz-delta { font-weight: 800; color: var(--green-soft); font-variant-numeric: tabular-nums; }
.fz-delta.neg { color: var(--red-soft); }
.fz .scoreboard { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1rem; width: 100%; }
.fz-decks { display: flex; flex-direction: column; gap: .5rem; width: 100%; }
.fz-deck-card {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  width: 100%;
  padding: .75rem .9rem;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  text-align: left;
}
button.fz-deck-card { cursor: pointer; }
#cfgDecks, #summaryDecks { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.6rem, 1fr)); }
#summaryDecks { margin-bottom: .9rem; }
.fz-decks-title { margin-top: 1rem; }
.fz-deck-slot { position: relative; display: flex; }
.fz-deck-slot .fz-deck-card { flex-direction: row; align-items: center; gap: .55rem; padding: .45rem .55rem; height: 100%; }
.fz-deck-slot .fz-deck-name { font-size: .9rem; line-height: 1.2; }
/* 👁 shows a deck's seven samples; on the host's tiles the tile itself picks the deck. */
.fz-deck-peek {
  position: absolute; left: .2rem; bottom: .2rem;   /* on the corner of the cover, clear of the name */
  width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(10, 20, 18, .78); color: #fff; font-size: .85rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
}
#summaryDecks .fz-deck-peek { pointer-events: none; }
.fz-deck-cover { flex: none; width: 2.3rem; }
.fz-deck-card.active { border-color: var(--fz-gold); background: rgba(252, 211, 77, .12); }
#summaryDeck { margin-bottom: .9rem; }
.fz-deck-name { font-weight: 800; }
.fz-deck-check { color: var(--fz-gold); margin-left: .25rem; }
.fz-deck-desc { font-size: .88rem; color: var(--muted); line-height: 1.35; }
.fz-admin { display: flex; justify-content: center; padding: .5rem 0 calc(1.5rem + var(--safe-b)); }

/* Big card sheet */
.fz-sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(.8rem + var(--safe-t)) 1rem calc(.8rem + var(--safe-b));
  background: rgba(3, 14, 12, .9);
  backdrop-filter: blur(6px);
}
.fz-sheet[hidden] { display: none; }
.fz-sheet-inner {
  width: 100%;
  max-width: 420px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .6rem;
}
.fz-sheet-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.fz-sheet-back {
  min-height: 44px;
  padding: .45rem .95rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.fz-sheet-back:active { background: var(--surface-2); }
.fz-sheet-title { color: var(--muted); font-weight: 700; }
.fz-sheet-card {
  width: min(100%, calc(52vh * 2 / 3));
  width: min(100%, calc(52dvh * 2 / 3));
  flex: none;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
  touch-action: pan-y;
  user-select: none;
}
.fz-sheet-form { width: 100%; display: flex; flex-direction: column; gap: .5rem; }
.fz-sheet-form input {
  width: 100%;
  min-height: var(--tap);
  padding: .7rem .9rem;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}
.fz-sheet-hint { min-height: 1em; font-size: .85rem; color: var(--muted); text-align: center; }
.fz-sheet-actions { display: flex; gap: .5rem; align-items: stretch; justify-content: center; }
.fz-sheet-actions .btn-start { margin-top: 0; flex: 1; }
.fz-sheet-actions .btn-ghost { min-width: 52px; font-size: 1.5rem; }
.fz-sheet-actions [hidden] { display: none; }

@media (min-width: 520px) {
  .fz-grid { grid-template-columns: repeat(4, 1fr); }
  .fz-grid-reveal { grid-template-columns: repeat(3, 1fr); }
}

/* ── TV ────────────────────────────────────────────── */
.tv-wrap.fz { background: var(--bg-grad); }
/* Centred while the screen fits, from the top when it doesn't (like `safe center`, which old
   WebViews lack): the auto margins take the free space and collapse when there is none. */
.tv-wrap.fz .tv-body { justify-content: flex-start; overflow: hidden; }
.tv-wrap.fz .tv-body > :first-child { margin-top: auto; }
.tv-wrap.fz .tv-body > :last-child { margin-bottom: auto; }
.tv-fz-reveal .tv-fz-clue { font-size: 3.8vh; }
.tv-fz-reveal.tv-fz-head { margin-bottom: .8vh; }
.tv-fz-head { text-align: center; margin-bottom: 2.5vh; }
.tv-fz-teller { font-size: 3vh; color: var(--muted); }
.tv-fz-teller b { color: var(--text); }
.tv-fz-clue {
  margin-top: 1.2vh;
  font-size: 6vh;
  font-weight: 900;
  line-height: 1.15;
  background: linear-gradient(135deg, #fff, var(--fz-gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.tv-fz-clue.aloud { font-size: 4vh; }
.tv-fz-wait { font-size: 3vh; color: var(--muted); margin-top: 1.5vh; }
.tv-fz-wait.tv-fz-step { color: var(--fz-gold); font-weight: 700; }
.tv-fz-next { font-size: 2.2vh; }
/* One row of cards: as big as the screen allows, always 2:3, so nothing is cropped. */
.tv-fz-table {
  --n: 5;
  --gap: 1.4vw;
  --max-h: 56vh;
  display: flex;
  justify-content: center;
  gap: var(--gap);
  flex-wrap: nowrap;
  width: 100%;
}
/* The results share the screen with the map: the cards go in one or two rows of their column. */
.tv-fz-table.reveal { --max-h: 38vh; --gap: 1vw; flex-wrap: wrap; }
.tv-fz-table.reveal.rows { --max-h: 20vh; row-gap: .2vh; width: calc(var(--n) * var(--max-h) * 2 / 3 + (var(--n) - 1) * var(--gap)); max-width: 100%; }
.tv-fz-table.reveal .tv-fz-card { width: min(calc((100% - (var(--n) - 1) * var(--gap)) / var(--n)), calc(var(--max-h) * 2 / 3)); gap: .4vh; }
.tv-fz-table.reveal .fz-num { top: .6vh; left: .6vh; height: 3.6vh; min-width: 3.6vh; font-size: 2.2vh; }
.tv-fz-table.reveal .tv-fz-owner { font-size: 2vh; }
.tv-fz-card {
  position: relative;
  flex: 0 0 auto;
  width: 11vw;
  width: min(calc((92vw - (var(--n) - 1) * var(--gap)) / var(--n)), calc(var(--max-h) * 2 / 3));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1vh;
}
.tv-fz-card > .fz-art { box-shadow: 0 1.2vh 3vh rgba(0, 0, 0, .5); }
.tv-fz-card.story > .fz-art { box-shadow: 0 0 0 .6vh var(--amber), 0 0 5vh rgba(251, 191, 36, .5); }
.tv-fz-card.dim > .fz-art { opacity: .75; }
.tv-fz-card .fz-num { top: 1vh; left: 1vh; height: 5vh; min-width: 5vh; font-size: 3vh; }
.tv-fz-owner { font-size: 2.6vh; font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-fz-back {
  height: 30vh;
  aspect-ratio: 2 / 3;
  border-radius: 1.6vh;
  background: repeating-linear-gradient(45deg, #134e4a 0 2vh, #0e3b35 2vh 4vh);
  box-shadow: inset 0 0 0 .4vh rgba(252, 211, 77, .5), 0 1vh 3vh rgba(0, 0, 0, .4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 7vh;
}
.tv-fz-back.empty { opacity: .2; }
.tv-fz-progress { display: flex; justify-content: center; gap: 2vw; flex-wrap: wrap; }
.tv-fz-progress.many { flex-wrap: nowrap; gap: 1.4vw; }
.tv-fz-progress.many .tv-fz-back { height: 22vh; font-size: 5vh; }
.tv-fz-progress.many .tv-fz-who > span { max-width: 10.5vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-wrap.fz .tv-lobby-side { max-width: none; min-width: 0; }   /* the row of decks scrolls inside it */
.tv-fz-info { display: flex; flex-direction: column; gap: inherit; }
.tv-fz-lobbyfoot { display: flex; justify-content: space-between; gap: 2vw; font-size: 2vh; }
/* The decks stand in one row: as many as fit, the rest scroll in so the tile in focus is in the
   middle (tv.js). Only that tile opens; a deck chosen on the phone has a gold name, not a frame. */
.tv-fz-decks { position: relative; max-width: 100%; display: flex; gap: .8vw; overflow: hidden; scroll-behavior: smooth; padding: .8vh .6vw; margin: 0 -.6vw; }
.tv-fz-decks.more { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 3%, #000 97%, transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 3%, #000 97%, transparent 100%); }
.tv-fz-deckcard {
  flex: 1 0 9.6vw;
  min-width: 9.6vw;
  display: flex;
  flex-direction: column;
  gap: .8vh;
  padding: 1.4vh .7vw;
  border-radius: 1.6vh;
  background: rgba(255, 255, 255, .05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
  font-size: 2.2vh;
  line-height: 1.3;
  opacity: .5;
  outline: none;
  cursor: pointer;
  transition: opacity .3s, box-shadow .3s, background .3s;
}
.tv-fz-deckcard.on { opacity: .85; }
.tv-fz-deckcard.on > b { color: var(--fz-gold); }
.tv-fz-deckcard:focus {
  flex: 2 0 21vw;
  opacity: 1;
  background: rgba(255, 255, 255, .1);
  box-shadow: inset 0 0 0 .4vh #fff, 0 1vh 4vh rgba(0, 0, 0, .45);
}
.tv-fz-desc { display: none; -webkit-box-orient: vertical; -webkit-line-clamp: 7; overflow: hidden; color: var(--muted); font-size: 1.9vh; }
.tv-fz-deckcard:focus .tv-fz-desc { display: -webkit-box; }
.tv-fz-check { color: var(--fz-gold); }
.tv-fz-check[hidden] { display: none; }

/* The fan: three cards, seven when the deck is in focus. */
.tv-fz-fan { position: relative; height: 19.5vh; margin-bottom: .6vh; }
.tv-fz-fancard {
  position: absolute;
  left: 50%;
  bottom: 2.4vh;   /* the outer cards of the open fan dip below it */
  width: 10vh;
  margin-left: -5vh;
  z-index: var(--z);
  transform: rotate(calc(var(--c) * 13deg));
  transform-origin: 50% 115%;
  transition: transform .55s cubic-bezier(.2, .8, .2, 1), opacity .3s;
}
.tv-fz-fancard .fz-art { box-shadow: 0 .6vh 1.6vh rgba(0, 0, 0, .5); }
.tv-fz-fancard.outer { opacity: 0; }
.tv-fz-deckcard:focus .tv-fz-fancard {
  opacity: 1;
  transform: translateX(calc(var(--k) * 1.5vh)) rotate(calc(var(--k) * 11deg));
}
.tv-fz-deckcard.leafing .tv-fz-fancard { opacity: 0; }

/* OK: the deck's cards go round from right to left. */
.tv-fz-strip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity .4s;
  pointer-events: none;
}
.tv-fz-deckcard.leafing .tv-fz-strip { opacity: 1; }
.tv-fz-stripmove {
  display: flex;
  width: max-content;
  height: 100%;
  align-items: center;
  animation: tv-fz-leaf var(--secs) linear infinite;
  will-change: transform;
}
.tv-fz-stripcard { flex: none; width: 11vh; padding-right: 1vh; box-sizing: content-box; }
@keyframes tv-fz-leaf { to { transform: translateX(-50%); } }
.tv-music { max-width: 24vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tv-fz-who { display: flex; flex-direction: column; align-items: center; gap: 1vh; font-size: 2.4vh; }
.tv-fz-who.dc { opacity: .4; }
.tv-fz-outcome { font-size: 3vh; color: var(--muted); text-align: center; margin-top: 2vh; }
.tv-fz-over { gap: 1vh; text-align: center; }
.tv-fz-over .tv-scoreboard { width: 100%; max-width: 70vh; }
.tv-sb-gain.neg { color: var(--red-soft); }
.fz .config-row select { min-width: 0; max-width: 62%; }

/* ── Card motion (phone): deal, flip, drag, fly to the table ── */
.fz-card { transform-style: preserve-3d; }
.fz-back {
  display: none;
  position: absolute;
  inset: 0;
  aspect-ratio: 2 / 3;
  border-radius: 12px;
  background:
    url('../img/emblem.png') center / 46% no-repeat,
    radial-gradient(circle at 50% 40%, rgba(252, 211, 77, .35), transparent 60%),
    linear-gradient(145deg, #134e4a, #0a2622 60%, #0e3b35);
  box-shadow: inset 0 0 0 2px rgba(252, 211, 77, .45), 0 4px 14px rgba(0, 0, 0, .35);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  transform: rotateY(180deg);
}
/* pan-y: a quick swipe over the hand scrolls the page; a held card is dragged (game.js). */
#cardGrid .fz-card { touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.fz-card.fz-lifted .fz-card-img { opacity: .18; filter: grayscale(.6); }

/* New cards in the hand fly in from below, one after another. */
.fz-deal { animation: fz-deal .55s cubic-bezier(.2, .9, .25, 1.05) both; animation-delay: calc(var(--i, 0) * 80ms); }
@keyframes fz-deal {
  from { opacity: 0; transform: translateY(70vh) rotate(-14deg) scale(.7); }
  70% { opacity: 1; }
  to { opacity: 1; transform: none; }
}
/* Table cards land face down and turn over. */
.fz-flip-in { animation: fz-flip .7s cubic-bezier(.3, .7, .25, 1) both; animation-delay: calc(var(--i, 0) * 120ms); }
.fz-flip-in .fz-back { display: block; }
.fz-flip-in > :not(.fz-back) { -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.fz-grid { perspective: 1000px; }
@keyframes fz-flip {
  from { transform: rotateY(180deg) translateY(-18px); }
  to { transform: rotateY(360deg); }
}
.fz-land { animation: fz-land .5s cubic-bezier(.2, .9, .25, 1.1) both; }
@keyframes fz-land { from { opacity: 0; transform: translateY(-30px) scale(.8) rotate(4deg); } to { opacity: 1; transform: none; } }

/* The card that follows the finger. */
.fz-ghost { position: fixed; z-index: 60; pointer-events: none; perspective: 900px; will-change: transform; }
.fz-ghost-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.fz-ghost .fz-art {
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .55), 0 0 0 2px rgba(252, 211, 77, .6);
}
.fz-ghost .fz-back { display: block; height: 100%; }
.fz-back[data-deck='mix'], .tv-fz-back[data-deck='mix'] { background: url('../img/frames/back_mix.webp') center / 100% 100% no-repeat; }
.fz-back[data-deck='dreams'], .tv-fz-back[data-deck='dreams'] { background: url('../img/frames/back_dreams.webp') center / 100% 100% no-repeat; }
.fz-back[data-deck='fantasy'], .tv-fz-back[data-deck='fantasy'] { background: url('../img/frames/back_fantasy.webp') center / 100% 100% no-repeat; }
.fz-back[data-deck='games'], .tv-fz-back[data-deck='games'] { background: url('../img/frames/back_games.webp') center / 100% 100% no-repeat; }
.fz-back[data-deck='kino'], .tv-fz-back[data-deck='kino'] { background: url('../img/frames/back_kino.webp') center / 100% 100% no-repeat; }
.fz-back[data-deck='night'], .tv-fz-back[data-deck='night'] { background: url('../img/frames/back_night.webp') center / 100% 100% no-repeat; }
.fz-back[data-deck='memes'], .tv-fz-back[data-deck='memes'] { background: url('../img/frames/back_memes.webp') center / 100% 100% no-repeat; }
.fz-back[data-deck='everyday'], .tv-fz-back[data-deck='everyday'] { background: url('../img/frames/back_everyday.webp') center / 100% 100% no-repeat; }
.fz-back[data-deck='ny_films'], .tv-fz-back[data-deck='ny_films'] { background: url('../img/frames/back_ny_films.webp') center / 100% 100% no-repeat; }
.fz-back[data-deck='ny_ages'], .tv-fz-back[data-deck='ny_ages'] { background: url('../img/frames/back_ny_ages.webp') center / 100% 100% no-repeat; }
.fz-back[data-deck='memes_faces'], .tv-fz-back[data-deck='memes_faces'] { background: url('../img/frames/back_memes_faces.webp') center / 100% 100% no-repeat; }
body.fz-dragging { overscroll-behavior: none; }

/* Where a dragged card is played. */
.fz-drop {
  position: fixed;
  z-index: 55;
  top: calc(var(--safe-t, 0px) + 64px);
  left: 50%;
  transform: translateX(-50%);
  width: min(78vw, 340px);
  padding: .8rem 1rem;
  display: flex;
  align-items: center;
  gap: .8rem;
  border-radius: 18px;
  border: 2px dashed rgba(252, 211, 77, .7);
  background: rgba(10, 38, 34, .92);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  animation: fz-drop-in .25s ease-out both;
  transition: transform .15s, border-color .15s, background .15s;
}
.fz-drop[hidden] { display: none; }
.fz-drop.hot { transform: translateX(-50%) scale(1.06); border-color: var(--mint); border-style: solid; background: linear-gradient(rgba(52, 211, 153, .22), rgba(52, 211, 153, .22)), #0a2622; }
.fz-drop-slot { width: 42px; height: 63px; border-radius: 8px; border: 2px solid rgba(255, 255, 255, .35); flex: none; }
.fz-drop.hot .fz-drop-slot { border-color: var(--mint); box-shadow: 0 0 16px rgba(52, 211, 153, .6); }
.fz-drop-label { font-weight: 800; }
@keyframes fz-drop-in { from { opacity: 0; transform: translateX(-50%) translateY(-12px); } to { opacity: 1; transform: translateX(-50%); } }

.fz-sheet-card { transform-origin: center; }
.fz-sheet-inner { perspective: 1200px; }

@media (prefers-reduced-motion: reduce) {
  .fz-deal, .fz-flip-in, .fz-land, .fz-drop { animation: none; }
  .fz-flip-in .fz-back { display: none; }
}

/* ── Score board: a winding track with a token per player ── */
.fz-board { position: relative; width: 100%; aspect-ratio: var(--ratio, 2 / 1); }
.fz-board > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.fz-track { fill: none; stroke: #1f5b52; stroke-width: 26; stroke-linecap: round; stroke-linejoin: round; }
.fz-track-glow { fill: none; stroke: rgba(252, 211, 77, .18); stroke-width: 44; stroke-linecap: round; stroke-linejoin: round; }
.fz-board.strip .fz-track { stroke-width: 10; }
.fz-board.strip .fz-track-glow { stroke-width: 20; }
.fz-cell circle { fill: #0f3a35; stroke: rgba(252, 211, 77, .45); stroke-width: 3; }
.fz-cell.m circle { fill: #134e4a; stroke: var(--fz-gold); }
.fz-cell.start circle { fill: #1f3b5c; stroke: #60a5fa; }
.fz-cell.finish circle { fill: #5c3a0b; stroke: var(--amber, #fbbf24); stroke-width: 5; }
.fz-board.strip .fz-cell circle { stroke-width: 2; }
.fz-cell-num { fill: rgba(255, 255, 255, .85); font: 800 26px system-ui, sans-serif; text-anchor: middle; dominant-baseline: central; }
.fz-cell-num.small { font-size: 18px; }
.fz-cell-flag { font-size: 34px; text-anchor: middle; dominant-baseline: central; }
.fz-board.strip .fz-cell-flag { font-size: 20px; }
.fz-tokens { position: absolute; inset: 0; pointer-events: none; }
.fz-token {
  position: absolute;
  width: 8.5%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  transition: left .2s ease-out, top .2s ease-out;
  z-index: 1;
}
.fz-board.strip .fz-token { width: 5.2%; }
.fz-board.wide .fz-token { width: 4.6%; }
.fz-token-av {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #0a2622;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .55), 0 3px 8px rgba(0, 0, 0, .5);
  overflow: hidden;
}
.fz-token-av .av-img, .fz-token-av img { width: 92%; height: 92%; }
.fz-token.me { z-index: 20 !important; }
.fz-token.me .fz-token-av { box-shadow: 0 0 0 3px var(--fz-mint), 0 0 14px rgba(110, 231, 183, .7); }
.fz-token.teller .fz-token-av { box-shadow: 0 0 0 3px var(--amber, #fbbf24), 0 3px 8px rgba(0, 0, 0, .5); }
.fz-token.dc { opacity: .45; }
.fz-token.hop { animation: fz-hop .22s ease-out; }
@keyframes fz-hop { 40% { transform: translate(-50%, -82%) scale(1.12); } }
.fz-token.winner .fz-token-av { box-shadow: 0 0 0 3px var(--amber, #fbbf24), 0 0 22px rgba(251, 191, 36, .9); }
.fz-token-name {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 2px;
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
  text-shadow: 0 1px 3px #000;
}
.fz-token-delta {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0 .35em;
  border-radius: 999px;
  background: var(--green, #22c55e);
  color: #06210f;
  font-weight: 900;
  font-size: .85rem;
  white-space: nowrap;
  animation: fz-delta 2.6s ease-out forwards;
}
.fz-token-delta.neg { background: var(--red, #ef4444); color: #fff; }
@keyframes fz-delta { 0% { opacity: 0; transform: translate(-50%, 6px); } 12% { opacity: 1; transform: translate(-50%, -4px); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -14px); } }
.fz-board-goal { position: absolute; right: 0; top: -1.25rem; font-size: .75rem; font-weight: 700; color: var(--muted); }

/* The painted board: the world of a deck, with the numbers and tokens on its road. */
.fz-board.map { background: center / cover no-repeat; border-radius: 14px; box-shadow: 0 6px 22px rgba(0, 0, 0, .45); }
.fz-map-num { fill: #2a2550; font: 800 42px system-ui, sans-serif; text-anchor: middle; dominant-baseline: central; }
.fz-map-num.m { fill: #b4431a; }
.fz-map-num.word { font-size: 21px; letter-spacing: .02em; }
.fz-map-finish { fill: rgba(251, 191, 36, .35); stroke: #fbbf24; stroke-width: 5; }
.fz-map-flag { font-size: 52px; text-anchor: middle; }
.fz-board.map .fz-token { width: 7.4%; }
.fz-board.map .fz-token.me { z-index: 200 !important; }

/* Phone: a strip above the cards during the round, the full board after it. */
.fz-mini { align-self: stretch; width: 100%; box-sizing: border-box; position: relative; margin: .2rem 0 1rem; padding: 1.1rem .5rem .3rem; border-radius: 14px; background: rgba(255, 255, 255, .04); cursor: pointer; }
.fz-mini::after { content: '⤢'; position: absolute; top: .3rem; left: .55rem; font-size: .8rem; color: var(--faint); }
.fz-mini.open { padding: .6rem .4rem .8rem; }
.fz-mini.open::after { content: '⤡'; }
.fz-board-big { align-self: stretch; width: 100%; box-sizing: border-box; margin: .2rem 0 1rem; padding: .7rem .4rem 1.4rem; border-radius: 16px; background: rgba(255, 255, 255, .04); }
.fz-board-big .fz-token-delta { font-size: 1rem; }

/* TV */
.tv-wrap.fz .fz-board { max-height: 100%; }
/* The map of the game takes one side of the screen, the story, the results or the winner the other. */
.tv-fz-beside { display: flex; align-items: center; justify-content: center; gap: 2vw; width: 100%; height: 100%; }
.tv-fz-main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6vh; }
.tv-fz-boardwrap { flex: 0 0 auto; width: min(46vw, 81vh); }
.fz-token.crowded .fz-token-name { display: none; }
.tv-wrap.fz .fz-token-name { font-size: 1.9vh; }
.tv-wrap.fz .fz-token-delta { font-size: 2.6vh; }
.tv-wrap.fz .fz-cell-num { font-size: 24px; }

@media (prefers-reduced-motion: reduce) {
  .fz-token { transition: none; }
  .fz-token.hop, .fz-token-delta { animation: none; }
}

/* Shared Quiz styles with hard-coded violet or blue: the emerald versions. */
.avatar-chip.active { background: rgba(45, 212, 191, .18); box-shadow: 0 0 0 2px rgba(45, 212, 191, .35); }
.session-player.me { border-color: rgba(110, 231, 183, .5); background: rgba(110, 231, 183, .14); }
.lobby-player.me { box-shadow: inset 0 0 0 1px rgba(110, 231, 183, .45); }
.sb-row.sb-me { background: rgba(5, 150, 105, .22); box-shadow: inset 0 0 0 1px rgba(110, 231, 183, .5); }
.pause-row { background: linear-gradient(180deg, rgba(10, 38, 34, 0) 0%, rgba(10, 38, 34, .94) 28%); }
.toast { background: rgba(8, 34, 30, .97); border-color: rgba(110, 231, 183, .5); }
.toast-warn, .toast-error { border-color: rgba(251, 191, 36, .6); border-left-color: var(--amber); }
.btn-enter.btn-join { background: linear-gradient(135deg, #0d9488, #0f766e); }

/* Engines without aspect-ratio (old TV WebViews, iOS < 15): explicit sizes instead. */
@supports not (aspect-ratio: 1 / 1) {
  .tv-fz-back { width: 20vh; }
  .tv-fz-progress.many .tv-fz-back { width: 14.6vh; }
  .fz-board { height: 0; padding-bottom: var(--ratio-pad, 50%); }
  .fz-token { height: 0; padding-bottom: 8.5%; }
  .fz-board.strip .fz-token { padding-bottom: 5.2%; }
  .fz-board.wide .fz-token { padding-bottom: 4.6%; }
  .fz-token-av { position: absolute; inset: 0; }
}

/* ── Always on the screen: the players in turn order, their scores, who has moved ── */
.fz-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .12rem; font-size: .7rem; line-height: 1.2; }
.fz .session-players { overflow: visible; flex-wrap: wrap; padding: 0 0 .3rem; margin: 0; }
.fz-chip {
  display: inline-flex;
  align-items: center;
  gap: .25em;
  padding: .1em .42em .1em .12em;
  border-radius: 999px;
  background: rgba(255, 255, 255, .07);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
  white-space: nowrap;
}
.fz-chip .player-avatar { min-width: 0; margin: 0; font-size: inherit; line-height: 0; flex: none; }
.fz-chip .player-avatar .av-img { width: 1.5em; height: 1.5em; }
.fz-chip-name { max-width: 4.7em; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
.fz-chip-score { font-variant-numeric: tabular-nums; color: var(--text); }
.fz-chip-mark { font-weight: 800; color: var(--muted); }
.fz-chip-next { color: var(--muted); opacity: .6; }
.fz-chip.me { box-shadow: inset 0 0 0 1px var(--fz-mint); }
.fz-chip.teller { background: rgba(252, 211, 77, .16); box-shadow: inset 0 0 0 1px rgba(252, 211, 77, .6); }
.fz-chip.teller .fz-chip-name { color: var(--text); }
.fz-chip.done { background: rgba(110, 231, 183, .16); }
.fz-chip.done .fz-chip-mark { color: var(--fz-mint); }
.fz-chip.dc { opacity: .4; }

/* The scoring rules in one small block. */
.fz-rules-mini {
  display: flex;
  flex-wrap: wrap;
  gap: .05rem .6rem;
  padding: .35rem 0 0;
  font-size: .64rem;
  line-height: 1.35;
  color: var(--muted);
}
.fz-rules-mini b { color: var(--fz-gold); font-weight: 700; }

/* Who voted for whom and how far everybody moves. */
.fz-summary {
  width: 100%;
  margin-bottom: .9rem;
  padding: .55rem .7rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, .05);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
  font-size: .85rem;
}
.fz-sum-title { display: flex; justify-content: space-between; margin-bottom: .3rem; font-size: .72rem; color: var(--muted); }
.fz-sum-row { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) auto; gap: .5rem; align-items: center; padding: .22rem 0; border-top: 1px solid rgba(255, 255, 255, .07); }
.fz-sum-row.teller { color: var(--fz-gold); }
.fz-sum-row.me .fz-sum-who { font-weight: 800; }
.fz-sum-who, .fz-sum-what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fz-sum-what { color: var(--muted); }
.fz-sum-what .av-img { width: 1.2em; height: 1.2em; }
.fz-sum-who .av-img { width: 1.4em; height: 1.4em; }
.fz-sum-found { color: var(--fz-mint); font-weight: 700; }
.fz-sum-got { color: var(--fz-gold); }
.fz-sum-none { opacity: .6; }
.fz-sum-points { min-width: 1.8em; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.fz-sum-points.plus { color: var(--fz-mint); }

/* The TV's version of the same. */
.tv-fz-clock { min-width: 3vw; font-size: 2.6vh; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--fz-gold); text-align: right; }
.tv-fz-clock::before { content: '⏱ '; font-size: .85em; }
.tv-fz-clock.urgent { color: var(--red-soft); }
.tv-fz-order { justify-content: center; gap: .6vh .4vw; padding: 1vh 3vw 0; font-size: 2vh; flex: none; }
.tv-fz-order .fz-chip-name { max-width: 9em; }
.tv-fz-rules { justify-content: center; gap: .2vh 1.6vw; padding: .6vh 3vw 1vh; font-size: 1.75vh; flex: none; }
.tv-fz-main .fz-summary { width: 100%; box-sizing: border-box; margin: 0; padding: .6vh .8vw; border-radius: 1.2vh; font-size: 1.85vh; line-height: 1.15; }
.tv-fz-main .fz-summary.compact { column-count: 2; column-gap: 2vw; }
.tv-fz-main .fz-sum-row { break-inside: avoid; }
.fz-summary.compact .fz-sum-row { grid-template-columns: minmax(0, 1fr) auto; }
.tv-fz-voters { display: flex; flex-wrap: wrap; justify-content: center; gap: .3vh; min-height: 3.2vh; max-width: 100%; }
.tv-fz-voters .av-img { width: 3vh; height: 3vh; }
.tv-fz-main .fz-sum-title { font-size: 1.6vh; margin-bottom: .3vh; column-span: all; }
.tv-fz-main .fz-sum-row { padding: .1vh 0; }
/* The tokens stay under the sticky button of a step. */
.fz-board { isolation: isolate; }
