* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--tg-theme-bg-color, #0f172a);
  color: var(--tg-theme-text-color, #f8fafc);
  height: 100%;
  overscroll-behavior: none;
}
body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  max-width: 820px;
  margin: 0 auto;
}
.hidden { display: none !important; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
.title-wrap { display: flex; align-items: center; gap: 8px; }
.badge {
  background: #3b82f6;
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
}
.muted { opacity: 0.75; font-size: 12px; }
.timer { font-weight: 700; font-size: 15px; color: #f59e0b; }

.banner {
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
}
.word-display { font-size: 18px; font-weight: 700; letter-spacing: 2px; }
.word-choices { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }

.canvas-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}
#board {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: crosshair;
}
.toast {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(17,24,39,0.9);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  pointer-events: none;
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.colors {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  cursor: pointer;
}
.swatch[data-color="#111827"] { background: #111827; }
.swatch[data-color="#ef4444"] { background: #ef4444; }
.swatch[data-color="#f97316"] { background: #f97316; }
.swatch[data-color="#eab308"] { background: #eab308; }
.swatch[data-color="#22c55e"] { background: #22c55e; }
.swatch[data-color="#3b82f6"] { background: #3b82f6; }
.swatch[data-color="#a855f7"] { background: #a855f7; }
.swatch[data-color="#ec4899"] { background: #ec4899; }
.swatch.active { transform: scale(1.18); border-color: #fff; box-shadow: 0 0 0 2px #3b82f6; }

.actions {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  border: none;
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(255,255,255,0.14);
  color: inherit;
}
.btn.active { background: #3b82f6; color: #fff; }
.btn.primary { background: #2563eb; color: #fff; }

.pic-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 120px;
}
.players-bar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 12px;
}
.player-chip {
  background: rgba(255,255,255,0.1);
  padding: 3px 8px;
  border-radius: 999px;
}
.player-chip.drawer { background: #f59e0b; color: #111827; font-weight: 700; }
.feed {
  flex: 1;
  min-height: 64px;
  max-height: 140px;
  overflow-y: auto;
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
}
.feed-line { margin-bottom: 3px; }
.feed-line.sys { color: #93c5fd; font-style: italic; }
.feed-line.win { color: #4ade80; font-weight: 700; }
.guess-form { display: flex; gap: 6px; }
.guess-form input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: inherit;
  font-size: 14px;
}
