:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel-2: #20242d;
  --line: #2a2f3a;
  --text: #e6e8ec;
  --muted: #9aa3b2;
  --accent: #5b8cff;
  --accent-2: #8b5bff;
  --good: #41d18b;
}

* { box-sizing: border-box; }
/* `hidden` must always win over the `display` we set on .landing/.room below. */
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
button {
  font: inherit;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
input, textarea, select {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  width: 100%;
}
textarea { resize: vertical; }
.muted { color: var(--muted); }
.err { color: #ff6b6b; min-height: 1.2em; margin: 4px 0 0; font-size: 13px; }
.hint { color: var(--muted); font-size: 13px; }

/* ---------- landing ---------- */
.landing {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
}
.card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
}
.card h1 { margin: 0 0 6px; font-size: 24px; }
.card h2 { font-size: 15px; margin: 0 0 10px; color: var(--muted); }
.sub { color: var(--muted); margin: 0 0 22px; }
.card section { display: grid; gap: 10px; }
.file-drop {
  display: grid;
  place-items: center;
  min-height: 90px;
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  cursor: pointer;
  text-align: center;
  padding: 12px;
}
.file-drop.over { border-color: var(--accent); color: var(--text); }
.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); margin: 22px 0;
}
.divider::before, .divider::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

/* ---------- room ---------- */
.room {
  height: 100vh;
  display: grid;
  grid-template-columns: 1fr 360px;
}
.viewer { display: flex; flex-direction: column; min-width: 0; background: #0a0c10; }
.viewer-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.badge {
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  padding: 3px 8px; border-radius: 6px;
  background: var(--panel-2); color: var(--muted);
}
.badge.host { background: var(--accent-2); color: #fff; }
.pageinfo { color: var(--muted); font-variant-numeric: tabular-nums; }
.host-controls { display: flex; gap: 6px; }
.host-controls button { padding: 6px 10px; background: var(--panel-2); }
.follow-note { margin-left: auto; color: var(--muted); font-size: 13px; }
.pdf-scroll {
  flex: 1;
  overflow: auto;
  display: grid;
  place-items: start center;
  padding: 16px;
}
#pdfCanvas {
  background: #fff;
  box-shadow: 0 6px 30px rgba(0,0,0,.5);
  border-radius: 2px;
}

/* ---------- side panel ---------- */
.side {
  display: flex; flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--panel);
  min-height: 0;
}
.side > * { padding: 0 14px; }
.side-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.side-head button { padding: 5px 10px; font-size: 13px; }
.participants {
  list-style: none; margin: 0; padding: 8px 14px;
  max-height: 130px; overflow: auto;
  border-bottom: 1px solid var(--line);
}
.participants li {
  display: flex; justify-content: space-between;
  padding: 3px 0; font-size: 14px;
}
.sub-yes { color: var(--good); font-size: 12px; }
.sub-no { color: var(--muted); font-size: 12px; }

.answer-block { padding: 12px 14px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.answer-head { display: flex; justify-content: space-between; align-items: baseline; }
.host-reveal { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.host-reveal button { flex: 1; min-width: 90px; }
#revealBtn { background: var(--good); color: #04210f; font-weight: 700; }

.reveal-list { padding: 12px 14px; border-bottom: 1px solid var(--line); max-height: 220px; overflow: auto; }
.reveal-list ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; }
.reveal-list li {
  display: grid; gap: 2px;
  background: var(--panel-2); border-radius: 8px; padding: 7px 10px;
}
.reveal-list li strong { color: var(--accent); font-size: 13px; }

.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; padding: 0; }
.chat-log { flex: 1; overflow: auto; padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; }
.chat-msg { font-size: 14px; }
.chat-msg b { color: var(--accent); }
.chat-sys { color: var(--muted); font-size: 12px; text-align: center; }
.chat-input { display: flex; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; }
.chat-input button { padding: 9px 14px; }

@media (max-width: 820px) {
  .room { grid-template-columns: 1fr; grid-template-rows: 55vh 1fr; }
  .side { border-left: none; border-top: 1px solid var(--line); }
}
