/* ============================================================
   PvP Blackjack — "Ember" theme
   All motion durations are multiplied by --anim (set from the
   "Animation speed" slider; ~0 = instant).
   ============================================================ */
:root {
  --bg: #120c0a;
  --bg-deep: #0d0807;
  --surface: #1b1311;
  --surface-2: #231916;
  --surface-3: #2a1d18;
  --hover: #3a2820;
  --line: rgba(255, 170, 130, .12);
  --line-2: rgba(255, 170, 130, .14);
  --ink: #f7efe9;
  --ink-2: #cdbab0;
  --muted: #a8968c;
  --faint: #7d6c63;
  --accent: #ff6a3d;
  --accent-ink: #1a0b05;
  --accent-deep: #a3260f;
  --win: #4fd18b;
  --lose: #ff7a7a;
  --bust: #ff5c5c;
  --gold: #ffc857;
  --red-suit: #c8283d;
  --black-suit: #16181d;
  --card-face: linear-gradient(160deg, #fffdf6, #f1ead8);
  --card-back: radial-gradient(circle, #f7efe9 0 8%, transparent 9%), repeating-linear-gradient(45deg, #ff6a3d 0 6px, #d4552a 6px 12px);
  --glow: 0 10px 30px rgba(255, 106, 61, .35);
  --card-w: 100px;
  --font: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --anim: 1;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
/* keep the scrollbar's space reserved on every screen, so switching between a
   long page and a short one (e.g. matchmaking) never shifts the layout */
html { scrollbar-gutter: stable; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
input { font: inherit; color: inherit; }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=number] { -moz-appearance: textfield; }
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
[hidden] { display: none !important; }

#app { position: relative; min-height: 100vh; overflow: clip; } /* the 8px slide-in of a new screen must never make the page scroll */
.screen { animation: screen-in calc(.3s * var(--anim)) ease both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } }
.page { margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 22px; padding: 22px 28px 48px; }
.page-home { max-width: 1360px; }
.page-bot { max-width: 1040px; gap: 26px; }
.page-pvp { max-width: 1120px; }

/* ---------------------------------------------------------- shared bits */
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -.03em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.ink { color: var(--ink); }
.accent { color: var(--accent); }
.small { font-size: .85rem; }
.center { text-align: center; }
.label { font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.kicker { margin: 0; font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--accent); font-weight: 800; }
.pos { color: var(--win); } .neg { color: var(--lose); }

.panel { background: var(--surface); border-radius: 22px; padding: 20px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-title { font-size: 1.35rem; letter-spacing: -.03em; display: flex; align-items: baseline; gap: 8px; }
.panel > .panel-title { margin-bottom: 16px; }
.panel-title.small { font-size: 1.15rem; letter-spacing: -.02em; }

/* buttons */
.btn { border: 0; border-radius: 14px; padding: 12px 18px; font-weight: 800; letter-spacing: .02em; transition: transform .15s ease, filter .15s ease, opacity .15s, background .15s, color .15s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .4; }
.btn-gold { background: var(--accent); color: var(--accent-ink); }
.btn-gold:hover:not(:disabled) { filter: brightness(1.08); }
.btn-glow { box-shadow: var(--glow); }
.btn-glow:hover:not(:disabled) { transform: translateY(-2px); }
.btn-ghost { background: var(--surface-3); color: var(--ink); font-weight: 700; }
.btn-ghost:hover:not(:disabled) { background: var(--hover); }
.btn-outline { background: none; border: 1px solid rgba(247, 239, 233, .2); font-weight: 700; letter-spacing: .04em; }
.btn-outline:hover:not(:disabled) { background: rgba(247, 239, 233, .06); }
.btn-red { background: none; border: 1px solid rgba(255, 92, 92, .45); color: var(--lose); }
.btn-red:hover:not(:disabled) { background: rgba(255, 92, 92, .12); color: #ff9a9a; }
.btn-green { background: var(--win); color: #06210f; }
.btn-green:hover:not(:disabled) { filter: brightness(1.08); }
.btn-block { width: 100%; }
.btn-big { padding: 15px; font-size: 1.05rem; }
.btn-huge { padding: 18px; font-size: 1.15rem; border-radius: 16px; letter-spacing: .04em; }
.btn-small { padding: 8px 14px; font-size: .85rem; border-radius: 10px; }
.btn-tiny { padding: 6px 10px; font-size: .75rem; border-radius: 9px; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); font-size: 1.1rem; display: grid; place-items: center; transition: transform .4s, border-color .15s; }
.icon-btn:hover { border-color: var(--accent); }
.icon-btn.cog:hover { transform: rotate(90deg); }
.pill-btn { height: 42px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; white-space: nowrap; transition: border-color .15s; }
.pill-btn:hover { border-color: var(--accent); }
.pill-btn .q { color: var(--accent); font-weight: 800; }
.link-btn { background: none; border: 0; padding: 0; color: var(--ink); font-weight: 700; transition: color .15s; }
.link-btn:hover { color: var(--accent); }

/* chip icon */
.coin { display: inline-block; width: 1em; height: 1em; vertical-align: -.14em; margin-right: .3em; flex: none; background: url("img/chip.svg") center / contain no-repeat; }
.coins { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; display: inline-flex; align-items: center; }

.avatar { width: 38px; height: 38px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; flex: none; background: var(--accent); color: var(--accent-ink); }
.avatar.sq { border-radius: 12px; }
.avatar.small { width: 30px; height: 30px; border-radius: 9px; font-size: .85rem; }
.avatar.big { width: 68px; height: 68px; border-radius: 20px; font-size: 1.7rem; }
.avatar.bot-avatar { background: var(--surface-3); padding: 3px; }
.avatar .robot-icon { width: 100%; height: 100%; display: block; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #4a3a33; flex: none; display: inline-block; }
.dot.online { background: var(--win); box-shadow: 0 0 0 3px rgba(79, 209, 139, .2); }
.dot.playing { background: var(--gold); box-shadow: 0 0 0 3px rgba(255, 200, 87, .2); }

.form-error { color: var(--lose); min-height: 1.2em; margin: 0; font-size: .88rem; }
.hint { color: var(--muted); font-size: .88rem; text-align: center; margin: 0; }
.hint strong { color: var(--ink); }
.empty { color: var(--muted); text-align: center; padding: 14px 8px; list-style: none; font-size: .9rem; }
.callout { margin: 0; padding: 12px 14px; border-radius: 14px; background: rgba(255, 106, 61, .1); border: 1px solid rgba(255, 106, 61, .28); color: var(--ink-2); line-height: 1.45; }
.callout.small { padding: 10px 12px; font-size: .85rem; border-radius: 12px; }
.callout b { color: var(--ink); }
.callout b.accent { color: var(--accent); }

/* one dark "pill" holding an input + button (add friend, chats) */
.inline-form { display: flex; gap: 6px; padding: 5px; border-radius: 14px; background: var(--bg); }
.inline-form input { flex: 1; min-width: 0; background: none; border: 0; padding: 8px 10px; font-size: .9rem; outline: none; }
.inline-form .btn { padding: 0 16px; font-size: .85rem; }

/* header */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.topbar-3 { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; }
.topbar-3 > :first-child { justify-self: start; }
.topbar-3 > :last-child { justify-self: end; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.screen-title { font-size: 1.5rem; }
.profile-btn { display: flex; align-items: center; gap: 10px; background: none; border: 1px solid transparent; border-radius: 14px; padding: 4px 14px 4px 4px; text-align: left; transition: background .15s, border-color .15s; }
.profile-btn:hover { background: var(--surface); border-color: var(--line); }
.profile-btn .avatar { width: 40px; height: 40px; font-size: 1.05rem; }
.profile-btn-text { display: flex; flex-direction: column; line-height: 1.1; }
.profile-btn-text small { color: var(--muted); font-size: .75rem; }
.balance-pill { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 12px; background: var(--surface); font-weight: 800; font-variant-numeric: tabular-nums; }
.balance-pill .coin { width: 18px; height: 18px; margin: 0; }

/* ---------------------------------------------------------- logo */
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; line-height: 1; white-space: nowrap; user-select: none; }
.logo-pvp { font-size: 2.1rem; letter-spacing: -.02em; padding: .08em .34em .12em; border-radius: .3em; background: var(--accent); color: var(--accent-ink); transform: rotate(-4deg); box-shadow: 0 6px 18px rgba(255, 106, 61, .35); }
.logo-word { font-size: 1.9rem; letter-spacing: -.04em; }
.logo-suit { font-size: 1.3rem; color: var(--muted); }
.logo-suit.accent { color: var(--accent); }
.logo-dark .logo-pvp { font-size: 1.8rem; background: var(--accent-ink); color: var(--accent); box-shadow: none; }
.logo-dark .logo-word { font-size: 1.6rem; }
.logo-dark .logo-suit { color: var(--accent-ink); }

/* ---------------------------------------------------------- ambient motion */
.ember { position: absolute; bottom: -10px; border-radius: 50%; pointer-events: none; animation: rise 4s ease-in infinite both; }
.ember.small { animation-name: rise-small; }
@keyframes rise { 0% { transform: translateY(0) scale(1); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-420px) scale(.3); opacity: 0; } }
@keyframes rise-small { 0% { transform: translateY(0) scale(1); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-260px) scale(.3); opacity: 0; } }
@keyframes flameFlick { 0%, 100% { opacity: .5; } 50% { opacity: .9; } }
@keyframes flameFlickScale { 0%, 100% { opacity: .55; transform: scale(1); } 50% { opacity: .85; transform: scale(1.08); } }
@keyframes floatA { 0%, 100% { transform: translate(0, 0) rotate(-14deg); } 50% { transform: translate(-6px, -16px) rotate(-10deg); } }
@keyframes floatB { 0%, 100% { transform: translate(0, 0) rotate(12deg); } 50% { transform: translate(6px, -12px) rotate(16deg); } }
@keyframes pvpFloatA { 0%, 100% { transform: translate(0, 0) rotate(-14deg); } 50% { transform: translate(-3px, -8px) rotate(-10deg); } }
@keyframes pvpFloatB { 0%, 100% { transform: translate(0, 0) rotate(12deg); } 50% { transform: translate(3px, -6px) rotate(16deg); } }
@keyframes drift { to { background-position: 120px 120px; } }
@keyframes wiggle { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
@keyframes vsPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 106, 61, .55), 0 20px 50px rgba(0, 0, 0, .6); } 50% { box-shadow: 0 0 0 18px rgba(255, 106, 61, 0), 0 20px 50px rgba(0, 0, 0, .6); } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.96); } }
@keyframes podium { from { transform: scaleY(0); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(14px); } }

