/* Гоостоп — a hwatu table on a green wool blanket. */
:root {
  --felt: #1b2547;
  --cream: #f7f0dc;
  --red: #d7341e;
  --red-d: #a8230f;
  --gold: #f3b733;
  --ink: #1c1a16;
  --green: #2f7d3a;
  --blue: #2350a8;
  --glass: rgba(18, 24, 12, 0.72);
  --cw: 60px;
  --ch: 90px;
  --top-inset: 0px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
}
[hidden] { display: none !important; }
* { box-sizing: border-box; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
input, textarea, .selectable, .selectable * { -webkit-user-select: text; user-select: text; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: var(--felt-color, var(--felt)); color: var(--cream); }
button { font: inherit; color: inherit; cursor: pointer; }
img { -webkit-user-drag: none; }
#app { position: fixed; inset: 0; overflow: hidden; }
.boot { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; letter-spacing: .02em; color: rgba(247, 240, 220, .8); }

/* ---------- board ---------- */
.board { position: absolute; top: 0; bottom: 0; left: 0; width: 100%; touch-action: none; }
.felt { position: absolute; inset: 0; z-index: 0; background: var(--felt-color, #1b2547) var(--felt-img, url(assets/ui/bg-indigo.webp)) center / cover; transition: background-color .2s; }
.felt::after { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 45%, rgba(255, 255, 255, .06), rgba(0, 0, 0, .35) 80%); }
.cards { position: absolute; inset: 0; }

.card { position: absolute; left: 0; top: 0; width: var(--cw); height: var(--ch); transform-origin: 0 0; transition: transform .32s cubic-bezier(.2, .8, .25, 1); will-change: transform; perspective: 600px; }
.card.instant, .card.instant .flip { transition: none !important; }
.card .flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .38s ease; border-radius: 7%/4.7%; }
.card.down .flip { transform: rotateY(180deg); }
.card img { position: absolute; inset: 0; width: 100%; height: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 7%/4.7%; filter: drop-shadow(0 1.5px 1.5px rgba(0, 0, 0, .45)); }
.card img.back { transform: rotateY(180deg); }
.card.can img.face { filter: drop-shadow(0 0 0 transparent) drop-shadow(0 0 6px var(--gold)) drop-shadow(0 0 2px var(--gold)); }
.card.can::after, .card.opt::after, .card.hot::after { content: ''; position: absolute; inset: -3px; border-radius: 9%/6%; border: 3px solid var(--gold); pointer-events: none; }
.card.can::after { animation: glow 1.4s ease-in-out infinite; }
.card.hot::after { border-width: 2px; border-color: rgba(243, 183, 51, .75); }
.card.opt::after { border-color: #fff; box-shadow: 0 0 14px #fff; animation: glow .8s ease-in-out infinite; }
.card.dim { filter: brightness(.82); }
.card.shown { filter: drop-shadow(0 0 10px #fff); }
.card[data-zone='hand'] { cursor: pointer; }
@keyframes glow { 50% { opacity: .35; } }

.deckcount { position: absolute; left: 0; top: 0; z-index: 260; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: var(--ink); color: #fff; font: 800 12px/22px system-ui, sans-serif; text-align: center; pointer-events: none; }
.deckcount:empty { display: none; }

/* seats */
.hud, .labels { position: absolute; inset: 0; pointer-events: none; }
.labels { z-index: 820; }
.hud { z-index: 850; }


/* my bar tools */
.bar { position: absolute; left: 0; right: 0; top: 0; z-index: 860; pointer-events: none; }
.tools { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: flex; gap: 8px; pointer-events: auto; }
.tool { width: 40px; height: 40px; padding: 0; border: 0; background: none; border-radius: 50%; }
.tool img { width: 100%; height: 100%; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .4)); }
.tool:active { transform: scale(.92); }
.tool.mic.live img { filter: drop-shadow(0 0 8px #ff6b5a); }
.tool .count { position: absolute; margin: -6px 0 0 -10px; font-size: 10px; font-weight: 900; background: var(--gold); color: var(--ink); border-radius: 8px; padding: 0 4px; }

.dummies { position: absolute; inset: 0; pointer-events: none; z-index: 450; }
.dummy { position: absolute; left: 0; top: 0; padding: 0; border: 0; background: none; pointer-events: auto; border-radius: 8%; }
.dummy img { width: 100%; height: 100%; border-radius: 7%/4.7%; opacity: .55; }
.dummy span { position: absolute; inset: auto 0 38% 0; font-size: 12px; font-weight: 900; color: #fff; text-shadow: 0 1px 2px #000; }
.dummy.can img { opacity: 1; }
.dummy.can { box-shadow: 0 0 0 3px var(--gold); animation: glow 1.4s ease-in-out infinite; }

/* ---------- overlays ---------- */
.prompt { position: absolute; inset: 0; z-index: 1200; display: flex; align-items: flex-end; background: rgba(0, 0, 0, .25); animation: fade .15s; }
.prompt .sheet { width: 100%; padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px)); border-radius: 22px 22px 0 0; background: var(--cream); color: var(--ink); box-shadow: 0 -10px 30px rgba(0, 0, 0, .35); animation: up .2s ease-out; }
.prompt h2, .card-modal h2 { margin: 0 0 6px; font-size: 21px; font-weight: 900; }
.prompt p { margin: 0 0 14px; font-size: 15px; line-height: 1.4; color: #3c372e; }
.pcards { display: flex; justify-content: center; gap: 18px; }
.pcards:empty { display: none; }
.pcard { width: 110px; aspect-ratio: 2 / 3; padding: 0; border: 3px solid transparent; border-radius: 10px; background: none; }
.pcard img { width: 100%; height: 100%; border-radius: 8px; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); }
.pcard:focus-visible, .pcard:active { border-color: var(--gold); }
.btns { display: grid; gap: 10px; margin-top: 4px; }
.btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; width: 100%; min-height: 50px; padding: 10px 16px; border: 2px solid rgba(28, 26, 22, .18); border-radius: 14px; background: #fff; color: var(--ink); font-weight: 800; font-size: 16px; }
.btn small { font-weight: 600; font-size: 12px; opacity: .75; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: rgba(247, 240, 220, .35); color: var(--cream); }
.btn.big { min-height: 54px; font-size: 17px; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; }
.btn img { width: 28px; height: 28px; }

.modal { position: absolute; inset: 0; z-index: 1250; display: grid; place-items: center; padding: 18px; background: rgba(0, 0, 0, .5); animation: fade .15s; }
.card-modal { width: min(380px, 100%); padding: 20px 18px 16px; border-radius: 22px; background: var(--cream); color: var(--ink); text-align: center; box-shadow: 0 20px 50px rgba(0, 0, 0, .5); animation: pop .22s ease-out; }
.card-modal p { margin: 0 0 14px; font-size: 15px; line-height: 1.4; color: #3c372e; }
.card-modal .risk { margin: 12px 0 0; font-size: 12.5px; color: #6b5f4c; }
.gs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gs button { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 92px; border: 0; border-radius: 18px; color: #fff; box-shadow: 0 5px 0 rgba(0, 0, 0, .25); }
.gs button b { font-size: 30px; font-weight: 900; letter-spacing: .02em; }
.gs button small { font-size: 13px; font-weight: 700; opacity: .92; }
.go-btn { background: linear-gradient(#3aa14a, #23772f); }
.stop-btn { background: linear-gradient(#e8462c, #b52512); }
.gs button:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, .25); }

.stamp { position: absolute; left: 50%; top: 42%; z-index: 1100; transform: translate(-50%, -50%) rotate(-6deg); display: flex; flex-direction: column; align-items: center; max-width: 86%; pointer-events: none; animation: stamp .28s cubic-bezier(.2, 1.6, .4, 1); }
.stamp b { padding: 2px 18px; border: 4px solid currentColor; border-radius: 12px; font-size: 44px; font-weight: 900; line-height: 1.1; letter-spacing: .03em; background: rgba(255, 250, 238, .94); box-shadow: 0 8px 22px rgba(0, 0, 0, .45); }
.stamp small { margin-top: 8px; padding: 5px 12px; border-radius: 10px; background: var(--glass); color: #fff; font-size: 13.5px; font-weight: 700; text-align: center; line-height: 1.3; transform: rotate(6deg); }
.stamp.red { color: var(--red); }
.stamp.gold { color: #c27c00; }
.stamp.green { color: var(--green); }
.stamp.out { animation: fade .22s reverse forwards; }
@keyframes stamp { from { transform: translate(-50%, -50%) rotate(-6deg) scale(2.2); opacity: 0; } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.out { animation: fade .18s reverse forwards !important; }

.toast { position: absolute; left: 50%; bottom: 36%; z-index: 1300; max-width: 88%; transform: translate(-50%, 10px); padding: 10px 16px; border-radius: 14px; background: var(--glass); color: #fff; font-size: 14.5px; font-weight: 700; text-align: center; line-height: 1.35; opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* full sheets: rules, menu, result, hall */
.full { position: absolute; inset: 0; z-index: 1400; display: flex; justify-content: center; background: rgba(10, 14, 6, .6); animation: fade .15s; }
.full-in { display: flex; flex-direction: column; width: 100%; max-width: 520px; height: 100%; padding-top: var(--top-inset); background: var(--cream); color: var(--ink); }
.full header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 6px 18px; }
.full header h2 { margin: 0; font-size: 20px; font-weight: 900; }
.x { width: 40px; height: 40px; padding: 0; border: 0; background: none; }
.x img { width: 100%; height: 100%; }
.full-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 6px 18px 18px; touch-action: pan-y; }
.full footer { display: grid; gap: 8px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid rgba(0, 0, 0, .08); }
.full footer .btn.ghost { color: var(--ink); border-color: rgba(28, 26, 22, .2); }

.rules section { margin: 0 0 18px; }
.rules h3 { margin: 0 0 6px; font-size: 16px; color: var(--red-d); }
.rules p, .rules dd { margin: 0; font-size: 14.5px; line-height: 1.5; -webkit-user-select: text; user-select: text; }
.rules dl { margin: 0; }
.rules dt { margin-top: 8px; font-weight: 800; font-size: 14.5px; }
.mrow { margin: 10px 0; }
.mrow h4 { margin: 0 0 4px; font-size: 13.5px; }
.mcards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mcards figure { margin: 0; text-align: center; }
.mcards img { width: 100%; aspect-ratio: 2 / 3; border-radius: 6px; box-shadow: 0 2px 4px rgba(0, 0, 0, .25); }
.mcards figcaption { font-size: 10.5px; font-weight: 700; line-height: 1.2; color: #5a5040; }

.menu .full-in { max-width: 420px; height: auto; margin-top: auto; border-radius: 22px 22px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
.menu .full-body { display: grid; gap: 12px; padding-bottom: 22px; }
.menu .btn { flex-direction: row; gap: 10px; }
.menu .btn.ghost { color: var(--red-d); border-color: rgba(168, 35, 15, .35); }
.mrow2 { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px; font-weight: 800; }
.segs { display: flex; gap: 6px; }
.seg { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 14px; border: 2px solid rgba(28, 26, 22, .15); border-radius: 12px; background: #fff; font-weight: 800; }
.seg[aria-pressed='true'] { border-color: var(--red); color: var(--red-d); }
.seg img { width: 26px; height: 26px; }

.boards .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.boards .tabs button { min-height: 40px; border: 2px solid rgba(28, 26, 22, .12); border-radius: 12px; background: #fff; font-weight: 800; }
.boards .tabs button[aria-selected='true'] { border-color: var(--red); color: var(--red-d); }
.rows, .totals ol { list-style: none; margin: 0; padding: 0; }
.rows li, .totals li { display: block; }
.rows li > *:not(button), .rows .row-btn, .totals li { display: flex; align-items: center; gap: 10px; }
.rows li { padding: 2px 0; }
.rows li.me, .totals li.me { background: #fff3cf; border-radius: 10px; }
.rows .row-btn { width: 100%; min-height: 44px; padding: 4px 6px; border: 0; background: none; text-align: left; }
.rows li.me { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 6px; }
.rows li.muted { color: #6b5f4c; font-weight: 600; padding: 10px 6px; }
.rk { width: 22px; font-weight: 900; text-align: center; color: #6b5f4c; }
.rows img, .totals img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #ccc; }
.nm { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows b, .totals b { font-weight: 900; }
.totals { margin: 4px 0 12px; }
.totals h3 { margin: 0 0 6px; font-size: 15px; }
.totals li { min-height: 44px; padding: 4px 6px; }

@media (prefers-reduced-motion: reduce) {
  .card, .card .flip, .seat, .pill { transition: none !important; }
  .card.can::after, .seat.turn .ring, .dummy.can, .card.opt::after { animation: none !important; }
  .stamp { animation: none; }
}


/* waiting hall */
.hall { position: absolute; inset: 0; z-index: 1300; display: flex; justify-content: center; align-items: flex-start; padding: calc(var(--top-inset) + 12px) 14px 14px; background: rgba(12, 18, 8, .55); overflow-y: auto; }
.hall-in { width: 100%; max-width: 440px; padding: 18px 16px 14px; border-radius: 22px; background: var(--cream); color: var(--ink); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); animation: pop .2s ease-out; }
.hall h2 { margin: 0; font-size: 22px; font-weight: 900; }
.hall .hint { margin: 4px 0 12px; font-size: 14px; color: #5a5040; }
.hrows { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.hrow { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 6px 10px; border-radius: 14px; background: #fff; }
.hrow.me { box-shadow: inset 0 0 0 2px var(--gold); }
.hrow img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.hrow .tag { font-style: normal; font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 6px; background: #efe5cc; color: #6b5f4c; }
.hrow .rd { font-size: 13px; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: #efe5cc; color: #6b5f4c; }
.hrow .rd.on { background: var(--green); color: #fff; }
.hrow.empty { background: transparent; border: 2px dashed rgba(28, 26, 22, .18); }
.hrow .slot { width: 40px; height: 40px; border-radius: 50%; background: rgba(28, 26, 22, .08); }
.mini { display: flex; align-items: center; gap: 6px; min-width: 40px; min-height: 40px; padding: 4px; border: 0; border-radius: 12px; background: #efe5cc; font-weight: 800; font-size: 13px; }
.mini img { width: 26px; height: 26px; }
.mini.wide { padding: 4px 10px 4px 6px; }
.hall .invite { flex-direction: row; gap: 8px; color: var(--ink); border-color: rgba(28, 26, 22, .2); margin-bottom: 12px; }
.hfoot { display: grid; gap: 8px; }
.hfoot .wait { margin: 0; text-align: center; font-weight: 700; color: #5a5040; }
.hfoot .start.go { background: var(--green); border-color: var(--green); }
.hfoot .solo { justify-self: center; }
.chat-sheet .phrases { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-sheet .own { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 6px; }
.chat-sheet input { min-height: 48px; padding: 0 12px; border: 2px solid rgba(28, 26, 22, .18); border-radius: 12px; font: inherit; font-size: 16px; }
.chat-sheet .btn { width: auto; }


.pcard { position: relative; }
.pcard .cap { position: absolute; left: 0; right: 0; bottom: -22px; font-size: 13px; font-weight: 800; color: var(--ink); text-align: center; }
.pcards.picks { margin-bottom: 8px; }
.pcards.show { gap: 8px; margin: 0 0 14px; }
.pshow { margin: 0; width: 58px; }
.pshow img { width: 100%; aspect-ratio: 2 / 3; border-radius: 6px; box-shadow: 0 3px 8px rgba(0, 0, 0, .3); display: block; }
.card:focus-visible { outline: 3px solid #fff; outline-offset: 2px; border-radius: 8px; }


/* ---- clean pass: seats, counts, month numbers ---- */
.card .mo { display: none; position: absolute; top: 3%; left: 4%; min-width: 24%; padding: 1px 3px; border-radius: 999px; background: rgba(28, 26, 22, .78); color: #fff; font: 800 calc(var(--cw) * .17)/1.1 system-ui, sans-serif; text-align: center; pointer-events: none; }
.card[data-zone='hand']:not(.down) .mo { display: block; }
.seat { position: absolute; left: 0; top: 0; display: flex; align-items: center; gap: 8px; height: 44px; transition: transform .3s; }
.seat .av { position: relative; flex: 0 0 auto; width: 40px; height: 40px; }
.seat .av img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255, 255, 255, .85); background: #556; }
.seat .ring { position: absolute; inset: -4px; border-radius: 50%; border: 3px solid transparent; transition: border-color .2s; }
.seat.turn .ring { border-color: var(--gold); box-shadow: 0 0 12px var(--gold); animation: glow 1.2s ease-in-out infinite; }
.seat.talking .av img { border-color: #6fe08a; box-shadow: 0 0 0 3px rgba(111, 224, 138, .5); }
.seat.away { opacity: .5; }
.seat .nm { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 96px; text-shadow: 0 1px 2px rgba(0, 0, 0, .6); }
.seat .pts { min-width: 30px; padding: 1px 10px; border-radius: 999px; background: rgba(0, 0, 0, .45); color: #fff; font: 900 18px/1.4 system-ui, sans-serif; text-align: center; transition: background .2s; }
.seat .pts.hot { background: var(--gold); color: var(--ink); }
.seat .chips { display: flex; gap: 4px; }
.seat .chips em { font-style: normal; font-size: 11px; font-weight: 900; padding: 2px 6px; border-radius: 7px; background: var(--red); color: #fff; }
.seat .chips em.go { background: var(--green); }
.bubble { position: absolute; left: 30px; top: 46px; max-width: 220px; padding: 6px 10px; border-radius: 12px; background: #fff; color: var(--ink); font-size: 13px; font-weight: 600; box-shadow: 0 4px 10px rgba(0, 0, 0, .3); z-index: 5; white-space: normal; animation: pop .2s ease-out; }
.seat.mine .bubble { top: auto; bottom: 48px; }
.seat .tm { position: absolute; right: -6px; bottom: -4px; min-width: 20px; height: 20px; padding: 0 4px; border-radius: 10px; background: var(--red); color: #fff; font: 900 12px/20px system-ui, sans-serif; text-align: center; animation: pop .2s; }
.gcount { position: absolute; left: 0; top: 0; z-index: 2; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: rgba(15, 15, 12, .72); color: #fff; font: 800 11px/18px system-ui, sans-serif; text-align: center; pointer-events: none; }
.gcount.done { background: var(--gold); color: var(--ink); }

/* ---- result ---- */
.result .rhead { position: relative; padding: 22px 16px 16px; text-align: center; }
.result .rhead.win { background: linear-gradient(#ffe7a3, var(--cream)); }
.result .rhead.lose { background: linear-gradient(#e9dccb, var(--cream)); }
.result .rhead h2 { margin: 8px 0 0; font-size: 22px; font-weight: 900; }
.result .rav { width: 64px; height: 64px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 4px 12px rgba(0, 0, 0, .25); }
.result .crown { position: absolute; left: 50%; top: 4px; width: 42px; transform: translateX(-50%) rotate(-8deg); }
.result .delta { font-size: 42px; font-weight: 900; line-height: 1.1; color: var(--red-d); }
.result .win .delta { color: var(--green); }
.result .draw .delta { font-size: 20px; color: #5a5040; }
.rsub { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 6px; font-size: 14px; font-weight: 700; color: #5a5040; }
.rsub .life b { color: var(--ink); font-weight: 900; }
.rsub .ladder { display: inline-flex; align-items: center; gap: 6px; }
.rsub .ladder img { width: 26px; height: 26px; border-radius: 50%; }
.pips { color: var(--red); letter-spacing: 2px; }
.result .save { display: block; margin-top: 6px; font-style: normal; font-size: 13px; font-weight: 700; color: var(--red-d); }
.bd { list-style: none; margin: 0 0 12px; padding: 0; }
.bd li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 2px; border-bottom: 1px solid rgba(28, 26, 22, .08); font-size: 15px; font-weight: 600; }
.bd li b { font-weight: 900; }
.bd li.mult b { color: var(--red-d); }
.bd .cnt { font-style: normal; font-size: 12.5px; color: #8a7d66; }
.bd.pays li em { font-style: normal; font-size: 12px; color: var(--red-d); font-weight: 800; }
.bd.pays li.me { color: var(--red-d); }
.link { padding: 0; border: 0; background: none; color: var(--blue); font-weight: 800; min-height: 40px; }
.full footer .link.sec { color: #6b5f4c; justify-self: center; }
.hostmark { width: 18px; height: 18px; vertical-align: -3px; }
.seat.tight .nm { max-width: 58px; font-size: 13px; }
.seat.tight { gap: 6px; }
.swatches { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.swatch { width: 44px; height: 44px; padding: 0; border: 3px solid rgba(28, 26, 22, .12); border-radius: 12px; background-size: cover; background-position: center; }
.swatch[aria-pressed='true'] { border-color: var(--red); box-shadow: 0 0 0 2px #fff inset; }
