/* ============ Sketchy — cartoonish atelier theme ============ */

:root {
  --accent: #e0455e;
  --ink: #33221a;
  --paper: #fffdf6;
  --wood-1: #9c6b3f;
  --wood-2: #85552d;
  --shadow: rgba(51, 34, 26, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  font-family: 'Nunito', system-ui, sans-serif;
  font-weight: 600;
  color: var(--ink);
  /* warm wooden atelier */
  background:
    repeating-linear-gradient(90deg,
      rgba(0,0,0,0.06) 0px, rgba(0,0,0,0.06) 3px,
      transparent 3px, transparent 90px),
    repeating-linear-gradient(0deg,
      rgba(255,255,255,0.03) 0px, rgba(255,255,255,0.03) 1px,
      transparent 1px, transparent 14px),
    linear-gradient(160deg, var(--wood-1), var(--wood-2) 70%);
  min-height: 100dvh;
}

.hidden { display: none !important; }

/* ---------- screens ---------- */
.screen {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#screen-game {
  padding: 0;
  justify-content: flex-start;
  /* Unlike the other screens, this one must never scroll: Discord's Activity
     panel can be much shorter than a phone browser, so cap it to the actual
     viewport and let canvas-wrap (flex:1, min-height:0) shrink to fit. */
  height: 100dvh;
  overflow: hidden;
}

/* ---------- paper cards ---------- */
.paper {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 26px 22px 28px 20px / 22px 28px 20px 26px; /* wobbly */
  box-shadow: 0 8px 0 var(--shadow), 0 14px 28px rgba(0,0,0,0.25);
}

.card {
  width: 100%;
  max-width: 460px;
  padding: 26px 22px;
  transform: rotate(-0.6deg);
}

.home-card { text-align: center; }

/* ---------- typography ---------- */
.title {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: clamp(3rem, 11vw, 4.2rem);
  line-height: 0.95;
  transform: rotate(-2deg);
}
.title-accent { color: var(--accent); }

.tagline {
  font-family: 'Caveat', cursive;
  font-size: 1.4rem;
  color: #7a6555;
  margin: 6px 0 4px;
}

.subtitle {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 2.2rem;
  text-align: center;
  transform: rotate(-1.2deg);
}

/* ---------- inputs & buttons ---------- */
.field-label {
  display: block;
  text-align: left;
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7a6555;
  margin: 14px 0 6px;
}
.hint { text-transform: none; letter-spacing: 0; font-weight: 600; }

input[type="text"], select {
  width: 100%;
  font-family: inherit;
  font-weight: 700;
  font-size: 1.15rem;
  padding: 13px 16px;
  border: 3px solid var(--ink);
  border-radius: 16px 14px 17px 13px / 14px 17px 13px 16px;
  background: #fff;
  color: var(--ink);
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }

#inp-code {
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-family: 'Caveat', cursive;
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
}

.btn {
  font-family: inherit;
  font-weight: 900;
  font-size: 1.05rem;
  color: #fff;
  background: var(--accent);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 13px 22px;
  cursor: pointer;
  box-shadow: 0 5px 0 var(--ink);
  transition: transform 0.08s, box-shadow 0.08s, background 0.2s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-big {
  width: 100%;
  font-size: 1.25rem;
  padding: 16px 24px;
  margin-top: 16px;
}

.join-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.join-row input { flex: 1; }
.join-row .btn { flex-shrink: 0; }

.error-msg {
  color: #c22f47;
  font-weight: 800;
  min-height: 1.4em;
  margin-top: 10px;
  text-align: center;
}

/* ---------- lobby ---------- */
#screen-lobby {
  justify-content: center;
  padding: clamp(10px, 2vw, 22px);
}
.lobby-card {
  position: relative;
  max-width: 1180px;
  min-height: 0;
  margin: auto;
  padding: clamp(16px, 2.2vw, 28px);
  transform: none;
  overflow: hidden;
}
.lobby-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 2px dashed rgba(51, 34, 26, 0.2);
}
.lobby-heading,
.lobby-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.lobby-heading { text-align: center; }
.lobby-right-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 9px;
}
.lobby-setting-summary {
  display: flex;
  align-items: center;
  gap: 6px;
}
.setup-summary-chip {
  padding: 7px 9px;
  border: 2px solid rgba(51,34,26,0.22);
  border-radius: 999px;
  background: #f4ecdd;
  color: #7a6555;
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}
.setup-summary-chip b {
  color: var(--ink);
  font-size: 0.9rem;
}
.lobby-heading h2,
.drawer-header h2 {
  font-family: 'Caveat', cursive;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  line-height: 0.9;
}
.lobby-kicker {
  color: #9b7359;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.lobby-settings-btn {
  min-height: 44px;
  padding: 9px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #f4ecdd;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
}
.lobby-settings-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }

