/* Doodle Maxxing — clean and friendly. Thick outlines, soft hard-shadows, chunky pills. */
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 400; font-display: swap; src: url(/fonts/BricolageGrotesque-Regular.ttf) format('truetype'); }
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 500 900; font-display: swap; src: url(/fonts/BricolageGrotesque-Bold.ttf) format('truetype'); }
:root {
  --yellow: #ffc567;
  --pink: #fb7da8;
  --red: #fd5a46;
  --purple: #552cb7;
  --green: #00995e;
  --blue: #058cd7;
  --gold: #ffc567;
  --silver: #d9dde3;
  --bronze: #e9a37d;

  --bg: #fff4e0;
  --bg-dot: #f1dcb8;
  --surface: #ffffff;
  --surface-2: #fff9ee;
  --text: #141414;
  --muted: #6b6158;
  --line: #141414;
  --shadow: #141414;
  --paper: #fffdf7;
  --ink: #141414;
  --on-accent: #141414;
  --on-dark-accent: #ffffff;

  --bw: 2.5px;
  --r: 16px;
  --sh: 4px;
  --font: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --pixel: 'Bricolage Grotesque', 'Space Grotesk', ui-sans-serif, system-ui, sans-serif; /* display font (name kept from the pixel days) */
  color-scheme: light;
}
:root[data-theme='dark'] {
  --bg: #131117;
  --bg-dot: #24202b;
  --surface: #1e1b24;
  --surface-2: #26222e;
  --text: #f5efe0;
  --muted: #a69f93;
  --line: #f5efe0;
  --shadow: #000000;
  --paper: #1b1920;
  --ink: #f5efe0;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
body {
  background-image: var(--page-bg-image, radial-gradient(var(--bg-dot) 1.4px, transparent 1.4px));
  background-size: var(--page-bg-size, 18px 18px);
  background-position: var(--page-bg-pos, 0 0);
  background-repeat: var(--page-bg-repeat, repeat);
  background-attachment: var(--page-bg-attach, scroll);
}
:root[data-theme='dark'] body { background-image: var(--page-bg-image-dark, var(--page-bg-image, radial-gradient(var(--bg-dot) 1.4px, transparent 1.4px))); }
button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  touch-action: manipulation;
}
img.avatar {
  display: block;
}

/* ---------- layout ---------- */
.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.wrap {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}
.wrap.center {
  align-items: center;
  justify-content: center;
  text-align: center;
}
.center-text {
  text-align: center;
}
.row {
  display: flex;
  align-items: center;
}
.gap {
  gap: 10px;
}
.stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.stack.center {
  align-items: stretch;
  text-align: center;
}
.muted {
  color: var(--muted);
}
.small {
  font-size: 13px;
}
.fine {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}
.label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.title {
  font-family: var(--pixel);
  font-weight: 700;
  font-size: 30px;
  line-height: 1.05;
  margin: 4px 0 0;
  letter-spacing: -0.01em;
}
.title.big {
  font-size: 44px;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
}
.topbar-right {
  display: flex;
  gap: 8px;
  align-items: center;
}
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: var(--bw) solid var(--line);
  background: var(--surface);
  box-shadow: 2px 2px 0 var(--shadow);
  font-size: 18px;
  display: grid;
  place-items: center;
  padding: 0;
}
.icon-btn:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

/* ---------- logo ---------- */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo-text {
  display: flex;
  flex-direction: column;
  font-family: var(--pixel);
  font-weight: 700;
  line-height: 0.9;
}
.logo.small .logo-text {
  flex-direction: row;
  gap: 6px;
  font-size: 18px;
}
.logo-pencil {
  width: 30px;
  height: 30px;
  border: var(--bw) solid var(--line);
  border-radius: 9px;
  background: var(--yellow) linear-gradient(135deg, transparent 44%, var(--line) 44% 56%, transparent 56%);
  box-shadow: 2px 2px 0 var(--shadow);
  flex: none;
}
.logo.big {
  justify-content: center;
  gap: 14px;
}
.logo.big .logo-text {
  font-size: clamp(56px, 18vw, 84px);
  letter-spacing: 0.02em;
}
.logo.big .logo-text b:first-child {
  color: var(--text);
}
.logo.big .logo-text b:last-child {
  color: var(--red);
  -webkit-text-stroke: 2px var(--line);
  text-shadow: 4px 4px 0 var(--shadow);
}
.logo.big .logo-pencil {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  border-width: 3px;
  box-shadow: 4px 4px 0 var(--shadow);
  transform: rotate(-8deg);
}
.hero {
  padding: 18px 0 4px;
  text-align: center;
}
.tagline {
  margin: 10px 0 0;
  font-weight: 700;
  font-size: 18px;
}

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: var(--bw) solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--sh) var(--sh) 0 var(--shadow);
  padding: 16px;
}
.card h2 {
  margin: 0;
  font-size: 18px;
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  font-weight: 700;
  font-size: 13px;
  background: var(--surface-2);
  white-space: nowrap;
}
.chip-green {
  background: var(--green);
  color: #fff;
}
.code-chip {
  font-family: var(--pixel);
  letter-spacing: -0.01em;
  background: var(--yellow);
  color: #141414;
}

/* ---------- buttons ---------- */
.btn {
  border: var(--bw) solid var(--line);
  border-radius: 999px;
  padding: 12px 20px;
  font-weight: 700;
  font-size: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--sh) var(--sh) 0 var(--shadow);
  transition: transform 0.06s, box-shadow 0.06s;
  white-space: nowrap;
  /* centre an icon and its label on one line (the icon used to sit on the text baseline, a little high) */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:active:not(:disabled) {
  transform: translate(var(--sh), var(--sh));
  box-shadow: 0 0 0 var(--shadow);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: 2px 2px 0 var(--shadow);
}
.btn-xl {
  font-size: 19px;
  padding: 16px 22px;
  width: 100%;
}
.btn-sm {
  padding: 8px 14px;
  font-size: 14px;
  box-shadow: 3px 3px 0 var(--shadow);
}
.btn-yellow {
  background: var(--yellow);
  color: #141414;
  border-color: #141414;
}
.btn-pink {
  background: var(--pink);
  color: #141414;
  border-color: #141414;
}
.btn-blue {
  background: var(--blue);
  color: #fff;
  border-color: #141414;
}
.btn-green {
  background: var(--green);
  color: #fff;
  border-color: #141414;
}
.btn-ghost {
  background: var(--surface);
}
.link {
  background: none;
  border: 0;
  color: var(--muted);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 8px;
  align-self: center;
}

