:root {
  --bg: #0f1218;
  --card: #171b24;
  --line: #262c3a;
  --text: #e7eaf0;
  --muted: #8b93a7;
  --accent: #6aa8ff;
  --gold: #e8b93a;
  --danger: #ff6b6b;
  --ok: #5fd35f;
  color-scheme: dark;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
}
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
h1 {
  margin: 0;
  font-size: 18px;
}
h2 {
  margin: 0;
  font-size: 15px;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--danger);
  flex: none;
}
.dot.on {
  background: var(--ok);
}
.pill {
  padding: 2px 10px;
  border-radius: 99px;
  background: #222838;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.actions,
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.row-actions {
  margin-top: 10px;
}
main {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  gap: 16px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  min-width: 0;
}
.card-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.muted {
  color: var(--muted);
  font-weight: 400;
}
code {
  background: #222838;
  padding: 1px 6px;
  border-radius: 4px;
  word-break: break-all;
}
.preview iframe {
  width: 100%;
  height: auto;
  aspect-ratio: 1920 / 200;
  min-height: 120px;
  max-height: 200px;
  border: 0;
  border-radius: 8px;
  display: block;
}
button {
  font: inherit;
  color: #0b0e14;
  background: var(--accent);
  border: 0;
  border-radius: 7px;
  padding: 7px 12px;
  cursor: pointer;
  white-space: nowrap;
}
button:hover {
  filter: brightness(1.1);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}
button.gold {
  background: var(--gold);
}
/* the mode that is running (or the vote that is open) */
button.ghost.on {
  background: #22314d;
  border-color: var(--accent);
  color: var(--accent);
}
.group.mode {
  flex-wrap: wrap;
}
#tChat {
  width: 220px;
}
/* connection states carry the reason: they wrap instead of being cut on a phone */
#twState,
#kkState {
  white-space: normal;
  overflow: visible;
}
#kkSecret {
  width: 200px;
}
#kkUrl {
  word-break: break-all;
}
.code-big {
  font-size: 20px;
  letter-spacing: 3px;
  color: var(--gold);
}
button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid #4a2a2e;
  padding: 4px 10px;
}
input,
select {
  font: inherit;
  color: var(--text);
  background: #0f131b;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 9px;
  min-width: 0;
}
input[type='number'] {
  width: 90px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  align-items: start;
}
.field {
  display: grid;
  gap: 4px;
  align-content: start;
  min-width: 0;
}
.field > span {
  color: var(--muted);
  font-size: 12px;
}
.field em {
  font-style: normal;
  opacity: 0.8;
}
.field input,
.field select {
  width: 100%;
}
.group {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.unit {
  color: var(--muted);
}
.result {
  min-height: 1.4em;
  margin: 10px 0 0;
  color: var(--muted);
}
.result.err {
  color: var(--danger);
}
.result.ok {
  color: var(--ok);
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th,
td {
  text-align: left;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
th {
  color: var(--muted);
  font-weight: 600;
}
td.name {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
tr.reserve td {
  opacity: 0.6;
}
.cls {
  font-weight: 700;
}
.cls.knight {
  color: #8fb3e8;
}
.cls.ranger {
  color: #79d27f;
}
.cls.sorcerer {
  color: #c592ff;
}
.empty {
  margin: 10px 0 0;
}
/* settings editor */
.set-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 10px 0 0;
  padding: 10px 12px 12px;
  min-width: 0;
}
.set-section > legend {
  padding: 0 6px;
  font-weight: 700;
}
.set-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
  align-items: start;
}
.set-item {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 8px;
  margin-top: 8px;
}
.set-item-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}
/* label + control share two grid rows with their neighbours, so a label that wraps
   to two lines does not push its own input below the inputs next to it */
.set-grid > .field,
.form-grid > .field {
  grid-row: span 2;
  grid-template-rows: subgrid;
  row-gap: 4px;
}
.check {
  display: flex;
  gap: 8px;
  align-items: center;
  grid-row: span 2;
  align-self: end;
  min-height: 34px;
}
.set-top {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 10px;
}
.set-top > summary {
  cursor: pointer;
  padding: 10px 12px;
  font-weight: 700;
}
.set-top > fieldset {
  border: 0;
  margin: 0;
  padding: 0 12px 12px;
}
.set-top > fieldset > legend {
  display: none;
}
.check input {
  width: auto;
  flex: none; /* a label that wraps to two lines must not squeeze the box */
}
@media (max-width: 640px) {
  .top {
    position: static;
  }
  .row-actions > button,
  .row-actions > .group {
    flex: 1 1 100%;
  }
  .row-actions .group button {
    flex: 1;
  }
}
