:root {
  --bg: #0e0d12;
  --panel: #17161d;
  --line: #2a2833;
  --ink: #e8e5ef;
  --dim: #8d879c;
  --judge: #d9b45f;
  --a: #6fb3d2;
  --b: #c98bc0;
  --alert: #d9695f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 ui-serif, Georgia, "Times New Roman", serif;
}

.top {
  padding: 2.5rem 1.5rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.top h1 { margin: 0; font-size: 2rem; letter-spacing: 0.01em; }
.top h1 span { color: var(--dim); font-weight: 400; }
.tagline { margin: 0.5rem 0 0; color: var(--dim); font-size: 0.95rem; }

main { max-width: 46rem; margin: 0 auto; padding: 1.5rem 1rem 6rem; }

/* Setup */
.setup {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.2rem;
}
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field.short { grid-column: span 1; }
label { font-size: 0.8rem; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; }
select, input[type="text"], input[type="number"] {
  background: #100f15;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 6px;
  padding: 0.55rem 0.6rem;
  font: inherit;
  font-size: 0.95rem;
}
.actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
button {
  background: var(--judge);
  color: #191510;
  border: 0;
  border-radius: 6px;
  padding: 0.6rem 1.2rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }
.stub { display: flex; align-items: center; gap: 0.4rem; text-transform: none; letter-spacing: 0; font-size: 0.85rem; }
.note { grid-column: 1 / -1; margin: 0; color: var(--dim); font-size: 0.85rem; }
.note.error { color: var(--alert); }

/* Feed */
.feed { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.4rem; }

.turn {
  margin: 1.6rem 0 0.4rem;
  color: var(--dim);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.turn::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* A judge narration is free text: one very long unbroken token would otherwise
   push the bubble past the viewport. */
.line { padding: 0.7rem 0.95rem; border-radius: 10px; max-width: 85%; overflow-wrap: anywhere; }
.chip { overflow-wrap: anywhere; }
.line .who { display: block; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.25rem; }
.line .says { display: block; }
.line .does { display: block; color: var(--dim); font-style: italic; margin-top: 0.3rem; }

.line.a { align-self: flex-start; background: #14202a; border: 1px solid #23404f; }
.line.a .who { color: var(--a); }
.line.b { align-self: flex-end; background: #241a24; border: 1px solid #47304a; }
.line.b .who { color: var(--b); }

.line.judge {
  align-self: stretch;
  max-width: none;
  background: transparent;
  border-left: 2px solid var(--judge);
  border-radius: 0;
  padding-left: 1rem;
}
.line.judge .who { color: var(--judge); }
.line.judge.asks { background: #1d1a12; border-radius: 0 8px 8px 0; }

.chip { align-self: center; font-size: 0.78rem; color: var(--dim); letter-spacing: 0.05em; }
.chip.roll { font-family: ui-monospace, monospace; }
.chip.roll.crit { color: var(--judge); }
.chip.roll.fail { color: var(--alert); }
.chip.status-on { color: #9ad39a; }
.chip.status-off { color: var(--dim); }
.chip.rule { color: var(--alert); font-style: italic; }
.chip.private { font-style: italic; }

.outcome {
  margin-top: 2rem;
  padding: 1.4rem;
  border: 1px solid var(--judge);
  border-radius: 10px;
  background: #1a1710;
}
.outcome h2 { margin: 0 0 0.2rem; font-size: 1.5rem; color: var(--judge); }
.outcome .kind { color: var(--dim); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; }
.outcome p { margin: 0.8rem 0 0; }

.waiting { align-self: center; color: var(--dim); font-size: 0.85rem; }
.waiting::after { content: "…"; animation: dots 1.2s steps(4, end) infinite; }
@keyframes dots { 0% { opacity: 0.3 } 50% { opacity: 1 } 100% { opacity: 0.3 } }

@media (max-width: 34rem) {
  .setup { grid-template-columns: 1fr; }
  .line { max-width: 95%; }
}