/* ---------------------------------------------------------- auth */
.auth-screen { min-height: 100vh; display: flex; flex-wrap: wrap; }
.auth-hero { position: relative; overflow: hidden; flex: 1 1 420px; min-height: 420px; padding: 40px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(150deg, #ff6a3d, #a3260f 60%, #4a0f05); }
.hero-glow { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 110%, rgba(255, 220, 150, .55), transparent 60%); animation: flameFlick 2.6s ease-in-out infinite; pointer-events: none; }
.auth-hero .logo { position: relative; }
.hero-cards { position: relative; height: 260px; }
.big-card { position: absolute; top: 20px; left: calc(50% - 130px); width: 150px; height: 210px; border-radius: 16px; padding: 14px; background: var(--card-face); color: var(--black-suit);
  box-shadow: 0 30px 60px rgba(0, 0, 0, .45); font-weight: 800; font-size: 30px; line-height: 1; animation: floatA 6s ease-in-out infinite; }
.big-card > span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 72px; }
.big-card.red { color: var(--red-suit); left: calc(50% - 10px); top: 30px; transform: rotate(12deg); animation: floatB 6.5s ease-in-out .5s infinite both; }
.hero-line { position: relative; margin: 0; font-size: clamp(2.4rem, 4.5vw, 3.8rem); font-weight: 800; letter-spacing: -.045em; line-height: .92; }
.hero-line span { color: var(--accent-ink); }
.auth-side { flex: 1 1 420px; display: grid; place-items: start center; padding: max(40px, calc(50vh - 330px)) 28px 40px; } /* top-anchored: switching tabs never moves the form */
.auth-form { width: min(400px, 100%); display: flex; flex-direction: column; gap: 16px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.auth-form input:not([type=checkbox]) { background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; padding: 13px 14px; font-size: 1rem; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; }
.auth-form input:not([type=checkbox]):focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 106, 61, .18); }
.auth-heading { margin-top: 8px; font-size: 2.2rem; letter-spacing: -.04em; line-height: 1; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-radius: 14px; padding: 4px; }
.tab { border: 0; background: transparent; padding: 11px; border-radius: 11px; color: var(--faint); font-weight: 700; transition: background .2s, color .2s; }
.tab.active { background: var(--surface-3); color: var(--ink); }
.auth-form .form-error { min-height: 1.2em; }
.shake { animation: shake .4s ease; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* ---------------------------------------------------------- home: mode hero */
.mode-hero { position: relative; display: flex; height: 340px; border-radius: 28px; overflow: hidden; background: var(--bg-deep); }
.mode-half { position: relative; flex: 1; border: 0; padding: 0; overflow: hidden; color: var(--ink); transition: flex .55s var(--ease); }
.mode-bot { margin-right: -40px; clip-path: polygon(0 0, 100% 0, calc(100% - 80px) 100%, 0 100%); text-align: left; background: #24170f; }
.mode-pvp { margin-left: -40px; clip-path: polygon(80px 0, 100% 0, 100% 100%, 0 100%); text-align: right; background: linear-gradient(140deg, #ff6a3d, #a3260f 70%, #5c1206); }
.mode-hero:has(.mode-bot:hover) .mode-bot, .mode-hero:has(.mode-pvp:hover) .mode-pvp { flex: 1.45; }
.dotgrid { position: absolute; inset: 0; opacity: .5; background-image: radial-gradient(rgba(255, 170, 130, .18) 1.5px, transparent 1.6px); background-size: 24px 24px; animation: drift 8s linear infinite; }
.bot-glow { position: absolute; inset: 0; background: radial-gradient(ellipse at 20% 100%, rgba(255, 106, 61, .25), transparent 60%); }
.pvp-glow { position: absolute; inset: 0; background: radial-gradient(ellipse at 80% 110%, rgba(255, 220, 150, .5), transparent 55%); animation: flameFlickScale 2.4s ease-in-out infinite; }
.mode-content { position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; gap: 14px; padding: 34px 120px 34px 36px; }
.mode-pvp .mode-content { align-items: flex-end; padding: 34px 36px 34px 120px; }
.mode-icon { width: 68px; height: 68px; border-radius: 20px; background: rgba(0, 0, 0, .35); display: grid; place-items: center; }
.mode-icon svg { width: 50px; height: 50px; animation: wiggle 3s ease-in-out infinite; }
.mode-title { font-size: clamp(2rem, 3.4vw, 3rem); font-weight: 800; letter-spacing: -.04em; line-height: .95; }
.mode-sub { color: var(--ink-2); font-size: .95rem; max-width: 300px; }
.mode-pvp .mode-sub { color: #ffe3d6; }
.mode-cta { align-self: flex-start; display: inline-flex; align-items: center; gap: 10px; padding: 12px 20px; border-radius: 14px; background: var(--ink); color: var(--accent-ink); font-weight: 800; letter-spacing: .14em; font-size: .88rem; transition: transform .2s var(--ease); }
.mode-cta span { font-size: 1.1rem; }
.mode-pvp .mode-cta { align-self: flex-end; background: var(--accent-ink); color: var(--ink); }
.mode-half:hover .mode-cta { transform: translateX(4px); }
.pvp-cards { position: relative; width: 110px; height: 96px; margin-bottom: 10px; top: -14px; }
.mini-card { position: absolute; left: 0; top: 10px; width: 56px; height: 78px; border-radius: 7px; padding: 5px 6px; text-align: left; background: var(--card-face); color: var(--black-suit);
  box-shadow: 0 12px 24px rgba(0, 0, 0, .45); font-weight: 800; font-size: 14px; line-height: 1; animation: pvpFloatA 4.4s ease-in-out infinite; }
.mini-card > span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; }
.mini-card.red { left: 46px; top: 14px; color: var(--red-suit); transform: rotate(12deg); animation: pvpFloatB 4.8s ease-in-out .4s infinite both; }
.medallion { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -62%); z-index: 3; width: 190px; height: 190px; border-radius: 50%; background: var(--bg); border: 3px solid var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; animation: vsPulse 2.6s ease-out infinite; transition: left .55s var(--ease); }
.mode-hero:has(.mode-bot:hover) .medallion { left: 59%; }
.mode-hero:has(.mode-pvp:hover) .medallion { left: 41%; }
.medallion .label { font-size: .66rem; letter-spacing: .2em; }
.medallion .coins { font-size: 1.9rem; letter-spacing: -.03em; gap: 6px; }
.medallion .coin { width: 24px; height: 24px; margin: 0; }
.bailout { margin-top: 4px; border: 0; border-radius: 99px; padding: 5px 10px; font-size: .68rem; font-weight: 800; background: var(--accent); color: var(--accent-ink); }
.bailout:hover { filter: brightness(1.08); }

/* ---------------------------------------------------------- home: panels */
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(310px, 1fr)); gap: 18px; align-items: start; }
.side-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* underline tabs (leaderboard) */
.utabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 1px solid rgba(255, 170, 130, .1); }
.utabs .seg-btn { border: 0; background: none; padding: 8px 10px 10px; color: var(--faint); font-weight: 700; font-size: .82rem; border-bottom: 2px solid transparent; margin-bottom: -1px; border-radius: 0; transition: color .2s, border-color .2s; }
.utabs .seg-btn:hover { color: var(--ink-2); }
.utabs .seg-btn.active { color: var(--ink); border-bottom-color: var(--accent); }