/* ---------- home ---------- */
.or {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.or::before,
.or::after {
  content: '';
  flex: 1;
  border-top: 2px dashed var(--muted);
  opacity: 0.5;
}
.join-row {
  display: flex;
  gap: 10px;
}
.code-input,
.name-input {
  flex: 1;
  min-width: 0;
  border: var(--bw) solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--surface-2);
  font-size: 18px;
  font-weight: 700;
  outline: none;
  box-shadow: inset 3px 3px 0 rgba(0, 0, 0, 0.08);
}
.code-input {
  font-family: var(--pixel);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-align: center;
  font-size: 22px;
}
.code-input:focus,
.name-input:focus {
  border-color: var(--blue);
}
.steps {
  display: grid;
  gap: 10px;
}
.step {
  display: flex;
  gap: 12px;
  align-items: center;
  border: var(--bw) solid #141414;
  border-radius: 14px;
  padding: 10px 12px;
  color: #141414;
  box-shadow: 3px 3px 0 var(--shadow);
}
.step p {
  margin: 2px 0 0;
  font-size: 14px;
}
.step.pink {
  background: var(--pink);
}
.step.blue {
  background: #8fd0f5;
}
.step.green {
  background: #8fe0b8;
}
.step-n {
  font-family: var(--pixel);
  font-size: 22px;
  width: 38px;
  height: 38px;
  flex: none;
  display: grid;
  place-items: center;
  background: #fff;
  border: 2px solid #141414;
  border-radius: 10px;
}

/* ---------- profile ---------- */
.code-badge {
  align-self: flex-start;
  font-family: var(--pixel);
  font-size: 22px;
  letter-spacing: 0.2em;
  background: var(--yellow);
  color: #141414;
  border: var(--bw) solid #141414;
  border-radius: 10px;
  padding: 4px 12px;
  box-shadow: 3px 3px 0 var(--shadow);
}
.avatar-row {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  margin: 6px 0;
}
.avatar-big {
  width: 132px;
  height: 132px;
  border: 3px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 5px 5px 0 var(--shadow);
}
.avatar-big img {
  width: 100%;
  height: 100%;
}
.avatar-big.pop {
  animation: pop 0.25s ease-out;
}
.dice {
  padding: 10px 14px;
  font-size: 20px;
}

/* ---------- lobby ---------- */
.room-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: var(--yellow);
  color: #141414;
  border-color: #141414;
}
.room-card .label {
  color: #5a4a2a;
}
.room-code {
  display: flex;
  flex-direction: column;
}
.room-code b {
  font-family: var(--pixel);
  font-size: 34px;
  letter-spacing: -0.01em;
}
.room-card .row {
  flex-direction: column;
  align-items: stretch;
}
.room-card .btn-ghost {
  background: #fff;
  color: #141414;
  border-color: #141414;
}
.player-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pchip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  background: var(--surface-2);
  min-width: 0;
}
.pchip img.avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 2px solid var(--line);
  flex: none;
}
.av-wrap {
  position: relative;
  flex: none;
}
.crown-badge {
  position: absolute;
  top: -10px;
  left: -6px;
  font-size: 15px;
  transform: rotate(-18deg);
  filter: drop-shadow(1px 1px 0 #141414);
}
.pchip.me {
  background: color-mix(in srgb, var(--yellow) 35%, var(--surface));
}
.pchip.offline,
.offline {
  opacity: 0.45;
}
.pchip.ghost {
  border-style: dashed;
  justify-content: center;
  color: var(--muted);
  min-height: 52px;
}
.pmeta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.15;
}
.pmeta small {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.pname {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.tags {
  display: flex;
  gap: 4px;
  align-items: center;
}
.tag.you {
  font-size: 11px;
  font-weight: 700;
  background: var(--line);
  color: var(--bg);
  border-radius: 6px;
  padding: 1px 5px;
}
.kick {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  padding: 4px;
}
.set-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.seg {
  display: flex;
  border: var(--bw) solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
}
.seg button {
  flex: 1;
  border: 0;
  border-right: 2px solid var(--line);
  background: none;
  padding: 9px 4px;
  font-weight: 700;
  font-size: 15px;
}
.seg button:last-child {
  border-right: 0;
}
.seg button.on {
  background: var(--purple);
  color: #fff;
}
.seg.readonly button {
  cursor: default;
}
.seg.readonly button:not(.on) {
  opacity: 0.6;
}
.seg button:disabled {
  opacity: 1;
  color: inherit;
}
.seg.readonly button.on {
  color: #fff;
}
.sticky-foot {
  position: sticky;
  bottom: 0;
  padding: 12px 16px;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, var(--bg) 30%);
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
}
.foot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.waiting-pill {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  border: var(--bw) dashed var(--line);
  border-radius: 999px;
  padding: 14px;
  font-weight: 700;
  background: var(--surface);
}
.dot-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 1s infinite;
}

/* ---------- intro ---------- */
.round-tag {
  align-self: center;
  font-family: var(--pixel);
  font-size: 15px;
  letter-spacing: -0.01em;
  background: var(--purple);
  color: #fff;
  border: var(--bw) solid #141414;
  border-radius: 999px;
  padding: 6px 14px;
  box-shadow: 3px 3px 0 var(--shadow);
}
.count-ring {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 4px solid #141414;
  background: var(--yellow);
  box-shadow: 6px 6px 0 var(--shadow);
  display: grid;
  place-items: center;
  margin: 18px 0;
}
.count {
  font-family: var(--pixel);
  font-size: 96px;
  color: #141414;
  line-height: 1;
}
.count.pop,
.word.pop {
  animation: pop 0.3s ease-out;
}
.hint {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  margin: 0;
  text-align: center;
}

