/* In-class questions — student + presenter views */
* { box-sizing: border-box; }
:root {
  --ink: #1a1a1a;
  --ink-2: #555;
  --ink-3: #8a8f98;
  --brand: #003da5;      /* chrome only, never data */
  --bar: #1b4fc0;        /* validated data fill on white */
  --track: #eef0f3;
  --line: #e3e6ea;
  --surface: #ffffff;
  --card: #f7f8fa;
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--surface);
  line-height: 1.45;
}
.topbar { background: var(--brand); color: #fff; padding: 0.55rem 1rem;
          display: flex; align-items: baseline; gap: 0.75rem; flex-wrap: wrap; }
.topbar .brand { font-weight: 700; }
.topbar .sub { color: #dbe6ff; font-size: 0.9rem; }
.topbar a { color: #dbe6ff; text-decoration: none; margin-left: auto; font-size: 0.9rem; }
.topbar a:hover { color: #fff; text-decoration: underline; }

/* ---------- student layout ---------- */
.student-wrap { max-width: 640px; margin: 0 auto; padding: 1rem 1.1rem 3rem; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
        padding: 1rem 1.1rem; margin: 0.9rem 0; }
.prompt { font-size: 1.15rem; font-weight: 700; margin: 0.2rem 0 0.9rem; }
.muted { color: var(--ink-2); font-size: 0.92rem; }
.tiny { color: var(--ink-3); font-size: 0.8rem; }

.choice-btn {
  display: block; width: 100%; text-align: left;
  font: inherit; font-size: 1rem; color: var(--ink);
  background: #fff; border: 2px solid var(--line); border-radius: 8px;
  padding: 0.65rem 0.8rem; margin: 0.45rem 0; cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.choice-btn:hover { border-color: #b9c6e8; }
.choice-btn.selected { border-color: var(--bar); background: #eef3ff; font-weight: 600; }
.choice-btn:disabled { opacity: 0.6; cursor: default; }

textarea.free-text {
  width: 100%; min-height: 6.5rem; font: inherit; font-size: 1rem;
  border: 2px solid var(--line); border-radius: 8px; padding: 0.6rem 0.7rem;
  resize: vertical;
}
textarea.free-text:focus { outline: none; border-color: var(--bar); }

.btn {
  font: inherit; font-size: 0.95rem; font-weight: 600;
  background: var(--brand); color: #fff; border: none; border-radius: 8px;
  padding: 0.55rem 1.1rem; cursor: pointer; margin-top: 0.6rem;
}
.btn:hover { background: #0348bd; }
.btn.secondary { background: #fff; color: var(--brand); border: 2px solid var(--brand); }
.btn:disabled { opacity: 0.5; cursor: default; }

input.field {
  width: 100%; font: inherit; font-size: 1rem;
  border: 2px solid var(--line); border-radius: 8px; padding: 0.55rem 0.7rem;
  margin: 0.3rem 0 0.7rem;
}
input.field:focus { outline: none; border-color: var(--bar); }
label { font-size: 0.9rem; font-weight: 600; color: var(--ink-2); }

.ok-badge { color: #1a7a3a; font-weight: 600; font-size: 0.92rem; }

/* ---------- results: single-series horizontal bars ---------- */
.results { margin-top: 0.4rem; }
.bar-row { margin: 0.55rem 0; }
.bar-label { font-size: 0.92rem; color: var(--ink); margin-bottom: 3px; }
.bar-line { display: flex; align-items: center; gap: 0.6rem; }
.bar-track { flex: 1; background: var(--track); border-radius: 4px; height: 22px; overflow: hidden; }
.bar-fill {
  height: 100%; background: var(--bar); border-radius: 0 4px 4px 0;
  width: 0; transition: width 0.35s ease; min-width: 0;
}
.bar-count { flex: 0 0 4.6rem; text-align: right; font-variant-numeric: tabular-nums;
             font-size: 0.92rem; color: var(--ink-2); white-space: nowrap; }
.results-total { margin-top: 0.5rem; }

/* ---------- text wall ---------- */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
        gap: 0.6rem; margin-top: 0.6rem; }
.wall .note { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--bar);
              border-radius: 6px; padding: 0.55rem 0.7rem; font-size: 0.95rem;
              animation: pop 0.25s ease; overflow-wrap: break-word; }
@keyframes pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; } }

/* ---------- presenter layout ---------- */
.present-grid { display: grid; grid-template-columns: 300px 1fr; gap: 1.25rem;
                max-width: 1280px; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.sidebar .card { margin-top: 0; }
.qlist { list-style: none; padding: 0; margin: 0.4rem 0 0; }
.qlist li { border: 1px solid var(--line); border-radius: 8px; background: #fff;
            padding: 0.5rem 0.65rem; margin: 0.4rem 0; cursor: pointer; font-size: 0.9rem; }
.qlist li:hover { border-color: #b9c6e8; }
.qlist li.live { border-color: var(--bar); background: #eef3ff; font-weight: 600; }
.qlist li .qtype { color: var(--ink-3); font-size: 0.75rem; text-transform: uppercase;
                   letter-spacing: 0.04em; margin-right: 0.4rem; }

.stage { min-height: 60vh; }
.stage .prompt { font-size: 1.9rem; line-height: 1.3; }
.stage .bar-label { font-size: 1.15rem; }
.stage .bar-track { height: 34px; border-radius: 5px; }
.stage .bar-fill { border-radius: 0 5px 5px 0; }
.stage .bar-count { font-size: 1.15rem; flex-basis: 6rem; }
.stage .wall .note { font-size: 1.1rem; }
.stage .results-total { font-size: 1.05rem; }

.qr-box { text-align: center; }
.qr-box .qr { display: inline-block; background: #fff; padding: 10px;
              border: 1px solid var(--line); border-radius: 8px; }
.join-url { font-weight: 700; color: var(--brand); font-size: 1.05rem; word-break: break-all; }

.count-pill { display: inline-block; background: #eef3ff; color: var(--brand);
              border-radius: 999px; padding: 0.15rem 0.7rem; font-weight: 700;
              font-variant-numeric: tabular-nums; }

.setup-warn { background: #fff8e6; border: 1px solid #f0dfa8; border-radius: 8px;
              padding: 0.8rem 1rem; margin: 1rem 0; font-size: 0.95rem; }

@media (max-width: 900px) {
  .present-grid { grid-template-columns: 1fr; }
  .stage .prompt { font-size: 1.4rem; }
}
