:root {
  /* EnGarde brand: indigo accent on a dark gray-900 canvas */
  --bg: #111827;        /* gray-900 */
  --bg2: #1f2937;       /* gray-800 — cards */
  --line: #374151;      /* gray-700 — borders */
  --fg: #f3f4f6;        /* gray-100 */
  --muted: #9ca3af;     /* gray-400 */
  --accent: #6366f1;    /* indigo-500 */
  --accent-2: #4f46e5;  /* indigo-600 */
  --cyan: #22d3ee;      /* gradient partner */
  --good: #22c55e;
  --bad: #ef4444;
  /* Kahoot answer colors — kept distinct so shape↔color mapping reads instantly */
  --c0: #e21b3c;
  --c1: #1368ce;
  --c2: #d89e00;
  --c3: #26890c;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-text-size-adjust: 100%;
}
body { padding: 0; }
::selection { background-color: rgba(99, 102, 241, 0.3); }
.wrap { max-width: 720px; margin: 0 auto; padding: 24px; }
h1, h2 { margin: 0 0 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.big { font-size: clamp(28px, 6vw, 64px); font-weight: 800; }
.huge { font-size: clamp(40px, 10vw, 140px); font-weight: 900; letter-spacing: 4px; }

button {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 10px;
  padding: 14px 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  cursor: pointer;
}
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.ghost { background: var(--bg2); border: 1px solid var(--line); }
input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  margin: 6px 0;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: 14px; padding: 20px; margin: 14px 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); font-weight: 600; }

/* EnGarde wordmark */
.brand { font-weight: 800; letter-spacing: -0.5px; }
.brand .g { color: var(--accent); }
.brand-tag { color: var(--muted); font-size: 0.9em; }

