:root {
  --ink: #efe6d2;
  --muted: #a99a7e;
  --gold: #d9a83f;
  --brass: #c79a3b;
  --line: #3d2e1c;
  --btn: #241a10;
  --btnLine: #4a3a25;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; color: var(--ink);
  background: radial-gradient(ellipse at 34% 52%, #3b2a18 0, #17110b 52%, #070604 100%) fixed #070604;
  font: 14px/1.4 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button { background: var(--btn); border: 1px solid var(--btnLine); border-radius: 8px; padding: 0 12px; min-height: 36px;
  cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink); }
button:hover { background: #33261a; }
button.primary { background: var(--gold); color: #2b1c05; border-color: transparent; font-weight: 600; }
button.primary:hover { filter: brightness(1.08); }
button.gold { background: transparent; border-color: var(--brass); color: var(--gold); font-weight: 600; }
button.quiet { background: transparent; color: var(--muted); }
button.off { background: #4a1f25; border-color: #7a2c36; }
input { width: 100%; background: rgba(0,0,0,.35); border: 1px solid var(--btnLine); border-radius: 8px; padding: 10px 12px; }
h1, h2, .headline, .big { font-family: 'Playfair Display', Georgia, serif; }
.eyebrow { font-size: 11px; letter-spacing: .2em; color: var(--brass); font-weight: 600; }
.eyebrow.gold { color: var(--gold); }
.muted { color: var(--muted); font-size: 12px; margin: 0; }

/* ------------------------------------------------------------ lobby */
#lobby { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.panel { width: min(600px, 100%); background: rgba(0,0,0,.42); border: 1px solid var(--line); border-radius: 16px; padding: 28px; }
.panel h1 { margin: 6px 0 8px; font-size: 38px; }
.panel h2 { margin: 0 0 8px; }
.lab { display: block; margin: 18px 0 8px; font-size: 11px; letter-spacing: .18em; color: var(--brass); font-weight: 600; }
.sub { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.msg { min-height: 1.4em; color: #ff8d8d; margin: 12px 0 0; }
#join { margin-top: 22px; width: 100%; min-height: 46px; font-size: 15px; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg button { flex: 1; min-height: 42px; }
.seg button.on { border-color: var(--gold); color: var(--gold); background: rgba(217,168,63,.10); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 20px; z-index: 200; }
.modal .primary { margin-top: 16px; width: 100%; }
.hand-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.hand-opt { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 4px; background: rgba(0,0,0,.3);
  border: 2px solid transparent; border-radius: 10px; cursor: pointer; font-size: 12px; color: var(--muted); }
.hand-opt:hover { border-color: var(--btnLine); }
.hand-opt.sel { border-color: var(--gold); color: var(--ink); }
.hand-opt svg { width: 54px; height: 54px; }

/* ------------------------------------------------------------ layout */
#game { display: flex; gap: 40px; padding: 40px; align-items: flex-start; justify-content: center; min-height: 100vh; }
#boardWrap { position: relative; flex: none; }
#board { position: absolute; left: 0; top: 0; width: 820px; height: 820px; transform-origin: 0 0;
  cursor: none; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#panel { width: 500px; flex: none; display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 999px) {
  #game { flex-direction: column; align-items: center; padding: 8px; gap: 16px; }
  #panel { width: min(500px, 100%); padding: 0 6px 24px; }
  .titleRow h1 { font-size: 28px; }
  .team .big { font-size: 34px; }
  .box { padding: 14px 16px; }
  .person { grid-template-columns: 24px 1fr 64px 96px; }
}

/* ------------------------------------------------------------ table */
.rim { position: absolute; inset: 0; border-radius: 44px; background: linear-gradient(135deg, #5a3a1f, #2d1a0b);
  box-shadow: 0 30px 60px rgba(0,0,0,.7), inset 0 0 0 2px #7a5430; }
.felt { position: absolute; left: 26px; top: 26px; width: 768px; height: 768px; border-radius: 28px;
  background: radial-gradient(circle at 50% 56%, #237048 0, #1b5e3b 45%, #124428 100%); box-shadow: inset 0 0 50px rgba(0,0,0,.6); }
.vignette { position: absolute; inset: 0; border-radius: 44px; pointer-events: none; z-index: 40;
  background: radial-gradient(circle at 50% 54%, rgba(255,214,140,.10) 0, rgba(0,0,0,0) 46%, rgba(0,0,0,.55) 100%); }
#feltMsg { position: absolute; left: 140px; right: 140px; top: 200px; text-align: center; z-index: 35; pointer-events: none;
  font-family: 'Playfair Display', Georgia, serif; font-size: 22px; color: rgba(239,230,210,.75); text-shadow: 0 2px 6px rgba(0,0,0,.6); }
#feltMsg small { display: block; font-family: 'Inter', sans-serif; font-size: 13px; color: rgba(239,230,210,.6); margin-top: 6px; }

/* the turntable */
#tt { position: absolute; left: 328px; top: 328px; width: 164px; height: 164px; z-index: 5; transition: transform 1.6s ease-in-out; }
.tt-ring { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, #b8892f 0, #8a6a22 100%); box-shadow: 0 8px 22px rgba(0,0,0,.65); }
.tt-wood { position: absolute; left: 12px; top: 12px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #5a3a1f 0, #2b1a0c 100%); }
.tt-arrow { position: absolute; left: 73px; top: 138px; width: 0; height: 0; border: 9px solid transparent; border-bottom: 12px solid var(--gold); border-top: 0; }
.tt-label { position: absolute; top: 114px; width: 46px; padding: 2px 0; text-align: center; border-radius: 999px; background: rgba(0,0,0,.55);
  color: var(--ink); font-size: 11px; font-weight: 600; line-height: 16px; pointer-events: none; z-index: 9; }
#ttCards { position: absolute; inset: 0; }

/* cards */
#cards, #labels, #cams, #drag, #hands, #strip { position: absolute; inset: 0; pointer-events: none; }
#cards { z-index: 10; }
#strip { z-index: 30; }
#labels { z-index: 25; }
#cams { z-index: 20; }
#drag { z-index: 55; }
#hands { z-index: 60; }
.card { position: absolute; left: 0; top: 0; border-radius: 6px; pointer-events: auto;
  box-shadow: 0 2px 5px rgba(0,0,0,.55); transition: transform .35s ease, top .12s ease, opacity .2s; will-change: transform; }
.card.notrans, .card.lifted { transition: none; }
.card.lifted { box-shadow: 0 14px 22px rgba(0,0,0,.6); }
.card.face { background: #f4ecd9; border: 1px solid #c9bb98; color: #1c1b19; }
.card.face.red { color: #b32428; }
.card span { position: absolute; font-family: 'Playfair Display', Georgia, serif; font-weight: 700; line-height: 1; }
.card .ix { left: calc(6 * var(--u)); top: calc(4 * var(--u)); font-size: calc(17 * var(--u)); }
.card .is { left: calc(6 * var(--u)); top: calc(22 * var(--u)); font-size: calc(14 * var(--u)); }
.card .pip { left: 0; right: 0; top: calc(38 * var(--u)); text-align: center; font-size: calc(34 * var(--u)); }
.card.blank span { display: none; }
.card.back { background: #6b1620; border: 1px solid #2a0a0e; }
.card.back::after { content: ""; position: absolute; inset: 12%; border: 1px solid var(--brass); border-radius: 3px;
  background: repeating-linear-gradient(45deg, rgba(199,154,59,.38) 0 1px, transparent 1px 6px),
              repeating-linear-gradient(-45deg, rgba(199,154,59,.38) 0 1px, transparent 1px 6px); }
.card.mine:hover:not(.lifted) { top: -14px; }
.card.carried { opacity: .25; }
.card.snap { box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(217,168,63,.7); }
.card.away { opacity: .35; }
.pill { position: absolute; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; line-height: 16px; white-space: nowrap;
  background: rgba(0,0,0,.55); color: var(--ink); transform: translate(-50%, -50%); transition: left .35s, top .35s; }
.pill.red { background: #b32428; color: #fff; }
.pill.black { background: #222; }

/* the team draw and roles, on the felt */
#start { position: absolute; left: 118px; top: 150px; width: 584px; z-index: 37; padding: 22px 20px 20px; border-radius: 16px;
  background: rgba(10,8,5,.86); border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0,0,0,.6); }
#start .ttl { font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 28px; margin: 4px 0 6px; }
#start .sub { margin: 0 0 16px; font-size: 13px; color: var(--muted); line-height: 1.5; }
#start .tiles { display: grid; grid-template-columns: repeat(4, 124px); gap: 16px; }
#start .tile { position: relative; height: 196px; border-radius: 12px; background: rgba(0,0,0,.35); border: 1px solid var(--line); }
#start .tile.spade { border-color: var(--gold); }
#start .tile .bar { position: absolute; left: 8px; right: 8px; top: 12px; height: 10px; border-radius: 5px; }
#start .tile .card { transform: translate(27px, 38px); }
#start .tile .card.dim { opacity: .25; }
#start .tile .card.flipIn { animation: flipIn .35s ease-out; }
@keyframes flipIn { from { transform: translate(27px, 38px) scaleX(0); } to { transform: translate(27px, 38px) scaleX(1); } }
#start .tile .nm { position: absolute; left: 4px; right: 4px; top: 152px; text-align: center; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#start .tile .tg { position: absolute; left: 0; right: 0; top: 172px; text-align: center; font-size: 11px; color: var(--gold); }
#start .res { margin-top: 16px; padding: 14px 18px; border-radius: 12px; background: rgba(217,168,63,.10); border: 1px solid var(--gold); }
#start .res.plain { background: rgba(0,0,0,.35); border-color: var(--line); }
#start .res b { display: block; font-family: 'Playfair Display', Georgia, serif; font-size: 20px; margin-bottom: 4px; }
#start .res p { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
#start .act { margin-top: 14px; display: flex; gap: 10px; }
#start .act button { min-height: 42px; flex: 1; pointer-events: auto; cursor: none; }
#start .teams { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
#start .tm { padding: 14px 16px; border-radius: 12px; background: rgba(0,0,0,.35); border: 1px solid var(--line); }
#start .tm.mine { border-color: var(--gold); }
#start .tm .who { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; }
#start .tm .who span:last-child { color: var(--gold); }
#start .tm .who.open span:last-child { color: var(--muted); }
#hint { position: absolute; left: 50%; top: 300px; transform: translateX(-50%); z-index: 58; pointer-events: none; padding: 8px 16px; border-radius: 999px;
  background: rgba(0,0,0,.8); border: 1px solid var(--gold); color: var(--ink); font-weight: 600; font-size: 14px; max-width: 560px; width: max-content; text-align: center; }

/* round scores, on the felt */
#scores { position: absolute; left: 46px; top: 46px; width: 728px; z-index: 37; padding: 20px 24px; border-radius: 16px;
  background: rgba(10,8,5,.94); border: 1px solid var(--line); box-shadow: 0 20px 50px rgba(0,0,0,.6); }
#scores .ttl { font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 30px; margin: 2px 0 4px; }
#scores .sub { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
#scores table { width: 100%; border-collapse: collapse; border-top: 2px solid var(--brass); }
#scores th { text-align: right; font-size: 13px; padding: 8px 0 4px; }
#scores td { border-bottom: 1px solid #2f2417; padding: 5px 0; }
#scores td.l b { display: block; font-size: 14px; }
#scores td.l small { color: var(--muted); font-size: 11px; }
#scores td.n { text-align: right; width: 140px; }
#scores .num { width: 120px; min-height: 30px; text-align: right; padding-right: 12px; background: #120d08; border: 1px solid var(--line);
  font-variant-numeric: tabular-nums; font-size: 14px; pointer-events: auto; cursor: none; }
#scores .num.neg { color: #e8a09b; }
#scores .tot { display: grid; grid-template-columns: 1fr 140px 140px; margin-top: 12px; padding: 12px 16px; border-radius: 12px; background: rgba(0,0,0,.4); border: 1px solid var(--btnLine); }
#scores .tot .big2 { font-family: 'Playfair Display', Georgia, serif; font-weight: 700; font-size: 26px; text-align: right; }
#scores .tot small { display: block; text-align: right; color: var(--muted); font-size: 11px; }
#scores .tot p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
#scores .act { margin-top: 12px; display: flex; gap: 12px; align-items: center; }
#scores .act button { min-height: 42px; padding: 0 18px; pointer-events: auto; cursor: none; }
#scores .act span { color: var(--muted); font-size: 13px; }

/* peek at your foot */
.peek-cards { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.peek-cards .card { position: relative; }

/* the grab strip */
.strip-card { position: absolute; width: 40px; height: 57px; pointer-events: none; transition: transform .12s; }
.strip-card.live { pointer-events: auto; cursor: none; }
.strip-card.live:hover { transform: translateY(-12px); box-shadow: 0 0 0 2px var(--gold), 0 10px 16px rgba(0,0,0,.6); }
.strip-aside { position: absolute; }

/* webcams */
.cam { position: absolute; width: 150px; height: 112px; border-radius: 10px; overflow: hidden; border: 2px solid var(--c, #3a4260);
  background: #2c2118; box-shadow: 0 4px 12px rgba(0,0,0,.6); transition: box-shadow .4s; }
.cam.turn { box-shadow: 0 0 0 2px var(--gold), 0 0 26px rgba(217,168,63,.55); }
.cam.empty { border-style: dashed; border-color: #5a4630; background: rgba(0,0,0,.25); box-shadow: none; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam video.me { transform: scaleX(-1); }
.cam .alt { position: absolute; inset: 0; display: grid; place-items: center; }
.cam .alt svg { width: 96px; height: 96px; }
.cam.hasvideo .alt { display: none; }
.cam .info { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 4px; background: linear-gradient(transparent, rgba(0,0,0,.75));
  font-size: 12px; font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.cam .info .r { color: var(--muted); font-weight: 500; }
.cam .d { position: absolute; right: 6px; top: 6px; width: 22px; height: 22px; border-radius: 50%; background: var(--brass); color: #2b1c05;
  font: 700 12px/22px 'Inter', sans-serif; text-align: center; }
.cam .emptyText { position: absolute; inset: 0; display: grid; place-items: center; color: #8a7556; font-size: 12px; }
.cam.awayCam::after { content: "Away"; position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.55);
  color: var(--ink); font-weight: 600; letter-spacing: .1em; }

/* hand cursors (from stage 1) */
.hand { position: absolute; left: 0; top: 0; width: 88px; height: 88px; will-change: transform; filter: drop-shadow(0 6px 4px rgba(0,0,0,.55)); }
.hand.away { display: none; }
.hand .art { width: 100%; height: 100%; transform-origin: 50% 50%; transform: rotate(var(--rot, 0deg)); position: relative; z-index: 2; }
.hand .art svg { width: 100%; height: 100%; overflow: visible; }
.hand .ring { position: absolute; inset: 12%; border-radius: 50%; border: 3px solid var(--c); opacity: 0; transform: scale(.4); pointer-events: none; }
.hand .tag { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: -8px; padding: 2px 9px; border-radius: 999px;
  background: var(--c); color: #111; font-size: 11px; font-weight: 600; line-height: 16px; white-space: nowrap; z-index: 3; }
.hand .carry { position: absolute; left: 50%; top: 50%; z-index: 1; }
.hand.slap .art { animation: slap .38s ease-out; }
.hand.slap .ring { animation: ring .38s ease-out; }
.hand.wave .art { animation: wave .5s ease-in-out infinite; }
@keyframes slap { 0% { transform: rotate(var(--rot)) scale(1.35); } 55% { transform: rotate(var(--rot)) scale(.82); } 100% { transform: rotate(var(--rot)) scale(1); } }
@keyframes ring { 0% { opacity: 0; transform: scale(.4); } 55% { opacity: .9; transform: scale(.9); } 100% { opacity: 0; transform: scale(1.5); } }
@keyframes wave { 0%, 100% { transform: rotate(calc(var(--rot) - 16deg)); } 50% { transform: rotate(calc(var(--rot) + 16deg)); } }

/* ------------------------------------------------------------ side panel */
.titleRow { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: -8px; }
.titleRow h1 { margin: 0; font-size: 34px; line-height: 1.1; }
.box { border-radius: 14px; background: rgba(0,0,0,.38); border: 1px solid var(--line); padding: 18px 22px; }
.scores { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 22px; }
.scores .muted { grid-column: 1 / -1; }
.team .tl { font-size: 12px; color: var(--muted); }
.team .big { font-size: 46px; font-weight: 700; line-height: 1; margin: 6px 0 12px; }
.team .bar { height: 6px; border-radius: 3px; background: #2b2116; width: 100%; max-width: 200px; overflow: hidden; }
.team .bar i { display: block; height: 100%; width: 0; border-radius: 3px; }
.turn { background: rgba(217,168,63,.10); border-color: var(--gold); }
.turn.quietBox { background: rgba(0,0,0,.30); border-color: var(--line); }
.headline { font-size: 24px; font-weight: 600; margin: 4px 0 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.actions:empty { display: none; }
#people { display: flex; flex-direction: column; margin-top: -6px; }
.person { display: grid; grid-template-columns: 24px 1fr 100px 110px; align-items: center; height: 40px; border-bottom: 1px solid #2f2417; }
.person .dot { width: 12px; height: 12px; border-radius: 50%; margin-left: 6px; }
.person .nm { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .nm small { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 4px; }
.person .c { color: var(--muted); font-size: 13px; }
.person.emptySeat .nm { color: #6d5b42; font-weight: 400; font-size: 13px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: -4px; }
.touchOnly { display: none; }
@media (pointer: coarse) {
  .touchOnly { display: flex; }
  .row button { min-height: 48px; border-radius: 12px; font-size: 14px; font-weight: 600; }
}
.help { color: var(--muted); font-size: 12px; margin: 0; }
.help b { color: var(--ink); }
#banner { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); background: #4a1f25; border: 1px solid #7a2c36;
  padding: 8px 16px; border-radius: 10px; z-index: 300; }
