/* 掼蛋蛋 (GuanDanDan), the GuanDan web app — original table design: green felt, a gold-rimmed table, dark glass plates.
   Card sizes come from CSS variables that app.js sets from the window size: --cw (card width),
   --ch, --step (visible part of a stacked card), --mw (played-card width), --handH. */
:root {
  --cw: 56px; --ch: 78px; --step: 24px; --mw: 40px; --handH: 160px;
  --gold: #f2c94c; --gold-d: #c9971c; --gold-soft: rgba(242, 201, 76, .34);
  --ink: #1d2327; --red: #d6336c;
  --felt-1: #1f805b; --felt-2: #135d43; --felt-3: #0b3d2c; --edge: #05211a;
  --panel: rgba(2, 22, 16, .66); --line: rgba(255, 255, 255, .13);
  --teamA: #f2c94c; --teamB: #7cc4fa;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--edge); color: #f1f3f5;
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif; }
button, input, select { font: inherit; }
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; }
.muted { opacity: .7; font-size: .9em; }
.err { color: #ffa8a8; min-height: 1.2em; }
.err.ok { color: var(--gold); font-weight: 700; }  /* a welcome, not an error */
.err .btn { margin-left: 4px; vertical-align: 1px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* the site's mark next to its name (掼蛋蛋): a small egg in a gold band, like the one in the opening animation */
.egg-mark { display: inline-block; width: .6em; height: .76em; margin: 0 .2em 0 .02em; vertical-align: -.06em; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  background: linear-gradient(transparent 56%, #f2c94c 56% 67%, transparent 67%), radial-gradient(circle at 36% 28%, #fff 0, #fbf4e1 45%, #d9c294 100%);
  box-shadow: inset 0 -.05em .08em rgba(122,90,0,.35), 0 .05em .12em rgba(0,0,0,.45); }

/* ---------- buttons */
.btn { border: 0; border-radius: 999px; padding: 8px 18px; font-weight: 700; cursor: pointer; color: var(--ink);
  background: linear-gradient(#ffffff, #dfe3e6); box-shadow: 0 2px 0 rgba(0,0,0,.3), 0 4px 10px rgba(0,0,0,.18); }
.btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0,0,0,.3); }
.btn:disabled { opacity: .42; cursor: default; }
.btn.primary { background: linear-gradient(#ffe27a, var(--gold) 55%, var(--gold-d)); color: #2b2100; }
.btn.blue { background: linear-gradient(#8fd0ff, #3d9be9); color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.25); }
.btn.ghost { background: rgba(255,255,255,.1); color: #f1f3f5; box-shadow: none; border: 1px solid var(--line); }
.btn.small { padding: 5px 12px; font-size: .88em; }

/* ---------- landing / join / login (test mode) */
#landing, #joinScreen, #login { display: grid; place-items: center; overflow: auto;
  background: radial-gradient(120% 90% at 50% 35%, var(--felt-1) 0%, var(--felt-2) 45%, var(--felt-3) 80%, var(--edge) 100%); }
.landing-panel { width: min(92vw, 420px); background: var(--panel); border: 1px solid var(--gold-soft); border-radius: 20px;
  padding: 24px; display: grid; gap: 12px; box-shadow: 0 16px 50px rgba(0,0,0,.45); }
.landing-panel h1 { margin: 0 0 4px; font-size: 2.1em; letter-spacing: 3px; color: var(--gold); }
.landing-panel h1 small { display: block; margin: 6px 0 0 2px; font-size: .42em; color: #f1f3f5; letter-spacing: 0; opacity: .85; }
.landing-panel label { display: grid; gap: 4px; font-size: .9em; }
.landing-panel p { margin: 0; }
.landing-panel input, .landing-panel select { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255,255,255,.94); color: var(--ink); }
.landing-panel .row { display: flex; gap: 8px; } .landing-panel .row input { flex: 1; text-transform: uppercase; }
.sep { text-align: center; opacity: .6; font-size: .85em; }
.muted.small { font-size: .78em; }

/* 登录 / 注册 (test mode): two tabs; 注册 has the name, the 蛋 suffix picker (egg-shell chips, the picked one gold, 随机
   rolls over them), the nickname as it will be, and the password */
.login-panel { width: min(94vw, 470px); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: rgba(0,0,0,.3); border: 1px solid var(--line); }
.tabs button { border: 0; border-radius: 999px; padding: 7px 6px; background: transparent; color: #f1f3f5; font-weight: 800; letter-spacing: 1px; cursor: pointer;
  transition: background .18s, color .18s; }
.tabs button small { font-weight: 400; font-size: .72em; letter-spacing: 0; opacity: .75; margin-left: 2px; }
.tabs button[aria-selected="true"] { background: linear-gradient(#ffe27a, var(--gold) 55%, var(--gold-d)); color: #2b2100; box-shadow: 0 2px 0 rgba(0,0,0,.25); }
.tabs button.nudge { animation: tab-nudge .5s ease-in-out 3; }
@keyframes tab-nudge { 50% { box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(242,201,76,.7); } }
.auth-form { display: grid; gap: 12px; }
.egg-pick { display: grid; gap: 7px; }
.egg-head { display: flex; align-items: center; gap: 6px; font-size: .9em; }
.egg-head small { opacity: .7; }
.egg-head .chip { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; font-weight: 700; }
.dice { width: 14px; height: 14px; flex: none; } .dice rect { fill: none; stroke: currentColor; stroke-width: 1.6; } .dice circle { fill: currentColor; }
.egg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(4em, 1fr)); gap: 6px; }
.egg-chip { border: 1px solid rgba(255,255,255,.5); border-radius: 999px; padding: 5px 2px 6px; font-size: .88em; font-weight: 700; letter-spacing: 1px; cursor: pointer;
  color: #4a3a14; background: linear-gradient(#fffaf0, #efe3c3); box-shadow: 0 2px 0 rgba(0,0,0,.28); white-space: nowrap; transition: transform .1s; }
.egg-chip:hover { transform: translateY(-1px); }
.egg-chip.roll { background: #fff3c4; box-shadow: 0 0 0 2px #fff3c4, 0 0 12px rgba(255,243,196,.8); }
.egg-chip[aria-checked="true"] { color: #2b2100; border-color: #fff3c4; background: linear-gradient(#ffe27a, var(--gold) 55%, var(--gold-d));
  box-shadow: 0 0 0 2px rgba(255,243,196,.55), 0 0 14px rgba(242,201,76,.6); animation: egg-picked .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes egg-picked { 0% { transform: scale(.85); } 55% { transform: scale(1.1) rotate(-3deg); } }
.egg-grid.want { animation: egg-want .45s ease-in-out; }  /* 注册 without a suffix */
@keyframes egg-want { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.name-preview { display: grid; justify-items: center; gap: 2px; padding: 7px 10px 9px; border-radius: 14px; background: rgba(0,0,0,.24); border: 1px dashed var(--gold-soft); }
.name-preview .cap { font-size: .74em; opacity: .7; }
#regPreview { display: flex; max-width: 100%; font-size: 1.45em; line-height: 1.25; font-weight: 900; letter-spacing: 1px; white-space: nowrap; color: #fff; }
#regPreview .nm { overflow: hidden; text-overflow: ellipsis; }
#regPreview .egg { color: var(--gold); flex: none; }
#regPreview .ph { opacity: .42; font-weight: 700; }
#regPreview .egg.pop { display: inline-block; animation: egg-pop .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes egg-pop { from { transform: scale(.55) rotate(-8deg); opacity: .3; } }

/* ---------- test mode lobby (大厅): every table as a small gold-rimmed felt oval; the dots are the two
   people's seats (team B blue), the gold glow a deal in progress */
#hall { display: flex; overflow: auto; padding: 3vh 0;
  background: radial-gradient(120% 90% at 50% 35%, var(--felt-1) 0%, var(--felt-2) 45%, var(--felt-3) 80%, var(--edge) 100%); }
.hall-panel { margin: auto; width: min(94vw, 820px); background: var(--panel); border: 1px solid var(--gold-soft); border-radius: 20px;
  padding: 20px 22px; display: grid; gap: 12px; box-shadow: 0 16px 50px rgba(0,0,0,.45); }
.hall-panel h1 { margin: 0 0 2px; font-size: 2.1em; letter-spacing: 3px; color: var(--gold); }
.hall-panel h1 small { font-size: .42em; color: #f1f3f5; letter-spacing: 0; margin-left: 8px; opacity: .85; }
.hall-panel p { margin: 0; }
#hallErr:empty { display: none; }  /* under the header: a welcome (gold) or an error */
.hall-row { display: flex; gap: 8px; }
.hall-row input { width: 9em; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.94); color: var(--ink); }
.hall-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.table-tile { display: grid; gap: 6px; justify-items: center; padding: 10px 6px; border-radius: 16px;
  background: rgba(255,255,255,.06); border: 1px solid var(--line); }
.mini-felt { width: 88px; height: 54px; border-radius: 999px; display: grid; place-items: center; align-content: center; gap: 4px;
  background: radial-gradient(120% 95% at 50% 38%, var(--felt-1) 0%, var(--felt-2) 55%, var(--felt-3) 100%);
  border: 2px solid var(--gold-d); box-shadow: inset 0 0 14px rgba(0,0,0,.4); }
.mini-felt b { color: var(--gold); font-size: 1.3em; line-height: 1; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.dots { display: flex; gap: 7px; }
.dots i { width: 9px; height: 9px; border-radius: 50%; background: rgba(255,255,255,.22); }
.dots i.on { background: var(--teamB); box-shadow: 0 0 6px var(--teamB); }
.table-tile.playing .mini-felt { border-color: var(--gold); box-shadow: 0 0 12px rgba(242,201,76,.5), inset 0 0 14px rgba(0,0,0,.4); }
.table-tile .status { font-size: .8em; opacity: .85; white-space: nowrap; }
.hall-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px 12px; flex-wrap: wrap; }
.hall-user { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.hall-user #hallUser { display: inline-flex; max-width: 14em; font-weight: 700; }
#hallUser .nm { overflow: hidden; text-overflow: ellipsis; }
#hallUser .egg { flex: none; color: var(--gold); } #hallUser .nm:only-child { color: var(--gold); }  /* a name without a suffix: gold, as before */
@media (max-width: 520px) { .hall-panel h1 small { display: block; margin: 6px 0 0; } }

/* 我的战绩 (my record): only the logged-in person's own deals; W/L marks newest first */
.my-stats { display: grid; gap: 8px; padding: 10px 14px; border-radius: 14px; background: rgba(0,0,0,.24); border: 1px solid var(--gold-soft); }
.ms-title { color: var(--gold); font-weight: 800; }
.ms-title small { color: #f1f3f5; opacity: .65; font-weight: 400; font-size: .78em; margin-left: 6px; }
.ms-body { display: flex; gap: 10px 22px; align-items: center; flex-wrap: wrap; }
.ms-nums { display: flex; gap: 20px; }
.ms-nums div { display: grid; justify-items: start; }
.ms-nums b { font-size: 1.55em; line-height: 1.1; color: #fff; font-variant-numeric: tabular-nums; }
.ms-nums span { font-size: .74em; opacity: .72; white-space: nowrap; }
.ms-recent-box { display: grid; gap: 4px; min-width: 0; }
.ms-cap { font-size: .72em; opacity: .65; }
.ms-recent { display: flex; gap: 3px; flex-wrap: wrap; min-height: 18px; }
.ms-recent .none { font-size: .8em; opacity: .6; }
.wl { width: 18px; height: 18px; border-radius: 5px; display: grid; place-items: center; font-size: .68em; font-weight: 800; flex: none; }
.wl.w { background: linear-gradient(#ffe27a, var(--gold)); color: #2b2100; }
.wl.l { background: rgba(255,255,255,.14); color: #ced4da; }
.ms-seat { font-size: .88em; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.result-stats { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 6px 0 2px; font-size: .88em; }
.result-stats b { color: var(--gold); }
.result-stats .ms-recent { min-height: 0; }

/* ---------- table: top bar, felt, hand, tools stacked */
#table { display: flex; flex-direction: column; user-select: none; -webkit-user-select: none;
  background: radial-gradient(120% 95% at 50% 38%, var(--felt-1) 0%, var(--felt-2) 42%, var(--felt-3) 78%, var(--edge) 100%); }
#topbar { flex: none; height: 44px; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 0 10px; background: linear-gradient(rgba(0,0,0,.5), rgba(0,0,0,.12)); position: relative; z-index: 30; }
.chips { display: flex; gap: 6px; align-items: center; flex: none; }
.chip { padding: 4px 11px; border-radius: 999px; background: rgba(0,0,0,.32); border: 1px solid var(--line); font-size: .85em;
  white-space: nowrap; color: #f1f3f5; }
.chip.gold { color: #2b2100; background: linear-gradient(#ffe27a, var(--gold)); border-color: transparent; font-weight: 800; }
.btn-chip { cursor: pointer; } .btn-chip.on { background: var(--gold); border-color: transparent; color: #2b2100; font-weight: 700; }
#conn { color: #ffa8a8; font-size: .8em; }

/* 记牌器 (card counter): the cards the other three hands still hold, by rank */
#tracker { display: flex; gap: 1px; padding: 2px 6px; border-radius: 10px; background: rgba(0,0,0,.42);
  border: 1px solid var(--gold-soft); min-width: 0; overflow: hidden; }
.tk { display: grid; justify-items: center; min-width: 23px; padding: 0 1px; line-height: 1.08; border-radius: 6px; }
.tk b { font-size: .68em; font-weight: 600; opacity: .8; white-space: nowrap; }
.tk span { font-size: .95em; font-weight: 800; font-variant-numeric: tabular-nums; }
.tk.zero span { opacity: .28; }
.tk.many span { color: var(--gold); }
.tk.level { background: rgba(242,201,76,.16); } .tk.level b { color: var(--gold); opacity: 1; }
.tk.wild { background: rgba(240,140,0,.18); } .tk.wild b, .tk.wild span { color: #ffb44d; }
.tk.sep { margin-left: 4px; }

/* the felt: five columns (left seat, its plays, the middle, plays, right seat) and three rows; the middle
   holds the partner's plays at the top, notices, and my own plays at the bottom */
#felt { flex: 1; min-height: 0; position: relative; display: grid; gap: 4px 8px; padding: 6px 14px 4px;
  grid-template-columns: minmax(150px, 1fr) minmax(0, 1.25fr) minmax(0, 1.5fr) minmax(0, 1.25fr) minmax(150px, 1fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "left  .      top     .      right"
    "left  lplay  mid     rplay  right"
    "me    me     actions info   info";
  align-items: center; justify-items: center; }
#mid { grid-area: mid; align-self: stretch; display: flex; flex-direction: column; justify-content: space-between;
  align-items: center; gap: 4px; min-height: 0; }
#felt::before { content: ""; position: absolute; inset: 2px 3% 0; border-radius: 999px; pointer-events: none;
  border: 1px solid var(--gold-soft); box-shadow: inset 0 0 0 6px rgba(0,0,0,.08), inset 0 0 70px rgba(0,0,0,.28), 0 0 0 1px rgba(0,0,0,.25); }
#center { flex: 1; display: grid; place-items: center; min-height: 0; }
#notice { padding: 7px 18px; border-radius: 999px; background: rgba(0,0,0,.42); border: 1px solid var(--gold-soft);
  color: var(--gold); font-weight: 700; white-space: nowrap; pointer-events: none; }

/* seats: dark glass plates; the avatar ring shows the team (A gold, B blue) */
.seat-panel { position: relative; z-index: 10; display: flex; align-items: center; gap: 9px; padding: 5px 14px 5px 5px;
  border-radius: 999px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(0,0,0,.28);
  max-width: 100%; transition: box-shadow .2s, border-color .2s; }
.seat-panel:empty { display: none; }
.seat-panel[data-pos="top"] { grid-area: top; }
.seat-panel[data-pos="left"] { grid-area: left; justify-self: start; }
.seat-panel[data-pos="right"] { grid-area: right; justify-self: end; flex-direction: row-reverse; padding: 5px 5px 5px 14px; text-align: right; }
.seat-panel[data-pos="bottom"] { grid-area: me; justify-self: start; }
.seat-panel.turn { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 22px rgba(242,201,76,.55); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 2px var(--gold), 0 0 6px rgba(242,201,76,.2); } }
.seat-panel[data-pos="right"].turn::after { left: auto; right: -2px; }
.seat-panel.turn::after { content: attr(data-turn); position: absolute; left: -2px; top: -9px;
  font-size: .66em; font-weight: 800; color: #2b2100; background: var(--gold); padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff;
  font-size: 1.05em; flex: none; border: 2px solid var(--teamB); box-shadow: inset 0 -3px 0 rgba(0,0,0,.22); }
.avatar.teamA { border-color: var(--teamA); }
.avatar.s0 { background: #d9480f; } .avatar.s1 { background: #1971c2; } .avatar.s2 { background: #9c36b5; } .avatar.s3 { background: #099268; }
.avatar.ai { background: linear-gradient(#5c6770, #343a40); font-size: .82em; letter-spacing: .5px; }
.seat-info { display: grid; gap: 3px; line-height: 1.15; min-width: 0; }
/* the name: its 蛋 suffix (test mode's accounts) in gold, （你） on your own plate; a name that does not fit shrinks a little
   (--fit, app.js fitName), then the part before the suffix is cut short (…). The plates at the top and the bottom have
   more room than the ones at the sides. */
.seat-name { display: flex; align-items: baseline; min-width: 0; font-weight: 700; font-size: calc(.93em * var(--fit, 1));
  max-width: calc(9em / var(--fit, 1)); white-space: nowrap; }
.seat-name .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.seat-name .egg, .seat-name .you { flex: none; }
.seat-name .egg { color: var(--gold); }
.seat-panel[data-pos="top"] .seat-name, .seat-panel[data-pos="bottom"] .seat-name { max-width: calc(15.5em / var(--fit, 1)); }
.seat-panel[data-pos="right"] .seat-name { justify-content: flex-end; justify-self: end; }
.compact .seat-name .you { display: none; }  /* phones: the 自己 tag says it */
.seat-tags { display: flex; gap: 4px; flex-wrap: wrap; font-size: .7em; }
.seat-panel[data-pos="right"] .seat-tags { justify-content: flex-end; }
.tag-pill { padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,.13); white-space: nowrap; }
.tag-pill.warn { background: #e03131; color: #fff; font-weight: 800; }
.tag-pill.mate { background: rgba(242,201,76,.22); color: var(--gold); }
.tag-pill.foe { background: rgba(124,196,250,.18); color: #a5d8ff; }
.tag-pill.off { background: #868e96; }
.compact .tag-pill .team, .compact #roomChip { display: none; }
/* places as the players go out, in medal colours (头游 gold, 二游 silver, 三游 bronze; at the end 末游 / 双下
   grey): the badge springs in once; a plate whose player is out is a little quieter */
.rank.r1 { background: linear-gradient(#ffe27a, var(--gold)); color: #2b2100; font-weight: 800; }
.rank.r2 { background: linear-gradient(#f8f9fa, #c3cad1); color: #1d2327; font-weight: 800; }
.rank.r3 { background: linear-gradient(#f3c49b, #c47a43); color: #2b1300; font-weight: 800; }
.rank.r4 { background: rgba(255,255,255,.12); color: #ced4da; font-weight: 700; }
.tag-pill.rank.new { animation: fx-label .6s cubic-bezier(.2,1.5,.4,1); }
.seat-panel.first { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold-soft), 0 0 16px rgba(242,201,76,.32); }
.seat-panel.out .avatar { opacity: .7; }
.hand-out { align-self: center; padding: 6px 16px; border-radius: 999px; font-size: .88em; font-weight: 700; color: var(--gold);
  background: rgba(0,0,0,.32); border: 1px solid var(--gold-soft); white-space: nowrap; max-width: 96vw; overflow: hidden; text-overflow: ellipsis; }

/* played cards, in front of each player */
.played { position: relative; z-index: 8; display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-height: calc(var(--mw) * 1.4); min-width: 0; }
.played[data-pos="left"] { grid-area: lplay; justify-self: start; align-items: flex-start; }
.played[data-pos="right"] { grid-area: rplay; justify-self: end; align-items: flex-end; }
#felt.my-turn .played[data-pos="bottom"] { visibility: hidden; }
.played .label { font-size: .74em; padding: 1px 9px; border-radius: 999px; background: rgba(0,0,0,.4); white-space: nowrap;
  color: var(--c, #f1f3f5); animation: pl-pop .34s .14s cubic-bezier(.2,1.45,.4,1) both; }
@keyframes pl-pop { from { transform: scale(.55); opacity: 0; } }
.played.top-play .mini-row { filter: drop-shadow(0 0 7px rgba(242,201,76,.9)); }
/* 不出: a bubble that pops up, then fades to a quiet mark for the rest of the trick */
.played .pass { font-size: 1.05em; font-weight: 800; color: #dee2e6; letter-spacing: 3px; padding: 2px 12px 2px 15px; border-radius: 999px;
  background: rgba(0,0,0,.34); border: 1px solid var(--line); text-shadow: 0 2px 3px rgba(0,0,0,.55); animation: fx-pass 1.7s ease-out forwards; }
@keyframes fx-pass { 0% { transform: scale(.55); opacity: 0; } 14% { transform: scale(1.1); opacity: 1; } 24% { transform: scale(1); }
  65% { opacity: 1; } 100% { transform: scale(1); opacity: .5; } }
.mini-row { display: flex; }
.played .label.hot { color: #2b2100; font-weight: 800; background: linear-gradient(#ffe27a, var(--gold)); animation: fx-label .6s cubic-bezier(.2,1.5,.4,1); }
@keyframes fx-label { from { transform: scale(1.6); opacity: 0; } }

/* chat bubbles next to the speaker */
.bubble { position: relative; z-index: 25; max-width: 220px; padding: 6px 11px; border-radius: 12px; background: #fff; color: var(--ink);
  font-size: .9em; box-shadow: 0 4px 14px rgba(0,0,0,.35); pointer-events: none; opacity: 0; transition: opacity .2s; word-break: break-word; }
.bubble.show { opacity: 1; }
.bubble[data-pos="top"] { grid-area: top; justify-self: end; }
.bubble[data-pos="left"] { grid-area: left; justify-self: start; align-self: start; transform: translateY(-115%); }
.bubble[data-pos="right"] { grid-area: right; justify-self: end; align-self: start; transform: translateY(-115%); }
.bubble[data-pos="bottom"] { grid-area: me; justify-self: start; align-self: start; transform: translate(40px, -115%); }

/* ---------- cards */
.card { position: absolute; left: 0; width: var(--cw); height: var(--ch); border-radius: calc(var(--cw) * .1); color: var(--ink);
  background: linear-gradient(160deg, #ffffff 0%, #f5f1e6 100%); border: 1px solid #b7b09f;
  box-shadow: 0 1px 2px rgba(0,0,0,.35); overflow: hidden; cursor: pointer; }
.card .corner { position: absolute; top: calc(var(--cw) * .04); left: calc(var(--cw) * .08); font-weight: 800;
  font-size: calc(var(--cw) * .3); line-height: 1; letter-spacing: -1px; white-space: nowrap; }
.card .corner b, .card .corner i { font-weight: 800; font-style: normal; }
.mini .corner { display: flex; flex-direction: column; align-items: center; left: calc(var(--cw) * .04); font-size: calc(var(--cw) * .32); }
.mini .corner i { font-size: .9em; margin-top: 1px; }
.card .pip { position: absolute; right: calc(var(--cw) * .1); bottom: calc(var(--cw) * .06); font-size: calc(var(--cw) * .56); line-height: 1; }
.card.red { color: var(--red); }
.card .tag { position: absolute; top: calc(var(--cw) * .05); right: calc(var(--cw) * .05); font-size: calc(var(--cw) * .19);
  line-height: 1.15; padding: 0 2px; border-radius: 3px; background: #2f9e44; color: #fff; font-weight: 700; }
.card.wild { border-color: #f08c00; box-shadow: inset 0 0 0 2px #ffc078, 0 1px 2px rgba(0,0,0,.35); }
.card.wild .tag { background: #f08c00; }
.card.joker { display: block; }
.card.joker .jk { position: absolute; top: calc(var(--cw) * .06); left: calc(var(--cw) * .07); writing-mode: vertical-rl;
  text-orientation: upright; font-weight: 800; font-size: calc(var(--cw) * .17); letter-spacing: -2px; line-height: 1; }
.card.joker .jk-name { position: absolute; right: calc(var(--cw) * .08); bottom: calc(var(--cw) * .08); font-weight: 800;
  font-size: calc(var(--cw) * .24); }
.card.joker.big { color: #c92a2a; } .card.joker.small { color: #343a40; }
.card.sel { background: linear-gradient(160deg, #e7f5ff 0%, #b9e0ff 100%); border-color: #1c7ed6; }
#hand .card.sel { transform: translateY(calc(var(--ch) * -.12)); box-shadow: 0 0 0 2px var(--gold), 0 6px 12px rgba(0,0,0,.45); }
#hand .card { transition: transform .08s; }
/* your turn: a soft gold line over the hand, and one brighter pulse when the turn comes */
#hand.my-turn::before { content: ""; position: absolute; left: 12%; right: 12%; top: -3px; height: 3px; border-radius: 3px; pointer-events: none;
  background: linear-gradient(90deg, rgba(242,201,76,0), var(--gold), rgba(242,201,76,0)); animation: fx-turn 1.6s ease-in-out infinite; }
@keyframes fx-turn { 50% { opacity: .3; } }
#hand.turn-ping::after { content: ""; position: absolute; left: 8%; right: 8%; top: -14px; height: 30px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(242,201,76,.42), rgba(242,201,76,0)); animation: fx-ping .9s ease-out forwards; }
@keyframes fx-ping { from { transform: scaleX(.4); opacity: 0; } 30% { opacity: 1; } to { transform: scaleX(1.05); opacity: 0; } }
#hand .card:hover:not(.sel) { transform: translateY(calc(var(--ch) * -.03)); }
.mini { --cw: var(--mw); position: relative; width: var(--mw); height: calc(var(--mw) * 1.4); cursor: default; }
.mini + .mini { margin-left: calc(var(--mw) * -.5); }
.final-row .mini, .final-row .mini + .mini { margin-left: calc(var(--mw) * -.38); }  /* every line of a long hand starts at the same place */
.final-row .mini-row { padding-left: calc(var(--mw) * .38); }

/* ---------- hand */
/* the columns: your own (理牌, a gold line under them), 一键理牌's (a thin light line), then rank columns. --colGap
   is the space between columns (app.js); it turns negative, so the columns overlap, when they would not fit */
#hand { flex: none; position: relative; height: calc(var(--handH) + 8px); display: flex; justify-content: center;
  align-items: flex-end; gap: 0; padding: 0 8px 6px; z-index: 20; touch-action: none; }
.col { position: relative; width: var(--cw); flex: none; margin: 0 calc(var(--colGap, 3px) / 2); }
.col.own, .col.auto { margin: 0 calc(var(--colGap, 3px) / 2 + 3px); }
.col.own::after, .col.auto::after { content: ""; position: absolute; left: -3px; right: -3px; bottom: -5px; height: 3px; border-radius: 2px;
  background: var(--gold); opacity: .8; }
.col.auto::after { left: 1px; right: 1px; height: 2px; bottom: -4px; background: #f1f3f5; opacity: .4; }
#handInfo { grid-area: info; justify-self: end; font-size: .8em; opacity: .85; white-space: nowrap; }

#actions { grid-area: actions; z-index: 22; display: flex; gap: 12px; }
#actions .btn { min-width: 96px; padding: 10px 22px; font-size: 1.05em; }
#choices { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--handH) + 64px); z-index: 23;
  background: var(--panel); border: 1px solid var(--gold-soft); border-radius: 12px; padding: 8px; display: flex; flex-wrap: wrap; gap: 6px;
  align-items: center; max-width: 92vw; }
#autoBanner { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--handH) / 2 + 30px); z-index: 24;
  background: rgba(0,0,0,.72); border: 1px solid var(--gold); color: var(--gold); padding: 10px 18px; border-radius: 12px; cursor: pointer; }

#tools { flex: none; height: 46px; z-index: 21; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 0 12px; background: linear-gradient(rgba(0,0,0,.18), rgba(0,0,0,.5)); }
.tool-group { display: flex; align-items: center; gap: 6px; }
.tool-label { font-size: .82em; opacity: .85; margin-right: 2px; }
.suit-btn { width: 32px; height: 32px; border-radius: 50%; border: 0; background: linear-gradient(#ffffff, #e3e6e8); color: var(--ink);
  font-size: 1.05em; cursor: pointer; box-shadow: 0 2px 0 rgba(0,0,0,.28); }
.suit-btn.red { color: var(--red); }
.btn.tool { padding: 6px 15px; font-size: .9em; background: rgba(255,255,255,.12); color: #f1f3f5; border: 1px solid var(--line); box-shadow: none; }
.btn.tool.unread { background: var(--gold); color: #2b2100; }
#arrangeBtn { min-width: calc(4em + 32px); }  /* 一键理牌 / 按大小: the same width, so nothing moves */

/* ---------- overlays */
.overlay { position: absolute; inset: 0; z-index: 50; background: rgba(0,0,0,.55); display: grid; place-items: center; }
.sheet { width: min(94vw, 640px); max-height: 92vh; overflow: auto; background: linear-gradient(#11432f, #0c3324);
  border: 1px solid var(--gold-soft); border-radius: 20px; padding: 16px 18px; box-shadow: 0 16px 50px rgba(0,0,0,.5); }
.sheet h2 { margin: 0 0 10px; color: var(--gold); font-size: 1.25em; }
.sheet h2 small { color: #f1f3f5; opacity: .75; font-size: .65em; margin-left: 6px; }
.share-row { display: flex; gap: 8px; margin-bottom: 12px; }
.share-row input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.94); color: var(--ink); }
.lobby-seats { display: grid; grid-template-columns: 1fr 1fr 1fr; grid-template-areas: ". top ." "left . right" ". bottom ."; gap: 8px; margin: 6px 0 12px; }
.lobby-seat { background: rgba(255,255,255,.07); border: 1px solid var(--line); border-radius: 14px; padding: 8px; display: grid; gap: 6px; justify-items: center; text-align: center; }
.lobby-seat.me { border-color: var(--gold); }
.lobby-seat .where { font-size: .75em; opacity: .7; }
.lobby-seat .who { font-weight: 700; }
.lobby-seat .ctl { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.lobby-row { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.lobby-row select { padding: 6px 8px; border-radius: 8px; }
/* end of deal: the banner springs in; a win gets a passing shine and a few gold sparks */
.result-banner { position: relative; text-align: center; margin: 2px 0 4px; }
.result-banner .rb { position: relative; display: inline-grid; justify-items: center; padding: 2px 26px 4px; overflow: hidden; border-radius: 14px;
  animation: fx-banner .7s cubic-bezier(.2,1.35,.35,1) both; }
.result-banner .rb b { font-size: 2.3em; line-height: 1.15; font-weight: 900; letter-spacing: 8px; padding-left: 8px; color: var(--gold);
  text-shadow: 0 2px 0 #7a5a00, 0 4px 12px rgba(0,0,0,.45); }
.result-banner .rb small { font-size: .85em; letter-spacing: 1px; opacity: .85; }
.result-banner.lose .rb b { color: #dee2e6; text-shadow: 0 2px 0 #495057, 0 4px 12px rgba(0,0,0,.45); }
.result-banner.watch .rb b { font-size: 1.7em; letter-spacing: 3px; }
@keyframes fx-banner { from { transform: scale(.5) translateY(-12px); opacity: 0; } }
.result-banner.win .rb::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 38%; pointer-events: none;
  background: linear-gradient(100deg, rgba(255,255,255,0), rgba(255,250,225,.55), rgba(255,255,255,0));
  transform: translateX(-160%) skewX(-20deg); animation: fx-shine 1.3s .55s ease-in-out forwards; }
@keyframes fx-shine { to { transform: translateX(360%) skewX(-20deg); } }
.result-banner .bs { position: absolute; width: 12px; height: 12px; opacity: 0; pointer-events: none; background: linear-gradient(#fff, var(--gold));
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); animation: fx-spark 1.1s ease-out both; }
.first-out { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin: 2px 0 4px;
  animation: fx-rise .5s .25s ease-out both; }
.first-out .pill { padding: 1px 10px; border-radius: 999px; background: linear-gradient(#ffe27a, var(--gold)); color: #2b2100; font-weight: 800; font-size: .85em; }
.first-out .pill.double { background: linear-gradient(#ffb199, #e8590c); color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.25); }
.first-out b { font-size: 1.05em; }
.first-out .score { opacity: .75; font-size: .9em; }
@keyframes fx-rise { from { transform: translateY(8px); opacity: 0; } }
.final-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; min-height: calc(var(--mw) * 1.4); }
.final-row .who { display: flex; align-items: baseline; width: 11.5em; flex: none; font-size: .9em; white-space: nowrap; }
.final-row .who .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.final-row .who .egg { flex: none; color: var(--gold); } .final-row .who .you, .final-row .who .team-dot { flex: none; }
.final-row .who .team-dot { align-self: center; }
/* the ranking of a deal that played on: one row per player in the order they went out, with the place */
.final-row .rank { flex: none; width: 3.3em; padding: 1px 0; border-radius: 999px; text-align: center; font-size: .8em; }
.final-row.out { min-height: 0; margin: 9px 0; }  /* a player who went out has no cards to show */
#finalHands.ranked .final-row { animation: fx-rise .45s ease-out both; }
#finalHands.ranked .final-row:nth-child(2) { animation-delay: .08s; } #finalHands.ranked .final-row:nth-child(3) { animation-delay: .16s; }
#finalHands.ranked .final-row:nth-child(4) { animation-delay: .24s; }
.team-dot { display: inline-block; width: 8px; height: 8px; margin-right: 5px; border-radius: 50%; vertical-align: 1px; }
.team-dot.tA { background: var(--teamA); } .team-dot.tB { background: var(--teamB); }
.final-row .mini-row { flex-wrap: wrap; row-gap: 4px; }
.sheet-actions { display: flex; gap: 10px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.rules-text { line-height: 1.6; font-size: .93em; } .rules-text li { margin: 3px 0; }

.drawer { position: absolute; right: 0; top: 0; bottom: 0; width: min(92vw, 340px); z-index: 45; background: linear-gradient(#11432f, #0c3324);
  border-left: 1px solid var(--gold-soft); display: flex; flex-direction: column; box-shadow: -8px 0 30px rgba(0,0,0,.4); }
.drawer header { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
#chatLog { flex: 1; overflow: auto; padding: 8px 12px; display: grid; align-content: start; gap: 6px; font-size: .92em; }
#chatLog .msg b { color: var(--gold); margin-right: 4px; } #chatLog .sys { opacity: .6; font-size: .85em; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; border-top: 1px solid var(--line); }
.quick button { border: 1px solid var(--line); background: rgba(255,255,255,.1); color: #f1f3f5; border-radius: 999px; padding: 4px 10px; font-size: .85em; cursor: pointer; }
.chat-input { display: flex; gap: 6px; padding: 8px 12px 12px; }
.chat-input input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); }

/* ---------- play effects: a layer above the felt that never takes a tap; transforms and opacity only.
   Bombs: a shockwave ring, a flash and a short shake (more for 6+ cards); 同花顺: a sweeping light with
   sparks; 四大天王: a burst of rays and a glow; sequences: a quick streak. */
#fx { position: absolute; inset: 0; z-index: 35; pointer-events: none; overflow: hidden; contain: strict; }
.fx { position: absolute; left: 0; top: 0; pointer-events: none; }
.fx.ring { width: 70px; height: 70px; margin: -35px 0 0 -35px; border-radius: 50%; border: 3px solid var(--gold);
  box-shadow: 0 0 8px rgba(242,201,76,.55), inset 0 0 6px rgba(255,255,255,.45); animation: fx-ring .7s cubic-bezier(.15,.7,.3,1) both; }
.fx.ring.thin { border-width: 2px; border-color: #fff3c4; }
@keyframes fx-ring { from { transform: scale(.2); opacity: .95; } to { transform: scale(5); opacity: 0; } }
.fx.flash { width: 100%; height: 100%; background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,247,222,.62),
  rgba(242,201,76,.2) 22%, rgba(242,201,76,0) 55%); animation: fx-flash .34s ease-out both; }
.fx.flash.strong { animation-duration: .5s; }
@keyframes fx-flash { 0% { opacity: 0; } 22% { opacity: 1; } 100% { opacity: 0; } }
.fx.sweep { overflow: hidden; border-radius: 8px; }
.fx.sweep::before { content: ""; position: absolute; top: -25%; bottom: -25%; left: 0; width: 42%;
  background: linear-gradient(100deg, rgba(255,255,255,0), rgba(255,250,222,.85) 50%, rgba(255,255,255,0));
  transform: translateX(-130%) skewX(-18deg); animation: fx-sweep .8s .05s ease-in-out both; }
@keyframes fx-sweep { to { transform: translateX(340%) skewX(-18deg); } }
.fx.spark { width: 14px; height: 14px; margin: -7px 0 0 -7px; background: linear-gradient(#fff, var(--gold));
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); animation: fx-spark .95s ease-out both; }
@keyframes fx-spark { 0% { transform: scale(0) rotate(0deg); opacity: 0; } 30% { transform: scale(1.15) rotate(50deg); opacity: 1; }
  100% { transform: translateY(-16px) scale(0) rotate(140deg); opacity: 0; } }
.fx.burst { width: 220px; height: 220px; margin: -110px 0 0 -110px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255,226,122,.8) 0deg 6deg, rgba(255,226,122,0) 6deg 22.5deg);
  -webkit-mask: radial-gradient(circle, transparent 16%, #000 30%, #000 50%, transparent 70%);
  mask: radial-gradient(circle, transparent 16%, #000 30%, #000 50%, transparent 70%); animation: fx-burst 1.05s cubic-bezier(.12,.75,.3,1) both; }
@keyframes fx-burst { from { transform: scale(.2) rotate(0deg); opacity: 1; } to { transform: scale(3.3) rotate(32deg); opacity: 0; } }
.fx.glow { width: 260px; height: 260px; margin: -130px 0 0 -130px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,240,190,.7), rgba(242,201,76,.32) 45%, rgba(242,201,76,0)); animation: fx-glow 1.4s ease-out both; }
@keyframes fx-glow { 0% { transform: scale(.35); opacity: 0; } 22% { opacity: 1; } 100% { transform: scale(2.1); opacity: 0; } }
.fx.streak { height: 3px; border-radius: 3px; transform-origin: left center;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,250,225,.95) 50%, rgba(242,201,76,.85) 70%, rgba(242,201,76,0));
  animation: fx-streak .45s ease-out both; }
@keyframes fx-streak { 0% { transform: translateX(-35%) scaleX(.25); opacity: 0; } 35% { opacity: 1; } 100% { transform: translateX(35%) scaleX(1); opacity: 0; } }
/* 头游 in a deal that plays on: a banner springs up over the middle of the felt, holds, and fades (a gold shine
   for the winning side); the score chip flashes as the score counts */
.fx.first-banner { transform: translate(-50%, -50%); }
.fx.first-banner .fb { position: relative; display: grid; justify-items: center; gap: 2px; padding: 8px 26px 9px; overflow: hidden;
  border-radius: 16px; white-space: nowrap; background: rgba(2, 22, 16, .82); border: 1px solid var(--gold);
  box-shadow: 0 0 0 3px rgba(242,201,76,.16), 0 0 28px rgba(242,201,76,.42), 0 12px 30px rgba(0,0,0,.45);
  animation: fx-first 3.4s ease-out both; }
.fx.first-banner b { font-size: 1.55em; line-height: 1.2; font-weight: 900; letter-spacing: 3px; color: var(--gold);
  text-shadow: 0 2px 0 #7a5a00, 0 4px 12px rgba(0,0,0,.45); }
.fx.first-banner small { font-size: .9em; font-weight: 700; letter-spacing: 1px; color: #f1f3f5; }
.fx.first-banner.lose .fb { border-color: rgba(222,226,230,.55); box-shadow: 0 0 0 3px rgba(255,255,255,.06), 0 12px 30px rgba(0,0,0,.45); }
.fx.first-banner.lose b { color: #e9ecef; text-shadow: 0 2px 0 #495057, 0 4px 12px rgba(0,0,0,.45); }
.fx.first-banner.win .fb::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 38%; pointer-events: none;
  background: linear-gradient(100deg, rgba(255,255,255,0), rgba(255,250,225,.5), rgba(255,255,255,0));
  transform: translateX(-160%) skewX(-20deg); animation: fx-shine 1.2s .45s ease-in-out forwards; }
@keyframes fx-first { 0% { transform: scale(.5) translateY(-10px); opacity: 0; } 9% { transform: scale(1.07); opacity: 1; }
  15% { transform: scale(1); } 84% { transform: scale(1); opacity: 1; } 100% { transform: scale(.97); opacity: 0; } }
/* the name of each play's combination as it lands (app.js typeTitle). Every type has its colour (--c, --g), used by
   its label under the cards too; 三同张 and 三带二 pop in (三带二 with a tilt), 顺子 swooshes in from the left and
   三连对 from the right, 钢板 drops in with a clang, all gone within a second. Bombs (larger with more cards),
   同花顺 and 四大天王 slam in as a big gold title for about 1.5 s. */
.t-triple { --c: #ffc078; --g: rgba(255,169,77,.3); }  .t-full { --c: #ffa8c5; --g: rgba(247,131,172,.3); }
.t-straight { --c: #8fd0ff; --g: rgba(77,171,247,.32); }  .t-pairs { --c: #96f2d7; --g: rgba(56,217,169,.3); }
.t-plate { --c: #e9ecef; --g: rgba(206,212,218,.28); }
.fx.ptype { transform: translate(-50%, -50%); }
.fx.ptype b { display: block; position: relative; white-space: nowrap; font-weight: 900; will-change: transform, opacity; }
.fx.ptype.mid b { padding: 3px 14px 4px 17px; border-radius: 999px; font-size: 1.15em; line-height: 1.25; letter-spacing: 3px; overflow: hidden;
  color: var(--c); background: rgba(2, 22, 16, .86); border: 1.5px solid var(--c); text-shadow: 0 1px 0 rgba(0,0,0,.6);
  box-shadow: 0 0 0 3px var(--g), 0 0 16px var(--g), 0 6px 16px rgba(0,0,0,.42); animation: pt-pop .95s cubic-bezier(.2,1.2,.4,1) both; }
.fx.ptype.t-full b { animation-name: pt-tilt; }
.fx.ptype.t-straight b { animation-name: pt-swoosh; animation-timing-function: cubic-bezier(.2,.9,.3,1); }
.fx.ptype.t-pairs b { animation-name: pt-swoosh-back; animation-timing-function: cubic-bezier(.2,.9,.3,1); }
.fx.ptype.t-plate b { color: #f8f9fa; background: linear-gradient(#6c757d, #343a40 52%, #495057); border-color: #dee2e6; animation-name: pt-clang; }
.fx.ptype.t-plate b::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 40%; pointer-events: none;
  background: linear-gradient(100deg, rgba(255,255,255,0), rgba(255,255,255,.55), rgba(255,255,255,0));
  transform: translateX(-130%) skewX(-20deg); animation: fx-sheen .55s .12s ease-in-out both; }
@keyframes fx-sheen { to { transform: translateX(300%) skewX(-20deg); } }
@keyframes pt-pop { 0% { transform: scale(.35); opacity: 0; } 16% { transform: scale(1.14); opacity: 1; } 28% { transform: scale(1); }
  72% { transform: none; opacity: 1; } 100% { transform: translateY(-12px); opacity: 0; } }
@keyframes pt-tilt { 0% { transform: scale(.4) rotate(-12deg); opacity: 0; } 16% { transform: scale(1.12) rotate(4deg); opacity: 1; }
  28% { transform: rotate(-1deg); } 36% { transform: none; } 72% { transform: none; opacity: 1; } 100% { transform: translateY(-12px); opacity: 0; } }
@keyframes pt-swoosh { 0% { transform: translateX(-56px) skewX(-24deg); opacity: 0; } 18% { transform: translateX(5px) skewX(8deg); opacity: 1; }
  30% { transform: none; } 72% { transform: none; opacity: 1; } 100% { transform: translateX(40px) skewX(-14deg); opacity: 0; } }
@keyframes pt-swoosh-back { 0% { transform: translateX(56px) skewX(24deg); opacity: 0; } 18% { transform: translateX(-5px) skewX(-8deg); opacity: 1; }
  30% { transform: none; } 72% { transform: none; opacity: 1; } 100% { transform: translateX(-40px) skewX(14deg); opacity: 0; } }
@keyframes pt-clang { 0% { transform: translateY(-26px) scale(1.08); opacity: 0; } 14% { transform: translateY(3px) scale(.97); opacity: 1; }
  22% { transform: translateY(-4px); } 30% { transform: translateY(1px); } 36% { transform: none; } 72% { opacity: 1; } 100% { transform: scale(.94); opacity: 0; } }
.fx.ptype.big b { font-size: calc(2.3em * var(--k, 1)); line-height: 1.1; letter-spacing: 5px; padding-left: 5px; color: #ffe066;
  text-shadow: 0 3px 0 #8a5a00, 0 0 3px #5c3d00, 0 0 22px rgba(255,170,40,.8), 0 8px 22px rgba(0,0,0,.55);
  animation: pt-slam 1.55s cubic-bezier(.2,.9,.3,1) both; }
.fx.ptype.t-flush b { color: #fff3bf; text-shadow: 0 3px 0 #7a5a00, 0 0 3px #5c3d00, 0 0 24px rgba(143,208,255,.85), 0 8px 22px rgba(0,0,0,.55);
  animation-name: pt-sweep-in; }
.fx.ptype.t-jokers b { font-size: 2.75em; color: #ffd43b;
  text-shadow: 0 3px 0 #8a2b00, 0 0 3px #5c1d00, 0 0 26px rgba(255,107,107,.8), 0 0 46px rgba(255,212,59,.55), 0 8px 22px rgba(0,0,0,.55);
  animation: pt-slam-big 1.65s cubic-bezier(.2,.9,.3,1) both; }
@keyframes pt-slam { 0% { transform: scale(2.6); opacity: 0; } 12% { transform: scale(.9); opacity: 1; } 20% { transform: scale(1.06); }
  28% { transform: scale(1); } 80% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.1) translateY(-8px); opacity: 0; } }
@keyframes pt-sweep-in { 0% { transform: translateX(-70px) skewX(-22deg) scale(.9); opacity: 0; } 16% { transform: translateX(6px) skewX(6deg) scale(1.05); opacity: 1; }
  26% { transform: none; } 80% { transform: none; opacity: 1; } 100% { transform: translateY(-10px) scale(1.05); opacity: 0; } }
@keyframes pt-slam-big { 0% { transform: scale(3.2) rotate(-6deg); opacity: 0; } 12% { transform: scale(.88) rotate(1deg); opacity: 1; }
  22% { transform: scale(1.08); } 30% { transform: scale(1); } 82% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.12) translateY(-10px); opacity: 0; } }
#scoreChip.bump { animation: fx-bump .8s cubic-bezier(.2,1.5,.4,1); }
@keyframes fx-bump { 30% { transform: scale(1.22); background: var(--gold); color: #2b2100; border-color: transparent; } }

/* reduced motion: nothing moves, only short fades */
@media (prefers-reduced-motion: reduce) {
  .fx.ring, .fx.burst, .fx.spark, .fx.streak, .fx.sweep, .result-banner .bs, .result-banner.win .rb::after, #hand.turn-ping::after { display: none; }
  .fx.first-banner.win .fb::after { display: none; }
  .fx.flash, .fx.glow { animation-name: fx-soft; }
  .seat-panel.turn, #hand.my-turn::before { animation: none; }
  .played .pass { animation: fx-fade-to .6s ease-out forwards; }
  .played .label.hot, .result-banner .rb, .first-out, .tag-pill.rank.new, #finalHands.ranked .final-row { animation: fx-fade .35s ease-out both; }
  .played .label { animation: fx-fade .3s ease-out both; }
  .fx.ptype b, .fx.ptype.mid b { animation: pt-fade .95s ease-out both; }
  .fx.ptype.big b, .fx.ptype.t-jokers b { animation: pt-fade 1.55s ease-out both; }
  .fx.ptype.t-plate b::after { display: none; }
  .fx.first-banner .fb { animation: fx-hold 3.4s ease-out both; }
  #scoreChip.bump { animation: none; }
}
@keyframes fx-hold { 0% { opacity: 0; } 8%, 84% { opacity: 1; } 100% { opacity: 0; } }
@keyframes pt-fade { 0% { opacity: 0; } 12%, 72% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fx-soft { 0%, 100% { opacity: 0; } 40% { opacity: .45; } }
@keyframes fx-fade { from { opacity: 0; } }
@keyframes fx-fade-to { from { opacity: 0; } to { opacity: .6; } }

/* ---------- the 声音 menu: effects and music on or off, and the volume */
.popover { position: fixed; z-index: 70; width: 230px; padding: 12px 14px; display: grid; gap: 11px; border-radius: 14px; top: 48px; right: 10px;
  background: linear-gradient(#11432f, #0c3324); border: 1px solid var(--gold-soft); box-shadow: 0 12px 34px rgba(0,0,0,.5); font-size: .9em; }
.popover p { margin: 0; font-size: .78em; }
.popover small { opacity: .7; }
.switch-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; cursor: pointer; }
.switch-row input { -webkit-appearance: none; appearance: none; flex: none; width: 42px; height: 24px; margin: 0; border-radius: 999px; position: relative;
  cursor: pointer; background: rgba(255,255,255,.2); border: 1px solid var(--line); transition: background .15s; }
.switch-row input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.4); transition: transform .15s; }
.switch-row input:checked { background: var(--gold); border-color: transparent; }
.switch-row input:checked::after { transform: translateX(18px); }
.vol-row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
.vol-row input { width: 100%; min-width: 0; accent-color: var(--gold); }
.btn-chip.silent { opacity: .65; text-decoration: line-through; }
.style-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.seg { display: inline-flex; flex: none; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.08); }
.seg button { border: 0; margin: 0; padding: 4px 12px; background: transparent; color: #f1f3f5; font-size: .92em; cursor: pointer; }
.seg button.on { background: var(--gold); color: #2b2100; font-weight: 700; }

#toast { position: absolute; left: 50%; top: 52px; transform: translateX(-50%); z-index: 60; background: rgba(20,20,20,.88);
  color: #fff; padding: 8px 16px; border-radius: 999px; font-size: .92em; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; }

/* ---------- narrower landscape screens: the counter gets its own line under the top bar */
@media (max-width: 980px) and (min-height: 521px) and (orientation: landscape), (max-width: 599px) and (orientation: landscape) {
  #topbar { flex-wrap: wrap; height: auto; row-gap: 3px; padding: 4px 8px; }
  #tracker { order: 3; flex-basis: 100%; justify-content: center; margin: 0 auto; max-width: max-content; }
}
/* large screens: slightly larger text */
@media (min-width: 1400px) and (min-height: 800px) {
  html, body { font-size: 17px; }
  .avatar { width: 46px; height: 46px; }
}

/* ---------- short screens (phones in landscape): three rows on the felt */
@media (max-height: 520px) and (orientation: landscape) {
  #topbar { padding: 3px 6px; height: auto; min-height: 34px; } .chips { gap: 4px; } .chip { padding: 2px 8px; font-size: .74em; }
  #tracker { padding: 1px 4px; } .tk { min-width: 18px; padding: 0; } .tk b { font-size: .56em; } .tk span { font-size: .76em; }
  #felt { padding: 2px 10px 0; gap: 2px 6px;
    grid-template-columns: minmax(120px, 1fr) minmax(0, 1.1fr) minmax(0, 1.6fr) minmax(0, 1.1fr) minmax(120px, 1fr); }
  #felt::before { inset: 0 2% 0; }
  .seat-panel { padding: 3px 10px 3px 3px; gap: 6px; }
  .seat-panel[data-pos="right"] { padding: 3px 3px 3px 10px; }
  .avatar { width: 30px; height: 30px; font-size: .82em; }
  .seat-name { font-size: calc(.84em * var(--fit, 1)); max-width: calc(7em / var(--fit, 1)); } .seat-tags { font-size: .62em; gap: 3px; }
  .seat-panel[data-pos="top"] .seat-name, .seat-panel[data-pos="bottom"] .seat-name { max-width: calc(12em / var(--fit, 1)); }
  .seat-panel.turn::after { top: -8px; font-size: .58em; }
  #actions .btn { min-width: 74px; padding: 6px 16px; font-size: .95em; }
  #notice { font-size: .85em; padding: 4px 12px; }
  #tools { height: 38px; } .suit-btn { width: 28px; height: 28px; font-size: .95em; }
  .btn.tool { padding: 4px 11px; font-size: .84em; } #arrangeBtn { min-width: calc(4em + 24px); }
  #choices { bottom: calc(var(--handH) + 50px); }
  .sheet { padding: 10px 14px; border-radius: 14px; } .sheet h2 { margin-bottom: 6px; font-size: 1.05em; }
  .share-row { margin-bottom: 6px; } .share-row input { padding: 5px 8px; }
  .lobby-seats { gap: 5px; margin: 2px 0 6px; } .lobby-seat { padding: 4px 6px; gap: 2px; } .lobby-seat .who { font-size: .9em; }
  .lobby-seat .btn.small { padding: 3px 10px; font-size: .8em; } .sheet-actions { margin-top: 6px; } .sheet-actions .btn { padding: 6px 14px; }
  .result-banner { margin: 0; } .result-banner .rb { padding: 0 20px 1px; } .result-banner .rb b { font-size: 1.45em; }
  .result-banner .rb small { display: none; } .first-out { margin: 0 0 2px; font-size: .9em; }
  .result-stats { margin: 0 0 2px; font-size: .8em; } .result-stats .ms-recent { display: none; } .final-row { margin: 3px 0; }
  .fx.first-banner .fb { padding: 5px 18px 6px; border-radius: 12px; } .fx.first-banner b { font-size: 1.2em; }
  .fx.first-banner small { font-size: .8em; } .hand-out { font-size: .78em; padding: 3px 12px; }
  .fx.ptype.mid b { font-size: .95em; padding: 2px 11px 3px 13px; letter-spacing: 2px; }
  .fx.ptype.big b { font-size: calc(1.7em * var(--k, 1)); letter-spacing: 3px; } .fx.ptype.t-jokers b { font-size: 2em; }
}

/* small phones in landscape: the invite link is in the 座位 sheet too */
@media (max-width: 759px) and (max-height: 520px) and (orientation: landscape) { #shareBtn { display: none; } }

/* ---------- narrow portrait screens (phones held upright): hand in two rows, compact plates */
@media (orientation: portrait) and (max-width: 640px) {
  #topbar { height: auto; flex-wrap: wrap; row-gap: 4px; padding: 5px 6px; justify-content: center; }
  .chips { flex-wrap: wrap; gap: 4px; justify-content: center; } .chip { font-size: .74em; padding: 3px 8px; }
  #tracker { order: 3; flex-basis: 100%; justify-content: center; flex-wrap: wrap; }
  .tk { min-width: 20px; } .tk b { font-size: .6em; } .tk span { font-size: .82em; }
  #felt { padding: 4px 6px 0; gap: 4px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas:
      "top     top     top"
      "left    mid     right"
      "lplay   mid     rplay"
      "me      actions actions"; }
  #felt::before { inset: 0 1% 0; border-radius: 36px; }
  .seat-panel { padding: 3px 8px 3px 3px; gap: 5px; }
  .seat-panel[data-pos="right"] { padding: 3px 3px 3px 8px; }
  .avatar { width: 30px; height: 30px; font-size: .8em; }
  .seat-name { font-size: calc(.82em * var(--fit, 1)); max-width: calc(6.5em / var(--fit, 1)); } .seat-tags { font-size: .62em; gap: 3px; }
  .seat-panel[data-pos="top"] .seat-name { max-width: calc(14em / var(--fit, 1)); }
  .seat-panel[data-pos="bottom"] .seat-name { max-width: calc(9em / var(--fit, 1)); }  /* its column is narrow: the plate fits it */
  .final-row .who { width: 7.5em; }
  #handInfo { display: none; }
  #actions { gap: 6px; justify-self: end; } #actions .btn { min-width: 0; padding: 8px 14px; font-size: .92em; white-space: nowrap; }
  #hand { flex-wrap: wrap; align-content: flex-end; row-gap: 8px; }
  #tools { padding: 0 6px; gap: 4px; } .tool-label { display: none; }
  .suit-btn { width: 29px; height: 29px; font-size: .95em; } .tool-group { gap: 4px; }
  .btn.tool { padding: 5px 9px; font-size: .8em; white-space: nowrap; } #arrangeBtn { min-width: calc(4em + 20px); }
  .btn.tool .long { display: none; }  /* 全部重排 reads 重排 */
  #notice { font-size: .85em; white-space: normal; text-align: center; }
  .lobby-seats { grid-template-columns: 1fr 1fr; grid-template-areas: "top top" "left right" "bottom bottom"; }
  .fx.ptype.mid b { font-size: 1em; padding: 2px 11px 3px 14px; letter-spacing: 2px; }
  .fx.ptype.big b { font-size: calc(1.75em * var(--k, 1)); letter-spacing: 3px; } .fx.ptype.t-jokers b { font-size: 2.1em; }
}
/* the narrowest phones (under 360 px): a tighter tools bar, so that 重排 理牌 一键理牌 聊天 still fit beside the suits */
@media (orientation: portrait) and (max-width: 359px) {
  #tools { padding: 0 4px; gap: 3px; } .tool-group { gap: 3px; }
  .suit-btn { width: 25px; height: 25px; font-size: .85em; }
  .btn.tool { padding: 5px 6px; font-size: .76em; } #arrangeBtn { min-width: calc(4em + 14px); }
}

/* ---------- 登录 / 注册 on phones in landscape: the title beside the tabs, and 注册 in two columns (the suffixes on the right) */
@media (max-height: 520px) and (orientation: landscape) {
  .login-panel { width: min(96vw, 800px); grid-template-columns: minmax(0, 1fr) minmax(0, 300px); align-items: center; gap: 8px 16px; padding: 12px 18px; }
  .login-panel h1 { font-size: 1.55em; } .login-panel h1 small { margin-top: 3px; }
  .login-panel .auth-form, .login-panel > p { grid-column: 1 / -1; }
  .auth-form { gap: 8px; } .landing-panel input { padding: 8px 12px; }
  #loginForm { grid-template-columns: 1fr 1fr; column-gap: 16px; } #loginForm > p, #loginForm > button { grid-column: 1 / -1; }
  #registerForm { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); column-gap: 18px; align-items: start; }
  #registerForm > :not(.egg-pick) { grid-column: 1; }
  #registerForm .egg-pick { grid-column: 2; grid-row: 1 / span 4; }
  .egg-grid { grid-template-columns: repeat(auto-fill, minmax(4.1em, 1fr)); gap: 5px; } .egg-chip { padding: 4px 2px 5px; }
  #regPreview { font-size: 1.25em; }
}

/* ---------- the opening animation (app.js splash, once per browser session). An egg in a gold band of suits drops onto
   the felt, bounces and wobbles, and cracks (0-1.1 s); its top pops off in a burst of gold light and sparks, a hand of
   cards fans out and the name comes out letter by letter (1.1-2 s), a shine runs over it, and it all fades into the
   page (2.3-2.75 s). Transforms and opacity only. `.skip` (a tap or a key) fades it at once; `.calm` (reduce motion) is
   a short fade of the name and the cards, nothing moves. */
.splash { position: fixed; inset: 0; z-index: 100; overflow: hidden; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  --egg: clamp(84px, 25vmin, 164px); --card: clamp(38px, 11vmin, 80px); --word: clamp(46px, 14vmin, 112px);
  background: radial-gradient(120% 90% at 50% 46%, var(--felt-1) 0%, var(--felt-2) 45%, var(--felt-3) 80%, var(--edge) 100%);
  animation: sp-out .45s 2.3s ease-in forwards; }
.splash.leaving { pointer-events: none; }
.splash.skip, .splash.calm.skip { animation: sp-skip .28s ease-out forwards; }
@keyframes sp-out { to { opacity: 0; } }
@keyframes sp-skip { to { opacity: 0; } }
@keyframes sp-gone { to { opacity: 0; } }
.sp-stage { position: absolute; inset: 0; animation: sp-zoom .45s 2.3s ease-in forwards; }
@keyframes sp-zoom { to { transform: scale(1.06); } }
.sp-stage::before { content: ""; position: absolute; left: 50%; top: 50%; width: min(88vw, 150vmin); height: min(72vh, 92vmin); transform: translate(-50%, -50%);
  border-radius: 50%; border: 1px solid var(--gold-soft); box-shadow: inset 0 0 0 6px rgba(0,0,0,.08), inset 0 0 90px rgba(0,0,0,.28); }
/* the egg: it drops and bounces (squash and stretch), wobbles, cracks from the middle out, and splits along the crack */
.sp-egg { position: absolute; left: 50%; top: 50%; width: var(--egg); height: calc(var(--egg) * 1.25); margin: calc(var(--egg) * -.625) 0 0 calc(var(--egg) * -.5);
  transform-origin: 50% 100%; animation: sp-drop .75s both; }
@keyframes sp-drop {
  0% { transform: translateY(-80vh) scale(.94, 1.08); animation-timing-function: cubic-bezier(.5, 0, .9, .5); }
  50% { transform: translateY(0) scale(1.16, .8); animation-timing-function: cubic-bezier(.2, .7, .4, 1); }
  66% { transform: translateY(-16%) scale(.95, 1.06); animation-timing-function: cubic-bezier(.6, 0, .85, .5); }
  80% { transform: translateY(0) scale(1.07, .92); animation-timing-function: ease-out; }
  91% { transform: translateY(-2%) scale(.99, 1.01); }
  100% { transform: translateY(0) scale(1, 1); } }
.sp-wob { width: 100%; height: 100%; transform-origin: 50% 94%; animation: sp-wobble .36s .76s ease-in-out both; }
@keyframes sp-wobble { 0%, 100% { transform: rotate(0deg); } 18% { transform: rotate(-9deg); } 42% { transform: rotate(8deg); } 64% { transform: rotate(-5deg); }
  84% { transform: rotate(2.5deg); } }
.sp-wob svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 6px 9px rgba(0,0,0,.32)); }
.sp-suits text { fill: #2b2100; } .sp-suits text.r { fill: #b3001b; }
.sp-whole { animation: sp-gone .01s 1.1s forwards; }  /* under the halves until they split: no seam shows along the crack */
.sp-top, .sp-bot { transform-box: fill-box; }
.sp-top { transform-origin: 50% 100%; animation: sp-lid .62s 1.1s cubic-bezier(.25, .6, .35, 1) both; }
.sp-bot { transform-origin: 50% 0%; animation: sp-cup .45s 1.1s ease-in both; }
@keyframes sp-lid { 0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; } 14% { transform: translate(0, -6%) rotate(0deg) scale(1.04); opacity: 1; }
  100% { transform: translate(-30%, -170%) rotate(-55deg) scale(1); opacity: 0; } }
@keyframes sp-cup { 0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; } 14% { transform: translate(0, 0) rotate(0deg) scale(1.03); opacity: 1; }
  100% { transform: translate(10%, 30%) rotate(14deg) scale(.86); opacity: 0; } }
.sp-crack { fill: none; stroke: #6b4c00; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1 1; stroke-dashoffset: 1;
  animation: sp-crack .3s .84s ease-out forwards, sp-gone .08s 1.1s forwards; }
@keyframes sp-crack { 30% { stroke-dashoffset: .7; } 55% { stroke-dashoffset: .7; } 100% { stroke-dashoffset: 0; } }
.sp-shadow { position: absolute; left: 50%; top: calc(50% + var(--egg) * .6); width: calc(var(--egg) * .9); height: calc(var(--egg) * .16);
  margin: calc(var(--egg) * -.08) 0 0 calc(var(--egg) * -.45); border-radius: 50%; background: radial-gradient(closest-side, rgba(0,0,0,.42), rgba(0,0,0,0));
  animation: sp-shadow .75s both, sp-gone .4s 1.12s forwards; }
@keyframes sp-shadow { 0% { transform: scale(.25); opacity: .2; animation-timing-function: cubic-bezier(.5, 0, .9, .5); } 50% { transform: scale(1.12); opacity: 1; }
  66% { transform: scale(.85); opacity: .75; } 80% { transform: scale(1.04); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
/* the burst: a gold glow (it stays, softly, behind the name), rays and sparks from the opened egg */
.sp-glow, .sp-rays, .sp-spark { position: absolute; left: 50%; top: calc(50% - var(--egg) * .14); pointer-events: none; }
.sp-glow { width: calc(var(--egg) * 3.4); height: calc(var(--egg) * 3.4); margin: calc(var(--egg) * -1.7) 0 0 calc(var(--egg) * -1.7); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,250,228,.95), rgba(255,226,122,.5) 38%, rgba(242,201,76,0) 72%); opacity: 0;
  animation: sp-glow 1.1s 1.1s ease-out both; }
@keyframes sp-glow { 0% { transform: scale(.08); opacity: 0; } 14% { opacity: 1; } 100% { transform: scale(1); opacity: .32; } }
.sp-rays { width: calc(var(--egg) * 4); height: calc(var(--egg) * 4); margin: calc(var(--egg) * -2) 0 0 calc(var(--egg) * -2); border-radius: 50%; opacity: 0;
  background: repeating-conic-gradient(rgba(255,226,122,.5) 0deg 5deg, rgba(255,226,122,0) 5deg 18deg);
  -webkit-mask: radial-gradient(circle, transparent 10%, #000 24%, #000 42%, transparent 68%); mask: radial-gradient(circle, transparent 10%, #000 24%, #000 42%, transparent 68%);
  animation: sp-rays 1.4s 1.1s cubic-bezier(.15, .7, .3, 1) both; }
@keyframes sp-rays { 0% { transform: scale(.2) rotate(0deg); opacity: 0; } 16% { opacity: .9; } 100% { transform: scale(1.25) rotate(28deg); opacity: 0; } }
.sp-spark { width: 14px; height: 14px; margin: -7px 0 0 -7px; opacity: 0; background: linear-gradient(#fff, var(--gold));
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
  animation: sp-spark .85s calc(1.12s + var(--t, 0s)) cubic-bezier(.2, .7, .3, 1) both; }
@keyframes sp-spark { 0% { transform: rotate(var(--a)) translateX(0) scale(.3) rotate(0deg); opacity: 0; } 18% { opacity: 1; }
  100% { transform: rotate(var(--a)) translateX(calc(var(--egg) * var(--d))) scale(1) rotate(120deg); opacity: 0; } }
/* a hand of cards fanning out behind the name: four aces (a bomb) and a joker */
.sp-fan { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.sp-card { position: absolute; left: calc(var(--card) * -.5); top: calc(var(--card) * -1.52); width: var(--card); height: calc(var(--card) * 1.4);
  border-radius: calc(var(--card) * .11); color: var(--ink); background: linear-gradient(160deg, #fff 0%, #f5f1e6 100%); border: 1px solid #b7b09f;
  box-shadow: 0 3px 10px rgba(0,0,0,.35); transform-origin: 50% 155%; transform: translateY(0) rotate(calc(var(--i) * 15deg)) scale(1);
  animation: sp-card .55s calc(1.13s + var(--k) * .045s) cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes sp-card { 0% { transform: translateY(25%) rotate(0deg) scale(.35); opacity: 0; } 35% { opacity: 1; } }
.sp-card b { position: absolute; top: calc(var(--card) * .06); left: calc(var(--card) * .09); display: grid; justify-items: center; font-weight: 800;
  font-size: calc(var(--card) * .3); line-height: 1; }
.sp-card b i { font-style: normal; font-size: .9em; margin-top: 1px; }
.sp-card .pip { position: absolute; left: 54%; top: 47%; transform: translate(-50%, -50%); font-size: calc(var(--card) * .62); line-height: 1; }
.sp-card.red { color: var(--red); }
.sp-card.jk { color: #c92a2a; }
.sp-card.jk .jt { writing-mode: vertical-rl; letter-spacing: 1px; font-size: calc(var(--card) * .21); }
.sp-card.jk .pip { color: var(--gold-d); }
/* the name, letter by letter, in gold, with a shine passing over it */
.sp-logo { position: absolute; left: 50%; top: 50%; z-index: 5; transform: translate(-50%, -28%); display: grid; justify-items: center; gap: calc(var(--word) * .06); }
.sp-word { position: relative; display: block; font-size: var(--word); font-weight: 900; line-height: 1.1; letter-spacing: .05em; padding-left: .05em; white-space: nowrap;
  filter: drop-shadow(0 .05em 0 #7a5a00) drop-shadow(0 .1em .14em rgba(0,0,0,.5)); }
.sp-word span { display: inline-block; color: transparent; background: linear-gradient(#fff7cc 6%, #ffe27a 36%, #f2c94c 58%, #c9971c 94%);
  -webkit-background-clip: text; background-clip: text; animation: sp-char .45s calc(1.26s + var(--k) * .085s) cubic-bezier(.2, 1.55, .35, 1) both; }
@keyframes sp-char { 0% { transform: translate(calc((1 - var(--k)) * 1.05em), .45em) scale(.2) rotate(-16deg); opacity: 0; } 40% { opacity: 1; }
  100% { transform: translate(0, 0) scale(1) rotate(0deg); } }  /* out of the egg, to their places */
.sp-shine { position: absolute; left: .05em; top: 0; font-style: normal; color: transparent; pointer-events: none;
  background: linear-gradient(100deg, rgba(255,255,255,0) 40%, rgba(255,255,255,.95) 50%, rgba(255,255,255,0) 60%) no-repeat; background-size: 300% 100%;
  background-position: 100% 0; -webkit-background-clip: text; background-clip: text; animation: sp-shine .6s 1.82s ease-in-out both; }
@keyframes sp-shine { from { background-position: 100% 0; } to { background-position: 0 0; } }
.sp-logo small { font-size: calc(var(--word) * .2); font-weight: 700; letter-spacing: .45em; padding-left: .45em; color: #fff3c4; text-shadow: 0 2px 6px rgba(0,0,0,.5);
  animation: sp-sub .45s 1.68s ease-out both; }
@keyframes sp-sub { from { opacity: 0; transform: translateY(.6em); } }
/* reduce motion: the name and the cards fade in and out (about 1.2 s), nothing moves */
.splash.calm { animation: sp-calm 1.2s ease-in-out both; }
@keyframes sp-calm { 0% { opacity: 0; } 18%, 66% { opacity: 1; } 100% { opacity: 0; } }
.splash.calm .sp-stage, .splash.calm .sp-stage * { animation: none !important; }
.splash.calm .sp-egg, .splash.calm .sp-shadow, .splash.calm .sp-rays, .splash.calm .sp-spark { display: none; }
.splash.calm .sp-glow { opacity: .32; }
