/*
  Party Game Hub UI

  Shape rules: panels 18px radius, controls (buttons, inputs) 12px, chips and avatars are pills.
  Elevation: 2px ink border plus a hard offset shadow. Pressing collapses the shadow.
  Colour: one accent (lime) for primary/positive; coral only for negative or destructive states.
  z-index scale: 10 sticky bars, 40 mobile drawer, 80 modal, 90 toasts.
*/

@font-face {
  font-family: "Bricolage Grotesque";
  src: url(../fonts/bricolage-latin.woff2) format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url(../fonts/bricolage-latin-ext.woff2) format("woff2");
  font-weight: 200 800;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Anton";
  src: url(../fonts/anton-latin.woff2) format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Anton";
  src: url(../fonts/anton-latin-ext.woff2) format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --paper: #eef0ea;
  --paper-2: #e2e5dc;
  --surface: #fbfbf8;
  --ink: #16161b;
  --ink-2: #4a4c54;
  --line: #16161b;
  --shadow: #16161b;
  --accent: #c5f23c;
  --accent-ink: #16161b;
  --danger: #ff6352;
  --danger-ink: #16161b;
  --dot: rgba(22, 22, 27, 0.11);
  --scrim: rgba(22, 22, 27, 0.55);

  --r-panel: 18px;
  --r-ctl: 12px;
  --bw: 2px;
  --lift: 4px;
  --gutter: clamp(16px, 3vw, 32px);

  --font: "Bricolage Grotesque", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --meme: "Anton", Impact, "Arial Narrow", sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #121316;
    --paper-2: #1c1d22;
    --surface: #1f2026;
    --ink: #eef0e8;
    --ink-2: #a7aab2;
    --line: #d9dcd2;
    --shadow: #050506;
    --dot: rgba(238, 240, 232, 0.07);
    --scrim: rgba(5, 5, 6, 0.7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #121316;
  --paper-2: #1c1d22;
  --surface: #1f2026;
  --ink: #eef0e8;
  --ink-2: #a7aab2;
  --line: #d9dcd2;
  --shadow: #050506;
  --dot: rgba(238, 240, 232, 0.07);
  --scrim: rgba(5, 5, 6, 0.7);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  font-weight: 450;
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
}

img,
canvas,
svg {
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 96;
}

p {
  margin: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.ic {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: currentColor;
}

.muted {
  color: var(--ink-2);
}

.boot {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  font-weight: 700;
}

/* ------------------------------------------------------------ buttons */

.btn {
  --sh: var(--lift);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 20px;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--ink);
  font-weight: 750;
  font-size: 16px;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--sh) var(--sh) 0 var(--shadow);
  transition: transform 0.14s var(--ease), box-shadow 0.14s var(--ease), background-color 0.14s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: calc(var(--sh) + 1px) calc(var(--sh) + 1px) 0 var(--shadow);
}
.btn:active {
  transform: translate(var(--sh), var(--sh));
  box-shadow: 0 0 0 var(--shadow);
}
.btn[disabled],
.btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: var(--sh) var(--sh) 0 var(--shadow);
}
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-danger {
  background: var(--danger);
  color: var(--danger-ink);
}
.btn-ink {
  background: var(--ink);
  color: var(--paper);
}
.btn-lg {
  min-height: 60px;
  padding: 16px 26px;
  font-size: 19px;
}
.btn-sm {
  --sh: 3px;
  min-height: 38px;
  padding: 8px 12px;
  font-size: 14px;
  gap: 7px;
}
.btn-block {
  width: 100%;
}
.btn-ghost {
  box-shadow: none;
  border-color: transparent;
  background: transparent;
}
.btn-ghost:hover {
  background: var(--paper-2);
  box-shadow: none;
  transform: none;
}
.btn-ghost:active {
  transform: scale(0.97);
}
.icon-btn {
  --sh: 3px;
  min-height: 42px;
  width: 42px;
  padding: 0;
}
.icon-btn .ic {
  width: 20px;
  height: 20px;
}
/* Language switch in the top bar: shows the language you would switch to. */
.lang-btn {
  min-height: 42px;
  min-width: 42px;
  padding: 0 9px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.lang-chip {
  padding: 2px 7px;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.badge {
  position: absolute;
  top: -8px;
  right: -8px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 99px;
  border: var(--bw) solid var(--line);
  background: var(--danger);
  color: var(--danger-ink);
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
}

/* ------------------------------------------------------------- panels */

.panel {
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r-panel);
  box-shadow: 6px 6px 0 var(--shadow);
}
.panel-pad {
  padding: clamp(16px, 2.2vw, 24px);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-head h2 {
  font-size: 22px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border: var(--bw) solid var(--line);
  border-radius: 99px;
  background: var(--surface);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
}
.chip-accent {
  background: var(--accent);
  color: var(--accent-ink);
}
.chip-danger {
  background: var(--danger);
  color: var(--danger-ink);
}
.chip-ink {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* ------------------------------------------------------------- forms */

.field {
  display: grid;
  gap: 7px;
}
.field > label,
.label {
  font-size: 14px;
  font-weight: 750;
}
.input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  font-size: 17px;
  font-weight: 650;
}
.input::placeholder {
  color: var(--ink-2);
  opacity: 0.85;
  font-weight: 500;
}
textarea.input {
  padding: 11px 14px;
  min-height: 0;
  resize: vertical;
  line-height: 1.35;
}
.help {
  font-size: 13px;
  color: var(--ink-2);
}

.code-input {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 800;
}

/* --------------------------------------------------------------- avatar */

.av {
  --s: 44px;
  width: var(--s);
  height: var(--s);
  flex: none;
  border-radius: 50%;
  border: var(--bw) solid var(--line);
  background: var(--c, var(--accent));
  display: grid;
  place-items: center;
  font-size: calc(var(--s) * 0.56);
  line-height: 1;
  position: relative;
  user-select: none;
}
.av.off {
  filter: grayscale(1);
  opacity: 0.55;
}

/* --------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
  padding: 10px var(--gutter);
  padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: var(--bw) solid var(--line);
}
.topbar .spacer {
  flex: 1;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.02em;
  font-variation-settings: "opsz" 96;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.brand-mark {
  width: 36px;
  height: 36px;
  flex: none;
  transform: rotate(-6deg);
  transition: transform 0.3s var(--ease);
}
.brand:hover .brand-mark {
  transform: rotate(6deg) scale(1.05);
}

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

.wrap {
  width: 100%;
  max-width: 1320px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
  padding-block: clamp(28px, 5vw, 64px) clamp(8px, 2vw, 24px);
}
.hero h1 {
  font-size: clamp(40px, 5vw, 70px);
  line-height: 0.98;
  letter-spacing: -0.035em;
}
.hero h1 .hl {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0 0.12em;
  border: var(--bw) solid var(--line);
  border-radius: 10px;
  transform: rotate(-2deg);
  box-shadow: 4px 4px 0 var(--shadow);
}
.hero-sub {
  margin-top: 18px;
  font-size: clamp(17px, 1.5vw, 20px);
  color: var(--ink-2);
  max-width: 44ch;
}

.play-card {
  margin-top: 28px;
  display: grid;
  gap: 18px;
}
.profile-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}
.profile-row .field {
  flex: 1;
}
.avatar-pick {
  position: relative;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
}
.avatar-pick .av {
  --s: 64px;
  box-shadow: 4px 4px 0 var(--shadow);
  transition: transform 0.2s var(--ease);
}
.avatar-pick:hover .av {
  transform: rotate(-8deg) scale(1.04);
}
.avatar-pick .edit {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: var(--bw) solid var(--line);
  background: var(--surface);
  display: grid;
  place-items: center;
}
.avatar-pick .edit .ic {
  width: 14px;
  height: 14px;
}
.cta-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 14px;
}
.join-row {
  display: flex;
  gap: 10px;
}
.join-row .input {
  flex: 1;
  min-width: 0;
}
.divider-label {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.divider-label::before,
.divider-label::after {
  content: "";
  flex: 1;
  height: 2px;
  background: var(--paper-2);
  border-radius: 2px;
}

.collage {
  position: relative;
  aspect-ratio: 1 / 0.95;
  width: 100%;
}
.collage .sticker {
  position: absolute;
  transition: transform 0.35s var(--ease);
}
.collage .sticker:hover {
  z-index: 3;
}
.collage .s1 {
  width: 54%;
  left: 2%;
  top: 4%;
  transform: rotate(-5deg);
}
.collage .s1:hover {
  transform: rotate(-2deg) scale(1.03);
}
.collage .s2 {
  width: 46%;
  right: 0;
  top: 0;
  transform: rotate(4deg);
  z-index: 1;
}
.collage .s2:hover {
  transform: rotate(1deg) scale(1.03);
}
.collage .s3 {
  width: 60%;
  left: 24%;
  bottom: 0;
  transform: rotate(-1.5deg);
  z-index: 2;
}
.collage .s3:hover {
  transform: rotate(1deg) scale(1.03);
}
.collage .tape {
  position: absolute;
  top: -12px;
  left: 50%;
  width: 84px;
  height: 24px;
  transform: translateX(-50%) rotate(-3deg);
  background: color-mix(in srgb, var(--accent) 80%, transparent);
  border: var(--bw) solid var(--line);
  border-radius: 4px;
  z-index: 2;
}

.section {
  padding-block: clamp(36px, 6vw, 72px);
}
.section-title {
  font-size: clamp(30px, 3.4vw, 44px);
  letter-spacing: -0.03em;
}
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.lobby-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}
.lobby-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px;
}
.lobby-card .meta {
  min-width: 0;
}
.lobby-card .meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lobby-card .meta span {
  font-size: 13px;
  color: var(--ink-2);
}
.empty {
  display: grid;
  justify-items: start;
  gap: 12px;
  padding: 28px;
  border: var(--bw) dashed var(--ink-2);
  border-radius: var(--r-panel);
}
.empty strong {
  font-size: 19px;
}

.skeleton {
  height: 84px;
  border-radius: var(--r-panel);
  background: linear-gradient(90deg, var(--paper-2) 0%, var(--surface) 50%, var(--paper-2) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.bento {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px;
}
.bento > * {
  padding: clamp(18px, 2.4vw, 28px);
  display: grid;
  align-content: start;
  gap: 12px;
}
.bento h3 {
  font-size: 24px;
}
.bento p {
  color: var(--ink-2);
}
.bento .b-caption {
  grid-column: span 4;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 24px;
}
.bento .b-vote,
.bento .b-buddy {
  align-content: space-between;
}
.bento .b-vote {
  grid-column: span 2;
  background: var(--accent);
  color: var(--accent-ink);
}
.bento .b-vote p {
  color: inherit;
  opacity: 0.8;
}
.bento .b-buddy {
  grid-column: span 2;
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.bento .b-buddy p {
  color: inherit;
  opacity: 0.75;
}
.bento .b-modes {
  grid-column: span 4;
}
.mini-votes {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}
.mini-votes span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: var(--bw) solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
.mode-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 24px;
}
.mode-list div,
.mode-list .mode-link {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 12px;
  align-items: center;
}
.mode-link {
  color: inherit;
  text-decoration: none;
  border-radius: 10px;
  margin: -4px -6px;
  padding: 4px 6px;
}
.mode-link:hover strong {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.mode-link:focus-visible {
  outline: 3px solid var(--focus, var(--accent));
  outline-offset: 2px;
}
.mode-list .ic {
  grid-row: span 2;
  width: 28px;
  height: 28px;
}
.mode-list strong {
  font-size: 17px;
}
.mode-list span {
  font-size: 14px;
  color: var(--ink-2);
}
.big-score {
  font-family: var(--meme);
  font-size: 64px;
  line-height: 1;
  letter-spacing: 0.01em;
}

.footer {
  border-top: var(--bw) solid var(--line);
  padding-block: 28px calc(28px + env(safe-area-inset-bottom));
  font-size: 14px;
  color: var(--ink-2);
}
.footer .wrap {
  display: grid;
  gap: 18px;
}
.footer-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
}
.footer-nav .label {
  font-weight: 800;
  color: var(--ink);
}
.footer-nav a {
  color: inherit;
  font-weight: 650;
  text-underline-offset: 3px;
}
.footer-nav a:hover {
  color: var(--ink);
}
.footer-nav .sep {
  width: 1px;
  height: 16px;
  background: var(--line);
  opacity: 0.4;
}

/* ------------------------------------------------------ feedback (feedback.js) */

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.link-btn:hover {
  color: var(--ink);
}
.feedback-links {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}
.room-feedback {
  display: flex;
  justify-content: center;
  margin-top: 18px;
  font-size: 14px;
  color: var(--ink-2);
}
.fb-dialog {
  width: min(560px, calc(100% - 32px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}
.fb-dialog::backdrop {
  background: var(--scrim);
}
.fb-form {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  animation: pop-in 0.3s var(--ease) both;
}
.fb-form .panel-head h2 {
  font-size: 26px;
}
.fb-body {
  display: grid;
  gap: 16px;
}
.fb-kinds {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.fb-kinds legend {
  padding: 0;
  margin-bottom: 7px;
}
.fb-kinds .seg {
  flex-wrap: wrap;
}
.fb-kinds label {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 6px 14px;
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
}
.fb-kinds label + label {
  border-left: var(--bw) solid var(--line);
}
.fb-kinds input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.fb-kinds label:has(input:checked) {
  background: var(--ink);
  color: var(--paper);
}
.fb-kinds label:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: -5px;
}
.fb-small {
  margin: 0;
  font-size: 13px;
}
.fb-small a {
  color: inherit;
  font-weight: 700;
  text-underline-offset: 3px;
}
.fb-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.fb-status {
  margin: 0;
  font-weight: 700;
}
.fb-status:empty {
  display: none;
}
.fb-status.is-error {
  padding: 9px 13px;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--danger);
  color: var(--danger-ink);
}
.fb-thanks {
  margin: 4px 0;
  font-size: 20px;
  font-weight: 750;
}

/* ------------------------------------------------------------- faq */

.faq-list {
  display: grid;
  gap: 12px;
}
.faq details {
  padding: 0;
  box-shadow: 4px 4px 0 var(--shadow);
}
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 16px 20px;
  font-weight: 800;
  font-size: 17px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: '+';
  font-size: 22px;
  line-height: 1;
}
.faq details[open] summary::after {
  content: '\2212';
}
.faq details p {
  padding: 0 20px 18px;
  color: var(--ink-2);
  max-width: 70ch;
}

/* ------------------------------------------------------------- memes */

.meme {
  position: relative;
  width: 100%;
  border: var(--bw) solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #0d0d10;
  box-shadow: 6px 6px 0 var(--shadow);
}
.meme canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.meme.flat {
  box-shadow: none;
}

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

.room-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) 340px;
  gap: 24px;
  padding-block: 28px 48px;
  align-items: start;
}
.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.player-tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: var(--bw) solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  min-width: 0;
  animation: pop-in 0.35s var(--ease) both;
}
.player-tile.me {
  background: color-mix(in srgb, var(--accent) 35%, var(--surface));
}
.player-tile .nm {
  min-width: 0;
  flex: 1;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player-tile .tag {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 4px;
}
.player-tile .me-edit {
  position: relative;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  flex: none;
}
.player-tile .me-edit .edit {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: var(--bw) solid var(--line);
  background: var(--surface);
  display: grid;
  place-items: center;
}
.player-tile .me-edit .edit .ic {
  width: 11px;
  height: 11px;
}
.player-tile .kick {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 30px;
  min-height: 30px;
  --sh: 2px;
}
.player-tile .kick .ic {
  width: 15px;
  height: 15px;
}
.player-tile.empty-slot {
  border-style: dashed;
  border-color: var(--ink-2);
  background: transparent;
  color: var(--ink-2);
  justify-content: center;
  min-height: 60px;
  animation: none;
}
.crown {
  color: #e0a800;
}

.invite {
  margin-top: 20px;
  display: grid;
  gap: 10px;
}
.invite-row {
  display: flex;
  gap: 10px;
}
.invite-row .input {
  flex: 1;
  min-width: 0;
  font-size: 15px;
}
.room-code {
  font-family: var(--meme);
  letter-spacing: 0.12em;
  font-size: 18px;
  font-weight: 400;
}

.settings {
  display: grid;
  gap: 22px;
}
.modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mode-opt {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  align-items: center;
  text-align: left;
  padding: 12px;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--paper);
  cursor: pointer;
  transition: transform 0.14s var(--ease), box-shadow 0.14s var(--ease), background-color 0.14s;
}
.mode-opt .ic {
  grid-row: span 2;
  width: 24px;
  height: 24px;
}
.mode-opt strong {
  font-size: 15px;
  line-height: 1.2;
}
.mode-opt span {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.25;
}
.mode-opt.on {
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 3px 3px 0 var(--shadow);
  transform: translate(-1px, -1px);
}
.mode-opt.on span {
  color: inherit;
  opacity: 0.75;
}
.mode-opt:disabled {
  cursor: default;
}
.mode-opt:not(.on):disabled {
  opacity: 0.6;
}