.room-code {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  padding: 6px 13px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  -webkit-tap-highlight-color: transparent;
}
.room-code::before {
  content: 'CODE';
  margin-right: 6px;
  color: #9b7359;
  font: 900 0.58rem 'Nunito', sans-serif;
  letter-spacing: 0.08em;
}
.room-code:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.room-code span {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 1.45rem;
  line-height: 1;
  color: var(--accent);
  text-shadow: 1px 1px 0 rgba(51,34,26,0.12);
}
.room-code span:nth-child(1) { transform: rotate(-6deg); }
.room-code span:nth-child(2) { transform: rotate(4deg) translateY(3px); }
.room-code span:nth-child(3) { transform: rotate(-3deg); }
.room-code span:nth-child(4) { transform: rotate(6deg) translateY(2px); }

.lobby-players {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(8px, 1.5vw, 18px);
  padding: clamp(14px, 2vw, 24px) 0;
}
.lobby-player {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  min-height: clamp(125px, 18vh, 185px);
  padding: 10px 6px 12px;
  border: 2px solid rgba(51,34,26,0.12);
  border-radius: 22px 18px 25px 19px;
  background:
    radial-gradient(circle at 50% 58%, color-mix(in srgb, var(--accent) 15%, transparent) 0 34%, transparent 35%),
    linear-gradient(180deg, rgba(255,255,255,0.65), rgba(244,236,221,0.7));
}
.lobby-player .avatar-svg {
  width: clamp(85px, 12vw, 135px);
  height: clamp(85px, 12vw, 135px);
  max-height: 12vh;
}
.lobby-player .p-name {
  max-width: 95%;
  font-size: clamp(0.82rem, 1.5vw, 1.05rem);
  font-weight: 900;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lobby-player .p-host {
  min-height: 1em;
  font-size: 0.62rem;
  color: #b58a2a;
  font-weight: 900;
  letter-spacing: 0.06em;
}
.lobby-player.empty-slot {
  border: 2px dashed rgba(51,34,26,0.25);
  background: rgba(51,34,26,0.025);
  justify-content: center;
  color: rgba(51,34,26,0.3);
  font-size: 2rem;
}
.lobby-footer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.55fr);
  align-items: end;
  gap: 22px;
  padding-top: 12px;
  border-top: 2px dashed rgba(51,34,26,0.2);
}
.lobby-color-control .field-label { margin-top: 0; }
.lobby-primary-action .btn-big { margin-top: 0; }
.lobby-primary-action .waiting-note { margin: 0; padding: 15px; }