/* ---------- draw ---------- */
.screen.draw {
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
}
.draw-view {
  height: 100dvh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  max-width: 560px;
  margin: 0 auto;
  width: 100%;
  padding: max(10px, env(safe-area-inset-top)) 12px max(10px, env(safe-area-inset-bottom));
  gap: 10px;
}
.draw-head {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  gap: 8px;
}
.counter,
.secs {
  font-family: var(--pixel);
  font-weight: 700;
  font-size: 18px;
  text-align: center;
  border: var(--bw) solid var(--line);
  border-radius: 12px;
  padding: 6px 0;
  background: var(--surface);
}
.secs {
  font-size: 24px;
  background: var(--yellow);
  color: #141414;
  border-color: #141414;
}
.word {
  text-align: center;
  font-weight: 700;
  font-size: clamp(22px, 7vw, 32px);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.tbar {
  height: 14px;
  border: var(--bw) solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface);
}
.tbar-fill {
  height: 100%;
  width: 100%;
  background: var(--green);
  transform-origin: left;
}
.tbar.low .tbar-fill {
  background: var(--red);
}
.pad-area {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pad-box {
  position: relative;
  border: 3px solid var(--line);
  border-radius: 18px;
  box-shadow: 5px 5px 0 var(--shadow);
  overflow: hidden;
  background: var(--paper);
}
canvas.pad {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.draw-tools {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
}
.tool {
  font-size: 18px;
  padding: 14px;
}
.big-emoji {
  font-size: 56px;
}
.progress-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}
.prog-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 6px 10px;
  background: var(--surface);
}
.prog-row img.avatar {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 2px solid var(--line);
}
.mini-bar {
  width: 70px;
  height: 8px;
  border: 2px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.mini-bar > div {
  height: 100%;
  background: var(--green);
}

/* ---------- match ---------- */
.match-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 0 12px;
  flex: 1;
}
.match-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.match-head {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}
.match-head img.avatar {
  width: 42px;
  height: 42px;
  border: 2px solid var(--line);
  border-radius: 10px;
}
.match-timer {
  font-family: var(--pixel);
  font-size: 20px;
  border: var(--bw) solid #141414;
  border-radius: 12px;
  padding: 6px 12px;
  background: var(--yellow);
  color: #141414;
  white-space: nowrap;
}
.match-timer.hurry {
  background: var(--red);
  color: #fff;
  animation: shake 0.6s infinite;
}
.match-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(var(--cols, 3), 1fr);
}
.match-grid[data-cols='2'] {
  --cols: 2;
}
.match-grid[data-cols='3'] {
  --cols: 3;
}
.match-grid[data-cols='4'] {
  --cols: 4;
}
.tile {
  border: var(--bw) solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  box-shadow: 3px 3px 0 var(--shadow);
  transition: transform 0.1s;
}
.tile canvas.thumb {
  width: 100%;
  aspect-ratio: 4 / 5;
  height: auto;
  display: block;
}
.slot {
  border-top: 2px solid var(--line);
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3px;
  background: var(--surface-2);
}
.slot-empty {
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}
.match-grid.placing .tile:not(.filled) {
  outline: 3px dashed var(--blue);
  outline-offset: -6px;
}
.tile.over {
  transform: scale(1.04);
  outline: 3px solid var(--blue);
  outline-offset: -3px;
}
.tile.filled .slot {
  background: color-mix(in srgb, var(--yellow) 40%, var(--surface));
}
.tray-wrap {
  position: sticky;
  bottom: 0;
  margin: 4px -12px 0;
  padding: 10px 12px;
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: var(--bw) solid var(--line);
  box-shadow: 0 -4px 0 rgba(0, 0, 0, 0.06);
}
.tray {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 36px;
  max-height: 28dvh;
  overflow-y: auto;
}
.tray-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
}
.wchip {
  border: 2px solid #141414;
  background: var(--pink);
  color: #141414;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 2px 2px 0 var(--shadow);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.wchip.sel {
  background: var(--blue);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 3px 4px 0 var(--shadow);
}
.wchip.placed {
  background: var(--yellow);
  font-size: 12px;
  padding: 3px 8px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: none;
}
.ghost-chip {
  position: fixed;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 50;
  background: var(--blue);
  color: #fff;
}

/* ---------- results ---------- */
.my-points {
  text-align: center;
  background: var(--green);
  color: #fff;
  border-color: #141414;
}
.big-pts {
  font-family: var(--pixel);
  font-size: 48px;
  line-height: 1;
}
.pts-split {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
  font-size: 14px;
  flex-wrap: wrap;
}
.board {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.board li {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 6px 10px;
  background: var(--surface-2);
}
.board li.me {
  background: color-mix(in srgb, var(--yellow) 35%, var(--surface));
}
.board img.avatar {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  border: 2px solid var(--line);
}
.rank {
  font-family: var(--pixel);
  width: 22px;
  text-align: center;
}
.delta {
  color: var(--green);
  font-weight: 700;
  font-size: 14px;
}
:root[data-theme='dark'] .delta {
  color: #45d39a;
}
.score {
  font-family: var(--pixel);
  min-width: 56px;
  text-align: right;
}
.res-grid + .res-grid {
  margin-top: 16px;
}
.res-grid-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.res-grid-head img.avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid var(--line);
}
.res-grid-head b {
  flex: 1;
}
.res-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.res-tile {
  border: 2px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper);
}
.res-tile canvas.thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  display: block;
}
.res-label {
  border-top: 2px solid var(--line);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 4px;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  background: var(--surface-2);
}
.res-label s {
  color: var(--red);
  font-weight: 500;
}
.res-tile.ok .res-label {
  background: #8fe0b8;
  color: #141414;
}
.res-tile.bad .res-label {
  background: #ffc1b7;
  color: #141414;
}

/* ---------- podium ---------- */
.podium {
  display: grid;
  grid-template-columns: 1fr 1.15fr 1fr;
  align-items: end;
  gap: 8px;
  margin-top: 30px;
}
.spot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.spot img.avatar {
  width: 64px;
  height: 64px;
  border: 3px solid var(--line);
  border-radius: 14px;
  box-shadow: 3px 3px 0 var(--shadow);
}
.spot.p1 img.avatar {
  width: 84px;
  height: 84px;
}
.spot-name {
  font-weight: 700;
  font-size: 14px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spot-score {
  font-family: var(--pixel);
  font-size: 14px;
}
.block {
  width: 100%;
  border: 3px solid #141414;
  border-radius: 14px 14px 0 0;
  display: grid;
  place-items: start center;
  padding-top: 8px;
  font-family: var(--pixel);
  font-size: 34px;
  color: #141414;
  box-shadow: 4px 0 0 var(--shadow);
}
.p1 .block {
  height: 150px;
  background: var(--gold);
}
.p2 .block {
  height: 110px;
  background: var(--silver);
}
.p3 .block {
  height: 80px;
  background: var(--bronze);
}
.crown-big {
  font-size: 34px;
  animation: bob 1.4s ease-in-out infinite;
}
.confetti {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 5;
}
.confetti i {
  position: absolute;
  top: -20px;
  width: 9px;
  height: 14px;
  border: 1.5px solid #141414;
  animation: fall linear forwards;
}

/* ---------- misc ---------- */
.spinner {
  width: 44px;
  height: 44px;
  border: 5px solid var(--line);
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 20px auto;
}
#toast {
  position: fixed;
  left: 50%;
  top: max(64px, calc(env(safe-area-inset-top) + 56px));
  transform: translate(-50%, -12px);
  opacity: 0;
  visibility: hidden;
  background: var(--line);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 14px;
  font-weight: 700;
  transition: transform 0.25s, opacity 0.25s, visibility 0.25s;
  z-index: 100;
  max-width: 90vw;
  text-align: center;
  pointer-events: none;
}
#toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
  visibility: visible;
}
#toast:empty {
  display: none;
}
#net-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--red);
  color: #fff;
  text-align: center;
  font-weight: 700;
  padding: 6px;
  transform: translateY(-100%);
  transition: transform 0.2s;
  z-index: 90;
  border-bottom: 2px solid #141414;
}
#net-banner.show {
  transform: none;
}