.set-rows {
  display: grid;
  gap: 4px;
}
.set-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 0;
  border-bottom: 2px solid var(--paper-2);
}
.set-row:last-child {
  border-bottom: 0;
}
.set-row-stack {
  flex-direction: column;
  align-items: stretch;
}
.set-select {
  width: auto;
  max-width: 60%;
  min-height: 40px;
  font-size: 15px;
  padding: 0 10px;
}
/* Draw & pass variant: three equal buttons under the label. */
.set-row-variant .seg {
  width: 100%;
}
.set-row-variant .seg button {
  flex: 1;
  justify-content: center;
  min-height: 40px;
}
.set-row .txt {
  flex: 1 1 150px;
  min-width: 0;
}
.set-row-stack .txt {
  flex: none;
}
/* Segmented controls keep their full width and move below the label when the row is too narrow. */
.set-row > .seg {
  flex: none;
  max-width: 100%;
}
.set-row .txt strong {
  display: block;
  font-size: 15px;
}
.set-row .txt span {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.3;
}

.stepper {
  display: inline-flex;
  align-items: center;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  overflow: hidden;
  flex: none;
}
.stepper button {
  width: 38px;
  height: 38px;
  border: 0;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.stepper button:hover:not(:disabled) {
  background: var(--paper-2);
}
.stepper button:disabled {
  opacity: 0.3;
  cursor: default;
}
.stepper output {
  min-width: 58px;
  text-align: center;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.switch {
  position: relative;
  width: 52px;
  height: 30px;
  flex: none;
  border: var(--bw) solid var(--line);
  border-radius: 99px;
  background: var(--paper-2);
  cursor: pointer;
  padding: 0;
  transition: background-color 0.2s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: var(--bw) solid var(--line);
  background: var(--surface);
  transition: transform 0.22s var(--ease);
}
.switch[aria-checked="true"] {
  background: var(--accent);
}
.switch[aria-checked="true"]::after {
  transform: translateX(22px);
}
.switch:disabled {
  cursor: default;
  opacity: 0.7;
}

.start-box {
  display: grid;
  gap: 10px;
}
.waiting {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  padding: 16px;
  border: var(--bw) dashed var(--ink-2);
  border-radius: var(--r-ctl);
  font-weight: 700;
  color: var(--ink-2);
  text-align: center;
}

/* --------------------------------------------------------------- chat */

.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-log {
  flex: 1;
  min-height: 160px;
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4px 2px 10px;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
.msg {
  font-size: 14.5px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.msg b {
  font-weight: 800;
}
.msg.sys {
  font-size: 13px;
  color: var(--ink-2);
  font-style: italic;
}
.msg.mine b {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0 4px;
  border-radius: 4px;
}
.chat-form {
  display: flex;
  gap: 8px;
  padding-top: 10px;
  border-top: 2px solid var(--paper-2);
}
.chat-form .input {
  min-height: 42px;
  font-size: 15px;
  flex: 1;
  min-width: 0;
}
.chat-empty {
  margin: auto 0;
  text-align: center;
  font-size: 14px;
  color: var(--ink-2);
}

/* --------------------------------------------------------------- game */

.hud {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.hud-round {
  display: grid;
  line-height: 1.1;
  min-width: 0;
}
.hud-round small {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.hud-round strong {
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timer {
  position: relative;
  width: 58px;
  height: 58px;
  flex: none;
  display: grid;
  place-items: center;
}
.timer svg.ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.timer .track {
  fill: var(--surface);
  stroke: var(--line);
  stroke-width: 2.5;
}
.timer .fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.25s linear, stroke 0.3s;
}
.timer.low .fill {
  stroke: var(--danger);
}
.timer .num {
  position: relative;
  font-family: var(--meme);
  font-size: 22px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.timer.low .num {
  animation: pulse 1s var(--ease) infinite;
}
.timer.idle .num {
  font-family: var(--font);
  font-weight: 800;
  font-size: 13px;
}

.game-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 28px;
  padding-block: 24px 48px;
  align-items: start;
}
.stage {
  width: 100%;
  max-width: 820px;
  margin-inline: auto;
  display: grid;
  gap: 20px;
  min-width: 0;
}
.stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.stage-head h2 {
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: -0.03em;
}
.topic-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--ink);
  color: var(--paper);
}
.topic-banner strong {
  font-size: 18px;
}
.topic-banner .ic {
  color: var(--accent);
}

.side {
  display: grid;
  gap: 20px;
  position: sticky;
  top: 92px;
}
.score-list {
  display: grid;
  gap: 8px;
}
.score-row {
  display: grid;
  grid-template-columns: 22px auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 12px;
  transition: background-color 0.2s;
}
.score-row.me {
  background: color-mix(in srgb, var(--accent) 30%, transparent);
}
.score-row .rank {
  font-weight: 800;
  font-size: 14px;
  color: var(--ink-2);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.score-row .av {
  --s: 36px;
}
.score-row .nm {
  min-width: 0;
  display: grid;
  line-height: 1.2;
}
.score-row .nm strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
}
.score-row .nm span {
  font-size: 12px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 4px;
}
.score-row .pts {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.status-ic {
  width: 14px;
  height: 14px;
}
.st-done {
  color: #2f8a1f;
}
:root[data-theme="dark"] .st-done {
  color: var(--accent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .st-done {
    color: var(--accent);
  }
}

/* intro */
.intro {
  display: grid;
  place-items: center;
  text-align: center;
  gap: 18px;
  min-height: 52vh;
  padding-block: 24px;
}
.intro .round-no {
  font-family: var(--meme);
  font-size: clamp(80px, 14vw, 170px);
  line-height: 0.9;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  animation: slam 0.7s var(--ease) both;
}
.intro .round-no span {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0 0.12em;
  border: 3px solid var(--line);
  border-radius: 16px;
  box-shadow: 8px 8px 0 var(--shadow);
  transform: rotate(-3deg);
}
.intro .intro-sub {
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 700;
  animation: fade-up 0.6s 0.35s var(--ease) both;
}

/* editor */
.editor {
  display: grid;
  gap: 16px;
}
.edit-stage {
  position: relative;
  width: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.edit-stage .meme {
  touch-action: none;
}
.tbox {
  position: absolute;
  border: 2px dashed rgba(255, 255, 255, 0.9);
  outline: 1.5px dashed rgba(0, 0, 0, 0.55);
  outline-offset: -3.5px;
  border-radius: 4px;
  cursor: text;
}
.tbox.sel {
  border: 2px solid var(--accent);
  outline: 1.5px solid #16161b;
  outline-offset: 0;
  background: rgba(197, 242, 60, 0.08);
}
.tbox .num {
  position: absolute;
  left: -2px;
  top: -2px;
  transform: translate(-40%, -40%);
  min-width: 22px;
  height: 22px;
  border-radius: 99px;
  border: 2px solid #16161b;
  background: #fbfbf8;
  color: #16161b;
  font-size: 12px;
  font-weight: 800;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.tbox.sel .num {
  background: var(--accent);
}

.swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: var(--bw) solid var(--line);
  cursor: pointer;
  padding: 0;
  position: relative;
}
.swatch.on {
  box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--ink);
}
.seg {
  display: inline-flex;
  border: var(--bw) solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.seg button {
  border: 0;
  background: transparent;
  padding: 6px 10px;
  font-weight: 750;
  font-size: 14px;
  cursor: pointer;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.seg button + button {
  border-left: var(--bw) solid var(--line);
}
.seg button.on {
  background: var(--ink);
  color: var(--paper);
}
.seg .impact {
  font-family: var(--meme);
  font-weight: 400;
  letter-spacing: 0.03em;
}

.captions {
  display: grid;
  gap: 10px;
}
.cap {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
}
.cap .n {
  width: 30px;
  height: 30px;
  margin-top: 10px;
  border-radius: 99px;
  border: var(--bw) solid var(--line);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  background: var(--surface);
}
.cap.sel .n {
  background: var(--accent);
  color: var(--accent-ink);
}
.cap textarea {
  font-size: 16px;
}
.editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.editor-actions .grow {
  flex: 1;
}
.locked-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 750;
  animation: pop-in 0.35s var(--ease) both;
}
.locked-bar .grow {
  flex: 1;
}

.progress-dots {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.progress-dots i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--surface);
}
.progress-dots i.on {
  background: var(--accent);
}

/* vote */
.vote-stage {
  display: grid;
  gap: 18px;
}
.vote-meme {
  width: 100%;
  max-width: 640px;
  margin-inline: auto;
  animation: meme-in 0.5s var(--ease) both;
}
.vote-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-width: 640px;
  width: 100%;
  margin-inline: auto;
}
.vote-btn {
  flex-direction: column;
  gap: 6px;
  min-height: 86px;
  font-size: 17px;
}
.vote-btn .ic {
  width: 30px;
  height: 30px;
}
.vote-btn.on.up {
  background: var(--accent);
  color: var(--accent-ink);
}
.vote-btn.on.meh {
  background: var(--ink);
  color: var(--paper);
}
.vote-btn.on.down {
  background: var(--danger);
  color: var(--danger-ink);
}
.vote-btn.on {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow);
}
.buddy-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 640px;
  margin-inline: auto;
  text-align: center;
}
.buddy-btn.on {
  background: var(--ink);
  color: var(--accent);
}
.own-note {
  max-width: 640px;
  width: 100%;
  margin-inline: auto;
  text-align: center;
  padding: 18px;
  border: var(--bw) dashed var(--ink-2);
  border-radius: var(--r-ctl);
  font-weight: 700;
}
.vote-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  max-width: 640px;
  width: 100%;
  margin-inline: auto;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-2);
}

/* reveal */
.reveal-card {
  max-width: 640px;
  width: 100%;
  margin-inline: auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 18px;
  animation: fade-up 0.45s var(--ease) both;
}
.reveal-card .who {
  min-width: 0;
}
.reveal-card .who small {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-2);
}
.reveal-card .who strong {
  display: block;
  font-size: 22px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.reveal-card .av {
  --s: 56px;
}
.points {
  font-family: var(--meme);
  font-size: clamp(38px, 5vw, 54px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  animation: slam 0.55s 0.2s var(--ease) both;
}
.points.neg {
  color: var(--danger);
}
.tally {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  grid-column: 1 / -1;
}

/* results */
.results-layout {
  display: grid;
  gap: 22px;
}
.winner {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 22px;
  align-items: center;
}
.winner .label {
  display: inline-flex;
}
.winner h3 {
  font-size: 28px;
  margin-top: 10px;
}
.meme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 22px 20px;
  align-items: start;
}
.timer > .ic {
  position: relative;
  width: 24px;
  height: 24px;
}
.meme-tile {
  display: grid;
  gap: 10px;
  animation: pop-in 0.4s var(--ease) both;
}
.meme-tile .cap-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 14px;
  font-weight: 700;
}
.meme-tile .cap-line .av {
  --s: 26px;
}
.meme-tile .cap-line .who {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meme-tile .cap-line .sc {
  flex: none;
  font-variant-numeric: tabular-nums;
}
.dl-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 1;
}
.leader {
  display: grid;
  gap: 8px;
}
.leader-row {
  display: grid;
  grid-template-columns: 28px auto 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 8px 12px;
  border: var(--bw) solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  animation: fade-up 0.4s var(--ease) both;
}
.leader-row .av {
  --s: 38px;
}
.leader-row .rank {
  font-family: var(--meme);
  font-size: 22px;
  text-align: center;
}
.leader-row .nm {
  font-weight: 750;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.leader-row .delta {
  font-weight: 800;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.leader-row .total {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 56px;
  text-align: right;
}
.delta.pos {
  color: #2f8a1f;
}
.delta.neg {
  color: var(--danger);
}
:root[data-theme="dark"] .delta.pos {
  color: var(--accent);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .delta.pos {
    color: var(--accent);
  }
}
.next-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

/* podium */
.podium {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: 14px;
  max-width: 620px;
  width: 100%;
  margin: 12px auto 0;
}
.pod {
  display: grid;
  justify-items: center;
  gap: 8px;
  text-align: center;
  min-width: 0;
}
.pod .av {
  --s: 64px;
  animation: pop-in 0.5s var(--ease) both;
}
.pod.first .av {
  --s: 84px;
}
.pod .nm {
  font-weight: 800;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pod .step {
  width: 100%;
  display: grid;
  place-items: center;
  border: var(--bw) solid var(--line);
  border-radius: 14px 14px 0 0;
  background: var(--surface);
  font-family: var(--meme);
  font-size: 40px;
  box-shadow: 5px 5px 0 var(--shadow);
  transform-origin: bottom;
  animation: rise 0.7s var(--ease) both;
}
.pod.first .step {
  height: 170px;
  background: var(--accent);
  color: var(--accent-ink);
  animation-delay: 0.5s;
}
.pod.second .step {
  height: 126px;
  animation-delay: 0.25s;
}
.pod.third .step {
  height: 92px;
}
.pod .pts {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 70;
}

/* ------------------------------------------------------ modal & toasts */

.modal-back {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--scrim);
  display: grid;
  place-items: center;
  padding: 16px;
  animation: fade 0.2s ease both;
}
.modal {
  width: 100%;
  max-width: 560px;
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  animation: pop-in 0.3s var(--ease) both;
}
.modal .panel-head h2 {
  font-size: 26px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}
.howto {
  display: grid;
  gap: 16px;
}
.howto div {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 4px 14px;
}
.howto .ic {
  grid-row: span 2;
  width: 40px;
  height: 40px;
  padding: 8px;
  border: var(--bw) solid var(--line);
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
}
.howto strong {
  font-size: 17px;
}
.howto p {
  color: var(--ink-2);
  font-size: 15px;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}
.emoji-grid button {
  aspect-ratio: 1;
  border: var(--bw) solid transparent;
  border-radius: 12px;
  background: var(--paper);
  font-size: 22px;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.emoji-grid button.on {
  border-color: var(--line);
  background: var(--accent);
}
.color-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.color-row .swatch {
  width: 34px;
  height: 34px;
}

.toasts {
  position: fixed;
  left: 50%;
  top: calc(80px + env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 90;
  display: grid;
  gap: 8px;
  width: min(420px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  box-shadow: 4px 4px 0 var(--shadow);
  font-weight: 700;
  animation: toast-in 0.35s var(--ease) both;
}
.toast.error {
  background: var(--danger);
  color: var(--danger-ink);
}
.toast.ok {
  background: var(--accent);
  color: var(--accent-ink);
}

.conn {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 90;
}

/* ------------------------------------------------------- draw & pass */

.tele-turn,
.album {
  display: grid;
  gap: 18px;
}
.prompt-banner strong {
  font-size: 20px;
  line-height: 1.25;
}
.drawpad {
  display: grid;
  gap: 12px;
}
.dp-stage {
  position: relative;
  width: min(100%, calc(62vh * 4 / 3));
  margin-inline: auto;
  aspect-ratio: 4 / 3;
  background: #ffffff;
  border: var(--bw) solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 6px 6px 0 var(--shadow);
  touch-action: none;
}
.dp-layer,
.dp-ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-user-drag: none;
}
.dp-ink {
  touch-action: none;
  cursor: crosshair;
}
.dp-ink.tool-fill {
  cursor: cell;
}
.drawpad.is-locked .dp-ink {
  pointer-events: none;
}
.drawpad.is-locked .dp-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(197, 242, 60, 0.12);
  pointer-events: none;
}
.dp-tools {
  display: grid;
  gap: 10px;
  width: min(100%, calc(62vh * 4 / 3));
  margin-inline: auto;
  padding: 12px;
  border: var(--bw) solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
}
.dp-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.dp-palette .swatch {
  width: 30px;
  height: 30px;
}
.dp-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.dp-sizes .dot {
  display: block;
  border-radius: 50%;
  background: currentColor;
}
.task-drawing {
  position: relative;
  width: min(100%, calc(58vh * 4 / 3));
  margin-inline: auto;
  aspect-ratio: 4 / 3;
  background: #ffffff;
  border: var(--bw) solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 6px 6px 0 var(--shadow);
}
.task-drawing img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.blank-drawing {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 160px;
  padding: 16px;
  text-align: center;
  color: #6b6f78;
  font-weight: 700;
  background: #ffffff;
}
.task-drawing.flash {
  animation: pop-in 0.35s var(--ease) both;
}
.flash-count {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 14px;
  border: var(--bw) solid #16161b;
  border-radius: 99px;
  background: var(--accent);
  color: #16161b;
  font-weight: 800;
}
.flash-count strong {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #16161b;
  color: var(--accent);
  font-family: var(--meme);
  font-size: 18px;
  font-weight: 400;
}
.tele-input {
  font-size: 19px;
  font-weight: 700;
}
.album-feed {
  display: grid;
  gap: 20px;
  max-width: 680px;
  width: 100%;
  margin-inline: auto;
}
.entry {
  display: grid;
  gap: 8px;
}
.entry.fresh {
  animation: meme-in 0.5s var(--ease) both;
}
.entry-who {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--ink-2);
}
.entry-who b {
  color: var(--ink);
}
.entry .task-drawing {
  width: 100%;
}
.bubble {
  justify-self: start;
  max-width: 100%;
  padding: 12px 16px;
  border: var(--bw) solid var(--line);
  border-radius: 4px 16px 16px 16px;
  background: var(--surface);
  box-shadow: 4px 4px 0 var(--shadow);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.album-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.album-tabs .chip {
  cursor: pointer;
  padding: 4px 12px 4px 4px;
}
.album-tabs .av {
  border-width: 1.5px;
  font-size: 13px;
}
.album-next {
  position: sticky;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 5;
  display: flex;
  justify-content: flex-start;
  pointer-events: none;
}
.album-next .btn {
  pointer-events: auto;
}

/* mobile side drawer toggle */
.side-toggle {
  display: none;
  position: relative;
}
.fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 45;
  width: 58px;
  min-height: 58px;
  padding: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
}
.fab .ic {
  width: 26px;
  height: 26px;
}
.side-scrim {
  display: none;
}

/* --------------------------------------------------------- animations */

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.9) rotate(-1.5deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes meme-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.94) rotate(1.5deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes slam {
  0% {
    opacity: 0;
    transform: scale(2.2);
  }
  60% {
    opacity: 1;
    transform: scale(0.94);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes rise {
  from {
    transform: scaleY(0);
  }
}
@keyframes pulse {
  50% {
    transform: scale(1.18);
  }
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------------------------------------------------------- responsive */

@media (max-width: 1180px) {
  .room-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .room-grid .chat-panel {
    grid-column: 1 / -1;
  }
  .game-grid {
    grid-template-columns: minmax(0, 1fr) 290px;
    gap: 20px;
  }
}

@media (max-width: 920px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .collage {
    max-width: 560px;
    margin-inline: auto;
  }
  .bento .b-caption,
  .bento .b-modes {
    grid-column: span 6;
  }
  .bento .b-vote,
  .bento .b-buddy {
    grid-column: span 3;
  }
  .game-grid {
    grid-template-columns: 1fr;
  }
  .side {
    position: fixed;
    z-index: 40;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    max-height: 78dvh;
    overflow-y: auto;
    padding: 16px var(--gutter) calc(16px + env(safe-area-inset-bottom));
    background: var(--paper);
    border-top: var(--bw) solid var(--line);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -8px 0 var(--scrim);
    transform: translateY(105%);
    transition: transform 0.35s var(--ease);
  }
  .side.open {
    transform: none;
  }
  .side-toggle {
    display: inline-flex;
  }
  .side-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 39;
    background: var(--scrim);
    animation: fade 0.2s ease both;
  }
  .stage {
    padding-bottom: 72px;
  }
  .winner {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .room-grid {
    grid-template-columns: 1fr;
  }
  .bento .b-vote,
  .bento .b-buddy {
    grid-column: span 6;
  }
  .bento .b-caption {
    grid-template-columns: 1fr;
  }
  .mode-list {
    grid-template-columns: 1fr;
  }
  .dp-palette .swatch {
    width: 26px;
    height: 26px;
  }
  .cta-row {
    grid-template-columns: 1fr;
  }
  .hud-round small {
    display: none;
  }
  .topbar .hide-sm {
    display: none;
  }
  .topbar.in-game .brand {
    display: none;
  }
  /* Room for the round title on phones; the language can be switched in the lobby. */
  .topbar.in-game .lang-btn {
    display: none;
  }
  .editor-actions > .btn-primary {
    flex-basis: 100%;
  }
  .vote-btn {
    min-height: 74px;
    font-size: 15px;
  }
  .reveal-card {
    grid-template-columns: auto 1fr;
  }
  .reveal-card .points {
    grid-column: 1 / -1;
  }
  .meme-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
  }
  .leader-row {
    grid-template-columns: 24px auto 1fr auto;
  }
  .leader-row .delta {
    display: none;
  }
  .emoji-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 420px) {
  .modes {
    grid-template-columns: 1fr;
  }
  .brand .brand-name {
    display: none;
  }
}