/* ---------- color picker ---------- */
.color-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0 0 4px;
}
.color-swatch {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  border: 3px solid var(--ink);
  background: var(--sw);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
  position: relative;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: transform 0.1s;
}
.color-swatch:active:not(:disabled) { transform: translateY(2px); box-shadow: none; }
.color-swatch.selected {
  transform: scale(1.15);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--sw);
}
.color-swatch.taken {
  cursor: not-allowed;
  opacity: 0.3;
  box-shadow: none;
}
.color-swatch.taken::after {
  content: '✕';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 900;
  font-size: 0.85rem;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* ---------- settings row (rounds + imposters side by side) ---------- */
.settings-row {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}
.settings-col { flex: 1; min-width: 0; }
.settings-col .field-label { margin-top: 0; }

.cat-chip:disabled,
.cat-chip.readonly {
  cursor: default;
}
select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.category-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cat-chip {
  font-family: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 8px 13px;
  border: 2.5px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  opacity: 0.55;
  transition: background 0.12s, opacity 0.12s, box-shadow 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.cat-chip.on {
  background: var(--accent);
  color: #fff;
  opacity: 1;
  box-shadow: 0 3px 0 var(--ink);
}

/* ---------- lobby settings drawer ---------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 54;
  border: 0;
  background: rgba(28, 16, 10, 0.48);
  backdrop-filter: blur(2px);
}
.lobby-settings-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 55;
  width: min(410px, 92vw);
  padding: max(22px, env(safe-area-inset-top)) 24px max(24px, env(safe-area-inset-bottom));
  overflow-y: auto;
  background:
    linear-gradient(rgba(255,253,246,0.96), rgba(244,236,221,0.98)),
    var(--paper);
  border-left: 3px solid var(--ink);
  box-shadow: -12px 0 35px rgba(31, 18, 10, 0.3);
  transform: translateX(calc(100% + 16px));
  transition: transform 220ms cubic-bezier(.2,.8,.2,1);
}
.lobby-settings-drawer.open { transform: translateX(0); }
.drawer-handle {
  width: 48px;
  height: 5px;
  margin: -10px auto 16px;
  border-radius: 99px;
  background: rgba(51,34,26,0.2);
}
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px dashed rgba(51,34,26,0.22);
}
.drawer-close {
  width: 44px;
  height: 44px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font: 900 1.8rem/1 'Nunito', sans-serif;
  cursor: pointer;
  box-shadow: 0 3px 0 var(--ink);
}
.drawer-note {
  margin-top: 22px;
  padding: 12px 14px;
  border: 2px dashed rgba(51,34,26,0.22);
  border-radius: 14px;
  color: #7a6555;
  font-size: 0.82rem;
  font-weight: 800;
  text-align: center;
}

.waiting-note {
  text-align: center;
  margin-top: 16px;
  font-weight: 800;
  color: #7a6555;
}
.dots::after {
  content: '';
  animation: dots 1.4s steps(4) infinite;
}
@keyframes dots {
  0% { content: ''; } 25% { content: '.'; }
  50% { content: '..'; } 75% { content: '...'; }
}

/* ---------- game screen ---------- */
.turn-banner {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--accent);
  border-bottom: 3px solid var(--ink);
  color: #fff;
  transition: background 0.4s;
}
.turn-avatar { width: 52px; height: 52px; flex-shrink: 0; }
.turn-avatar .avatar-svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 0 rgba(0,0,0,0.25)); }
.turn-text { flex: 1; min-width: 0; }
.turn-name {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 1px 2px 0 rgba(0,0,0,0.2);
}
.turn-round { font-size: 0.8rem; font-weight: 800; opacity: 0.9; }

.quit-btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.94);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 3px 0 var(--ink);
  font-size: 1.05rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.quit-btn:active { transform: translateY(2px); box-shadow: none; }

.quit-btn-floating {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 5;
}

.turn-timer {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.94);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 3px 0 var(--ink);
  font-weight: 900;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}
.turn-timer.low {
  background: #c22f47;
  color: #fff;
  animation: timer-pulse 0.5s ease-in-out infinite alternate;
}
@keyframes timer-pulse {
  from { transform: scale(1); }
  to   { transform: scale(1.12); }
}

