/* BLUFF TAVERN — a warm room, an oak table, leather cups, bone dice. */

:root {
  --ink: #f6ead2;
  --muted: #c9b48f;
  --gold: #f2c766;
  --gold-2: #b8862f;
  --red: #e2483d;
  --oak: #5b3418;
  --oak-dark: #2b170a;
  --felt: #4a1416;
  --panel: rgba(32, 18, 9, 0.88);
  --line: rgba(242, 199, 102, 0.28);
  --serif: Georgia, "Palatino Linotype", "Book Antiqua", Palatino, serif;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: #1a0f08;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* web/style.css pins .volume-slider position:fixed top:12px on pages that load
   it; this page does not, but the shared strip must never land in a corner. */
.volume-slider { position: static !important; top: auto !important; }

button { font-family: inherit; color: inherit; }
button:disabled { cursor: default; }
.muted { color: var(--muted); }

/* ── the room ────────────────────────────────────────────────────────── */
#room {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(0,0,0,.0) 30%, rgba(0,0,0,.65) 80%),
    repeating-linear-gradient(90deg, rgba(0,0,0,.22) 0 2px, transparent 2px 118px),
    repeating-linear-gradient(90deg, #3a2210 0 58px, #42260f 58px 119px, #361e0d 119px 180px),
    #2f1b0c;
}
#room::after {           /* wainscot rail */
  content: ""; position: absolute; left: 0; right: 0; top: 62%; height: 14px;
  background: linear-gradient(#6b4220, #2a160a);
  box-shadow: 0 6px 18px rgba(0,0,0,.5);
  opacity: .55;
}
.lamp {
  position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,190,100,.32), rgba(255,150,60,.08) 40%, transparent 65%);
  animation: flicker 5s ease-in-out infinite;
}
.lamp-a { left: -25vmax; top: -30vmax; }
.lamp-b { right: -28vmax; top: -24vmax; animation-delay: -2.3s; }
@keyframes flicker {
  0%, 100% { opacity: .95; } 42% { opacity: .82; } 47% { opacity: 1; } 70% { opacity: .88; }
}