@keyframes pop {
  0% {
    transform: scale(0.6);
  }
  70% {
    transform: scale(1.08);
  }
  100% {
    transform: scale(1);
  }
}
@keyframes pulse {
  50% {
    opacity: 0.3;
    transform: scale(0.7);
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes shake {
  0%,
  100% {
    transform: rotate(0);
  }
  25% {
    transform: rotate(-3deg);
  }
  75% {
    transform: rotate(3deg);
  }
}
@keyframes bob {
  50% {
    transform: translateY(-5px);
  }
}
@keyframes fall {
  to {
    transform: translateY(110vh) rotate(720deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .confetti {
    display: none;
  }
}
@media (min-width: 700px) {
  .player-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

/* =================== v2: pages, sheets, profile, gallery =================== */
.foot-links {
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}
.leave-btn {
  width: auto;
  padding: 0 12px;
  gap: 6px;
  display: flex;
  align-items: center;
  font-size: 15px;
  font-weight: 700;
}
.screen:has(.sticky-foot) .wrap {
  padding-bottom: 110px;
}
.me-btn {
  padding: 0;
  overflow: hidden;
}
.me-btn img.avatar {
  width: 100%;
  height: 100%;
}
.center-row {
  justify-content: center;
  flex-wrap: wrap;
}
.row.wrap {
  flex-wrap: wrap;
}
.sub-line {
  display: block;
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
}
.btn.danger {
  background: var(--red);
  color: #fff;
  border-color: #141414;
}

/* sheet (overlay) */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(10, 8, 14, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadein 0.15s ease-out;
}
.sheet.closing {
  animation: fadeout 0.18s ease-in forwards;
}
.sheet-inner {
  background: var(--bg);
  width: 100%;
  max-width: 560px;
  max-height: 94dvh;
  border: 3px solid var(--line);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  display: flex;
  flex-direction: column;
  animation: slideup 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
  background-image: var(--page-bg-image, radial-gradient(var(--bg-dot) 1.4px, transparent 1.4px));
  background-size: var(--page-bg-size, 18px 18px);
  background-position: var(--page-bg-pos, 0 0);
  background-repeat: var(--page-bg-repeat, repeat);
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 2px solid var(--line);
}
.sheet-head h2 {
  margin: 0;
  font-family: var(--pixel);
  font-size: 20px;
}
.sheet-body {
  overflow-y: auto;
  padding: 14px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
}
@keyframes slideup {
  from {
    transform: translateY(40%);
    opacity: 0;
  }
}
@keyframes fadein {
  from {
    opacity: 0;
  }
}
@keyframes fadeout {
  to {
    opacity: 0;
  }
}

/* profile */
.profile-page {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.profile-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}
.profile-head .name-input {
  text-align: center;
  width: 100%;
  max-width: 300px;
}
.level {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 10px;
  width: 100%;
}
.level .small {
  grid-column: 2;
  text-align: right;
}
.lvl-badge {
  font-family: var(--pixel);
  background: var(--purple);
  color: #fff;
  border: 2px solid #141414;
  border-radius: 10px;
  padding: 4px 10px;
  grid-row: span 2;
}
.xp-bar,
.meter-bar,
.b-prog {
  height: 12px;
  border: 2px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
}
.xp-bar > div {
  height: 100%;
  background: var(--yellow);
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stat-tile {
  border: var(--bw) solid var(--line);
  border-radius: 14px;
  padding: 10px 8px;
  background: var(--surface);
  box-shadow: 3px 3px 0 var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}
.stat-tile b {
  font-family: var(--pixel);
  font-size: 20px;
}
.stat-tile span {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.85;
}
.stat-tile.yellow,
.stat-tile.pink,
.stat-tile.blue,
.stat-tile.green {
  color: #141414;
  border-color: #141414;
}
.stat-tile.yellow {
  background: var(--yellow);
}
.stat-tile.pink {
  background: var(--pink);
}
.stat-tile.blue {
  background: #8fd0f5;
}
.stat-tile.green {
  background: #8fe0b8;
}
.meter {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.meter-top {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}
.meter-bar > div {
  height: 100%;
  background: var(--green);
}
.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
}
.mini-stats div {
  display: flex;
  flex-direction: column;
  border: 2px dashed var(--line);
  border-radius: 12px;
  padding: 8px 4px;
}
.mini-stats b {
  font-family: var(--pixel);
  font-size: 18px;
}
.mini-stats span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}
.badges {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.badge {
  border: 2px dashed var(--muted);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  opacity: 0.55;
  filter: grayscale(1);
}
.badge.got {
  opacity: 1;
  filter: none;
  border: 2px solid #141414;
  background: var(--yellow);
  color: #141414;
  box-shadow: 3px 3px 0 var(--shadow);
}
.b-emoji {
  font-size: 26px;
}
.b-prog {
  height: 8px;
  margin-top: 4px;
}
.b-prog > div {
  height: 100%;
  background: var(--blue);
}
.history li {
  align-items: center;
}
.history .pname {
  white-space: normal;
}
.save-card {
  background: color-mix(in srgb, var(--blue) 18%, var(--surface));
}
.g-btn {
  display: flex;
  justify-content: center;
  min-height: 44px;
}

/* gallery */
.gallery {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tabs button {
  font-size: 14px;
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.g-card {
  border: var(--bw) solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
  background: var(--paper);
  text-align: left;
  box-shadow: 3px 3px 0 var(--shadow);
  display: flex;
  flex-direction: column;
}
.g-card canvas.thumb {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  display: block;
}
.g-meta {
  border-top: 2px solid var(--line);
  background: var(--surface-2);
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  line-height: 1.2;
}
.g-meta b {
  text-transform: capitalize;
}
.g-artist {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.g-artist img.avatar {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1.5px solid var(--line);
  flex: none;
}
.zoom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.zoom-frame {
  border: 3px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 5px 5px 0 var(--shadow);
  width: min(100%, 360px);
}
.zoom-canvas {
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  display: block;
}
.zoom-meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.zoom-meta b {
  font-size: 22px;
  text-transform: uppercase;
}

/* how to play + privacy */
.how {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.how-step {
  display: flex;
  gap: 12px;
  border: var(--bw) solid #141414;
  border-radius: 16px;
  padding: 14px;
  color: #141414;
  box-shadow: 4px 4px 0 var(--shadow);
}
.how-step h3 {
  margin: 4px 0 6px;
}
.how-step p {
  margin: 0 0 6px;
}
.how-step ul {
  margin: 0;
  padding-left: 18px;
}
.how-step.yellow {
  background: var(--yellow);
}
.how-step.pink {
  background: var(--pink);
}
.how-step.blue {
  background: #8fd0f5;
}
.how-step.green {
  background: #8fe0b8;
}
.legal-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.legal h3 {
  margin: 0 0 6px;
}
.legal ul {
  margin: 0;
  padding-left: 18px;
  line-height: 1.5;
}
.legal p {
  margin: 0;
  line-height: 1.5;
}
.legal a {
  color: var(--blue);
}
.big-pts.pop {
  animation: pop 0.35s ease-out;
}

/* =================== v3: matching tweaks =================== */
.match-timer.calm {
  background: var(--surface);
  color: var(--muted);
  font-size: 15px;
}
:root[data-theme='dark'] .match-timer.calm {
  color: var(--text);
}
.medal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.medal span {
  font-size: 64px;
  line-height: 1;
  animation: bob 1.4s ease-in-out infinite;
}
.medal b {
  font-family: var(--pixel);
  font-size: 18px;
  background: var(--yellow);
  color: #141414;
  border: 2px solid #141414;
  border-radius: 999px;
  padding: 4px 12px;
  box-shadow: 3px 3px 0 var(--shadow);
}

/* =================== v3: motion =================== */
@keyframes screenIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}
@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
}
@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.6) rotate(-4deg);
  }
  70% {
    opacity: 1;
    transform: scale(1.06) rotate(1deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}
@keyframes paperIn {
  from {
    opacity: 0.2;
    transform: translateX(46px) rotate(3deg);
  }
}
@keyframes land {
  0% {
    transform: translateY(-14px) scale(1.15);
  }
  60% {
    transform: translateY(2px) scale(0.96);
  }
  100% {
    transform: none;
  }
}
@keyframes flipIn {
  from {
    opacity: 0;
    transform: perspective(500px) rotateY(85deg);
  }
}
@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-24px);
  }
}
@keyframes growUp {
  from {
    transform: scaleY(0);
  }
}
@keyframes dropIn {
  0% {
    opacity: 0;
    transform: translateY(-60px);
  }
  70% {
    opacity: 1;
    transform: translateY(6px);
  }
  100% {
    transform: none;
  }
}
@keyframes growX {
  from {
    transform: scaleX(0);
  }
}
@keyframes wiggle {
  0%,
  100% {
    transform: rotate(-8deg);
  }
  50% {
    transform: rotate(6deg);
  }
}
@keyframes pulseLow {
  50% {
    opacity: 0.55;
  }
}

.screen {
  animation: screenIn 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.screen.draw {
  animation: none;
}
/* staggered entrance of a screen's sections — only right after the screen opens */
.screen.enter .wrap > *,
.screen.enter .sheet-body > * > * {
  animation: riseIn 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.screen.enter .wrap > *:nth-child(2) { animation-delay: 0.05s; }
.screen.enter .wrap > *:nth-child(3) { animation-delay: 0.1s; }
.screen.enter .wrap > *:nth-child(4) { animation-delay: 0.15s; }
.screen.enter .wrap > *:nth-child(5) { animation-delay: 0.2s; }
.screen.enter .wrap > *:nth-child(6) { animation-delay: 0.25s; }
.screen.enter .wrap > *:nth-child(n + 7) { animation-delay: 0.3s; }

.logo.big .logo-pencil {
  animation: wiggle 2.6s ease-in-out infinite;
}
.pchip.new {
  animation: popIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.pad-box.swap {
  animation: paperIn 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.tbar.low .tbar-fill {
  animation: pulseLow 0.5s ease-in-out infinite;
}
.tile.tile-in {
  animation: popIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 35ms);
}
.tray.enter .wchip {
  animation: riseIn 0.35s both;
  animation-delay: calc(var(--i, 0) * 30ms + 0.2s);
}
.wchip.placed.just {
  animation: land 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.res-tile {
  animation: flipIn 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 45ms + 0.3s);
}
.board li {
  animation: slideInLeft 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms + 0.15s);
}
.my-points {
  animation: popIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.podium .block {
  transform-origin: bottom;
  animation: growUp 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}
.podium .p3 .block { animation-delay: 1.5s; }
.podium .p2 .block { animation-delay: 1.9s; }
.podium .p1 .block { animation-delay: 2.3s; }
.podium .spot > :not(.block) {
  animation: dropIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.podium .p3 > :not(.block) { animation-delay: 1.9s; }
.podium .p2 > :not(.block) { animation-delay: 2.3s; }
.podium .p1 > :not(.block) { animation-delay: 2.75s; }
.xp-bar > div,
.meter-bar > div,
.b-prog > div {
  transform-origin: left;
  animation: growX 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) both 0.3s;
}
.stat-tile,
.badge {
  animation: popIn 0.4s both;
  animation-delay: calc(var(--i, 0) * 40ms + 0.1s);
}
.g-card {
  animation: popIn 0.35s both;
  animation-delay: calc(var(--i, 0) * 25ms);
}
.round-tag {
  animation: dropIn 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
.count-ring {
  animation: popIn 0.5s both 0.1s;
}
.medal {
  animation: popIn 0.5s both;
}
@media (hover: hover) {
  .btn:hover:not(:disabled) {
    transform: translate(-1px, -1px);
    box-shadow: calc(var(--sh) + 1px) calc(var(--sh) + 1px) 0 var(--shadow);
  }
  .tile:hover,
  .g-card:hover {
    transform: translateY(-2px);
  }
}

.icon-btn.off {
  opacity: 0.45;
  text-decoration: line-through;
}
@media (max-width: 380px) {
  .topbar-right {
    gap: 5px;
  }
  .topbar .icon-btn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .leave-btn {
    padding: 0 9px;
    font-size: 14px;
  }
}

.hint.nudge {
  color: #141414;
  background: var(--yellow);
  border: 2px solid #141414;
  border-radius: 10px;
  padding: 6px 10px;
  animation: popIn 0.4s both;
}

/* ===================== v4: public rooms, bots, reports, nudges ===================== */
.center-text { text-align: center; }
.row.gap-s { display: flex; gap: 6px; align-items: center; }
.wrap-row { flex-wrap: wrap; }
.btn-xs {
  padding: 4px 10px;
  font-size: 13px;
  min-height: 0;
  border-width: 2px;
  box-shadow: 2px 2px 0 var(--shadow);
}

/* open rooms on the home page */
.live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 60%, transparent);
  animation: livePulse 1.8s ease-out infinite;
}
@keyframes livePulse {
  to { box-shadow: 0 0 0 10px transparent; }
}
.rooms-list { display: flex; flex-direction: column; gap: 8px; }
.rooms-empty { text-align: center; padding: 6px 0; }
.rooms-empty p { margin: 4px 0; }
.room-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  background: var(--surface-2);
  animation: riseIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.room-meta { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.room-meta b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.av-stack { display: flex; }
.av-stack img.avatar {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: 2px solid var(--line);
  margin-left: -8px;
  background: var(--surface);
}
.av-stack img.avatar:first-child { margin-left: 0; }

/* public room switch */
.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 6px 0;
  position: relative;
  text-align: left;
}
.switch-row.readonly { cursor: default; opacity: 0.7; }
.switch-text { flex: 1; display: flex; flex-direction: column; }
.switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch {
  width: 48px;
  height: 28px;
  border: var(--bw) solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  position: relative;
  flex: none;
  transition: background 0.2s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--line);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.switch-input:checked + .switch { background: var(--green); }
.switch-input:checked + .switch::after { transform: translateX(20px); background: #fff; }
.switch-input:focus-visible + .switch { outline: 3px solid var(--blue); outline-offset: 2px; }

/* bots */
.bot-tag {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--pixel);
  font-size: 9px;
  line-height: 1;
  padding: 3px 4px 2px;
  border-radius: 5px;
  border: 1.5px solid var(--line);
  background: var(--blue);
  color: #fff;
  vertical-align: middle;
}
.quick-card .room-code b { font-size: 20px; }
.start-pill { font-weight: 700; }

/* reports */
.report-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 8px;
  line-height: 1;
}
.report-btn:hover { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
.report-btn.done { color: var(--red); cursor: default; }
.report-gap { width: 28px; flex: none; }
.report-sheet .btn { justify-content: flex-start; }

/* results nudges */
.nudges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 10px; }
.nudge {
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-2);
  animation: popIn 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 150ms + 1.6s);
}

/* podium: XP + play again */
.xp-card { display: flex; flex-direction: column; gap: 8px; animation: riseIn 0.5s 2.8s both; }
.xp-top { display: flex; justify-content: space-between; align-items: center; }
.xp-earned { font-family: var(--pixel); font-size: 22px; color: var(--purple); }
[data-theme='dark'] .xp-earned { color: var(--yellow); }
.xp-card .lvl-badge { grid-row: auto; }
.xp-fill { height: 100%; background: var(--yellow); transition: width 1.4s cubic-bezier(0.2, 0.8, 0.2, 1); }
.next-card { display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; animation: riseIn 0.5s 3s both; }
.next-card h2 { margin: 0; }
.ready-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
.ready-av img.avatar {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 2px solid var(--line);
  opacity: 0.35;
  filter: grayscale(1);
  transition: opacity 0.25s, filter 0.25s, transform 0.25s;
}
.ready-av.on img.avatar { opacity: 1; filter: none; transform: translateY(-2px); box-shadow: 0 3px 0 var(--green); }
@media (prefers-reduced-motion: reduce) {
  .live-dot, .room-row, .nudge, .xp-card, .next-card { animation: none; }
}
.has-tag { display: flex; align-items: center; justify-content: inherit; min-width: 0; }
.has-tag .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.spot-name.has-tag { justify-content: center; }
.bot-tag { flex: none; }
.room-card { flex-wrap: wrap; }
.room-card .switch-row { flex-basis: 100%; border-top: 2px dashed rgba(20, 20, 20, 0.25); padding-top: 10px; margin-top: 2px; }
.room-card .switch-row .muted { color: #5a4a2a; }
.room-card .switch { background: #fff; border-color: #141414; }
.room-card .switch::after { background: #141414; }
.room-card > .muted { flex-basis: 100%; margin: 0; color: #5a4a2a; }
.quick-card { flex-direction: column; align-items: stretch; }
.quick-card .room-code b { font-family: var(--font); font-size: 24px; letter-spacing: 0; }
.quick-card .row { flex-direction: row; }
.lang-pick { display: inline-flex; align-items: center; gap: 4px; }
.lang-pick select { font: inherit; font-weight: 600; background: none; border: 2px solid var(--line); border-radius: 10px; padding: 3px 6px; color: var(--text); }

/* draw your own avatar */
.avatar-draw { align-items: center; }
.avatar-timer { display: flex; align-items: center; gap: 10px; width: min(100%, 320px); }
.avatar-timer .tbar { flex: 1; }
.avatar-time { font-family: var(--pixel); min-width: 2ch; text-align: right; }
.avatar-pad-wrap { position: relative; width: min(100%, 320px); }
.avatar-pad-wrap .pad { width: 100%; aspect-ratio: 4 / 5; display: block; }
.avatar-frame {
  position: absolute; left: 0; right: 0; top: 10%; height: 80%;
  border-top: 2px dashed color-mix(in srgb, var(--line) 45%, transparent);
  border-bottom: 2px dashed color-mix(in srgb, var(--line) 45%, transparent);
  pointer-events: none;
}
.avatar-row .btn-blue.dice { margin-left: 6px; }

/* age question */
.age-ask { gap: 14px; text-align: center; }
.age-ask .big { font-size: 1.25rem; font-weight: 800; margin: 0; }
.age-ask .stack { gap: 10px; width: 100%; max-width: 320px; margin: 0 auto; }

/* ================= new look (v2): icons, avatars, editor, player card ================= */
.ic { display: inline-flex; align-items: center; justify-content: center; line-height: 0; flex: none; }
.ic svg { display: block; overflow: visible; }
.btn .ic { margin-right: 0; }
.icon-btn .ic { pointer-events: none; }
.icon-btn.off { opacity: 0.55; }
img.avatar { background: var(--surface-2); }

/* name screen: the avatar is the edit button */
.avatar-row { align-items: center; gap: 16px; }
.avatar-edit { position: relative; padding: 0; border: 0; background: none; }
.avatar-edit .avatar-big { width: 140px; height: 140px; border-radius: 24px; }
.avatar-edit-pen { position: absolute; right: -8px; bottom: -8px; width: 36px; height: 36px; border-radius: 50%; background: var(--yellow); border: var(--bw) solid var(--line); display: grid; place-items: center; color: #141414; box-shadow: 2px 2px 0 var(--shadow); }
.avatar-actions { display: flex; flex-direction: column; gap: 10px; }
.avatar-actions .btn { justify-content: flex-start; }

/* Edit look sheet */
.sheet-tall .sheet-inner { max-height: 92vh; }
.le { display: flex; flex-direction: column; gap: 12px; }
.le-preview { position: relative; height: 190px; border: 3px solid var(--line); border-radius: 20px; display: flex; justify-content: center; align-items: flex-end; overflow: hidden; background: var(--light); }
.le-preview img.le-big { position: relative; }
.le-preview img.le-big { width: 210px; height: 210px; background: transparent; margin-bottom: -12px; }
.le-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; }
.le-tabs::-webkit-scrollbar { display: none; }
.le-tab { flex: none; border: var(--bw) solid var(--line); background: var(--surface); color: var(--text); border-radius: 999px; padding: 7px 13px; font: 700 14px var(--font); }
.le-tab.on { background: var(--text); color: var(--bg); }
.le-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; max-height: 34vh; overflow-y: auto; padding: 4px; }
.le-opt { padding: 0; border: var(--bw) solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface-2); aspect-ratio: 1; }
.le-opt img.avatar { width: 100%; height: 100%; }
.le-opt.on { outline: 3px solid var(--yellow); outline-offset: 2px; }
.le-none { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); }
.le-colors { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; padding: 8px; }
.le-color { width: 46px; height: 46px; border-radius: 50%; border: 3px solid var(--line); }
.le-color.on { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--line); }
.le-foot { display: flex; gap: 10px; }
.le-foot .btn { flex: 1; justify-content: center; }
.le-draw { align-self: center; }

/* ---------- player card (profile) ---------- */
.profile-page { display: flex; flex-direction: column; gap: 18px; }
.pc-wrap { filter: drop-shadow(0 8px 12px rgba(40, 25, 10, 0.18)) drop-shadow(0 1px 1px rgba(40, 25, 10, 0.25)); max-width: 380px; width: 100%; margin: 4px auto 0; }
/* postage-stamp edge: top/bottom holes on the outer layer, side holes on the inner one */
.pc {
  --hole: 6px;
  --step: 17px;
  -webkit-mask: radial-gradient(circle at 50% 0, #0000 var(--hole), #000 calc(var(--hole) + 0.5px)) 0 0 / var(--step) 51% repeat-x, radial-gradient(circle at 50% 100%, #0000 var(--hole), #000 calc(var(--hole) + 0.5px)) 0 100% / var(--step) 51% repeat-x;
  mask: radial-gradient(circle at 50% 0, #0000 var(--hole), #000 calc(var(--hole) + 0.5px)) 0 0 / var(--step) 51% repeat-x, radial-gradient(circle at 50% 100%, #0000 var(--hole), #000 calc(var(--hole) + 0.5px)) 0 100% / var(--step) 51% repeat-x;
}
.pc-paper {
  background: #fffbf3;
  padding: 15px;
  -webkit-mask: radial-gradient(circle at 0 50%, #0000 var(--hole), #000 calc(var(--hole) + 0.5px)) 0 0 / 51% var(--step) repeat-y, radial-gradient(circle at 100% 50%, #0000 var(--hole), #000 calc(var(--hole) + 0.5px)) 100% 0 / 51% var(--step) repeat-y;
  mask: radial-gradient(circle at 0 50%, #0000 var(--hole), #000 calc(var(--hole) + 0.5px)) 0 0 / 51% var(--step) repeat-y, radial-gradient(circle at 100% 50%, #0000 var(--hole), #000 calc(var(--hole) + 0.5px)) 100% 0 / 51% var(--step) repeat-y;
}
.pc-in { background: var(--mid); border: 3px solid #231a15; border-radius: 6px; padding: 12px 12px 9px; color: #231a15; display: flex; flex-direction: column; gap: 10px; }
.pc-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; }
.pc-name { font: 700 40px/0.88 var(--pixel); letter-spacing: -0.03em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-no { font: 700 11px var(--font); text-align: right; line-height: 1; flex: none; }
.pc-no b { display: block; font: 700 21px var(--pixel); }
.pc-art { position: relative; height: 220px; background: var(--light); border: 3px solid #231a15; border-radius: 4px; overflow: hidden; }
.pc-rays { position: absolute; inset: -60%; background: repeating-conic-gradient(var(--mid) 0 9deg, transparent 9deg 18deg); opacity: 0.45; }
.pc-art img.pc-avatar { position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%); width: 250px; height: 250px; background: transparent; }
.pc-sticker { position: absolute; left: 10px; top: 10px; width: 54px; height: 54px; border-radius: 50%; background: #ffc93c; border: 3px solid #231a15; display: flex; flex-direction: column; align-items: center; justify-content: center; transform: rotate(-12deg); font: 700 12px var(--pixel); box-shadow: 2px 2px 0 #231a15; }
.pc-edit { position: absolute; right: 8px; top: 8px; width: 38px; height: 38px; border-radius: 12px; border: 2.5px solid #231a15; background: #fffbf3; color: #231a15; display: grid; place-items: center; }
.pc-title { background: #fffbf3; border: 3px solid #231a15; border-radius: 3px; text-align: center; font: 700 16px var(--pixel); padding: 5px 8px; }
.pc-stats { display: grid; grid-template-columns: 1fr 1fr; column-gap: 16px; row-gap: 2px; padding: 0 3px; }
.pc-stat { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.pc-stat span { font: 700 11.5px var(--font); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.pc-stat i { flex: 1; border-bottom: 2.5px dotted rgba(35, 26, 21, 0.45); transform: translateY(-3px); min-width: 8px; }
.pc-stat b { font: 700 22px/1.15 var(--pixel); display: flex; align-items: center; gap: 2px; }
.pc-badges { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; min-height: 46px; align-items: center; }
.pc-badges::-webkit-scrollbar { display: none; }
.pc-badge { flex: none; width: 40px; height: 40px; border-radius: 50%; background: #fffbf3; border: 2.5px solid #231a15; display: grid; place-items: center; box-shadow: 2px 2px 0 #231a15; padding: 0; }
.pc-empty { font: 400 13px var(--font); opacity: 0.75; padding-left: 2px; }
.pc-foot { display: flex; justify-content: space-between; font: 700 9.5px var(--font); letter-spacing: 0.16em; border-top: 2.5px solid #231a15; padding-top: 6px; }
.card-actions { display: flex; flex-direction: column; gap: 10px; max-width: 380px; width: 100%; margin: 0 auto; }
.card-actions .row .btn { flex: 1; justify-content: center; }
.badge .b-icon { display: grid; place-items: center; height: 36px; }
.badge:not(.got) .b-icon { color: var(--muted); }

/* podium: each player in their own colour */
.spot-frame { border: var(--bw) solid var(--line); border-radius: 18px; background: var(--mid, var(--surface-2)); padding: 4px; box-shadow: 3px 3px 0 var(--shadow); }
.spot-frame img.avatar { border-radius: 13px; }
.crown-big .ic { filter: drop-shadow(2px 2px 0 var(--shadow)); }
.medal .ic { margin-bottom: 4px; }
.big-emoji .ic { margin: 0 auto; }
.pts-split span b { margin-left: 5px; }

/* plain wordmark (no illustration) until the real logo exists */
.logo-pencil { display: none !important; }
.logo-text { flex-direction: row; letter-spacing: -0.02em; }
.logo.big .logo-text { font-size: clamp(48px, 15vw, 68px); letter-spacing: -0.03em; color: var(--text); }

/* Quick Play while public play is switched off */
.btn.soon { background: var(--surface-2); color: var(--muted); box-shadow: 2px 2px 0 var(--shadow); display: flex; align-items: center; justify-content: center; gap: 10px; }
.soon-pill { font: 700 11px var(--font); letter-spacing: 0.08em; text-transform: uppercase; background: var(--text); color: var(--bg); border-radius: 999px; padding: 4px 9px; }

/* quick questions after the podium */
.survey { display: flex; flex-direction: column; gap: 12px; padding: 4px 2px 6px; }
.sv-q { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; }
.sv-scale { display: grid; grid-template-columns: repeat(11, 1fr); gap: 4px; }
.sv-n { font: inherit; font-weight: 700; padding: 10px 0; border: var(--bw) solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer; }
.sv-n.on, .sv-opt.on { background: var(--yellow); color: var(--on-accent); }
.sv-ends { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: -6px; }
.sv-opts { display: flex; flex-direction: column; gap: 8px; }
.sv-opt { font: inherit; font-weight: 600; text-align: left; padding: 12px 14px; border: var(--bw) solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; }
.sv-text { font: inherit; width: 100%; box-sizing: border-box; padding: 10px 12px; border: var(--bw) solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); resize: none; }
.sv-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sv-actions .btn[disabled] { opacity: .45; }
@media (max-width: 380px) { .sv-n { padding: 9px 0; font-size: 13px; } }

/* ---------- Visuals from the Control panel ---------- */
.ic-mask { background-color: currentColor; -webkit-mask: var(--u) center / contain no-repeat; mask: var(--u) center / contain no-repeat; }
.ic img { display: block; width: 100%; height: 100%; }

/* wordmark (until a logo is uploaded): two lines on the big one */
.logo.big .logo-text { flex-direction: column; align-items: center; line-height: 0.95; font-size: clamp(46px, 15vw, 66px); }
.logo.big .logo-text b:last-child { color: var(--red); -webkit-text-stroke: 0; text-shadow: none; }
.logo.small .logo-text { flex-direction: row; gap: 6px; font-size: 17px; }
.logo-anim { display: grid; justify-items: center; }
.logo-anim img { grid-area: 1 / 1; display: block; visibility: hidden; max-width: 100%; user-select: none; -webkit-user-drag: none; }
.logo-anim img.on { visibility: visible; }
.logo-anim.big { width: min(100%, 360px); margin: 0 auto; }
.logo-anim.big img { width: 100%; height: auto; }
.logo-anim.small img { height: 34px; width: auto; }
@keyframes logo-bounce { from { transform: translateY(0); } to { transform: translateY(calc(var(--logo-amp, 6) * -1px)); } }
@keyframes logo-wobble { from { transform: rotate(calc(var(--logo-amp, 6) * -0.5deg)); } to { transform: rotate(calc(var(--logo-amp, 6) * 0.5deg)); } }
@keyframes logo-tilt { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(calc(var(--logo-amp, 6) * 0.6deg)); } }
@keyframes logo-pulse { from { transform: scale(1); } to { transform: scale(calc(1 + var(--logo-amp, 6) / 100)); } }
@keyframes logo-float { 0% { transform: translate(0, 0); } 33% { transform: translate(calc(var(--logo-amp, 6) * 0.6px), calc(var(--logo-amp, 6) * -0.8px)); } 66% { transform: translate(calc(var(--logo-amp, 6) * -0.6px), calc(var(--logo-amp, 6) * -0.3px)); } 100% { transform: translate(0, 0); } }
.logo-anim.fx-bounce { animation: logo-bounce var(--logo-speed, 1.4s) ease-in-out infinite alternate; }
.logo-anim.fx-wobble { animation: logo-wobble var(--logo-speed, 1.4s) ease-in-out infinite alternate; }
.logo-anim.fx-tilt { animation: logo-tilt calc(var(--logo-speed, 1.4s) * 2) ease-in-out infinite; }
.logo-anim.fx-pulse { animation: logo-pulse var(--logo-speed, 1.4s) ease-in-out infinite alternate; }
.logo-anim.fx-float { animation: logo-float calc(var(--logo-speed, 1.4s) * 3) ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .logo-anim { animation: none !important; } }

/* lean home screen: one card with avatar picker, name, create */
.hp { gap: 12px; }
.hp-stage { position: relative; display: grid; grid-template-columns: 1fr; justify-items: center; align-items: flex-end; gap: 6px; padding: 0; height: 250px; border: var(--bw) solid var(--line); border-radius: 18px; background: var(--light, var(--surface-2)); overflow: hidden; }
.hp-stage .pc-rays { position: absolute; inset: 0; }
.hp-av { position: relative; display: flex; justify-content: center; align-self: end; }
.hp-av img { width: 242px; height: 242px; display: block; background: transparent; margin-bottom: -2px; }
.hp-av.pop { animation: pop 0.3s ease; }
.hp-arrows { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.hp-arrow { width: 44px; height: 44px; border: var(--bw) solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 2px 2px 0 var(--shadow); display: flex; align-items: center; justify-content: center; padding: 0; }
.hp-arrow.right .ic { transform: scaleX(-1); }
.hp-arrow:active { transform: translate(2px, 2px); box-shadow: none; }
.hp-dice, .hp-edit { position: absolute; top: 8px; width: 40px; height: 40px; border: var(--bw) solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 2px 2px 0 var(--shadow); display: flex; align-items: center; justify-content: center; padding: 0; }
.hp-dice { right: 8px; }
.hp-edit { left: 8px; }
.hp .name-input { width: 100%; }

/* how-to-play slideshow */
.slides { display: flex; flex-direction: column; gap: 10px; align-items: center; padding: 4px 0 10px; }
.slides-track { display: flex; width: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 16px; }
.slides-track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; gap: 8px; }
.slide-img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border: var(--bw) solid var(--line); border-radius: 16px; background: var(--surface-2); display: block; }
.slide-cap { margin: 0; text-align: center; font-weight: 600; }
.slide-card { aspect-ratio: 4 / 3; border: var(--bw) solid var(--line); border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 18px; text-align: center; box-shadow: 3px 3px 0 var(--shadow); }
.slide-card b { font-size: 26px; }
.slide-card p { margin: 0; font-size: 16px; }
.slide-card.pink { background: var(--pink); }
.slide-card.blue { background: var(--sky, #8fd0f6); }
.slide-card.green { background: #8fe0b5; }
.slide-dots { display: flex; gap: 8px; }
.slide-dot { width: 10px; height: 10px; padding: 0; border-radius: 50%; border: 2px solid var(--line); background: transparent; }
.slide-dot.on { background: var(--line); }

/* Words setting: English | local | More (drop-down list of the other word sets and languages) */
.seg button.more-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seg button .caret {
  font-size: 11px;
  opacity: 0.8;
}
.pack-block .more-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 2px 0 10px;
  padding: 10px;
  border: var(--bw) solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  animation: morein 0.14s ease-out;
}
@keyframes morein {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}
.pack-block .more-list .chip {
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: inherit;
  padding: 6px 12px;
  font-weight: 700;
  font-size: 14px;
}
.pack-block .more-list .chip.on {
  background: var(--purple);
  color: #fff;
  border-color: var(--purple);
}

/* Voice chat */
.mic-btn.live {
  background: var(--green, #2ec27e);
  color: #fff;
}
.mic-btn.muted {
  opacity: 0.85;
}
.mic-btn.talking {
  box-shadow: 0 0 0 4px rgba(46, 194, 126, 0.45);
}
.mic-x {
  width: 28px;
  min-width: 28px;
  padding: 0;
  opacity: 0.8;
}
.pchip.speaking {
  box-shadow: 0 0 0 3px rgba(46, 194, 126, 0.65);
  transition: box-shadow 0.12s;
}
.vbadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--surface);
  color: inherit;
  padding: 0;
}
.vbadge.off,
.vbadge.deaf {
  opacity: 0.55;
}
button.vbadge {
  cursor: pointer;
}
.sv-thanks {
  text-align: center;
  padding: 18px 6px;
  font-size: 20px;
}

/* player options, bans and votes to remove someone */
.more-btn {
  background: none;
  border: none;
  color: var(--muted);
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 8px;
  line-height: 1;
}
.more-btn:hover { background: color-mix(in srgb, var(--text) 10%, transparent); color: var(--text); }
.ban-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; font-weight: 700; }
.report-sheet .btn.danger { color: var(--red); }
.votebar {
  position: fixed;
  left: 10px;
  right: 10px;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  z-index: 60;
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  border: var(--bw) solid var(--line);
  border-radius: var(--r);
  box-shadow: 0 var(--sh) 0 var(--shadow);
}
.votebar .vb-text { display: flex; flex-direction: column; min-width: 0; }
.votebar small { color: var(--muted); }
.votebar .vb-btns { display: flex; gap: 6px; flex: none; }
