/*
VOICE  cozy night-market: warm, playful, chunky sticker UI
IDEA   a lantern-lit food stall table; every button is a sticker you can press
PICTURE the hot pot table (SVG on the hub, 3D in the game)
COLOUR plum night ground, cream stickers, lantern yellow, chili red, mint
TYPE   Fredoka for display, Nunito for text
*/
:root {
  --plum: #2a1422; --plum2: #3d1f33; --line: #5a3249; --dash: #6b3d58;
  --cream: #fff4e2; --ink: #3b2219; --chili: #e5543b; --lantern: #ffb547; --mint: #7ed3b2; --pink: #ff8fab;
  --muted: #e0bccd; --soft: #f3d9c4; --deep: #160a12;
  --fd: 'Fredoka', 'Nunito', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; min-width: 0; }
html, body { margin: 0; height: 100%; }
body { background: var(--plum); color: var(--cream); font: 17px/1.55 'Nunito', system-ui, sans-serif; overflow-x: clip; -webkit-tap-highlight-color: transparent; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--lantern); }
h1, h2, h3 { font-family: var(--fd); font-weight: 600; margin: 0; line-height: 1.08; text-wrap: balance; }
:focus-visible { outline: 3px solid var(--lantern); outline-offset: 3px; }
[hidden] { display: none !important; }

/* ---------- sticker buttons ---------- */
.btn {
  font-family: var(--fd); font-weight: 600; font-size: 17px; color: var(--ink); background: var(--lantern);
  border: 3px solid var(--ink); border-radius: 16px; padding: 10px 20px; min-height: 48px; cursor: pointer;
  box-shadow: 0 5px 0 var(--ink); transition: transform .12s cubic-bezier(.3, 1.6, .5, 1), box-shadow .12s, filter .12s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; user-select: none;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); filter: brightness(1.05); }