/* ── dice ────────────────────────────────────────────────────────────── */
.die {
  --s: 30px;
  display: inline-grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  width: var(--s); height: var(--s); padding: calc(var(--s) * .13);
  border-radius: calc(var(--s) * .2);
  background: radial-gradient(circle at 30% 25%, #fffdf6, #f2e6cc 55%, #d9c6a0);
  box-shadow: inset 0 -2px 0 rgba(120, 90, 50, .35), inset 0 1px 0 #fff,
              0 2px 3px rgba(0,0,0,.45);
  vertical-align: middle; flex: none;
  transition: transform .2s, opacity .25s, filter .25s, box-shadow .25s;
}
.die i { display: block; margin: 9%; border-radius: 50%; }
.die i.on {
  background: radial-gradient(circle at 35% 30%, #4a3424, #140b05);
  box-shadow: inset 0 1px 1px rgba(0,0,0,.6);
}
.die[data-v="1"] i.on { background: radial-gradient(circle at 35% 30%, #e0584c, #7d1510); margin: 0; }
.die.wild-one i.on {
  background: radial-gradient(circle at 35% 30%, #ffde6e, #c7362b 70%);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  border-radius: 0;
}
/* store cosmetic `bluff_dice` (payloads in js/dice.js): the owner's dice and
   cup. Pips keep a hard contrast against every face; the wild-one star
   stays a star. No class = the house die above. */
.die.skin-ebony {
  background:
    repeating-linear-gradient(100deg, rgba(255,210,150,.05) 0 2px, transparent 2px 5px),
    radial-gradient(circle at 30% 25%, #6b4428, #3a2010 55%, #1c0e05);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.5), inset 0 1px 0 rgba(255,220,170,.35),
              0 0 0 1px #c9a56a, 0 2px 3px rgba(0,0,0,.5);
}
.die.skin-ebony i.on { background: radial-gradient(circle at 35% 30%, #fffaf0, #e6d3ab); box-shadow: 0 0 1px rgba(0,0,0,.6); }
.die.skin-ebony[data-v="1"] i.on { background: radial-gradient(circle at 35% 30%, #ff8a7a, #d4342a); }
.die.skin-ruby {
  background:
    linear-gradient(135deg, rgba(255,255,255,.5) 0 12%, transparent 30% 70%, rgba(255,120,140,.25) 85%),
    radial-gradient(circle at 32% 28%, #ff7d8c, #c4142e 50%, #5e0313);
  box-shadow: inset 0 -2px 0 rgba(60,0,10,.6), inset 0 1px 0 rgba(255,210,220,.8),
              0 0 6px rgba(230,30,60,.45), 0 2px 3px rgba(0,0,0,.5);
}
.die.skin-ruby i.on { background: radial-gradient(circle at 35% 30%, #ffffff, #f3dfe2); box-shadow: 0 0 2px rgba(60,0,10,.8); }
.die.skin-ruby[data-v="1"] i.on { background: radial-gradient(circle at 35% 30%, #fff6c8, #f2c14a); }
.die.skin-gilded {
  background:
    linear-gradient(150deg, rgba(255,255,255,.55) 0 10%, transparent 28%),
    radial-gradient(circle at 30% 25%, #fff4b8, #e8b84c 50%, #9a6414);
  box-shadow: inset 0 -2px 0 rgba(110,60,0,.55), inset 0 1px 0 #fffbe0,
              0 0 0 1px #7a4c0c, 0 0 7px rgba(255,200,80,.5), 0 2px 3px rgba(0,0,0,.45);
}
.die.skin-gilded i.on { background: radial-gradient(circle at 35% 30%, #4a2e08, #1a0e02); box-shadow: inset 0 1px 1px rgba(0,0,0,.7), 0 1px 0 rgba(255,250,210,.7); }
.die.skin-gilded[data-v="1"] i.on { background: radial-gradient(circle at 35% 30%, #d93a2c, #6a0c06); }
.die.skin-ebony.wild-one i.on, .die.skin-gilded.wild-one i.on {
  background: radial-gradient(circle at 35% 30%, #ffde6e, #c7362b 70%);
}
.die.skin-ruby.wild-one i.on { background: radial-gradient(circle at 35% 30%, #ffffff, #ffd75e 70%); }
.cup.skin-ebony .cup-svg { filter: brightness(.5) saturate(.45) contrast(1.25); }
.cup.skin-ruby .cup-svg { filter: hue-rotate(-28deg) saturate(2) brightness(1.05); }
.cup.skin-gilded .cup-svg { filter: sepia(1) saturate(2.6) brightness(1.3) hue-rotate(-8deg); }
.die.xs { --s: 17px; }
.die.sm { --s: 22px; }
.die.md { --s: 40px; }
.die.lg { --s: 58px; }
.die.tumble { animation: tumble .15s linear infinite; }
.die.land { animation: land .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes tumble { 0% { transform: rotate(0) translateY(0); } 50% { transform: rotate(18deg) translateY(-4px); } 100% { transform: rotate(-8deg) translateY(0); } }
@keyframes land { 0% { transform: translateY(-14px) rotate(-20deg); } 60% { transform: translateY(2px) rotate(4deg); } 100% { transform: none; } }

/* ── panels and buttons ──────────────────────────────────────────────── */
.primary, .ghost, .liar-btn {
  border-radius: 12px; font-weight: 700; cursor: pointer; font-size: 16px;
  padding: 12px 18px; border: 1px solid transparent; transition: transform .1s, filter .15s, box-shadow .2s;
}
.primary {
  background: linear-gradient(#f7d27a, #c9902f); color: #2a1606;
  border-color: #fbe3a4; box-shadow: 0 3px 0 #7a5212, 0 6px 16px rgba(0,0,0,.35);
}
.primary:hover:not(:disabled) { filter: brightness(1.07); }
.primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #7a5212; }
.primary:disabled { filter: grayscale(.8) brightness(.6); box-shadow: none; }
.ghost {
  background: rgba(255, 230, 180, .06); color: var(--ink); border-color: var(--line);
}
.ghost:hover { background: rgba(255, 230, 180, .13); }
.ghost.small { padding: 6px 10px; font-size: 13px; }
.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 10px; flex: none;
  background: rgba(255, 230, 180, .07); border: 1px solid var(--line); cursor: pointer; font-size: 17px;
}
.icon-btn .dot {
  position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 0 2px #2b170a;
}
.panel-label {
  font: 700 11px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold); opacity: .85; margin: 0 0 8px;
}

/* ── the lobby card ──────────────────────────────────────────────────── */
#lobbyOverlay {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center;
  justify-content: center; padding: 16px; overflow-y: auto;
  background: radial-gradient(ellipse at center, rgba(20,10,4,.25), rgba(10,5,2,.7));
}
.card {
  position: relative; width: 100%; max-width: 440px; margin: auto;
  padding: 26px 24px 18px; border-radius: 20px; text-align: center;
  background:
    linear-gradient(rgba(255,240,210,.05), rgba(0,0,0,.15)),
    repeating-linear-gradient(0deg, rgba(0,0,0,.08) 0 1px, transparent 1px 7px),
    linear-gradient(160deg, #4a2a12, #2c180a);
  border: 1px solid rgba(242,199,102,.45);
  box-shadow: 0 0 0 5px rgba(40,22,8,.9), 0 0 0 6px rgba(242,199,102,.3),
              0 26px 60px rgba(0,0,0,.6);
}
.card.wide { max-width: 860px; text-align: left; }
.card input[type="text"] {
  width: 100%; margin: 14px 0 10px; padding: 13px 14px; font-size: 17px;
  border-radius: 12px; border: 1px solid var(--line); color: var(--ink);
  background: rgba(0,0,0,.35); outline: none;
}
.card input[type="text"]:focus { border-color: var(--gold); }
#joinPane .primary, #joinPane .ghost { width: 100%; margin-top: 8px; }
.back-link { display: block; margin-top: 14px; color: var(--muted); font-size: 14px; text-align: center; text-decoration: none; }
.back-link:hover { color: var(--gold); }
.lobby-audio { margin: 14px auto 0; display: flex; justify-content: center; }

.sign {
  font: 700 44px/1.02 var(--serif); letter-spacing: .02em;
  background: linear-gradient(#ffeaa8, #e5a83a 55%, #9c6a1c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #2a1606) drop-shadow(0 6px 14px rgba(0,0,0,.6));
}
.sign .sign-small { display: block; font-size: .36em; letter-spacing: .5em; margin-bottom: 2px; }
.sign.small { font-size: 30px; }
.tagline { color: var(--muted); line-height: 1.5; margin: 10px 4px 2px; }
.join-dice { display: flex; justify-content: center; gap: 10px; margin: 16px 0 6px; }
.join-dice .die { animation: bob 2.8s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-7px) rotate(5deg); } }

.hub-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hub-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lobby-note {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 14px;
  background: rgba(242,199,102,.1); border: 1px solid var(--line);
}
.lobby-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 16px; }
.player-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.player-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px;
  background: rgba(0,0,0,.25); border: 1px solid rgba(242,199,102,.12);
}
.player-row.me { border-color: rgba(242,199,102,.5); }
.player-row.bot { opacity: .75; }
.player-row .nm { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.player-row .tags { color: var(--muted); font-size: 13px; white-space: nowrap; }
.avatar {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; flex: none; font-weight: 800; color: #2a1606;
}
.bot-av { background: #6b5a45; font-size: 15px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 12px; }
.setting > span { color: var(--muted); font-size: 14px; }
.seg { display: inline-flex; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.seg button { background: transparent; border: 0; padding: 8px 11px; cursor: pointer; font-size: 14px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: linear-gradient(#f7d27a, #c9902f); color: #2a1606; font-weight: 700; }
.seg button:disabled:not(.on) { opacity: .55; }
.stepper { display: inline-flex; align-items: center; gap: 4px; }
.stepper button, .step {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer;
  background: rgba(255,230,180,.08); font-size: 20px; line-height: 1;
}
.stepper b { min-width: 28px; text-align: center; font-size: 18px; }
.rules-blurb { font-size: 13px; line-height: 1.45; margin: 4px 0 14px; }
#startBtn { width: 100%; font-size: 18px; }
#waitHost { text-align: center; }

#countPane { text-align: center; padding: 20px 0; }
.count-info { font: 600 15px var(--serif); color: var(--muted); letter-spacing: .1em; text-transform: uppercase; }
.countdown { font: 700 96px/1.1 var(--serif); color: var(--gold); text-shadow: 0 4px 0 #2a1606; }
.countdown.tick { animation: tickIn .6s ease-out; }
@keyframes tickIn { from { transform: scale(1.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

#resultsPane { text-align: center; }
.result-sign { margin-bottom: 4px; }
.result-winner { margin: 10px 0 2px; font: 700 26px var(--serif); }
.result-winner .crown { font-size: 46px; animation: bob 2.4s ease-in-out infinite; }
.result-winner .win-tail { font: 400 15px var(--sans); color: var(--muted); margin-top: 4px; }
.end-line { color: var(--muted); margin-bottom: 10px; font-size: 14px; }
.end-credits { color: var(--gold); font-weight: 700; margin: 8px 0; }
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
#resultTable, #resultAwards { text-align: left; }
#resultTable { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#errorPane { text-align: center; }
#errorPane .primary { width: 100%; }

/* ── the play screen ─────────────────────────────────────────────────── */
#playScreen {
  position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
#playTop {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; flex: none;
  background: linear-gradient(rgba(20,10,4,.85), rgba(20,10,4,.4));
  border-bottom: 1px solid rgba(242,199,102,.15);
}
.round-info { flex: 1; min-width: 0; }
.round-label { font: 700 18px var(--serif); color: var(--gold); }
.dice-label { font-size: 12px; color: var(--muted); }
.wild-badge {
  align-items: center; gap: 4px; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: rgba(226,72,61,.18); border: 1px solid rgba(226,72,61,.55); color: #ffb3a8; white-space: nowrap;
}
.pop {
  position: absolute; right: 12px; top: 58px; z-index: 30; padding: 12px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); box-shadow: 0 14px 40px rgba(0,0,0,.6);
}
.chat-pop { width: min(360px, calc(100vw - 24px)); }
.chat-note { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.chat-note:empty { display: none; }

#tableMain { flex: 1; display: flex; min-height: 0; }
#tableWrap { position: relative; flex: 1; min-width: 0; }
#table {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(92%, 980px); height: 84%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 35%, rgba(255,210,150,.25), transparent 60%),
    repeating-linear-gradient(100deg, rgba(0,0,0,.1) 0 3px, transparent 3px 22px),
    linear-gradient(180deg, #7a4520, #4e2a12);
  box-shadow: 0 0 0 3px #2a1406, 0 0 0 7px #8f5e28, 0 0 0 9px #2a1406,
              0 30px 60px rgba(0,0,0,.7), inset 0 -10px 30px rgba(0,0,0,.45);
}
.felt {
  position: absolute; inset: 9% 10%; border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255,140,110,.16), transparent 65%),
    radial-gradient(circle at 20% 70%, rgba(0,0,0,.18), transparent 40%),
    var(--felt);
  box-shadow: inset 0 6px 24px rgba(0,0,0,.7), 0 1px 0 rgba(255,220,160,.25);
}
.felt::after {
  content: ""; position: absolute; inset: 6%; border-radius: 50%;
  border: 1px dashed rgba(242,199,102,.25);
}
.center {
  /* anchored from the top so the bid sits at the middle and anything added
     below it (the tally, the verdict) grows DOWN, never into the top seat */
  position: absolute; left: 50%; top: calc(50% - 52px); transform: translateX(-50%);
  transition: opacity .2s; z-index: 5;
  text-align: center; pointer-events: none; min-width: 180px;
}
.center.hushed { opacity: 0; }
.bid-label { font: 700 11px var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--gold); opacity: .85; }
.bid-show { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 66px; margin: 4px 0; }
.bid-show.popin { animation: bidPop .45s cubic-bezier(.3, 1.7, .5, 1); }
@keyframes bidPop { from { transform: scale(1.5); opacity: .2; } to { transform: scale(1); opacity: 1; } }
.bid-q { font: 700 56px/1 var(--serif); color: #fff3d6; text-shadow: 0 3px 0 rgba(0,0,0,.5); }
.bid-x { font-size: 28px; color: var(--muted); }
.bid-by { font-size: 14px; color: var(--muted); min-height: 18px; }
.bid-by .nm { font-weight: 700; }
.count-show {
  margin-top: 2px; font: 700 22px var(--serif); color: #ffd9a0;
  padding: 3px 14px; border-radius: 999px; background: rgba(0,0,0,.35); display: inline-block;
}
.count-show.enough { color: #9ff08a; }
.count-show.short { color: #ff8f84; }

/* the seats */
#seats { position: absolute; inset: 0; }
.seat {
  position: absolute; transform: translate(-50%, -50%); z-index: 3;
  display: flex; flex-direction: column; align-items: center; gap: 2px; width: 150px;
  transition: opacity .4s, filter .4s;
}
.seat.top-half { flex-direction: column-reverse; }
.seat-plate {
  display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; max-width: 150px;
  border-radius: 999px; background: rgba(20,10,4,.82); border: 1px solid rgba(242,199,102,.25);
  box-shadow: 0 4px 10px rgba(0,0,0,.45); transition: border-color .3s, box-shadow .3s;
}
.seat .avatar { width: 34px; height: 34px; background: var(--seat, #ffcf6b); font-size: 15px; }
.seat .avatar b { position: relative; z-index: 1; }
.ring { position: absolute; inset: -5px; width: 44px; height: 44px; transform: rotate(-90deg); opacity: 0; }
.ring circle { fill: none; stroke: var(--gold); stroke-width: 3; stroke-dasharray: 126; stroke-dashoffset: 0; stroke-linecap: round; }
.seat.turn .ring { opacity: 1; }
.seat.turn .seat-plate { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(242,199,102,.35), 0 0 22px rgba(242,199,102,.45); }
.seat.turn.hurry .ring circle { stroke: var(--red); }
.seat.turn.hurry .seat-plate { animation: hurry .6s ease-in-out infinite alternate; }
@keyframes hurry { to { box-shadow: 0 0 0 2px rgba(226,72,61,.6), 0 0 26px rgba(226,72,61,.6); } }
.seat-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.seat-name { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 98px; }
.seat-name .nm-wrap { display: flex; flex-direction: column; min-width: 0; }
.seat-name .nm { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-name .mg-name-title { font-size: 10px; font-weight: 500; }
.seat-count { display: flex; gap: 3px; align-items: center; min-height: 9px; font-size: 11px; color: var(--muted); }
.seat-count i { width: 7px; height: 7px; border-radius: 2px; background: #efe1c2; box-shadow: 0 1px 0 rgba(0,0,0,.4); }
.seat-count em { font-style: normal; margin-left: 4px; color: #ffb3a8; }
.seat.mine .seat-plate { border-color: rgba(127,211,255,.6); }
.seat.out { opacity: .5; filter: grayscale(.8); }
.seat.away .avatar { filter: grayscale(1); }

.seat-cup { position: relative; width: 130px; height: 58px; }
.cup {
  position: absolute; left: 50%; bottom: 0; width: 52px; height: 58px; transform: translateX(-50%);
  transition: transform .5s cubic-bezier(.4, 1.4, .5, 1), opacity .5s; z-index: 2;
  transform-origin: 50% 100%;
}
.cup-svg { width: 100%; height: 100%; display: block; }
.seat-dice {
  position: absolute; left: 0; right: 0; bottom: 2px; display: flex; flex-wrap: wrap-reverse;
  justify-content: center; gap: 3px; z-index: 1;
}
/* an open cup (my own, or every cup for a watcher): the cup is set aside and
   the dice sit on a little leather mat */
.seat-cup.peek .cup { transform: translateX(-50%) translateY(-34px) scale(.5); opacity: 0; }
.seat-cup.peek .seat-dice, .seat-cup.lifted .seat-dice {
  left: 50%; right: auto; transform: translateX(-50%); width: max-content; flex-wrap: nowrap;
  padding: 4px 5px; border-radius: 9px; background: rgba(20, 8, 4, .55);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.6);
}
.seat-cup.lifted .cup { transform: translateX(-50%) translateY(-90px) rotate(-14deg); opacity: 0; }
.seat-cup.empty .cup { opacity: 0; }
.seat-cup.shaking .cup { animation: shake .95s ease-in-out; }
@keyframes shake {
  0%, 100% { transform: translateX(-50%) rotate(0); }
  10% { transform: translateX(-50%) translate(-4px, -8px) rotate(-10deg); }
  20% { transform: translateX(-50%) translate(4px, -12px) rotate(9deg); }
  30% { transform: translateX(-50%) translate(-5px, -9px) rotate(-11deg); }
  40% { transform: translateX(-50%) translate(5px, -13px) rotate(10deg); }
  50% { transform: translateX(-50%) translate(-4px, -8px) rotate(-8deg); }
  60% { transform: translateX(-50%) translate(4px, -10px) rotate(7deg); }
  75% { transform: translateX(-50%) translate(0, -4px) rotate(-3deg); }
  88% { transform: translateX(-50%) translate(0, 2px) rotate(0); }
}
.seat-dice .die.match { box-shadow: 0 0 0 2px rgba(242,199,102,.0), 0 2px 3px rgba(0,0,0,.45); }
.seat-cup.lifted .seat-dice .die:not(.match) { opacity: .45; filter: saturate(.4); }
.seat-dice .die.counted {
  transform: translateY(-5px) scale(1.12);
  box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(242,199,102,.9);
}
.seat.lost .seat-plate { animation: lost .9s ease-out; }
@keyframes lost { 0% { box-shadow: 0 0 0 0 rgba(226,72,61,.9); } 40% { box-shadow: 0 0 0 8px rgba(226,72,61,.35), 0 0 30px rgba(226,72,61,.8); } 100% { box-shadow: 0 4px 10px rgba(0,0,0,.45); } }
.seat.lost .seat-count::before {
  content: ""; position: absolute; width: 12px; height: 12px; border-radius: 3px; background: #efe1c2;
  animation: dieGone .9s ease-in forwards;
}
.seat-count { position: relative; }
@keyframes dieGone { from { transform: translate(0, 0) rotate(0); opacity: 1; } to { transform: translate(30px, 36px) rotate(240deg); opacity: 0; } }

.seat-bubble {
  position: absolute; bottom: calc(100% - 6px); left: 50%; transform: translateX(-50%) scale(.6);
  display: flex; align-items: center; gap: 4px; padding: 4px 9px; border-radius: 12px;
  font: 700 16px var(--serif); color: #2a1606; white-space: nowrap;
  background: linear-gradient(#fff6dd, #ecd6a6); box-shadow: 0 4px 10px rgba(0,0,0,.5);
  opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; z-index: 4;
}
.seat-bubble .x { font-size: 12px; opacity: .7; }
.seat-bubble.on { opacity: 1; transform: translateX(-50%) scale(1); }
.seat.top-half .seat-bubble { bottom: auto; top: calc(100% - 6px); }
.seat-bubble.popin { animation: bubble .5s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes bubble { from { transform: translateX(-50%) scale(.3); } to { transform: translateX(-50%) scale(1); } }
.seat:not(.bidder) .seat-bubble.on { opacity: .55; }

/* verdict, stamp, toasts */
.verdict {
  margin: 8px auto 0; z-index: 8; display: inline-block;
  padding: 8px 20px; border-radius: 14px; text-align: center; white-space: nowrap;
  background: rgba(20,10,4,.92); border: 2px solid var(--gold); box-shadow: 0 12px 34px rgba(0,0,0,.6);
  animation: verdictIn .5s cubic-bezier(.3, 1.6, .5, 1);
}
.verdict.caught { border-color: var(--red); }
.v-title { font: 700 24px var(--serif); color: var(--gold); }
.verdict.caught .v-title { color: #ff8f84; }
.v-count { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 13px; color: var(--muted); margin: 2px 0; }
.v-bid { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.v-line { font-size: 15px; margin-top: 2px; }
.v-line .nm { font-weight: 700; }
@keyframes verdictIn { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.stamp {
  position: absolute; left: 50%; top: 45%; z-index: 9; transform: translate(-50%, -50%) rotate(-10deg);
  font: 900 76px/1 var(--serif); color: var(--red); letter-spacing: .04em; text-align: center;
  text-shadow: 0 4px 0 #4a0a06, 0 0 30px rgba(226,72,61,.6);
  -webkit-text-stroke: 2px #ffd8c8; pointer-events: none;
}
.stamp small { display: block; font: 700 16px var(--sans); -webkit-text-stroke: 0; color: var(--ink); text-shadow: 0 2px 4px #000; margin-top: 6px; }
.stamp.slam { animation: slam .45s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes slam { from { transform: translate(-50%, -50%) rotate(-24deg) scale(2.6); opacity: 0; } to { transform: translate(-50%, -50%) rotate(-10deg) scale(1); opacity: 1; } }
body.jolt #table { animation: jolt .35s; }
@keyframes jolt { 20% { transform: translate(-50%, calc(-50% + 6px)); } 45% { transform: translate(calc(-50% - 3px), calc(-50% - 2px)); } }
.toast {
  position: absolute; left: 50%; top: 10px; transform: translateX(-50%); z-index: 10;
  padding: 8px 14px; border-radius: 10px; background: rgba(20,10,4,.92); border: 1px solid var(--line);
  font-size: 14px; white-space: nowrap;
}
.toast.warn { border-color: var(--red); }
.watch-flag {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 6;
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  background: rgba(127,211,255,.15); border: 1px solid rgba(127,211,255,.5); color: #bfe8ff; white-space: nowrap;
}
.watch-flag.fogged { background: rgba(255,255,255,.07); border-color: var(--line); color: var(--muted); }

/* the history */
#historyPanel {
  width: 230px; flex: none; margin: 12px 12px 12px 0; padding: 12px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0;
}
.history-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.history-list li {
  display: flex; align-items: center; gap: 8px; padding: 6px 4px; font-size: 14px;
  border-bottom: 1px solid rgba(242,199,102,.08); animation: rowIn .3s ease-out;
}
.history-list li .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.h-bid { display: inline-flex; align-items: center; gap: 4px; font: 700 15px var(--serif); white-space: nowrap; }
.h-verdict { font-size: 12px; font-weight: 700; padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.h-verdict.ok { background: rgba(159,240,138,.15); color: #9ff08a; }
.h-verdict.lie { background: rgba(226,72,61,.18); color: #ff9c92; }
@keyframes rowIn { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

/* my hand and the controls */
#handBar {
  flex: none; display: flex; align-items: center; justify-content: center; gap: 22px;
  padding: 10px 16px 12px; background: linear-gradient(rgba(20,10,4,.3), rgba(20,10,4,.92));
  border-top: 1px solid rgba(242,199,102,.18);
}
#handBar.watching { padding: 10px 16px; }
.my-hand { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.my-hand.watching { color: var(--muted); font-size: 14px; }
.hand-label { font: 700 11px var(--sans); letter-spacing: .16em; text-transform: uppercase; color: #7fd3ff; }
.hand-dice { display: flex; gap: 8px; }
.controls { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.turn-note { font-size: 13px; color: var(--muted); text-align: center; min-height: 17px; }
.turn-note.mine { color: var(--gold); font-weight: 700; }
.pick-row { display: flex; align-items: center; gap: 8px; justify-content: center; }
.qty { display: inline-flex; align-items: center; gap: 4px; }
.qty b { min-width: 34px; text-align: center; font: 700 28px var(--serif); }
.step:disabled { opacity: .35; }
.times { color: var(--muted); font-size: 20px; }
.face-pick { display: flex; gap: 5px; }
.face-btn {
  padding: 3px; border-radius: 10px; border: 2px solid transparent; background: transparent; cursor: pointer;
  transition: transform .12s, border-color .15s;
}
.face-btn .die { --s: 36px; }
.face-btn.on { border-color: var(--gold); background: rgba(242,199,102,.14); transform: translateY(-3px); }
.face-btn:disabled { opacity: .35; }
.act-row { display: flex; gap: 8px; }
.bid-btn { flex: 1.4; }
.bid-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.bid-btn .die { --s: 22px; }
.liar-btn {
  flex: 1; background: linear-gradient(#ef6455, #a5231a); color: #fff; border-color: #ffb3a8;
  box-shadow: 0 3px 0 #5d0f09, 0 6px 16px rgba(0,0,0,.35); font: 900 18px var(--serif); letter-spacing: .04em;
}
.liar-btn:disabled { filter: grayscale(.9) brightness(.55); box-shadow: none; }
.liar-btn:active:not(:disabled) { transform: translateY(2px); }
.controls.live .bid-btn:not(:disabled) { animation: glow 1.4s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 3px 0 #7a5212, 0 0 22px rgba(242,199,102,.7); } }

/* ── how to play ─────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(8,4,2,.72); }
.modal-card {
  position: relative; width: 100%; max-width: 760px; max-height: 92vh; overflow-y: auto; padding: 22px;
  border-radius: 18px; background: linear-gradient(160deg, #4a2a12, #2c180a); border: 1px solid rgba(242,199,102,.45);
}
.modal-card h2 { margin: 0 0 10px; font-family: var(--serif); color: var(--gold); }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 22px; }
.help-grid h3 { margin: 10px 0 4px; font-family: var(--serif); color: #ffe2a3; font-size: 17px; }
.help-grid p { margin: 0 0 8px; line-height: 1.5; font-size: 14px; }
.help-close { position: absolute; right: 12px; top: 12px; }
.pip-inline { font-size: 1.2em; }
#helpOk { width: 100%; margin-top: 12px; }

/* ── the shared modules, in this room's colours ──────────────────────── */
.lb-panel, .lb-card {
  --lb-accent: #f2c766; --lb-panel: #2c180a; --lb-edge: rgba(242,199,102,.35);
  --lb-text: #f6ead2; --lb-dim: #c9b48f;
}
.lb-card { background: linear-gradient(160deg, #4a2a12, #2c180a); }
#lobbyChat .mps-chat-messages, #tableChat .mps-chat-messages { max-height: 150px; }

/* ── phones ──────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .lobby-cols { grid-template-columns: 1fr; }
  .help-grid { grid-template-columns: 1fr; }
  .card { padding: 22px 16px 16px; }
  .sign { font-size: 38px; }
  .sign.small { font-size: 24px; }
  #tableMain { flex-direction: column; }
  #table { width: 96%; height: 92%; }
  .felt { inset: 8% 9%; }
  #historyPanel {
    width: auto; margin: 0 8px 6px; padding: 6px 8px; flex-direction: row; align-items: center; gap: 8px;
  }
  #historyPanel .panel-label { margin: 0; writing-mode: horizontal-tb; white-space: nowrap; font-size: 10px; }
  .history-list { display: flex; overflow-x: auto; overflow-y: hidden; gap: 6px; scrollbar-width: none; }
  .history-list::-webkit-scrollbar { display: none; }
  .history-list li { flex: none; border: 1px solid rgba(242,199,102,.15); border-radius: 8px; padding: 3px 7px; font-size: 12px; gap: 5px; }
  .history-list li .nm { max-width: 64px; flex: none; }
  .h-bid { font-size: 13px; }
  .seat { width: 104px; }
  .seat-plate { padding: 3px 7px 3px 3px; gap: 5px; max-width: 108px; }
  .seat .avatar { width: 28px; height: 28px; font-size: 13px; }
  .ring { width: 38px; height: 38px; }
  .seat-name { font-size: 12px; max-width: 70px; }
  .seat-cup { width: 104px; height: 46px; }
  .cup { width: 40px; height: 46px; }
  .seat-dice { gap: 2px; }
  .seat-dice .die.sm { --s: 17px; }
  .bid-q { font-size: 44px; }
  .die.lg { --s: 46px; }
  .stamp { font-size: 56px; }
  .v-title { font-size: 19px; }
  .verdict { white-space: normal; max-width: 230px; padding: 7px 12px; }
  .v-count { font-size: 12px; flex-wrap: wrap; }
  .v-line { font-size: 14px; }
  #handBar { flex-direction: column; gap: 6px; padding: 6px 10px 10px; }
  .hand-dice { gap: 6px; }
  .my-hand { flex-direction: row; gap: 10px; }
  .hand-label { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 9px; }
  .face-btn .die { --s: 34px; }
  .face-pick { gap: 2px; }
  .controls { width: 100%; max-width: 420px; }
  .qty b { min-width: 26px; font-size: 24px; }
  .step { width: 34px; height: 40px; }
  #playTop { padding: 6px 8px; gap: 6px; }
  .icon-btn { width: 36px; height: 36px; }
  .round-label { font-size: 16px; }
}
@media (max-width: 760px) and (max-height: 700px) {
  .die.md { --s: 34px; }
}