.my-word-chip {
  font-family: inherit;
  background: rgba(255,255,255,0.94);
  color: var(--ink);
  border: 2.5px solid var(--ink);
  border-radius: 14px;
  padding: 5px 14px;
  box-shadow: 0 3px 0 var(--ink);
  flex-shrink: 0;
  max-width: 42%;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.my-word-chip:active { transform: translateY(2px); box-shadow: none; }
.mwc-label {
  display: block;
  font-size: 0.55rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7a6555;
}
.mwc-word {
  display: block;
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 1.45rem;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- player strip ---------- */
.player-strip {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px 0;
}
.strip-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 58px;
  opacity: 0.55;
  transition: opacity 0.25s, transform 0.25s;
}
.strip-player .avatar-svg {
  width: 38px;
  height: 38px;
  filter: drop-shadow(0 2px 0 rgba(0,0,0,0.25));
}
.strip-player .sp-name {
  font-size: 0.6rem;
  font-weight: 800;
  color: #f7ecd9;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.strip-player .sp-brush {
  font-size: 0.75rem;
  min-height: 1.1em;
  line-height: 1.1;
}
.strip-player.drawing {
  opacity: 1;
  transform: scale(1.18);
}
.strip-player.drawing .sp-brush { animation: bounce-brush 0.7s ease-in-out infinite alternate; }
.strip-player.offline { opacity: 0.2; filter: grayscale(1); }

.canvas-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  min-height: 0;
}
#canvas {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 6px 0 var(--shadow), 0 12px 24px rgba(0,0,0,0.25);
  touch-action: none;
  display: block;
}
#canvas.my-turn { border-color: var(--accent); }

.game-footer {
  width: 100%;
  padding: 10px 14px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.btn-done { max-width: 420px; margin-top: 0; flex: 1; min-width: 200px; }

/* ---------- drawing toolbar ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 4px 0 var(--shadow);
}
.tool {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  background: #fff;
  font-size: 1.15rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 0 var(--ink);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.tool:active { transform: translateY(2px); box-shadow: none; }
.tool.active { background: var(--accent); box-shadow: none; transform: translateY(1px); }
.tool-sep {
  width: 2px;
  height: 26px;
  background: rgba(51, 34, 26, 0.2);
  border-radius: 1px;
}
.size-dot { display: block; border-radius: 50%; background: var(--ink); }
.size-dot.s1 { width: 6px; height: 6px; }
.size-dot.s2 { width: 11px; height: 11px; }
.size-dot.s3 { width: 17px; height: 17px; }
.tool.active .size-dot { background: #fff; }
.wait-turn {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #f7ecd9;
  font-weight: 800;
  font-size: 1.05rem;
  text-shadow: 0 2px 3px rgba(0,0,0,0.3);
}

/* ---------- brush loader ---------- */
.brush-loader {
  width: 46px;
  height: 46px;
  margin: 6px auto;
  background-repeat: no-repeat;
  background-size: contain;
  animation: bounce-brush 0.7s ease-in-out infinite alternate;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50"><g transform="rotate(40 25 25)"><rect x="22" y="16" width="6" height="26" rx="3" fill="%23b98a54" stroke="%2333221a" stroke-width="2.5"/><path d="M21 14 Q25 4 29 14 L29 19 L21 19 Z" fill="%23e0455e" stroke="%2333221a" stroke-width="2.5" stroke-linejoin="round"/></g></svg>');
}
.brush-loader.small { width: 30px; height: 30px; margin: 0; }
@keyframes bounce-brush {
  from { transform: translateY(0) rotate(-6deg); }
  to   { transform: translateY(-10px) rotate(8deg); }
}

/* ---------- voting ---------- */
.vote-card-panel { max-width: 640px; }
.vote-hint {
  text-align: center;
  color: #7a6555;
  margin: 4px 0 12px;
  font-size: 0.95rem;
}
.vote-canvas-wrap { width: 100%; }
#vote-canvas {
  display: block;
  width: 100%;
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 14px;
  box-shadow: 0 4px 0 var(--shadow);
}
.vote-timer {
  text-align: center;
  font-weight: 900;
  color: #7a6555;
  margin: 10px 0 12px;
  font-variant-numeric: tabular-nums;
}
.vote-timer.low { color: #c22f47; animation: timer-pulse 0.5s ease-in-out infinite alternate; }
.vote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.vote-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 18px 15px 19px 14px / 15px 19px 14px 18px;
  box-shadow: 0 4px 0 var(--shadow);
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  color: var(--ink);
  transition: transform 0.1s;
}
.vote-option:active { transform: scale(0.94); }
.vote-option .avatar-svg { width: 64px; height: 64px; }
.vote-option.selected {
  background: var(--ink);
  color: #fff;
  transform: rotate(-2deg) scale(1.03);
}
.vote-option:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.vote-option .v-count {
  font-size: 0.7rem;
  color: #b58a2a;
  min-height: 1em;
}

