/* Color Riot: "street party" theme. Deep purple night, four loud paint colours,
   sticker-style cards with a spray stripe. */

:root {
  --bg: #120d1d;
  --bg-2: #1b1430;
  --surface: #211936;
  --surface-2: #2b2147;
  --line: #3a2e5c;
  --text: #fbf8ff;
  --muted: #a89cc8;
  --ink: #0e0a18;

  --red: #ff3d5a;
  --yellow: #ffcc29;
  --green: #23d68a;
  --blue: #3a86ff;
  --accent: #ff4fd8; /* riot pink: buttons, highlights */
  --now: var(--accent); /* current colour on the table, set inline */

  --display: "Bungee", Impact, "Arial Black", sans-serif;
  --body: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --cw: 84px; /* card width */
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background:
    radial-gradient(600px 400px at 8% -5%, #ff3d5a26, transparent 70%),
    radial-gradient(600px 420px at 100% 0%, #3a86ff26, transparent 70%),
    radial-gradient(700px 500px at 50% 110%, #ff4fd81f, transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 500 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, p, ul, ol { margin: 0; }
h2 { font-family: var(--display); font-weight: 400; font-size: clamp(1.5rem, 5vw, 2.3rem); line-height: 1.05; }
h3 { font-size: .78rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin: 18px 0 10px; }
h3:first-child { margin-top: 0; }
button, input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.hint { color: var(--muted); font-size: .86rem; margin-top: 8px; }
.label { font-size: .74rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.grow { flex: 1; }
.hot { color: var(--red); }
.link { background: none; border: 0; color: var(--muted); text-align: center; font-size: .9rem; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; display: block; margin: 12px auto 0; }
.link:hover { color: var(--text); }

/* --------------------------------------------------------------- logo */

.logo { font-family: var(--display); font-weight: 400; line-height: .9; display: inline-flex; flex-direction: column; transform: rotate(-4deg); font-size: clamp(3rem, 14vw, 5.2rem); letter-spacing: .01em; }
.logo span { display: block; -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 5px 5px 0 var(--ink); }
.logo .l1 { background: linear-gradient(90deg, var(--red), var(--yellow)); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(5px 5px 0 var(--ink)); }
.logo .l2 { background: linear-gradient(90deg, var(--green), var(--blue)); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(5px 5px 0 var(--ink)); margin-left: .6em; }
.logo.small { font-size: 1.35rem; flex-direction: row; gap: .3em; transform: rotate(-3deg); }
.logo.small span { -webkit-text-stroke: 1.5px var(--ink); }
.logo.small .l1, .logo.small .l2 { filter: drop-shadow(2px 2px 0 var(--ink)); margin: 0; }

/* -------------------------------------------------------------- layout */

.page { width: min(720px, 100%); margin: 0 auto; padding: 20px 16px 48px; display: flex; flex-direction: column; gap: 16px; }
.page.narrow { width: min(460px, 100%); }
.page.center { align-items: center; text-align: center; padding-top: 12vh; }
.top { display: flex; align-items: center; justify-content: space-between; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }

input {
  width: 100%; background: var(--bg-2); border: 2px solid var(--line); border-radius: 12px; padding: 12px 14px; outline: none;
}
input:focus { border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none;
  background: var(--surface-2); border: 2px solid var(--line); color: var(--text); border-radius: 14px;
  padding: 12px 18px; font-weight: 800; cursor: pointer; transition: transform .08s, background .15s, border-color .15s;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(2px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--ink); color: var(--ink); box-shadow: 0 4px 0 var(--ink); }
.btn.primary:active { box-shadow: 0 1px 0 var(--ink); transform: translateY(3px); }
.btn.big { font-size: 1.15rem; padding: 16px 28px; width: 100%; }
.icon-btn { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; width: 40px; height: 40px; cursor: pointer; font-size: 1.1rem; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--bg-2); border: 2px solid var(--line); border-radius: 999px; padding: 7px 14px; font-weight: 700; cursor: pointer; text-transform: capitalize; }
.chip.on { background: var(--text); color: var(--ink); border-color: var(--text); }
.chip:disabled { cursor: default; }
.chip:not(.on):disabled { opacity: .55; }

.tag { font-size: .7rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; background: var(--surface-2); color: var(--muted); padding: 3px 8px; border-radius: 999px; }
.tag.bot { color: var(--yellow); }
.chip-count { font-weight: 800; font-size: .8rem; background: var(--bg-2); border: 1px solid var(--line); padding: 2px 9px; border-radius: 999px; }
.chip-count.hot { background: var(--red); color: var(--ink); border-color: var(--ink); }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 800; color: var(--ink); border: 2px solid var(--ink); flex: none; font-size: 1.05rem; }
.avatar.sm { width: 30px; height: 30px; font-size: .85rem; }

/* ----------------------------------------------------------------- home */

.home { padding-top: 6vh; gap: 14px; }
.home .logo { align-self: center; margin-bottom: 4px; }
.tagline { text-align: center; color: var(--muted); margin-bottom: 8px; }
.hero-cards { display: flex; justify-content: center; height: 150px; margin-bottom: -10px; }
.hero-cards .card { margin: 0 -14px; animation: float 4s ease-in-out infinite; }
.hero-cards .h1c { transform: rotate(-14deg) translateY(10px); }
.hero-cards .h2c { z-index: 1; animation-delay: -1.3s; }
.hero-cards .h3c { transform: rotate(14deg) translateY(10px); animation-delay: -2.6s; }
@keyframes float { 50% { translate: 0 -8px; } }
.join { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.code-input { text-transform: uppercase; letter-spacing: .3em; font-weight: 800; text-align: center; }

.rules { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 18px; }
.rules summary { cursor: pointer; font-weight: 800; }
.rules ul { margin-top: 10px; padding-left: 20px; display: grid; gap: 6px; color: var(--muted); font-size: .92rem; }
.rules b { color: var(--text); }

/* ---------------------------------------------------------------- lobby */

.invite { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.code { font-family: var(--display); font-size: 2.4rem; letter-spacing: .12em; line-height: 1; }
.players { list-style: none; padding: 0; display: grid; gap: 8px; }
.players li { display: flex; align-items: center; gap: 10px; background: var(--bg-2); border-radius: 12px; padding: 8px 10px; }
.players li.off { opacity: .5; }
.players .pname { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.players .you { color: var(--muted); font-weight: 500; }
.x { background: none; border: 0; color: var(--muted); font-size: 1.4rem; cursor: pointer; line-height: 1; padding: 0 4px; }
.x:hover { color: var(--red); }
.addbots { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.toggles { display: grid; gap: 8px; margin-top: 12px; }
.toggle { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; background: var(--bg-2); border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; }
.toggle.on { border-color: var(--accent); }
.toggle input { width: 20px; height: 20px; grid-row: span 2; accent-color: var(--accent); }
.toggle .tt { font-weight: 800; }
.toggle .td { color: var(--muted); font-size: .85rem; }
.start { display: grid; gap: 8px; }

/* ---------------------------------------------------------------- cards */

.card {
  --col: var(--surface-2);
  position: relative; flex: none; width: var(--cw); aspect-ratio: 5 / 7.4; border-radius: 12% / 8%;
  background: var(--col); border: 3px solid var(--ink); overflow: hidden; color: #fff; padding: 0;
  box-shadow: 0 3px 0 var(--ink), 0 8px 18px #0007; font-family: var(--display); user-select: none;
}
.card.sz-lg { --cw: 104px; }
.card.sz-sm { --cw: 34px; border-width: 2px; box-shadow: 0 2px 0 var(--ink); }
.c-red { --col: var(--red); }
.c-yellow { --col: var(--yellow); }
.c-green { --col: var(--green); }
.c-blue { --col: var(--blue); }
.c-wild { --col: #17111f; }
/* The spray stripe: a darker diagonal band with a speckled edge. */
.card::before {
  content: ""; position: absolute; inset: -30%;
  background:
    radial-gradient(circle at 30% 48%, #0003 0 2px, transparent 3px) 0 0 / 14px 14px,
    linear-gradient(118deg, transparent 40%, #0000002e 40% 60%, transparent 60%);
  pointer-events: none;
}
.c-wild::before { background: radial-gradient(circle at 50% 50%, #ffffff10 0 2px, transparent 3px) 0 0 / 12px 12px; }
.card .face { position: absolute; inset: 0; display: grid; place-items: center; }
.card .big {
  position: relative; font-size: calc(var(--cw) * .5); line-height: 1; transform: rotate(-8deg);
  -webkit-text-stroke: calc(var(--cw) * .045) var(--ink); paint-order: stroke fill; text-shadow: calc(var(--cw) * .04) calc(var(--cw) * .04) 0 var(--ink);
}
.card .big svg { width: calc(var(--cw) * .56); height: calc(var(--cw) * .56); filter: drop-shadow(2px 2px 0 var(--ink)) drop-shadow(-1px -1px 0 var(--ink)); }
.v-plus2 .big, .v-wild4 .big { font-size: calc(var(--cw) * .4); }
.v-wild .big { font-size: calc(var(--cw) * .25); }
.card .pip { position: absolute; font-size: calc(var(--cw) * .16); line-height: 1; -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; }
.card .pip svg { width: calc(var(--cw) * .17); height: calc(var(--cw) * .17); }
.card .pip.tl { top: 6%; left: 9%; }
.card .pip.br { bottom: 6%; right: 9%; }
/* 6 and 9 get an underline so they can't be confused. */
.v-6 .big, .v-9 .big, .v-6 .pip, .v-9 .pip { text-decoration: underline; text-decoration-thickness: .08em; text-underline-offset: .08em; }
.card .glyph { position: absolute; top: 5%; right: 9%; font-size: calc(var(--cw) * .13); color: #0008; font-family: var(--body); }
.card .splat {
  position: absolute; width: 74%; aspect-ratio: 1; border-radius: 46% 54% 38% 62% / 58% 40% 60% 42%; border: 3px solid var(--ink);
  background: conic-gradient(from 20deg, var(--red) 0 25%, var(--yellow) 0 50%, var(--green) 0 75%, var(--blue) 0);
  transform: rotate(-12deg);
}
.c-wild.chosen { box-shadow: 0 0 0 4px var(--chosen), 0 3px 0 var(--ink), 0 8px 18px #0007; }
.sz-sm .pip, .sz-sm .glyph { display: none; }
.sz-sm .big { -webkit-text-stroke-width: 1px; text-shadow: none; }
.sz-sm .splat { border-width: 1.5px; }

.card.back { background: #17111f; display: grid; place-items: center; }
.card.back::before {
  background:
    linear-gradient(135deg, transparent 0 30%, var(--red) 30% 38%, transparent 38% 46%, var(--yellow) 46% 54%, transparent 54% 62%, var(--green) 62% 70%, transparent 70%),
    #17111f;
  opacity: .9;
}
.card.back .brand { position: relative; font-size: calc(var(--cw) * .17); line-height: .95; text-align: center; transform: rotate(-20deg); -webkit-text-stroke: 1.5px var(--ink); paint-order: stroke fill; }

button.card { cursor: pointer; }
button.card.playable { transform: translateY(-10px); box-shadow: 0 0 0 3px #fff, 0 3px 0 var(--ink), 0 12px 24px #000a; }
button.card.playable:hover { transform: translateY(-18px) rotate(-2deg); }
button.card.dim { filter: saturate(.5) brightness(.72); }
.card.dealt { animation: deal .35s ease-out backwards; }
@keyframes deal { from { transform: translateY(-80px) scale(.6) rotate(-20deg); opacity: 0; } }

/* ---------------------------------------------------------------- table */

.table {
  min-height: 100dvh; max-width: 980px; margin: 0 auto; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  display: grid; grid-template-rows: auto auto 1fr auto auto; grid-template-columns: minmax(0, 1fr); gap: 10px;
}
.table > *, .me > * { min-width: 0; }
.tbar { display: flex; align-items: center; gap: 12px; }
.seats { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; justify-content: safe center; }
.seat {
  position: relative; flex: 0 0 auto; min-width: 104px; max-width: 140px; background: var(--surface); border: 2px solid var(--line);
  border-radius: 16px; padding: 8px 10px; display: grid; gap: 6px; transition: border-color .2s, transform .2s;
}
.seat.turn { border-color: var(--now); transform: translateY(2px); box-shadow: 0 0 0 3px color-mix(in srgb, var(--now) 35%, transparent); }
.seat.off { opacity: .55; }
.seat .who { display: flex; align-items: center; gap: 6px; min-width: 0; }
.seat .pname { font-weight: 700; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .backs { display: flex; height: 26px; padding-left: 8px; }
.seat .backs i { width: 18px; height: 26px; margin-left: -8px; border-radius: 3px; border: 1.5px solid var(--ink); background: linear-gradient(135deg, #17111f 30%, var(--red) 30% 45%, #17111f 45% 55%, var(--yellow) 55% 70%, #17111f 70%); }
.seat .meta { display: flex; align-items: center; gap: 6px; }
.badge { position: absolute; top: -10px; right: -6px; font-family: var(--display); font-size: .7rem; padding: 3px 8px; border-radius: 999px; border: 2px solid var(--ink); }
.badge.riot { position: static; background: var(--yellow); color: var(--ink); }
.seat .badge.riot { position: absolute; }
.badge.catch { background: var(--red); color: #fff; cursor: pointer; animation: pulse .6s ease-in-out infinite alternate; top: auto; bottom: -12px; right: 50%; translate: 50% 0; white-space: nowrap; }
@keyframes pulse { to { transform: scale(1.12); } }

/* The felt: draw pile, discard pile, direction and current colour. */
.felt { display: flex; align-items: center; justify-content: center; gap: clamp(20px, 6vw, 56px); position: relative; min-height: 190px; flex-wrap: wrap; }
.pile { position: relative; background: none; border: 0; padding: 0; }
.pile.draw { cursor: pointer; }
.pile.draw:disabled { cursor: default; }
.pile.draw.ready .card { animation: nudge 1.4s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(-6px) rotate(-3deg); } }
.pile.draw::before, .pile.draw::after { content: ""; position: absolute; inset: 0; border-radius: 12% / 8%; background: #17111f; border: 3px solid var(--ink); }
.pile.draw::before { transform: translate(6px, 6px); }
.pile.draw::after { transform: translate(3px, 3px); }
.pile.draw .card { position: relative; z-index: 1; }
.pile .count { position: absolute; z-index: 2; bottom: -10px; left: 50%; translate: -50% 0; background: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; font-weight: 800; font-size: .8rem; }
.pile.discard { display: grid; place-items: center; }
.pile.discard .dir {
  position: absolute; width: 190px; height: 190px; display: grid; place-items: center; font-size: 168px; line-height: 1; color: color-mix(in srgb, var(--now) 40%, transparent);
  animation: spin 6s linear infinite; pointer-events: none;
}
.pile.discard .dir.ccw { animation-direction: reverse; transform: scaleX(-1); }
@keyframes spin { to { rotate: 360deg; } }
.card.land { animation: land .3s cubic-bezier(.2, 1.4, .5, 1) both; }
.card.land.r0 { rotate: -6deg; } .card.land.r1 { rotate: 4deg; } .card.land.r2 { rotate: -2deg; } .card.land.r3 { rotate: 7deg; } .card.land.r4 { rotate: -9deg; }
@keyframes land { from { transform: scale(1.5) translateY(-40px); opacity: 0; } }
.now-color { position: absolute; bottom: -6px; left: 50%; translate: -50% 0; display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: .85rem; background: var(--surface); border: 1px solid var(--line); padding: 4px 12px; border-radius: 999px; }
.now-color .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--now); border: 2px solid var(--ink); }

.status { position: relative; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; background: var(--surface); border: 2px solid var(--line); border-radius: 16px; padding: 10px 14px; overflow: hidden; min-height: 58px; }
.status.mine { border-color: var(--now); }
.stext { font-weight: 700; }
.stext b { font-family: var(--display); font-weight: 400; }
.sbtns { display: flex; gap: 8px; }
.sbtns .btn { padding: 8px 14px; }
.timer { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #0004; }
.timer i { display: block; height: 100%; width: 100%; background: var(--now); }
.timer.low i { background: var(--red); }

.me { display: grid; gap: 4px; }
.me-bar { display: flex; align-items: center; gap: 8px; }
.me-bar .pname { font-weight: 800; }
.btn.riot { font-family: var(--display); font-weight: 400; background: var(--yellow); color: var(--ink); border-color: var(--ink); box-shadow: 0 4px 0 var(--ink); padding: 8px 18px; }
.btn.riot.urgent { background: var(--red); color: #fff; animation: pulse .4s ease-in-out infinite alternate; }
.hand { display: flex; overflow-x: auto; padding: 22px 12px 14px; scrollbar-width: thin; justify-content: safe center; }
.hand .card { transition: transform .15s, box-shadow .15s; }
.hand .card + .card { margin-left: calc(var(--cw) * -0.28); }
.hand.tight .card + .card { margin-left: calc(var(--cw) * -0.5); }
.reacts { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; }
.react { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-size: 1.25rem; width: 42px; height: 38px; cursor: pointer; transition: transform .1s; }
.react:active { transform: scale(.88); }

.overlay { position: fixed; inset: 0; z-index: 20; background: #07040fcc; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet { background: var(--surface); border: 2px solid var(--line); border-radius: 22px; padding: 22px; width: min(420px, 100%); text-align: center; display: grid; gap: 16px; }
.colors { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.swatch { background: var(--col); border: 3px solid var(--ink); border-radius: 16px; height: 86px; font-weight: 800; color: var(--ink); cursor: pointer; box-shadow: 0 4px 0 var(--ink); display: grid; place-items: center; font-size: 1.05rem; }
.swatch span { font-size: 1.6rem; line-height: 1; }
.swatch:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.targets { display: grid; gap: 8px; }
.target { display: flex; align-items: center; gap: 10px; background: var(--bg-2); border: 2px solid var(--line); border-radius: 12px; padding: 10px; cursor: pointer; }
.target .pname { flex: 1; text-align: left; font-weight: 700; }
.target:hover { border-color: var(--accent); }

#fx { position: fixed; inset: 0; pointer-events: none; z-index: 25; }
.float { position: absolute; translate: -50% -50%; animation: rise 1.8s ease-out forwards; }
.float.emoji { font-size: 2.6rem; }
.float.word { font-family: var(--display); font-size: 1.6rem; color: var(--yellow); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
@keyframes rise { 0% { transform: scale(.4); opacity: 0; } 15% { transform: scale(1.2); opacity: 1; } 100% { transform: translateY(-70px) scale(1); opacity: 0; } }

/* -------------------------------------------------------------- results */

.banner { text-align: center; display: grid; gap: 8px; padding: 18px 0 6px; }
.scores { list-style: none; padding: 0; display: grid; gap: 8px; }
.scores li { display: grid; grid-template-columns: auto 110px 1fr auto; align-items: center; gap: 10px; }
.scores .pname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scores .bar { height: 10px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.scores .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--red), var(--yellow), var(--green), var(--blue)); }
.leftovers { display: grid; gap: 10px; }
.left-row { display: grid; grid-template-columns: 100px 1fr; align-items: center; gap: 10px; }
.left-row .pname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-hand { display: flex; flex-wrap: wrap; gap: 4px; }

/* -------------------------------------------------------------- account */

.hright { display: flex; align-items: center; gap: 8px; }
.home-top { display: flex; justify-content: flex-end; min-height: 40px; }
img.avatar { object-fit: cover; background: var(--surface-2); }
.coin { display: inline-block; width: 1em; height: 1em; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 35%, #fff6c2 0 18%, var(--yellow) 19% 62%, #d99a00 63%); border: 2px solid var(--ink); vertical-align: -0.15em; }
.coin.big { width: 30px; height: 30px; }
.coin-chip { position: relative; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px 0 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; font-weight: 800; cursor: pointer; }
.coin-chip img { width: 28px; height: 28px; border-radius: 50%; }
.coin-chip:not(:has(img)) { padding-left: 12px; }
.dot-new { position: absolute; top: 2px; right: 2px; width: 10px; height: 10px; border-radius: 50%; background: var(--red); border: 2px solid var(--bg); }
.signin { display: grid; gap: 12px; justify-items: start; }
.gsi-slot { min-height: 44px; }
.dev-login { display: flex; gap: 8px; width: 100%; }
.dev-login input { flex: 1; }

.wallet { text-align: left; gap: 14px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.w-head { display: flex; align-items: center; gap: 12px; }
.w-head > div { flex: 1; min-width: 0; }
.w-head .avatar { background: var(--accent); }
.w-avatar { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--ink); }
.balance { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 6px 0; }
.balance b { font-family: var(--display); font-weight: 400; font-size: 2.4rem; line-height: 1; }
.w-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px; padding: 14px; display: grid; gap: 12px; }
.w-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.streak { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.sday { display: grid; justify-items: center; gap: 2px; padding: 6px 0; border-radius: 10px; background: var(--surface); border: 2px solid transparent; font-size: .62rem; color: var(--muted); }
.sday b { font-size: .85rem; color: var(--text); }
.sday.got { background: color-mix(in srgb, var(--green) 25%, var(--surface)); }
.sday.today { border-color: var(--yellow); }
.ledger { list-style: none; padding: 0; display: grid; gap: 6px; }
.ledger li { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 6px 2px; border-bottom: 1px solid var(--line); }
.ledger .pos { color: var(--green); }
.ledger .neg { color: var(--red); }
.reward { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 800; color: var(--yellow); }
.ad-mock .sheet { border-color: var(--yellow); }

/* ------------------------------------------------------- social sheets */

.badge-wrap { position: relative; }
.sheet.wide { width: min(560px, 100%); text-align: left; max-height: calc(100dvh - 32px); overflow-y: auto; }
.s-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tabs { margin-bottom: 4px; }
.board { list-style: none; padding: 0; display: grid; gap: 6px; }
.board li { display: grid; grid-template-columns: 34px auto 1fr auto auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 12px; background: var(--bg-2); }
.board li.you { outline: 2px solid var(--accent); }
.board .rank { text-align: center; font-weight: 800; color: var(--muted); }
.board .pname { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-coins { display: flex; align-items: center; gap: 8px; font-size: 1.2rem; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.item { background: var(--bg-2); border: 2px solid var(--line); border-radius: 16px; padding: 12px; display: grid; gap: 8px; justify-items: center; text-align: center; }
.item.on { border-color: var(--accent); }
.item .btn { width: 100%; padding: 8px; }
.item-art { height: 70px; display: grid; place-items: center; }
.item-art .card { --cw: 44px; }
.theme-swatch { width: 90px; height: 60px; border-radius: 12px; border: 2px solid var(--ink); display: block; }
.my-code { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--bg-2); border-radius: 14px; padding: 12px; }
.my-code .code { font-size: 1.6rem; }
.add-friend { display: flex; gap: 8px; }
.friends { list-style: none; padding: 0; display: grid; gap: 8px; }
.friends li { display: flex; align-items: center; gap: 10px; background: var(--bg-2); border-radius: 12px; padding: 8px 10px; }
.friends li.off { opacity: .6; }
.friends .pname { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.friends .btn { padding: 6px 12px; }
.presence { font-weight: 500; font-size: .8rem; color: var(--muted); }
.presence.on { color: var(--green); }
.invite-toast { position: fixed; z-index: 35; bottom: 16px; left: 50%; translate: -50% 0; display: flex; align-items: center; gap: 12px; background: var(--surface); border: 2px solid var(--accent); border-radius: 16px; padding: 10px 12px 10px 16px; box-shadow: 0 10px 30px #000a; animation: drop .25s ease-out; width: max-content; max-width: calc(100vw - 32px); }
.invite-toast .btn { padding: 8px 14px; }

.searching { gap: 12px; }
.spinner { display: flex; justify-content: center; gap: 8px; height: 56px; align-items: center; }
.spinner i { width: 26px; height: 38px; border-radius: 6px; border: 2px solid var(--ink); animation: hop .9s ease-in-out infinite; }
.spinner i:nth-child(1) { background: var(--red); }
.spinner i:nth-child(2) { background: var(--yellow); animation-delay: .12s; }
.spinner i:nth-child(3) { background: var(--green); animation-delay: .24s; }
.spinner i:nth-child(4) { background: var(--blue); animation-delay: .36s; }
@keyframes hop { 50% { transform: translateY(-14px) rotate(-8deg); } }

.react.troll { background: var(--accent); border-color: var(--ink); }
.troll-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.troll-btn { display: grid; justify-items: center; gap: 4px; background: var(--bg-2); border: 2px solid var(--line); border-radius: 14px; padding: 10px 4px; cursor: pointer; }
.troll-btn:hover:not(:disabled) { border-color: var(--accent); }
.troll-btn:disabled { opacity: .5; cursor: not-allowed; }
.troll-btn .ti { font-size: 1.8rem; }
.troll-btn .tt { font-family: var(--display); font-size: .62rem; }
.troll-pop { position: absolute; left: 50%; top: 38%; translate: -50% -50%; display: grid; justify-items: center; gap: 4px; animation: troll 2.6s cubic-bezier(.2, 1.5, .4, 1) forwards; }
.troll-pop .ti { font-size: 6rem; line-height: 1; filter: drop-shadow(4px 6px 0 var(--ink)); }
.troll-pop b { font-family: var(--display); font-weight: 400; font-size: 2.4rem; color: var(--yellow); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; transform: rotate(-6deg); }
.troll-pop .by { font-weight: 800; background: var(--ink); padding: 2px 10px; border-radius: 999px; }
@keyframes troll { 0% { transform: scale(.2) rotate(-30deg); opacity: 0; } 12% { transform: scale(1.15) rotate(6deg); opacity: 1; } 20% { transform: scale(1) rotate(0); } 85% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(.9) translateY(-30px); } }

/* ------------------------------------------------------------ cosmetics */

/* Card backs: on .card.back and on the mini backs of a seat (.backs i). */
.card.back.bk-neon::before, .backs.bk-neon i { background: linear-gradient(#ff4fd8 2px, transparent 2px) 0 0 / 100% 12px, linear-gradient(90deg, #2ee6ff 2px, transparent 2px) 0 0 / 12px 100%, #0d0620; }
.card.back.bk-flame::before, .backs.bk-flame i { background: radial-gradient(ellipse at 50% 120%, #ffcc29 0 25%, #ff7a1a 26% 45%, #ff3d5a 46% 62%, transparent 63%), #2a0b10; }
.card.back.bk-galaxy::before, .backs.bk-galaxy i { background: radial-gradient(circle at 30% 30%, #fff 0 1px, transparent 2px) 0 0 / 18px 18px, radial-gradient(circle at 70% 60%, #fff9 0 1px, transparent 2px) 0 0 / 23px 23px, radial-gradient(circle at 40% 40%, #6b3fd6, #170a35 70%); }
.card.back.bk-gold::before, .backs.bk-gold i { background: repeating-linear-gradient(45deg, #ffd75e 0 8px, #e6a700 8px 16px); }
.card.back.bk-neon::before, .card.back.bk-flame::before, .card.back.bk-galaxy::before, .card.back.bk-gold::before { opacity: 1; }
.card.back.bk-gold .brand { color: var(--ink); -webkit-text-stroke: 0; }

/* Avatar frames */
.framed { position: relative; display: inline-grid; place-items: center; border-radius: 50%; padding: 3px; flex: none; }
.fr-gold { background: linear-gradient(135deg, #fff1a8, #e6a700, #fff1a8); }
.fr-fire { background: conic-gradient(#ff3d5a, #ffcc29, #ff7a1a, #ff3d5a); animation: spin 2s linear infinite; }
.fr-fire > * { animation: spin 2s linear infinite reverse; }
.fr-rainbow { background: conic-gradient(var(--red), var(--yellow), var(--green), var(--blue), var(--accent), var(--red)); animation: spin 3s linear infinite; }
.fr-rainbow > * { animation: spin 3s linear infinite reverse; }
.fr-crown { background: linear-gradient(135deg, #fff1a8, #e6a700); }
.fr-crown::after { content: "👑"; position: absolute; top: -.85em; left: 50%; translate: -50% 0; font-size: .9em; }

/* Table themes (body[data-theme]) */
body[data-theme="sunset"] { background: radial-gradient(800px 500px at 50% 0%, #ff7a1a33, transparent 70%), linear-gradient(#2a0f2e, #120d1d) fixed; }
body[data-theme="ocean"] { background: radial-gradient(800px 500px at 50% 0%, #2ee6ff2b, transparent 70%), linear-gradient(#061a33, #0a0d1f) fixed; }
body[data-theme="jungle"] { background: radial-gradient(800px 500px at 50% 0%, #23d68a2b, transparent 70%), linear-gradient(#08241a, #0c1410) fixed; }
body[data-theme="arcade"] { background: linear-gradient(#ff4fd80d 1px, transparent 1px) 0 0 / 100% 32px, linear-gradient(90deg, #2ee6ff0d 1px, transparent 1px) 0 0 / 32px 100%, radial-gradient(800px 500px at 50% 0%, #ff4fd833, transparent 70%), #0b0718; background-attachment: fixed; }
.th-night { background: linear-gradient(135deg, #ff3d5a55, #120d1d 50%, #3a86ff55); }
.th-sunset { background: linear-gradient(#ff7a1a, #2a0f2e); }
.th-ocean { background: linear-gradient(#2ee6ff, #061a33); }
.th-jungle { background: linear-gradient(#23d68a, #08241a); }
.th-arcade { background: linear-gradient(#ff4fd8 1px, transparent 1px) 0 0 / 100% 10px, linear-gradient(90deg, #2ee6ff 1px, transparent 1px) 0 0 / 10px 100%, #0b0718; }

/* ---------------------------------------------------------------- voice */

.players-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.players-head h3 { margin: 0; }
.voice-ctl { display: inline-flex; gap: 6px; border-radius: 14px; }
.voice-btn { padding: 7px 12px; font-size: .9rem; }
.voice-btn.live { background: var(--green); color: var(--ink); border-color: var(--ink); }
.voice-btn.muted { background: var(--red); color: #fff; border-color: var(--ink); }
.vbadge { background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; font-size: .75rem; line-height: 1; padding: 3px 5px; cursor: pointer; flex: none; }
.vbadge.blocked { opacity: .7; }
.vbadge.wait { animation: pulse .6s ease-in-out infinite alternate; }
/* Talking: a green glow on the seat / lobby row / your own bar. */
.speaking { box-shadow: 0 0 0 3px var(--green), 0 0 18px color-mix(in srgb, var(--green) 60%, transparent) !important; transition: box-shadow .08s; }
.me-bar.speaking, .voice-ctl.speaking { border-radius: 14px; }

/* --------------------------------------------------------------- toasts */

#toasts { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 30; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { background: var(--text); color: var(--ink); font-weight: 700; padding: 10px 16px; border-radius: 12px; border-left: 6px solid var(--accent); box-shadow: 0 10px 30px #000a; animation: drop .25s ease-out; transition: opacity .4s; }
.toast.bad { border-left-color: var(--red); }
.toast.out { opacity: 0; }
@keyframes drop { from { transform: translateY(-16px); opacity: 0; } }
.offline-note { display: none; position: fixed; bottom: 12px; left: 50%; translate: -50% 0; background: var(--red); color: #fff; font-weight: 800; padding: 6px 14px; border-radius: 999px; z-index: 40; }
body.offline .offline-note { display: block; }

/* --------------------------------------------------------- small screens */

@media (max-width: 600px) {
  :root { --cw: 70px; }
  .card.sz-lg { --cw: 84px; }
  .felt { min-height: 150px; }
  .pile.discard .dir { width: 150px; height: 150px; font-size: 130px; }
  .seat { min-width: 92px; padding: 6px 8px; }
  .join { grid-template-columns: 1fr auto; }
  .join .label { grid-column: 1 / -1; }
  .scores li { grid-template-columns: auto 1fr auto; }
  .scores .bar { display: none; }
  .react { width: 34px; height: 34px; font-size: 1rem; }
  .troll-grid { grid-template-columns: repeat(2, 1fr); }
  .hright .icon-btn { width: 34px; height: 34px; font-size: .95rem; }
  .tbar { gap: 8px; }
  .tbar > .label { display: none; }
  .top { flex-wrap: wrap; justify-content: center; row-gap: 10px; }
  .tbar .logo.small { font-size: 1.05rem; }
  .hright { gap: 4px; }
  .coin-chip { height: 34px; padding: 0 8px 0 4px; font-size: .85rem; }
  .coin-chip img { width: 24px; height: 24px; }
  .reacts { gap: 3px; }
  .hand .card + .card { margin-left: calc(var(--cw) * -0.4); }
  .hand.tight .card + .card { margin-left: calc(var(--cw) * -0.58); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
