/* Logo font, bundled with the game (Apache 2.0, see fonts/LICENSE-permanent-marker.txt) */
@font-face {
  font-family: "Permanent Marker";
  src: url("/fonts/permanent-marker.woff2") format("woff2");
  font-display: swap;
}
:root {
  --bg: #f6f1e7;
  --card: #fffdf8;
  --ink: #1d1a16;
  --muted: #7a7065;
  --line: #e2d8c6;
  --accent: #c8341f; /* "guilty" red */
  --accent-soft: #c8341f1f;
  --accent-ink: #fff;
  --win: #2f7d4f;
  --win-soft: #2f7d4f1f;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171411;
    --card: #221e1a;
    --ink: #f1ebe0;
    --muted: #a0968a;
    --line: #3a332b;
    --accent: #e0533c;
    --accent-soft: #e0533c26;
    --win: #5fbf86;
    --win-soft: #5fbf8626;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
main { max-width: 560px; margin: 0 auto; padding: 32px 16px 64px; }
header { margin-bottom: 28px; }
h1 { font-size: 2rem; margin: 0; letter-spacing: -0.02em; }
/* Logo image (white outline reads on both light and dark backgrounds) */
.logo { margin: 0 0 4px -6px; line-height: 0; }
.logo img { display: block; width: 100%; max-width: 300px; height: auto; }
.phase-label { font-family: "Permanent Marker", "Comic Sans MS", cursive; font-weight: 400 !important; letter-spacing: 0 !important; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
#lobby h2 { margin-top: 24px; }
.tag, .muted { color: var(--muted); }
.tag { margin: 4px 0 0; }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.accent-text { color: var(--accent); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
form { display: flex; gap: 8px; }
input, textarea {
  flex: 1; min-width: 0; font: inherit; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
}
textarea { width: 100%; resize: vertical; }
textarea:disabled { opacity: 0.7; }
#code-input { text-transform: uppercase; letter-spacing: 0.15em; }
button {
  font: inherit; padding: 10px 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--ink);
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; width: 100%; }
form button.primary, .row button.primary { width: auto; }
button.ghost { background: transparent; }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.or { text-align: center; color: var(--muted); margin: 14px 0; }

/* lobby */
.room-label { margin-top: 0; }
.invite { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.invite > div { display: flex; flex-direction: column; }
.big { font-size: 1.6rem; letter-spacing: 0.12em; }
.settings { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; margin: 8px 0 20px; }
.settings input { padding: 0; }
#rounds-out { min-width: 7ch; text-align: right; font-variant-numeric: tabular-nums; }
#wait { margin-bottom: 0; }

/* player lists */
.plist { list-style: none; padding: 0; margin: 0 0 16px; }
.plist li { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.plist li.away .pname { color: var(--muted); }
.plist.compact li { padding: 6px 0; font-size: 0.95rem; }
.badge { font-size: 0.75rem; padding: 2px 8px; border-radius: 99px; background: var(--line); color: var(--muted); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.kick { margin-left: auto; padding: 4px 10px; font-size: 0.85rem; }
.check { color: var(--win); font-weight: 700; }
.score { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }

/* game frame */
.bar { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 12px; }
.phase-label { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.01em; }
.timer { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.timer.low { color: var(--accent); }
.scoreboard { margin-top: 20px; }
#end-game { display: block; margin: 0 auto; }

.composer { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.prompt { font-size: 1.15rem; margin: 0 0 12px; }
.reference { border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; background: var(--bg); }

#stage.intro { min-height: 180px; display: flex; align-items: center; justify-content: center; text-align: center; }
.intro-line { font-size: 1.5rem; line-height: 1.3; margin: 8px 0 16px; }

/* voting + results */
.entries { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 520px) { .entries { grid-template-columns: repeat(3, 1fr); } }
.entry { text-align: left; padding: 6px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--bg); display: flex; flex-direction: column; gap: 6px; }
.entry.picked { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.entry.mine { opacity: 0.55; }
.entry.winner, .tallies li.winner { border-color: var(--win); background: var(--win-soft); }
.entry-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.verdict { font-size: 1.2rem; font-weight: 700; margin: 4px 0 12px; }
.tallies { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.tallies li { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.by { display: flex; justify-content: space-between; font-size: 0.9rem; color: var(--muted); }
.by span:first-child { color: var(--ink); font-weight: 600; }
.votes { font-variant-numeric: tabular-nums; }

/* final */
.slide-winners { display: grid; gap: 10px; margin-bottom: 16px; }
.podium { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 12px 0 16px; }
.step { border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.step.p1 { border-color: var(--win); background: var(--win-soft); }
.place { font-size: 1.3rem; font-weight: 800; }
.step .pname { font-weight: 600; margin: 4px 0; }
.standings { margin: 0 0 16px; padding-left: 24px; }

#status { margin-top: 12px; }
#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px;
  max-width: calc(100% - 32px);
}

/* ---------------------------------------------------------------- images */
.art { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; border-radius: 6px; }
.art:not([src]) { background: linear-gradient(100deg, var(--line) 30%, var(--card) 50%, var(--line) 70%) 0 0 / 300% 100%; animation: shimmer 1.2s linear infinite; }
.art.missing { animation: none; background: var(--line); }
@keyframes shimmer { to { background-position: -150% 0; } }
.mine-tag { text-align: center; }
.tallies li { padding: 6px 6px 10px; }
.tallies .by, .slide-winners .by { padding: 0 6px; }
.intro-mug { max-width: 220px; margin: 0 auto; border: 1px solid var(--line); }
#stage.intro { flex-direction: column; gap: 8px; }

/* ----------------------------------------------------------- drawing stage */
.drawing-stage { padding: 14px; }
.drawing-stage .hint { margin: 0 0 10px; }
.evidence-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.evidence-head .prompt { margin: 0; flex: 1; }
.ref { padding: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; flex: 0 0 auto; width: 92px; position: relative; overflow: hidden; }
.ref-img { border-radius: 0; }
.ref-label { position: absolute; left: 0; right: 0; bottom: 0; font-size: 0.7rem; padding: 2px 0; background: #000a; color: #fff; text-align: center; }
.row.end { justify-content: flex-end; }

.pad { display: flex; flex-direction: column; gap: 10px; }
.pad-frame { position: relative; border-radius: 10px; overflow: hidden; border: 1.5px solid var(--line); background: #fff; }
.pad-canvas { display: block; width: 100%; aspect-ratio: 4 / 3; touch-action: none; cursor: crosshair; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.pad-veil { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: #ffffff8c; color: #1d1a16; font-weight: 700; letter-spacing: 0.04em; pointer-events: none; }
.pad.locked .pad-veil { display: flex; }
.pad.locked .pad-tools { opacity: 0.4; pointer-events: none; }
.pad-tools { position: relative; display: flex; flex-direction: column; gap: 8px; }

.swatches { display: grid; grid-template-columns: repeat(13, 1fr); gap: 5px; }
.swatch { aspect-ratio: 1; padding: 0; border-radius: 50%; background: var(--c); border: 1.5px solid #0003; min-width: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }
.wheel-btn { background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); position: relative; }
.wheel-btn::after { content: ""; position: absolute; inset: 28%; border-radius: 50%; background: var(--c); border: 1.5px solid #fff; }
@media (max-width: 420px) { .swatches { grid-template-columns: repeat(7, 1fr); } }

.toolrow { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.group { display: flex; gap: 4px; align-items: center; }
.tool, .size { width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }
.tool.on, .size.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.size span { display: block; border-radius: 50%; background: currentColor; }
.sizes { gap: 2px; }
@media (max-width: 440px) { .toolrow { flex-wrap: nowrap; gap: 4px; } .group { gap: 2px; } .tool, .size { width: 34px; height: 36px; border-radius: 8px; } .tool svg { width: 20px; height: 20px; } }

.wheel-pop { position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 5; display: flex; gap: 14px; align-items: center; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px #0004; }
.wheel-wrap { position: relative; width: 180px; flex: 0 0 auto; }
.wheel { display: block; width: 100%; height: auto; touch-action: none; cursor: crosshair; }
.wheel-marker { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1.5px #000a; pointer-events: none; }
.wheel-side { flex: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.wheel-side input[type=range] { padding: 0; }
.wheel-row { display: flex; align-items: center; gap: 8px; }
.wheel-preview { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid #0003; flex: 0 0 auto; }
@media (max-width: 420px) { .wheel-wrap { width: 150px; } .wheel-pop { gap: 10px; padding: 12px; } }

/* ---------------------------------------------------------------- lightbox */
.lightbox { position: fixed; inset: 0; z-index: 50; background: #000d; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 80vh; background: #fff; border-radius: 8px; }
.lightbox-cap { color: #fff; font-size: 0.95rem; }
@media (max-width: 380px) {
  .drawing-stage { padding: 10px; }
  .tool, .size { width: 30px; height: 34px; }
  .tool svg { width: 18px; height: 18px; }
}

/* test-mode buttons (only shown with ?test) */
.test-btn { width: 100%; margin-top: 10px; border-style: dashed; color: var(--muted); }
#add-bot { margin: 0 0 10px; }