/* ---------- results ---------- */
.results-card {
  max-width: 980px;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(340px, 1.1fr);
  gap: 0 28px;
  text-align: center;
  overflow: hidden;
  position: relative;
  transform: none;
}
#results-content { display: contents; }
.results-reveal {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 0;
  padding: 12px 26px 12px 6px;
  border-right: 2px dashed rgba(51,34,26,0.22);
}
.results-votes {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  text-align: left;
  padding: 8px 4px 4px 0;
}
.results-votes h3 {
  font-family: 'Caveat', cursive;
  font-size: 2rem;
  line-height: 1;
  margin: 2px 0 16px;
}
.results-eyebrow {
  color: #9b7359;
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.results-card > #btn-restart,
.results-card > #results-wait {
  grid-column: 2;
  grid-row: 2;
  align-self: end;
}
.results-card > #btn-restart { margin-top: 18px; }
.results-card > #results-wait {
  margin: 18px 0 0;
  padding: 15px;
}
.no-votes {
  padding: 20px;
  border: 2px dashed rgba(51,34,26,0.22);
  border-radius: 16px;
  color: #7a6555;
  font-weight: 800;
  text-align: center;
}

.spotlight {
  position: relative;
  width: 170px;
  height: 170px;
  margin: 10px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.spotlight.multi { width: auto; max-width: 100%; gap: 6px; }
.spotlight.multi .avatar-svg { width: 100px; height: 100px; }
.spotlight::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,230,150,0.95) 0%, rgba(255,230,150,0.35) 55%, transparent 72%);
  animation: spot-pulse 1.6s ease-in-out infinite alternate;
}
@keyframes spot-pulse {
  from { transform: scale(0.92); opacity: 0.85; }
  to   { transform: scale(1.06); opacity: 1; }
}
.spotlight .avatar-svg {
  width: 130px;
  height: 130px;
  position: relative;
  animation: reveal-pop 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes reveal-pop {
  from { transform: scale(0) rotate(-30deg); }
  to   { transform: scale(1) rotate(0); }
}

.verdict {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 2.6rem;
  line-height: 1.15;
  transform: rotate(-1.5deg);
}
.verdict.win { color: #2fa864; }
.verdict.lose { color: #c22f47; }

.reveal-name { font-size: 1.15rem; font-weight: 900; margin-top: 6px; }

.words-reveal {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 16px 0;
  flex-wrap: wrap;
}
.word-chip {
  padding: 10px 16px;
  border-radius: 14px;
  border: 3px solid var(--ink);
  background: #f4ecdd;
  font-weight: 800;
}
.word-chip .wc-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #7a6555;
}
.word-chip .wc-word { font-family: 'Caveat', cursive; font-size: 1.6rem; font-weight: 700; line-height: 1; }
.word-chip.imposter-chip { background: #fbe3e7; }

.vote-breakdown {
  font-size: 0.9rem;
  color: #7a6555;
  margin-bottom: 6px;
}
.vote-breakdown b { color: var(--ink); }

.imposter-badge {
  display: inline-block;
  background: #c22f47;
  color: #fff;
  font-weight: 900;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  padding: 5px 14px;
  border-radius: 999px;
  border: 2.5px solid var(--ink);
  box-shadow: 0 3px 0 var(--ink);
  transform: rotate(-3deg);
  margin: -8px 0 6px;
}

/* ---------- who-voted-whom map ---------- */
.vote-map-label {
  font-size: 0.7rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #7a6555;
  margin: 14px 0 6px;
}
.vote-map {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 4px;
}
.vote-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 2.5px solid rgba(51, 34, 26, 0.22);
  border-radius: 14px;
  background: rgba(51, 34, 26, 0.04);
  font-weight: 800;
  font-size: 0.88rem;
}
.vote-row.hit {
  border-color: #2fa864;
  background: #e7f6ec;
}
.vote-row .avatar-svg { width: 30px; height: 30px; flex-shrink: 0; }
.vr-side {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
.vr-voter { justify-content: flex-end; text-align: right; }
.vr-target { justify-content: flex-start; text-align: left; }
.vr-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vr-arrow {
  flex-shrink: 0;
  font-size: 0.95rem;
  opacity: 0.75;
}
.vr-verdict { flex-shrink: 0; font-size: 0.9rem; }

@media (max-width: 720px) {
  #screen-results { justify-content: flex-start; overflow-y: auto; }
  .results-card {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .results-reveal {
    grid-column: 1;
    grid-row: auto;
    padding: 4px 0 20px;
    border-right: 0;
    border-bottom: 2px dashed rgba(51,34,26,0.22);
  }
  .results-votes {
    grid-column: 1;
    grid-row: auto;
    padding: 0;
  }
  .results-card > #btn-restart,
  .results-card > #results-wait {
    grid-column: 1;
    grid-row: auto;
  }
}

/* ---------- word modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(30, 18, 10, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 60;
}
.word-modal-card { max-width: 380px; text-align: center; transform: rotate(1deg); }
.info-modal-card h2 { margin-top: 0; }
.info-modal-card p { margin: 10px 0; font-weight: 700; }
.info-modal-card .info-warning {
  color: #b8324b;
  font-weight: 900;
  transform: rotate(-1deg);
}
.your-word-label {
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #7a6555;
}
.your-word {
  font-family: 'Caveat', cursive;
  font-weight: 700;
  font-size: 3.4rem;
  line-height: 1.05;
  color: var(--accent);
  transform: rotate(-2deg);
  margin: 6px 0;
  word-break: break-word;
}
.mister-white-note {
  font-size: 1.05rem;
  margin-top: 8px;
}

/* ---------- paint splat transition ---------- */
.splat {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.splat svg {
  width: 250vmax;
  height: 250vmax;
  animation: splat-anim 0.75s ease-in forwards;
}
@keyframes splat-anim {
  0%   { transform: scale(0) rotate(-20deg); opacity: 1; }
  45%  { transform: scale(1) rotate(0deg);  opacity: 1; }
  70%  { transform: scale(1.05); opacity: 1; }
  100% { transform: scale(1.15); opacity: 0; }
}

/* ---------- paint blob confetti ---------- */
.paint-blob {
  position: fixed;
  top: -30px;
  z-index: 70;
  pointer-events: none;
  border-radius: 58% 42% 55% 45% / 48% 55% 45% 52%;
  animation: blob-fall linear forwards;
}
@keyframes blob-fall {
  to { transform: translateY(115vh) rotate(340deg); opacity: 0.9; }
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  padding: 12px 22px;
  border-radius: 999px;
  border: 2px solid #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
  z-index: 90;
  max-width: 90vw;
  text-align: center;
}

/* ---------- small screens ---------- */
@media (max-width: 380px) {
  .card { padding: 20px 16px; }
}

@media (max-width: 700px) {
  #screen-lobby { padding: 8px; }
  .lobby-card {
    min-height: 0;
    padding: 14px;
    border-radius: 20px;
  }
  .lobby-header {
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
  }
  .lobby-heading { display: none; }
  .lobby-kicker { display: none; }
  .lobby-heading h2 { font-size: 1.65rem; }
  .lobby-header-actions { gap: 7px; }
  .lobby-settings-btn {
    width: 44px;
    padding: 8px;
    font-size: 0;
  }
  .lobby-settings-btn span { font-size: 1.2rem; }
  .room-code { padding: 5px 9px; }
  .room-code::before { display: none; }
  .lobby-setting-summary { gap: 4px; }
  .setup-summary-chip {
    width: 34px;
    height: 34px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0;
  }
  .setup-summary-chip b { font-size: 0.85rem; }
  .setup-summary-chip:first-child b::after { content: 'R'; font-size: 0.55rem; margin-left: 1px; }
  .setup-summary-chip:last-child b::after { content: 'I'; font-size: 0.55rem; margin-left: 1px; }
  .lobby-players {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px 0;
  }
  .lobby-player {
    min-height: clamp(108px, 15vh, 140px);
  }
  .lobby-player .avatar-svg {
    width: clamp(72px, 24vw, 108px);
    height: clamp(72px, 24vw, 108px);
    max-height: 10vh;
  }
  .lobby-footer { grid-template-columns: 1fr; gap: 10px; }
  .color-picker { justify-content: center; }
  .lobby-color-control .field-label { text-align: center; }
}

@media (max-height: 720px) and (min-width: 701px) {
  .lobby-player { min-height: 115px; }
  .lobby-player .avatar-svg { width: 86px; height: 86px; }
  .lobby-players { padding: 10px 0; }
}

/* ============================================================
   Illustrated art mode (generated images in /img)
   Default mode. Add body.classic-mode to go back to the old
   inline-SVG doodle look — nothing below deletes the old style,
   it only decides which of the two rendered variants is shown.
   ============================================================ */

/* --- avatars: both variants are always in the DOM --- */
.avatar-img {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
}
.avatar-img::before {
  /* player color badge behind the character (replaces the SVG's tinted smock) */
  content: '';
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  background: var(--pc, var(--accent));
  opacity: 0.30;
}
.avatar-img.artist::before {
  /* artist artwork carries its own tinted circle — no badge needed */
  display: none;
}
.avatar-img img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 0 rgba(51, 34, 26, 0.18));
  -webkit-user-drag: none;
  user-select: none;
}
body:not(.classic-mode) svg.avatar-svg { display: none; }
body.classic-mode .avatar-img { display: none; }

/* --- logo: image wordmark vs. classic text title --- */
.logo-img {
  display: block;
  width: min(320px, 86%);
  margin: 0 auto 4px;
  transform: rotate(-2deg);
  filter: drop-shadow(0 3px 0 rgba(51, 34, 26, 0.15));
}
body:not(.classic-mode) .home-card .title { display: none; }
body.classic-mode .logo-img { display: none; }

/* --- brush loader: swap the inline-SVG background for the painted brush --- */
body:not(.classic-mode) .brush-loader {
  background-image: url('img/brush-loader.png');
}

/* --- paint splat transition: PNG used as a mask so it can be tinted --- */
.splat-img { display: none; }
body:not(.classic-mode) .splat svg { display: none; }
body:not(.classic-mode) .splat-img {
  display: block;
  flex-shrink: 0;
  width: 250vmax;
  height: 250vmax;
  background-color: #e0455e; /* tinted per player from client.js */
  -webkit-mask: url('img/paint-splat-red.png') center / contain no-repeat;
  mask: url('img/paint-splat-red.png') center / contain no-repeat;
  animation: splat-anim 0.75s ease-in forwards;
}

/* --- imposter badge: stamped artwork vs. classic text pill --- */
.imposter-badge-img { display: none; }
body:not(.classic-mode) .imposter-badge { display: none; }
body:not(.classic-mode) .imposter-badge-img {
  display: inline-block;
  width: min(230px, 68%);
  margin: -6px 0 4px;
  transform: rotate(-3deg);
  filter: drop-shadow(0 3px 0 rgba(51, 34, 26, 0.2));
}

/* --- floating information button --- */
.style-toggle {
  position: fixed;
  left: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 95;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 3px 0 var(--ink);
  cursor: pointer;
  opacity: 0.85;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 900;
}
.style-toggle:active { transform: translateY(2px); box-shadow: none; }
