/* Game Night — Material 3 inspired design system (light, Google colours, phone-first) */
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 300 800; font-display: swap; src: url(../assets/fonts/outfit-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Outfit'; font-style: normal; font-weight: 300 800; font-display: swap; src: url(../assets/fonts/outfit-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --font: 'Outfit', 'Noto Color Emoji', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bg: #f8fafd; --surface: #ffffff; --s1: #f3f6fb; --s2: #ebf0f8; --s3: #e1e8f4;
  --on: #1b1c20; --on2: #565b68; --on3: #8a90a0;
  --line: #dde2ec; --line2: #c3cad9;
  --blue: #1a73e8; --blue-c: #d3e3fd; --blue-d: #0b3f8f;
  --red: #ea4335; --red-c: #fcdad6; --red-d: #8c1d18;
  --yellow: #fbbc04; --yellow-c: #feefc3; --yellow-d: #6b4e00;
  --green: #1e9e4b; --green-c: #cbefd6; --green-d: #0b5a28;
  --purple: #8e4de8; --purple-c: #eadcfd; --purple-d: #4b1f94;
  --pink: #e5399b; --pink-c: #ffd9ec; --pink-d: #7d1050;
  --teal: #0fa9c2; --teal-c: #c7f0f7; --teal-d: #04505e;
  --orange: #f57c00; --orange-c: #ffe0b8; --orange-d: #7a3b00;
  /* aliases used by the games */
  --panel: var(--surface); --panel2: var(--s2); --panel3: var(--s3); --bg2: var(--s1);
  --text: var(--on); --muted: var(--on2); --accent: var(--blue); --accent2: var(--pink);
  --good: var(--green); --bad: var(--red); --warn: var(--yellow);
  --r: 20px; --r-s: 12px; --r-m: 16px; --r-l: 24px; --r-xl: 32px;
  --e1: 0 1px 2px rgba(31, 41, 55, 0.08), 0 2px 8px rgba(31, 41, 55, 0.06);
  --e2: 0 2px 6px rgba(31, 41, 55, 0.1), 0 8px 24px rgba(31, 41, 55, 0.1);
  --e3: 0 8px 36px rgba(31, 41, 55, 0.2);
  --shadow: var(--e1);
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font); font-size: 16px; color: var(--on); overflow-x: hidden; overscroll-behavior-y: none;
  background: radial-gradient(900px 520px at -5% -10%, #e5eefc 0%, transparent 60%), radial-gradient(800px 520px at 105% 0%, #fde8f3 0%, transparent 55%), radial-gradient(700px 500px at 50% 110%, #e7f6ec 0%, transparent 60%), var(--bg);
  background-attachment: fixed;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { touch-action: manipulation; }
a { color: var(--blue); }
h1, h2, h3, h4, p { margin: 0; }
h2 { font-weight: 700; letter-spacing: -0.2px; }
.hide { display: none !important; }
.muted { color: var(--on2); }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.sep { height: 1px; background: var(--line); margin: 14px 0; }
.emo { font-family: 'Noto Color Emoji', 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif; }

#app { height: 100dvh; display: flex; flex-direction: column; }
#view { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }

/* ---------- icons ---------- */
.ic { width: 24px; height: 24px; fill: currentColor; flex: none; display: block; }
.ic.sm { width: 18px; height: 18px; } .ic.lg { width: 32px; height: 32px; } .ic.xl { width: 48px; height: 48px; }

/* ---------- buttons ---------- */
.btn {
  --h: 44px; position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--h); padding: 0 22px; border: 0; border-radius: 999px;
  background: var(--s2); color: var(--on); font: 600 15px/1 var(--font); letter-spacing: 0.1px; cursor: pointer; white-space: nowrap; user-select: none; transition: box-shadow 0.2s, background 0.2s, transform 0.1s, filter 0.2s;
}
.btn:hover:not(:disabled) { background: var(--s3); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:focus-visible, .iconbtn:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 40%, transparent); outline-offset: 2px; }
.btn.primary { background: var(--blue); color: #fff; box-shadow: 0 1px 3px rgba(26, 115, 232, 0.4), 0 4px 12px rgba(26, 115, 232, 0.25); }
.btn.primary:hover:not(:disabled) { background: #1967d2; }
.btn.good { background: var(--green); color: #fff; } .btn.good:hover:not(:disabled) { background: #178a41; }
.btn.bad { background: var(--red); color: #fff; } .btn.bad:hover:not(:disabled) { background: #d33426; }
.btn.tonal { background: var(--blue-c); color: var(--blue-d); } .btn.tonal:hover:not(:disabled) { background: #c2d8fb; }
.btn.ghost { background: transparent; color: var(--blue); } .btn.ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--blue) 10%, transparent); }
.btn.outline { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line2); } .btn.outline:hover:not(:disabled) { background: var(--s1); }
.btn.small { --h: 36px; padding: 0 16px; font-size: 13.5px; }
.btn.big { --h: 56px; padding: 0 32px; font-size: 17px; }
.btn.block { width: 100%; }
.btn .ic { width: 20px; height: 20px; margin-left: -4px; }
.btn.small .ic { width: 18px; height: 18px; }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: 0.2; transform: scale(0); animation: rip 0.6s ease-out forwards; pointer-events: none; }
@keyframes rip { to { transform: scale(1); opacity: 0; } }
.iconbtn {
  position: relative; overflow: visible; width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--on2); display: inline-grid; place-items: center; cursor: pointer; flex: none; transition: background 0.2s, color 0.2s;
}
.iconbtn:hover { background: var(--s2); color: var(--on); }
.iconbtn:active { background: var(--s3); }
.iconbtn.tonal { background: var(--s2); color: var(--on); }
.iconbtn.live { background: var(--green-c); color: var(--green-d); }
.iconbtn.muted { background: var(--red-c); color: var(--red-d); }
.iconbtn.sm { width: 36px; height: 36px; } .iconbtn.sm .ic { width: 20px; height: 20px; }
.dot { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font: 700 11px/18px var(--font); text-align: center; padding: 0 5px; box-shadow: 0 0 0 2px var(--bg); }
.dot.static { position: static; margin-top: 6px; box-shadow: none; }
.fab { position: fixed; right: 16px; bottom: calc(16px + var(--sab)); z-index: 30; --h: 56px; box-shadow: var(--e2); }