/* segmented tabs (requests) */
.seg { display: inline-flex; background: var(--bg); border-radius: 12px; padding: 4px; gap: 2px; }
.seg .seg-btn { border: 0; background: transparent; padding: 6px 10px; border-radius: 9px; color: var(--faint); font-weight: 700; font-size: .78rem; display: flex; align-items: center; gap: 5px; transition: background .2s, color .2s; }
.seg .seg-btn.active { background: var(--surface-3); color: var(--ink); }
.seg-count { opacity: .75; }
.seg-btn.has-new:not(.active)::after { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* podium */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 8px; margin-bottom: 14px; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; cursor: pointer; background: none; border: 0; padding: 0; }
.pod.empty-slot { cursor: default; opacity: .35; }
.pod-av { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--surface-3); border: 2px solid var(--medal); animation: popIn calc(.5s * var(--anim)) ease both; }
.pod-name { font-size: .85rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pod-val { display: flex; align-items: center; gap: 4px; font-size: .78rem; font-weight: 700; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.pod-val .coin { width: 13px; height: 13px; margin: 0; }
.pod-bar { width: 100%; border-radius: 12px 12px 4px 4px; background: var(--medal); display: grid; place-items: start center; padding-top: 8px; font-weight: 800; font-size: 1.3rem; color: var(--accent-ink);
  transform-origin: bottom; animation: podium calc(.7s * var(--anim)) var(--ease) both; }
.pod.r1 { --medal: #ffd76a; } .pod.r1 .pod-bar { height: 96px; background: var(--accent); }
.pod.r2 { --medal: #d9dee3; } .pod.r2 .pod-bar { height: 70px; }
.pod.r3 { --medal: #e1a26b; } .pod.r3 .pod-bar { height: 54px; }
.pod:not(.empty-slot):hover .pod-name { color: var(--accent); }
.pod.me .pod-name { color: var(--accent); }

/* ranks 4+ : 7 rows visible (10 incl. podium), scroll to 50 */
.leaderboard { list-style: none; margin: 0; padding: 0 4px 0 0; display: grid; gap: 2px; grid-auto-rows: 40px; max-height: 294px; overflow-y: auto; }
.lb-row { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 0 10px; border-radius: 10px; cursor: pointer; transition: background .15s; }
.lb-row:hover { background: var(--surface-3); }
.lb-row.me { background: rgba(255, 106, 61, .12); }
.lb-rank { font-weight: 700; color: var(--faint); font-variant-numeric: tabular-nums; }
.lb-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name small { color: var(--faint); font-weight: 500; margin-left: 6px; }
.lb-value { display: flex; align-items: center; gap: 5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-value .coin { width: 14px; height: 14px; margin: 0; }
.leaderboard .empty { grid-row: span 2; }

/* recent games */
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hist-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); animation: popIn calc(.4s * var(--anim)) ease both; }
.hist-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .95rem; min-width: 0; }
.hist-main .robot-icon { width: 18px; height: 18px; }
.hist-sub { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: .8rem; flex-wrap: wrap; }
.hist-row .net { grid-column: 2; grid-row: 1 / span 2; font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; color: var(--muted); }
.hist-row .net.pos { color: var(--win); } .hist-row .net.neg { color: var(--lose); }
.pill { font-size: .66rem; font-weight: 800; letter-spacing: .1em; padding: 4px 8px; border-radius: 99px; }
.pill.win { background: rgba(79, 209, 139, .15); color: var(--win); }
.pill.lose { background: rgba(255, 92, 92, .15); color: var(--lose); }
.pill.tie { background: rgba(255, 200, 87, .15); color: var(--gold); }
.friendly-tag { color: var(--ink-2); border: 1px dashed rgba(255, 170, 130, .3); border-radius: 6px; padding: 1px 6px; font-size: .7rem; font-weight: 600; white-space: nowrap; }

/* friends */
.online-count { color: var(--win); font-size: .82rem; font-weight: 600; letter-spacing: 0; }
.online-count.zero { color: var(--muted); }
.help-btn { width: 30px; height: 30px; border-radius: 10px; border: 0; background: var(--surface-3); color: var(--accent); font-weight: 800; }
.help-btn:hover { background: var(--hover); }
.add-friend { margin-bottom: 12px; }
.friend-list { list-style: none; margin: 0; padding: 0 4px 0 0; display: grid; gap: 2px; grid-auto-rows: 52px; max-height: 270px; overflow-y: auto; }
.friend-list .empty { grid-row: span 2; }
.friend-row { display: flex; align-items: center; gap: 10px; padding: 0 6px; border-radius: 12px; transition: background .15s; }
.friend-row:hover { background: var(--surface-2); }
.star-btn { width: 22px; border: 0; background: none; padding: 0; font-size: 1rem; color: #4a3a33; flex: none; transition: color .15s, transform .15s; }
.star-btn:hover { color: var(--gold); transform: scale(1.15); }
.star-btn.on { color: var(--gold); }
.f-av { flex: none; width: 36px; height: 36px; border-radius: 11px; background: var(--surface-3); display: grid; place-items: center; font-weight: 800; font-size: .85rem; box-shadow: inset 0 0 0 2px #4a3a33; }
.f-av.online { box-shadow: inset 0 0 0 2px var(--win); }
.f-av.playing { box-shadow: inset 0 0 0 2px var(--gold); }
.friend-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: none; border: 0; text-align: left; padding: 0; }
.friend-main strong { font-weight: 700; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friend-main small { color: var(--muted); font-size: .74rem; }
.friend-main small.hot { color: #ff9a73; }
.friend-main:hover strong { color: var(--accent); }
.f-btn { position: relative; height: 32px; padding: 0 10px; border-radius: 9px; border: 0; background: var(--surface-3); font-size: .75rem; font-weight: 700; flex: none; transition: background .15s, filter .15s; }
.f-btn:hover:not(:disabled) { background: var(--hover); }
.f-btn.duel { font-weight: 800; color: var(--muted); }
.f-btn.duel:disabled { opacity: .35; }
.f-btn.duel.on { background: var(--accent); color: var(--accent-ink); }
.f-btn.duel.on:hover { filter: brightness(1.08); }
.f-btn.cancel { background: none; border: 1px solid rgba(255, 92, 92, .4); color: var(--lose); font-weight: 800; }
.f-btn.cancel:hover { background: rgba(255, 92, 92, .12); }
.badge { position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-size: .65rem; font-weight: 800; display: grid; place-items: center; }

/* pending requests */
.req-list { list-style: none; margin: 0; padding: 0 4px 0 0; display: grid; gap: 4px; max-height: 236px; overflow-y: auto; }
.req-row { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 12px; border-radius: 12px; background: var(--surface-2); }
.req-row .grow { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.req-row .muted { font-size: .8rem; }
.req-list .empty { padding: 12px 0; }

/* ---------------------------------------------------------- wager forms (bot, custom, challenge) */
.bot-layout { display: flex; gap: 20px; flex-wrap: wrap; align-items: stretch; }
.wager-panel { flex: 1 1 380px; border-radius: 24px; padding: 26px; display: flex; flex-direction: column; gap: 18px; }
.wager-panel .btn-huge { margin-top: auto; }
.wager-input-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) 52px; gap: 8px; }
.wager-input-row input { min-width: 0; text-align: center; font-size: 1.8rem; font-weight: 800; letter-spacing: -.03em; background: var(--bg); border: 1px solid var(--line-2); border-radius: 14px; padding: 8px; outline: none; color: var(--ink); font-variant-numeric: tabular-nums; transition: border-color .15s; }
.wager-input-row input:focus { border-color: var(--accent); }
.wager-input-row.big { grid-template-columns: 60px minmax(0, 1fr) 60px; gap: 10px; }
.wager-input-row.big input { font-size: 2.6rem; border-radius: 16px; padding: 10px; }
.wager-input-row.big .step-btn { border-radius: 16px; font-size: 1.8rem; }
.step-btn { border: 0; border-radius: 14px; background: var(--surface-3); font-size: 1.5rem; font-weight: 500; transition: background .15s; }
.step-btn:hover:not(:disabled) { background: var(--hover); }
.step-btn:disabled { opacity: .4; }
.slider-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; }
.chips { display: flex; gap: 8px; }
.chip { width: 46px; height: 46px; border-radius: 50%; border: 3px dashed rgba(26, 11, 5, .35); color: var(--accent-ink); font-weight: 800; font-size: .9rem; transition: transform .1s; flex: none; padding: 0; }
.chip-half { background: radial-gradient(circle, #ff8a5c 55%, #d4552a); }
.chip-max { background: radial-gradient(circle, #ffc857 55%, #d49a20); font-size: .72rem; }
.chip:active:not(:disabled) { transform: translateY(2px); }
.chip:disabled { opacity: .4; }
.wager-panel .slider-row { gap: 16px; }
.wager-panel .chip { width: 52px; height: 52px; }
.wager-panel .chip-max { font-size: .8rem; }
.pot-preview { text-align: center; color: var(--muted); margin: 0; font-size: .88rem; }
.pot-preview strong { color: var(--accent); }

/* bot setup: chip stacks */
.stake-visual { flex: 1 1 380px; position: relative; overflow: hidden; border-radius: 24px; background: linear-gradient(160deg, #24170f, #120c0a); border: 1px solid rgba(255, 170, 130, .1);
  padding: 26px; display: flex; flex-direction: column; justify-content: space-between; gap: 20px; min-height: 380px; }
.stake-visual .pot-preview { font-size: 1rem; }
.stacks { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 10px; flex: 1; }
.stack-col { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.stack-col .avatar { width: 44px; height: 44px; }
.robot-tile { background: var(--surface-3) !important; }
.robot-tile svg { width: 34px; height: 34px; animation: wiggle 3s ease-in-out infinite; }
.chip-stack { display: flex; flex-direction: column-reverse; align-items: center; min-height: 170px; justify-content: flex-start; }
.stack-chip { width: 84px; height: 16px; margin-top: -6px; border-radius: 50%; background: var(--accent); border: 2px dashed rgba(26, 11, 5, .45); box-shadow: 0 3px 0 var(--accent-deep);
  animation: chipDrop calc(.35s * var(--anim)) cubic-bezier(.2, .9, .3, 1.3) both; }
.chip-stack.bot .stack-chip { background: var(--ink); border-color: rgba(26, 11, 5, .35); box-shadow: 0 3px 0 var(--muted); animation-delay: calc(.08s * var(--anim)); }
@keyframes chipDrop { from { transform: translateY(-40px); opacity: 0; } }
.stake-pot { align-self: center; display: flex; flex-direction: column; align-items: center; gap: 4px; animation: potPulse 2.4s ease-in-out infinite; }
.stake-pot .label { font-size: .68rem; letter-spacing: .2em; }
.stake-pot .num { font-size: 2rem; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
@keyframes potPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

/* ---------------------------------------------------------- PvP lobby */
.section { display: flex; flex-direction: column; gap: 12px; }
.section-title { font-size: 1.25rem; letter-spacing: -.02em; }
.section-title span { color: var(--muted); font-weight: 500; font-size: .9rem; letter-spacing: 0; }
.stake-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.stake-card { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 18px; padding: 22px; border-radius: 22px; border: 0; color: #fff; text-align: left;
  transition: transform .2s var(--ease), opacity .2s; animation: popIn calc(.45s * var(--anim)) ease both; }
.stake-card.tier-1 { background: linear-gradient(140deg, #8a3214, #4a1205); }
.stake-card.tier-2 { background: linear-gradient(140deg, #bf4520, #741c09); }
.stake-card.tier-3 { background: linear-gradient(140deg, #e85a2a, #a8300f); }
.stake-card:hover:not(:disabled) { transform: translateY(-4px); }
.stake-card:disabled { opacity: .45; }
.stake-glow { position: absolute; right: -40px; bottom: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 220, 150, .6), transparent 65%); animation: heat 3s ease-in-out infinite; }
@keyframes heat { 0%, 100% { opacity: .35; } 50% { opacity: .75; } }
.stake-tier { position: relative; font-size: .7rem; letter-spacing: .2em; font-weight: 800; opacity: .75; }
.stake-amt { position: relative; display: flex; align-items: center; gap: 8px; font-size: 2.4rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.stake-amt .coin { width: 30px; height: 30px; margin: 0; }
.stake-amt small { font-size: .9rem; letter-spacing: .06em; }
.stake-foot { position: relative; display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; font-weight: 600; }
#pvp-error:empty { display: none; }
.custom-grid { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.custom-lobby { flex: 1.25 1 440px; display: flex; flex-direction: column; gap: 12px; }
.custom-lobby .panel-head { margin-bottom: 0; }
.custom-create { flex: 1 1 340px; display: flex; flex-direction: column; gap: 14px; }
.custom-create p { margin: 0; line-height: 1.45; }
.custom-create p b { color: var(--ink); }
.range-filter { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.range-filter .label { margin-right: 4px; font-size: .7rem; letter-spacing: .16em; }
.range-filter input { width: 96px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 10px; outline: none; transition: border-color .15s; }
.range-filter input:focus { border-color: var(--accent); }
.range-filter .btn-tiny { border-radius: 8px; }
.lobby-caption { margin: 0; font-size: .8rem; color: var(--muted); }
.lobby-list { list-style: none; margin: 0; padding: 0 4px 0 0; display: grid; gap: 4px; grid-auto-rows: 60px; max-height: 316px; overflow-y: auto; }
.lobby-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 0 12px; border-radius: 14px; background: var(--surface-2); }
.lobby-wager { font-size: 1.2rem; gap: 6px; }
.lobby-wager .coin { width: 18px; height: 18px; margin: 0; }
.lobby-host { min-width: 0; display: flex; flex-direction: column; }
.lobby-host .link-btn { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lobby-host small { color: var(--muted); font-size: .75rem; }
.lobby-row .btn { min-width: 74px; border-radius: 10px; padding: 9px 14px; font-size: .82rem; }
.lobby-row .btn:disabled { background: var(--surface-3); color: var(--faint); opacity: .6; }
.lobby-list .empty { grid-row: span 2; display: grid; place-items: center; }

/* ---------------------------------------------------------- matchmaking */
.mm-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 40px 24px; text-align: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 106, 61, .14), transparent 60%); }
.radar { position: relative; width: 300px; height: 300px; display: grid; place-items: center; margin-bottom: 12px; }
.radar .ring { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; animation: ping 2.4s ease-out infinite; }
.radar .ring:nth-child(2) { animation-delay: .8s; }
.radar .ring:nth-child(3) { animation-delay: 1.6s; }
.orbit-path { position: absolute; inset: 30px; border-radius: 50%; border: 1px dashed rgba(255, 170, 130, .2); }
.orbit { position: absolute; inset: 30px; animation: orbit 9s linear infinite; }
.o-card { position: absolute; width: 34px; height: 48px; border-radius: 5px; padding: 3px 4px; background: var(--card-face); color: var(--black-suit); font-weight: 800; font-size: 12px; line-height: 1;
  box-shadow: 0 6px 14px rgba(0, 0, 0, .5); animation: counter 9s linear infinite; }
.o-card > span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 18px; }
.o-card.red { color: var(--red-suit); }
.o-card.back { background: repeating-linear-gradient(45deg, #ff6a3d 0 4px, #d4552a 4px 8px); border: 3px solid var(--ink); }
.o-card.top { left: 50%; top: -24px; margin-left: -17px; }
.o-card.bottom { left: 50%; bottom: -24px; margin-left: -17px; }
.o-card.left { top: 50%; left: -17px; margin-top: -24px; }
.o-card.right { top: 50%; right: -17px; margin-top: -24px; }
.radar-chip { position: relative; width: 104px; height: 104px; border-radius: 50%; filter: drop-shadow(0 0 28px rgba(255, 106, 61, .55)) drop-shadow(0 10px 18px rgba(0, 0, 0, .5)); animation: bob 1.6s ease-in-out infinite; }
.radar-chip img { width: 104px; height: 104px; display: block; animation: orbit 6s linear infinite; }
@keyframes ping { 0% { transform: scale(.3); opacity: .9; } 100% { transform: scale(1); opacity: 0; } }
@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes counter { to { transform: rotate(-360deg); } }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-6deg); } }
.mm-title { font-size: clamp(1.8rem, 3.4vw, 2.6rem); letter-spacing: -.04em; }
.dots span { animation: dots 1.4s infinite; }
.dots span:nth-child(2) { animation-delay: .2s; }
.dots span:nth-child(3) { animation-delay: .4s; }
@keyframes dots { 0%, 20% { opacity: .2; } 50% { opacity: 1; } 100% { opacity: .2; } }
.mm-line { margin: 0; color: var(--muted); font-size: 1.05rem; }
.mm-line strong { color: var(--ink); }
.mm-line strong.accent { color: var(--accent); }
.mm-note { margin: 0; color: var(--muted); font-size: .88rem; max-width: 380px; }
.mm-elapsed { margin: 0; font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.btn-cancel { margin-top: 8px; padding: 13px 34px; letter-spacing: .04em; }

/* ---------------------------------------------------------- table */
.table-screen { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: stretch; max-width: 1360px; margin: 0 auto; padding: 20px 24px;
  height: 100vh; min-height: 720px; }
.table-screen.no-chat, .table-screen.chat-hidden { grid-template-columns: minmax(0, 1fr); max-width: 1040px; }
.table-main { position: relative; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.felt { position: relative; overflow: hidden; flex: 1; min-height: 600px; display: grid; grid-template-rows: 1fr auto 1fr; gap: 8px; padding: 22px 28px; border-radius: 40px; border: 2px solid rgba(255, 106, 61, .28);
  background: radial-gradient(ellipse at 50% 50%, #3a1d12 0%, #22120c 55%, #140c09 100%); box-shadow: inset 0 0 0 8px rgba(0, 0, 0, .2), inset 0 0 80px rgba(0, 0, 0, .5); }
.felt-ring { position: absolute; left: 50%; top: 50%; width: 62%; height: 44%; transform: translate(-50%, -50%); border-radius: 50%; border: 1px dashed rgba(255, 170, 130, .12); pointer-events: none; }
.seat { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.seat-label { display: flex; align-items: center; gap: 8px; font-weight: 700; background: none; border: 1px solid transparent; border-radius: 12px; padding: 3px 12px 3px 3px; }
.seat-link:not(:disabled):hover { border-color: rgba(255, 170, 130, .15); background: rgba(0, 0, 0, .2); }
.seat-link:disabled { cursor: default; opacity: 1; }
#opp-avatar { background: var(--surface-3); color: var(--ink); }
.wager-chip { font-size: .75rem; font-weight: 800; color: var(--accent-ink); background: var(--accent); padding: 3px 9px; border-radius: 99px; font-variant-numeric: tabular-nums; }
.hand { display: flex; justify-content: center; min-height: calc(var(--card-w) * 1.4); }
.hand .card + .card { margin-left: calc(var(--card-w) * -.38); }
.hand-total { display: flex; align-items: center; gap: 8px; min-height: 34px; }
.total-badge { min-width: 54px; padding: 4px 14px; border-radius: 99px; text-align: center; font-weight: 800; font-size: 1.25rem; background: rgba(0, 0, 0, .45); color: #fff; font-variant-numeric: tabular-nums; transition: background .2s, color .2s; }
.total-badge.bust { background: var(--bust); color: #fff; }
.total-badge.twentyone { background: var(--accent); color: var(--accent-ink); }
.opp-total { color: var(--muted); font-weight: 600; padding: 4px 14px; white-space: nowrap; }
.opp-total.revealed { color: var(--ink); background: rgba(0, 0, 0, .45); border-radius: 99px; font-weight: 800; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.opp-total.revealed.bust { background: var(--bust); color: #fff; }
.tag { font-size: .74rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.tag.flash { animation: tag-flash calc(.6s * var(--anim)) ease; }
@keyframes tag-flash { 30% { transform: scale(1.25); } }

.center-info { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.pot { display: flex; flex-direction: column; align-items: flex-start; padding-left: 6%; }
.pot .label { font-size: .74rem; letter-spacing: .2em; }
.pot .coins { font-size: 2.1rem; letter-spacing: -.03em; gap: 8px; }
.pot .coin { width: 28px; height: 28px; margin: 0; }
.pot .coins.bump { animation: bump calc(.45s * var(--anim)) ease; }
@keyframes bump { 40% { transform: scale(1.18); color: var(--accent); } }
.status-line { text-align: right; font-size: 1.15rem; color: var(--ink); font-weight: 700; }
.status-line.waiting { color: var(--muted); }
.timer { position: relative; width: 88px; height: 88px; display: grid; place-items: center; transition: opacity .3s; }
.timer svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.timer circle { stroke-width: 5; }
.timer .track { fill: rgba(0, 0, 0, .35); stroke: rgba(255, 255, 255, .1); }
.timer .ring { fill: none; stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 238.76; transition: stroke-dashoffset 1s linear, stroke .3s; }
.timer span { position: relative; font-weight: 800; font-size: 1.8rem; font-variant-numeric: tabular-nums; color: var(--accent); }
.timer.warn .ring { stroke: var(--lose); }
.timer.warn span { color: var(--lose); animation: pulse 1s ease-in-out infinite; }
.timer.idle { opacity: .45; }
.timer.idle span { color: var(--muted); }
@keyframes pulse { 50% { transform: scale(1.12); } }

.actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; max-width: 660px; width: 100%; margin: 0 auto; }
.act { min-height: 66px; border: 0; border-radius: 18px; font-weight: 800; font-size: 1.15rem; letter-spacing: .08em; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; transition: transform .08s, opacity .2s, filter .15s; }
.act small { font-size: .66rem; font-weight: 600; letter-spacing: .04em; opacity: .6; }
.act:hover:not(:disabled) { filter: brightness(1.06); }
.act:active:not(:disabled) { transform: translateY(3px); }
.act:disabled { opacity: .3; }
.act-hit { background: var(--ink); color: var(--accent-ink); box-shadow: 0 5px 0 var(--muted); }
.act-stand { background: var(--surface-3); color: var(--ink); box-shadow: 0 5px 0 #0d0806; }
.act-double { background: linear-gradient(140deg, #ff8a52, #ff6a3d 50%, #c23a14); color: var(--accent-ink); box-shadow: 0 5px 0 #7a1f0c; }
.act-double small { font-weight: 700; opacity: .7; }
.act:active:not(:disabled) { box-shadow: 0 2px 0 rgba(0, 0, 0, .4); }
@keyframes glow { 0%, 100% { box-shadow: 0 5px 0 #7a1f0c, 0 0 0 0 rgba(255, 106, 61, 0); } 50% { box-shadow: 0 5px 0 #7a1f0c, 0 0 0 6px rgba(255, 106, 61, .25); } }

/* DOUBLE explainer tooltip (wrapper gets the hover so it works even when the button is disabled) */
.tip-wrap { position: relative; display: grid; }
.tip { position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%) translateY(6px); width: 300px; z-index: 6; padding: 14px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--accent); box-shadow: 0 14px 30px rgba(0, 0, 0, .5); display: flex; flex-direction: column; gap: 6px; font-size: .84rem; line-height: 1.4; color: var(--ink-2); text-align: left;
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .15s ease, transform .15s ease, visibility 0s linear .15s; }
.tip strong { color: var(--accent); font-size: .92rem; }
.tip b { color: var(--ink); }
.tip::after { content: ''; position: absolute; top: 100%; left: 50%; margin-left: -7px; border: 7px solid transparent; border-top-color: var(--accent); }
.tip-wrap:hover .tip, .tip-wrap:focus-within .tip { opacity: 1; visibility: visible; pointer-events: auto; transform: translateX(-50%); transition-delay: .25s, .25s, 0s; }
.tip::before { content: ''; position: absolute; left: 0; right: 0; top: 100%; height: 16px; }
.tip-off { align-self: flex-start; margin-top: 4px; border: 0; background: var(--surface-3); color: var(--ink-2); border-radius: 8px; padding: 6px 10px; font-size: .75rem; font-weight: 700; }
.tip-off:hover { background: var(--hover); color: var(--ink); }
.tip-wrap.no-tip .tip { display: none; }

/* table chat */
.table-chat { display: flex; flex-direction: column; min-height: 0; border-radius: 28px; background: var(--surface); padding: 18px; }
.table-chat .panel-head { margin-bottom: 12px; }
.chat-head-btns { display: flex; gap: 6px; }
.chat-head-btns .btn-tiny { font-size: .78rem; }
.chat-log { list-style: none; margin: 0; padding: 0 4px 0 0; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.chat-msg { max-width: 85%; padding: 9px 13px; border-radius: 16px; background: var(--surface-3); align-self: flex-start; font-size: .92rem; line-height: 1.35; overflow-wrap: anywhere; }
.chat-msg.mine { align-self: flex-end; background: var(--accent); color: var(--accent-ink); }
.chat-msg .who { display: block; font-size: .7rem; font-weight: 700; opacity: .7; margin-bottom: 2px; }
.chat-msg .time { display: block; font-size: .65rem; color: var(--muted); margin-top: 2px; }
.chat-msg.mine .time { color: inherit; opacity: .7; }
.chat-sys { align-self: stretch; text-align: center; font-size: .8rem; color: var(--muted); padding: 8px 10px; border-radius: 12px; border: 1px dashed rgba(255, 170, 130, .2); }
.chat-sys.highlight { color: var(--ink); font-size: .82rem; padding: 10px; background: rgba(255, 106, 61, .1); border: 1px solid rgba(255, 106, 61, .3); }
.chat-sys .sys-actions { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.chat-sys .btn-tiny { border-radius: 8px; padding: 5px 11px; }
.chat-form { margin-top: 12px; }
.chat-log .empty { margin: auto 0; }
/* collapsed chat: a tab on the right edge of the window */
.chat-tab { position: fixed; right: 0; top: 50%; transform: translateY(-50%); z-index: 8; border: 1px solid var(--line-2); border-right: 0; border-radius: 14px 0 0 14px; padding: 16px 9px;
  background: var(--surface); color: var(--accent); font-weight: 800; letter-spacing: .06em; box-shadow: -6px 0 20px rgba(0, 0, 0, .35); display: flex; flex-direction: column; align-items: center; gap: 8px; transition: padding .15s, background .15s; }
.chat-tab:hover { padding-right: 13px; background: var(--surface-3); }
.chat-tab-label { writing-mode: vertical-rl; transform: rotate(180deg); font-size: .85rem; }
.chat-tab .badge { position: static; }
.chat-tab.ping { animation: tab-ping calc(.6s * var(--anim)) ease 2; }
@keyframes tab-ping { 50% { background: rgba(255, 106, 61, .35); } }

/* result card — sits over the felt and the action bar */
.result-layer { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; padding: 16px; border-radius: 40px; background: rgba(10, 6, 5, .6);
  animation: fade calc(.25s * var(--anim)) ease both; }
.result-card { position: relative; flex: none; width: min(440px, 100%); max-height: 100%; overflow-x: hidden; overflow-y: auto; border-radius: 28px; padding: 26px 24px; text-align: center;
  background: var(--surface); border: 1px solid var(--line-2); box-shadow: 0 30px 60px rgba(0, 0, 0, .6); animation: popRes calc(.45s * var(--anim)) cubic-bezier(.2, 1.4, .4, 1) both; --res: var(--gold); }
@keyframes popRes { from { opacity: 0; transform: scale(.85) translateY(20px); } }
.result-card.win { --res: var(--win); }
.result-card.lose { --res: var(--lose); }
.burst { position: absolute; left: 50%; top: 60px; border-radius: 50%; background: var(--res); animation: burst calc(1s * var(--anim)) ease-out both; pointer-events: none; }
.burst.gold { background: var(--gold); }
.burst.accent { background: var(--accent); }
@keyframes burst { 0% { transform: translate(0, 0) scale(1); opacity: 1; } 100% { transform: translate(var(--x), var(--y)) scale(.4); opacity: 0; } }
.result-card h2 { margin: 8px 0 0; font-size: 2.6rem; letter-spacing: -.04em; color: var(--res); text-shadow: 0 0 24px color-mix(in srgb, var(--res) 40%, transparent); }
.result-bj { margin: 4px 0 0; font-weight: 800; letter-spacing: .04em; color: var(--gold); }
.result-reason { color: var(--muted); margin: 6px 0 18px; min-height: 1.2em; }
.result-friendly { margin: -10px 0 14px; font-size: .82rem; color: var(--muted); }
.result-hands { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin-bottom: 16px; }
.result-hands > div:not(.vs) { display: flex; flex-direction: column; gap: 2px; background: var(--surface-2); border-radius: 16px; padding: 14px 6px; min-width: 0; }
.result-hands small { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .12em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-hands strong { font-size: 2.1rem; font-weight: 800; }
.res-note { font-size: .72rem; color: var(--accent); min-height: 1em; font-weight: 700; }
.vs { color: var(--faint); font-style: italic; }
.money-line { display: flex; justify-content: space-between; align-items: baseline; padding: 12px 4px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.money-line strong { font-size: 1.7rem; font-variant-numeric: tabular-nums; color: var(--res); }
.ledger { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 12px 4px 18px; font-size: .88rem; text-align: left; }
.ledger dt { color: var(--muted); } .ledger dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.result-buttons { display: grid; gap: 9px; }
.btn-rematch { background: #e2531f; color: var(--accent-ink); letter-spacing: .06em; }
.btn-again { background: #ff9466; color: var(--accent-ink); padding: 12px; letter-spacing: .04em; }
.btn-rematch:hover:not(:disabled), .btn-again:hover:not(:disabled) { filter: brightness(1.08); }
.result-buttons .btn-outline { padding: 12px; }
.rematch-note { margin: -2px 0 2px; font-size: .85rem; color: var(--muted); min-height: 1.1em; }
.rematch-note.hot { color: var(--accent); font-weight: 700; }
.rematch-note:empty { display: none; }
/* "View cards": tuck the result away to look at both revealed hands */
.peek-btn { position: absolute; top: 14px; right: 14px; z-index: 1; border: 0; background: var(--surface-3); border-radius: 9px; padding: 6px 10px; font-size: .75rem; font-weight: 700; color: var(--muted); }
.peek-btn:hover { color: var(--ink); }
.result-show { display: none; }
.result-layer.peek { background: none; pointer-events: none; align-items: flex-end; padding-bottom: 100px; }
.result-layer.peek .result-card { display: none; }
.result-layer.peek .result-show { display: block; pointer-events: auto; padding: 13px 22px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }

/* ---------------------------------------------------------- playing cards */
.card { position: relative; z-index: 0; isolation: isolate; width: var(--card-w); height: calc(var(--card-w) * 1.4); flex: none; border-radius: calc(var(--card-w) * .1); }
.card .face, .card .back { position: absolute; inset: 0; border-radius: inherit; box-shadow: 0 8px 18px rgba(0, 0, 0, .5); }
.card .face { z-index: 1; background: var(--card-face); color: var(--black-suit); }
.card.suit-H .face, .card.suit-D .face { color: var(--red-suit); }
.card .corner { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: .9; font-weight: 800; font-size: calc(var(--card-w) * .2); }
.card .corner small { font-size: .8em; }
.card .corner.tl { top: 5%; left: 9%; }
.card .corner.br { bottom: 5%; right: 9%; transform: rotate(180deg); }
.card .pip { position: absolute; inset: 0; display: grid; place-items: center; font-size: calc(var(--card-w) * .48); line-height: 1; }
.card .back { background: var(--card-back); border: calc(var(--card-w) * .06) solid var(--ink); }
.card.facedown .face { visibility: hidden; }
.card:not(.facedown):not(.flip) .back { visibility: hidden; }
/* revealed: the face flips in over the back */
.card.flip .back { animation: turnAway calc(.24s * var(--anim)) ease-in both; }
.card.flip .face { animation: turnIn calc(.28s * var(--anim)) cubic-bezier(.2, .8, .3, 1.15) calc(.24s * var(--anim)) both; }
@keyframes turnAway { from { transform: perspective(700px) rotateY(0); } to { transform: perspective(700px) rotateY(90deg) scale(1.06); visibility: hidden; } }
@keyframes turnIn { from { transform: perspective(700px) rotateY(-90deg) scale(1.06); } to { transform: none; } }
@keyframes flipIn { from { opacity: 0; transform: perspective(600px) rotateY(90deg) scale(1.08); } }

.card.deal { will-change: transform, opacity; animation: dealIn calc(.5s * var(--anim)) var(--ease) both; }
@keyframes dealIn { from { opacity: 0; transform: translate(40vw, -30vh) rotate(25deg) scale(.6); } }
.seat-opponent .card.deal { animation-name: dealOpp; }
@keyframes dealOpp { from { opacity: 0; transform: translate(40vw, 30vh) rotate(-25deg) scale(.6); } }
/* DOUBLE: the old card flies off, the replacement flips in with a gold ring */
.card .face.discard-face { z-index: 2; box-shadow: 0 8px 18px rgba(0, 0, 0, .5); animation: discardOut calc(.7s * var(--anim)) cubic-bezier(.5, 0, .75, 0) both; }
@keyframes discardOut { 0% { transform: none; opacity: 1; } 100% { transform: translate(-170px, -230px) rotate(-55deg) scale(.8); opacity: 0; } }
.seat-opponent .card .face.discard-face { animation-name: discardOutUp; }
@keyframes discardOutUp { 0% { transform: none; opacity: 1; } 100% { transform: translate(-170px, 120px) rotate(55deg) scale(.8); opacity: 0; } }
.card.swapped .face:not(.discard-face) { animation: flipIn calc(.5s * var(--anim)) var(--ease) calc(.45s * var(--anim)) both; box-shadow: 0 0 0 3px var(--gold), 0 0 22px rgba(255, 200, 87, .6); }
.hand.busted .card .face { filter: grayscale(.5) brightness(.75); }
.hand.winner .card .face { box-shadow: 0 0 0 3px var(--accent), 0 0 24px rgba(255, 106, 61, .7); transition: box-shadow .3s; }

/* ---------------------------------------------------------- modals */
.overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgba(10, 6, 5, .72); backdrop-filter: blur(3px); animation: fade calc(.2s * var(--anim)) ease both; }
.modal { position: relative; width: min(480px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; border-radius: 28px; padding: 28px; background: var(--surface); border: 1px solid var(--line-2);
  box-shadow: 0 30px 60px rgba(0, 0, 0, .55); animation: pop calc(.35s * var(--anim)) cubic-bezier(.2, 1.3, .4, 1) both; display: flex; flex-direction: column; gap: 16px; }
.modal h2 { font-size: 1.8rem; letter-spacing: -.04em; padding-right: 40px; }
.modal-x { position: absolute; top: 16px; right: 16px; width: 36px; height: 36px; border-radius: 11px; border: 0; background: var(--surface-3); font-size: 1.3rem; line-height: 1; display: grid; place-items: center; transition: background .15s; }
.modal-x:hover { background: var(--hover); }
.modal-x.small { position: static; width: 28px; height: 28px; border-radius: 9px; font-size: 1.1rem; }

/* settings */
.settings-modal { width: min(440px, 100%); }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--surface-2); border-radius: 14px; padding: 14px 16px; font-weight: 600; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch { position: relative; flex: none; width: 46px; height: 26px; border-radius: 99px; background: var(--hover); transition: background .2s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); transition: left .2s var(--ease); }
.toggle input:checked + .switch { background: var(--accent); }
.toggle input:checked + .switch::after { left: 23px; }
.toggle input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 3px; }
.speed-setting { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 14px; background: var(--surface-2); }
.speed-head { display: flex; justify-content: space-between; font-weight: 600; }
.speed-head strong { color: var(--accent); }
.speed-scale { display: flex; justify-content: space-between; font-size: .72rem; color: var(--muted); }
.speed-setting p { margin: 0; font-size: .82rem; }

/* how to play */
/* never squash a pop-up's contents to fit the window — scroll instead */
.modal > * { flex-shrink: 0; }
.howto-modal { width: min(640px, 100%); }
.howto-modal h2 { font-size: 2rem; margin-top: -6px; }
.howto-body { min-height: 310px; display: flex; flex-direction: column; gap: 14px; line-height: 1.5; color: var(--ink-2); }
.howto-body p { margin: 0; }
.howto-body ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.howto-body b { color: var(--ink); }
.howto-body .callout p { color: var(--ink-2); }
.demo { display: flex; align-items: center; justify-content: center; gap: 20px; padding: 16px; border-radius: 18px; background: var(--bg); flex-wrap: wrap; }
.demo > div:not(.hand) { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.demo .hand { --card-w: 62px; min-height: auto; }
.demo .hand .card + .card { margin-left: -20px; }
.demo .card .face, .demo .card .back { box-shadow: 0 6px 14px rgba(0, 0, 0, .45); }
.demo .card .back { border-width: 4px; background: repeating-linear-gradient(45deg, #ff6a3d 0 5px, #d4552a 5px 10px); }
.demo .arrow { font-size: 1.3rem; color: var(--accent); font-weight: 800; }
.demo .demo-label { text-align: center; font-size: .8rem; color: var(--muted); }
.demo .demo-label strong { color: var(--ink); }
.card.ghost { opacity: .35; }
.payout-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.payout-table th, .payout-table td { padding: 7px 8px; text-align: left; }
.payout-table tbody tr { border-top: 1px solid rgba(255, 170, 130, .1); }
.payout-table th { color: var(--muted); font-weight: 700; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; }
.payout-table small { color: var(--faint); }
.howto-dots { display: flex; gap: 6px; justify-content: center; }
.howto-dots span { height: 8px; width: 8px; border-radius: 99px; background: rgba(255, 255, 255, .18); transition: width .25s, background .25s; }
.howto-dots span.on { background: var(--accent); width: 22px; }
.howto-nav { display: flex; justify-content: space-between; gap: 10px; }
.howto-nav .btn { min-width: 120px; }

/* first-time DOUBLE explainer */
.double-modal { width: min(560px, 100%); gap: 14px; }
.double-modal ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; color: var(--ink-2); line-height: 1.45; }
.double-modal b { color: var(--ink); }
.swap-demo { gap: 4px; padding: 18px; }
.swap-demo .hand { align-items: center; }
.swap-slot { position: relative; width: 62px; height: 87px; flex: none; margin-left: -20px; }
.swap-slot .card { position: absolute; inset: 0; margin: 0 !important; }
.swap-slot .card.out { animation: swapOut 3.6s ease-in-out infinite; }
.swap-slot .card.in { animation: swapIn 3.6s ease-in-out infinite; }
.swap-slot .card.in .face { box-shadow: 0 0 0 3px var(--accent), 0 0 20px rgba(255, 106, 61, .6); }
@keyframes swapOut { 0%, 30% { opacity: 1; transform: none; } 50%, 80% { opacity: 0; transform: translateY(-30px) rotate(-18deg); } 100% { opacity: 1; transform: none; } }
@keyframes swapIn { 0%, 45% { opacity: 0; transform: translateY(-30px) rotateY(90deg); } 60%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.swap-text { margin-left: 18px; font-size: .85rem; color: var(--muted); line-height: 1.4; }
.swap-text strong { color: var(--ink); }
.swap-text strong.accent { color: var(--accent); }

/* profile */
.profile-modal { width: min(620px, 100%); }
.pf-head { display: flex; align-items: center; gap: 16px; }
.pf-sub { margin: 4px 0 0; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .9rem; font-weight: 700; }
.pf-sub .coin { width: 16px; height: 16px; margin: 0; }
.pf-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stat { padding: 12px; border-radius: 14px; background: var(--surface-2); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat small { color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.stat strong { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat.locked strong { font-size: .8rem; color: var(--muted); font-weight: 600; line-height: 1.3; }
.pf-chart-wrap { padding: 14px; border-radius: 16px; background: var(--surface-2); }
.pf-chart-head { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.pf-chart-head strong { font-variant-numeric: tabular-nums; }
.pf-chart { height: 170px; }
.pf-chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pf-chart .empty { padding-top: 60px; }
.chart-line { stroke-dasharray: 1200; animation: draw calc(1.6s * var(--anim)) ease-out both; }
.chart-area { animation: fade calc(1.2s * var(--anim)) ease-out calc(.3s * var(--anim)) both; }
@keyframes draw { from { stroke-dashoffset: 1200; } to { stroke-dashoffset: 0; } }
.pf-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-actions .btn { flex: 1; min-width: 140px; padding: 12px; }
.challenge-modal { width: min(460px, 100%); gap: 14px; }
.challenge-modal p { margin: 0; }

/* direct-message dock */
.dm-dock { position: fixed; right: 24px; bottom: 0; z-index: 25; width: 340px; height: 440px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-2); border-bottom: 0;
  border-radius: 20px 20px 0 0; box-shadow: 0 -10px 40px rgba(0, 0, 0, .45); padding: 12px 14px 14px; animation: dock-in calc(.25s * var(--anim)) ease both; }
@keyframes dock-in { from { transform: translateY(30px); opacity: 0; } }
.dm-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.dm-who { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 0; }
.dm-who:hover strong { color: var(--accent); }
.dm-head-btns { display: flex; gap: 6px; }
.dm-who .badge { position: static; margin-left: 2px; }
.dm-dock.min { height: auto; padding-bottom: 12px; }
.dm-dock.min .dm-head { margin: 0; padding: 0; border: 0; }
.dm-dock.min .dm-log, .dm-dock.min .chat-form { display: none; }

/* notifications */
.notifications { position: fixed; top: 16px; right: 16px; z-index: 60; display: flex; flex-direction: column; gap: 10px; width: 340px; pointer-events: none; }
.note { pointer-events: auto; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid rgba(255, 170, 130, .18); box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
  animation: note-in calc(.25s * var(--anim)) ease both; font-size: .9rem; color: var(--ink-2); }
.note.error { border-color: rgba(255, 92, 92, .5); }
.note.leaving { animation: note-out .2s ease forwards; }
@keyframes note-in { from { opacity: 0; transform: translateX(30px); } }
@keyframes note-out { to { opacity: 0; transform: translateX(30px); } }
.note strong { display: block; margin-bottom: 2px; color: var(--ink); }
.note .note-actions { display: flex; gap: 6px; margin-top: 10px; }
.note .note-actions .btn { border-radius: 8px; padding: 6px 12px; font-size: .78rem; }
.note .bar { height: 3px; background: var(--accent); border-radius: 99px; margin-top: 10px; transform-origin: left; }
.note .btn:disabled { cursor: not-allowed; }
.wager-hl { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px 1px 5px; margin: 0 1px; border-radius: 99px; font-weight: 800; color: var(--accent-ink); background: var(--accent); box-shadow: 0 0 12px rgba(255, 106, 61, .45); }
.wager-hl .coin { width: 13px; height: 13px; margin: 0; }
.note-sub { display: block; color: var(--muted); margin-top: 4px; font-size: .78rem; }
.note-warn { display: block; color: var(--lose); font-weight: 700; font-size: .8rem; margin-top: 6px; }
.conn-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 70; text-align: center; padding: 7px 10px; background: #8a3a00; color: #fff; font-weight: 700; font-size: .85rem; }

/* friends guide illustrations */
.mock { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 14px; background: var(--bg); }
.mock .friend-row { height: 52px; cursor: default; }
.mock .chat-msg { font-size: .88rem; }
.mock-note { padding: 12px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid rgba(255, 170, 130, .18); font-size: .85rem; }
.mock-note strong { display: block; color: var(--ink); }
.mock-note .note-actions { display: flex; gap: 6px; margin-top: 8px; }
.mock-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: center; }
.howto-body .dot { vertical-align: 1px; }

/* ---------------------------------------------------------- scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255, 150, 110, .25); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 150, 110, .4); }
::-webkit-scrollbar-corner { background: transparent; }
@supports (-moz-appearance: none) { * { scrollbar-width: thin; scrollbar-color: rgba(255, 150, 110, .3) transparent; } }
/* Scrollbars inside rounded boxes: keep the track off the rounded corners. */
.result-card::-webkit-scrollbar-track, .modal::-webkit-scrollbar-track { margin: 24px 0; }
.result-card::-webkit-scrollbar, .modal::-webkit-scrollbar { width: 12px; }
.result-card::-webkit-scrollbar-thumb, .modal::-webkit-scrollbar-thumb { border-right: 4px solid transparent; background-clip: padding-box; }

/* ---------------------------------------------------------- accounts, legal & safety */
/* keyboard focus is always visible (mouse clicks don't show it) */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.auth-form input:focus-visible, .field input:focus-visible, .field textarea:focus-visible, .toggle input:focus-visible,
.inline-form input:focus-visible, .wager-input-row input:focus-visible, .range-filter input:focus-visible { outline: none; }
.noscript { margin: 0; padding: 14px 20px; text-align: center; background: #8a3a00; color: #fff; font-weight: 700; }

.field-hint { color: var(--faint); font-size: .78rem; font-weight: 500; }
.consent, .auth-form .consent { display: flex; flex-direction: row; align-items: flex-start; gap: 10px; font-size: .85rem; line-height: 1.45; color: var(--ink-2); font-weight: 500; cursor: pointer; }
.consent input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
.consent b { color: var(--ink); }
.consent a { color: var(--accent); }
.or-line { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.or-line::before, .or-line::after { content: ''; flex: 1; height: 1px; background: var(--line-2); }
.auth-alt { display: flex; flex-direction: column; gap: 10px; }
/* login: "Forgot password?" under the password */
.forgot-link { align-self: flex-end; margin-top: -6px; font-size: .84rem; font-weight: 600; color: var(--muted); }
.forgot-link:hover { color: var(--accent); }
/* the e-mail code pop-up */
.code-input { width: 100%; text-align: center; font-size: 2rem; font-weight: 800; letter-spacing: .45em; padding: 14px 0 14px .45em; border-radius: 14px;
  background: var(--bg); border: 1px solid var(--line-2); color: var(--ink); font-variant-numeric: tabular-nums; }
.code-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 106, 61, .25); }
.code-input::placeholder { color: var(--faint); letter-spacing: .3em; }
.code-help { margin-top: 10px; }
.code-help .link-btn:disabled { color: var(--faint); cursor: default; text-decoration: none; }
.code-step[hidden] { display: none !important; }
.acct-email { font-weight: 500; margin-left: 6px; overflow-wrap: anywhere; }
.legal-links { display: flex; justify-content: center; gap: 16px; margin: 0; font-size: .8rem; }
.legal-links a { color: var(--muted); text-decoration: none; }
.legal-links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.link-btn.accent { color: var(--accent); }
.link-btn.faint { color: var(--faint); font-weight: 600; }
.link-btn.faint:hover { color: var(--ink-2); }
.link-btn.accent:hover { text-decoration: underline; }

/* form fields inside pop-ups */
.field { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; color: var(--muted); font-weight: 600; }
.field input, .field textarea { background: var(--bg); border: 1px solid var(--line-2); border-radius: 12px; padding: 12px 14px; font: inherit; font-size: 1rem; font-weight: 500; color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 106, 61, .18); }

/* small pop-ups: guest, Google username, Terms, upgrade, delete, report, confirm */
.small-modal { width: min(460px, 100%); gap: 14px; }
.small-modal p { margin: 0; line-height: 1.5; }
.small-modal .form-error:empty, .acct-form .form-error:empty { display: none; }
.small-modal .coin { margin-right: .2em; }
.check-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; color: var(--ink-2); line-height: 1.45; font-size: .92rem; }
.check-list li { position: relative; padding-left: 28px; }
.check-list li::before { content: '✓'; position: absolute; left: 0; top: 2px; width: 18px; height: 18px; border-radius: 6px; display: grid; place-items: center; font-size: .66rem; font-weight: 800; color: var(--accent-ink); background: var(--accent); }
.check-list b { color: var(--ink); }
.kicker.danger { color: var(--lose); }
.btn-danger { background: var(--bust); color: #2a0505; }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.confirm-btns { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.confirm-btns .btn { min-width: 110px; }
.reason-list { display: grid; gap: 6px; }
.reason { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid transparent; cursor: pointer; transition: border-color .15s, background .15s; }
.reason:hover { background: var(--surface-3); }
.reason:has(input:checked) { border-color: var(--accent); background: rgba(255, 106, 61, .08); }
.reason input { margin: 3px 0 0; accent-color: var(--accent); }
.reason span { display: flex; flex-direction: column; line-height: 1.3; }
.reason b { font-size: .92rem; }
.reason small { color: var(--muted); font-size: .78rem; }

/* home: guest invitation + footer */
.guest-panel { display: flex; flex-direction: column; gap: 12px; border: 1px solid rgba(255, 106, 61, .3); background: linear-gradient(160deg, rgba(255, 106, 61, .16), rgba(255, 106, 61, .03) 60%), var(--surface); }
.guest-panel .panel-title { margin: 0; }
.guest-panel p { margin: 0; }
.perk-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.perk-list li { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: .92rem; }
.perk-list li::before { content: '♠\FE0E'; color: var(--accent); font-size: .9rem; }
.site-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--faint); font-size: .8rem; }

/* settings: game | account */
.settings-modal { width: min(860px, 100%); }
.settings-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; align-items: start; }
.set-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.set-title { margin: 0 0 2px; font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.acct-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2); }
.acct-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.acct-who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-who small, .acct-line small { color: var(--muted); font-size: .78rem; }
.acct-box { border-radius: 14px; background: var(--surface-2); }
.acct-box summary { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 13px 16px; font-weight: 600; cursor: pointer; list-style: none; border-radius: 14px; }
.acct-box summary::-webkit-details-marker { display: none; }
.acct-box summary::after { content: '▾'; color: var(--muted); transition: transform .2s; }
.acct-box[open] summary::after { transform: rotate(180deg); }
.acct-box summary .faint { margin-right: auto; }
.acct-form { display: flex; flex-direction: column; gap: 10px; padding: 0 16px 16px; }
.acct-form .btn { align-self: flex-start; }
.acct-form p { margin: 0; }
.acct-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-radius: 14px; background: var(--surface-2); }
.acct-line > span { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.blocked-list { list-style: none; margin: 0; padding: 0 12px 12px; display: grid; gap: 2px; max-height: 180px; overflow-y: auto; }
.blocked-list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 4px 5px 6px; font-weight: 600; font-size: .9rem; }
.blocked-list .empty { justify-content: center; font-weight: 500; padding: 6px; }
.acct-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.acct-actions .btn { flex: 1; }
.acct-delete { align-self: flex-start; }
.set-col .legal-links { justify-content: flex-start; margin-top: 2px; }

/* profile: block / report */
.pf-head > div:nth-child(2) { flex: 1; min-width: 0; }
.pf-safety { align-self: flex-start; display: flex; gap: 14px; padding: 6px 48px 0 0; }
.pf-safety .link-btn { color: var(--muted); font-size: .82rem; font-weight: 700; }
.pf-safety .link-btn:hover { color: var(--lose); }

/* ---------------------------------------------------------- smaller desktop windows */
@media (max-width: 1100px) {
  .table-screen { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 760px) {
  .settings-cols { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .table-screen { grid-template-columns: 1fr; height: auto; }
  .table-chat { height: 360px; }
  :root { --card-w: 80px; }
  .medallion { width: 150px; height: 150px; }
  .medallion .coins { font-size: 1.4rem; }
}
@media (max-height: 760px) {
  :root { --card-w: 86px; }
  .felt { min-height: 520px; }
  .table-screen { min-height: 640px; }
  .act { min-height: 58px; }
}

/* ---------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  .ember, .hero-glow, .pvp-glow, .dotgrid, .big-card, .mini-card, .mode-icon svg, .robot-tile svg, .medallion, .stake-glow, .stake-pot,
  .radar .ring, .orbit, .o-card, .radar-chip, .radar-chip img, .swap-slot .card { animation: none !important; }
  .radar .ring { opacity: .3; }
  .swap-slot .card.out { opacity: 0; }
  .mode-half, .medallion { transition: none; }
}

/* ================================================================ phones & touch
   Everything below 760 px wide: one column, compact header, the mode hero
   stacked, and a table that fits the screen with the chat underneath. */
@media (hover: none) {
  .tip { display: none !important; }            /* no hover on touch — the first-SWAP pop-up explains it */
  .toggle:has(#set-dbltip) { display: none; }  /* …so its setting isn't needed either */
  .act small:not(#double-cost) { display: none; } /* keyboard letters mean nothing on a phone */
}
button, a, input, label { touch-action: manipulation; } /* no double-tap zoom delay */

@media (max-width: 760px) {
  :root { --card-w: 62px; }
  .page { padding: 14px 14px 32px; gap: 16px; }
  .panel { padding: 16px; border-radius: 18px; }
  .panel-title { font-size: 1.2rem; }
  /* phones zoom into inputs with text smaller than 16 px — keep them at 16 */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not(.big-num), textarea { font-size: 16px !important; }
  .wager-input-row input { font-size: 1.6rem !important; }
  .code-input { font-size: 1.7rem !important; }
  .wager-input-row.big input { font-size: 2rem !important; }

  /* header: avatar · logo · ? ⚙ */
  .topbar-3 { grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; }
  .topbar-3 > .logo, .topbar-3 > .screen-title { justify-self: center; }
  .topbar .logo { gap: 6px; }
  .topbar .logo-suit { display: none; }
  .topbar .logo-pvp { font-size: 1.15rem; }
  .topbar .logo-word { font-size: 1.15rem; }
  .profile-btn { padding: 2px; gap: 8px; }
  .profile-btn-text { display: none; }
  .pill-btn { width: 42px; padding: 0; justify-content: center; font-size: 0; gap: 0; }
  .pill-btn .q { font-size: 1.1rem; }
  .screen-title { font-size: 1.15rem; text-align: center; }
  .balance-pill { padding: 7px 10px; font-size: .9rem; }

  /* home: balance on top, then the two modes stacked */
  .mode-hero { flex-direction: column; height: auto; border-radius: 22px; }
  .mode-half { margin: 0 !important; clip-path: none !important; flex: none !important; min-height: 168px; }
  .mode-content { padding: 20px !important; gap: 10px; justify-content: center; }
  .mode-icon { width: 52px; height: 52px; border-radius: 16px; }
  .mode-icon svg { width: 38px; height: 38px; }
  .mode-title { font-size: 1.9rem; }
  .mode-title br { display: none; }
  .mode-sub { font-size: .88rem; }
  .mode-cta { padding: 10px 16px; font-size: .8rem; }
  /* two floating cards above the title, mirroring the robot icon on the Bot card */
  .pvp-cards { top: 0; width: 88px; height: 70px; margin: 0 4px 2px 0; }
  .pvp-cards .mini-card { top: 4px; width: 44px; height: 62px; font-size: 12px; padding: 4px 5px; border-radius: 6px; }
  .pvp-cards .mini-card > span { font-size: 22px; }
  .pvp-cards .mini-card.red { left: 38px; top: 7px; }
  .act small:not(#double-cost) { display: none; } /* key letters: keyboard only */
  .medallion { position: static; order: -1; transform: none; width: auto; height: auto; border: 0; border-radius: 0; flex-direction: row; justify-content: center; gap: 12px; padding: 14px; animation: none;
    border-bottom: 1px solid var(--line); }
  .mode-hero:has(.mode-bot:hover) .medallion, .mode-hero:has(.mode-pvp:hover) .medallion { left: auto; }
  .medallion .coins { font-size: 1.5rem; }
  .medallion .coin { width: 20px; height: 20px; }
  .home-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .site-foot { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* login */
  .auth-hero { flex-basis: 100%; min-height: 0; padding: 22px 20px 26px; gap: 14px; }
  .hero-cards { height: 150px; }
  .big-card { width: 92px; height: 129px; font-size: 20px; padding: 9px; left: calc(50% - 82px); top: 8px; border-radius: 11px; }
  .big-card > span { font-size: 46px; }
  .big-card.red { left: calc(50% - 8px); top: 14px; }
  .hero-line { font-size: 2.1rem; }
  .auth-side { flex-basis: 100%; padding: 24px 16px 36px; }
  .auth-heading { font-size: 1.8rem; }

  /* bot setup & PvP lobby */
  .bot-layout { gap: 14px; }
  .wager-panel, .stake-visual { flex-basis: 100%; padding: 18px; border-radius: 20px; }
  .wager-input-row.big input { font-size: 2rem; }
  .stake-visual { min-height: 0; gap: 14px; }
  .chip-stack { min-height: 110px; }
  .stack-chip { width: 64px; height: 13px; }
  .stake-list { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .stake-card { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 16px 18px; }
  .stake-amt { font-size: 1.9rem; }
  .stake-foot { flex-basis: 100%; font-size: .82rem; }
  .section-title span { display: block; margin-top: 2px; }
  .custom-lobby, .custom-create { flex-basis: 100%; }
  .range-filter input { width: 80px; }
  .lobby-row { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 0 10px; }
  .lobby-wager { font-size: 1.05rem; }

  /* matchmaking */
  .mm-screen { min-height: 100svh; padding: 24px 16px; gap: 12px; }
  .radar { width: 230px; height: 230px; }
  .radar-chip, .radar-chip img { width: 84px; height: 84px; }

  /* table: felt + buttons fill the screen, chat below */
  .table-screen { display: flex; flex-direction: column; height: auto; min-height: 0; padding: 8px; gap: 12px; }
  .table-main { min-height: calc(100svh - 16px); gap: 10px; }
  .felt { min-height: 0; padding: 12px 10px; border-radius: 26px; gap: 4px; }
  .felt-ring { width: 86%; }
  .seat { gap: 6px; }
  .seat-label { font-size: .9rem; }
  .hand-total { min-height: 28px; }
  .total-badge, .opp-total.revealed { font-size: 1.05rem; padding: 3px 12px; }
  .center-info { gap: 8px; }
  .pot { padding-left: 2px; }
  .pot .coins { font-size: 1.5rem; }
  .pot .coin { width: 20px; height: 20px; }
  .timer { width: 64px; height: 64px; }
  .timer span { font-size: 1.35rem; }
  .status-line { font-size: .85rem; }
  .actions { gap: 8px; }
  .act { min-height: 58px; font-size: 1rem; border-radius: 15px; }
  .result-layer { border-radius: 26px; padding: 10px; }
  .result-card { padding: 20px 16px; border-radius: 22px; }
  .result-card h2 { font-size: 2rem; }
  .result-hands strong { font-size: 1.7rem; }
  .money-line strong { font-size: 1.4rem; }
  .ledger { margin-bottom: 14px; }
  .result-layer.peek { padding-bottom: 24px; }
  /* chat: a sheet over the table, opened from the tab on the right edge */
  .table-chat { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 20; height: min(460px, 62svh); border-radius: 22px; padding: 14px;
    border: 1px solid var(--line-2); box-shadow: 0 -12px 40px rgba(0, 0, 0, .6); animation: dock-in calc(.25s * var(--anim)) ease both; }
  .chat-tab { top: auto; bottom: 110px; transform: none; padding: 12px 7px; }

  /* pop-ups, notifications, messages */
  .overlay { padding: 10px; align-items: end; }
  .modal { padding: 20px 18px; border-radius: 22px; gap: 14px; max-height: calc(100svh - 20px); }
  .modal h2 { font-size: 1.5rem; }
  .howto-modal h2 { font-size: 1.6rem; }
  .howto-body { min-height: 0; }
  .howto-nav .btn { min-width: 0; flex: 1; }
  .pf-head { flex-wrap: wrap; }
  .pf-safety { order: 3; width: 100%; padding: 0; }
  .pf-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pf-chart { height: 140px; }
  .demo { gap: 10px; padding: 12px; }
  .notifications { left: 8px; right: 8px; top: 8px; width: auto; }
  .dm-dock { left: 8px; right: 8px; width: auto; height: min(440px, 70svh); }
  .confirm-btns .btn { flex: 1; min-width: 0; }
}
@media (max-width: 380px) {
  :root { --card-w: 56px; }
  .topbar .logo-pvp, .topbar .logo-word { font-size: 1rem; }
  .mode-title { font-size: 1.65rem; }
  .act { font-size: .9rem; letter-spacing: .04em; }
}
