/* ============================================================
   PLAYFABFAB UI 2.0 — clean table layout
   Palette: Black #07040d · Purple #7b2ff7/#a855f7 · Blood red #c1121f/#e11d2e
   ============================================================ */

:root {
  --black: #07040d;
  --black-2: #0d0618;
  --purple: #7b2ff7;
  --purple-hi: #a855f7;
  --purple-deep: #3b1d6e;
  --red: #c1121f;
  --red-hi: #e11d2e;
  --red-deep: #7a0c14;
  --bone: #f5f0e6;
  --ink: #17102a;
  --gold: #f2b705;
  --font-spray: 'Rubik Spray Paint', system-ui, sans-serif;
  --font-marker: 'Permanent Marker', cursive;
  --font-cond: 'Barlow Condensed', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--black);
  color: var(--bone);
  font-family: var(--font-cond);
  overscroll-behavior: none;
}

body::before { /* film grain */
  content: '';
  position: fixed; inset: 0; z-index: 9999; pointer-events: none;
  opacity: .08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.7'/%3E%3C/svg%3E");
}

body::after { /* city glow */
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60% 40% at 50% -10%, rgba(123,47,247,.35), transparent 70%),
    radial-gradient(50% 35% at 85% 110%, rgba(193,18,31,.22), transparent 70%),
    radial-gradient(45% 30% at 10% 105%, rgba(123,47,247,.18), transparent 70%);
}

#app { position: relative; z-index: 1; height: 100dvh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; }