/* ---------- forms ---------- */
input.txt, select.txt, textarea.txt {
  background: #fff; border: 1.5px solid var(--line2); border-radius: 14px; padding: 12px 14px; min-height: 48px; outline: none; min-width: 0; color: var(--on); font: 500 16px var(--font); transition: border-color 0.15s, box-shadow 0.15s;
}
input.txt::placeholder, textarea.txt::placeholder { color: var(--on3); }
input.txt:focus, select.txt:focus, textarea.txt:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.14); }
input.txt:disabled { background: var(--s1); }
select.txt { appearance: none; padding-right: 38px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23565b68'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 10px center / 22px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--s3); box-shadow: inset 0 0 0 2px var(--line2); transition: 0.2s; }
.switch span::after { content: ''; position: absolute; left: 6px; top: 6px; width: 20px; height: 20px; border-radius: 50%; background: var(--on3); transition: 0.2s; }
.switch input:checked + span { background: var(--blue); box-shadow: none; }
.switch input:checked + span::after { left: 26px; width: 20px; background: #fff; }
.seg { display: inline-flex; border: 1.5px solid var(--line2); border-radius: 999px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: transparent; padding: 0 16px; min-height: 38px; font: 600 14px var(--font); color: var(--on2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button + button { border-left: 1.5px solid var(--line2); }
.seg button.on { background: var(--blue-c); color: var(--blue-d); }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border-radius: var(--r-l); padding: 18px; box-shadow: var(--e1); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-radius: 999px; background: var(--s2); color: var(--on2); font: 600 12.5px/1 var(--font); white-space: nowrap; }
.chip .ic { width: 16px; height: 16px; }
.chip.blue { background: var(--blue-c); color: var(--blue-d); } .chip.green { background: var(--green-c); color: var(--green-d); }
.chip.red { background: var(--red-c); color: var(--red-d); } .chip.yellow { background: var(--yellow-c); color: var(--yellow-d); }
.chip.purple { background: var(--purple-c); color: var(--purple-d); } .chip.pink { background: var(--pink-c); color: var(--pink-d); }
.warnbox { background: var(--yellow-c); color: var(--yellow-d); border-radius: 16px; padding: 12px 16px; font-size: 14px; line-height: 1.45; display: flex; gap: 10px; align-items: flex-start; }
.spinner { width: 44px; height: 44px; border-radius: 50%; border: 5px solid var(--s3); border-top-color: var(--blue); animation: spin 0.8s linear infinite; margin: 0 auto 14px; }
.pname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- app bar ---------- */
.top { flex: none; position: relative; z-index: 25; display: flex; align-items: center; gap: 4px; min-height: calc(60px + var(--sat)); padding: var(--sat) 8px 0 12px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.logo { display: flex; align-items: center; gap: 10px; font: 700 22px/1 var(--font); letter-spacing: -0.4px; cursor: pointer; text-decoration: none; color: var(--on); }
.logo .mark { width: 36px; height: 36px; flex: none; }
.logo b { font-weight: 800; background: linear-gradient(90deg, var(--blue), var(--pink) 55%, var(--orange)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tb-title { display: flex; flex-direction: column; min-width: 0; margin-left: 2px; line-height: 1.15; }
.tb-title b { font: 700 18px var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.codechip { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; margin-top: 2px; padding: 2px 8px 2px 10px; border-radius: 999px; background: var(--blue-c); color: var(--blue-d); font: 700 12px/1.3 var(--font); cursor: pointer; border: 0; }
.codechip .ic { width: 14px; height: 14px; }
.tb-players { display: flex; gap: 4px; margin: 0 8px; overflow: hidden; }
.profilechip { display: flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; border-radius: 999px; border: 0; background: var(--surface); box-shadow: var(--e1); cursor: pointer; font: 600 14px var(--font); max-width: 180px; }
.profilechip span.n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- avatars ---------- */
.av { --s: 36px; width: var(--s); height: var(--s); position: relative; flex: none; display: inline-block; border-radius: 50%; }
.av.xs { --s: 22px; } .av.sm { --s: 30px; } .av.lg { --s: 48px; } .av.xl { --s: 124px; }
.av svg { width: 100%; height: 100%; display: block; overflow: visible; transform-origin: 50% 92%; animation: avbob 3.2s ease-in-out infinite; animation-delay: var(--d, 0s); }
.av.photo img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; border: 2px solid var(--c, #fff); transform-origin: 50% 92%; animation: avbob 3.2s ease-in-out infinite; animation-delay: var(--d, 0s); background: #fff; }
.av .av-eyes { transform-origin: 50px 52px; animation: avblink 5s infinite; animation-delay: var(--d, 0s); }
.av.still svg, .av.still img, .av.still .av-eyes { animation: none; }
.av.bounce svg, .av.bounce img { animation: avbounce 0.95s ease-in-out infinite; }
.av.dance svg, .av.dance img { animation: avdance 0.7s ease-in-out infinite; }
.av.off { filter: grayscale(1); opacity: 0.5; }
@keyframes avbob { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-3%) scale(1.03, 0.97); } }
@keyframes avblink { 0%, 90%, 100% { transform: scaleY(1); } 94% { transform: scaleY(0.1); } }
@keyframes avbounce { 0%, 100% { transform: translateY(0) scale(1.07, 0.9); } 40% { transform: translateY(-14%) scale(0.95, 1.07); } 70% { transform: translateY(0) scale(1.04, 0.94); } }
@keyframes avdance { 0%, 100% { transform: rotate(-9deg) translateY(0); } 50% { transform: rotate(9deg) translateY(-10%); } }
.avwrap { position: relative; flex: none; }
.avwrap .crown { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; background: var(--yellow); color: #5b4300; display: grid; place-items: center; box-shadow: 0 0 0 2px #fff; }
.avwrap .crown .ic { width: 14px; height: 14px; }
.avedit { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.avedit-stage { width: 100%; padding: 16px 0 8px; display: grid; place-items: center; border-radius: 28px; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--blue) 16%, #fff), var(--s1) 75%); }
.avedit-rows { display: flex; flex-direction: column; gap: 6px; align-items: center; width: 100%; }
.avedit-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: min(260px, 100%); font-weight: 600; }
.avarrow { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--s2); cursor: pointer; display: grid; place-items: center; color: var(--on); font-size: 12px; }
.avarrow:hover { background: var(--s3); } .avarrow:active { transform: scale(0.92); }

/* ---------- home ---------- */
.home { flex: 1; overflow-y: auto; padding: 0 16px 80px; }
.hero { max-width: 1080px; margin: 0 auto; padding: 18px 0 8px; }
.hero h1 { font: 800 clamp(34px, 8vw, 60px)/1.04 var(--font); letter-spacing: -1.5px; }
.hero h1 .g { background: linear-gradient(90deg, var(--blue), var(--red) 38%, var(--orange) 62%, var(--green)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--on2); font-size: clamp(15px, 2.4vw, 19px); margin-top: 10px; max-width: 560px; line-height: 1.45; }
.joincard { display: flex; align-items: center; gap: 8px; max-width: 540px; margin-top: 20px; background: var(--surface); border-radius: 999px; padding: 6px 6px 6px 20px; box-shadow: var(--e2); }
.joincard .ic { color: var(--on3); }
.joincard input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font: 500 17px var(--font); padding: 10px 4px; }
.searchbar { display: flex; align-items: center; gap: 10px; max-width: 540px; margin-top: 14px; background: var(--s2); border-radius: 999px; padding: 0 18px; height: 52px; }
.searchbar input { flex: 1; border: 0; background: transparent; outline: none; font: 500 16px var(--font); min-width: 0; }
.filters { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 18px -16px 14px; padding: 2px 16px; max-width: 1080px; }
.filters::-webkit-scrollbar { display: none; }
.fchip { flex: none; height: 38px; padding: 0 18px; border-radius: 999px; border: 1.5px solid var(--line2); background: var(--surface); cursor: pointer; font: 600 14px var(--font); color: var(--on2); display: inline-flex; align-items: center; gap: 6px; }
.fchip.on { background: var(--blue-c); border-color: transparent; color: var(--blue-d); }
.grid { max-width: 1080px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.gcard {
  position: relative; text-align: left; border: 0; border-radius: 28px; padding: 16px; min-height: 184px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; overflow: hidden; color: var(--on); font-family: var(--font);
  background: linear-gradient(160deg, color-mix(in srgb, var(--gc) 22%, #fff), color-mix(in srgb, var(--gc) 7%, #fff)); box-shadow: 0 1px 2px rgba(31, 41, 55, 0.06); transition: transform 0.18s, box-shadow 0.2s;
}
.gcard:hover { transform: translateY(-4px); box-shadow: 0 10px 28px color-mix(in srgb, var(--gc) 28%, transparent); }
.gcard:active { transform: scale(0.98); }
.gcard .tile { width: 56px; height: 56px; border-radius: 18px; display: grid; place-items: center; font-size: 30px; line-height: 1; background: linear-gradient(145deg, var(--gc), color-mix(in srgb, var(--gc) 72%, #000)); box-shadow: 0 6px 16px color-mix(in srgb, var(--gc) 42%, transparent); }
.gcard h3 { font: 700 17px/1.2 var(--font); margin-top: 8px; letter-spacing: -0.2px; }
.gcard p { font-size: 13px; color: var(--on2); line-height: 1.35; flex: 1; }
.gcard .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.gcard .meta .chip { background: rgba(255, 255, 255, 0.75); height: 26px; font-size: 12px; }
.gcard .badge { position: absolute; top: 12px; right: 12px; }
.footnote { max-width: 760px; margin: 36px auto 0; text-align: center; color: var(--on3); font-size: 13px; line-height: 1.6; }
.empty { text-align: center; color: var(--on2); padding: 40px 0; }

/* ---------- sheets / dialogs / menus / snackbar ---------- */
.scrim { position: fixed; inset: 0; z-index: 80; background: rgba(20, 24, 35, 0.48); display: flex; align-items: flex-end; justify-content: center; animation: fade 0.18s; }
.sheet { position: relative; width: min(100%, 680px); max-height: 92dvh; overflow-y: auto; background: var(--surface); border-radius: 28px 28px 0 0; padding: 6px 20px calc(24px + var(--sab)); box-shadow: var(--e3); animation: slideup 0.26s cubic-bezier(0.2, 0.8, 0.2, 1); overscroll-behavior: contain; }
.sheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line2); margin: 8px auto 14px; }
.sheet .x { position: absolute; top: 12px; right: 12px; z-index: 2; }
.sheet h2 { font-size: 24px; }
.sheet.wide { width: min(100%, 900px); }
.sheet .sticky { position: sticky; bottom: calc(-24px - var(--sab)); background: linear-gradient(transparent, var(--surface) 22%); padding: 22px 0 calc(24px + var(--sab)); margin: 0 0 calc(-24px - var(--sab)); }
@media (min-width: 720px) { .scrim { align-items: center; } .sheet { border-radius: 28px; max-height: 88dvh; padding: 24px 28px; } .sheet .grab { display: none; } .sheet .sticky { bottom: -24px; padding-bottom: 24px; margin-bottom: -24px; } }
.dialog { width: min(92vw, 400px); background: var(--surface); border-radius: 28px; padding: 24px; box-shadow: var(--e3); animation: pop 0.2s; align-self: center; }
.scrim.center { align-items: center; }
.dialog h3 { font: 700 22px var(--font); margin-bottom: 8px; }
.dialog p { color: var(--on2); line-height: 1.5; }
.dialog .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.menu { position: fixed; z-index: 90; min-width: 230px; background: var(--surface); border-radius: 18px; box-shadow: var(--e3); padding: 8px; animation: pop 0.14s; transform-origin: top right; }
.menu button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 0 14px; min-height: 48px; border: 0; background: transparent; border-radius: 12px; cursor: pointer; font: 500 15px var(--font); color: var(--on); text-align: left; }
.menu button:hover { background: var(--s1); }
.menu button.danger { color: var(--red); }
.menu .ic { color: var(--on2); } .menu button.danger .ic { color: var(--red); }
.menu hr { border: 0; height: 1px; background: var(--line); margin: 6px 4px; }
#toasts { position: fixed; bottom: calc(20px + var(--sab)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 120; pointer-events: none; align-items: center; width: min(92vw, 460px); }
.toast { background: #2e3135; color: #f1f3f4; padding: 13px 18px; border-radius: 14px; box-shadow: var(--e2); font: 500 14.5px/1.35 var(--font); animation: pop 0.2s; display: flex; gap: 10px; align-items: center; }
.toast.bad::before, .toast.good::before { content: ''; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.toast.bad::before { background: #ff8a80; } .toast.good::before { background: #7be495; }

/* ---------- rules / help ---------- */
.help h2 { padding-right: 44px; }
.help .hd { display: flex; gap: 14px; align-items: center; margin: 6px 0 14px; }
.help .hd .tile { width: 60px; height: 60px; border-radius: 20px; display: grid; place-items: center; font-size: 34px; background: linear-gradient(145deg, var(--gc), color-mix(in srgb, var(--gc) 72%, #000)); flex: none; }
.help h4 { font: 700 13px var(--font); text-transform: uppercase; letter-spacing: 0.8px; color: var(--on3); margin: 18px 0 8px; }
.help ol, .help ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; counter-reset: s; }
.help li { position: relative; padding-left: 38px; line-height: 1.5; font-size: 15px; color: var(--on); }
.help ol li::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--blue-c); color: var(--blue-d); display: grid; place-items: center; font: 700 13px var(--font); }
.help ul li::before { content: ''; position: absolute; left: 8px; top: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--yellow)); }
.help .goal { background: color-mix(in srgb, var(--gc) 12%, #fff); border-radius: 18px; padding: 14px 16px; line-height: 1.5; }
.help .keys { display: flex; flex-wrap: wrap; gap: 8px; }
.help kbd { background: var(--s2); border-radius: 8px; padding: 3px 9px; font: 600 13px var(--font); box-shadow: inset 0 -2px 0 var(--line2); }

/* ---------- lobby ---------- */
.lobby { flex: 1; overflow-y: auto; padding: 8px 16px 110px; display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 16px; max-width: 1100px; width: 100%; margin: 0 auto; align-content: start; }
@container (max-width: 820px) { .lobby { grid-template-columns: 1fr; } }
.lobby .colL, .lobby .colR { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.invite { background: linear-gradient(145deg, var(--blue-c), color-mix(in srgb, var(--pink-c) 70%, #fff)); }
.invite .lbl { font: 700 12px var(--font); text-transform: uppercase; letter-spacing: 1.2px; color: var(--blue-d); }
.invite .bignum { font: 800 76px/1 var(--font); letter-spacing: -2px; color: var(--blue-d); margin: 2px 0 6px; }
.invite .link { background: rgba(255, 255, 255, 0.7); border-radius: 12px; padding: 9px 12px; font-size: 12.5px; color: var(--on2); word-break: break-all; user-select: all; margin: 8px 0 12px; }
.sw-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; font-weight: 500; font-size: 15px; }
.plist { display: flex; flex-direction: column; gap: 8px; }
.prow { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 18px; background: var(--s1); }
.prow .tag { font-size: 12px; color: var(--on3); font-weight: 600; }
.gsel { display: flex; gap: 16px; align-items: center; }
.gsel .tile { width: 68px; height: 68px; border-radius: 22px; display: grid; place-items: center; font-size: 38px; flex: none; background: linear-gradient(145deg, var(--gc), color-mix(in srgb, var(--gc) 72%, #000)); box-shadow: 0 8px 20px color-mix(in srgb, var(--gc) 38%, transparent); }
.gsel h2 { font-size: 26px; }
.opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 14px; }
.opt { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--on2); font-weight: 600; }
.opt .ro { background: var(--s1); border-radius: 14px; padding: 12px 14px; color: var(--on); font-size: 15px; font-weight: 500; }
.startbar { position: sticky; bottom: 0; z-index: 5; margin-top: 4px; }
.picker { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

/* ---------- chat ---------- */
.roomwrap { flex: 1; min-height: 0; display: flex; }
.roommain { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.chatside { width: 320px; flex: none; background: var(--surface); display: none; flex-direction: column; padding: 12px; gap: 8px; position: relative; box-shadow: -1px 0 0 var(--line); }
.chatside.collapsed { width: 60px; padding: 8px 6px; align-items: center; }
.chathead { display: flex; align-items: center; gap: 8px; font: 700 17px var(--font); }
.chatside .chat { flex: 1; min-height: 0; }
@media (min-width: 1000px) { .chatside { display: flex; } }
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat .msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px 8px; min-height: 0; }
.chat .m { display: flex; gap: 8px; align-items: flex-end; max-width: 92%; }
.chat .m .bub { background: var(--s2); border-radius: 18px 18px 18px 6px; padding: 8px 13px; line-height: 1.35; font-size: 14.5px; word-break: break-word; }
.chat .m .bub b { display: block; font: 700 12px var(--font); margin-bottom: 1px; }
.chat .m.me { align-self: flex-end; flex-direction: row-reverse; }
.chat .m.me .bub { background: var(--blue-c); color: var(--blue-d); border-radius: 18px 18px 6px 18px; }
.chat .m.sys { align-self: center; max-width: 100%; }
.chat .m.sys .bub { background: transparent; color: var(--on3); font-size: 12.5px; padding: 2px 8px; }
.chat form { display: flex; gap: 8px; margin-top: 4px; align-items: center; }
.chat form input { flex: 1; min-width: 0; border-radius: 999px; padding-left: 18px; }
.chatsend { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--blue); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; box-shadow: 0 2px 8px rgba(26, 115, 232, 0.4); }
.chatsend:active { transform: scale(0.92); }
.chatbar { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px calc(8px + var(--sab)); background: var(--surface); box-shadow: 0 -1px 0 var(--line); z-index: 26; }
.chatbar input { flex: 1; min-width: 0; border-radius: 999px; padding: 10px 18px; min-height: 44px; }
.chatfloat { position: absolute; left: 10px; right: 10px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; z-index: 25; align-items: flex-start; }
.chatfloat .fm { background: rgba(32, 36, 48, 0.88); color: #fff; padding: 7px 14px 7px 8px; border-radius: 999px; font-size: 13.5px; max-width: 92%; display: flex; gap: 8px; align-items: center; animation: pop 0.2s, fmout 0.6s 6.4s forwards; backdrop-filter: blur(6px); }
.chatfloat .fm.sys { padding-left: 14px; color: #cfd3dc; font-style: italic; }
.chatfloat .fm b { font-weight: 700; } .chatfloat .fm b::after { content: ':'; }
@keyframes fmout { to { opacity: 0; transform: translateY(-6px); } }
.chatsheet { position: fixed; left: 0; right: 0; bottom: 0; height: min(78dvh, 600px); background: var(--surface); border-radius: 28px 28px 0 0; z-index: 71; padding: 8px 14px calc(12px + var(--sab)); display: flex; flex-direction: column; gap: 6px; transform: translateY(105%); transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1); box-shadow: var(--e3); }
.chatsheet.open { transform: none; }
.chatsheet .grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line2); margin: 4px auto 6px; flex: none; }
.sheetback { position: fixed; inset: 0; background: rgba(20, 24, 35, 0.4); z-index: 70; display: none; }
.sheetback.open { display: block; animation: fade 0.2s; }

/* ---------- in-game shell ---------- */
.stage { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; overflow: hidden; container-type: inline-size; }
.game-root { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; overflow: hidden; }
.banner { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); background: var(--yellow); color: #4a3600; font-weight: 700; padding: 9px 18px; border-radius: 999px; z-index: 50; box-shadow: var(--e2); font-size: 14px; white-space: nowrap; }
.waitscreen { flex: 1; display: grid; place-items: center; text-align: center; padding: 24px; }

/* results */
.resultsback { position: absolute; inset: 0; background: rgba(20, 24, 35, 0.5); backdrop-filter: blur(4px); z-index: 30; display: grid; place-items: center; padding: 16px; overflow-y: auto; animation: fade 0.3s; }
.results { background: var(--surface); border-radius: 32px; padding: 26px 22px; width: min(480px, 100%); box-shadow: var(--e3); animation: pop 0.3s; }
.results .trophy { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 8px; display: grid; place-items: center; background: linear-gradient(145deg, var(--yellow), var(--orange)); color: #fff; box-shadow: 0 10px 24px rgba(245, 124, 0, 0.35); }
.results .trophy .ic { width: 46px; height: 46px; }
.results h2 { font-size: 28px; text-align: center; }
.results .sub { text-align: center; color: var(--on2); margin-top: 4px; }
.rrow { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 20px; background: var(--s1); margin-top: 8px; }
.rrow.first { background: linear-gradient(90deg, var(--yellow-c), #fff8e1); }
.rrow .rk { width: 30px; text-align: center; font: 800 20px var(--font); color: var(--on3); }
.rrow.first .rk { color: #b07d00; }
.rrow .sc { margin-left: auto; font: 800 18px var(--font); font-variant-numeric: tabular-nums; text-align: right; }
.rrow .sc small { display: block; font-weight: 500; color: var(--on2); font-size: 11px; }
.confetti { position: absolute; top: -10px; width: 10px; height: 14px; z-index: 35; pointer-events: none; animation: fall linear forwards; border-radius: 2px; }

/* touch controls */
.touch-controls { display: none; justify-content: space-between; align-items: center; padding: 6px 14px calc(10px + var(--sab)); flex: none; user-select: none; -webkit-user-select: none; touch-action: none; }
@media (pointer: coarse) { .touch-controls { display: flex; } }
.dpad { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(3, 56px); gap: 4px; }
.dpad .u { grid-column: 2; grid-row: 1; } .dpad .l { grid-column: 1; grid-row: 2; } .dpad .r { grid-column: 3; grid-row: 2; } .dpad .d { grid-column: 2; grid-row: 3; }
.acts { display: flex; gap: 12px; }
.tbtn { width: 56px; height: 56px; border-radius: 18px; border: 0; background: #fff; color: var(--on2); font: 700 18px var(--font); box-shadow: var(--e1), inset 0 -3px 0 var(--s3); touch-action: none; user-select: none; -webkit-user-select: none; display: grid; place-items: center; }
.tbtn.act { width: 72px; height: 72px; border-radius: 50%; background: var(--pink-c); color: var(--pink-d); font-size: 26px; }
.tbtn.down { background: var(--blue); color: #fff; transform: scale(0.95); }

/* ---------- animations ---------- */
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.94) translateY(8px); } }
@keyframes slideup { from { transform: translateY(40px); opacity: 0.4; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: 0.8; } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes bounce { 0%, 100% { transform: none; } 50% { transform: translateY(-6px); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: 0.001s !important; transition-duration: 0.001s !important; } }

/* ---------- voice / video call ---------- */
.avdock { flex: none; display: none; flex-direction: column; gap: 8px; width: 168px; padding: 10px; background: var(--surface); box-shadow: -1px 0 0 var(--line); overflow-y: auto; }
.avdock.show { display: flex; }
.avtiles { display: flex; flex-direction: column; gap: 8px; }
.avtile { position: relative; border-radius: 18px; overflow: hidden; background: #111; aspect-ratio: 4 / 3; flex: none; border: 3px solid transparent; cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s; }
.avtile video { width: 100%; height: 100%; object-fit: cover; display: block; background: var(--s3); }
.avtile.mirror video { transform: scaleX(-1); }
.avtile.speaking { border-color: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 30%, transparent); }
.avtile .lbl { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 8px 4px; font: 600 11.5px var(--font); color: #fff; background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); display: flex; justify-content: space-between; gap: 4px; align-items: center; }
.avtile .lbl .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avtile .lbl .ic { width: 14px; height: 14px; }
.avtile .wait { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: #fff; background: rgba(0, 0, 0, 0.45); }
.avtile.big { grid-column: 1 / -1; }
.avjoin { background: var(--green-c); color: var(--green-d); border-radius: 18px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.avbar { display: flex; gap: 6px; justify-content: center; }

/* ---------- responsive ---------- */
@media (max-width: 999px) {
  .roomwrap { flex-direction: column; }
  .avdock { order: -1; width: auto; flex-direction: row; align-items: center; box-shadow: 0 1px 0 var(--line); overflow-x: auto; overflow-y: hidden; padding: 8px 12px; }
  .avtiles { flex-direction: row; }
  .avtile { width: 100px; border-radius: 14px; }
  .avtile.big { width: 200px; }
  .avjoin { flex-direction: row; align-items: center; flex-wrap: wrap; }
}
@media (max-width: 720px) {
  .top { padding-left: 6px; }
  .profilechip { padding: 3px; max-width: none; } .profilechip span.n { display: none; }
  .tb-players { display: none; }
  .hide-sm { display: none !important; }
  .hero { padding-top: 8px; }
  .grid { gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gcard { min-height: 168px; padding: 14px; border-radius: 24px; }
  .gcard .tile { width: 50px; height: 50px; font-size: 27px; border-radius: 16px; }
  .gcard h3 { font-size: 16px; }
  .gcard p { font-size: 12.5px; }
  .invite .bignum { font-size: 64px; }
  .lobby { padding: 4px 12px 110px; gap: 12px; }
  .panel { padding: 16px; border-radius: 22px; }
  .tb-title b { font-size: 17px; }
  .results { padding: 22px 16px; }
  .dpad { grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(3, 52px); }
  .tbtn { width: 52px; height: 52px; }
  .tbtn.act { width: 64px; height: 64px; }
}
@media (max-width: 380px) { .iconbtn { width: 40px; height: 40px; } .tb-title b { font-size: 16px; } }

@media (min-width: 1000px) { .hide-wide { display: none !important; } }

/* ---------- game kit (shared by the party games) ---------- */
.kt { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 12px 14px calc(14px + var(--sab)); overflow-y: auto; width: 100%; max-width: 760px; margin: 0 auto; }
.kt.wide { max-width: 1000px; }
.kt > * { flex-shrink: 0; } /* the page scrolls; never squash a section */
.kt-card { background: var(--surface); border-radius: 26px; padding: 16px; box-shadow: var(--e1); }
.kt-prompt { border-radius: 28px; padding: 22px 20px; text-align: center; color: #fff; font: 700 clamp(20px, 5vw, 28px)/1.25 var(--font); background: linear-gradient(135deg, var(--pc, var(--blue)), color-mix(in srgb, var(--pc, var(--blue)) 60%, #000)); box-shadow: 0 10px 26px color-mix(in srgb, var(--pc, var(--blue)) 35%, transparent); }
.kt-prompt small { display: block; font: 600 12px var(--font); text-transform: uppercase; letter-spacing: 1.2px; opacity: 0.8; margin-bottom: 6px; }
.kt-timer { display: flex; align-items: center; gap: 10px; }
.kt-timer .bar { flex: 1; height: 8px; border-radius: 4px; background: var(--s3); overflow: hidden; }
.kt-timer .bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--blue), var(--pink)); border-radius: 4px; transition: width 0.25s linear; }
.kt-timer .sec { font: 800 15px var(--font); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; color: var(--on2); }
.kt-timer.low .bar i { background: var(--red); } .kt-timer.low .sec { color: var(--red); }
.kt-title { font: 700 13px var(--font); text-transform: uppercase; letter-spacing: 0.9px; color: var(--on3); }
.kt-score { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.kt-pill { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); box-shadow: var(--e1); border-radius: 999px; padding: 4px 14px 4px 5px; font: 600 14px var(--font); }
.kt-pill b { font-weight: 800; color: var(--blue); font-variant-numeric: tabular-nums; }
.kt-pill.done { background: var(--green-c); } .kt-pill.dim { opacity: 0.5; }
.kt-center { flex: 1; display: grid; place-items: center; text-align: center; }
.kt-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.kt-field { display: flex; gap: 8px; align-items: center; }
.kt-field input.txt, .kt-field textarea.txt { flex: 1; }
.kt-choice { display: block; width: 100%; text-align: left; border: 2px solid transparent; background: var(--surface); box-shadow: var(--e1); border-radius: 20px; padding: 14px 16px; font: 600 16px/1.35 var(--font); color: var(--on); cursor: pointer; transition: transform 0.1s, border-color 0.15s, background 0.15s; }
.kt-choice:hover:not(:disabled) { border-color: var(--blue); }
.kt-choice:active:not(:disabled) { transform: scale(0.99); }
.kt-choice.sel { border-color: var(--blue); background: var(--blue-c); }
.kt-choice.win { border-color: var(--green); background: var(--green-c); }
.kt-choice.lose { opacity: 0.6; }
.kt-choice:disabled { cursor: default; }
.kt-choice small { display: block; font-weight: 600; color: var(--on2); margin-top: 4px; font-size: 13px; }
.kt-big { font: 800 clamp(34px, 10vw, 56px)/1.05 var(--font); letter-spacing: -1px; text-align: center; }
.kt-hint { text-align: center; color: var(--on2); font-weight: 500; font-size: 15px; line-height: 1.4; }
.kt-img { width: 100%; max-width: 520px; border-radius: 20px; box-shadow: var(--e1); background: #fff; display: block; margin: 0 auto; aspect-ratio: 4 / 3; object-fit: contain; }
.kt-tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 12px; background: var(--s2); font: 700 12px var(--font); color: var(--on2); }
@keyframes ktpop { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
.kt-in { animation: ktpop 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

.kt-sticky { position: sticky; bottom: -2px; z-index: 3; padding: 14px 0 2px; background: linear-gradient(transparent, var(--bg) 40%); }