.btn:active:not(:disabled) { transform: translateY(4px) scale(.98); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.big { font-size: 21px; padding: 14px 28px; min-height: 58px; border-radius: 18px; }
.btn.m { background: var(--mint); } .btn.w { background: #fff; } .btn.p { background: var(--pink); }
.btn.r { background: var(--chili); color: #fff; }
.btn.ghost { background: transparent; color: var(--cream); border-color: var(--dash); box-shadow: none; }
.btn.ghost:hover { box-shadow: none; background: #ffffff10; }
.chip { font-family: var(--fd); font-weight: 600; background: var(--plum2); border: 3px solid var(--line); border-radius: 999px; padding: 5px 14px; white-space: nowrap; }
.round { width: 46px; height: 46px; border-radius: 50%; padding: 0; background: var(--plum2); border: 3px solid var(--line); color: var(--cream); font-family: var(--fd); font-weight: 700; font-size: 19px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: transform .12s; }
.round:hover { transform: scale(1.08); } .round:active { transform: scale(.92); }
.avatar { width: var(--s, 52px); height: var(--s, 52px); border-radius: 50%; overflow: hidden; background: color-mix(in srgb, var(--c) 40%, #fff4e2); border: 3px solid var(--ink); display: flex; align-items: center; justify-content: center; font-family: var(--fd); font-weight: 700; font-size: calc(var(--s, 52px) * .42); color: var(--ink); flex: none; }
.field { background: var(--cream); color: var(--ink); border: 3px solid var(--ink); border-radius: 14px; padding: 10px 14px; font-family: var(--fd); font-weight: 600; font-size: 18px; min-height: 50px; }
.field::placeholder { color: #a48a7e; }

/* ---------- hub ---------- */
.top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 16px max(4vw, 16px); border-bottom: 3px solid var(--plum2); }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--fd); font-weight: 700; font-size: 27px; color: var(--cream); text-decoration: none; }
.brand .steam path { animation: steam 2.4s ease-in-out infinite; }
.navl { display: flex; gap: 22px; font-family: var(--fd); font-weight: 500; }
.navl a { color: var(--cream); text-decoration: none; } .navl a:hover { color: var(--lantern); }
.me { display: flex; align-items: center; gap: 10px; background: var(--plum2); border: 3px solid var(--line); border-radius: 999px; padding: 4px 16px 4px 4px; font-family: var(--fd); font-weight: 600; cursor: pointer; color: var(--cream); min-height: 48px; }
.me small { opacity: .6; font-weight: 400; font-size: 15px; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 max(4vw, 16px); }
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 28px; padding-block: 44px 28px; }
.hero > div { flex: 1 1 420px; display: flex; flex-direction: column; gap: 20px; }
.hero h1 { font-size: clamp(36px, 5.4vw, 54px); font-weight: 700; line-height: 1.04; }
.hero p { margin: 0; font-size: 19px; color: var(--soft); max-width: 34em; }
.hero .art { flex: 1 1 380px; height: clamp(300px, 40vw, 430px); }
.tableart { width: 100%; height: 100%; display: block; }
.tableart .orbit { animation: bob 3.2s ease-in-out infinite; animation-delay: var(--d); }
.tableart .bub { animation: bub 2.4s ease-out infinite; animation-delay: var(--d); opacity: 0; transform-box: fill-box; transform-origin: center; }
.tableart .wisp { animation: wisp 3s ease-in-out infinite; animation-delay: var(--d); opacity: 0; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.codeform { align-self: flex-start; display: flex; gap: 8px; align-items: center; background: var(--plum2); border: 3px solid var(--line); border-radius: 18px; padding: 6px 6px 6px 16px; }
.codeform label { font-family: var(--fd); font-size: 15px; color: var(--soft); }
.livestats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 14px 0 0; font-size: 15px; color: var(--muted); min-height: 1.4em; }
.livestats b { color: var(--cream); font-family: var(--fd); font-weight: 600; }
.livestats .on i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--mint); margin-right: 7px; vertical-align: 1px; box-shadow: 0 0 0 3px rgba(126,211,178,.22); animation: livepulse 2s ease-in-out infinite; }
@keyframes livepulse { 50% { box-shadow: 0 0 0 6px rgba(126,211,178,0); } }
@media (prefers-reduced-motion: reduce) { .livestats .on i { animation: none; } }
.code-in { width: 104px; text-align: center; letter-spacing: 5px; text-transform: uppercase; font-size: 22px; font-weight: 700; padding: 6px 8px; }
section h2 { font-size: 32px; margin-bottom: 18px; }
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 20px; }
.gcard { background: var(--cream); color: var(--ink); border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 7px 0 var(--deep); overflow: hidden; display: flex; flex-direction: column; transition: transform .2s cubic-bezier(.3, 1.6, .5, 1); }
.gcard:hover { transform: translateY(-4px) rotate(-.4deg); }
.gcard .pic { height: 150px; background: var(--chili); border-bottom: 3px solid var(--ink); display: flex; align-items: center; justify-content: center; gap: 6px; }
.gcard .pic .card:nth-child(1) { transform: rotate(-10deg); } .gcard .pic .card:nth-child(3) { transform: rotate(10deg); }
.gcard .pic .card:nth-child(2) { transform: translateY(-6px); }
.gcard:hover .pic .card:nth-child(1) { transform: rotate(-16deg) translateX(-6px); } .gcard:hover .pic .card:nth-child(3) { transform: rotate(16deg) translateX(6px); }
.gcard .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.gcard h3 { font-size: 26px; font-weight: 700; }
.gcard p { margin: 0; font-size: 16px; }
.tag { font-weight: 800; font-size: 14px; background: #ffe2a8; border-radius: 999px; padding: 3px 10px; white-space: nowrap; }
.soon { border: 3px dashed var(--dash); border-radius: 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 28px; text-align: center; color: var(--muted); min-height: 280px; }
.soon svg { opacity: .5; }
.soon h3 { color: var(--cream); font-size: 22px; }
.soon p { margin: 0; font-size: 15px; }
.tables { display: flex; flex-direction: column; gap: 12px; }
.trow { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; background: var(--plum2); border: 3px solid var(--line); border-radius: 18px; padding: 12px 16px; animation: popin .35s cubic-bezier(.3, 1.6, .5, 1) both; }
.trow .who { flex: 1 1 180px; } .trow .who b { font-family: var(--fd); font-weight: 600; font-size: 19px; display: block; }
.trow .who span { font-size: 14px; color: var(--muted); }
.dots { display: flex; gap: 6px; } .dots i { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--cream); } .dots i.on { background: var(--cream); }
.tcode { font-family: var(--fd); font-weight: 700; letter-spacing: 3px; color: var(--lantern); font-size: 18px; }
.empty { border: 3px dashed var(--dash); border-radius: 18px; padding: 22px; text-align: center; color: var(--muted); }
footer { padding: 22px; text-align: center; font-size: 14px; color: #a97b93; border-top: 3px solid var(--plum2); margin-top: 48px; }

.gcard .pic.marblepic { background: #3d1f33; padding: 0; }
.gcard .pic.marblepic svg { width: 100%; height: 100%; display: block; }
.gcard .pic.ladderpic { background: #3d1f33; padding: 0; }
.gcard .pic.ladderpic svg { width: 100%; height: 100%; display: block; }
.marblepic .roll { animation: bob 2.2s ease-in-out infinite; animation-delay: var(--d); }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: #160a12cc; backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; animation: fade .2s both; }
.sheet { background: var(--cream); color: var(--ink); border: 3px solid var(--ink); border-radius: 26px; box-shadow: 0 9px 0 var(--deep); padding: 28px; width: min(460px, 100%); max-height: calc(100vh - 32px); overflow: auto; display: flex; flex-direction: column; gap: 18px; animation: popin .35s cubic-bezier(.3, 1.6, .5, 1) both; }
.sheet h2 { font-size: 30px; color: var(--ink); }
.sheet .rules + h2 { margin-top: 6px; }
.sheet p { margin: 0; color: #6b4a3c; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatches button { width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--ink); background: var(--c); cursor: pointer; transition: transform .15s cubic-bezier(.3, 1.6, .5, 1); }
.swatches button[aria-pressed=true] { transform: scale(1.18); box-shadow: 0 0 0 4px var(--cream), 0 0 0 7px var(--ink); }
.preview { display: flex; align-items: center; gap: 14px; }
.rules { font-size: 16px; line-height: 1.55; color: #5a3d31; }
.rules ol { padding-left: 1.2em; margin: 0; display: grid; gap: 6px; }
.rules b { font-family: var(--fd); font-weight: 600; color: var(--ink); }

.avatar svg { width: 100%; height: 100%; display: block; }
.avatar.spin { animation: popin .4s cubic-bezier(.3, 1.6, .5, 1); }
.sheet:has(.creator) { width: min(720px, 100%); }
.creator .preview { position: sticky; top: -28px; z-index: 2; background: var(--cream); padding: 10px 0; border-bottom: 3px dashed #e6cfbd; }
.cgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 22px; }
.crow.wide { grid-column: 1 / -1; }
@media (max-width: 600px) { .cgrid { grid-template-columns: minmax(0, 1fr); } }
.creator { display: flex; flex-direction: column; gap: 14px; }
.creator .preview { align-items: center; gap: 18px; }
.creator .namecol { flex: 1; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.creator .namecol label, .crow b { font-family: var(--fd); font-weight: 600; font-size: 15px; color: #6b4a3c; }
.creator .namecol .field { width: 100%; }
.btn.sm { font-size: 15px; padding: 5px 14px; min-height: 40px; border-radius: 12px; box-shadow: 0 3px 0 var(--ink); }
.crow { display: flex; flex-direction: column; gap: 6px; }
.creator .swatches { gap: 8px; }
.creator .swatches button { width: 34px; height: 34px; }
.sheet .pills button { color: var(--ink); border-color: #c9a99a; min-height: 40px; padding: 5px 13px; font-size: 15px; }

/* ---------- lobby ---------- */
.lobby { display: flex; flex-wrap: wrap; gap: 28px; padding-block: 36px 48px; }
.lobby .main { flex: 999 1 520px; display: flex; flex-direction: column; gap: 24px; }
.lobby aside { flex: 1 1 320px; background: var(--plum2); border: 3px solid var(--line); border-radius: 24px; padding: 24px; display: flex; flex-direction: column; gap: 20px; align-self: flex-start; }
.crumb { display: flex; align-items: center; gap: 10px; font-family: var(--fd); font-weight: 600; font-size: 19px; color: var(--muted); }
.codetiles { display: flex; gap: 8px; }
.codetiles span { width: clamp(50px, 12vw, 64px); height: clamp(60px, 14vw, 76px); display: flex; align-items: center; justify-content: center; background: var(--cream); color: var(--ink); border: 3px solid var(--ink); border-radius: 14px; box-shadow: 0 5px 0 var(--deep); font-family: var(--fd); font-weight: 700; font-size: clamp(32px, 8vw, 44px); animation: popin .4s cubic-bezier(.3, 1.6, .5, 1) both; }
.codetiles span:nth-child(2) { animation-delay: .06s; } .codetiles span:nth-child(3) { animation-delay: .12s; } .codetiles span:nth-child(4) { animation-delay: .18s; }
.seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.seat { display: flex; align-items: center; gap: 14px; border-radius: 20px; padding: 14px; min-height: 92px; }
.seat.full { background: var(--cream); color: var(--ink); border: 3px solid var(--ink); box-shadow: 0 6px 0 var(--deep); animation: popin .4s cubic-bezier(.3, 1.6, .5, 1) both; }
.seat.full b { font-family: var(--fd); font-weight: 700; font-size: 21px; display: block; }
.seat.full span { font-size: 15px; color: #7a5545; }
.seat.open { border: 3px dashed var(--dash); color: var(--muted); }
.seat.open b { font-family: var(--fd); font-weight: 600; font-size: 19px; color: var(--cream); display: block; }
.seat.open svg { opacity: .55; flex: none; }
.offline { opacity: .5; }
.opt b { font-family: var(--fd); font-weight: 500; display: block; margin-bottom: 8px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills button { font-family: var(--fd); font-weight: 600; font-size: 16px; padding: 8px 16px; min-height: 44px; border-radius: 12px; border: 3px solid var(--dash); background: transparent; color: var(--cream); cursor: pointer; transition: transform .12s; }
.pills button[aria-pressed=true] { border-color: var(--ink); background: var(--lantern); color: var(--ink); }
.pills button:not(:disabled):active { transform: scale(.94); }
.pills button:disabled { cursor: default; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-family: var(--fd); font-weight: 500; cursor: pointer; }
.toggle input { appearance: none; width: 58px; height: 34px; border-radius: 999px; background: var(--dash); border: 3px solid var(--ink); position: relative; cursor: pointer; transition: background .2s; flex: none; }
.toggle input::after { content: ''; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.toggle input:checked { background: var(--mint); } .toggle input:checked::after { transform: translateX(23px); }
.howto { background: var(--plum); border-radius: 16px; padding: 16px; font-size: 15px; color: var(--soft); }
.howto b { font-family: var(--fd); font-weight: 600; color: var(--lantern); }

/* ---------- toasts / connection ---------- */
#toasts { position: fixed; left: 50%; top: 74px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 80; pointer-events: none; width: max-content; max-width: 92vw; }
.toast { background: var(--cream); color: var(--ink); border: 3px solid var(--ink); border-radius: 16px; padding: 8px 16px; font-family: var(--fd); font-weight: 600; box-shadow: 0 5px 0 var(--deep); animation: toast 2.8s cubic-bezier(.3, 1.6, .5, 1) both; display: flex; align-items: center; gap: 8px; }
.toast svg { width: 30px; height: 30px; flex: none; }
.toast.bad { background: #ffd4cc; }
#conn { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 90; background: var(--chili); color: #fff; border: 3px solid var(--ink); border-radius: 999px; padding: 6px 16px; font-family: var(--fd); font-weight: 600; }
#conn.replaced { background: var(--ink); }
#conn button { margin-left: 8px; font: inherit; background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 12px; cursor: pointer; }

/* ---------- chat & reactions ---------- */
#chat { position: fixed; right: 18px; bottom: 18px; z-index: 40; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.chatbtn { background: var(--pink); position: relative; }
.chatbtn .badge { position: absolute; top: -10px; right: -8px; min-width: 26px; height: 26px; border-radius: 13px; background: var(--chili); color: #fff; border: 3px solid var(--ink); font-size: 13px; display: flex; align-items: center; justify-content: center; padding: 0 4px; animation: popin .3s cubic-bezier(.3, 1.6, .5, 1); }
.chatpanel { width: min(340px, calc(100vw - 16px)); height: min(430px, 62vh); background: var(--cream); color: var(--ink); border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 7px 0 var(--deep); display: flex; flex-direction: column; overflow: hidden; animation: popin .25s cubic-bezier(.3, 1.6, .5, 1) both; transform-origin: bottom right; }
.chathead { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 16px; background: var(--pink); border-bottom: 3px solid var(--ink); font-family: var(--fd); font-size: 19px; }
.chathead .round { width: 36px; height: 36px; background: var(--cream); color: var(--ink); border-color: var(--ink); }
.chatlog { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.cl { display: flex; gap: 8px; align-items: flex-start; animation: popin .25s both; }
.cl p { margin: 0; color: var(--ink); background: #fff; border: 2.5px solid var(--ink); border-radius: 4px 14px 14px 14px; padding: 4px 10px; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.cl p b { font-family: var(--fd); font-weight: 600; margin-right: 4px; color: #a8452f; }
.cl.own { flex-direction: row-reverse; } .cl.own p { background: #ffe9b8; border-radius: 14px 4px 14px 14px; } .cl.own p b { display: none; }
.cl .avatar { border-width: 2.5px; margin-top: 2px; }
.chatempty { margin: auto; color: #8a6a5c; font-size: 15px; }
.chatemoji { display: flex; justify-content: space-between; padding: 6px 10px; border-top: 3px dashed #e6cfbd; }
.chatemoji button { width: 42px; height: 42px; border-radius: 12px; border: 0; background: transparent; font-size: 24px; cursor: pointer; transition: transform .15s cubic-bezier(.3, 1.6, .5, 1); }
.chatemoji button:hover { transform: scale(1.3) rotate(-8deg); } .chatemoji button:active { transform: scale(.85); }
.chatform { display: flex; gap: 6px; padding: 8px; border-top: 3px solid var(--ink); background: #ffe9d0; }
.chatform .field { flex: 1; min-height: 44px; padding: 6px 12px; font-size: 16px; font-family: inherit; font-weight: 600; }
.chatform .btn { min-height: 44px; padding: 6px 14px; box-shadow: 0 3px 0 var(--ink); }
.chatpeek { max-width: min(300px, 80vw); animation: popin .3s cubic-bezier(.3, 1.6, .5, 1) both; }
.chatpeek .cl p { box-shadow: 0 4px 0 var(--deep); }
.floaty { position: fixed; z-index: 45; width: 64px; height: 64px; pointer-events: none; animation: floaty 1.6s cubic-bezier(.3, 1.4, .5, 1) both; filter: drop-shadow(0 4px 0 #0006); }
.floaty svg { width: 100%; height: 100%; }
.floaty .emo { font-size: 52px; line-height: 64px; display: block; text-align: center; }
@keyframes floaty { 0% { opacity: 0; transform: translateY(20px) scale(.3); } 20% { opacity: 1; transform: translateY(-10px) scale(1.15); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-110px) scale(.9) rotate(12deg); } }

/* ---------- cards ---------- */
.card {
  --w: var(--cw, 92px); width: var(--w); height: calc(var(--w) * 1.38); background: var(--cream); border: 3px solid var(--ink);
  border-radius: calc(var(--w) * .15); box-shadow: 0 5px 0 var(--ink); display: flex; flex-direction: column; align-items: center;
  overflow: hidden; flex: none; color: var(--ink); padding: 0; position: relative;
}
.card::before { content: ''; position: absolute; left: 9%; right: 9%; top: 23%; aspect-ratio: 1; border-radius: 50%; background: var(--c); opacity: .17; }
.card > * { position: relative; }
.card .band { width: 100%; background: linear-gradient(#ffffff38, #ffffff00 60%), var(--c); color: #fff; font-family: var(--fd); font-weight: 600; font-size: calc(var(--w) * .12); text-align: center; padding: 2px 0; border-bottom: 3px solid var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 0 #3b221955; }
.card svg { width: 82%; height: auto; margin-top: 2%; }
.card .nm { font-family: var(--fd); font-weight: 600; font-size: calc(var(--w) * .13); text-align: center; line-height: 1.05; padding: 0 3px; }
.card.back { background: radial-gradient(circle, #ffffff2e 18%, transparent 20%) 0 0 / calc(var(--w) * .2) calc(var(--w) * .2), var(--chili); justify-content: center; }
.card.back::before { left: 12%; right: 12%; top: auto; background: #fff4e2; opacity: .2; }
.card.back svg { width: 80%; margin: 0; }
/* little signs of life in the ingredient art (icons.js): blinking eyes, twinkling sparkles, beating hearts */
.fx-eyes, .fx-sp, .fx-hrt { transform-box: fill-box; transform-origin: center; }
.fx-eyes { animation: fxblink 4.6s steps(1) infinite; } /* steps: a few repaints a second instead of sixty */
.fx-sp { animation: fxtwinkle 2.4s steps(1) infinite; } .fx-sp + .fx-sp { animation-delay: -.9s; }
.fx-hrt { animation: fxbeat 2.4s steps(1) infinite; }
.card:nth-child(3n) .fx-eyes { animation-delay: -1.4s; } .card:nth-child(3n+1) .fx-eyes { animation-delay: -3.1s; } .card:nth-child(2n) .fx-sp { animation-delay: -.5s; }
@keyframes fxblink { 0%, 96%, 100% { transform: none; } 93% { transform: scaleY(.08); } }
@keyframes fxtwinkle { 0%, 100% { transform: none; } 50% { transform: scale(.6) rotate(45deg); } }
@keyframes fxbeat { 0%, 100% { transform: none; } 50% { transform: scale(1.25); } }
@keyframes fxbob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-3%) rotate(-1.5deg); } }
@keyframes fxwiggle { 0%, 100% { transform: rotate(0) scale(1.06); } 25% { transform: rotate(-7deg) scale(1.1); } 75% { transform: rotate(7deg) scale(1.1); } }

/* keyframes */
@keyframes steam { 0%, 100% { transform: translateY(0); opacity: .9; } 50% { transform: translateY(-4px); opacity: .5; } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-6px) rotate(3deg); } }
@keyframes bub { 0% { opacity: 0; transform: scale(.2); } 30% { opacity: .55; } 80% { opacity: .5; transform: scale(1); } 100% { opacity: 0; transform: scale(1.6); } }
@keyframes wisp { 0% { opacity: 0; transform: translateY(10px); } 40% { opacity: .35; } 100% { opacity: 0; transform: translateY(-30px); } }
@keyframes popin { 0% { opacity: 0; transform: scale(.6) translateY(12px); } 100% { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes toast { 0% { opacity: 0; transform: translateY(-14px) scale(.8); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-8px); } }

@media (max-width: 600px) {
  .navl { display: none; }
  .hero { padding-top: 24px; }
  .codeform { width: 100%; } .codeform label { flex: 1; }
  .sheet { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ---------- ranks, XP and scoreboards ---------- */
.lv { display: inline-flex; align-items: center; gap: 4px; font-family: var(--fd); font-weight: 700; font-size: 14px; line-height: 1; background: var(--lantern); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; padding: 3px 9px; white-space: nowrap; vertical-align: middle; }
.lvslot:empty { display: none; }
.mecard { background: var(--plum2); border: 3px solid var(--line); border-radius: 24px; padding: 22px; display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.rankrow { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.rankicon { font-size: 40px; line-height: 1; width: 68px; height: 68px; display: grid; place-items: center; background: var(--cream); border: 3px solid var(--ink); border-radius: 20px; box-shadow: 0 5px 0 var(--deep); flex: none; }
.rankname { flex: 1 1 200px; } .rankname b { font-family: var(--fd); font-weight: 600; font-size: 26px; display: block; line-height: 1.1; }
.rankname span, .xpnote { font-size: 14px; color: var(--muted); }
.acct { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.acct b { color: var(--cream); }
.btn.sm.ghost { box-shadow: none; }
.xpbar { height: 18px; background: var(--deep); border: 3px solid var(--ink); border-radius: 999px; overflow: hidden; }
.xpbar i { display: block; height: 100%; min-width: 6px; background: linear-gradient(90deg, var(--mint), var(--lantern)); border-radius: 999px; transition: width .6s cubic-bezier(.3, 1.2, .5, 1); }
.xpnote { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.stats div { background: var(--plum); border-radius: 16px; padding: 12px 14px; }
.stats b { font-family: var(--fd); font-weight: 600; font-size: 28px; display: block; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stats span { font-size: 14px; color: var(--muted); }
.pergame { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 24px; font-size: 15px; }
.pergame b { font-family: var(--fd); font-weight: 600; margin-right: 8px; } .pergame span { color: var(--muted); }
.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.board li { display: flex; align-items: center; gap: 10px; background: var(--plum); border-radius: 14px; padding: 8px 12px; }
.board li:first-child { outline: 2px solid var(--lantern); }
.board .pos { font-family: var(--fd); font-weight: 700; width: 18px; text-align: center; color: var(--lantern); flex: none; }
.board li > b { font-family: var(--fd); font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .num { font-size: 14px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; } .board .num b { color: var(--cream); font-family: var(--fd); }
.authform { display: flex; flex-direction: column; gap: 8px; }
.authform label { font-family: var(--fd); font-weight: 600; margin-top: 6px; }
.authform .btn.big { margin-top: 10px; }
.autherr { color: #b3261e !important; font-weight: 700; }
.btn.ghost-ink { background: transparent; border-color: transparent; box-shadow: none; text-decoration: underline; }
.btn.ghost-ink:hover:not(:disabled) { box-shadow: none; transform: none; }

/* ---------- results: play-again voting (shared by every game) ---------- */
.again { display: flex; flex-direction: column; gap: 12px; }
.again .row { display: flex; flex-wrap: wrap; gap: 12px; }
.again .tally { align-self: flex-start; display: inline-flex; align-items: center; gap: 10px; background: #fff; color: var(--ink); border: 3px solid #c9a99a; border-radius: 999px; padding: 4px 16px 4px 6px; font-family: var(--fd); font-weight: 600; min-height: 44px; }
.again .tally b { font-size: 20px; }
.again .tally.all { background: #e3f7ee; border-color: var(--mint); }
.again .faces { display: inline-flex; }
.again .faces:empty { display: none; }
.again .face { margin-left: -8px; animation: popin .3s cubic-bezier(.3, 1.6, .5, 1) both; }
.again .face:first-child { margin-left: 0; }
.again .face .avatar { box-shadow: 0 0 0 2px #fff; }
.again .wait { font-size: 15px; }
.sheet .chip { background: #fff; color: var(--ink); border-color: #c9a99a; }

.board li { flex-wrap: wrap; row-gap: 2px; } .board li > b { min-width: 5em; }
.boardnote { margin: 0; font-size: 14px; color: var(--muted); }
.chatbtns { display: flex; gap: 8px; align-items: flex-end; }
body:has(.lobby) .scorebtn { display: none; }
.scorepanel { height: auto; max-height: min(430px, 62vh); }
.scorebody { padding: 12px; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.scorepanel .board li { background: #f6e3cb; } .scorepanel .board .pos { color: var(--chili); }
.scorepanel .board .num, .scorepanel .boardnote { color: #7a5545; } .scorepanel .board .num b { color: var(--ink); }
.scorepanel .board li:first-child { outline-color: var(--ink); }
@media (max-width: 760px) { body.in-game .scorebtn .lbl { display: none; } body.in-game .scorebtn { padding: 6px 10px; min-height: 40px; } }
@media (max-width: 1150px) { body:has(.mr) .scorebtn .lbl { display: none; } }
/* watcher bar: shown over a game to people who joined mid-game */
#watchbar { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 45; display: flex; align-items: center; gap: 12px;
  background: #fff; color: var(--ink); border: 3px solid #c9a99a; border-radius: 999px; padding: 5px 5px 5px 18px; font-family: var(--fd); font-weight: 600;
  box-shadow: 0 6px 18px #0004; max-width: calc(100vw - 32px); }
#watchbar[hidden] { display: none; }
#watchbar .btn { min-height: 40px; padding: 6px 16px; white-space: nowrap; }
@media (max-width: 560px) { #watchbar { left: 16px; right: 16px; bottom: max(8px, env(safe-area-inset-bottom)); transform: none; justify-content: space-between; font-size: 14px; padding-left: 14px; } }
.gcard .pic.pokerpic { background: #2b7a5e; padding: 0; }
.gcard .pic.pokerpic svg { width: 100%; height: 100%; display: block; }
.pokerpic .fan { animation: bob 2.6s ease-in-out infinite; animation-delay: var(--d); }

.gcard .pic.ludopic { background: #3d1f33; padding: 0; }
.gcard .pic.ludopic svg { width: 100%; height: 100%; display: block; }
.gcard .pic.farmpic { background: #bfe8ff; padding: 0; }
.gcard .pic.farmpic svg { width: 100%; height: 100%; display: block; }

/* ---------- avatar creator: 3D preview on the left, tabs of options on the right ---------- */
.avatar { background-size: cover; background-position: center; }
.sheet:has(.creator) { width: min(860px, 100%); }
.creator .cmain { display: grid; grid-template-columns: minmax(0, 250px) minmax(0, 1fr); gap: 18px; align-items: start; }
.creator .pvcol { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; }
.creator .pv3d { aspect-ratio: 4 / 5; border-radius: 18px; border: 3px solid var(--ink); background: linear-gradient(#ffe9d2, #ffd3b8); overflow: hidden; touch-action: pan-y; cursor: grab; display: flex; align-items: center; justify-content: center; }
.creator .pv3d canvas { width: 100%; height: 100%; display: block; }
.creator .pvbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.creator .pvseg { display: inline-flex; border: 3px solid var(--ink); border-radius: 12px; overflow: hidden; }
.creator .pvseg button { font-family: var(--fd); font-weight: 600; font-size: 15px; padding: 5px 12px; min-height: 36px; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.creator .pvseg button[aria-pressed=true] { background: var(--ink); color: var(--cream); }
.creator .optcol { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.creator .ctabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 3px dashed #e6cfbd; padding-bottom: 10px; }
.creator .ctabs button { font-family: var(--fd); font-weight: 600; font-size: 16px; padding: 6px 14px; min-height: 40px; border-radius: 12px; border: 3px solid transparent; background: transparent; color: #6b4a3c; cursor: pointer; }
.creator .ctabs button[aria-selected=true] { background: var(--ink); color: var(--cream); }
.creator .crows { display: flex; flex-direction: column; gap: 12px; }
.creator .pills { gap: 6px; }
.creator .pills button { min-height: 36px; padding: 3px 11px; font-size: 14.5px; border-width: 2.5px; }
.creator button:focus-visible { outline: 3px solid var(--chili); outline-offset: 2px; }
@media (max-width: 700px) {
  .creator .cmain { grid-template-columns: minmax(0, 1fr); }
  .creator .pvcol { top: -28px; z-index: 2; background: var(--cream); padding: 8px 0; border-bottom: 3px dashed #e6cfbd; flex-direction: row; align-items: center; }
  .creator .pv3d { width: 132px; flex: none; }
  .creator .pvbar { flex-direction: column; align-items: flex-start; }
}

/* friends */
.me.frbtn { position: relative; margin-left: auto; margin-right: 8px; padding: 0 16px; } .top .me.frbtn + .me { margin-left: 0; }
.frbadge { position: absolute; top: -8px; right: -8px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; background: var(--chili, #e0452f); color: #fff; border: 2px solid var(--ink); font-size: 13px; font-weight: 700; line-height: 18px; text-align: center; }
.frbody { display: flex; flex-direction: column; gap: 12px; } .frbody h3 { margin: 4px 0 0; font-size: 18px; color: var(--ink); }
.fradd { display: flex; gap: 8px; } .fradd .field { flex: 1; min-width: 0; }
.frlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.frlist li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 8px 10px; }
.frname { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; } .frname b { font-family: var(--fd); font-weight: 600; font-size: 18px; color: var(--ink); } .frname small { font-size: 13px; color: #6b4a3c; }
.frdot { font-size: 13px; font-weight: 700; color: #8a7468; } .frdot::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #c9b8ab; margin-right: 5px; } .frdot.on { color: #2f8f4e; } .frdot.on::before { background: #3fbf68; }
.fract { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- coins and the avatar shop ---------- */
.cn { display: inline-block; width: .95em; height: .95em; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe58a, #ffc93c 55%, #d99a1e); box-shadow: inset 0 0 0 2px #b97c12; vertical-align: -.12em; margin-right: .25em; flex: none; }
.coinbtn { font-variant-numeric: tabular-nums; }
.creator .shoptab { color: #a5670b; }
.creator .shopnote { margin: 0; font-size: 14.5px; color: #6b4a3c; }
.creator .pills button.lk { border-style: dashed; }
.creator .pills button .pr { font-size: 12.5px; opacity: .85; white-space: nowrap; }
.creator .swatches button { position: relative; }
.creator .swatches button.lk::after { content: attr(data-p); position: absolute; left: 50%; bottom: -9px; transform: translateX(-50%); font: 700 10.5px/1 var(--fd); background: #ffc93c; color: var(--ink); border: 2px solid var(--ink); border-radius: 8px; padding: 1px 4px; }
.creator .swatches:has(.lk) { padding-bottom: 6px; }
.creator .cart:empty { display: none; }
.creator .cart { display: flex; flex-direction: column; gap: 6px; background: #fff3d6; border: 3px dashed #e6b860; border-radius: 16px; padding: 10px 12px; }
.creator .cart small { font-size: 13.5px; color: #6b4a3c; }
.creator .cartlist { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.creator .cartlist > b { font-family: var(--fd); font-weight: 600; color: #6b4a3c; }
.creator .cartitem { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; }
.creator .cartitem .btn { white-space: nowrap; }
.creator .cartitem .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--c); border: 2px solid var(--ink); display: inline-block; }
.me.coinbtn { padding: 0 14px; margin-right: 8px; gap: 2px; } .top .me.coinbtn + .me { margin-left: 0; }
@media (max-width: 560px) { .me.coinbtn small { display: none; } }
.creator .cart { position: sticky; bottom: -18px; z-index: 3; box-shadow: 0 -8px 0 var(--cream); }
.creator .cartitem .btn .cn { margin-right: .3em; }
