:root {
  color-scheme: light dark;
  --bg: #f6f6f8;
  --fg: #1d1d22;
  --muted: #6b6b76;
  --card: #ffffff;
  --line: #dcdce2;
  --dead: #d9534f;
  --broken: #e0922f;
  --complete: #3d9a41;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18181c;
    --fg: #ececf1;
    --muted: #9a9aa6;
    --card: #222228;
    --line: #34343c;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 1000px; margin: 0 auto; padding: 16px; }
header { display: flex; align-items: center; gap: 12px; }
h1 { flex: 1; margin: 0; font-size: 1.5rem; }
button {
  font: inherit; color: inherit; background: var(--card);
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; cursor: pointer;
}
#message { color: var(--muted); }
#message.error { color: var(--dead); font-weight: 600; }
#players { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.player {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 10px;
}
.player .name { font-weight: 600; }
.player .info, #updated, .note { color: var(--muted); font-size: 0.9em; }
table {
  width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
th, td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--line); }
th { font-size: 0.85em; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
.status-dead, .entry-dead { color: var(--dead); }
.status-broken, .entry-failed { color: var(--broken); }
.status-complete { color: var(--complete); }
.status { font-weight: 600; }
.nick { font-weight: 600; }
.mobile-status { display: none; }
.species, .level { color: var(--muted); }
.entry-dead .species, .entry-dead .level { color: inherit; }

/* start and admin pages */
h2 { font-size: 1.1rem; margin: 0 0 8px; }
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; margin-bottom: 14px;
}
form.panel { display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
input {
  font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px;
}
form button { align-self: flex-start; }
.link-row { margin-bottom: 12px; }
.link-label { font-weight: 600; margin-bottom: 4px; }
.link-line { display: flex; gap: 8px; }
.link-line input { flex: 1; min-width: 0; font-family: ui-monospace, monospace; font-size: 0.85em; }
.warning { color: var(--broken); font-weight: 600; }
.player-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; }
.player-row .name { font-weight: 600; }
.player-row button { margin-left: auto; }
.panel > button { margin: 4px 8px 4px 0; }
button.danger { color: var(--dead); border-color: var(--dead); }
[hidden] { display: none !important; }

/* phones: one card per place */
@media (max-width: 640px) {
  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  table { background: none; border: none; }
  tr {
    background: var(--card); border: 1px solid var(--line); border-radius: 8px;
    margin-bottom: 10px; padding: 4px 0;
  }
  td { border: none; padding: 3px 12px; }
  td.place { font-weight: 600; display: flex; justify-content: space-between; }
  td[data-player]::before { content: attr(data-player) ": "; color: var(--muted); }
  td.status-cell { display: none; }
  td.empty { display: none; }
  .mobile-status { display: inline; }
}
