:root {
  --bg: #0b0d10;
  --bg-elev: #14181f;
  --bg-bubble-a: #1a1f28;
  --bg-bubble-b: #181d25;
  --ink: #e6e8ec;
  --muted: #8893a3;
  --dim: #5c6675;
  --accent: #7ec4cf;
  --accent-soft: rgba(126, 196, 207, 0.12);
  --warm: #d4a056;
  --bad: #cf6b6b;
  --good: #7fbf7f;
  --line: #232a34;
  --mono: ui-monospace, SFMono-Regular, 'JetBrains Mono', Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  text-align: center;
  padding: 2.5rem 1.25rem 0.25rem;
}

.wordmark {
  font-family: var(--mono);
  font-size: clamp(2rem, 6vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  margin: 0 0 0.2rem;
  line-height: 1;
  color: var(--ink);
}
.wordmark::before {
  content: "/";
  color: var(--accent);
  margin-right: 0.05em;
}

.kicker {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}

main {
  flex: 1;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 2rem;
}

footer {
  padding: 1.25rem 1rem 1.75rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  opacity: 0.65;
  font-family: var(--mono);
}
footer .brand {
  color: var(--accent);
}

.screen { display: none; }
.screen.active { display: block; animation: fadein 0.25s ease; }

@keyframes fadein {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.explainer {
  font-size: 1.05rem;
  margin: 1.1rem auto;
  max-width: 32rem;
  text-align: center;
  line-height: 1.55;
}
.explainer.subtle {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 1.75rem;
  font-family: var(--mono);
}
.explainer em {
  color: var(--accent);
  font-style: normal;
  font-weight: 500;
}

button {
  display: block;
  margin: 1.5rem auto 0;
  border: none;
  border-radius: 6px;
  padding: 0.85rem 2rem;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  min-width: 11rem;
  transition: filter 0.15s, transform 0.05s, background 0.15s, color 0.15s, border-color 0.15s;
}
.primary {
  background: var(--accent);
  color: var(--bg);
}
.primary:hover { filter: brightness(1.08); }
.primary:active { transform: translateY(1px); }
.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  margin-top: 0.6rem;
}
.ghost:hover { color: var(--ink); border-color: var(--muted); }
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* chat */
.chat-header {
  border-bottom: 1px solid var(--line);
  padding: 0 0 0.75rem;
  margin-bottom: 1rem;
}
.chat-title {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
}
.chat-title::before {
  content: "#";
  color: var(--accent);
}
.chat-meta {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.15rem;
  font-family: var(--mono);
}
.chat-meta span { color: var(--ink); }

.transcript {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.msg {
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  gap: 0.65rem;
  animation: fadein 0.2s ease;
}
.avatar {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--bg);
  flex-shrink: 0;
  margin-top: 0.1rem;
  font-family: var(--mono);
}
.msg-body {
  min-width: 0;
}
.msg-handle {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.msg-handle .time {
  color: var(--dim);
  font-weight: 400;
  margin-left: 0.4rem;
  font-size: 0.75rem;
}
.msg-text {
  color: var(--ink);
  font-size: 0.97rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg + .msg.same-author {
  margin-top: -0.55rem;
}
.msg.same-author .avatar { visibility: hidden; }
.msg.same-author .msg-handle { display: none; }

/* per-participant colors */
.p0 .avatar { background: #c08a5a; }
.p0 .msg-handle { color: #c08a5a; }
.p1 .avatar { background: #6fa8d6; }
.p1 .msg-handle { color: #6fa8d6; }
.p2 .avatar { background: #a48dc7; }
.p2 .msg-handle { color: #a48dc7; }
.p3 .avatar { background: #7fbf8c; }
.p3 .msg-handle { color: #7fbf8c; }

.prompt {
  text-align: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.95rem;
  margin: 1.5rem 0 0.75rem;
}
.prompt::before { content: "// "; color: var(--dim); }

.vote-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
  margin-bottom: 1rem;
}
.vote-option {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
  font-family: var(--mono);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.vote-option:hover {
  border-color: var(--accent);
  background: rgba(126, 196, 207, 0.04);
}
.vote-option .swatch {
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  flex-shrink: 0;
}
.vote-option.p0 .swatch { background: #c08a5a; }
.vote-option.p1 .swatch { background: #6fa8d6; }
.vote-option.p2 .swatch { background: #a48dc7; }
.vote-option.p3 .swatch { background: #7fbf8c; }

/* result */
#result h2, #end h2 {
  text-align: center;
  font-family: var(--mono);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 1rem 0 0.5rem;
  letter-spacing: -0.01em;
}
#result h2.good { color: var(--good); }
#result h2.bad { color: var(--bad); }

.reveal-detail {
  text-align: center;
  color: var(--muted);
  margin: 0.5rem auto 1.25rem;
  max-width: 32rem;
  line-height: 1.55;
  font-size: 0.95rem;
}
.reveal-detail strong { color: var(--ink); font-weight: 600; }

.tells {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  margin: 1rem 0 1.5rem;
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.7;
}
.tells .tells-head {
  color: var(--accent);
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tells ul {
  list-style: none;
  padding: 0;
}
.tells li::before {
  content: "—";
  color: var(--dim);
  margin-right: 0.4rem;
}
.tells code {
  color: var(--ink);
  background: rgba(126, 196, 207, 0.08);
  padding: 0.05rem 0.3rem;
  border-radius: 3px;
  font-size: 0.95em;
}

.streak-block {
  text-align: center;
  margin: 1.5rem auto;
}
.label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.streak-num {
  font-family: var(--mono);
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
  margin: 0.25rem 0 0.75rem;
}

.emoji-grid {
  font-family: var(--mono);
  font-size: 1.5rem;
  letter-spacing: 0.2rem;
  text-align: center;
  margin: 0.5rem 0;
  min-height: 1.5rem;
}

.status {
  text-align: center;
  color: var(--muted);
  min-height: 1.4em;
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  font-family: var(--mono);
}

@media (max-width: 480px) {
  .wordmark { font-size: 1.85rem; }
  main { padding: 1rem 0.9rem 2rem; }
  header { padding-top: 1.75rem; }
  .vote-options { grid-template-columns: 1fr; }
  .msg { grid-template-columns: 2rem 1fr; gap: 0.55rem; }
  .avatar { width: 2rem; height: 2rem; font-size: 0.8rem; }
}