/* ---------- screens ---------- */
.screen { display: none; flex: 1; flex-direction: column; min-height: 0; overflow: hidden; animation: screenIn .35s ease both; }
.screen.active { display: flex; }
@keyframes screenIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- typography ---------- */
.game-title {
  font-family: var(--font-spray);
  font-size: clamp(44px, 13vw, 68px);
  letter-spacing: 2px; line-height: 1; text-align: center;
  margin: 6px 0 14px;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,.6)) drop-shadow(0 0 24px rgba(168,85,247,.45));
  transform: rotate(-2deg);
}
.t-purple { color: var(--purple-hi); }
.t-red { color: var(--red-hi); text-shadow: 0 0 18px rgba(225,29,46,.55); }
.tagline { font-family: var(--font-marker); font-size: clamp(14px, 4vw, 17px); text-align: center; color: #c9b8e8; line-height: 1.6; text-shadow: 0 2px 6px #000; }
.panel-title { font-family: var(--font-spray); font-size: 26px; color: var(--purple-hi); text-align: center; letter-spacing: 1px; margin-bottom: 14px; text-shadow: 0 0 16px rgba(168,85,247,.5); }

/* ---------- home ---------- */
#screen-home { justify-content: center; }
.home-inner { display: flex; flex-direction: column; align-items: center; padding: 24px; gap: 4px; }
.logo-mark { animation: logoFloat 4s ease-in-out infinite; }
.logo-svg { width: 96px; height: 100px; filter: drop-shadow(0 0 22px rgba(225,29,46,.5)); }
.logo-svg.big { width: 108px; height: 112px; }
@keyframes logoFloat { 0%,100% { transform: translateY(0) rotate(-2deg);} 50% { transform: translateY(-8px) rotate(2deg);} }
.home-actions { display: flex; flex-direction: column; gap: 14px; margin-top: 30px; width: 100%; max-width: 320px; }
.home-row { display: flex; gap: 10px; }
.home-row .btn { flex: 1; }
.home-foot { margin-top: 34px; font-size: 14px; letter-spacing: 1.5px; color: #6e5a99; text-transform: uppercase; }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--font-marker); font-size: 16px; letter-spacing: 1px; color: var(--bone);
  background: linear-gradient(150deg, var(--purple) 0%, var(--purple-deep) 100%);
  border: 2px solid var(--purple-hi); border-radius: 16px 5px 16px 5px;
  padding: 12px 20px; cursor: pointer;
  box-shadow: 0 5px 0 #1c0f38, 0 0 20px rgba(123,47,247,.35);
  transition: transform .08s ease, box-shadow .08s ease;
  user-select: none; touch-action: manipulation;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #1c0f38, 0 0 20px rgba(123,47,247,.35); }
.btn-primary { text-shadow: 0 2px 3px rgba(0,0,0,.5); }
.btn-big { font-size: 20px; padding: 16px 24px; }
.btn-danger, .btn-ghost {
  background: linear-gradient(150deg, #1a1030 0%, #0d0819 100%);
  border-color: var(--red);
  box-shadow: 0 5px 0 #2a060a, 0 0 16px rgba(193,18,31,.25);
  color: #e8b4bc;
}
.btn.disabled { opacity: .4; pointer-events: none; filter: grayscale(.5); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px 4px 12px 4px;
  background: #160b28; border: 2px solid var(--purple-deep); color: var(--purple-hi);
  font-size: 18px; cursor: pointer; font-family: var(--font-marker);
}

/* ---------- setup ---------- */
#screen-setup { justify-content: center; padding: 16px; overflow-y: auto; }
.panel {
  background: linear-gradient(170deg, #150a26 0%, #0b0514 100%);
  border: 2px solid var(--purple-deep); border-radius: 22px 8px 22px 8px;
  padding: 22px 18px;
  box-shadow: 0 0 40px rgba(123,47,247,.18), inset 0 0 60px rgba(0,0,0,.5);
  width: 100%; max-width: 420px; margin: 0 auto;
}
.field-label { display: block; font-family: var(--font-marker); font-size: 13px; letter-spacing: 2px; color: var(--red-hi); margin: 16px 0 6px; text-shadow: 0 0 10px rgba(225,29,46,.4); }
.text-input {
  width: 100%; padding: 12px 14px; font-family: var(--font-marker); font-size: 17px;
  background: #0a0612; color: var(--bone); border: 2px solid var(--purple-deep);
  border-radius: 12px 4px 12px 4px; outline: none;
}
.text-input:focus { border-color: var(--purple-hi); box-shadow: 0 0 14px rgba(168,85,247,.4); }
.seg-control { display: flex; gap: 8px; }
.seg-btn {
  flex: 1; padding: 10px 4px; font-family: var(--font-marker); font-size: 15px;
  background: #0d0718; color: #8d7bb5; border: 2px solid var(--purple-deep);
  border-radius: 12px 4px 12px 4px; cursor: pointer; transition: all .15s ease;
}
.seg-btn.active { background: linear-gradient(150deg, var(--purple), var(--purple-deep)); color: #fff; border-color: var(--purple-hi); box-shadow: 0 0 16px rgba(168,85,247,.45); }
.seg-control.small .seg-btn { font-size: 12px; padding: 8px 2px; }
.opt-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.opt-name { font-size: 16px; font-weight: 600; letter-spacing: .5px; color: #cbb8ea; }
.bot-chip {
  display: inline-flex; align-items: center; gap: 6px; margin: 4px 6px 0 0;
  background: #120a22; border: 1px solid var(--purple-deep); border-radius: 10px;
  padding: 5px 10px; font-size: 14px; color: #a78ddb; letter-spacing: .5px;
}
.bot-chip b { color: var(--bone); font-weight: 600; }
.setup-actions { display: flex; gap: 10px; margin-top: 22px; }
.setup-actions .btn-big { flex: 1; }
.fine-print { text-align: center; font-size: 12px; letter-spacing: 1px; color: #5d4b85; margin-top: 12px; text-transform: uppercase; }

/* ============================================================
   GAME SCREEN — UI 2.0
   opponents row / center info / your zone / hand
   ============================================================ */
.game-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 6px;
  background: linear-gradient(180deg, #12081f 0%, transparent 100%);
}
.round-badge { font-family: var(--font-marker); font-size: 15px; letter-spacing: 2px; color: var(--purple-hi); text-shadow: 0 0 12px rgba(168,85,247,.5); }
.wallet-mini {
  display: flex; align-items: center; gap: 5px; font-family: var(--font-marker); font-size: 15px;
  color: var(--gold); background: #160b28; border: 1px solid var(--purple-deep);
  padding: 5px 12px; border-radius: 12px 4px 12px 4px;
}
.coin-ico { color: var(--gold); text-shadow: 0 0 8px rgba(242,183,5,.6); }
.big-ico { font-size: 34px; }
.coin-chip { color: var(--gold); margin-left: 4px; }

/* opponents: a clean row of panels across the top */
.opps-zone {
  display: flex; gap: 8px; padding: 6px 10px 2px;
  overflow-x: auto; scrollbar-width: none; flex: 0 0 auto;
}
.opps-zone::-webkit-scrollbar { display: none; }
.opp {
  flex: 1 1 0; min-width: 100px; max-width: 155px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: rgba(19,10,35,.55);
  border: 1px solid var(--purple-deep);
  border-radius: 14px 5px 14px 5px;
  padding: 6px 4px 7px;
}
.opp.turn { border-color: var(--red-hi); box-shadow: 0 0 18px rgba(225,29,46,.5); }
.opp-id { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-marker); font-size: 14px; color: #fff;
  background: linear-gradient(150deg, var(--purple) 0%, var(--red-deep) 100%);
  border: 2px solid var(--purple-hi);
  text-shadow: 0 1px 2px #000;
}
.opp.turn .avatar { box-shadow: 0 0 0 2px var(--red-hi), 0 0 18px rgba(225,29,46,.7); }
.seat-name { font-family: var(--font-marker); font-size: 11px; letter-spacing: 1px; color: #cbb8ea; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-name .you-tag { color: var(--gold); }
.backs { display: flex; min-height: 18px; }
.card-back-mini {
  width: 15px; height: 21px; margin-left: -5px;
  background: linear-gradient(150deg, var(--purple) 0%, var(--red-deep) 100%);
  border: 1px solid #0a0612; border-radius: 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,.6);
}
.card-back-mini:first-child { margin-left: 0; }

/* played-card rows: every player's open cards, upright, in front of them */
.opp-open { display: flex; align-items: center; min-height: 34px; }
.opp-open .card.mini { width: 28px; }
.opp-open .card.mini + .card.mini { margin-left: -10px; }

/* center info */
.center-zone {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 10px 6px; flex: 0 0 auto;
}
.suit-orb {
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; line-height: 1;
  background: radial-gradient(circle at 35% 30%, #2a1245 0%, #0d0618 75%);
  border: 2px dashed rgba(168,85,247,.5);
  box-shadow: 0 0 26px rgba(168,85,247,.3), inset 0 0 18px rgba(0,0,0,.7);
}
.suit-orb.red { color: var(--red-hi); text-shadow: 0 0 14px rgba(225,29,46,.8); border-color: rgba(225,29,46,.55); }
.suit-orb.black { color: var(--purple-hi); text-shadow: 0 0 14px rgba(168,85,247,.8); }
.control-indicator {
  display: flex; align-items: center; gap: 8px;
  background: rgba(10,6,18,.72); border: 1px solid var(--purple-deep);
  border-radius: 14px 4px 14px 4px; padding: 5px 14px;
}
.ci-label { font-size: 11px; letter-spacing: 2px; color: #6e5a99; font-weight: 700; }
.ci-suit { font-size: 20px; line-height: 1; }
.ci-suit.red { color: var(--red-hi); text-shadow: 0 0 12px rgba(225,29,46,.7); }
.ci-suit.black { color: var(--purple-hi); text-shadow: 0 0 12px rgba(168,85,247,.7); }
.ci-name { font-family: var(--font-marker); font-size: 13px; color: var(--bone); }
.deck-left { font-size: 11px; letter-spacing: 1.5px; color: #8d7bb5; font-weight: 600; text-transform: uppercase; }

/* your zone: your played cards + this round's slot, right above your hand */
.you-zone { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 2px 10px 0; flex: 0 0 auto; min-height: 148px; justify-content: flex-end; }
.you-open { display: flex; align-items: center; min-height: 48px; }
.you-open .card.mini { width: 44px; }
.you-open .card.mini + .card.mini { margin-left: -12px; }

/* the card played this round — slot in front of each player */
.trick-front { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 1px; min-height: 70px; }
.tf-label { font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: #9b86c4; font-weight: 600; }
.tf-label.winning { color: var(--gold); text-shadow: 0 0 8px rgba(242,183,5,.6); }

/* hand bar */
.hand-bar {
  display: flex; align-items: flex-end; justify-content: center; gap: 6px;
  padding: 6px 8px calc(env(safe-area-inset-bottom, 0px) + 6px);
  background: linear-gradient(0deg, rgba(7,4,13,.95) 55%, rgba(7,4,13,0) 100%);
  flex: 0 0 auto;
}
.you-info { min-width: 60px; }
.you-info .seat-name { font-size: 13px; }
.you-info .ctrl-tag { font-family: var(--font-marker); font-size: 10px; color: var(--gold); letter-spacing: 1px; min-height: 14px; display: block; text-shadow: 0 0 8px rgba(242,183,5,.5); }
.hand { display: flex; justify-content: center; padding: 2px 0; }
.hand .card { margin-left: -14px; }
.hand .card:first-child { margin-left: 0; }

.hint-bar {
  margin: 2px 14px 4px; text-align: center;
  font-family: var(--font-marker); font-size: 13px; letter-spacing: 1px;
  color: var(--purple-hi); text-shadow: 0 0 10px rgba(168,85,247,.4);
  min-height: 20px; flex: 0 0 auto;
}
.history-strip {
  display: flex; gap: 6px; overflow-x: auto;
  padding: 0 12px calc(env(safe-area-inset-bottom, 0px) + 8px);
  scrollbar-width: none; flex: 0 0 auto;
}
.history-strip::-webkit-scrollbar { display: none; }
.hist-chip {
  flex: 0 0 auto; font-size: 12px; font-weight: 600; letter-spacing: .5px;
  background: #120a22; border: 1px solid var(--purple-deep); border-radius: 8px;
  padding: 3px 8px; color: #a78ddb;
}
.hist-chip b { color: var(--bone); }
.hist-chip .kura-star { color: var(--red-hi); }

/* ---------- cards ---------- */
.card {
  position: relative;
  width: clamp(46px, 13vw, 62px);
  aspect-ratio: 5/7;
  background: linear-gradient(160deg, #fffdf7 0%, var(--bone) 100%);
  border: 2px solid #0a0612;
  border-radius: 9px;
  box-shadow: 0 3px 8px rgba(0,0,0,.55);
  cursor: pointer;
  display: flex; flex-direction: column;
  font-family: var(--font-cond); font-weight: 700; color: var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, filter .15s ease;
  user-select: none; touch-action: manipulation;
}
.card .corner { position: absolute; top: 4px; left: 5px; line-height: .95; text-align: center; font-size: clamp(12px, 3.4vw, 16px); }
.card .corner small { display: block; font-size: .85em; }
.card .pip { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: clamp(22px, 6.4vw, 32px); opacity: .9; }
.card.red { color: var(--red); }
.card.illegal { filter: grayscale(.75) brightness(.55); cursor: not-allowed; }
.card.illegal::after {
  content: '✕'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--red-hi); font-size: 22px; opacity: .8; text-shadow: 0 0 8px #000;
}
.card.legal { box-shadow: 0 0 0 2px var(--purple-hi), 0 0 18px rgba(168,85,247,.55), 0 3px 8px rgba(0,0,0,.55); }
.card.legal:active { transform: translateY(-8px) scale(1.05); }
.card.card-back {
  background: radial-gradient(circle at 50% 42%, rgba(225,29,46,.9) 0%, rgba(225,29,46,0) 34%),
    linear-gradient(150deg, var(--purple) 0%, var(--red-deep) 100%);
  border-color: var(--purple-hi);
}
.card.mini { width: 28px; cursor: default; border-width: 1px; border-radius: 5px; box-shadow: 0 2px 4px rgba(0,0,0,.55); transition: none; }
.card.mini .corner { font-size: 9px; top: 2px; left: 3px; }
.card.mini .pip { font-size: 13px; }
.card.tcard { width: 40px; cursor: default; }
.card.tcard .corner { font-size: 10px; }
.card.tcard .pip { font-size: 18px; }
.you-zone .card.tcard { width: 54px; }
.you-zone .card.tcard .corner { font-size: 13px; }
.you-zone .card.tcard .pip { font-size: 24px; }
.card.tcard.winning { box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(242,183,5,.7), 0 3px 8px rgba(0,0,0,.55); }

/* turn arrow + timer badge */
.turn-arrow {
  display: none; font-size: 16px; color: var(--gold); line-height: 1;
  text-shadow: 0 0 12px rgba(242,183,5,.9);
  animation: arrowBounce .6s ease-in-out infinite alternate;
}
.opp.turn .turn-arrow, .you-zone .turn-on { display: block; }
@keyframes arrowBounce { from { opacity: .55; } to { opacity: 1; } }
.timer-badge {
  display: none; min-width: 22px; height: 22px; padding: 0 3px; border-radius: 50%;
  background: linear-gradient(150deg, var(--red-hi), var(--red-deep));
  color: #fff; font-family: var(--font-marker); font-size: 12px; line-height: 22px; text-align: center;
  box-shadow: 0 0 14px rgba(225,29,46,.8);
  animation: timerPulse .45s ease-in-out infinite alternate;
}
.timer-badge.show { display: block; }
@keyframes timerPulse { from { transform: scale(1); } to { transform: scale(1.28); } }

/* ---------- overlays / modals ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: none;
  align-items: center; justify-content: center; padding: 18px;
  background: rgba(4,2,9,.82); backdrop-filter: blur(4px);
}
.overlay.active { display: flex; animation: screenIn .25s ease both; }
.modal-panel { max-height: 86dvh; display: flex; flex-direction: column; }
.rules-scroll { overflow-y: auto; padding-right: 4px; margin-bottom: 14px; }
.rules-scroll h3 { font-family: var(--font-marker); font-size: 15px; color: var(--red-hi); letter-spacing: 2px; margin: 14px 0 4px; }
.rules-scroll p { font-size: 16px; line-height: 1.5; color: #d5c8ee; margin-bottom: 4px; }
.rules-scroll b { color: var(--purple-hi); }

/* result */
.result-panel { text-align: center; }
.result-logo { display: flex; justify-content: center; animation: logoFloat 3s ease-in-out infinite; }
.result-title {
  font-family: var(--font-spray); font-size: clamp(28px, 8vw, 44px); letter-spacing: 2px;
  color: var(--gold); text-shadow: 0 0 30px rgba(242,183,5,.5), 0 4px 0 #000;
  transform: rotate(-2deg); margin: 8px 0 4px;
}
.result-title.lose { color: var(--red-hi); text-shadow: 0 0 30px rgba(225,29,46,.5), 0 4px 0 #000; }
.kura-banner {
  display: none; font-family: var(--font-marker); letter-spacing: 2px; font-size: 16px;
  color: #fff; background: linear-gradient(90deg, var(--purple) 0%, var(--red) 100%);
  border-radius: 10px; padding: 8px 14px; margin: 8px 0;
  box-shadow: 0 0 26px rgba(225,29,46,.5);
  animation: kuraPulse 1s ease-in-out infinite;
}
.kura-banner.show { display: block; }
@keyframes kuraPulse { 50% { box-shadow: 0 0 44px rgba(168,85,247,.8); transform: scale(1.03); } }
.result-sub { font-size: 17px; color: #cbb8ea; margin: 6px 0; }
.coin-delta { font-family: var(--font-marker); font-size: 30px; color: var(--gold); text-shadow: 0 0 16px rgba(242,183,5,.55); margin: 10px 0 18px; }
.coin-delta.negative { color: var(--red-hi); text-shadow: 0 0 16px rgba(225,29,46,.55); }
.result-actions { display: flex; flex-direction: column; gap: 10px; }

/* wallet */
.wallet-balance { display: flex; align-items: baseline; justify-content: center; gap: 8px; font-family: var(--font-marker); font-size: 42px; color: var(--gold); text-shadow: 0 0 20px rgba(242,183,5,.5); }
.wallet-balance small { font-size: 13px; letter-spacing: 2px; color: #8d7bb5; }
.wallet-id { text-align: center; font-size: 14px; letter-spacing: 1px; color: #9b86c4; margin: 6px 0 12px; }
.wallet-id b { color: var(--purple-hi); }
.wallet-tx { max-height: 150px; overflow-y: auto; margin-bottom: 12px; }
.tx-row { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 10px; border-bottom: 1px dashed #2a1747; color: #cbb8ea; }
.tx-row .plus { color: var(--gold); } .tx-row .minus { color: var(--red-hi); }
.wallet-actions { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.wallet-actions .btn { font-size: 13px; padding: 10px; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 18%; transform: translateX(-50%) translateY(20px);
  background: linear-gradient(150deg, #1c0f38, #0d0718);
  border: 2px solid var(--red); color: var(--bone);
  font-family: var(--font-marker); font-size: 14px; letter-spacing: 1px;
  padding: 10px 18px; border-radius: 14px 4px 14px 4px;
  opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 100;
  box-shadow: 0 0 24px rgba(225,29,46,.4); max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 480px) {
  .hand .card { margin-left: -10px; }
}

/* ============================================================
   UI 3.0 — graffiti oval table (reference build)
   ============================================================ */
.game-topbar { gap: 8px; }
.gt-mid { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.gt-title {
  font-family: var(--font-spray); font-size: 17px; letter-spacing: 1px;
  color: var(--purple-hi); text-shadow: 0 0 14px rgba(168,85,247,.65), 0 2px 0 #000;
}
.gt-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.bet-btns { display: flex; gap: 4px; }
.bet-btn {
  font-family: var(--font-marker); font-size: 10px; letter-spacing: 1px;
  padding: 4px 9px; cursor: pointer; color: #f3c9cf;
  background: linear-gradient(150deg, #4a0d15, #1c060a);
  border: 1.5px solid var(--red-hi); border-radius: 8px 3px 8px 3px;
  box-shadow: 0 2px 0 #2a060a;
}
.bet-btn:active { transform: translateY(2px); box-shadow: none; }

.table-oval {
  position: relative; flex: 1 1 auto; min-height: 0;
  margin: 4px 12px; border-radius: 50% / 46%;
  background: radial-gradient(ellipse 95% 85% at 50% 42%, #2c1549 0%, #190b2c 55%, #0c0516 100%);
  border: 3px solid #241243;
  box-shadow: inset 0 0 90px rgba(0,0,0,.8), inset 0 16px 44px rgba(168,85,247,.10), 0 0 44px rgba(123,47,247,.28);
  overflow: visible;
}
.oval-felt {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 6px rgba(0,0,0,.35), inset 0 2px 18px rgba(255,255,255,.05);
}
.oval-tags {
  position: absolute; inset: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.tag { font-family: var(--font-spray); line-height: 1; white-space: nowrap; }
.tag-purple {
  font-size: clamp(40px, 13vw, 68px); transform: rotate(-7deg) translateY(-8%);
  color: rgba(168,85,247,.32); text-shadow: 0 0 34px rgba(168,85,247,.45), 0 4px 0 rgba(0,0,0,.4);
}
.tag-red {
  font-size: clamp(26px, 8vw, 42px); transform: rotate(5deg) translate(24%, 52%);
  color: rgba(225,29,46,.30); text-shadow: 0 0 28px rgba(225,29,46,.4);
}
.table-center-mini {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 1;
}

.seat2 {
  position: absolute; transform: translate(-50%, -50%);
  width: 136px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  z-index: 2;
}
.seat2.you { flex-direction: column-reverse; }
.seat2.turn .avatar { box-shadow: 0 0 0 2px var(--red-hi), 0 0 20px rgba(225,29,46,.75); }
.seat2 .avatar { width: 36px; height: 36px; border: 2px solid var(--purple-hi); }
.seat2.you .avatar { width: 42px; height: 42px; }

.fan { position: relative; width: 100%; height: 58px; }
.fan .card.mini {
  position: absolute; left: 50%; top: 0; margin-left: -15px;
  transform-origin: 50% 165%;
  width: 30px; border-radius: 5px;
}
.fan .card.mini .corner { font-size: 8px; top: 2px; left: 3px; }
.fan .card.mini .pip { font-size: 12px; }
.seat2.you .fan { height: 66px; }
.seat2.you .fan .card.mini { width: 38px; margin-left: -19px; }
.seat2.you .fan .card.mini .corner { font-size: 10px; }
.seat2.you .fan .card.mini .pip { font-size: 16px; }

.tcard-slot { min-height: 66px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 1px; }
.seat2.you .tcard-slot { min-height: 78px; }
.card.tcard { width: 38px; }
.card.tcard .corner { font-size: 10px; }
.card.tcard .pip { font-size: 16px; }
.seat2.you .card.tcard { width: 54px; }
.seat2.you .card.tcard .corner { font-size: 13px; }
.seat2.you .card.tcard .pip { font-size: 24px; }
.seat2 .backs { min-height: 16px; }
.seat2 .card-back-mini { width: 14px; height: 19px; margin-left: -5px; }

/* ============ UI 3.1 — multiplayer room ============ */
.mp-head { display: flex; align-items: center; justify-content: space-between; padding: calc(env(safe-area-inset-top, 0px) + 8px) 12px 6px; }
.mp-body { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 18px 20px; overflow-y: auto; }
#mp-join-form { width: 100%; max-width: 300px; display: flex; flex-direction: column; gap: 4px; }
.mp-code-input { text-align: center; font-size: 26px; letter-spacing: 8px; }
.mp-or { text-align: center; font-family: var(--font-marker); color: #6e5a99; margin: 10px 0; font-size: 13px; }
.mp-code {
  font-family: var(--font-spray); font-size: 64px; letter-spacing: 8px; color: var(--gold);
  text-shadow: 0 0 30px rgba(242,183,5,.5), 0 4px 0 #000; cursor: pointer; transform: rotate(-2deg);
}
.mp-code-sub { font-size: 13px; color: #8d7bb5; margin: 6px 0 18px; }
.mp-code-sub a { color: var(--purple-hi); }
.mp-seats-label { font-family: var(--font-marker); font-size: 12px; letter-spacing: 2px; color: var(--red-hi); margin-bottom: 10px; }
.mp-roster { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 6px; }
.mp-row {
  display: flex; align-items: center; gap: 10px;
  background: rgba(19,10,35,.55); border: 1px solid var(--purple-deep);
  border-radius: 12px 4px 12px 4px; padding: 10px 12px;
}
.mp-row.empty { opacity: .45; border-style: dashed; }
.mp-row.off .mp-name { color: #6e5a99; }
.mp-dot { width: 10px; height: 10px; border-radius: 50%; background: #2a1747; flex: 0 0 auto; }
.mp-dot.on { background: #38d06b; box-shadow: 0 0 8px rgba(56,208,107,.7); }
.mp-name { flex: 1; font-family: var(--font-marker); font-size: 15px; }
.mp-name b { color: var(--gold); }
.mp-host { font-size: 9px; letter-spacing: 1px; color: #fff; background: linear-gradient(90deg, var(--purple), var(--red)); border-radius: 5px; padding: 1px 5px; margin-left: 4px; }
.mp-seat { font-size: 12px; color: #8d7bb5; letter-spacing: 1px; }
.mp-status { margin-top: 16px; font-family: var(--font-marker); font-size: 12px; letter-spacing: 1px; color: var(--purple-hi); text-align: center; }

/* multiplayer room: deal button + chat */
.mp-chat {
  width: 100%; max-width: 340px; margin-top: 14px; max-height: 140px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  background: rgba(10,6,18,.5); border: 1px solid var(--purple-deep);
  border-radius: 12px 4px 12px 4px; padding: 8px 10px;
}
.mp-msg { font-size: 14px; color: #cbb8ea; }
.mp-msg b { color: var(--purple-hi); font-weight: 600; }
.mp-msg.mine b { color: var(--gold); }
.mp-chat-row { display: flex; gap: 6px; width: 100%; max-width: 340px; margin-top: 8px; }
.mp-chat-row .text-input { flex: 1; padding: 8px 12px; font-size: 14px; }
.mp-chat-row .btn { padding: 8px 14px; font-size: 13px; }
.modal-field { margin: 4px 0 14px; }
#overlay-name .btn-primary { width: 100%; }
.mp-row.self { box-shadow: inset 3px 0 0 #e8b84b; }
.gate-err { display: none; color: #ff9c9c; font-size: 13px; margin-top: 10px; text-align: center; }
#overlay-gate .panel-sub { text-align: center; font-size: 13px; opacity: .85; margin-bottom: 10px; }
.mp-bal { font-size: 12px; opacity: .8; margin-left: auto; }
.mp-bal.broke { color: #ff8080; opacity: 1; font-weight: 700; }
