:root {
  --ink: #0e0c1d; --ink-2: #151230; --panel: #1a1736; --panel-2: #221e45;
  --line: rgba(233, 217, 168, .16); --line-2: rgba(233, 217, 168, .32);
  --parch: #e9d9a8; --parch-2: #cdb77a; --gold: #d9a94a; --gold-2: #f0cd7a;
  --nawab: #2f9e6a; --nawab-d: #1d6a47; --nawab-l: #6fd3a0;
  --eic: #c0414a; --eic-d: #7d1f27; --eic-l: #f08a8f;
  --text: #f4ecd4; --muted: #b3aa94;
  --r: 6px; --rc: 12px;
  --display: 'Noto Serif Bengali', Georgia, serif;
  --body: 'Noto Serif Bengali', Georgia, serif;
  --ease: cubic-bezier(.22, .8, .24, 1);
}
* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  background: radial-gradient(120% 90% at 50% 0%, #241f4d 0%, var(--ink-2) 42%, var(--ink) 100%) fixed;
  color: var(--text); font-family: var(--body); font-size: 16px; line-height: 1.5;
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
body::before { /* paper grain */
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
body::after { /* vignette */
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: radial-gradient(100% 80% at 50% 45%, transparent 55%, rgba(0, 0, 0, .55) 100%);
}
#fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
#app { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
img { display: block; -webkit-user-drag: none; user-select: none; }
.display { font-family: var(--display); }

/* ---------- buttons ---------- */
.btn {
  min-height: 48px; padding: 10px 22px; border-radius: var(--r); border: 1px solid var(--line-2);
  background: transparent; color: var(--parch); font-weight: 600; font-size: 17px;
  transition: transform .18s var(--ease), box-shadow .25s, background .25s, border-color .25s, opacity .2s;
}
.btn:hover:not(:disabled) { background: rgba(233, 217, 168, .08); border-color: var(--gold); transform: translateY(-1px); }
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:focus-visible, .seat:focus-visible, .tcard:focus-visible, input:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; }
.btn.primary {
  color: #1d1405; border-color: transparent;
  background: linear-gradient(180deg, var(--gold-2), var(--gold) 60%, #b98725);
  box-shadow: 0 0 24px rgba(217, 169, 74, .38), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffe092, var(--gold-2) 60%, var(--gold)); box-shadow: 0 0 30px rgba(240, 205, 122, .5), inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.btn.small { min-height: 44px; padding: 6px 14px; font-size: 15px; }

/* ---------- home ---------- */
.home { flex: 1; display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: 48px; max-width: 1120px; width: 100%; margin: 0 auto; padding: 48px 24px; }
.hero { position: relative; height: min(560px, 62vh); display: grid; place-items: center; }
.fan { position: absolute; width: min(220px, 34vw); aspect-ratio: 2/3; border-radius: var(--rc); box-shadow: 0 24px 50px rgba(0, 0, 0, .55), 0 0 0 1px rgba(255, 255, 255, .06); animation: floaty 7s ease-in-out infinite; }
.fan img { width: 100%; height: 100%; border-radius: var(--rc); }
.fan.a { transform: translate(-72%, 6%) rotate(-13deg); animation-delay: -1s; }
.fan.b { transform: translate(72%, 8%) rotate(12deg); animation-delay: -3s; }
.fan.c { z-index: 2; width: min(250px, 38vw); animation-delay: -2s; }
.fan { opacity: 0; animation: dealIn .9s var(--ease) forwards, floaty 7s ease-in-out 1s infinite; }
.fan.b { animation-delay: .18s, 1s; } .fan.c { animation-delay: .34s, 1s; }
.home h1 { font-family: var(--display); font-weight: 400; font-size: clamp(64px, 9vw, 108px); line-height: 1; letter-spacing: .01em; background: linear-gradient(180deg, #fff3c8, var(--gold) 70%); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 4px 20px rgba(217, 169, 74, .3)); }
.home .tag { color: var(--muted); font-size: 19px; margin: 6px 0 28px; }
.form { display: grid; gap: 14px; max-width: 420px; }
.field label { display: block; font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.field input { width: 100%; min-height: 50px; padding: 10px 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: rgba(14, 12, 29, .6); color: var(--text); font: inherit; font-size: 18px; }
.field input::placeholder { color: #918ca8; }
.code-input { text-transform: uppercase; letter-spacing: .3em; text-align: center; font-weight: 700; }
.or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.err { color: var(--eic-l); font-size: 15px; min-height: 22px; }

/* ---------- lobby ---------- */
.shell { max-width: 1120px; width: 100%; margin: 0 auto; padding: 28px 24px 40px; display: grid; gap: 24px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { font-family: var(--display); font-size: 30px; color: var(--gold-2); }
.roomcode { display: flex; align-items: center; gap: 12px; padding: 6px 8px 6px 18px; border: 1px solid var(--line-2); border-radius: var(--r); background: rgba(14, 12, 29, .55); }
.roomcode small { color: var(--muted); font-size: 13px; }
.roomcode b { font-size: 30px; letter-spacing: .28em; color: var(--parch); padding-left: .28em; font-weight: 700; }
.lobby-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 24px; }
.panel { background: linear-gradient(180deg, rgba(34, 30, 69, .85), rgba(21, 18, 48, .9)); border: 1px solid var(--line); border-radius: var(--rc); padding: 22px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); }
.panel h2 { font-family: var(--display); font-weight: 400; font-size: 26px; color: var(--parch); margin-bottom: 4px; }
.panel .sub { color: var(--muted); font-size: 15px; margin-bottom: 16px; }
.plist { display: grid; gap: 8px; }
.prow { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--r); background: rgba(14, 12, 29, .45); border: 1px solid transparent; animation: rowIn .5s var(--ease) both; }
.prow .nm { flex: 1; font-size: 18px; font-weight: 500; }
.prow .tagx { font-size: 13px; color: var(--muted); border: 1px solid var(--line); padding: 1px 8px; border-radius: 99px; }
.prow .x { min-width: 44px; min-height: 44px; border: 0; background: none; color: var(--muted); font-size: 20px; border-radius: var(--r); }
.prow .x:hover { color: var(--eic-l); background: rgba(192, 65, 74, .12); }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: 22px; color: #fff; flex: none; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .18), 0 4px 10px rgba(0, 0, 0, .35); }
.counts { display: flex; gap: 10px; margin: 14px 0 6px; flex-wrap: wrap; }
.pill { padding: 4px 14px; border-radius: 99px; font-size: 15px; font-weight: 600; border: 1px solid; }
.pill.n { color: var(--nawab-l); border-color: rgba(47, 158, 106, .5); background: rgba(47, 158, 106, .12); }
.pill.e { color: var(--eic-l); border-color: rgba(192, 65, 74, .5); background: rgba(192, 65, 74, .12); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.hint { color: var(--muted); font-size: 15px; }
.powers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.pw { display: flex; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: var(--rc); background: rgba(14, 12, 29, .45); text-align: left; width: 100%; transition: border-color .25s, background .25s, transform .2s var(--ease); }
button.pw:hover { transform: translateY(-2px); border-color: var(--line-2); }
.pw img { width: 64px; height: 96px; border-radius: 8px; flex: none; filter: grayscale(.85) brightness(.7); transition: filter .4s; }
.pw.on { border-color: var(--gold); background: rgba(217, 169, 74, .08); box-shadow: 0 0 22px rgba(217, 169, 74, .12); }
.pw.on img { filter: none; }
.pw b { display: block; font-size: 17px; }
.pw span { font-size: 14px; color: var(--muted); line-height: 1.4; display: block; }
.pw i { font-style: normal; display: inline-block; margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--muted); }
.pw.on i { color: var(--gold-2); }
.pw.eic b { color: var(--eic-l); } .pw.nawab b { color: var(--nawab-l); }

/* ---------- game ---------- */
.game { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr auto; max-width: 1180px; width: 100%; margin: 0 auto; padding: 14px 16px 18px; gap: 6px; min-height: 100vh; }
.hud { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hud-l { display: flex; align-items: center; gap: 12px; min-width: 120px; }
.hud-r { min-width: 120px; display: flex; justify-content: flex-end; }
.track { display: flex; gap: 10px; }
.slot { width: 52px; height: 78px; perspective: 600px; position: relative; }
.slot .flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform 1s var(--ease); }
.slot.done .flip { transform: rotateY(180deg); }
.slot .face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 8px; overflow: hidden; }
.slot .front { display: grid; place-items: center; background: linear-gradient(160deg, #2a2552, #1a1736); border: 1px solid var(--line-2); font-family: var(--display); font-size: 26px; color: var(--parch); }
.slot .front small { position: absolute; bottom: 4px; font-family: var(--body); font-size: 11px; color: var(--muted); }
.slot .back { transform: rotateY(180deg); } .slot .back img { width: 100%; height: 100%; object-fit: cover; }
.slot.now .front { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 0 20px rgba(217, 169, 74, .45); animation: glow 2.4s ease-in-out infinite; }
.slot.star .front::after { content: '✦'; position: absolute; top: 2px; right: 5px; font-size: 11px; color: var(--gold-2); }
.rejects { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.seal { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--eic-d); background: transparent; transition: background .4s, box-shadow .4s, transform .4s var(--ease); }
.seal.on { background: radial-gradient(circle at 35% 30%, #f06a73, var(--eic) 55%, var(--eic-d)); box-shadow: 0 0 10px rgba(192, 65, 74, .7); transform: scale(1.15); }

.stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 40px 0 12px; }
.table { position: relative; width: min(100%, 860px, max(470px, calc((100vh - 390px) * 1.3))); aspect-ratio: 1.28; container-type: inline-size; }
.felt { position: absolute; inset: 12% 9%; border-radius: 50%; background: radial-gradient(closest-side, #2b2658 0%, #1d1a40 62%, #141231 100%); box-shadow: inset 0 0 0 2px rgba(217, 169, 74, .35), inset 0 0 0 12px rgba(14, 12, 29, .5), inset 0 0 0 13px rgba(217, 169, 74, .16), 0 30px 70px rgba(0, 0, 0, .5), 0 0 90px rgba(120, 90, 220, .1); }
.felt::after { content: ''; position: absolute; inset: 14%; border-radius: 50%; border: 1px dashed rgba(233, 217, 168, .14); }
.tcenter { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 44%; text-align: center; z-index: 3; display: grid; gap: 4px; justify-items: center; }
.tcenter { transition: opacity .3s; } .table.hasb .tcenter { opacity: 0; }
.tcenter h3 { font-family: var(--display); font-weight: 400; font-size: clamp(20px, 3.1vw, 32px); color: var(--gold-2); line-height: 1.25; text-shadow: 0 2px 14px rgba(0, 0, 0, .6); animation: titleIn .6s var(--ease) both; }
.tcenter p { font-size: clamp(14px, 1.7vw, 17px); color: var(--text); opacity: .85; }
.tcenter .big { font-size: clamp(30px, 5vw, 52px); font-family: var(--display); color: var(--parch); }

.seat, .cmd { --sw: clamp(60px, 12cqw, 104px); }
.seat { position: absolute; left: clamp(calc(var(--sw) / 2 + 4px), var(--x), calc(100% - var(--sw) / 2 - 4px)); top: var(--y); transform: translate(-50%, -50%); width: var(--sw); text-align: center; background: none; border: 0; padding: 0; z-index: 4; transition: filter .3s; }
.seat .av { position: relative; width: clamp(40px, 7.4cqw, 64px); height: clamp(40px, 7.4cqw, 64px); margin: 0 auto; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-size: clamp(20px, 3.5cqw, 30px); color: #fff; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .18), 0 8px 18px rgba(0, 0, 0, .5); transition: box-shadow .3s, transform .3s var(--ease); animation: seatIn .7s var(--ease) both; }
.seat .nm { margin-top: 6px; font-size: clamp(11px, 1.8cqw, 15px); font-weight: 600; text-shadow: 0 1px 8px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat.me .av { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .18), 0 0 0 3px var(--gold), 0 0 22px rgba(217, 169, 74, .5); }
.seat.off { filter: grayscale(1) opacity(.5); }
.seat.pickable { cursor: pointer; } .seat.pickable:hover .av { transform: scale(1.08); }
.seat.picked .av { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .18), 0 0 0 4px var(--gold-2), 0 0 28px rgba(240, 205, 122, .8); transform: scale(1.1); }
.seat.waiting .av::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid transparent; border-top-color: var(--gold-2); animation: spin 1.2s linear infinite; }
.seat.ok .av::after { content: '✓'; position: absolute; right: -4px; bottom: -4px; width: 24px; height: 24px; border-radius: 50%; background: var(--nawab); color: #fff; font-size: 14px; display: grid; place-items: center; font-family: var(--body); animation: pop .4s var(--ease); }
.badge-team { position: absolute; left: 50%; top: -34px; translate: -50% 0; width: 30px; transform: rotate(-12deg); filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .6)); animation: pop .5s var(--ease) both; z-index: 2; }
.badge-team img { width: 100%; border-radius: 4px; }
.vt { position: absolute; right: -24px; top: -16px; width: 44px; height: 44px; perspective: 400px; z-index: 3; }
.vt .flip { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .8s var(--ease); transform: translateY(-14px) scale(.4) rotateY(0); opacity: 0; }
.vt.go .flip { opacity: 1; transform: translateY(0) scale(1) rotateY(180deg); transition: transform .9s var(--ease), opacity .3s; }
.vt .face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 50%; }
.vt .face img { width: 100%; height: 100%; border-radius: 50%; box-shadow: 0 4px 10px rgba(0, 0, 0, .6); }
.vt .tb { background: radial-gradient(circle at 35% 30%, #4a447e, #221e45); border: 2px solid var(--parch-2); }
.vt .tf { transform: rotateY(180deg); }
.cmd { position: absolute; width: clamp(34px, 5.4cqw, 46px); left: clamp(26px, calc(clamp(calc(var(--sw) / 2 + 4px), var(--x), calc(100% - var(--sw) / 2 - 4px)) + var(--cox, 34px)), calc(100% - 26px)); top: calc(var(--y) - var(--coy, 38px)); z-index: 6; pointer-events: none; transform: translate(-50%, -50%); transition: left 1s var(--ease), top 1s var(--ease); filter: drop-shadow(0 6px 10px rgba(0, 0, 0, .7)); }
.cmd img { width: 100%; animation: bob 2.6s ease-in-out infinite; }

/* final reveal cards on seats */
.seat .rv { position: absolute; left: 50%; top: -34px; width: 50px; aspect-ratio: 2/3; transform: translateX(-50%); perspective: 400px; z-index: 5; }
.flip3 { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .9s var(--ease); }
.flip3 .face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 6px; overflow: hidden; }
.flip3 .face img { width: 100%; height: 100%; }
.flip3 .face + .face { transform: rotateY(180deg); }
.rv.go .flip3 { transform: rotateY(180deg); }
.rv.eicx .face + .face img { box-shadow: 0 0 0 2px var(--eic); } .rv.nawabx .face + .face img { box-shadow: 0 0 0 2px var(--nawab); }

/* center overlays */
.fan-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 8; display: flex; gap: 10px; pointer-events: none; }
.mc { width: clamp(56px, 8.5vw, 88px); aspect-ratio: 2/3; perspective: 700px; animation: mcIn .7s var(--ease) both; }
.mc .flip3 { transition-duration: 1s; }
.mc.go .flip3 { transform: rotateY(180deg); }
.mc .face { box-shadow: 0 14px 30px rgba(0, 0, 0, .6); border-radius: 8px; }
.banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 9; text-align: center; padding: 18px 40px; min-width: 260px; border-radius: var(--rc); backdrop-filter: blur(6px); animation: bannerIn .8s var(--ease) both; pointer-events: none; }
.banner h2 { font-family: var(--display); font-weight: 400; font-size: clamp(26px, 4.6vw, 46px); line-height: 1.2; }
.banner p { margin-top: 4px; font-size: 17px; opacity: .92; }
.banner.n { background: linear-gradient(180deg, rgba(29, 106, 71, .92), rgba(15, 56, 38, .94)); border: 1px solid var(--nawab-l); box-shadow: 0 0 60px rgba(47, 158, 106, .5); color: #e6fff1; }
.banner.e { background: linear-gradient(180deg, rgba(125, 31, 39, .94), rgba(70, 14, 20, .95)); border: 1px solid var(--eic-l); box-shadow: 0 0 60px rgba(192, 65, 74, .5); color: #ffe9ea; }
.banner.g { background: linear-gradient(180deg, rgba(40, 34, 80, .95), rgba(21, 18, 48, .96)); border: 1px solid var(--gold); box-shadow: 0 0 60px rgba(217, 169, 74, .35); }
.shake { animation: shake .6s; }

/* ---------- dock ---------- */
.dock { min-height: 120px; display: grid; place-items: center; position: sticky; bottom: 0; z-index: 30; padding: 10px 0 6px; background: linear-gradient(180deg, rgba(14, 12, 29, 0), rgba(14, 12, 29, .92) 28%); }
.dockin { width: 100%; max-width: 760px; display: grid; justify-items: center; gap: 12px; padding: 14px 18px; border-radius: var(--rc); background: linear-gradient(180deg, rgba(34, 30, 69, .86), rgba(21, 18, 48, .92)); border: 1px solid var(--line); box-shadow: 0 -10px 40px rgba(0, 0, 0, .3); animation: dockIn .55s var(--ease) both; text-align: center; }
.dockin h4 { font-family: var(--display); font-weight: 400; font-size: 22px; color: var(--parch); }
.dockin p { color: var(--muted); font-size: 15px; }
.row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; align-items: center; }
.tcard { width: 96px; background: none; border: 0; padding: 0; position: relative; transition: transform .35s var(--ease), filter .3s; }
.tcard img { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 10px; box-shadow: 0 12px 26px rgba(0, 0, 0, .55); }
.tcard:hover:not(:disabled) { transform: translateY(-8px) rotate(-1.5deg) scale(1.04); }
.tcard:disabled { filter: grayscale(.9) brightness(.55); cursor: not-allowed; }
.tcard span { display: block; margin-top: 6px; font-size: 14px; font-weight: 600; }
.tcard.sel { transform: translateY(-12px) scale(1.06); } .tcard.sel img { box-shadow: 0 0 0 3px var(--gold-2), 0 0 30px rgba(240, 205, 122, .6); }
.votebtns { display: flex; gap: 26px; }
.votebtn { width: 84px; background: none; border: 0; padding: 0; text-align: center; transition: transform .3s var(--ease); }
.votebtn img { width: 100%; border-radius: 50%; box-shadow: 0 10px 24px rgba(0, 0, 0, .6); transition: box-shadow .3s; }
.votebtn:hover { transform: translateY(-6px) rotate(-4deg) scale(1.06); }
.votebtn.y:hover img { box-shadow: 0 0 36px rgba(111, 211, 160, .7); } .votebtn.n:hover img { box-shadow: 0 0 36px rgba(240, 138, 143, .7); }
.votebtn b { display: block; margin-top: 8px; font-size: 18px; }
.chiplist { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.chip { padding: 3px 12px; border-radius: 99px; font-size: 15px; border: 1px solid var(--line-2); display: inline-flex; gap: 6px; align-items: center; }
.chip.e { border-color: rgba(192, 65, 74, .6); color: var(--eic-l); background: rgba(192, 65, 74, .1); }
.chip.m { border-color: rgba(217, 169, 74, .6); color: var(--gold-2); background: rgba(217, 169, 74, .1); }

/* role overlay */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: radial-gradient(80% 80% at 50% 40%, rgba(40, 34, 90, .9), rgba(8, 6, 18, .95)); animation: fade .5s both; padding: 20px; overflow: auto; }
.role { display: grid; justify-items: center; gap: 16px; text-align: center; max-width: 440px; }
.rcard { width: min(250px, 58vw); aspect-ratio: 2/3; perspective: 1100px; cursor: pointer; animation: dealIn .9s var(--ease) both; }
.rcard .flip3 { transition-duration: 1.1s; }
.rcard.go .flip3 { transform: rotateY(180deg); }
.rcard .face { border-radius: 14px; box-shadow: 0 30px 70px rgba(0, 0, 0, .7), 0 0 60px rgba(217, 169, 74, .12); }
.rcard.idle .flip3 { animation: tilt 4s ease-in-out infinite; }
.rcard .shine { position: absolute; inset: 0; border-radius: 14px; background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .22) 50%, transparent 65%); background-size: 250% 100%; animation: sheen 3.2s linear infinite; mix-blend-mode: overlay; pointer-events: none; }
.role h2 { font-family: var(--display); font-weight: 400; font-size: 34px; line-height: 1.2; }
.role .side { font-size: 18px; font-weight: 700; padding: 2px 16px; border-radius: 99px; display: inline-block; }
.side.n { color: var(--nawab-l); background: rgba(47, 158, 106, .14); border: 1px solid rgba(47, 158, 106, .5); }
.side.e { color: var(--eic-l); background: rgba(192, 65, 74, .14); border: 1px solid rgba(192, 65, 74, .5); }
.role p { color: var(--text); opacity: .88; font-size: 17px; }
.role .reveal-only { animation: fade .8s .5s both; display: grid; gap: 12px; justify-items: center; }

.mini { font-size: 13px; color: var(--muted); }
.floatbtn { position: fixed; left: 14px; bottom: 14px; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 6px 16px 6px 6px; min-height: 52px; border-radius: 99px; background: rgba(21, 18, 48, .92); border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .5); transition: transform .25s var(--ease), border-color .25s; }
.floatbtn:hover { transform: translateY(-3px); border-color: var(--gold); }
.floatbtn img { width: 34px; aspect-ratio: 2/3; border-radius: 5px; object-fit: cover; }
.toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%); z-index: 99; background: var(--panel-2); border: 1px solid var(--line-2); padding: 10px 18px; border-radius: var(--r); box-shadow: 0 12px 40px #000a; animation: titleIn .4s var(--ease) both; }

/* ---------- keyframes ---------- */
@keyframes dealIn { from { opacity: 0; translate: 0 40px; scale: .86; rotate: -4deg; } to { opacity: 1; translate: 0; scale: 1; rotate: 0deg; } }
@keyframes floaty { 0%, 100% { translate: 0 0; } 50% { translate: 0 -12px; } }
@keyframes rowIn { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
@keyframes seatIn { from { opacity: 0; transform: scale(.4) translateY(20px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(0) rotate(-20deg); } 70% { transform: scale(1.2) rotate(-12deg); } 100% { transform: scale(1) rotate(-12deg); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 1px var(--gold), 0 0 14px rgba(217, 169, 74, .3); } 50% { box-shadow: 0 0 0 1px var(--gold-2), 0 0 26px rgba(240, 205, 122, .7); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
@keyframes titleIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes dockIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mcIn { from { opacity: 0; transform: translateY(60px) scale(.5) rotate(var(--rot, 0deg)); } to { opacity: 1; transform: none; } }
@keyframes bannerIn { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.7); } 60% { transform: translate(-50%, -52%) scale(1.06); } 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); } }
@keyframes tilt { 0%, 100% { transform: rotateY(-7deg) rotateX(3deg); } 50% { transform: rotateY(7deg) rotateX(-3deg); } }
@keyframes sheen { from { background-position: 220% 0; } to { background-position: -120% 0; } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .home { grid-template-columns: 1fr; gap: 8px; padding: 20px 16px 36px; }
  .hero { height: 300px; order: 2; margin-top: 16px; }
  .lobby-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .shell { padding: 16px 16px 88px; }
  .home { padding-bottom: 96px; }
  .game { padding: 10px 10px 78px; }
  .rejects span { display: none; } .seal { width: 11px; height: 11px; } .rejects { gap: 4px; }
  .hud { flex-direction: column; gap: 8px; } .hud-r { justify-content: center; }
  .stage { padding: 30px 0 6px; }
  .seat .rv { width: 40px; top: -28px; }
  .cmd { --cox: 22px; --coy: 30px; }
  .hud { gap: 8px; } .hud-l, .hud-r { min-width: 0; } .hud-l { display: none; }
  .slot { width: 42px; height: 63px; } .slot .front { font-size: 22px; } .track { gap: 7px; }
  .table { width: 100%; min-width: 0; aspect-ratio: 1.02; }
  .felt { inset: 14% 8%; }
  .badge-team { width: 24px; top: -28px; } .vt { width: 36px; height: 36px; right: -18px; }
  .tcenter { width: 56%; } .tcenter h3 { font-size: 18px; }
  .powers { grid-template-columns: 1fr; }
  .tcard { width: 84px; } .votebtn { width: 92px; }
  .roomcode b { font-size: 24px; }
  .floatbtn span { display: none; } .floatbtn { padding: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- rulebook ---------- */
.rulebtn { position: fixed; right: 14px; bottom: 14px; z-index: 40; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 18px 0 14px; border-radius: 99px; background: rgba(21, 18, 48, .92); border: 1px solid var(--line-2); color: var(--parch); font-weight: 600; font-size: 16px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); transition: transform .25s var(--ease), border-color .25s, box-shadow .25s; }
.rulebtn:hover { transform: translateY(-3px); border-color: var(--gold); box-shadow: 0 14px 34px rgba(0, 0, 0, .55), 0 0 22px rgba(217, 169, 74, .2); }
.rulebtn:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 3px; }
.rules { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; background: rgba(6, 5, 16, .78); backdrop-filter: blur(5px); animation: fade .3s both; }
.rules.out { animation: fadeOut .25s both; } .rules.out .book { animation: bookOut .25s both; }
.book { width: min(980px, 100%); height: min(760px, 100%); display: grid; grid-template-columns: 210px 1fr; grid-template-rows: auto 1fr; border-radius: var(--rc); overflow: hidden; background: linear-gradient(180deg, #ecdcac, #dcc78d); color: #2a2111; box-shadow: 0 40px 100px rgba(0, 0, 0, .7), 0 0 0 1px rgba(217, 169, 74, .5), inset 0 0 0 6px rgba(120, 82, 24, .18); animation: bookIn .5s var(--ease) both; }
.book header { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding: 14px 22px; background: linear-gradient(180deg, #1d1940, #151230); border-bottom: 2px solid var(--gold); }
.book header .brand { font-size: 28px; line-height: 1.1; } .book header .mini { color: var(--muted); }
.book nav { display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; background: rgba(90, 60, 14, .1); border-right: 1px solid rgba(90, 60, 14, .25); overflow-y: auto; }
.book nav button { text-align: left; min-height: 44px; padding: 8px 14px; border: 0; border-radius: var(--r); background: transparent; color: #4a3715; font-weight: 600; font-size: 16px; transition: background .2s, color .2s; }
.book nav button:hover { background: rgba(90, 60, 14, .12); }
.book nav button.on { background: #2a2111; color: var(--gold-2); }
.pages { overflow-y: auto; padding: 8px 34px 40px; scroll-behavior: smooth; }
.pages section { padding: 22px 0 8px; border-bottom: 1px dashed rgba(90, 60, 14, .3); }
.pages section:last-child { border-bottom: 0; }
.pages h3 { font-family: var(--display); font-weight: 400; font-size: 32px; color: #3a2a0d; margin-bottom: 8px; }
.pages h5 { font-size: 17px; margin: 18px 0 8px; color: #3a2a0d; }
.pages p { font-size: 18px; line-height: 1.75; margin-bottom: 10px; }
.pages .mini, .pages .hint { color: #584420; font-size: 15px; }
.tn { color: #0f5a35; } .te { color: #8f202a; }
.steps { list-style: none; padding: 0; display: grid; gap: 12px; counter-reset: s; margin: 12px 0; }
.steps li { counter-increment: s; position: relative; padding: 12px 14px 12px 62px; border-radius: 10px; background: rgba(255, 255, 255, .35); border: 1px solid rgba(90, 60, 14, .22); }
.steps li::before { content: counter(s, bengali); position: absolute; left: 14px; top: 12px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #2a2111; color: var(--gold-2); font-family: var(--display); font-size: 20px; }
.steps b { display: block; font-size: 19px; margin-bottom: 2px; } .steps span { font-size: 17px; line-height: 1.7; display: block; }
.note { margin: 12px 0; padding: 12px 16px; border-radius: 10px; background: rgba(154, 38, 48, .1); border-left: 4px solid #9a2630; font-size: 17px; line-height: 1.7; }
.ends { padding-left: 22px; display: grid; gap: 10px; margin: 10px 0; font-size: 18px; line-height: 1.7; }
.tw { overflow-x: auto; margin-bottom: 4px; }
.tw table { border-collapse: collapse; width: 100%; min-width: 440px; background: rgba(255, 255, 255, .35); }
.tw th, .tw td { border: 1px solid rgba(90, 60, 14, .3); padding: 8px 10px; text-align: center; font-size: 17px; }
.tw tr:first-child th { background: #2a2111; color: var(--gold-2); } .tw th:first-child { text-align: left; white-space: nowrap; }
.tw th.n { color: #14673f; } .tw th.e { color: #9a2630; }
.tw .hl { background: rgba(217, 169, 74, .45); font-weight: 700; } .tw tr:first-child th.hl { background: var(--gold); color: #1d1405; }
.tw sup { color: #9a2630; font-size: 12px; margin-left: 2px; }
.rcs { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-top: 12px; }
.rc { display: flex; gap: 12px; padding: 10px; border-radius: 10px; background: rgba(255, 255, 255, .35); border: 1px solid rgba(90, 60, 14, .22); }
.rc img { width: 88px; aspect-ratio: 2/3; flex: none; border-radius: 8px; object-fit: cover; box-shadow: 0 6px 16px rgba(0, 0, 0, .35); }
.rc h4 { font-family: var(--display); font-weight: 400; font-size: 20px; line-height: 1.25; margin-bottom: 4px; }
.rc p { font-size: 15px; line-height: 1.55; margin: 6px 0 2px; } .rc small { color: #584420; font-size: 13px; }
.rc .side { font-size: 13px; padding: 0 10px; }
.rc .side.n { color: #14673f; background: rgba(47, 158, 106, .15); border-color: rgba(20, 103, 63, .5); } .rc .side.e { color: #9a2630; background: rgba(192, 65, 74, .13); border-color: rgba(154, 38, 48, .5); }
@keyframes bookIn { from { opacity: 0; transform: translateY(30px) scale(.96) rotateX(6deg); } to { opacity: 1; transform: none; } }
@keyframes bookOut { to { opacity: 0; transform: translateY(20px) scale(.97); } }
@keyframes fadeOut { to { opacity: 0; } }
@counter-style bengali { system: numeric; symbols: '০' '১' '২' '৩' '৪' '৫' '৬' '৭' '৮' '৯'; }
@media (max-width: 760px) {
  .rules { padding: 0; } .book { height: 100%; border-radius: 0; grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .book nav { flex-direction: row; overflow-x: auto; padding: 8px 10px; border-right: 0; border-bottom: 1px solid rgba(90, 60, 14, .25); }
  .book nav button { white-space: nowrap; }
  .pages { padding: 4px 16px 90px; } .pages h3 { font-size: 27px; } .pages p, .ends { font-size: 17px; }
  .rcs { grid-template-columns: 1fr; }
  .rulebtn span { display: none; } .rulebtn { padding: 0 14px; }
}

/* floating buttons never sit on top of the dock */
@media (max-width: 1100px) { .game { padding-bottom: 82px; } .floatbtn span, .rulebtn span { display: none; } .floatbtn { padding: 6px; } .rulebtn { padding: 0 14px; } }
@media (max-width: 640px) {
  .ingame .floatbtn { top: 10px; bottom: auto; left: 10px; }
  .ingame .rulebtn { top: 10px; bottom: auto; right: 10px; }
  .game { padding-bottom: 14px; }
}
@media (max-width: 360px) { .slot { width: 36px; height: 54px; } .slot .front { font-size: 19px; } .track { gap: 6px; } }

/* game setup and spy */
.modeline { padding: 10px 14px; margin-bottom: 4px; border-radius: var(--r); background: rgba(217, 169, 74, .08); border: 1px solid rgba(217, 169, 74, .3); font-size: 16px; }
.modeline b { color: var(--gold-2); }
.subh { font-family: var(--display); font-weight: 400; font-size: 21px; color: var(--parch); margin: 20px 0 4px; }
.pw.spy { margin-top: 2px; }
.pw.spy img { filter: grayscale(.85) brightness(.75); } .pw.spy.on img { filter: none; }
.badge-spy { position: absolute; left: -10px; bottom: -6px; width: 22px; aspect-ratio: 2/3; border-radius: 4px; transform: rotate(10deg); box-shadow: 0 3px 8px rgba(0, 0, 0, .6); animation: pop .5s var(--ease) both; z-index: 2; }

/* touch screens: no hover effects, so a first tap is never eaten by a button moving away */
@media (hover: none) {
  .btn:hover:not(:disabled), .tcard:hover:not(:disabled), .votebtn:hover, button.pw:hover, .rulebtn:hover, .floatbtn:hover { transform: none; }
  .seat.pickable:hover .av { transform: none; }
}

/* instant feedback after tapping an action */
.dockin.busy button:not(.chosen) { opacity: .4; pointer-events: none; }
.dockin.busy .chosen { pointer-events: none; }
.votebtn.chosen { transform: translateY(-6px) scale(1.12); } .votebtn.chosen img { box-shadow: 0 0 0 3px var(--gold-2), 0 0 34px rgba(240, 205, 122, .75); }
.tcard.chosen { transform: translateY(-12px) scale(1.06); } .tcard.chosen img { box-shadow: 0 0 0 3px var(--gold-2), 0 0 30px rgba(240, 205, 122, .6); }
.btn.chosen { opacity: .8; }
