/* ---------- tokens ---------- */
:root {
  --ink: #2b2650;
  --muted: #6b6890;
  --bg: #f4f0fc;
  --card: #ffffff;
  --primary: #6b4fdb;
  --primary-hover: #5a3fc4;
  --soft: #ebe7f8;
  --accent: #f4d675;
  --ok: #2b9a6b;
  --danger: #c8404f;
  --radius: 18px;
  --lift: 0 4px 0 var(--ink);
  --pal-1: #f08a8a; --pal-2: #f2b46b; --pal-3: #efd977; --pal-4: #8fcf9c;
  --pal-5: #6fc7c0; --pal-6: #86aee8; --pal-7: #b7a0e6; --pal-8: #eba0cc;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; background: var(--bg); color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 16px; line-height: 1.4;
}
h1, h2, h3 { margin: 0; line-height: 1.15; }
a { color: inherit; }
:focus-visible { outline: 3px solid #ffb800; outline-offset: 2px; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  font: inherit; font-weight: 700; color: var(--ink); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 18px; cursor: pointer; white-space: nowrap;
  background: #fff; border: 3px solid var(--ink); border-radius: 999px; box-shadow: var(--lift);
  transition: transform .06s, box-shadow .06s, background .12s;
}
.btn:hover { background: #fbf1cf; }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { color: var(--danger); }
.btn.big { font-size: 22px; min-height: 56px; padding: 10px 36px; }
.btn.small { min-height: 36px; padding: 4px 12px; font-size: 14px; box-shadow: 0 3px 0 var(--ink); }
.btn.ghost { border-color: transparent; box-shadow: none; background: transparent; }
.btn.ghost:hover { background: var(--soft); }
.btn.icon { padding: 0; width: 44px; }
.btn.small.icon { width: 36px; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

/* ---------- forms ---------- */
label.field { display: grid; gap: 6px; font-weight: 700; }
input[type=text], input[type=search], select, textarea {
  font: inherit; font-weight: 400; color: var(--ink); width: 100%;
  background: #fff; border: 3px solid var(--ink); border-radius: 14px; padding: 10px 14px;
  min-height: 44px;
}
textarea { resize: vertical; line-height: 1.5; }
.hint { color: var(--muted); font-size: 14px; font-weight: 400; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20; background: var(--bg);
  border-bottom: 3px solid var(--ink);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px;
}
.logo { font-size: 24px; font-weight: 800; text-decoration: none; margin-right: 8px; }
.top .grow { flex: 1; min-width: 140px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 16px; }

/* ---------- folder chips ---------- */
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px;
  scroll-snap-type: x proximity; scrollbar-width: thin;
}
.chip {
  flex: none; scroll-snap-align: start; font: inherit; font-weight: 700; color: var(--ink);
  min-height: 40px; padding: 6px 16px; cursor: pointer; white-space: nowrap;
  background: #fff; border: 3px solid var(--ink); border-radius: 999px;
}
.chip[aria-selected=true] { background: var(--ink); color: #fff; }
.chip.add { border-style: dashed; color: var(--muted); border-color: var(--muted); }
.chip.drop-over { background: var(--accent); transform: scale(1.06); }
.chip .n { opacity: .65; font-weight: 400; margin-left: 4px; }
.folder-bar { display: flex; align-items: center; gap: 8px; min-height: 36px; margin: 0 0 6px; color: var(--muted); }

/* ---------- set cards ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.set-card {
  background: var(--card); border: 3px solid var(--ink); border-radius: var(--radius);
  box-shadow: var(--lift); overflow: hidden; display: flex; flex-direction: column;
  transition: transform .12s;
}
.set-card:hover { transform: translateY(-3px); }
.set-card.dragging { opacity: .4; }
.set-band { display: flex; align-items: flex-start; justify-content: space-between; gap: 6px;
  padding: 12px 10px 12px 16px; background: var(--band, var(--soft)); border-bottom: 3px solid var(--ink); }
.set-emoji { font-size: 56px; line-height: 1; }
.set-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.set-title { font-size: 21px; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 14px; }
.set-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 8px; }
.set-actions .btn.primary { flex: 1; }
.star[aria-pressed=true] { color: #d99a00; }

.empty {
  text-align: center; padding: 40px 16px; background: #fff; border: 3px dashed var(--muted);
  border-radius: var(--radius); display: grid; gap: 12px; justify-items: center;
}
.empty .big-emoji { font-size: 64px; }
.empty p { margin: 0; color: var(--muted); max-width: 46ch; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- dialog / menu / toast ---------- */
dialog.dlg { border: 4px solid var(--ink); border-radius: 24px; padding: 0; max-width: min(92vw, 640px); width: 100%;
  background: #fff; color: var(--ink); box-shadow: 0 8px 0 var(--ink); }
dialog.dlg::backdrop { background: rgba(34, 29, 74, .6); }
.dlg-body { padding: 22px; display: grid; gap: 14px; animation: pop .22s ease-out; }
.dlg-body h2 { font-size: 22px; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }

.emoji-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.emoji-pick button { font-size: 24px; width: 44px; height: 44px; border-radius: 12px; border: 3px solid transparent; background: var(--soft); cursor: pointer; }
.emoji-pick button[aria-pressed=true] { border-color: var(--ink); background: var(--accent); }

.menu { position: absolute; z-index: 90; min-width: 220px; background: #fff; border: 3px solid var(--ink);
  border-radius: 14px; box-shadow: var(--lift); padding: 6px; display: grid; }
.menu-item { font: inherit; text-align: left; background: none; border: 0; border-radius: 8px; padding: 10px 12px; min-height: 44px; cursor: pointer; color: var(--ink); }
.menu-item:hover { background: var(--soft); }
.menu-item.danger { color: var(--danger); }

#toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(120px); z-index: 120;
  background: var(--ink); color: #fff; padding: 10px 14px 10px 20px; border-radius: 999px; font-weight: 700;
  display: flex; gap: 12px; align-items: center; transition: transform .25s; max-width: 92vw; }
#toast.show { transform: translateX(-50%); }
#toast button { font: inherit; font-weight: 800; color: var(--accent); background: none; border: 0; cursor: pointer; padding: 4px 8px; min-height: 36px; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 170; }

/* ---------- editor ---------- */
.panel { background: #fff; border: 3px solid var(--ink); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel > summary { cursor: pointer; font-weight: 800; font-size: 18px; min-height: 32px; }
.steps { margin: 12px 0 0; padding-left: 0; list-style: none; display: grid; gap: 14px; counter-reset: s; }
.steps > li { counter-increment: s; display: grid; gap: 8px; padding-left: 40px; position: relative; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 50%;
  background: var(--primary); color: #fff; font-weight: 800; display: grid; place-items: center; }
.opts { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.prompt-box { font-size: 14px; background: #f1eefa; min-height: 150px; }
.head-fields { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .head-fields { grid-template-columns: 2fr 1fr; } }
.preview { width: 100%; border-collapse: collapse; font-size: 15px; }
.preview th, .preview td { text-align: left; padding: 6px 10px; border-bottom: 2px solid #e6e1fa; overflow-wrap: anywhere; }
.preview th { color: var(--muted); font-size: 13px; }
.preview td.n { color: var(--muted); width: 36px; }
.warn { background: #fff4d6; border: 2px solid #e0b100; border-radius: 12px; padding: 8px 12px; font-size: 14px; margin-top: 8px; }
.savebar { position: sticky; bottom: 0; z-index: 15; background: var(--bg); border-top: 3px solid var(--ink);
  padding: 10px 16px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.savebar .status { color: var(--muted); font-size: 14px; flex: 1; min-width: 100px; }

/* ---------- play page ---------- */
.gamebar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; }
.seg { display: inline-flex; border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; background: #fff; }
.seg button { font: inherit; font-weight: 700; color: var(--ink); background: none; border: 0; padding: 6px 14px; min-height: 38px; cursor: pointer; }
.seg button[aria-pressed=true] { background: var(--ink); color: #fff; }
.stage { display: grid; justify-items: center; gap: 14px; padding: 8px 0 24px; }
.controls { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; justify-content: center; }
.toggle { display: flex; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; min-height: 44px; }
.toggle input { width: 22px; height: 22px; accent-color: var(--primary); }
.notice { text-align: center; color: var(--muted); }

.wheel-canvas { display: block; cursor: pointer; touch-action: manipulation; }

.tiles { width: 100%; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); }
.tile { aspect-ratio: 1; font: inherit; font-size: clamp(24px, 6vw, 40px); font-weight: 800; color: var(--ink);
  border: 3px solid var(--ink); border-radius: 16px; box-shadow: var(--lift); cursor: pointer;
  transition: transform .08s, opacity .2s; }
.tile:hover:not(:disabled) { transform: translateY(-3px) rotate(-2deg); }
.tile:active:not(:disabled) { transform: translateY(3px); box-shadow: none; }
.tile:disabled { opacity: .35; box-shadow: none; cursor: default; background: #ddd !important; }

.card-text { text-align: center; font-weight: 800; overflow-wrap: anywhere; padding: 18px 0; transition: transform .16s, opacity .16s; }
.card-text.flipping { transform: rotateX(90deg); opacity: 0; }
.card-caption { justify-self: center; justify-self: center; font-weight: 800; padding: 4px 16px; border: 3px solid var(--ink); border-radius: 999px; background: var(--soft); }
.card-note { text-align: center; color: var(--muted); font-size: 18px; min-height: 1.4em; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- team mode (tiles) ---------- */
.teams { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; width: 100%; }
.team { flex: 1 1 150px; max-width: 220px; background: #fff; border: 3px solid var(--ink); border-radius: 16px;
  padding: 8px 10px 10px; display: grid; gap: 4px; justify-items: center; transition: transform .15s, box-shadow .15s; }
.team::before { content: ""; height: 8px; width: 100%; border-radius: 999px; background: var(--tc); margin-bottom: 2px; }
.team.on { transform: translateY(-4px) scale(1.04); box-shadow: 0 6px 0 var(--ink); background: #fffbe6; }
.team .name { font: inherit; font-weight: 800; text-align: center; border: 0; background: transparent; width: 100%;
  color: var(--ink); padding: 2px; min-height: 30px; border-radius: 8px; }
.team .name:hover, .team .name:focus { background: var(--soft); }
.team .score { font-size: 36px; font-weight: 800; line-height: 1; }
.team .adj { display: flex; gap: 6px; }
.turn-tag { font-size: 12px; font-weight: 800; color: var(--primary); min-height: 16px; }
.tile.bonus:disabled, .tile.ok:disabled { font-size: clamp(28px, 7vw, 44px); }
.big-emoji-line { font-size: 72px; text-align: center; line-height: 1.1; }

/* ---------- pre-game setup screen ---------- */
.setup { width: min(560px, 100%); margin: 8px auto 24px; background: #fff; border: 3px solid var(--ink);
  border-radius: 24px; box-shadow: var(--lift); padding: 22px; display: grid; gap: 16px; }
.setup-head { text-align: center; }
.setup-head .big-emoji-line { font-size: 56px; }
.set-group { display: grid; gap: 8px; }
.set-group .seg { justify-self: start; flex-wrap: wrap; }

/* ---------- full screen: only the game stays ---------- */
.fs-exit { display: none; }
body.fs .fs-exit { display: grid; position: fixed; top: 10px; right: 10px; z-index: 40; opacity: .35; }
body.fs .fs-exit:hover, body.fs .fs-exit:focus-visible { opacity: 1; }
body.fs .top, body.fs .tabs { display: none; }
body.fs .wrap { max-width: none; padding: 10px; }
body.fs .stage { padding: 0; gap: 10px; }
body.fs .spin-controls { display: none; }

.tile { font-size: var(--tile-fs, 32px); }
.teams.many .team { flex-basis: 90px; padding: 6px 6px 8px; }
.teams.many .team .score { font-size: 24px; }
.teams.many .team .name { font-size: 13px; }
.team .name { font-weight: 800; text-align: center; overflow-wrap: anywhere; line-height: 1.15; padding: 2px; }

/* ---------- tile suspense: shake, then flash ---------- */
.tile.shaking, .bxcell.shaking, .bx.shaking { animation: tile-shake .9s linear forwards; pointer-events: none; z-index: 2; position: relative; }
.tile.popping { animation: tile-pop .26s ease-out forwards; pointer-events: none; z-index: 2; position: relative; }
@keyframes tile-shake {
  0%   { transform: none; }
  12%  { transform: translateX(-2px) rotate(-3deg) scale(1.02); }
  25%  { transform: translateX(2px) rotate(3deg) scale(1.03); }
  38%  { transform: translateX(-3px) rotate(-5deg) scale(1.05); }
  50%  { transform: translateX(3px) rotate(5deg) scale(1.07); }
  62%  { transform: translateX(-4px) rotate(-7deg) scale(1.09); }
  75%  { transform: translateX(4px) rotate(7deg) scale(1.11); }
  88%  { transform: translateX(-5px) rotate(-9deg) scale(1.13); }
  100% { transform: translateX(5px) rotate(9deg) scale(1.15); }
}
@keyframes tile-pop {
  0%   { transform: scale(1.15); filter: brightness(1); }
  50%  { transform: scale(1.4); filter: brightness(1.35); }
  100% { transform: scale(1.5); filter: brightness(1.6); opacity: .2; }
}

/* variants: same idea (build-up, then flash), different personality */
.tile.shaking.v-wobble, .bxcell.shaking.v-wobble, .bx.shaking.v-wobble { animation-name: tile-wobble; animation-timing-function: ease-in-out; }
.tile.shaking.v-jump, .bxcell.shaking.v-jump, .bx.shaking.v-jump { animation-name: tile-jump;   animation-timing-function: ease-in; }
.tile.shaking.v-spin, .bxcell.shaking.v-spin, .bx.shaking.v-spin { animation-name: tile-spin;   animation-timing-function: cubic-bezier(.5, 0, 1, .6); }
.tile.shaking.v-pulse, .bxcell.shaking.v-pulse, .bx.shaking.v-pulse { animation-name: tile-pulse;  animation-timing-function: ease-in-out; }
@keyframes tile-wobble {
  0%   { transform: rotate(0); }
  15%  { transform: rotate(-8deg) scale(1.02); }
  35%  { transform: rotate(10deg) scale(1.05); }
  55%  { transform: rotate(-14deg) scale(1.09); }
  75%  { transform: rotate(16deg) scale(1.12); }
  100% { transform: rotate(-18deg) scale(1.15); }
}
@keyframes tile-jump {
  0%, 100% { transform: translateY(0) scale(1.15); }
  14% { transform: translateY(-6px); }
  28% { transform: translateY(0) scale(1.03); }
  42% { transform: translateY(-14px) scale(1.06); }
  56% { transform: translateY(0) scale(1.06); }
  72% { transform: translateY(-24px) scale(1.1); }
  86% { transform: translateY(0) scale(1.12); }
}
@keyframes tile-spin {
  0%   { transform: rotate(0) scale(1); }
  100% { transform: rotate(720deg) scale(1.15); }
}
@keyframes tile-pulse {
  0%, 100% { transform: scale(1.15); }
  10% { transform: scale(1.06); } 20% { transform: scale(1); }
  35% { transform: scale(1.08); } 45% { transform: scale(1.01); }
  58% { transform: scale(1.11); } 66% { transform: scale(1.03); }
  78% { transform: scale(1.14); } 86% { transform: scale(1.07); }
}

/* ---------- phones: don't waste the top third of the screen ---------- */
@media (max-width: 600px) {
  .top { position: static; }
  .wrap { padding-bottom: 96px; }
  .btn.fab { position: fixed; right: 16px; bottom: 16px; z-index: 30; box-shadow: 0 4px 0 var(--ink), 0 10px 24px rgba(43, 38, 80, .3); }
}
@media (max-width: 600px) { .hide-sm { display: none; } .top h1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .top .grow { min-width: 0; } }

/* ---------- simple start screen ---------- */
.setup .btn.big { width: 100%; }
.num-row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.setup .num-row .btn.big { width: auto; min-width: 64px; padding: 8px 14px; }
.more summary { cursor: pointer; color: var(--muted); font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.more[open] summary { margin-bottom: 8px; }

.from-tag { align-self: flex-start; font-size: 13px; font-weight: 700; color: var(--primary); background: var(--soft); border-radius: 999px; padding: 2px 10px; }

/* ---------- boxes (CSS-drawn gift boxes) ---------- */
.bxcell { font-size: var(--bs, 18px); width: 10em; aspect-ratio: 10 / 9.4; padding: 0; border: 0; background: none; cursor: pointer; }
.bxcell:hover:not(:disabled) .bx { transform: translateY(-.25em) rotate(-2deg); }
.bxcell:disabled { cursor: default; }
.bxcell.opened .bx { opacity: .5; }
.bxcell.opened .bx-lid { transform: translate(2.2em, -1.8em) rotate(26deg); }

.bx { position: relative; width: 100%; height: 100%; transition: transform .12s; }
.bx.big { font-size: 22px; width: 10em; height: 9.4em; }
.bx-body { position: absolute; left: .5em; right: .5em; bottom: 0; height: 6em; z-index: 2;
  background: var(--c); border: .22em solid var(--ink); border-radius: .5em; box-shadow: 0 .3em 0 var(--ink);
  display: grid; place-items: center; overflow: hidden; }
.bx-ribbon { position: absolute; top: 0; bottom: 0; left: 50%; width: 1.7em; transform: translateX(-50%);
  background: rgba(255, 255, 255, .55); border-left: .14em solid var(--ink); border-right: .14em solid var(--ink); }
.bx-num { position: relative; z-index: 1; min-width: 2.2em; height: 2.2em; padding: 0 .2em; display: grid; place-items: center;
  background: #fff; border: .18em solid var(--ink); border-radius: 50%; font-weight: 800; font-size: 1.4em; line-height: 1; }
.bx-lid { position: absolute; left: 0; right: 0; top: 2.3em; height: 2.3em; z-index: 3;
  background: color-mix(in srgb, var(--c) 72%, white); border: .22em solid var(--ink); border-radius: .5em;
  transform-origin: 12% 100%; transition: transform .5s cubic-bezier(.3, 1.5, .5, 1); }
.bx-bow { position: absolute; left: 50%; top: -1.05em; width: 2.6em; height: 1.2em; transform: translateX(-50%); }
.bx-bow::before, .bx-bow::after { content: ""; position: absolute; top: 0; width: 1.25em; height: 1.1em;
  background: #fff; border: .16em solid var(--ink); border-radius: 50% 50% 40% 40%; }
.bx-bow::before { left: 0; transform: rotate(-18deg); } .bx-bow::after { right: 0; transform: rotate(18deg); }
.bx.open .bx-lid { transform: translate(2.6em, -2.6em) rotate(32deg); }

.bx-item { position: absolute; left: 50%; bottom: 4.6em; z-index: 1; transform: translateX(-50%) scale(.3); opacity: 0;
  text-align: center; font-weight: 800; line-height: 1.15; }
.bx-item.emoji span { display: block; font-size: 5.2em; line-height: 1; }
.bx-item.text span { display: block; background: #fff; border: .12em solid var(--ink); border-radius: .5em;
  padding: .3em .6em; width: max-content; max-width: 11em; overflow-wrap: anywhere; box-shadow: 0 .12em 0 var(--ink); }
.bx.open .bx-item { animation: bx-pop .75s cubic-bezier(.2, 1.35, .4, 1) forwards; }
.bx-item.swap { transition: transform .16s, opacity .16s; transform: translateX(-50%) translateY(-4.5em) scaleY(0) !important; }
@keyframes bx-pop {
  0%   { transform: translateX(-50%) translateY(0) scale(.3); opacity: 0; }
  30%  { opacity: 1; }
  70%  { transform: translateX(-50%) translateY(-5.6em) scale(1.18); opacity: 1; }
  100% { transform: translateX(-50%) translateY(-4.5em) scale(1); opacity: 1; }
}
.bx-stage { display: grid; justify-items: center; padding: 8.5em 0 .8em; font-size: 22px; }
.bx-stage .bx { margin-top: .4em; }
dialog.dlg { max-height: 96vh; overflow-x: hidden; overflow-y: auto; }

.tiles { justify-content: center; }

/* ---------- box themes ---------- */
.t-chest .bx-body { background: repeating-linear-gradient(0deg, transparent 0 1.45em, rgba(43, 38, 80, .35) 1.45em 1.6em),
  color-mix(in srgb, var(--c) 30%, #9a6332); }
.t-chest .bx-ribbon { width: 1.3em; background: #f2c94c; }
.t-chest .bx-lid { background: color-mix(in srgb, var(--c) 30%, #b5763c); border-radius: 2.6em 2.6em .4em .4em / 2.3em 2.3em .4em .4em; }
.t-chest .bx-bow { top: auto; bottom: -.6em; width: 1.4em; height: 1.5em; background: #f2c94c; border: .16em solid var(--ink); border-radius: .3em; }
.t-chest .bx-bow::before, .t-chest .bx-bow::after { display: none; }
.t-crate .bx-body { background: color-mix(in srgb, var(--c) 28%, #d6ac74); }
.t-crate .bx-ribbon { background: rgba(255, 255, 255, .45); width: 1.4em; }
.t-crate .bx-lid { background: color-mix(in srgb, var(--c) 28%, #e6c594); }
.t-crate .bx-bow { display: none; }

/* warm glow and camera push when a big box opens */
.bx-stage { transition: transform 1.3s cubic-bezier(.2, .8, .2, 1); }
.bx-stage.push { transform: scale(1.1); }
.bx.big::before { content: ""; position: absolute; left: 50%; bottom: 3.4em; width: 13em; height: 13em; transform: translateX(-50%) scale(.2);
  background: radial-gradient(circle, rgba(255, 236, 140, .95), rgba(255, 236, 140, 0) 65%); opacity: 0; z-index: 0; pointer-events: none; }
.bx.big.open::before { animation: bx-glow 1.1s ease-out forwards; }
@keyframes bx-glow { 0% { opacity: 0; transform: translateX(-50%) scale(.2); } 40% { opacity: 1; } 100% { opacity: .75; transform: translateX(-50%) scale(1); } }

/* ---------- emoji builder ---------- */
dialog.dlg.wide { max-width: min(96vw, 760px); }
.emo-grid { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); max-height: 38vh; overflow: auto; padding: 2px; }
.emo { font: inherit; display: grid; justify-items: center; gap: 0; padding: 6px 2px; border: 3px solid var(--ink); border-radius: 12px;
  background: #fff; cursor: pointer; min-height: 64px; }
.emo .e { font-size: 28px; line-height: 1.1; }
.emo .w { font-size: 12px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emo.off { opacity: .3; border-style: dashed; }

.set-card.featured { border-width: 4px; }
.set-card.featured .set-emoji { font-size: 40px; letter-spacing: .05em; }

/* the main button of a long dialog must always be reachable */
dialog.dlg.wide .dlg-actions { position: sticky; bottom: 0; z-index: 5; background: #fff; padding: 10px 0 4px; border-top: 2px solid #ece7f8; margin-top: 4px; }

/* theme cards */
.theme-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
.theme-card { font: inherit; display: grid; justify-items: center; gap: 2px; padding: 8px 4px 6px; background: #fff; color: var(--ink);
  border: 3px solid var(--ink); border-radius: 14px; cursor: pointer; position: relative; min-height: 84px; transition: transform .08s; }
.theme-card:hover { transform: translateY(-2px); }
.theme-card .ti { font-size: 30px; line-height: 1.1; }
.theme-card .tn { font-weight: 700; font-size: 13px; text-align: center; line-height: 1.15; }
.theme-card .tc { position: absolute; top: 4px; right: 6px; font-size: 11px; color: var(--muted); }
.theme-card.on { background: var(--ink); color: #fff; box-shadow: 0 3px 0 var(--primary); }
.theme-card.on .tc { color: #cfc8f5; }
.emo-grid { max-height: 34vh; }

/* team counter on the start screen */
.counter { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.count-in { width: 72px; text-align: center; font-weight: 800; font-size: 20px; padding: 6px; }

/* ---------- slot machine ---------- */
.slot-wrap { font-size: var(--ss, 16px); display: grid; justify-items: center; gap: .9em; width: 100%; }
.slot { --cell: 8em; --win: 12.6em; --pad: calc((var(--win) - var(--cell)) / 2); position: relative; margin-right: 3.8em;
  background: linear-gradient(180deg, #e0566a 0%, #b73546 55%, #8f2637 100%); border: .3em solid var(--ink); border-radius: 2.4em 2.4em 1.2em 1.2em;
  padding: 0 1.2em 1.1em; box-shadow: 0 .5em 0 var(--ink), inset 0 .3em 0 rgba(255, 255, 255, .3); }
.marquee { margin: -.3em -1.5em 0; padding: .55em .8em .5em; background: linear-gradient(180deg, #fff3b0, #f1c232 50%, #b98a12);
  border: .3em solid var(--ink); border-radius: 2.4em 2.4em 1em 1em; text-align: center; display: grid; gap: .25em; }
.marquee-text { font-weight: 800; font-size: 1.5em; letter-spacing: .12em; color: var(--ink); white-space: nowrap; }
.bulbs { display: flex; justify-content: center; gap: .55em; }
.bulb { width: .55em; height: .55em; border-radius: 50%; background: #fffbe0; border: .1em solid var(--ink); display: block; box-shadow: 0 0 .35em rgba(255, 255, 255, .9); }
.slot.spinning .bulb { animation: chase .36s steps(2) infinite; }
.slot.spinning .bulb:nth-child(3n) { animation-delay: .12s; } .slot.spinning .bulb:nth-child(3n+1) { animation-delay: .24s; }
.slot.win .bulb { animation: chase .16s steps(2) infinite; }
@keyframes chase { 0% { background: #fffbe0; } 100% { background: #ff6b6b; box-shadow: 0 0 .5em #ff6b6b; } }

.frame { position: relative; margin-top: .9em; background: #2b2650; border: .3em solid #f1c232; border-radius: 1em; padding: .55em;
  box-shadow: 0 0 0 .14em var(--ink), inset 0 0 0 .14em var(--ink); }
.reels { display: flex; gap: .5em; }
.reel-win { width: 9em; height: var(--win); overflow: hidden; background: #fdfcff; border-radius: .5em; position: relative; }
.reel-win::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(43, 38, 80, .6), rgba(43, 38, 80, 0) 30%, rgba(43, 38, 80, 0) 70%, rgba(43, 38, 80, .6)); }
.reel-strip { will-change: transform; }
.reel-strip.fast { filter: blur(1.4px); }
.reel-cell { height: var(--cell); display: grid; place-items: center; align-content: center; text-align: center; padding: .4em; font-weight: 800; line-height: 1.1; color: var(--ink); }
.reel-cell .emoji { font-size: 4.6em; line-height: 1; }
.reel-cell .word { overflow-wrap: anywhere; }
.reel-cell.blank { background: radial-gradient(circle at 50% 45%, #fffbe0, #ffe27a 70%, #f6c944); }
.reel-cell.blank span { font-size: 4.2em; line-height: 1; animation: twinkle 1.6s ease-in-out infinite alternate; }
@keyframes twinkle { from { transform: scale(.88) rotate(-6deg); opacity: .8; } to { transform: scale(1.08) rotate(6deg); opacity: 1; } }
.reel-cell.unknown span { font-size: 5em; color: #b9b2e4; line-height: 1; }

.caps { display: flex; gap: .5em; justify-content: center; margin: .5em .55em 0; }
.reel-cap { width: 9em; min-height: 2.9em; color: #fff; font-weight: 800; text-align: center; line-height: 1.15; opacity: 0; transition: opacity .3s; overflow-wrap: anywhere; }
.reel-cap.show { opacity: 1; }
.reel-cap small { display: block; color: #ffd9de; font-weight: 400; font-size: .8em; }

.slot .panel { display: flex; align-items: center; justify-content: space-between; gap: 1em; margin-top: .6em; background: #6f1f2d;
  border: .22em solid var(--ink); border-radius: .8em; padding: .5em .9em; }
.led { background: #1a0d12; color: #ff4d4d; border: .15em solid var(--ink); border-radius: .45em; padding: .15em .8em .2em; text-align: center; min-width: 5.6em; }
.led small { display: block; font-size: .7em; letter-spacing: .15em; opacity: .8; }
.led-num { font: 800 2.2em/1 ui-monospace, Menlo, Consolas, monospace; text-shadow: 0 0 .35em #ff4d4d; }
.spin-btn { font: inherit; font-weight: 800; font-size: .95em; width: 3.6em; height: 3.6em; border-radius: 50%; color: #fff; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #ff9a9a, #e03a3a 60%, #a51f1f); border: .2em solid var(--ink); box-shadow: 0 .25em 0 var(--ink); }
.spin-btn:active { transform: translateY(.22em); box-shadow: 0 .03em 0 var(--ink); }

.tray { position: relative; margin: .8em auto 0; width: 74%; height: 2.1em; background: #1a0d12; border: .2em solid var(--ink);
  border-radius: .6em .6em 1.2em 1.2em; box-shadow: inset 0 .4em .5em rgba(0, 0, 0, .65); }
.coin { position: absolute; bottom: .1em; font-size: 1.7em; line-height: 1; pointer-events: none; animation: coin-pop 1.3s ease-out forwards; }
@keyframes coin-pop {
  0% { transform: translate(0, 0) rotate(0) scale(.5); opacity: 0; }
  25% { transform: translate(var(--dx), -4.6em) rotate(200deg) scale(1); opacity: 1; }
  100% { transform: translate(calc(var(--dx) * 1.4), .4em) rotate(560deg) scale(.9); opacity: 0; }
}
.slot-hint { font-size: 1.3em; font-weight: 800; text-align: center; min-height: 1.4em; }
.slot-wrap .controls { font-size: 16px; }

/* the lever, in its slot on the side */
.lever-wrap { position: absolute; right: -3.4em; top: 5.2em; width: 3em; height: 14em; }
.lever-wrap::before { content: ""; position: absolute; left: 50%; top: 1.6em; bottom: 1.6em; width: 1em; transform: translateX(-50%);
  background: #1a0d12; border: .15em solid var(--ink); border-radius: .5em; }
.lever { all: unset; box-sizing: border-box; position: absolute; inset: 0; display: flex; flex-direction: column-reverse; align-items: center; cursor: grab; touch-action: none; }
.lever:focus-visible { outline: 3px solid #ffb800; outline-offset: 4px; border-radius: .6em; }
.lever.drag { cursor: grabbing; }
.lever-base { flex: none; width: 2.4em; height: 1.6em; margin-bottom: 1em; background: linear-gradient(180deg, #fff3b0, #f1c232 60%, #b98a12); border: .2em solid var(--ink); border-radius: .5em; z-index: 1; }
.lever-stick { flex: none; width: .8em; height: calc(8em - var(--p, 0) * 5.4em); background: linear-gradient(90deg, #8d92a8, #f4f5fb 45%, #8d92a8); border: .15em solid var(--ink); border-bottom: 0; transition: height .2s; }
.lever-ball { flex: none; width: 2.8em; height: 2.8em; border-radius: 50%; margin-bottom: -.25em; z-index: 2; border: .22em solid var(--ink);
  background: radial-gradient(circle at 35% 30%, #ffb3b3, #e03a3a 55%, #a51f1f); box-shadow: 0 .2em 0 rgba(0, 0, 0, .25); }
.lever.drag .lever-stick { transition: none; }
.lever:hover:not(.drag) .lever-ball { filter: brightness(1.1); }

.cap-emoji { display: block; font-size: 2.2em; line-height: 1.1; }

/* subtle side markers instead of a line across the reels */
.frame::before, .frame::after { position: absolute; top: 50%; transform: translateY(-50%); font-size: .8em; color: #f1c232; text-shadow: 0 0 .2em #000; z-index: 3; pointer-events: none; }
.frame::before { content: "▶"; left: .04em; } .frame::after { content: "◀"; right: .04em; }
.reel-cell.blank { background: linear-gradient(180deg, #f3f0ff, #e6e0fb); }
.reel-cell.blank span { font-size: 4.4em; animation: none; }

/* ---------- slot polish (from slot-design practice) ---------- */
.reel-win.land { animation: land .34s ease-out; }
@keyframes land { 0% { transform: scale(1.04, .94); } 55% { transform: scale(.985, 1.03); } 100% { transform: none; } }
.reel-win.glow { animation: glow 1.1s ease-in-out 2; box-shadow: 0 0 0 .22em #ffd54a, 0 0 1.1em .3em rgba(255, 213, 74, .85); }
@keyframes glow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.12); } }
.slot.shake { animation: machine-shake .6s; }
@keyframes machine-shake { 0%, 100% { transform: none; } 15% { transform: translateX(-.3em) rotate(-.6deg); } 35% { transform: translateX(.3em) rotate(.6deg); } 55% { transform: translateX(-.2em); } 75% { transform: translateX(.2em); } }
.win-lamps { display: flex; gap: .45em; }
.wl { width: 2em; height: 2em; border-radius: 50%; display: grid; place-items: center; font-size: .85em; font-weight: 800; color: #b98a8f;
  background: #4d1420; border: .15em solid var(--ink); transition: background .2s, color .2s, box-shadow .2s; }
.wl.on { background: radial-gradient(circle at 35% 30%, #fff6b0, #ffd54a 60%, #e0a800); color: var(--ink); box-shadow: 0 0 .7em .15em rgba(255, 213, 74, .8); }
.coin { width: 1.25em; height: 1.25em; border-radius: 50%; font-size: 1em;
  background: radial-gradient(circle at 35% 30%, #fff6b0, #f1c232 55%, #b98a12); border: .14em solid var(--ink); box-shadow: inset 0 0 0 .14em rgba(255, 255, 255, .4); }
.spin-btn { min-width: 44px; min-height: 44px; }
.lever-wrap { min-width: 44px; }

.wl.star { color: #ffb3a7; } .wl.star.on { background: radial-gradient(circle at 35% 30%, #fff, #ffd54a 55%, #ff9f1a); animation: glow .5s ease-in-out infinite; }
.marquee-text { transition: letter-spacing .3s; }

/* ---------- game picker ---------- */
.picker { max-width: 620px; margin: 0 auto; display: grid; gap: 16px; }
.picker h2 { text-align: center; font-size: 26px; }
.game-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.game-card { font: inherit; color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--lift);
  padding: 18px 14px 16px; display: grid; justify-items: center; gap: 6px; text-align: center; cursor: pointer; transition: transform .1s; }
.game-card:hover:not(:disabled) { transform: translateY(-4px) rotate(-1deg); background: #fffbe8; }
.game-card:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.game-card:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.gc-emoji { font-size: 56px; line-height: 1.1; }
.gc-name { font-size: 22px; font-weight: 800; }
.gc-desc { font-size: 14px; color: var(--muted); }

/* ---------- full-screen celebration ---------- */
.cele { position: fixed; inset: 0; z-index: 160; display: grid; place-items: center; overflow: hidden; cursor: pointer; outline: none;
  background: radial-gradient(circle at 50% 50%, #fff3a8 0%, #ffc04d 34%, #ff6b9d 68%, #7a4dff 100%); animation: cele-in .22s ease-out; }
.cele.out { animation: cele-out .26s ease-in forwards; }
.cele::before { content: ""; position: absolute; inset: -60%; background: repeating-conic-gradient(rgba(255, 255, 255, .42) 0 9deg, rgba(255, 255, 255, 0) 9deg 18deg);
  animation: cele-spin 9s linear infinite; }
.cele-flash { position: absolute; inset: 0; background: #fff; pointer-events: none; animation: cele-flash .55s ease-out forwards; }
.cele-body { position: relative; display: grid; justify-items: center; gap: .05em; padding: 1rem; text-align: center; }
.cele-emojis { display: flex; gap: .08em; font-size: clamp(44px, 15vw, 170px); line-height: 1.1; animation: cele-bounce .55s ease-in-out infinite alternate; }
.cele-title, .cele-text { font-weight: 900; line-height: 1; color: #fff36b; -webkit-text-stroke: .05em var(--ink); paint-order: stroke fill;
  text-shadow: 0 .07em 0 var(--ink), 0 0 .35em rgba(255, 255, 255, .85); }
.cele-title { font-size: clamp(76px, 26vw, 280px); letter-spacing: .02em; animation: cele-pop .7s cubic-bezier(.2, 1.7, .4, 1) .05s both; }
.cele-text { font-size: clamp(34px, 11vw, 130px); color: #fff; animation: cele-pop .7s cubic-bezier(.2, 1.7, .4, 1) .22s both, cele-bob 1s ease-in-out 1s infinite alternate; }
.cele-hint { position: absolute; bottom: 1.1rem; left: 0; right: 0; text-align: center; font-weight: 800; color: rgba(43, 38, 80, .75); font-size: 16px; }
@keyframes cele-in { from { transform: scale(1.15); } to { transform: none; } }
@keyframes cele-out { to { opacity: 0; transform: scale(.96); } }
@keyframes cele-flash { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes cele-spin { to { transform: rotate(360deg); } }
@keyframes cele-pop { from { transform: scale(0) rotate(-14deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cele-bob { from { transform: translateY(0) rotate(-1.5deg); } to { transform: translateY(-.12em) rotate(1.5deg); } }
@keyframes cele-bounce { from { transform: translateY(0); } to { transform: translateY(-.14em); } }

/* ---------- shooting gallery ---------- */
.range-wrap { font-size: var(--rs, 16px); display: grid; justify-items: center; width: 100%; }
.range { position: relative; width: 34em; height: 31em; overflow: hidden; outline: none; cursor: crosshair; touch-action: manipulation;
  border: .3em solid var(--ink); border-radius: 1.4em; box-shadow: 0 .45em 0 var(--ink);
  background: linear-gradient(180deg, #ffe2a8 0%, #ffbf82 50%, #e8a265 50.2%, #c98a52 100%); }
.range::before { content: ""; position: absolute; left: 0; right: 0; top: 13em; height: 6em; opacity: .35;
  background: linear-gradient(135deg, transparent 49%, #b96a3c 50%) 0 0 / 7em 6em repeat-x; }
.range:focus-visible { box-shadow: 0 .45em 0 var(--ink), 0 0 0 .3em #ffb800; }
.counter { position: absolute; left: 0; right: 0; bottom: 0; height: 5.4em; border-top: .3em solid var(--ink);
  background: repeating-linear-gradient(90deg, #8a5a2b 0 2.2em, #7a4f24 2.2em 2.35em); }
.hud { position: absolute; left: .9em; bottom: 1.1em; z-index: 5; color: #fff; font-weight: 800; font-size: 1.15em; text-shadow: 0 .1em 0 var(--ink); }
.prompt { position: absolute; top: 1em; left: 50%; transform: translateX(-50%); z-index: 5; min-width: 13em; max-width: 27em; text-align: center;
  background: #fffdf5; border: .25em solid var(--ink); border-radius: .8em; padding: .35em 1.1em .5em; box-shadow: 0 .3em 0 var(--ink); }
.prompt small { display: block; font-size: .8em; font-weight: 700; color: var(--muted); }
.prompt .pw { font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }

.targets { position: absolute; left: 0; right: 0; top: 8.8em; height: 14em; display: flex; justify-content: space-around; padding: 0 1.4em; }
.target { all: unset; box-sizing: border-box; position: relative; width: 9.4em; height: 14em; cursor: crosshair; display: block; touch-action: manipulation; }
.t-bandit { position: absolute; left: 50%; top: 1.4em; width: 9em; z-index: 1; opacity: 0; transform: translate(-50%, 3.2em) scale(.4); }
.bandit-svg { width: 100%; display: block; }
.t-post { position: absolute; left: 50%; top: 7.4em; width: .9em; height: 5.2em; transform: translateX(-50%); background: #8a5a2b; border: .2em solid var(--ink); z-index: 0; }
.t-board { position: absolute; left: .7em; top: 0; width: 8em; height: 8em; border-radius: 50%; z-index: 2; border: .25em solid var(--ink);
  background: radial-gradient(circle, #e03a3a 0 14%, #fff 14% 30%, #e03a3a 30% 46%, #fff 46% 62%, #e03a3a 62% 78%, #fff 78% 100%);
  box-shadow: 0 .3em 0 rgba(0, 0, 0, .25); transition: transform .45s cubic-bezier(.5, 1.5, .5, 1); }
.t-plate { position: absolute; left: -.2em; right: -.2em; top: 8.5em; min-height: 3.3em; z-index: 3; display: grid; place-items: center; padding: .2em .45em;
  background: #fffdf5; border: .22em solid var(--ink); border-radius: .6em; box-shadow: 0 .25em 0 var(--ink); font-weight: 800; text-align: center; line-height: 1.1; overflow-wrap: anywhere; }
.target.appear .t-board { animation: t-appear .45s cubic-bezier(.3, 1.6, .5, 1); }
.target.hover .t-board { transform: scale(1.07); } .target.hover .t-plate { background: #fff3b8; }
.target.hit .t-board { animation: t-hit .55s ease-in forwards; } .target.hit .t-plate { background: #b9f3c9; }
.target.slide .t-board { transform: translateX(var(--sx, -6em)) rotate(var(--sr, -24deg)); }
.target.slide .t-bandit { opacity: 1; transform: translate(-50%, 0) scale(1); transition: transform .5s cubic-bezier(.3, 1.6, .5, 1), opacity .2s; }
.target.answer .t-plate { background: #b9f3c9; animation: t-answer .5s ease-in-out 3; }
@keyframes t-appear { from { transform: scale(.2) translateY(2em); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes t-hit { 0% { transform: scale(1); } 35% { transform: scale(1.25); filter: brightness(1.5); } 100% { transform: scale(.1) rotate(200deg); opacity: 0; } }
@keyframes t-answer { 50% { transform: scale(1.08); } }

.gun { position: absolute; left: 50%; bottom: -2.4em; width: 7.5em; height: 13em; margin-left: -3.75em; z-index: 6; pointer-events: none;
  transform-origin: 50% 88%; transform: rotate(var(--a, 0deg)); transition: transform .06s linear; }
.gun-svg { width: 100%; height: 100%; overflow: visible; display: block; filter: drop-shadow(0 .25em 0 rgba(0, 0, 0, .25)); }
.muzzle { opacity: 0; transform-origin: 50px 6px; }
.gun.fire .gun-svg { animation: recoil .17s ease-out; } .gun.fire .muzzle { opacity: 1; }
@keyframes recoil { 30% { transform: translateY(.7em) scale(1.03); } }
.bandit-svg .muzzle { opacity: 0; }

.flash { position: absolute; inset: 0; z-index: 8; background: #fff; opacity: 0; pointer-events: none; }
.flash.red { background: #ff2b2b; } .flash.on { animation: flash-on .55s ease-out; }
@keyframes flash-on { 0% { opacity: .95; } 100% { opacity: 0; } }
.range.shake { animation: range-shake .5s; }
@keyframes range-shake { 0%, 100% { transform: none; } 15% { transform: translate(-.5em, .2em) rotate(-.6deg); } 35% { transform: translate(.5em, -.2em) rotate(.6deg); } 55% { transform: translate(-.3em, .2em); } 75% { transform: translate(.3em, 0); } }
.bang { position: absolute; left: 50%; top: 42%; z-index: 9; transform: translate(-50%, -50%) rotate(-7deg); font-size: 5em; font-weight: 900; color: #fff24d;
  -webkit-text-stroke: .06em var(--ink); paint-order: stroke fill; text-shadow: 0 .06em 0 var(--ink), 0 0 .4em #ff5a2a; animation: bang-pop .7s cubic-bezier(.2, 1.7, .4, 1) both; pointer-events: none; }
@keyframes bang-pop { from { transform: translate(-50%, -50%) scale(0) rotate(-20deg); } to { transform: translate(-50%, -50%) scale(1) rotate(-7deg); } }
.counter-row { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }

.bandit-svg .bflash { opacity: 0; transform-box: fill-box; transform-origin: center; }
.target.fired .bandit-svg .bflash { opacity: 1; animation: bflash .35s ease-out; }
@keyframes bflash { from { transform: scale(.3); } to { transform: scale(1); } }
.target .bang { left: 50%; top: -1.8em; font-size: 3.4em; z-index: 9; }
.target .bang { transform: translate(-50%, 0) rotate(-7deg); animation: bang-pop2 .7s cubic-bezier(.2, 1.7, .4, 1) both; white-space: nowrap; }
@keyframes bang-pop2 { from { transform: translate(-50%, 0) scale(0) rotate(-20deg); } to { transform: translate(-50%, 0) scale(1) rotate(-7deg); } }

/* ---------- the scary bandit and the big muzzle blast ---------- */
.range.scary .t-bandit { width: 14em; top: -1.2em; }
.range.scary .target.fired .bandit-svg .bflash { animation: bflash-big .45s ease-out; }
@keyframes bflash-big { 0% { transform: scale(.2); } 35% { transform: scale(1.25); } 100% { transform: scale(1); } }
.range.scary .target .bang { font-size: 4.4em; top: -2.4em; }
.blast { position: absolute; inset: 0; z-index: 9; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at var(--fx, 50%) var(--fy, 50%), #fff 0, #fff7b8 10%, #ffc83a 26%, rgba(255, 110, 28, .8) 44%, rgba(255, 60, 40, .35) 62%, rgba(255, 60, 40, 0) 80%); }
.blast.on { animation: blast .75s ease-out; }
@keyframes blast { 0% { opacity: 1; transform: scale(.55); } 22% { opacity: 1; transform: scale(1.2); } 100% { opacity: 0; transform: scale(1.7); } }

/* round blast centred on the muzzle (was a clipped rectangle); the bandit stays inside the scene */
.blast { inset: auto; left: var(--fx, 50%); top: var(--fy, 50%); width: 38em; height: 38em; border-radius: 50%;
  background: radial-gradient(circle, #fff 0, #fff7b8 9%, #ffc83a 24%, rgba(255, 110, 28, .82) 42%, rgba(255, 60, 40, .38) 58%, rgba(255, 60, 40, 0) 72%); }
.blast.on { animation: blast2 .8s ease-out; }
@keyframes blast2 { 0% { opacity: 1; transform: translate(-50%, -50%) scale(.25); } 25% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.6); } }
.range.scary .t-bandit { width: 12.5em; top: -.4em; transform: translate(calc(-50% + var(--bx, 0em)), 3.2em) scale(.4); }
.range.scary .target.slide .t-bandit { transform: translate(calc(-50% + var(--bx, 0em)), 0) scale(1); }
.target .bang { transform: translate(calc(-50% + var(--bx, 0em)), 0) rotate(-7deg); animation-name: bang-pop3; }
@keyframes bang-pop3 { from { transform: translate(calc(-50% + var(--bx, 0em)), 0) scale(0) rotate(-20deg); } to { transform: translate(calc(-50% + var(--bx, 0em)), 0) scale(1) rotate(-7deg); } }

/* the bandit steps out IN FRONT of the slid target (so his big revolver is visible), but stays behind the word plates */
.range.scary .target.slide .t-bandit { z-index: 3; }
.t-plate { z-index: 4; }

/* the muzzle flash is a burst, not a sticker: it blooms and fades, leaving the big black revolver in view */
.bandit-svg .bflash { opacity: 0; }
.target.fired .bandit-svg .bflash, .range.scary .target.fired .bandit-svg .bflash { opacity: 0; animation: bflash-fade .6s ease-out; }
@keyframes bflash-fade { 0% { opacity: 1; transform: scale(.2); } 30% { opacity: 1; transform: scale(1.3); } 100% { opacity: 0; transform: scale(1.05); } }

/* ---------- WILD WEST: scenery per level, hud, timer, banners ---------- */
.deco { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.deco .d { position: absolute; line-height: 1; opacity: .92; filter: drop-shadow(0 .15em 0 rgba(0, 0, 0, .18)); }
.deco .sun { left: 60%; top: 4.4em; width: 9em; height: 9em; border-radius: 50%; background: radial-gradient(circle, #fff7c2, #ffb347 62%, #ff6b3d); box-shadow: 0 0 3em #ff9f43; }
.range.th1 { background: linear-gradient(180deg, #5a3aa8 0%, #d94f8f 36%, #ff9d52 62%, #a04b2c 62.2%, #7a331f 100%); }
.range.th2 { background: linear-gradient(180deg, #0f1b3d 0%, #263a75 55%, #2f2b47 55.2%, #1b1830 100%); }
.range.th3 { background: linear-gradient(180deg, #8c97b3 0%, #c9cfde 56%, #6e7490 56.2%, #4a4e66 100%); }
.range.th2::before { opacity: .15; } .range.th3::before { opacity: .2; }
.range.th1 .counter { background: repeating-linear-gradient(90deg, #7a4a3a 0 2.2em, #6a3e31 2.2em 2.35em); }
.range.th2 .counter { background: repeating-linear-gradient(90deg, #3f3450 0 2.2em, #352b44 2.2em 2.35em); }
.range.th3 .counter { background: repeating-linear-gradient(90deg, #596079 0 2.2em, #4b5169 2.2em 2.35em); }

.counter { display: flex; align-items: center; justify-content: space-between; padding: 0 1em; z-index: 5; }
.stat { color: #fff; font-weight: 800; text-align: right; line-height: 1.35; font-size: .95em; text-shadow: 0 .1em 0 var(--ink); }
.streak { color: #fff; font-weight: 900; font-size: 1.8em; text-shadow: 0 .08em 0 var(--ink); transform-origin: left center; }
.streak.hot { color: #ffd54a; text-shadow: 0 0 .4em #ff7a1a, 0 .08em 0 var(--ink); }
.streak.pop { animation: streak-pop .45s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes streak-pop { 0% { transform: scale(1); } 40% { transform: scale(1.6) rotate(-4deg); } 100% { transform: scale(1); } }
.hearts { position: absolute; left: .8em; top: .7em; z-index: 6; font-size: 1.25em; letter-spacing: .04em; filter: drop-shadow(0 .1em 0 rgba(0, 0, 0, .25)); }
.lvl { position: absolute; right: .8em; top: .7em; z-index: 6; background: var(--ink); color: #fff; font-weight: 800; padding: .2em .75em; border-radius: 999px; font-size: .95em; }
.prompt { max-width: 19em; }

.timer { position: absolute; top: 6.5em; left: 50%; transform: translateX(-50%); z-index: 6; width: 15em; display: flex; align-items: center; gap: .5em; }
.tbar { flex: 1; height: 1.1em; background: #fff; border: .2em solid var(--ink); border-radius: 999px; overflow: hidden; }
.tbar i { display: block; height: 100%; width: 100%; background: #3ed16a; }
.timer.late .tbar i { background: #ff3b3b; }
.timer b { min-width: 1.3em; text-align: center; font-size: 1.7em; line-height: 1; color: #fff; -webkit-text-stroke: .08em var(--ink); paint-order: stroke fill; }
.timer.late b { color: #ff5a4a; animation: late .35s ease-in-out infinite alternate; }
@keyframes late { to { transform: scale(1.25); } }

.banner { position: absolute; inset: 0; z-index: 12; display: grid; place-content: center; gap: .4em; text-align: center; padding: 1.2em; cursor: pointer;
  background: rgba(43, 38, 80, .9); color: #fff; animation: bn-in .3s ease-out; }
.bn-title { font-size: 2.5em; font-weight: 900; line-height: 1.05; color: #ffd54a; text-shadow: 0 .08em 0 #000; }
.bn-sub { font-size: 1.25em; font-weight: 700; max-width: 22em; margin: 0 auto; }
.bn-hint { font-size: .9em; opacity: .7; margin-top: 1em; }
.banner.out { animation: bn-out .26s forwards; }
@keyframes bn-in { from { opacity: 0; transform: scale(1.08); } to { opacity: 1; transform: none; } }
@keyframes bn-out { to { opacity: 0; } }
.timeup { position: absolute; left: 50%; top: 38%; z-index: 11; transform: translate(-50%, -50%); font-size: 2.4em; font-weight: 900; color: #fff; white-space: nowrap;
  background: #d63a4a; border: .12em solid var(--ink); padding: .2em .7em; border-radius: .6em; animation: bang-pop .5s cubic-bezier(.2, 1.7, .4, 1) both; }

.targets { padding: 0 1em; }
.target { width: var(--tw, 9.4em); }
.t-board { left: calc((var(--tw, 9.4em) - var(--bd, 8em)) / 2); width: var(--bd, 8em); height: var(--bd, 8em); }
.t-post { top: calc(var(--bd, 8em) - .6em); }
.t-plate { top: calc(var(--bd, 8em) + .5em); }

.stats { display: grid; gap: .4rem; }
.stats > div { display: flex; justify-content: space-between; gap: 1rem; padding: .4rem .2rem; border-bottom: 2px dashed #e6e1fa; font-size: 1.1rem; }
.stats .big { background: var(--accent); border: 3px solid var(--ink); border-radius: 12px; padding: .6rem .8rem; font-size: 1.35rem; }
.stats span { font-weight: 900; }

/* ---------- WILD WEST v3: the word is ABOVE the target; the revolver slides; sights and the bullseye reticle ---------- */
.targets { top: 8.4em; height: 17.5em; }
.t-plate { top: 0; }
.t-board { top: 3.9em; }
.t-post { top: calc(3.9em + var(--bd, 8em) - .6em); }
.t-bandit { top: 5.7em; }
.range.scary .t-bandit { top: 3.6em; }
.target .bang { top: 2.4em; }
.range.scary .target .bang { top: 1.4em; }
.target.aimed .t-plate { background: #fff3b8; }

.gun { left: var(--gx, 50%); margin-left: 0; transform: translateX(-50%); width: 8.6em; height: 14.8em; bottom: -2.6em; transform-origin: 50% 88%;
  transition: left .16s cubic-bezier(.3, 1.3, .5, 1); }
.aimline { position: absolute; z-index: 4; width: 0; border-left: .14em dashed rgba(224, 22, 43, .7); transition: left .16s, height .16s; pointer-events: none; }
.sight { position: absolute; z-index: 7; transform: translate(-50%, -50%); pointer-events: none; transition: left .16s, top .16s; }
.sight svg { width: 100%; height: 100%; display: block; }
.tracer { position: absolute; z-index: 8; width: .55em; margin-left: -.275em; border-radius: .3em; pointer-events: none; transform-origin: bottom center;
  background: linear-gradient(#fff, #ffd54a 70%, rgba(255, 213, 74, 0)); box-shadow: 0 0 .9em .15em #ffd54a; animation: tracer-go .16s linear both; }
@keyframes tracer-go { from { transform: scaleY(0); opacity: 1; } to { transform: scaleY(1); opacity: .2; } }

/* the villain's speech bubble */
.say { position: absolute; left: 50%; top: -3.6em; z-index: 10; transform: translateX(calc(-50% + var(--bx, 0em))); width: max-content; max-width: 15em; text-align: center;
  background: #fff; border: .22em solid var(--ink); border-radius: .9em; padding: .3em .8em .4em; box-shadow: 0 .25em 0 var(--ink); animation: say-pop .35s cubic-bezier(.2, 1.7, .4, 1) both; pointer-events: none; }
.say::after { content: ""; position: absolute; left: 50%; bottom: -.62em; width: .9em; height: .9em; background: #fff; border-right: .22em solid var(--ink); border-bottom: .22em solid var(--ink); transform: translateX(-50%) rotate(45deg); }
.sy-main { font-size: 1.9em; font-weight: 900; line-height: 1.1; color: #d63a4a; }
.sy-py { font-size: 1em; font-weight: 700; color: var(--ink); }
.sy-ru { font-size: .85em; color: var(--muted); }
@keyframes say-pop { from { transform: translateX(calc(-50% + var(--bx, 0em))) scale(.3); opacity: 0; } to { transform: translateX(calc(-50% + var(--bx, 0em))) scale(1); opacity: 1; } }

/* cool (laser) blast: cyan and magenta instead of orange */
.blast.cool { background: radial-gradient(circle, #fff 0, #e0feff 9%, #6ff3ff 24%, rgba(0, 160, 255, .8) 42%, rgba(170, 60, 255, .4) 58%, rgba(170, 60, 255, 0) 72%); }
.target .bang { font-size: 3em; }

/* ---------- levels 5 and 6: Fantômas (night Paris, flamethrower) and the intellectual cat (library, explosive blowpipe) ---------- */
.range.th4 { background: linear-gradient(180deg, #081d33 0%, #17506e 52%, #2a3a48 52.2%, #131d29 100%); }
.range.th5 { background: linear-gradient(180deg, #a87a48 0%, #d6b57e 56%, #6a4828 56.2%, #45301a 100%); }
.range.th4::before { opacity: .12; } .range.th5::before { opacity: .1; }
.range.th4 .counter { background: repeating-linear-gradient(90deg, #1f3a4a 0 2.2em, #182f3d 2.2em 2.35em); }
.range.th5 .counter { background: repeating-linear-gradient(90deg, #5a3c1f 0 2.2em, #4d3219 2.2em 2.35em); }
.blast.fire { background: radial-gradient(circle, #fff3b0 0, #ffd04a 14%, #ff8a1a 32%, rgba(214, 42, 0, .85) 50%, rgba(120, 10, 0, .4) 66%, rgba(120, 10, 0, 0) 78%); }
.blast.boom { background: radial-gradient(circle, #fff 0, #ffe9a0 10%, #ff9f1a 26%, rgba(214, 60, 20, .8) 44%, rgba(70, 60, 60, .55) 62%, rgba(70, 60, 60, 0) 76%); }

/* library: two rows of colourful book spines on the back wall */
.deco .shelf { left: 0; right: 0; top: 0; height: 13em; opacity: 1; filter: none;
  background:
    linear-gradient(#3d2812, #3d2812) 0 4.9em / 100% .5em no-repeat,
    linear-gradient(#3d2812, #3d2812) 0 10.5em / 100% .5em no-repeat,
    repeating-linear-gradient(90deg, #c0392b 0 1.1em, #2c3e50 1.1em 2.0em, #e0a82e 2.0em 3.3em, #2e8b57 3.3em 4.2em, #6b4fdb 4.2em 5.1em, #d35400 5.1em 6.4em, #1f7a8c 6.4em 7.3em, #8e3b6f 7.3em 8.5em) 0 .9em / 100% 4em no-repeat,
    repeating-linear-gradient(90deg, #2e8b57 0 1.3em, #e0a82e 1.3em 2.1em, #8e3b6f 2.1em 3.4em, #c0392b 3.4em 4.3em, #1f7a8c 4.3em 5.5em, #d35400 5.5em 6.3em, #6b4fdb 6.3em 7.6em, #2c3e50 7.6em 8.5em) 0 6.5em / 100% 4em no-repeat,
    linear-gradient(rgba(0,0,0,.25), rgba(0,0,0,.25)); }

/* first-person Colt (PNG, barrel tip at the top centre) */
.gun { width: 10.4em; height: 15.1em; bottom: -2.8em; transform-origin: 50% 60%; }
.gun .gun-svg { object-fit: contain; object-position: 50% 0; }

/* end screen: only the streak */
.endscr { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2em;
  background: radial-gradient(circle at 50% 40%, #6b4fdb, #2a1a6b); color: #fff; text-align: center; animation: endin .3s ease-out; }
.endscr .e-head { font-size: clamp(1.6rem, 6vw, 3rem); font-weight: 800; color: #ffd54a; }
.endscr .e-cap { font-size: clamp(1.2rem, 4vw, 2rem); opacity: .85; }
.endscr .e-num { font-size: clamp(9rem, 38vmin, 26rem); font-weight: 900; line-height: 1; color: #ffd54a; text-shadow: 0 .05em 0 rgba(0,0,0,.3); }
.endscr .e-btns { display: flex; gap: 12px; margin-top: 1.2rem; flex-wrap: wrap; justify-content: center; }
@keyframes endin { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }

/* players */
.turn { position: absolute; left: .9em; top: 2.9em; z-index: 5; background: #fff; color: #2a1a6b; border: .15em solid #2a1a6b; border-radius: 1em; padding: .15em .7em; font-weight: 800; font-size: .95em; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.names { display: grid; grid-template-columns: repeat(auto-fit, minmax(9em, 1fr)); gap: 8px; }
.names input { font: inherit; padding: .5em .7em; border: 2px solid var(--line, #d9d3f3); border-radius: 12px; min-width: 0; }
.endscr.many { justify-content: center; gap: 1rem; padding: 1rem; }
.e-table { border-collapse: collapse; font-size: clamp(1rem, 3.2vw, 2rem); background: rgba(255,255,255,.12); border-radius: 18px; overflow: hidden; }
.e-table th { font-size: .6em; opacity: .8; font-weight: 600; padding: .5em .8em; }
.e-table td { padding: .35em .8em; text-align: center; font-weight: 700; }
.e-table td.nm { text-align: left; } .e-table td.pt { color: #ffd54a; font-size: 1.2em; font-weight: 900; }
.e-table tr.win td { background: rgba(255,213,74,.22); }
.e-table { font-size: clamp(1.2rem, 4.2vw, 2.6rem); min-width: min(92vw, 34em); }
.endscr.many .e-head { font-size: clamp(2rem, 7vw, 4rem); }

/* the middle ring of the target is green */
.t-board { background: radial-gradient(circle, #e03a3a 0 14%, #fff 14% 30%, #2fb35a 30% 46%, #fff 46% 62%, #e03a3a 62% 78%, #fff 78% 100%); }

/* library: a realistic room drawn as SVG (img/library.svg) */
.range.th5 { background: #2a1a10 url(../img/library.svg) center / cover no-repeat; }
.range.th5 .counter { background: repeating-linear-gradient(90deg, #4a2f18 0 2.2em, #3f2714 2.2em 2.35em); }

/* the cat's bomb rolling across the floor */
.rollbomb { position: absolute; z-index: 10; left: 0; top: 0; pointer-events: none; will-change: transform; filter: drop-shadow(0 .25em 0 rgba(0,0,0,.35)); }
.rollbomb svg { width: 100%; height: 100%; display: block; overflow: visible; }
.rollbomb .spark { transform-origin: 18px -46px; animation: spark .18s steps(2) infinite; }
@keyframes spark { from { transform: scale(.85) rotate(-8deg); } to { transform: scale(1.25) rotate(10deg); } }
.fs-gear { display: none; }
body.fs .fs-gear { display: grid; position: fixed; top: 10px; right: 54px; z-index: 40; opacity: .35; }
body.fs .fs-gear:hover, body.fs .fs-gear:focus-visible { opacity: 1; }

/* full screen: the targets slide down into the extra space */
body.fs .range .targets { transform: translateY(var(--dy, 0px)); }
body.fs .range-wrap { justify-items: stretch; }
/* in full screen the ⚙️ and ✕ buttons sit in the top-right corner: move the level chip out from under them */
body.fs .range .lvl { top: 3.6em; right: .8em; }

/* ---------- account ---------- */
.acct { display: inline-flex; }
.avatar { width: 2.6em; height: 2.6em; border-radius: 50%; border: 3px solid var(--ink); background: var(--primary); color: #fff; font: inherit; font-weight: 800; cursor: pointer; overflow: hidden; padding: 0; display: grid; place-items: center; box-shadow: 0 3px 0 var(--ink); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.auth { display: grid; gap: 12px; min-width: min(22em, 80vw); }
.auth-form { display: grid; gap: 12px; }
.auth .google { display: flex; align-items: center; justify-content: center; gap: .6em; background: #fff; }
.g-logo { display: inline-grid; place-items: center; width: 1.5em; height: 1.5em; border-radius: 50%; background: conic-gradient(#ea4335 0 25%, #fbbc05 0 50%, #34a853 0 75%, #4285f4 0); color: #fff; font-weight: 900; font-size: .8em; }
.or { display: flex; align-items: center; gap: .6em; color: var(--muted, #777); font-size: .9em; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .3; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.linklike { background: none; border: 0; padding: 4px 0; font: inherit; color: var(--primary); text-decoration: underline; cursor: pointer; }
.auth-msg { min-height: 1.2em; color: #c0392b; font-size: .92em; } .auth-msg.ok { color: #1e8f4e; }
.auth .field input { font: inherit; padding: .7em .9em; border: 2px solid var(--ink); border-radius: 12px; background: #fff; width: 100%; box-sizing: border-box; }
.auth .field input:focus-visible { outline: 3px solid #ffb800; outline-offset: 1px; }

/* ---------- shared: players board ---------- */
.pboard { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 4px 0 10px; }
.pchip { display: flex; align-items: center; gap: .5em; padding: .3em .8em; border: 3px solid var(--ink); border-radius: 999px; background: #fff; font-weight: 700; opacity: .7; }
.pchip.on { background: var(--primary); color: #fff; opacity: 1; transform: scale(1.06); box-shadow: 0 3px 0 var(--ink); }
.pchip b { background: rgba(0,0,0,.12); border-radius: 999px; padding: 0 .55em; }
.pchip .pn { max-width: 8em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gm-wrap { display: grid; gap: 10px; justify-items: center; width: 100%; }
.gm-info { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; font-weight: 700; color: var(--ink); }

/* ---------- Pairs ---------- */
.pg-area { display: grid; gap: 10px; justify-content: center; font-size: 16px; }
.pg-card { width: var(--cs, 120px); height: var(--cs, 120px); perspective: 700px; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
.pg-in { position: relative; display: block; width: 100%; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.pg-card.up .pg-in, .pg-card.done .pg-in { transform: rotateY(180deg); }
.pg-face { position: absolute; inset: 0; display: grid; place-items: center; border: 3px solid var(--ink); border-radius: 14px; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 4px 0 var(--ink); padding: .3em; text-align: center; font-weight: 800; overflow: hidden; overflow-wrap: anywhere; line-height: 1.1; }
.pg-back { background: repeating-linear-gradient(45deg, var(--primary) 0 10px, #7d63e8 10px 20px); color: #fff; font-size: 2.2em; }
.pg-front { background: #fffdf5; color: var(--ink); transform: rotateY(180deg); }
.pg-card.done .pg-front { background: #c6f1d3; }
.pg-area.match { align-items: start; }
.pg-col { display: grid; gap: 8px; align-content: start; }
.pg-item { height: var(--ih, 60px); background: #fffdf5; border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 4px 0 var(--ink); font: inherit; font-weight: 800; color: var(--ink); cursor: pointer; padding: 0 .5em; overflow: hidden; line-height: 1.1; }
.pg-item.sel { background: #fff3b8; transform: translateY(-2px); }
.pg-item.done { background: #c6f1d3; opacity: .55; cursor: default; box-shadow: none; }
.pg-item.bad { background: #ffd0d0; animation: pg-shake .4s; }
@keyframes pg-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- Quiz ---------- */
.qz { max-width: 44em; margin: 0 auto; }
.qz-q { width: 100%; box-sizing: border-box; background: #fffdf5; border: 4px solid var(--ink); border-radius: 18px; box-shadow: 0 6px 0 var(--ink); padding: .8em 1em; text-align: center; font-weight: 900; color: var(--ink); min-height: 3.4em; display: grid; place-items: center; overflow-wrap: anywhere; line-height: 1.1; }
.qz-q.late { animation: pg-shake .4s; background: #ffe2e2; }
.qz-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; }
@media (max-width: 520px) { .qz-opts { grid-template-columns: 1fr; } }
.qz-opt { display: flex; align-items: center; gap: .6em; text-align: left; font: inherit; font-weight: 800; color: var(--ink); background: #fff; border: 3px solid var(--ink); border-radius: 16px; box-shadow: 0 5px 0 var(--ink); padding: .8em 1em; min-height: 3.6em; cursor: pointer; overflow-wrap: anywhere; line-height: 1.1; }
.qz-opt:hover { background: #f3eeff; } .qz-opt:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.qz-opt .k { flex: none; width: 1.8em; height: 1.8em; display: grid; place-items: center; border-radius: 50%; background: var(--primary); color: #fff; font-size: .85em; }
.qz-opt.ok { background: #b9f3c9; } .qz-opt.no { background: #ffc9c9; animation: pg-shake .4s; }
.qz-timer { display: flex; align-items: center; gap: 10px; width: 100%; } .qz-timer > span { flex: 1; height: .9em; border: 3px solid var(--ink); border-radius: 999px; background: #fff; overflow: hidden; }
.qz-timer i { display: block; height: 100%; background: #3ac16a; } .qz-timer.late i { background: #e0392b; } .qz-timer b { min-width: 1.4em; font-size: 1.3em; color: var(--ink); }
.qz-miss { color: #fff; background: rgba(255,255,255,.12); border-radius: 14px; padding: .6em 1em; font-size: clamp(.95rem, 2.6vw, 1.3rem); max-width: 90vw; text-align: left; }

/* ---------- Words ---------- */
.wd { max-width: 46em; margin: 0 auto; }
.wd-hint { width: 100%; box-sizing: border-box; background: #fffdf5; border: 4px solid var(--ink); border-radius: 18px; box-shadow: 0 6px 0 var(--ink); padding: .6em 1em; text-align: center; font-weight: 900; color: var(--ink); line-height: 1.1; overflow-wrap: anywhere; }
.wd-hint small { display: block; font-size: .5em; opacity: .7; margin-top: .3em; font-weight: 700; }
.wd-slots { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 6px 0; }
.wd-slots.shake { animation: pg-shake .4s; } .wd-slots.win .wd-slot { background: #b9f3c9; transform: translateY(-4px); }
.wd-slot, .wd-gap { min-width: 2.2em; height: 2.6em; display: grid; place-items: center; font: inherit; font-size: clamp(1.3rem, 5vw, 2.2rem); font-weight: 900; color: var(--ink); }
.wd-slot { border: 3px solid var(--ink); border-bottom-width: 6px; border-radius: 12px; background: #fff; cursor: pointer; padding: 0 .3em; }
.wd-slot.full { background: #fff3b8; } .wd-slot.lock { background: #dfe8ff; } .wd-slot.miss { background: #ffd0d0; }
.wd-pool, .wd-keys { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.wd-pool { flex-direction: column; align-items: center; }
.wd-tile, .wd-key { min-width: 2.4em; height: 2.6em; border: 3px solid var(--ink); border-radius: 12px; background: var(--primary); color: #fff; font: inherit; font-size: clamp(1.2rem, 4.5vw, 2rem); font-weight: 900; box-shadow: 0 4px 0 var(--ink); cursor: pointer; text-transform: uppercase; }
.wd-pool:has(.wd-tile) { flex-direction: row; }
.wd-tile:disabled { opacity: .2; box-shadow: none; cursor: default; }
.wd-key { background: #fff; color: var(--ink); min-width: 2em; height: 2.2em; font-size: clamp(1rem, 3.6vw, 1.6rem); } .wd-key.hit { background: #b9f3c9; } .wd-key.no { background: #ffd0d0; opacity: .6; } .wd-key:disabled { cursor: default; box-shadow: none; }
.wd-balloons { font-size: 2em; letter-spacing: .1em; } .wd-tools { display: flex; gap: 10px; }

/* ---------- Deck of cards ---------- */
.dk { --cw: 12em; font-size: clamp(11px, 2.2vw, 18px); width: 100%; }
.dk-table { display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: 1.2em; align-items: center; justify-items: center; width: 100%; max-width: 62em; margin: 0 auto; padding: 1em; box-sizing: border-box; background: radial-gradient(ellipse at center, #2f9a62 0%, #1f7a4a 75%); border: 4px solid var(--ink); border-radius: 26px; box-shadow: inset 0 0 3em rgba(0,0,0,.3); min-height: 24em; }
.dk-zone { display: grid; gap: .6em; justify-items: center; }
.dk-pile { position: relative; width: 8.4em; height: 12em; background: none; border: 0; padding: 0; cursor: pointer; }
.dk-pile.empty { opacity: .35; cursor: default; }
.dk-layer, .dk-back { position: absolute; inset: 0; border: 3px solid var(--ink); border-radius: .8em; background: repeating-linear-gradient(45deg, var(--primary) 0 .6em, #7d63e8 .6em 1.2em); box-shadow: 0 .15em 0 rgba(0,0,0,.35); }
.dk-pile:not(.empty):hover .dk-layer:last-child { filter: brightness(1.1); }
.dk-count { color: #fff; font-weight: 800; text-shadow: 0 1px 0 rgba(0,0,0,.4); text-align: center; }
.dk-slot { width: 14.4em; height: 20em; display: grid; place-items: center; border: 3px dashed rgba(255,255,255,.4); border-radius: 1.1em; }
.dk-card { position: relative; width: 100%; height: 100%; perspective: 900px; }
.dk-card.flying { position: fixed; }
.dk-in { position: absolute; inset: 0; transform-style: preserve-3d; }
.dk-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.dk-front { display: grid; place-items: center; text-align: center; padding: .8em; background: #fffdf5; color: var(--ink); border: 4px solid var(--ink); border-radius: 1.1em; box-shadow: 0 .25em 0 rgba(0,0,0,.4); font-weight: 900; line-height: 1.1; overflow-wrap: anywhere; white-space: pre-line; cursor: pointer; }
.dk-front span { display: block; max-width: 100%; }
.dk-card:not(.flying) .dk-back { display: none; }
.dk-discard { position: relative; width: 8.4em; height: 12em; }
.dk-mini { position: absolute; inset: 0; background: #fffdf5; border: 3px solid var(--ink); border-radius: .8em; box-shadow: 0 .12em 0 rgba(0,0,0,.35); opacity: .9; }
.dk-hint { text-align: center; }
.dk-shuffle { position: fixed; inset: 0; z-index: 55; pointer-events: none; }
@media (max-width: 640px) { .dk-table { grid-template-columns: 1fr 1.5fr 1fr; gap: .4em; padding: .5em; } .dk-pile, .dk-discard { width: 5.6em; height: 8em; } .dk-slot { width: 11em; height: 15.5em; } }
.seg button[aria-selected=true] { background: var(--ink); color: #fff; }

.mode-seg { display: flex; width: fit-content; margin: 0 auto 10px; }
.mode-seg button { font-size: 1.05em; padding: .55em 1.2em; }

/* ---------- "online / shared": a cool sky-blue language, apart from the purple of your own things ---------- */
:root { --net: #2f8fe8; --net-deep: #1c62b3; --net-soft: #e4f2ff; }
.set-band { position: relative; }
/* shared deck: blue frame and shadow, a little "online" tag on the top edge */
.set-card.shared { border-color: var(--net); box-shadow: 0 4px 0 var(--net); }
.set-card.shared .set-band { border-bottom-color: var(--net); }
.set-card.shared .from-tag { color: var(--net-deep); background: var(--net-soft); }
.net-tag { position: absolute; left: 10px; bottom: -.7em; z-index: 2; display: inline-flex; align-items: center; gap: .4em; background: var(--net); color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .02em; padding: 2px 10px 2px 8px; border-radius: 999px; box-shadow: 0 2px 0 var(--net-deep); }
.net-tag::before { content: "🌐"; font-size: 1.05em; }
.net-tag .pulse { order: 2; width: .55em; height: .55em; border-radius: 50%; background: #7dffb0; box-shadow: 0 0 0 0 rgba(125, 255, 176, .8); animation: net-pulse 2s infinite; }
@keyframes net-pulse { 70% { box-shadow: 0 0 0 .6em rgba(125, 255, 176, 0); } 100% { box-shadow: 0 0 0 0 rgba(125, 255, 176, 0); } }
@media (prefers-reduced-motion: reduce) { .net-tag .pulse { animation: none; } }
/* shared folder chips */
.chip.shared { border-color: var(--net); background: var(--net-soft); color: var(--net-deep); }
.chip.shared[aria-selected=true] { background: var(--net); color: #fff; }
.chip.shared[aria-selected=true] .n { background: rgba(255,255,255,.25); color: #fff; }
/* the catalog switch and page */
.mode-seg button.net[aria-selected=true] { background: var(--net); }
.mode-seg button.net:not([aria-selected=true]) { color: var(--net-deep); }
.net-zone { background: linear-gradient(180deg, var(--net-soft), transparent 22em); border-radius: 0 0 28px 28px; position: relative; }
.net-zone::before { content: "☁️"; position: absolute; right: 6%; top: .2em; font-size: 3.4em; opacity: .18; pointer-events: none; }
.net-zone .folder-bar { color: var(--net-deep); }
.net-zone .folder-bar .btn { border-color: var(--net); color: var(--net-deep); background: #fff; }
.net-zone .set-actions .btn.primary { background: var(--net); border-color: var(--net-deep); box-shadow: 0 3px 0 var(--net-deep); }
/* in "my decks", the bar of a shared folder */
.folder-bar .from-tag { color: var(--net-deep); background: var(--net-soft); border: 2px solid var(--net); }
.net-zone .set-actions { flex-wrap: wrap; } .net-zone .set-actions .btn { padding-left: 12px; padding-right: 12px; }

/* the little "online" dot, everywhere something is shared */
.pulse { display: inline-block; width: .55em; height: .55em; border-radius: 50%; background: #25c96a; box-shadow: 0 0 0 0 rgba(37, 201, 106, .7); animation: net-pulse-g 2s infinite; flex: none; vertical-align: middle; margin-right: .35em; }
.net-tag .pulse { margin: 0; }
@keyframes net-pulse-g { 70% { box-shadow: 0 0 0 .55em rgba(37, 201, 106, 0); } 100% { box-shadow: 0 0 0 0 rgba(37, 201, 106, 0); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.chip.shared[aria-selected=true] .pulse, .mode-seg button.net[aria-selected=true] .pulse { background: #9dffc6; }
.mode-seg button.net .pulse { margin: 0 0 0 .4em; }
.from-tag.net { display: inline-flex; align-items: center; }
.upd-tag { align-self: flex-start; border: 2px solid var(--net); background: #fff; color: var(--net-deep); font: inherit; font-size: 13px; font-weight: 800; border-radius: 999px; padding: 2px 10px; cursor: pointer; }
.btn.upd { border-color: var(--net); background: var(--net-soft); animation: upd-wiggle 2.4s infinite; }
@keyframes upd-wiggle { 0%, 88%, 100% { transform: none; } 92% { transform: rotate(-12deg); } 96% { transform: rotate(10deg); } }
.diff { max-height: 50vh; overflow: auto; display: grid; gap: 10px; }
.diff-sec ul { margin: 4px 0 0; padding-left: 1.2em; } .diff-sec li { margin: 2px 0; }

/* sticker + colour of a deck */
.emoji-pick button.plain { font-size: 20px; }
.color-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 2px rgba(0,0,0,.12); }
.swatch[aria-pressed=true] { border-color: var(--ink); box-shadow: 0 0 0 3px #fff inset; }
.set-letter { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.55); border: 3px solid var(--ink); font-weight: 900; font-size: 28px; color: var(--ink); }

/* sticker / colour panel (like stickers in a messenger) */
.look-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.look-prev { width: 52px; height: 52px; border-radius: 16px; border: 3px solid var(--ink); display: grid; place-items: center; font-size: 30px; box-shadow: 0 3px 0 var(--ink); }
.look-prev.letter { font-weight: 900; font-size: 26px; color: var(--ink); }
.pop { position: fixed; z-index: 120; background: #fff; border: 3px solid var(--ink); border-radius: 18px; box-shadow: 0 8px 0 rgba(43,38,80,.25), 0 14px 30px rgba(0,0,0,.25); padding: 10px; animation: pop-in .14s ease-out; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } to { opacity: 1; transform: none; } }
.st-pop { width: min(21em, calc(100vw - 32px)); display: grid; gap: 8px; }
.st-top { display: flex; gap: 8px; flex-wrap: wrap; }
.st-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--soft); padding-bottom: 6px; }
.st-tabs button { font-size: 20px; width: 38px; height: 34px; border: 0; background: var(--soft); border-radius: 10px; cursor: pointer; }
.st-scroll { max-height: 15em; overflow: auto; scroll-behavior: smooth; padding-right: 4px; }
.st-scroll h4 { margin: 8px 0 4px; font-size: 13px; color: #6b6890; position: sticky; top: 0; background: #fff; }
.st-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.st { font-size: 26px; height: 40px; border: 2px solid transparent; background: none; border-radius: 10px; cursor: pointer; }
.st:hover { background: var(--soft); transform: scale(1.12); } .st[aria-pressed=true] { border-color: var(--ink); background: var(--accent, #fff3b8); }
.col-pop { display: grid; gap: 10px; }
.col-grid { display: grid; grid-template-columns: repeat(4, 44px); gap: 10px; }
.col-grid .swatch { width: 44px; height: 44px; }

/* catalog card that turns over to show what is inside */
.set-card.flip { perspective: 900px; overflow: visible; background: none; border: 0; box-shadow: none; }
.flip-in { position: relative; display: flex; flex-direction: column; flex: 1; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3, .7, .2, 1); }
.set-card.flip.flipped .flip-in { transform: rotateY(180deg); }
.flip-face { backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 3px solid var(--net); border-radius: var(--radius); box-shadow: 0 4px 0 var(--net); background: var(--card); overflow: hidden; }
.flip-front { display: flex; flex-direction: column; flex: 1; }
.flip-back { position: absolute; inset: 0; transform: rotateY(180deg); display: flex; flex-direction: column; gap: 6px; padding: 12px; background: linear-gradient(180deg, var(--net-soft), #fff 55%); }
.fb-head { display: flex; align-items: center; gap: 8px; font-size: 15px; } .fb-head b { line-height: 1.15; } .fb-emoji { font-size: 24px; }
.fb-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 13.5px; line-height: 1.25; overflow: hidden; flex: 1; align-content: start; }
.fb-list b { font-weight: 800; } .fb-list i { font-style: normal; color: var(--net-deep); font-size: .92em; } .fb-list span { color: #555; }
.fb-more { color: var(--net-deep); font-weight: 700; } .fb-meta { font-size: 12px; color: var(--net-deep); font-weight: 700; }
.set-card.flip:focus-visible { outline: 3px solid #ffb800; outline-offset: 3px; border-radius: var(--radius); }
.flip-back .set-actions { margin-top: auto; }
@media (prefers-reduced-motion: reduce) { .flip-in { transition: none; } }
.set-card.flip .flip-in { min-height: 17.4em; }
.fb-list { font-size: 13px; gap: 2px; }

/* ---------- Двадцать одно ---------- */
.bj { max-width: 62em; margin: 0 auto; font-size: clamp(12px, 2.1vw, 17px); }
.bj-table { width: 100%; box-sizing: border-box; display: grid; gap: .8em; padding: 1em; background: radial-gradient(ellipse at center, #2f9a62 0%, #1f7a4a 75%); border: 4px solid var(--ink); border-radius: 26px; box-shadow: inset 0 0 3em rgba(0,0,0,.3); min-height: 30em; grid-template-rows: auto auto auto; }
.bj-side { display: grid; gap: .4em; justify-items: center; }
.bj-who { color: #fff; font-weight: 800; display: flex; align-items: center; gap: .6em; text-shadow: 0 1px 0 rgba(0,0,0,.4); }
.bj-sum { min-width: 2.2em; text-align: center; background: #fffdf5; color: var(--ink); border: 3px solid var(--ink); border-radius: 999px; padding: 0 .5em; font-size: 1.2em; }
.bj-sum.max { background: #ffd54a; } .bj-sum.neg { background: #ffc9c9; }
.bj-cards { display: flex; gap: .6em; justify-content: center; flex-wrap: wrap; min-height: 10.6em; }
.bj-mid { display: grid; grid-template-columns: auto 1fr; gap: 1em; align-items: center; }
.bj-pile { position: relative; width: 4.6em; height: 6.4em; } .bj-pile span { position: absolute; inset: 0; border: 3px solid var(--ink); border-radius: .6em; background: repeating-linear-gradient(45deg, var(--primary) 0 .5em, #7d63e8 .5em 1em); } .bj-pile span:nth-child(2) { transform: translate(-.12em, -.12em); } .bj-pile span:nth-child(3) { transform: translate(-.24em, -.24em); }
.bj-msg { color: #fff; font-weight: 800; text-shadow: 0 1px 0 rgba(0,0,0,.4); text-align: center; min-height: 2.6em; display: grid; place-items: center; line-height: 1.2; font-size: 1.1em; }
.bj-msg.big { font-size: 1.5em; } .bj-msg.good { color: #ffe066; } .bj-msg.bad { color: #ffb3b3; }
.bj-card { position: relative; width: 7.4em; height: 10.4em; perspective: 800px; }
.bj-in { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .5s; }
.bj-card.down .bj-in { transform: rotateY(180deg); }
.bj-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 3px solid var(--ink); border-radius: .8em; box-shadow: 0 .2em 0 rgba(0,0,0,.35); }
.bj-back { transform: rotateY(180deg); background: repeating-linear-gradient(45deg, var(--primary) 0 .6em, #7d63e8 .6em 1.2em); }
.bj-front { background: #fffdf5; color: var(--ink); display: grid; place-items: center; text-align: center; padding: 1.4em .3em; font-weight: 900; overflow: hidden; overflow-wrap: anywhere; line-height: 1.1; }
.bj-w { position: absolute; left: .4em; top: .2em; font-size: 1.15em; color: #c0392b; } .bj-w.b { left: auto; top: auto; right: .4em; bottom: .2em; transform: rotate(180deg); }
.bj-card.ok .bj-front { background: #c6f1d3; } .bj-card.no .bj-front { background: #ffd0d0; }
.bj-res { position: absolute; left: 50%; bottom: -.9em; transform: translateX(-50%); z-index: 3; background: #fff; color: var(--ink); border: 3px solid var(--ink); border-radius: 999px; padding: 0 .6em; font-weight: 900; white-space: nowrap; }
.bj-card.ok .bj-res { background: #3ac16a; color: #fff; } .bj-card.no .bj-res { background: #e0392b; color: #fff; }
.bj-ctl { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; align-items: center; min-height: 3.4em; }
.bj-ctl .btn.no { background: #ffe2e2; border-color: #c0392b; color: #8a1c12; } .bj-ans { font-size: 1.6em; font-weight: 900; color: var(--ink); background: #fff3b8; border: 3px solid var(--ink); border-radius: 14px; padding: .1em .7em; }

/* ===== Двадцать одно: casino atmosphere ===== */
.bj { max-width: 64em; }
.bj-table { position: relative; overflow: hidden; display: grid; grid-template-rows: auto auto auto auto auto; gap: .5em; padding: 1.2em 1.2em 1em; min-height: 34em;
  background:
    radial-gradient(ellipse 70% 55% at 50% 38%, rgba(255,255,255,.16), transparent 70%),
    radial-gradient(ellipse at center, #2c9a63 0%, #1b7a48 62%, #0f5a33 100%);
  border: .7em solid #5a3a1e; border-radius: 2.4em;
  box-shadow: inset 0 0 0 .18em #c9a24a, inset 0 0 4em rgba(0,0,0,.55), 0 .5em 0 #3b2412, 0 1.1em 2em rgba(0,0,0,.35); }
.bj-table::before { content: ""; position: absolute; inset: 0; opacity: .13; pointer-events: none; mix-blend-mode: multiply;
  background-image: repeating-linear-gradient(0deg, rgba(0,0,0,.6) 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, rgba(0,0,0,.5) 0 1px, transparent 1px 4px); }
.bj-table::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 30%, transparent 40%, rgba(0,0,0,.35) 100%); }
.bj-table > * { position: relative; z-index: 1; }
.bj-felt-text { position: absolute !important; left: 6%; right: 6%; top: 34%; height: 26%; z-index: 0 !important; pointer-events: none; }
.bj-felt-text svg { width: 100%; height: 100%; } .bj-felt-text text { fill: rgba(255, 236, 160, .55); font: 800 17px/1 Georgia, 'Times New Roman', serif; letter-spacing: .14em; }
/* the dealer */
.bj-dealer { display: grid; grid-template-columns: auto 1fr auto; gap: .8em; align-items: center; }
.bj-dealer-pic { width: 6.2em; height: 5.6em; border: .22em solid #c9a24a; border-radius: 50% 50% 1em 1em; background: radial-gradient(circle at 50% 30%, #3a4a5a, #1b2530); overflow: hidden; box-shadow: 0 .25em 0 rgba(0,0,0,.45); }
.bj-dealer-pic svg { width: 130%; margin: -8% 0 0 -15%; display: block; }
.bj-dealer-pic .bflash { opacity: 0; }
.bj-dmeta { display: grid; gap: .4em; justify-items: start; }
.bj-dname { letter-spacing: .04em; }
.bj-bubble { position: relative; background: #fffdf5; color: var(--ink); border: .18em solid var(--ink); border-radius: 1em; padding: .3em .8em; max-width: 22em; line-height: 1.15; animation: bj-pop .25s ease-out; }
.bj-bubble::before { content: ""; position: absolute; left: -.55em; top: .8em; border: .35em solid transparent; border-right-color: var(--ink); }
.bj-bubble b { display: block; font-size: 1.3em; color: #c0392b; } .bj-bubble small { display: block; opacity: .75; }
@keyframes bj-pop { from { transform: scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
/* the card shoe */
.bj-shoe { position: relative; width: 4.6em; height: 6.6em; transform: rotate(8deg); }
.bj-shoe span { position: absolute; border: .18em solid #111; border-radius: .5em; background: repeating-linear-gradient(45deg, #8b1a2b 0 .4em, #b32a3f .4em .8em); }
.bj-shoe span:nth-child(1) { inset: 0; } .bj-shoe span:nth-child(2) { inset: .15em -.35em -.15em .35em; filter: brightness(.85); } .bj-shoe span:nth-child(3) { inset: .3em -.7em -.3em .7em; filter: brightness(.7); }
.bj-side { display: grid; justify-items: center; } .bj-cards { min-height: 11.4em; align-items: center; }
.bj-who { color: #fff6cf; font-weight: 800; display: flex; align-items: center; gap: .6em; text-shadow: 0 .08em 0 rgba(0,0,0,.6); letter-spacing: .03em; }
.bj-sum { background: radial-gradient(circle at 30% 25%, #fff, #e8e0c6); border: .15em solid #c9a24a; min-width: 2.3em; }
.bj-mid { min-height: 4.6em; display: grid; place-items: center; }
.bj-msg { color: #fff6cf; }
/* playing cards */
.bj-card { width: 7.6em; height: 10.8em; filter: drop-shadow(0 .35em .3em rgba(0,0,0,.45)); animation: bj-land .3s ease-out; }
@keyframes bj-land { from { margin-top: -.6em; } to { margin-top: 0; } }
.bj-back { background: repeating-linear-gradient(45deg, #8b1a2b 0 .5em, #b32a3f .5em 1em); border: .16em solid #fff; outline: .16em solid #8b1a2b; outline-offset: -.5em; }
.bj-back::after { content: "♠"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 3em; color: rgba(255,255,255,.75); }
.bj-front { background: linear-gradient(180deg, #fffefa, #f6efdc); border: .16em solid #cfc6a8; }
.bj-front.red .bj-w, .bj-front.red .bj-pip { color: #c0392b; } .bj-w { color: #1a1a24; line-height: 1; font-size: 1.15em; display: grid; justify-items: center; left: .35em; top: .25em; } .bj-w small { font-size: .85em; }
.bj-pip { position: absolute; right: .5em; top: .35em; font-size: 1.4em; opacity: .25; color: #1a1a24; }
.bj-card.ok .bj-front { background: linear-gradient(180deg, #e3f8e9, #c6f1d3); } .bj-card.no .bj-front { background: linear-gradient(180deg, #ffe4e4, #ffd0d0); }
/* chips, bet spot, bank */
.bj-player { display: flex; align-items: center; justify-content: center; gap: 1.2em; flex-wrap: wrap; }
.bj-bet { position: relative; width: 4.4em; height: 4.4em; border: .18em dashed rgba(255, 236, 160, .7); border-radius: 50%; display: grid; place-items: center; }
.bj-chip { display: inline-grid; place-items: center; width: 3.2em; height: 3.2em; border-radius: 50%; background: radial-gradient(circle, #d33 0 38%, #fff 38% 46%, #d33 46%); border: .2em dashed #fff; box-shadow: 0 .18em 0 rgba(0,0,0,.45), inset 0 0 0 .18em #b11; color: #fff; font-weight: 900; transition: transform .7s cubic-bezier(.4,0,.2,1), opacity .7s; }
.bj-bank { display: flex; align-items: center; gap: .4em; color: #fff6cf; font-weight: 900; font-size: 1.2em; } .bj-chip.small { width: 1.6em; height: 1.6em; border-width: .14em; }
/* stamps */
.bj-stamp { position: absolute; left: 50%; top: 50%; z-index: 5 !important; transform: translate(-50%, -50%) rotate(-7deg); font: 900 2.6em/1 Georgia, serif; letter-spacing: .06em; padding: .15em .5em; border: .14em solid currentColor; border-radius: .3em; background: rgba(255,255,255,.93); color: #444; box-shadow: 0 .2em 0 rgba(0,0,0,.35); animation: bj-stamp .45s cubic-bezier(.2, 1.6, .4, 1); white-space: nowrap; pointer-events: none; }
.bj-stamp.good { color: #1e8f4e; } .bj-stamp.bad { color: #c0392b; } .bj-stamp.gold { color: #b8860b; background: #fff3b8; }
@keyframes bj-stamp { from { transform: translate(-50%, -50%) rotate(-7deg) scale(2.4); opacity: 0; } to { transform: translate(-50%, -50%) rotate(-7deg) scale(1); opacity: 1; } }
.bj-ctl .btn.big { box-shadow: 0 .25em 0 var(--ink); }
@media (max-width: 640px) { .bj-felt-text text { font-size: 15px; } .bj-dealer-pic { width: 4.6em; height: 4.2em; } .bj-card { width: 6.2em; height: 8.8em; } .bj-cards { min-height: 9.6em; } }
.bj-mid { grid-template-columns: 1fr; } .bj-msg { text-align: center; justify-self: center; } .bj-felt-text { top: 40%; } .bj-felt-text text { font-size: 15px; }
.bj-msg:not(:empty) { background: rgba(0, 0, 0, .38); padding: .25em .9em; border-radius: 999px; }

/* ===== Двадцать одно v3: a real table layout (dealer on the straight side, players on an arc), chips, full screen ===== */
.bj-table { grid-template-rows: auto auto auto auto auto; gap: .4em; }
.bj-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 1em; }
.bj-dealer { display: grid; grid-template-columns: auto auto; gap: .8em; align-items: center; justify-self: center; grid-template-areas: "pic meta" "tray tray"; }
.bj-dealer-pic { grid-area: pic; width: 6.2em; height: 6em; background: radial-gradient(circle at 50% 30%, #4f7c63, #1f3d2e); border-radius: 50% 50% 1em 1em; }
.bj-dealer-pic svg { width: 100%; height: 100%; margin: 0; }
.bj-dmeta { grid-area: meta; }
.bj-tray { grid-area: tray; justify-self: center; height: 2.4em; min-width: 14em; border-radius: .5em; background: linear-gradient(180deg, #2a1a0d, #4a2f18); border: .15em solid #c9a24a; display: flex; align-items: center; justify-content: center; gap: .5em; padding: 0 .8em; }
.bj-tray::before { content: ""; display: block; width: 100%; height: 1.4em; background: repeating-linear-gradient(90deg, #e9e9ee 0 1.3em, #d33 1.3em 2.6em, #2f9a62 2.6em 3.9em, #222 3.9em 5.2em); border-radius: .3em; box-shadow: inset 0 .4em .3em rgba(0,0,0,.35); }
.bj-tray .bj-dstack { display: none; }
.bj-shoe { justify-self: end; margin-right: 1em; } .bj-discard { position: relative; width: 6em; height: 4.4em; justify-self: start; margin-left: 1em; border: .18em solid #c9a24a; border-radius: .5em; background: rgba(0,0,0,.25); }
.bj-discard span { position: absolute; width: 2.6em; height: 3.6em; top: .3em; left: .5em; border: .14em solid #888; border-radius: .3em; background: #fffdf5; transform: rotate(-12deg); } .bj-discard span + span { left: 2.4em; transform: rotate(9deg); background: #f3eed8; }
.bj-who.me { min-height: 1.8em; }
/* players on an arc, each with a betting circle */
.bj-seats { display: flex; justify-content: center; gap: .6em; flex-wrap: nowrap; align-items: flex-start; padding-bottom: 1.8em; }
.bj-seat { display: grid; justify-items: center; gap: .25em; min-width: 5em; max-width: 8em; flex: 1 1 0; opacity: .75; transition: opacity .3s, transform .3s; }
.bj-seat.on { opacity: 1; } .bj-seat.on .bj-sname { background: var(--primary); color: #fff; } .bj-seat.out { opacity: .3; filter: grayscale(1); }
.bj-seat .bj-bet { width: 5em; height: 5em; border: .18em solid rgba(255, 236, 160, .75); border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.12); position: relative; }
.bj-seat.on .bj-bet { border-color: #ffe066; box-shadow: 0 0 1.2em rgba(255, 224, 102, .6); }
.bj-sname { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: rgba(255,255,255,.9); color: var(--ink); font-weight: 800; border-radius: 999px; padding: 0 .7em; font-size: .9em; }
.bj-bank { min-height: 3em; display: grid; align-items: end; justify-items: center; }
/* chips and neat stacks */
.bj-stack { display: flex; align-items: flex-end; gap: .15em; justify-content: center; }
.bj-col { position: relative; width: 2.3em; } .bj-col .bj-chip { position: absolute; left: 0; }
.bj-chip { display: inline-grid; place-items: center; width: 2.3em; height: 2.3em; border-radius: 50%; font-size: .75em; font-weight: 900; color: #fff; border: .22em dashed #fff; box-shadow: 0 .14em 0 rgba(0,0,0,.5); transition: none; }
.bj-chip.c1 { background: #ececf2; border-color: #9aa; color: #333; } .bj-chip.c5 { background: #d33; } .bj-chip.c25 { background: #2f9a62; } .bj-chip.c100 { background: #222; }
.bj-chip.fly { position: fixed; left: 0; top: 0; z-index: 90; width: 36px; height: 36px; font-size: 11px; pointer-events: none; }
.bj-more { position: absolute; right: -1.6em; top: 0; font-style: normal; color: #fff6cf; font-weight: 900; font-size: .8em; }
.bj-ctl .btn.chipbtn { min-width: 4em; color: #fff; border-color: var(--ink); } .bj-ctl .btn.chipbtn.c1 { background: #ececf2; color: #222; } .bj-ctl .btn.chipbtn.c5 { background: #d33; } .bj-ctl .btn.chipbtn.c25 { background: #2f9a62; }
.bj-ctl .btn.chipbtn:disabled { opacity: .35; }
/* full screen: the table fills the window */
body.fs .bj { max-width: none; } body.fs .bj-table { min-height: 0; }
@media (max-width: 720px) { .bj-seat { min-width: 3.6em; } .bj-seat .bj-bet { width: 3.8em; height: 3.8em; } .bj-discard { display: none; } .bj-top { grid-template-columns: 1fr auto; } }

.bj-sum:empty { display: none; }
body.fs .bj-ctl { position: fixed; left: 0; right: 0; bottom: 10px; z-index: 35; padding: 0 12px; }
body.fs .bj-table { overflow: hidden; }
body.fs .bj { padding-bottom: 0; }
body.fs .pboard { padding-right: 110px; }
.bj-seats { padding-bottom: .5em; } .bj-table { padding-bottom: .6em; }

/* ===== Двадцать одно v4: no header, the green field is the whole screen; number cards + word cards ===== */
.bj-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 1em; }
.bj-topl { display: grid; gap: .5em; justify-items: start; } .bj-topl .gm-info { color: #fff6cf; font-weight: 800; text-shadow: 0 .08em 0 rgba(0,0,0,.6); }
.bj-dealer { display: grid; gap: .35em; justify-items: center; }
.bj-bubble { max-width: 20em; } .bj-bubble::before { display: none; }
.bj-tray { min-width: 11em; height: 1.7em; }
.bj-table { grid-template-rows: auto auto 1fr auto auto auto; }
.bj-ctl { position: static; padding: .3em 0 0; }
body.fs .bj { max-width: none; margin: 0; }
body.fs .bj-table { position: fixed; inset: 0; z-index: 20; height: auto !important; min-height: 0; border-radius: 0; border-width: .5em; padding: .7em 1em .7em; }
body.fs .bj-ctl { position: static; padding: .3em 0 0; }
.bj-card.num .bj-big { position: absolute; inset: 0; display: grid; place-items: center; font-size: 4.2em; color: #1a1a24; }
.bj-card.num .bj-front.red .bj-big { color: #c0392b; }
.bj-card.word .bj-front::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: .45em; background: var(--primary); }
.bj-card.word .bj-front { padding-top: 1.6em; }
body.fs .bj-shoe { margin-right: 4.6em; margin-top: .2em; }

.bj-sum.big { font-size: 2.1em; min-width: 2.2em; line-height: 1.15; padding: 0 .4em; }
.bj-who { gap: .5em; } .bj-dealer .bj-who { font-size: 1em; }

/* real table: the player's cards overlap in a cascade (a bit higher and to the right), the dealer's lie side by side */
.bj-cards.cascade { flex-wrap: nowrap; gap: 0; justify-content: center; padding-top: 3.2em; }
.bj-cards.cascade > .bj-card { position: relative; top: calc(var(--i, 0) * -.6em); margin-left: -4.3em; }
.bj-cards.cascade > .bj-card:first-child { margin-left: 0; }
.bj-cards.cascade > .bj-card .bj-res { left: .3em; transform: none; bottom: -.8em; font-size: .85em; }

/* ===== Двадцать одно v5: a slightly tilted table, big physical chips, nicer bets ===== */
.bj-table { background: radial-gradient(ellipse at 50% 30%, #1d4d36, #0b2217 75%); border: 0; box-shadow: none; border-radius: 0; overflow: hidden; }
body:not(.fs) .bj-table { border-radius: 1.6em; }
.bj-table::before, .bj-table::after { display: none; }
.bj-plane { position: absolute; left: 1.2%; right: 1.2%; top: 1.2%; bottom: 1.4%; z-index: 0 !important; border: .8em solid #5a3a1e; border-radius: 1.6em 1.6em 22% 22% / 1.6em 1.6em 14% 14%;
  background: radial-gradient(ellipse 70% 55% at 50% 35%, rgba(255,255,255,.17), transparent 70%), radial-gradient(ellipse at center, #2c9a63 0%, #1b7a48 62%, #0f5a33 100%);
  box-shadow: inset 0 0 0 .2em #c9a24a, inset 0 0 5em rgba(0,0,0,.5), 0 1em 1.6em rgba(0,0,0,.6), 0 .25em 0 #3b2412; overflow: hidden; }
.bj-plane::before { content: ""; position: absolute; inset: 0; opacity: .13; mix-blend-mode: multiply; background-image: repeating-linear-gradient(0deg, rgba(0,0,0,.6) 0 1px, transparent 1px 3px), repeating-linear-gradient(90deg, rgba(0,0,0,.5) 0 1px, transparent 1px 4px); }
.bj-plane::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 28%, transparent 40%, rgba(0,0,0,.38) 100%); }
/* chips: bigger, flattened like discs lying on the felt, every one drawn, with a thick edge */
.bj-chip { width: 3em; height: 3em; font-size: .9em; transform: scaleY(.78); border-width: .24em; box-shadow: 0 .2em 0 rgba(0,0,0,.55), 0 .35em .3em rgba(0,0,0,.35), inset 0 0 0 .2em rgba(0,0,0,.18); }
.bj-col { width: 3em; } .bj-stack { gap: .25em; filter: drop-shadow(0 .3em .25em rgba(0,0,0,.4)); }
.bj-chip.small { width: 2em; height: 2em; } .bj-chip.fly { width: 2.7em; height: 2.7em; transform-origin: center; }
.bj-seat .bj-bet { width: 7em; height: 5.4em; border: 0; background: none; box-shadow: none; position: relative; display: grid; place-items: center; }
.bj-seat .bj-bet::before { content: ""; position: absolute; inset: 0; border: .2em solid rgba(255, 236, 160, .7); border-radius: 50%; background: rgba(0,0,0,.14); }
.bj-seat.on .bj-bet::before { border-color: #ffe066; box-shadow: 0 0 1.4em rgba(255, 224, 102, .65); }
.bj-seat .bj-bet .bj-stack { position: relative; }
.bj-amt { min-height: 1.3em; color: #fff6cf; font-weight: 900; text-shadow: 0 .08em 0 rgba(0,0,0,.7); }
.bj-seat { min-width: 7em; max-width: 13em; } .bj-sname { font-size: .95em; }
.bj-bank { min-height: 4.6em; } .bj-bank.grew { animation: bank-grow .8s ease-out; }
@keyframes bank-grow { 0% { transform: scale(1); } 30% { transform: scale(1.18); filter: brightness(1.3); } 100% { transform: scale(1); } }
.bj-seat.paying .bj-bet::before { border-color: #7dffb0; }
.bj-seats { padding-bottom: .4em; }
/* the bets: a rack of real chips to tap, then "Раздать" */
.bj-ctl .btn.chipbtn { width: 4.4em; height: 4.4em; min-width: 0; padding: 0; border-radius: 50%; font-size: 1.25em; font-weight: 900; color: #fff; border: .18em dashed #fff; box-shadow: 0 .18em 0 rgba(0,0,0,.5), inset 0 0 0 .2em rgba(0,0,0,.2); transition: transform .12s; text-shadow: 0 .05em 0 rgba(0,0,0,.4); }
.bj-ctl .btn.chipbtn:hover:not(:disabled) { transform: translateY(-.2em) rotate(-6deg); } .bj-ctl .btn.chipbtn:active:not(:disabled) { transform: scale(.94); }
.bj-ctl .btn.chipbtn.c1 { background: radial-gradient(circle, #f4f4f8 0 52%, #c9c9d4 52% 60%, #f4f4f8 60%); color: #333; text-shadow: none; }
.bj-ctl .btn.chipbtn.c5 { background: radial-gradient(circle, #d33 0 52%, #fff 52% 60%, #d33 60%); }
.bj-ctl .btn.chipbtn.c25 { background: radial-gradient(circle, #2f9a62 0 52%, #fff 52% 60%, #2f9a62 60%); }
.bj-ctl .btn.chipbtn.c100 { background: radial-gradient(circle, #222 0 52%, #fff 52% 60%, #222 60%); }
.bj-ctl .btn.chipbtn:disabled { opacity: .3; filter: grayscale(.6); }
.bj-ctl .btn.undo { width: 3.2em; height: 3.2em; min-width: 0; padding: 0; border-radius: 50%; font-size: 1.3em; background: rgba(255,255,255,.92); }
.bj-ctl .btn.deal { padding-left: 1.6em; padding-right: 1.6em; font-size: 1.25em; }
.bj-ctl { gap: .9em; }

.bj-ctl .btn.chipbtn { width: 3.9em; height: 3.9em; font-size: 1.15em; }
.bj-ctl .btn.undo { width: 2.8em; height: 2.8em; }
body.fs .bj-table { padding-bottom: .5em; }

/* full screen: the buttons are pinned to the bottom edge of the field, always reachable; the table keeps room for them */
body.fs .bj-table { padding-bottom: 6.2em; }
body.fs .bj-ctl { position: fixed; left: 0; right: 0; bottom: .7em; z-index: 40; padding: 0 1em; min-height: 0; }

/* ===== Двадцать одно: the improved version ===== */
.bj-seat { gap: .35em; align-content: start; } .bj-bank { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; margin-top: .6em; }
.bj-cnt { font-size: 1.6em; font-weight: 900; color: #fff6cf; text-shadow: 0 .08em 0 rgba(0,0,0,.7); line-height: 1; transition: transform .2s, color .2s; }
.bj-cnt.up { color: #7dffb0; transform: scale(1.25); } .bj-cnt.down { color: #ffb3b3; transform: scale(.92); }
.bj-goal { width: 90%; display: grid; gap: .1em; justify-items: center; } .bj-goal > span { width: 100%; height: .6em; border-radius: 999px; background: rgba(0,0,0,.35); overflow: hidden; border: .12em solid rgba(255, 236, 160, .6); }
.bj-goal i { display: block; height: 100%; background: linear-gradient(90deg, #ffd54a, #ff9f1a); transition: width .7s; } .bj-goal small { color: #fff6cf; font-size: .72em; opacity: .85; }
.bj-delta { position: absolute; left: 50%; top: 35%; z-index: 6; font-weight: 900; font-size: 2em; pointer-events: none; text-shadow: 0 .08em 0 rgba(0,0,0,.7); animation: bj-delta 1.4s ease-out forwards; }
.bj-delta.pos { color: #7dffb0; } .bj-delta.neg { color: #ffb3b3; }
@keyframes bj-delta { from { transform: translate(-50%, 0) scale(.6); opacity: 0; } 15% { transform: translate(-50%, -.4em) scale(1.2); opacity: 1; } to { transform: translate(-50%, -3em) scale(1); opacity: 0; } }
.bj-seat { position: relative; }
.bj-seat.lead .bj-sname { background: #ffd54a; color: #5a3a00; box-shadow: 0 0 1.2em rgba(255, 213, 74, .9); } .bj-seat.lead .bj-sname::before { content: "👑 "; }
.bj-leader { color: #ffe066; font-weight: 800; text-shadow: 0 .08em 0 rgba(0,0,0,.6); min-height: 1.2em; }

/* ===== game picker in groups ===== */
.picker { max-width: 860px; }
.picker .continue { justify-self: center; font-size: 1.2em; padding: .7em 1.6em; }
.pk-group { display: grid; gap: 8px; }
.pk-group h3 { font-size: 18px; display: flex; align-items: baseline; gap: .6em; margin: 4px 0 0; } .pk-group h3 small { font-weight: 600; color: var(--muted); font-size: 13px; }
.pk-group .game-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pk-group .game-card { padding: 10px 10px 12px; gap: 2px; }
.pk-group .gc-emoji { font-size: 38px; } .pk-group .gc-name { font-size: 18px; }
.pk-group .gc-desc { font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ===== first visit ===== */
.firstrun { background: #fff; border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--lift); padding: 12px 14px; margin: 0 0 14px; display: grid; gap: 10px; }
.fr-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 1.05em; }
.fr-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.fr-step { position: relative; display: grid; gap: 2px; justify-items: center; text-align: center; padding: 10px 8px; border-radius: 14px; background: var(--soft); }
.fr-n { position: absolute; left: 8px; top: 8px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: #fff; font-weight: 800; font-size: 13px; }
.fr-i { font-size: 34px; line-height: 1.1; } .fr-step small { color: var(--muted); }

/* ===== game picker v2: 4 recent games, the rest on request ===== */
.picker { max-width: 760px; }
.picker .game-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.picker .game-card { position: relative; padding: 12px 10px 14px; gap: 2px; }
.picker .gc-emoji { font-size: 44px; } .picker .gc-name { font-size: 19px; } .picker .gc-desc { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.picker .game-card.last { border-color: var(--primary); box-shadow: 0 4px 0 var(--primary); }
.gc-badge { position: absolute; left: 8px; top: 8px; background: var(--primary); color: #fff; font-weight: 800; font-size: 11px; border-radius: 999px; padding: 1px 8px; }
.show-more { justify-self: center; }
.picker .game-grid.more { padding-top: 4px; animation: pop-in .2s ease-out; }
.presets { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; } .presets .seg button[aria-pressed=true] { background: var(--primary); }

/* ===== projector mode: a bigger interface (the games scale themselves to the screen) ===== */
body.proj .setup, body.proj .picker, body.proj .empty, body.proj .notice { zoom: 1.3; }
body.proj .dlg { zoom: 1.2; }
body.proj .btn { min-height: 48px; }
body.proj .top .btn { min-height: 44px; }
