:root {
  --seat-pad: 60px; /* keeps edge seats (name plate + counter) on screen */
  --hand-cw: min(21vw, 88px);
  --red: #e53935; --yellow: #fbc02d; --green: #43a047; --blue: #1e88e5;
  --bg: #1a0606; --panel: rgba(0, 0, 0, .35); --panel2: rgba(255, 255, 255, .08);
  --text: #fff; --muted: rgba(255, 255, 255, .65);
  --accent: #ffcc00;
  --cw: 72px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  /* menus, lobby, profile: dark leather; the game screen draws its own table on top */
  background: #1e1a17 url(/assets/menu-bg.webp) center / cover no-repeat fixed;
  user-select: none; -webkit-user-select: none;
}
button { font: inherit; color: inherit; border: 0; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
input { font: inherit; }

#app { height: 100%; max-width: 720px; margin: 0 auto; position: relative; }
.screen { display: none; height: 100%; flex-direction: column; }
.screen.active { display: flex; }
.scroll { overflow-y: auto; flex: 1; padding: 16px 16px calc(16px + var(--safe-b)); }

/* ---------- loading ---------- */
#screen-loading { align-items: center; justify-content: center; gap: 18px; }
.logo { width: min(60vw, 260px); filter: drop-shadow(0 8px 24px rgba(0,0,0,.5)); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid rgba(255,255,255,.2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- common ---------- */
.panel { background: var(--panel); border-radius: 16px; padding: 14px; margin-bottom: 14px; backdrop-filter: blur(6px); }
.panel h3 { margin: 0 0 10px; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 18px; border-radius: 12px; background: var(--panel2); font-weight: 600; transition: transform .1s, background .2s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: linear-gradient(180deg, #ffd740, #ffb300); color: #3b1d00; box-shadow: 0 4px 0 #b37400; }
.btn.danger { background: rgba(229, 57, 53, .25); color: #ffb4b2; }
.btn.block { width: 100%; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.row { display: flex; gap: 10px; align-items: center; }
.muted { color: var(--muted); }
.center { text-align: center; }
.hidden { display: none !important; }
.title { font-size: 22px; font-weight: 800; margin: 4px 0 14px; display: flex; align-items: center; gap: 10px; }
.title img { height: 40px; }

.avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: 15px; overflow: hidden; background: #555; position: relative; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid rgba(255,255,255,.15); background: rgba(0,0,0,.3); color: #fff; outline: none; }

/* ---------- home / profile ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--panel2); border-radius: 12px; padding: 10px 6px; text-align: center; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 11px; color: var(--muted); }
.ach { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; font-size: 13px; }
.ach div { padding: 8px; border-radius: 10px; background: var(--panel2); }
.ach .off { opacity: .4; }
.toplist { list-style: none; padding: 0; margin: 0; }
.toplist li { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid rgba(255,255,255,.07); font-size: 14px; }
.dev-lobby { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.07); }

/* ---------- lobby ---------- */
.players { list-style: none; margin: 0; padding: 0; }
.players li { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.players li .name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.players li .crown { font-size: 18px; }
.slot-empty { opacity: .35; }
.rule { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.07); gap: 10px; }
.rule:last-child { border-bottom: 0; }
.rule small { display: block; color: var(--muted); font-size: 12px; }
.switch { width: 46px; height: 28px; border-radius: 14px; background: rgba(255,255,255,.2); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(18px); }
.seg { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.seg button { padding: 5px 8px; border-radius: 8px; background: var(--panel2); font-size: 13px; }
.seg button.on { background: var(--accent); color: #3b1d00; font-weight: 700; }
.lobby-footer { padding: 12px 16px calc(12px + var(--safe-b)); display: flex; gap: 10px; background: linear-gradient(transparent, rgba(0,0,0,.5)); }
.lobby-footer .btn { flex: 1; }
.code { font-family: ui-monospace, Menlo, monospace; background: rgba(0,0,0,.35); padding: 3px 8px; border-radius: 6px; }

/* ---------- cards ---------- */
.card {
  width: var(--cw); aspect-ratio: 116 / 168; flex: none;
  background-size: 100% 100%; background-repeat: no-repeat;
  border-radius: 9% / 6.2%;
  box-shadow: 0 2px 6px rgba(0,0,0,.45);
  position: relative;
}
.card.back { background-image: var(--card-back, url(/assets/back.png)); }

/* ---------- game ---------- */
#screen-game { position: relative; overflow: hidden; overflow: clip; }
#screen-game > * { position: relative; z-index: 1; }
#screen-game > .table-bg { position: fixed; z-index: 0; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px 0; }
.topbar .info { flex: 1; font-size: 13px; color: var(--muted); text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; background: rgba(0,0,0,.3); display: grid; place-items: center; font-size: 18px; }

.arena { flex: 1; position: relative; min-height: 0; }

/* table art + direction arrows */
.table-bg { pointer-events: none; background: url(/assets/table/arena-portrait.svg) center / 100% 100% no-repeat; }
.table-bg.land { background-image: url(/assets/table/arena-landscape.svg); }
@keyframes arrows-breathe { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }
@keyframes arrows-flip { from { transform: translate(-50%, -50%) scaleX(-1); opacity: .3; } }
.turn-glow { position: absolute; left: 50%; top: 50%; width: 330%; transform: translate(-50%, -50%); pointer-events: none; opacity: .9; }

/* seats */
.seat { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; z-index: 3; }
.plate { display: flex; flex-direction: column; align-items: center; position: relative; }
.av-frame { position: relative; width: 62px; height: 62px; background: url(/assets/ui/frame-neutral.svg) center / contain no-repeat; filter: drop-shadow(0 3px 6px rgba(0,0,0,.45)); }
.av-frame.active { background-image: url(/assets/ui/frame-active.svg); filter: drop-shadow(0 0 12px rgba(255, 196, 60, .85)); }
.av-clip { position: absolute; inset: 14%; clip-path: polygon(14% 0, 86% 0, 100% 14%, 100% 86%, 86% 100%, 14% 100%, 0 86%, 0 14%); background: #3a1210; }
.av-clip .avatar { width: 100%; height: 100%; border-radius: 0; background: none; }
.avatar img { display: block; }
.ribbon { margin-top: -8px; width: 104px; height: 20px; display: flex; align-items: center; justify-content: center; background: url(/assets/ui/nameplate-blue.svg) center / 100% 100% no-repeat; position: relative; z-index: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.ribbon .nm { font-size: 11px; font-weight: 800; padding: 0 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.seat.turn .ribbon, .plate.me.turn .ribbon { background-image: url(/assets/ui/nameplate-gold.svg); }
.plate .cnt { position: absolute; top: 30px; right: -8px; width: 28px; height: 29px; display: grid; place-items: center; padding: 4px 0 0 5px; background: url(/assets/ui/card-counter.svg) center / contain no-repeat; color: #4a1410; font-weight: 900; font-size: 13px; z-index: 2; }
.timer-ring { position: absolute; inset: 4%; border-radius: 22%; background: conic-gradient(#3ee07a calc(var(--p, 1) * 360deg), rgba(0,0,0,.35) 0); filter: drop-shadow(0 0 6px rgba(62, 224, 122, .9)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; padding: 3px; pointer-events: none; }
.uno-badge { position: absolute; top: -8px; right: -14px; background: radial-gradient(circle at 30% 30%, #ff6b5e, #c62828); color: #ffe066; font-size: 10px; font-weight: 900; padding: 3px 6px; border-radius: 10px; transform: rotate(12deg); box-shadow: 0 2px 6px rgba(0,0,0,.5); z-index: 4; animation: pulse .6s infinite alternate; }
.catch { margin-top: 4px; font-size: 11px; padding: 4px 8px; border-radius: 8px; background: var(--red); font-weight: 800; animation: pulse 0.6s infinite alternate; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.08); } }

/* center: deck + discard */
.table-center { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 30px; z-index: 2; }
.deck, .discard { position: relative; --cw: min(21vw, 92px); width: var(--cw); aspect-ratio: 116 / 168; }
.deck { cursor: pointer; transform: rotate(-8deg); }
.deck .card { position: absolute; left: 0; top: 0; }
.deck.can .card:last-of-type { box-shadow: 0 0 0 3px var(--accent), 0 0 6px var(--accent); }
.deck.can .card:last-of-type::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 0 22px var(--accent); animation: glow 1s infinite alternate; pointer-events: none; }
@keyframes glow { from { opacity: 1; } to { opacity: 0; } }
.deck-count { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--muted); transform: rotate(8deg); }
.pending { position: absolute; top: -14px; right: -16px; background: var(--red); font-weight: 900; padding: 4px 9px; border-radius: 14px; font-size: 17px; box-shadow: 0 2px 8px rgba(0,0,0,.5); z-index: 6; transform: rotate(8deg); animation: pulse .5s infinite alternate; }
.discard .card { position: absolute; left: 0; top: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--r)); box-shadow: 0 3px 8px rgba(0,0,0,.45); }
.discard .card.top { box-shadow: 0 0 0 3px var(--c), 0 0 26px 2px var(--c), 0 4px 10px rgba(0,0,0,.5); transition: box-shadow .3s; }
.wild-dot { position: absolute; right: -8px; bottom: -8px; width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff; z-index: 5; box-shadow: 0 2px 6px rgba(0,0,0,.5); }
.status { position: absolute; left: 0; right: 0; top: calc(52% + min(29vw, 150px)); text-align: center; font-weight: 800; font-size: 15px; text-shadow: 0 2px 6px rgba(0,0,0,.6); padding: 0 12px; z-index: 2; }
.status.mine { color: var(--accent); font-size: 17px; }

/* me */
.me-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 0 12px; position: relative; z-index: 5; }
.plate.me { flex-direction: row; align-items: center; gap: 0; }
.plate.me .ribbon { margin-top: 0; margin-left: -10px; width: 70px; }
.plate.me .cnt { top: auto; bottom: 22px; right: -30px; }
.plate.me .uno-badge { top: -6px; right: auto; left: 40px; }
.me-actions { display: flex; gap: 8px; align-items: center; }
.btn-uno { background: url(/assets/ui/button-red.svg) center / 100% 100% no-repeat; color: #ffe066; font-weight: 900; font-size: 18px; width: 100px; height: 41px; text-shadow: 0 2px 0 #7f1414; letter-spacing: .04em; filter: drop-shadow(0 3px 4px rgba(0,0,0,.4)); }
.btn-take { background: linear-gradient(180deg, #ffd740, #ffb300); color: #3b1d00; font-weight: 900; font-size: 15px; padding: 10px 14px; border-radius: 30px; box-shadow: 0 4px 0 #b37400; animation: pulse .7s infinite alternate; white-space: nowrap; }
.btn-take.pass { background: linear-gradient(180deg, #64b5f6, #1e88e5); color: #fff; box-shadow: 0 4px 0 #0d47a1; }
.btn-uno.ready { animation: pulse .6s infinite alternate; }

.hand { position: relative; height: calc(var(--cw) * 1.45 + 34px); margin-bottom: calc(6px + var(--safe-b)); --cw: var(--hand-cw); touch-action: none; }
.hand .card {
  position: absolute; left: 50%; bottom: 4px; margin-left: calc(var(--cw) / -2);
  transform-origin: 50% 115%;
  transform: translateX(var(--x, 0)) translateY(calc(var(--y, 0px) + var(--lift, 0px))) rotate(var(--r, 0deg));
  transition: transform .25s cubic-bezier(.2,.8,.3,1.2), filter .2s, box-shadow .2s;
  box-shadow: -2px 2px 8px rgba(0,0,0,.45);
}
.hand.my-turn .card.playable { --lift: -22px; cursor: pointer; box-shadow: 0 0 0 2px rgba(255, 230, 120, .9), 0 0 14px rgba(255, 204, 0, .7), -2px 4px 10px rgba(0,0,0,.5); }
.hand .card.playable:active { --lift: -30px; }
.hand.no-anim .card { transition: none; }
.hand.rows-2 { --cw: calc(var(--hand-cw) * .9); height: calc(var(--cw) * 1.45 * 1.5 + 34px); }
.hand.rows-3 { --cw: calc(var(--hand-cw) * .8); height: calc(var(--cw) * 1.45 * 2 + 34px); }
.hand .card.dim { filter: brightness(.6) saturate(.8); }
.hand .card.drawn { --lift: -30px; }
.spectator-note { text-align: center; padding: 14px; color: var(--muted); }
.flyer { position: fixed; z-index: 40; pointer-events: none; margin: 0; box-shadow: 0 8px 20px rgba(0,0,0,.5); }

@media (max-height: 680px) {
  .hand { --cw: min(18vw, 70px); }
  .deck, .discard { --cw: min(18vw, 76px); }
  .av-frame { width: 52px; height: 52px; }
}
@media (min-width: 600px) and (min-height: 700px) {
  .hand { --cw: 96px; }
  .deck, .discard { --cw: 104px; }
}

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 50; padding: 20px; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: #2a0d0b; border-radius: 20px; padding: 20px; width: min(100%, 380px); box-shadow: 0 10px 40px rgba(0,0,0,.6); max-height: 90vh; overflow-y: auto; }
.sheet h2 { margin: 0 0 14px; text-align: center; }
.color-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.color-pick button { aspect-ratio: 1.4; border-radius: 16px; font-weight: 800; font-size: 16px; text-shadow: 0 1px 3px rgba(0,0,0,.5); box-shadow: inset 0 -5px 0 rgba(0,0,0,.25); }
.results li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.results .pl { width: 30px; font-size: 20px; text-align: center; }
.results .nm { flex: 1; font-weight: 600; }
.results ul { list-style: none; margin: 0 0 16px; padding: 0; }

/* ---------- toasts ---------- */
#toasts { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; width: 92%; max-width: 420px; }
.toast { display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 6px 14px 6px 6px; border-radius: 16px; font-size: 13.5px; font-weight: 600; line-height: 1.25;
  background: linear-gradient(180deg, rgba(48, 14, 12, .94), rgba(28, 8, 8, .94)); border: 1px solid rgba(255, 196, 120, .28);
  box-shadow: 0 8px 22px rgba(0,0,0,.45), inset 0 1px 0 rgba(255,255,255,.06); animation: toast-in .3s cubic-bezier(.2,.9,.3,1.2); }
.toast:not(:has(.toast-ic)) { padding-left: 14px; }
.toast .toast-ic { width: 30px; height: 30px; flex: none; }
.toast.err { background: linear-gradient(180deg, rgba(150, 24, 20, .96), rgba(100, 12, 10, .96)); border-color: rgba(255, 150, 140, .4); }
.toast.out { opacity: 0; transition: opacity .3s; }
@keyframes toast-in { from { transform: translateY(-10px); opacity: 0; } }
#conn-banner { position: fixed; bottom: 0; left: 0; right: 0; background: #b71c1c; text-align: center; padding: 8px; font-size: 13px; z-index: 70; }


/* ---------- invalid move ---------- */
.hand .card.shake { animation: shake .45s; }
@keyframes shake {
  0%, 100% { translate: 0 0; }
  20% { translate: -9px 0; } 40% { translate: 8px 0; } 60% { translate: -6px 0; } 80% { translate: 4px 0; }
}

/* ---------- skip / block ---------- */
.block-icon {
  width: 46px; height: 46px; border-radius: 50%; position: relative;
  background: radial-gradient(circle, #ff5a4e, #c62828 70%);
  box-shadow: inset 0 0 0 5px #fff, 0 4px 14px rgba(0,0,0,.55);
}
.block-icon::after {
  content: ""; position: absolute; left: 14%; right: 14%; top: 50%; height: 16%; margin-top: -8%;
  background: #fff; border-radius: 4px; transform: rotate(-45deg);
}
.seat-block { position: absolute; top: -6px; left: 50%; width: 74px; height: 74px; margin-left: -37px; z-index: 10; pointer-events: none; animation: block-pop 1.7s ease-out forwards; filter: drop-shadow(0 4px 10px rgba(0,0,0,.5)); }
@keyframes block-pop {
  0% { transform: scale(0) rotate(-90deg); opacity: 0; }
  18% { transform: scale(1.25) rotate(0); opacity: 1; }
  28% { transform: scale(1); }
  80% { transform: scale(1); opacity: 1; }
  100% { transform: scale(.8) translateY(-14px); opacity: 0; }
}
.skip-overlay {
  position: fixed; inset: 0; z-index: 45; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(circle, rgba(120, 0, 0, .55), rgba(0, 0, 0, .55));
  animation: skip-bg 1.7s ease-out forwards;
}
.skip-big { width: min(70vw, 320px); height: auto; animation: block-big 1.9s cubic-bezier(.2,.9,.3,1.2) forwards; filter: drop-shadow(0 0 40px rgba(255, 80, 40, .7)); }
.skip-text { font-size: 28px; font-weight: 900; text-shadow: 0 3px 10px rgba(0,0,0,.6); animation: skip-text 1.7s ease-out forwards; }
@keyframes block-big {
  0% { transform: scale(3) rotate(-60deg); opacity: 0; }
  20% { transform: scale(1) rotate(0); opacity: 1; }
  26% { transform: scale(1.08); }
  32% { transform: scale(1); }
  80% { opacity: 1; }
  100% { transform: scale(.9); opacity: 0; }
}
@keyframes skip-bg { 0% { opacity: 0; } 12% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes skip-text { 0%, 15% { opacity: 0; transform: translateY(16px); } 30% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }


/* lobby avatars use the same illustrated faces */
.players .avatar, .panel .avatar { background: #3a1210; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- deck in the top-left corner ---------- */
.deck-wrap { position: absolute; left: 12px; top: 4px; z-index: 3; --cw: min(15vw, 64px); }
.deck-wrap .deck { --cw: inherit; width: var(--cw); transform: perspective(500px) rotateX(28deg) rotate(-12deg); }
.deck-wrap .deck-count { position: static; transform: none; margin-top: 6px; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.6); color: rgba(255,255,255,.85); width: var(--cw); }
.discard .pending { top: -16px; right: -18px; }

/* ---------- opponents' cards standing upright in 3D ---------- */
.opp-cards { position: absolute; width: 0; height: 0; z-index: 2; pointer-events: none; }
.opp-cards .card {
  --cw: min(10vw, 42px);
  position: absolute; left: calc(var(--cw) / -2); top: calc(var(--cw) * -1.2);
  transform-origin: 50% 100%;
  box-shadow: -2px 2px 5px rgba(0,0,0,.45); border-radius: 4px; transition: transform .3s;
}
/* player across the table: an upright fan facing us */
.opp-cards.top .card { transform: translateX(var(--x)) rotate(var(--r)); }
/* players on the sides: an upright row turned into the depth, near end largest */
.opp-cards.left { transform: perspective(420px) rotateY(58deg) rotateZ(-3deg); }
.opp-cards.right { transform: perspective(420px) rotateY(-58deg) rotateZ(3deg); }
.opp-cards.left .card, .opp-cards.right .card { transform: translateX(var(--x)); }
/* soft contact shadow on the felt */
.opp-cards::after { content: ""; position: absolute; left: -60px; width: 120px; top: -6px; height: 14px; border-radius: 50%; background: radial-gradient(rgba(0,0,0,.35), transparent 70%); }
.opp-cards.turn .card { box-shadow: 0 0 0 1px rgba(255, 215, 90, .8), -2px 2px 6px rgba(0,0,0,.45); }

/* ---------- UNO! burst ---------- */
.uno-burst { position: absolute; left: 50%; top: 4px; width: 128px; margin-left: -64px; margin-top: -40px; z-index: 12; pointer-events: none; filter: drop-shadow(0 6px 14px rgba(0,0,0,.45)); animation: uno-burst 1.9s cubic-bezier(.2, .9, .3, 1.3) forwards; }
.plate.me .uno-burst { left: 50px; top: -34px; }
@keyframes uno-burst {
  0% { transform: scale(0) rotate(-25deg); opacity: 0; }
  14% { transform: scale(1.35) rotate(6deg); opacity: 1; }
  24% { transform: scale(1) rotate(-4deg); }
  34% { transform: scale(1.08) rotate(0); }
  80% { transform: scale(1) translateY(0); opacity: 1; }
  100% { transform: scale(.85) translateY(-22px); opacity: 0; }
}

/* ---------- hand gestures ---------- */
.hand .card.peek { --lift: -26px; scale: 1.07; z-index: 50 !important; }
@media (hover: hover) { .hand .card:hover { --lift: -18px; } }
.drag-ghost { position: fixed; z-index: 45; pointer-events: none; margin: 0; box-shadow: 0 16px 30px rgba(0,0,0,.55); will-change: left, top, transform; }

/* ---------- big screens ---------- */
@media (min-width: 900px) and (min-height: 700px) {
  :root { --hand-cw: 118px; }
  #app { max-width: 1180px; }
  .deck, .discard { --cw: 132px; }
  .deck-wrap { --cw: 100px; left: 24px; top: 12px; }
  .table-center { gap: 0; }
  .turn-ring { width: min(72%, 760px); }
  .av-frame { width: 86px; height: 86px; }
  .ribbon { width: 150px; height: 28px; margin-top: -10px; }
  .ribbon .nm { font-size: 15px; }
  .plate .cnt { width: 38px; height: 40px; font-size: 17px; top: 44px; right: -14px; }
  .plate.me .ribbon { width: 100px; }
  .plate.me .cnt { bottom: 32px; right: -42px; }
  .opp-cards .card { --cw: 58px; }
  .uno-burst { width: 180px; margin-left: -90px; margin-top: -56px; }
  .status { font-size: 20px; }
  .status.mine { font-size: 24px; }
  .btn-uno { width: 140px; height: 57px; font-size: 24px; }
  .btn-take { font-size: 19px; padding: 14px 22px; }
  .topbar .info { font-size: 15px; }
  .icon-btn { width: 44px; height: 44px; font-size: 22px; }
  .seat-block { width: 96px; height: 96px; margin-left: -48px; }
}

.skip-trail { position: fixed; height: 34px; margin-top: -17px; z-index: 44; pointer-events: none; transform-origin: 0 50%; transform: rotate(var(--a)); animation: skip-trail .65s ease-out forwards; }
@keyframes skip-trail {
  0% { clip-path: inset(0 100% 0 0); opacity: 1; }
  55% { clip-path: inset(0 0 0 0); opacity: 1; }
  100% { clip-path: inset(0 0 0 60%); opacity: 0; }
}
.seat.edge-left .uno-burst { left: -14px; margin-left: 0; }
.seat.edge-right .uno-burst { left: auto; right: -14px; margin-left: 0; }

/* ---------- player with the app closed ---------- */
.seat.offline .av-frame { filter: grayscale(.9) brightness(.7); }
.offline-badge { position: absolute; top: 46px; left: 50%; transform: translateX(-50%); z-index: 6; white-space: nowrap; font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 10px; background: rgba(20, 5, 5, .85); color: #ffd0c8; box-shadow: 0 2px 6px rgba(0,0,0,.5); animation: pulse .9s infinite alternate; }
.players li.is-offline { opacity: .55; }

/* edge seats: keep counter and badges on the inner side */
.seat.edge-right .plate .cnt { right: auto; left: -8px; }
/* deck count sits on the deck itself, so it never overlaps a seat below */
.deck-wrap .deck-count { position: absolute; right: -8px; bottom: -4px; width: auto; margin: 0; padding: 1px 7px; border-radius: 10px; background: rgba(20, 5, 5, .85); font-size: 11px; z-index: 5; }
@media (min-width: 900px) and (min-height: 700px) { :root { --seat-pad: 84px; } }

/* status badges sit in a row above the avatar, never over the name */
.seat-badges { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); margin-bottom: -10px; display: flex; gap: 4px; align-items: center; z-index: 7; pointer-events: none; }
.seat-badges:empty { display: none; }
.seat-badges .uno-badge, .seat-badges .offline-badge { position: static; transform: none; }

/* direction arrows: a circle spinning flat on the table (squashed into the table's perspective) */
.turn-ring { position: absolute; left: 50%; top: 52%; width: min(94%, 560px); aspect-ratio: 1; transform: translate(-50%, -50%) scaleY(.56); pointer-events: none; z-index: 1; }
.turn-ring img { display: block; width: 100%; height: 100%; filter: drop-shadow(0 2px 6px rgba(0,0,0,.35)); animation: ring-spin 9s linear infinite; }
.turn-ring.ccw img { animation-direction: reverse; }
@keyframes ring-spin { to { transform: rotate(360deg); } }
.turn-ring.flip { animation: ring-flip .5s ease-out; }
@keyframes ring-flip { from { transform: translate(-50%, -50%) scaleY(.56) scaleX(-1); opacity: .3; } }

/* ---------- game modes: table themes ---------- */
.table-bg[data-theme="flip-light"] { background-image: url(/studio/themes/flip-light-portrait.svg); }
.table-bg[data-theme="flip-dark"] { background-image: url(/studio/themes/flip-dark-portrait.svg); }
.table-bg[data-theme="no-mercy"] { background-image: url(/studio/themes/no-mercy-portrait.svg); }
.table-bg.land[data-theme="flip-light"] { background-image: url(/studio/themes/flip-light-landscape.svg); }
.table-bg.land[data-theme="flip-dark"] { background-image: url(/studio/themes/flip-dark-landscape.svg); }
.table-bg.land[data-theme="no-mercy"] { background-image: url(/studio/themes/no-mercy-landscape.svg); }
#screen-game:has(.table-bg[data-theme="flip-dark"]) { --accent: #23ddcc; }
#screen-game:has(.table-bg[data-theme="no-mercy"]) { --accent: #ffb63c; }

.topbar .info { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mode-badge { font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 10px; background: rgba(0,0,0,.35); color: #fff3d6; white-space: nowrap; }
.mode-badge.flip-dark { background: rgba(35, 221, 204, .18); color: #b8fff7; }
.mode-badge.flip-light { background: rgba(255, 52, 125, .2); }
.mode-badge.no-mercy { background: rgba(255, 182, 60, .18); color: #ffd98a; }
.mode-badge { display: inline-flex; align-items: center; gap: 4px; line-height: 1; padding: 4px 10px; }
.mode-badge .gl.inline, .mode-badge .ic, .mode-badge .ic.inline-ic { margin: 0; display: block; }
.game-clock, .watchers { gap: 3px; line-height: 1; }
.game-clock i, .watchers i { display: block; line-height: 1; }
.topbar .places { font-size: 11px; color: var(--muted); }

/* lobby: mode tiles */
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mode-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px 8px; border-radius: 14px; background: var(--panel2); text-align: center; border: 2px solid transparent; transition: border-color .2s, background .2s; }
.mode-tile img { width: 46px; aspect-ratio: 116 / 168; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(0,0,0,.4)); margin-bottom: 2px; }
.mode-tile b { font-size: 14px; }
.mode-tile small { font-size: 10.5px; color: var(--muted); line-height: 1.25; }
.mode-tile .mode-max { font-size: 10px; color: var(--accent); opacity: .8; }
.mode-tile.on { border-color: var(--accent); background: rgba(255, 204, 0, .12); }
.mode-tile:disabled { opacity: 1; }
.mode-tile:disabled:not(.on) { opacity: .55; }
.warn { margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; background: rgba(229, 57, 53, .25); color: #ffd0cc; font-size: 13px; }
.mode-note { margin: 0 0 6px; font-size: 13px; color: var(--muted); line-height: 1.4; }

/* stack total + threshold */
.pending small { display: block; font-size: 10px; font-weight: 700; opacity: .9; text-align: center; margin-top: -1px; }

/* No Mercy: getting close to 25 */
.plate .cnt.danger { filter: drop-shadow(0 0 6px #ff3b30); color: #c40000; animation: pulse .5s infinite alternate; }
.mercy-warn { position: absolute; left: 0; top: -22px; white-space: nowrap; font-size: 11px; font-weight: 900; color: #ffd0c8; background: rgba(160, 20, 20, .85); padding: 2px 7px; border-radius: 9px; }

/* target picker */
.target-pick { display: flex; flex-direction: column; gap: 8px; }
.target-pick button { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 14px; background: var(--panel2); text-align: left; font-weight: 700; }
.target-pick button span { flex: 1; }
.target-pick button b { color: var(--accent); }
.target-pick button:active { background: rgba(255,255,255,.15); }
.modal-card { display: block; width: 72px; margin: 0 auto 8px; }

/* event effects */
.fx-pop { position: fixed; z-index: 46; pointer-events: none; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 4px; animation: fx-pop 1.4s cubic-bezier(.2,.9,.3,1.2) forwards; }
.fx-pop img { width: 58px; height: 58px; filter: drop-shadow(0 4px 10px rgba(0,0,0,.5)); }
.fx-pop span { font-size: 13px; font-weight: 900; padding: 3px 10px; border-radius: 12px; background: rgba(20, 5, 5, .85); color: #fff3d6; white-space: nowrap; box-shadow: 0 3px 10px rgba(0,0,0,.4); }
.fx-pop.big { animation-duration: 1.7s; }
.fx-pop.big img { width: 96px; height: 96px; }
.fx-pop.big span { font-size: 16px; }
.fx-faces { display: flex; gap: 3px; margin-top: 4px; max-width: 92vw; flex-wrap: wrap; justify-content: center; }
.fx-faces .card { --cw: 34px; border-radius: 4px; }
.fx-pop:has(.fx-faces) { animation-duration: 2.6s; }
@keyframes fx-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.3); }
  14% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); }
  24% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -62%) scale(.96); }
}

.table-bg { transition: opacity .3s; }

/* rules modal */
.rules-body { font-size: 14px; line-height: 1.45; }
.rules-body h4 { margin: 14px 0 6px; }
.rule-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.rule-row > div { flex: 1; }
.mini-card { display: inline-block; width: 30px; aspect-ratio: 116 / 168; background-size: 100% 100%; border-radius: 3px; margin-right: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.5); vertical-align: middle; flex: none; }
.rule-row .mini-card + .mini-card { margin-left: -6px; }

/* studio card faces carry their own border */
.card.studio { background-color: transparent; }
.rule.stack-rule { flex-direction: column; align-items: stretch; }
.rule.stack-rule .seg { justify-content: stretch; flex-wrap: nowrap; }
.rule.stack-rule .seg button { flex: 1; padding: 7px 4px; }
.rule.inactive > div:first-child { opacity: .5; }


/* ---------- icons ---------- */
.ic { width: 22px; height: 22px; vertical-align: middle; flex: none; }
.gl { width: 20px; height: 20px; vertical-align: middle; flex: none; }
.gl.inline, .ic.inline-ic { width: 16px; height: 16px; margin: -2px 3px 0 0; }
.gl.flip-x { transform: scaleX(-1); }
.ic.h-ic { width: 20px; height: 20px; margin: -3px 4px 0 0; }
.ic.title-ic { width: 44px; height: 44px; display: block; margin: 0 auto 6px; }
.ic.btn-ic { width: 22px; height: 22px; margin: -3px 2px 0 0; }
.ic.big-ic { width: 72px; height: 72px; display: block; margin: 6px auto; }
.medal { width: 26px; height: 26px; flex: none; vertical-align: middle; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.crown-ic { width: 22px; height: 22px; vertical-align: middle; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.icon-btn .gl { width: 22px; height: 22px; }
.small { font-size: 13px; }

/* ---------- brand ---------- */
.brand-logo { display: block; width: min(52vw, 220px); margin: 0 auto; filter: drop-shadow(0 8px 18px rgba(0,0,0,.45)); }
.brand-logo.top { width: min(40vw, 170px); margin-bottom: 10px; }
.brand { text-align: center; margin: 4px 0 14px; }
.brand span { display: inline-block; margin-top: 4px; font-size: 13px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.title img { height: 44px; }
.logo { width: min(64vw, 280px); }
.loading-box { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 60px; color: var(--muted); }
.glass-card { background: linear-gradient(180deg, rgba(40, 10, 8, .62), rgba(20, 5, 5, .62)); border: 1px solid rgba(255, 196, 120, .14); border-radius: 20px; padding: 16px; margin-bottom: 14px; backdrop-filter: blur(8px); box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.login-err { margin-top: 30px; }
.login-err h2 { margin: 6px 0; }
.big-btn { padding: 15px; font-size: 17px; margin-bottom: 14px; }
.section-title { display: flex; align-items: center; gap: 8px; margin: 18px 2px 10px; font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #ffd9a8; }
.section-title .ic, .section-title .gl { width: 24px; height: 24px; }
.game-tile { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border-radius: 14px; background: rgba(255,255,255,.07); border-left: 4px solid #ffcf3f; }
.game-tile.playing { border-left-color: #3ee07a; }
.game-tile.finished { border-left-color: #8a7a78; }
.gt-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.gt-info b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gt-info span { font-size: 12px; color: var(--muted); }
.hint-card { display: flex; align-items: center; gap: 12px; margin: 18px 0 6px; padding: 12px 14px; border-radius: 16px; background: rgba(255, 207, 63, .1); border: 1px dashed rgba(255, 207, 63, .4); font-size: 13.5px; }
.hint-card .ic { width: 36px; height: 36px; }

/* ---------- profile ---------- */
.profile { padding-top: 10px; }
.hero { display: flex; align-items: center; gap: 14px; padding: 16px 14px; border-radius: 22px;
  background: radial-gradient(120% 140% at 0% 0%, rgba(255, 170, 60, .28), transparent 60%), linear-gradient(180deg, rgba(48, 12, 10, .8), rgba(24, 6, 6, .8));
  border: 1px solid rgba(255, 196, 120, .25); box-shadow: 0 12px 30px rgba(0,0,0,.35); }
.hero-av .av-frame { width: 84px; height: 84px; }
.hero-main { flex: 1; min-width: 0; }
.hero-name { font-size: 21px; font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.hero-rank { display: flex; align-items: center; gap: 5px; font-size: 13px; color: #ffd9a8; margin: 3px 0 7px; }
.hero-rank .ic { width: 20px; height: 20px; }
.hero-line { display: flex; gap: 12px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.hero-line span { display: flex; align-items: center; gap: 4px; }
.hero-line b { color: #fff; font-size: 15px; }
.hero-line .ic { width: 20px; height: 20px; }
.wr-ring { --p: 0; flex: none; width: 74px; height: 74px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: radial-gradient(closest-side, #2a0b09 76%, transparent 78% 100%), conic-gradient(#3ee07a calc(var(--p) * 1%), rgba(255,255,255,.12) 0); }
.wr-ring b { font-size: 18px; line-height: 1; }
.wr-ring span { font-size: 10px; color: var(--muted); }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px 9px; border-radius: 16px; text-align: center;
  background: linear-gradient(180deg, rgba(255,255,255,.09), rgba(255,255,255,.03)); border: 1px solid rgba(255,255,255,.07); }
.stat-tile .ic { width: 34px; height: 34px; margin-bottom: 2px; }
.stat-tile b { font-size: 19px; }
.stat-tile span { font-size: 10.5px; color: var(--muted); line-height: 1.15; }
.ach-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ach-badge { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 4px; border-radius: 16px; text-align: center; font-size: 10.5px; line-height: 1.15;
  background: rgba(255,255,255,.05); color: var(--muted); }
.ach-badge .ic { width: 38px; height: 38px; filter: grayscale(1) brightness(.6); opacity: .6; }
.ach-badge.done { background: linear-gradient(180deg, rgba(255, 207, 63, .2), rgba(255, 140, 40, .08)); color: #fff; border: 1px solid rgba(255, 207, 63, .35); }
.ach-badge.done .ic { filter: drop-shadow(0 0 8px rgba(255, 196, 60, .6)); opacity: 1; }
.recent, .top-list { display: flex; flex-direction: column; gap: 6px; }
.recent-row, .top-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: rgba(255,255,255,.06); font-size: 14px; }
.recent-row span { flex: 1; }
.recent-row i { font-style: normal; font-size: 12px; color: var(--muted); }
.top-row .tn { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-row .tv { display: flex; align-items: center; gap: 3px; font-weight: 800; font-size: 13px; }
.top-row .tv .ic { width: 18px; height: 18px; }
.top-row.me { background: rgba(255, 207, 63, .14); border: 1px solid rgba(255, 207, 63, .3); }

/* ---------- modals: menu, place, results ---------- */
.menu-head { text-align: center; margin-bottom: 8px; }
.menu-head h2 { margin: 0 0 6px; }
.menu-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; margin-bottom: 8px; border-radius: 14px; background: rgba(255,255,255,.07); font-weight: 700; text-align: left; }
.menu-row .ic, .menu-row .gl { width: 26px; height: 26px; }
.menu-row.danger { color: #ffb4b2; background: rgba(229, 57, 53, .18); }
.with-ic { text-align: center; }
.sheet-celebrate, .sheet-results { background: radial-gradient(120% 80% at 50% 0%, rgba(255, 170, 60, .3), transparent 60%), #2a0d0b; border: 1px solid rgba(255, 196, 120, .25); }
.celebrate { position: relative; text-align: center; padding: 6px 0 12px; }
.celebrate .medal { width: 96px; height: 96px; position: relative; z-index: 1; animation: medal-in .7s cubic-bezier(.2,.9,.3,1.4); }
.celebrate h2 { margin: 8px 0 4px; font-size: 26px; }
.celebrate p { margin: 0; color: var(--muted); }
.burst { position: absolute; left: 50%; top: 52px; width: 220px; height: 220px; margin: -110px 0 0 -110px; border-radius: 50%;
  background: repeating-conic-gradient(rgba(255, 207, 63, .28) 0 10deg, transparent 10deg 24deg); -webkit-mask: radial-gradient(circle, #000 20%, transparent 70%); mask: radial-gradient(circle, #000 20%, transparent 70%); animation: spin 12s linear infinite; }
@keyframes medal-in { from { transform: scale(0) rotate(-40deg); } }
.res-head { text-align: center; margin-bottom: 6px; }
.res-head .res-ic { width: 64px; height: 64px; display: block; margin: 0 auto; animation: medal-in .6s cubic-bezier(.2,.9,.3,1.4); }
.res-head h2 { margin: 4px 0 2px; }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 8px; margin: 12px 0 10px; }
.pod { display: flex; flex-direction: column; align-items: center; width: 31%; min-width: 0; animation: pod-up .5s ease-out backwards; }
.pod.p1 { animation-delay: .25s; } .pod.p2 { animation-delay: .1s; } .pod.p3 { animation-delay: .4s; }
@keyframes pod-up { from { opacity: 0; transform: translateY(30px); } }
.pod-av .av-frame { width: 56px; height: 56px; }
.pod.p1 .pod-av .av-frame { width: 72px; height: 72px; }
.pod-name { font-size: 12px; font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 2px 0 4px; }
.pod-block { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; border-radius: 12px 12px 6px 6px;
  background: linear-gradient(180deg, rgba(255,255,255,.16), rgba(255,255,255,.05)); border: 1px solid rgba(255,255,255,.12); }
.pod.p1 .pod-block { height: 92px; background: linear-gradient(180deg, rgba(255, 207, 63, .35), rgba(255, 140, 40, .1)); border-color: rgba(255, 207, 63, .45); }
.pod.p2 .pod-block { height: 70px; }
.pod.p3 .pod-block { height: 56px; }
.pod-block .medal { width: 30px; height: 30px; }
.pod-block b { font-size: 13px; }
.res-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.res-row { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 12px; background: rgba(255,255,255,.06); font-size: 14px; }
.res-row .nm { flex: 1; font-weight: 700; }

/* ---------- game: whose turn, clock ---------- */
.game-clock { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; padding-left: 7px; border-left: 1px solid rgba(255,255,255,.25); font-variant-numeric: tabular-nums; }
.game-clock i { font-style: normal; }
.watchers { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; opacity: .5; font-size: .92em; font-variant-numeric: tabular-nums; }
.watchers.hidden { display: none; }
.watchers i { font-style: normal; }
.topbar .places { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.topbar .places .medal { width: 18px; height: 18px; margin-right: 2px; }
#screen-game::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 42%; pointer-events: none; z-index: 0; transition: opacity .4s, background .4s; opacity: 0; }
#screen-game.turn-mine::after { opacity: 1; background: linear-gradient(0deg, rgba(62, 224, 122, .5), rgba(62, 224, 122, .16) 45%, transparent); }
#screen-game.turn-other::after { opacity: 1; background: linear-gradient(0deg, rgba(0, 0, 0, .55), rgba(0, 0, 0, .25) 50%, transparent); }
#screen-game.turn-other .hand .card { filter: brightness(.82); }
#screen-game.turn-mine .plate.me .ribbon { animation: pulse .8s infinite alternate; }
.offline-badge .gl { width: 13px; height: 13px; margin-right: 3px; }
.mercy-warn { display: flex; align-items: center; }

/* ---------- emotes ---------- */
.emote-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.35); color: #ffe08a; border: 1px solid rgba(255, 224, 138, .35); }
.emote-btn .gl { width: 26px; height: 26px; }
#emote-panel { position: fixed; inset: 0; z-index: 55; display: flex; align-items: flex-end; justify-content: center; padding: 0 10px calc(150px + var(--safe-b)); background: rgba(0,0,0,.25); animation: fade .15s; }
.ep-card { position: relative; width: min(100%, 380px); max-height: 34vh; padding: 42px 8px 8px; border-radius: 24px; background: #fffaf2; box-shadow: 0 16px 40px rgba(0,0,0,.5); animation: ep-in .25s cubic-bezier(.2,.9,.3,1.2); }
@keyframes ep-in { from { transform: translateY(30px) scale(.95); opacity: 0; } }
.ep-close { position: absolute; left: 12px; top: 8px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #d23b3b; border: 2px solid #f1b0b0; background: #fff; }
.ep-close .gl { width: 16px; height: 16px; }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; max-height: calc(34vh - 50px); overflow-y: auto; overscroll-behavior: contain; }
.ep-grid button { min-width: 0; aspect-ratio: 1; border-radius: 10px; background: transparent; padding: 2px; transition: transform .1s, background .15s; }
.ep-grid button:active { transform: scale(.9); background: rgba(0,0,0,.06); }
.ep-grid img { width: 100%; height: 100%; object-fit: contain; }
.av-frame.emoting .av-clip { filter: brightness(.45) saturate(.7); transition: filter .2s; }
.av-frame .emote { position: absolute; inset: -14%; z-index: 4; pointer-events: none; animation: emote 3.2s ease-out forwards; }
.av-frame .emote img { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 4px 8px rgba(0,0,0,.45)); }
@keyframes emote {
  0% { transform: scale(0) rotate(-20deg); opacity: 0; }
  12% { transform: scale(1.18) rotate(6deg); opacity: 1; }
  20% { transform: scale(.95) rotate(-3deg); }
  28% { transform: scale(1.03) rotate(0); }
  40%, 70% { transform: scale(1) translateY(0); }
  55% { transform: scale(1.04) translateY(-3px); }
  88% { opacity: 1; }
  100% { transform: scale(.8) translateY(-10px); opacity: 0; }
}

/* bottom bar: keep everything on one line on phones */
.me-actions { gap: 6px; flex-wrap: nowrap; }
@media (max-width: 420px) {
  .btn-uno { width: 82px; height: 36px; font-size: 16px; }
  .btn-take { font-size: 14px; padding: 9px 12px; }
  .emote-btn { width: 38px; height: 38px; }
  .emote-btn .gl { width: 22px; height: 22px; }
  .plate.me .ribbon { width: 56px; }
}

/* Opening round — purely visual; table controls and the server clock stay live. */
.round-intro {
  position: fixed; inset: 0; z-index: 44; pointer-events: none;
  display: grid; place-items: center; isolation: isolate;
}
.round-intro::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(ellipse 27% 28% at 50% 44%, rgba(255,153,45,.30), rgba(43,12,20,.38) 70%, transparent 100%);
  animation: round-intro-shade 1.63s ease both;
}
.round-intro-stage {
  display: grid; place-items: center; width: min(60vw, 225px);
  transform: translateY(-6vh);
}
.round-intro-card, .round-intro-go { grid-area: 1 / 1; opacity: 0; }
.round-intro-card {
  display: block; width: 69%; height: auto; min-width: 84px;
  filter: drop-shadow(0 7px 12px rgba(31,5,14,.70));
  animation: round-intro-card .36s var(--intro-delay) cubic-bezier(.2,.7,.35,1) both;
}
.round-intro-go {
  display: grid; justify-items: center; row-gap: 0;
  width: 100%; margin-top: -8px;
  animation: round-intro-go .55s 1.08s cubic-bezier(.18,.75,.35,1) both;
}
.round-intro-go img {
  display: block; width: 100%; height: auto;
  filter: drop-shadow(0 7px 13px rgba(35,7,13,.76));
}
.round-intro-go b {
  margin-top: -5px; padding: 4px 15px 5px; border-radius: 50px;
  background: #421421; border: 1px solid #ffbd59; color: #fff1b7;
  font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .15em;
  box-shadow: 0 3px 11px #2b06165e;
}
.round-intro-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
@keyframes round-intro-card {
  0% { opacity: 0; transform: translateY(15px) rotate(-21deg) scale(.66); }
  21%, 72% { opacity: 1; }
  38%, 60% { transform: translateY(0) rotate(var(--intro-tilt)) scale(1); }
  100% { opacity: 0; transform: translateY(-14px) rotate(12deg) scale(.91); }
}
@keyframes round-intro-go {
  0% { opacity: 0; transform: scale(.76) rotate(-4deg); }
  22%, 76% { opacity: 1; }
  36% { transform: scale(1.05) rotate(1deg); }
  70% { transform: scale(1); }
  100% { opacity: 0; transform: translateY(-7px) scale(.96); }
}
@keyframes round-intro-shade { 0%, 100% { opacity: 0; } 13%, 79% { opacity: 1; } }
.round-intro-quiet::before { animation: none; }
.round-intro-quiet .round-intro-go { animation: none; opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .round-intro::before { animation: none; }
  .round-intro-card { display: none; }
  .round-intro-go { animation: none; opacity: 1; }
}

/* panels on the dark menu background */
.panel, .glass-card { background: linear-gradient(180deg, rgba(255, 236, 214, .07), rgba(255, 236, 214, .03)); border: 1px solid rgba(255, 214, 170, .12); }
.hero { background: radial-gradient(120% 140% at 0% 0%, rgba(255, 170, 60, .2), transparent 60%), linear-gradient(180deg, rgba(60, 40, 30, .75), rgba(30, 22, 18, .75)); }
.stat-tile, .recent-row, .top-row, .game-tile { background: rgba(255, 236, 214, .06); }
.mode-tile { background: rgba(255, 236, 214, .06); }
.lobby-footer { background: linear-gradient(transparent, rgba(0,0,0,.6)); }

/* ---------- opening show ---------- */
#screen-game.dealing .hand .card { animation: deal-hand .5s cubic-bezier(.2,.8,.3,1) backwards; }
@keyframes deal-hand {
  0% { opacity: 0; transform: translate(var(--fx, 0), var(--fy, -40vh)) scale(.45) rotate(-35deg); }
  15% { opacity: 1; transform: translate(var(--fx, 0), var(--fy, -40vh)) scale(.45) rotate(-35deg); }
}
#screen-game.dealing .opp-cards .card { animation: deal-opp .35s ease-out backwards; }
@keyframes deal-opp { 0% { opacity: 0; translate: 0 -40px; scale: .3; } 40% { opacity: 1; } }
#screen-game.dealing .discard .card { animation: deal-opp .4s ease-out backwards; animation-delay: .2s; }
#screen-game.dealing .me-actions, #screen-game.dealing .status { opacity: 0; transition: opacity .3s; }
.countdown { position: fixed; inset: 0; z-index: 48; pointer-events: none; display: grid; place-items: center;
  background: rgba(10, 4, 4, .86); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .3s; }
.countdown.out { opacity: 0; transition: opacity .35s; }
.cd-item { display: flex; flex-direction: column; align-items: center; gap: 10px; animation: cd-pop .7s cubic-bezier(.2,.9,.3,1.3) both; }
.cd-card { width: min(44vw, 190px); aspect-ratio: 116 / 168; background-size: 100% 100%; border-radius: 9% / 6.2%;
  box-shadow: 0 0 0 4px rgba(255, 236, 170, .9), 0 0 40px 12px rgba(255, 200, 70, .75), 0 18px 40px rgba(0,0,0,.6); transform: rotate(-6deg); }
.cd-logo { width: min(70vw, 320px); filter: drop-shadow(0 0 30px rgba(255, 200, 60, .7)); }
.cd-start { font-size: 30px; font-weight: 900; letter-spacing: .04em; padding: 6px 22px; border-radius: 30px; color: #fff3d6;
  background: linear-gradient(180deg, #3a1210, #1c0807); border: 2px solid rgba(255, 207, 63, .6); box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.cd-item.last { animation-duration: .8s; }
@keyframes cd-pop {
  0% { opacity: 0; transform: scale(.3) rotate(-25deg); }
  45% { opacity: 1; transform: scale(1.12) rotate(4deg); }
  65% { transform: scale(.97) rotate(-1deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

/* 3D card turns (Flip) */
.hand, .discard, .opp-cards { perspective: 900px; }

/* Telegram (Bot API 8+) can draw its own controls over the top of the page: keep our top bar below them */
:root { --tg-top: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)); }
.topbar { padding-top: calc(8px + var(--tg-top)); }
.scroll { padding-top: calc(16px + var(--tg-top)); }
.countdown, #toasts { margin-top: var(--tg-top); }

/* my plate like everyone else's: name under the avatar, card count at the frame's corner */
.plate.me { flex-direction: column; align-items: center; }
.plate.me .ribbon { margin: -8px 0 0; width: 84px; }
.plate.me .cnt { top: 30px; bottom: auto; right: -12px; left: auto; }
.plate.me .uno-badge { top: -8px; left: auto; right: -14px; }
.plate.me .mercy-warn { top: -24px; left: 50%; transform: translateX(-50%); }
.me-bar { align-items: center; }
@media (min-width: 900px) and (min-height: 700px) {
  .plate.me .ribbon { width: 130px; margin-top: -10px; }
  .plate.me .cnt { top: 44px; right: -16px; }
}

#screen-game.counting .table-center, #screen-game.counting .turn-ring, #screen-game.counting .status { visibility: hidden; }

/* a reaction sits above the name plate and the card counter, so it's fully visible */
.av-frame.emoting { z-index: 8; }
.plate:has(.av-frame.emoting) { z-index: 8; }
.seat:has(.av-frame.emoting) { z-index: 9; }
.av-frame .emote { inset: -18% -18% -30%; }

/* ---------- colour cubes ---------- */
#color-cubes { position: fixed; inset: 0; z-index: 52; touch-action: none; background: rgba(8, 3, 3, .62); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); animation: fade .2s; }
.cc-title { position: absolute; left: 0; right: 0; top: calc(70px + var(--tg-top, 0px)); text-align: center; font-weight: 900; font-size: 18px; padding: 0 20px; text-shadow: 0 2px 8px rgba(0,0,0,.7); }
.cc-title .ic { width: 40px; height: 40px; display: block; margin: 0 auto 6px; }
.cc-hint { position: absolute; left: 0; right: 0; bottom: calc(150px + var(--safe-b)); text-align: center; font-size: 13px; color: rgba(255,255,255,.75); text-shadow: 0 1px 4px rgba(0,0,0,.8); }
.cc-cancel { position: absolute; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); min-width: 140px; background: rgba(20, 8, 8, .85); }
.cube { --lift: 0px; --depth: calc(var(--cube) * .32); position: absolute; width: var(--cube); height: var(--cube); margin: calc(var(--cube) / -2) 0 0 calc(var(--cube) / -2);
  transform: translateY(calc(var(--lift) * -1)); transition: transform .22s cubic-bezier(.2,.9,.3,1.3), --lift .2s; animation: cube-in .35s cubic-bezier(.2,.9,.3,1.3) backwards; animation-delay: var(--delay); }
@keyframes cube-in { from { opacity: 0; transform: translateY(30px) scale(.6); } }
.cube-top { position: absolute; inset: 0; border-radius: 16%; z-index: 2; display: grid; place-items: center;
  background: var(--c);
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 70%, #fff) 0%, var(--c) 45%, color-mix(in srgb, var(--c) 80%, #000) 100%);
  box-shadow: inset 0 2px 0 rgba(255,255,255,.55), inset 0 -3px 0 rgba(0,0,0,.18); }
.cube-top span { font-size: 11px; font-weight: 900; color: rgba(255,255,255,.92); text-shadow: 0 1px 2px rgba(0,0,0,.45); opacity: 0; transition: opacity .2s; }
/* the side of the cube: grows when the cube rises */
.cube-side { position: absolute; left: 0; right: 0; top: 50%; height: calc(50% + var(--depth) + var(--lift)); border-radius: 0 0 16% 16%; z-index: 1;
  background: var(--c);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 75%, #000), color-mix(in srgb, var(--c) 45%, #000)); transition: height .22s cubic-bezier(.2,.9,.3,1.3);
  box-shadow: 0 10px 18px rgba(0,0,0,.45); }
.cube.up { --lift: calc(var(--cube) * .3); z-index: 3; }
.cube.up .cube-top { box-shadow: inset 0 2px 0 rgba(255,255,255,.6), 0 0 26px color-mix(in srgb, var(--c) 80%, #fff); }
.cube.up .cube-top span { opacity: 1; }
.cube.chosen { --lift: calc(var(--cube) * .85); z-index: 4; }
.cube.chosen .cube-top { box-shadow: inset 0 2px 0 rgba(255,255,255,.7), 0 0 40px 8px color-mix(in srgb, var(--c) 85%, #fff); }
.cube.chosen .cube-top span { opacity: 1; }
#color-cubes.done .cube:not(.chosen) { opacity: .25; transform: translateY(8px) scale(.9); transition: opacity .25s, transform .25s; }
@supports not (color: color-mix(in srgb, red 50%, blue)) { .cube-side { filter: brightness(.6); } }

/* draw pile: thickness instead of a counter */
.deck-empty { position: absolute; inset: 0; border-radius: 9% / 6.2%; border: 2px dashed rgba(255, 236, 200, .35); background: rgba(0,0,0,.15); }
.deck .deck-peel { z-index: 5; animation: deck-peel .6s ease-in forwards; }
@keyframes deck-peel {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  100% { opacity: 0; transform: translate(-22px, -30px) rotate(-18deg) scale(.92); }
}
.deck-wrap .deck-count { display: none; }

/* ---------- turn timer: outside the frame, on top, with seconds ---------- */
.av-frame .timer-ring { inset: -9%; padding: 4px; border-radius: 27%; z-index: 3;
  background: conic-gradient(var(--tc, #3ee07a) calc(var(--p, 1) * 360deg), rgba(0, 0, 0, .45) 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
  filter: drop-shadow(0 0 5px var(--tc, #3ee07a)); }
.av-frame .timer-ring.hurry { animation: pulse .45s infinite alternate; }
.timer-sec { position: absolute; left: -12%; top: -12%; z-index: 4; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px;
  display: grid; place-items: center; font-size: 12px; font-weight: 900; font-variant-numeric: tabular-nums;
  background: var(--tc, #3ee07a); color: #102014; box-shadow: 0 2px 6px rgba(0,0,0,.5), 0 0 0 2px rgba(0,0,0,.35); }
.timer-sec:empty { display: none; }

.confirm-box { text-align: center; margin-bottom: 14px; }
.confirm-box h2 { margin: 4px 0 6px; }
.confirm-box p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.4; }

/* ---------- reactions without a seat: a light rain at the top ---------- */
.emote-rain { position: absolute; left: 0; right: 0; top: 0; height: 190px; z-index: 1; pointer-events: none; overflow: hidden; }
.emote-rain.top { position: fixed; top: var(--tg-top, 0px); z-index: 52; height: 170px; }
.emote-rain img { position: absolute; top: -40px; object-fit: contain; opacity: 0; animation: emo-rain 1.7s ease-in forwards; }
@keyframes emo-rain {
  0% { opacity: 0; transform: translateY(0) rotate(0); }
  20% { opacity: .5; }
  75% { opacity: .42; }
  100% { opacity: 0; transform: translateY(var(--fall)) rotate(var(--rot)); }
}
.sheet-results { position: relative; }
.res-emote { position: absolute; right: 12px; top: 12px; z-index: 2; }
.spect-actions { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 8px; }
.emote-btn.small { width: 36px; height: 36px; }
.emote-btn.small .gl { width: 20px; height: 20px; }
.rematch-invite { margin-bottom: 10px; padding: 10px; border-radius: 14px; background: rgba(255, 210, 120, .1); border: 1px solid rgba(255, 210, 120, .3); text-align: center; }
.rematch-invite p { margin: 0 0 8px; }

/* crowded table (5+ players): opponents' cards and plates take less room */
.arena.crowd .opp-cards .card { --cw: min(8vw, 32px); }
.arena.crowd .seat .av-frame { width: 54px; height: 54px; }
/* crowded table: the draw pile hides behind the left edge and only peeks out (drawing goes through «Взять») */
.arena.crowd .deck-wrap { left: calc(var(--cw) * -0.74); top: 0; transition: left .3s ease; }
.arena.crowd .deck-wrap:has(.deck.can) { left: calc(var(--cw) * -0.55); }

/* rule suggestions from lobby members */
.sugg-panel { border: 1px solid rgba(255, 210, 120, .35); }
.sugg-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,.08); }
.sugg-row:first-of-type { border-top: 0; }
.sugg-what { color: #ffd98a; font-weight: 700; }
.sugg-act { display: flex; gap: 6px; flex: none; }
.switch.suggested { box-shadow: 0 0 0 2px rgba(255, 210, 120, .7); }

/* ---------- replay player ---------- */
#screen-game.replay .rp-hand { pointer-events: none; }
#screen-game.replay #g-draw { pointer-events: none; }
#screen-game.replay .seat { cursor: pointer; }
#screen-game.replay .status { display: none; }
#g-rules.on { color: var(--accent); box-shadow: 0 0 0 2px rgba(255, 204, 0, .5); }
.rp-bar { display: flex; align-items: center; gap: 6px; }
.rp-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.4); color: #fff2cf; border: 1px solid rgba(255, 224, 138, .3); }
.rp-btn .gl { width: 18px; height: 18px; }
.rp-btn.main { width: 50px; height: 50px; background: linear-gradient(180deg, #ffd740, #ffb300); color: #3b1d00; border: 0; box-shadow: 0 3px 0 #b37400; }
.rp-btn.main .gl { width: 22px; height: 22px; }
.rp-btn.speed { font-weight: 900; font-size: 14px; width: 44px; border-radius: 14px; }
.rp-btn:active { transform: scale(.92); }
.me-bar.rp-only { justify-content: space-between; }
.rp-pov { display: flex; align-items: center; gap: 6px; font-weight: 700; color: #ffe6b0; }
.rp-line { padding: 4px 16px 6px; }
.rp-track { position: relative; height: 28px; }
.rp-track::before { content: ""; position: absolute; left: 0; right: 0; top: 12px; height: 5px; border-radius: 3px; background: rgba(0,0,0,.45); }
.rp-fill { position: absolute; left: 0; top: 12px; height: 5px; border-radius: 3px; background: var(--accent); pointer-events: none; }
.rp-mark { position: absolute; top: 9px; width: 4px; height: 11px; margin-left: -2px; border-radius: 2px; background: #fff; opacity: .85; pointer-events: none; }
.rp-mark.t-finish, .rp-mark.t-out { background: #6dff8a; }
.rp-mark.t-mercy, .rp-mark.t-caught, .rp-mark.t-leave { background: #ff5b4f; }
.rp-mark.t-flip { background: #b98cff; }
#rp-range { position: absolute; inset: 0; width: 100%; margin: 0; opacity: 0; cursor: pointer; }
.rp-events { max-height: 55vh; overflow-y: auto; margin: 10px 0; }
.rp-ev { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; align-items: center; width: 100%; text-align: left; padding: 9px 10px; border-radius: 10px; background: rgba(255,255,255,.05); margin-bottom: 6px; }
.rp-ev.cur { box-shadow: inset 0 0 0 2px var(--accent); }
.rp-ev-t { font-variant-numeric: tabular-nums; color: var(--muted); }
.replay-tile { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 10px 12px; margin-bottom: 8px; border-radius: 14px; background: rgba(255,255,255,.07); }
.rt-play { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; background: linear-gradient(180deg, #ffd740, #ffb300); color: #3b1d00; }
.rt-info { display: flex; flex-direction: column; min-width: 0; }
.rt-info span { font-size: 12px; color: var(--muted); }

/* ---------- premium card ---------- */
.premium { margin: 14px 0; padding: 14px; border-radius: 18px; background: linear-gradient(160deg, rgba(255, 196, 60, .16), rgba(120, 60, 255, .12)); border: 1px solid rgba(255, 210, 120, .35); }
.premium.on { border-color: rgba(255, 215, 90, .7); }
.pr-head { display: flex; align-items: center; gap: 8px; font-size: 16px; color: #ffd98a; }
.pr-head .gl { width: 20px; height: 20px; }
.pr-badge { margin-left: auto; font-size: 12px; padding: 2px 8px; border-radius: 10px; background: rgba(0,0,0,.35); color: #fff3d6; }
.pr-chat { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; border-top: 1px solid rgba(255,255,255,.08); }
.pr-tiers { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.pr-tiers .btn { flex-direction: column; gap: 2px; padding: 8px 4px; }
.pr-tiers i { font-style: normal; font-size: 11px; opacity: .85; }

/* ---------- admin panel ---------- */
.adm { display: flex; flex-direction: column; height: 100%; padding-top: var(--tg-top, 0px); }
.adm-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; }
.adm-top b { display: flex; align-items: center; gap: 6px; }
.adm-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 0 12px 8px; flex: none; }
.adm-tabs button { padding: 7px 12px; border-radius: 10px; background: rgba(255,255,255,.07); white-space: nowrap; font-weight: 600; font-size: 13px; }
.adm-tabs button.on { background: var(--accent); color: #2a1500; }
.adm-body { flex: 1; overflow-y: auto; padding: 4px 12px 24px; }
.adm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 12px; }
.adm-tile { padding: 8px 6px; border-radius: 12px; background: rgba(255,255,255,.06); text-align: center; }
.adm-tile b { display: block; font-size: 17px; }
.adm-tile span { font-size: 10px; color: var(--muted); }
.adm-card { padding: 12px; border-radius: 14px; background: rgba(255,255,255,.06); margin-bottom: 10px; }
.adm-card h4 { margin: 0 0 8px; }
.adm-card .row, .adm-search { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.adm-card .row .input { width: 80px; flex: none; padding: 8px; }
.adm-search .input { flex: 1; }
.adm-list { margin-top: 10px; }
.adm-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; padding: 10px; border-radius: 12px; background: rgba(255,255,255,.05); margin-bottom: 6px; }
.adm-row.blocked { opacity: .55; }
.adm-row i { color: var(--muted); font-style: normal; }
.adm-tags em, .adm-row em { font-style: normal; font-size: 11px; padding: 2px 7px; border-radius: 8px; margin-left: 4px; }
em.bad { background: rgba(255, 60, 60, .3); }
em.good { background: rgba(80, 220, 120, .25); }
.adm-acts { display: flex; gap: 6px; flex: none; }
@media (max-width: 380px) { .adm-grid { grid-template-columns: repeat(3, 1fr); } }
.replay-tile.locked .rt-play { background: rgba(255,255,255,.14); color: #ffe6b0; }
.replay-tile.locked { opacity: .8; }

/* ---------- duck coins & skin shop ---------- */
.duckcoin { width: 18px; height: 18px; vertical-align: -4px; }
.duckcoin.big { width: 30px; height: 30px; }
.wallet { display: flex; align-items: center; gap: 10px; width: 100%; margin: 12px 0; padding: 10px 14px; border-radius: 16px; text-align: left;
  background: linear-gradient(135deg, rgba(255, 200, 60, .22), rgba(255, 140, 40, .1)); border: 1px solid rgba(255, 210, 100, .4); }
.w-info { display: flex; flex-direction: column; line-height: 1.1; }
.w-info b { font-size: 20px; color: #ffe08a; }
.w-info span { font-size: 11px; color: var(--muted); }
.w-shop { margin-left: auto; display: flex; align-items: center; gap: 4px; font-weight: 700; color: #ffd98a; }
#screen-shop .scroll { padding-top: calc(12px + var(--tg-top, 0px)); }
.shop-top { display: flex; align-items: center; justify-content: space-between; }
.shop-bal { display: flex; align-items: center; gap: 6px; padding: 4px 12px 4px 6px; border-radius: 20px; background: rgba(0,0,0,.35); font-size: 18px; color: #ffe08a; }
.sale { margin-left: 6px; padding: 2px 8px; border-radius: 8px; background: #e53935; color: #fff; font-size: 11px; letter-spacing: 0; }
.skin-block { margin-bottom: 16px; padding: 12px; border-radius: 18px; background: rgba(255,255,255,.06); }
.sb-head { font-size: 17px; margin-bottom: 8px; }
.skin-preview { position: relative; height: 150px; border-radius: 14px; overflow: hidden; margin-bottom: 8px; }
.sp-board { position: absolute; inset: 0; background-size: cover; }
.skin-preview .sp-board.table-bg[data-skin-board][data-theme] { background-size: 100% 260%, cover; background-position: center 45%, var(--skin-center, center); }
.sp-frame { position: absolute; left: 12px; bottom: 10px; width: 64px; height: 64px; }
.sp-cards { position: absolute; right: 14px; bottom: 12px; display: flex; }
.sp-card { width: 50px; aspect-ratio: 116 / 168; margin-left: -16px; background-size: 100% 100%; border-radius: 5px; box-shadow: -2px 3px 8px rgba(0,0,0,.45); }
.sp-card:nth-child(1) { transform: rotate(-10deg); } .sp-card:nth-child(3) { transform: rotate(10deg) translateY(4px); }
.shop-item { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-top: 1px solid rgba(255,255,255,.07); }
.shop-item.set { background: rgba(255, 210, 100, .08); border-radius: 10px; border-top: 0; padding: 9px 8px; }
.shop-item.worn .si-name { color: #8ff0a4; }
.si-ic { width: 22px; display: grid; place-items: center; color: #ffd98a; }
.si-name { flex: 1; display: flex; flex-direction: column; font-weight: 600; }
.si-name i { font-style: normal; font-size: 11px; font-weight: 400; color: var(--muted); }
.si-off s { opacity: .7; } .si-off { color: #ff8a80 !important; }
.si-own { color: #8ff0a4 !important; }
.shop-item .buy { gap: 4px; }
.shop-item .buy[data-short] { opacity: .6; }
.packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pack { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 6px; border-radius: 14px; background: rgba(255,255,255,.07); }
.pack b { font-size: 18px; color: #ffe08a; }
.pack span { font-size: 12px; color: var(--muted); }
.sh-grid { display: grid; grid-template-columns: 1fr 70px 64px 40px; gap: 6px; align-items: center; }
.sh-grid .input { width: 100%; padding: 6px; }
.sh-pack .input { width: 90px !important; }
.adm-skins { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.replays-btn { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; margin: 12px 0; padding: 10px 14px; border-radius: 16px; background: rgba(255,255,255,.07); border: 1px solid rgba(255, 210, 120, .25); }
.replays-btn > .gl { margin-left: auto; color: #ffd98a; }