/* answer option grid (attendee + display) */
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt {
  display: flex; align-items: center; gap: 12px;
  min-height: 84px; padding: 16px; border-radius: 14px;
  color: #fff; font-size: clamp(18px, 3vw, 30px); font-weight: 800;
  border: 4px solid transparent;
}
.opt .shape { font-size: 1.4em; }
.opt0 { background: var(--c0); }
.opt1 { background: var(--c1); }
.opt2 { background: var(--c2); }
.opt3 { background: var(--c3); }
.opt.dim { opacity: 0.3; }
.opt.correct { border-color: #fff; box-shadow: 0 0 0 4px var(--good); }
.opt.mine { outline: 4px dashed #fff; outline-offset: 2px; }

/* tally bars (display reveal) */
.bars { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; align-items: end; height: 260px; }
.bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; }
.bar .fill { width: 100%; border-radius: 8px 8px 0 0; transition: height .4s ease; min-height: 6px; flex: none; }
.bar.b0 .fill { background: var(--c0); }
.bar.b1 .fill { background: var(--c1); }
.bar.b2 .fill { background: var(--c2); }
.bar.b3 .fill { background: var(--c3); }

/* leaderboard */
.lb { list-style: none; padding: 0; margin: 0; }
.lb li { display: flex; justify-content: space-between; padding: 12px 16px; background: var(--bg2); border-radius: 10px; margin: 8px 0; font-size: clamp(18px, 2.5vw, 28px); font-weight: 700; }
.lb li .rank { color: var(--accent); margin-right: 12px; }

/* join banner on the projector */
.joinbar { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; gap: 24px; align-items: center; padding: 14px; background: rgba(0,0,0,.35); font-weight: 800; }
.joinbar .code { font-size: clamp(28px, 5vw, 56px); letter-spacing: 6px; color: var(--accent); }

/* fullscreen display layout */
.stage { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 40px 200px 100px; }

/* full-bleed background slides paint onto .stage directly (set inline) */

/* Markdown body on the projector */
.slide-md { max-width: 1100px; margin: 0 auto; font-size: clamp(22px, 2.6vw, 38px); line-height: 1.4; }
.slide-md.scrim { background: rgba(17, 24, 39, .72); border-radius: 20px; padding: 36px 56px; backdrop-filter: blur(3px); }
.slide-md h1 { font-size: clamp(40px, 6vw, 86px); margin: 0 0 .3em; }
.slide-md h2 { font-size: clamp(30px, 4.5vw, 60px); margin: .4em 0 .25em; }
.slide-md h3 { font-size: clamp(24px, 3.4vw, 44px); margin: .4em 0 .25em; color: var(--accent); }
.slide-md p { margin: .4em 0; }
.slide-md ul, .slide-md ol { text-align: left; display: inline-block; margin: .3em 0; }
.slide-md li { margin: .25em 0; }
.slide-md a { color: var(--accent); }
.slide-md code { background: rgba(255,255,255,.12); padding: .1em .35em; border-radius: 6px; font-size: .9em; }
.slide-md img { max-width: 100%; max-height: 38vh; border-radius: 14px; vertical-align: middle; margin: .2em 0; }
.slide-md .md-pre { display: inline-block; text-align: left; font-family: ui-monospace, "SF Mono", Menlo, monospace; white-space: pre; line-height: 1.05; letter-spacing: 3px; font-size: clamp(18px, 3vw, 40px); margin: .15em 0; }
.md-preview .md-pre { white-space: pre; line-height: 1; font-size: 10px; letter-spacing: 1px; }

/* syntax highlighting tokens (code fences with a language) */
.tok-keyword { color: #c792ea; }
.tok-string  { color: #c3e88d; }
.tok-number  { color: #f78c6c; }
.tok-fn      { color: #82aaff; }
.tok-comment { color: #676e95; font-style: italic; }

/* editor: markdown preview + image dropzone */
.md-preview { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin: 6px 0; min-height: 8px; color: var(--muted); font-size: 14px; }
.md-preview:empty { display: none; }
.md-preview img { max-width: 120px; max-height: 80px; border-radius: 6px; vertical-align: middle; }
.md-preview h1, .md-preview h2, .md-preview h3 { font-size: 16px; margin: 4px 0; color: var(--fg); }
.dropzone { border: 2px dashed var(--line); border-radius: 10px; padding: 16px; margin: 6px 0; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone:focus { border-color: var(--accent); outline: none; }
.dropzone.drag { border-color: var(--accent); background: rgba(99, 102, 241, .12); }
.dropzone.has-img { text-align: left; }
.bgthumb { display: block; max-height: 120px; max-width: 100%; border-radius: 8px; }

/* speaker notes — presenter remote */
.notes-card { border-left: 4px solid var(--accent); }
.notes-label { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: 1px; margin-bottom: 8px; }
.notes-body { font-size: 18px; line-height: 1.5; }
.notes-body h1, .notes-body h2, .notes-body h3 { font-size: 20px; margin: 6px 0; }
.notes-body ul, .notes-body ol { padding-left: 22px; margin: 6px 0; }
.notes-body li { margin: 3px 0; }
.notes-body code { background: rgba(255,255,255,.1); padding: .1em .35em; border-radius: 5px; }
.notes-body .md-pre { font-family: ui-monospace, "SF Mono", Menlo, monospace; white-space: pre; font-size: 13px; line-height: 1.4; background: rgba(255,255,255,.06); padding: 8px 10px; border-radius: 6px; margin: 6px 0; }

/* speaker-notes field — editor */
.notes-field { border-style: dashed; border-color: var(--accent); background: rgba(99,102,241,.06); font-size: 13px; }

/* persistent JOIN QR badge (projector, top-right) */
.qrbadge {
  position: fixed; top: 20px; right: 20px; z-index: 50;
  background: #fff; color: #111; border-radius: 16px; padding: 12px 12px 8px;
  text-align: center; box-shadow: 0 8px 28px rgba(0, 0, 0, .45);
}
.qrbadge .qrlabel { font-weight: 900; font-size: clamp(16px, 1.6vw, 22px); margin-bottom: 6px; }
.qrbadge img { display: block; width: clamp(120px, 12vw, 170px); height: auto; image-rendering: pixelated; }
.qrbadge .qrhost { font-size: clamp(11px, 1vw, 14px); color: #555; margin-top: 6px; max-width: 170px; word-break: break-all; }
