:root {
  color-scheme: dark;
  --bg: #131316;
  --panel: #1c1c1e;
  --line: #353945;
  --text: #eeeef0;
  --muted: #9a9daa;
  --accent: #f8ff13;
  --accent-text: #131316;
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  display: flex;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, sans-serif;
}

.panel {
  flex: 0 0 300px;
  padding: 16px;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

h1 { margin: 0; font-size: 18px; }

.muted { color: var(--muted); }

code { font-size: 0.92em; }

a { color: var(--text); }

fieldset {
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

label { display: block; margin-top: 8px; }

input:not([type="radio"]), select, button {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
}

input:not([type="radio"]), select {
  display: block;
  width: 100%;
  margin-top: 2px;
  padding: 6px 8px;
}

button { padding: 6px 10px; cursor: pointer; }

button:hover { border-color: var(--muted); }

small { display: block; color: var(--muted); font-size: 11px; }

.games, .presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.game {
  padding: 10px;
  text-align: left;
  font-weight: 600;
}

.game small { font-weight: 400; }

.game:hover, .game:focus-visible { border-color: var(--accent); }

#close { margin-top: 8px; }

.presets button { text-align: left; }

.size { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.actions { display: flex; gap: 6px; margin-top: 16px; }

.primary {
  flex: 1;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

/* The stage scrolls when the window is larger than the room for it, so the
   frame always has exactly the size asked for. */
.stage {
  flex: 1 1 auto;
  min-width: 0;
  overflow: auto;
  padding: 16px;
}

iframe {
  display: block;
  margin: 0 auto;
  border: 0;
  outline: 1px solid var(--line);
  background: #000;
}

@media (max-width: 720px) {
  body { flex-direction: column; }
  .panel { flex: 0 0 auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .stage { padding: 8px; }
}

.nav { display: flex; gap: 12px; margin: 6px 0 10px; }

.nav a { color: var(--muted); }

/* Pages other than the lobby are plain documents. */
body.page {
  display: block;
  height: auto;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

.page h2 { margin: 28px 0 8px; font-size: 15px; }

.page section { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.number { text-align: right; font-variant-numeric: tabular-nums; }

form.inline { display: inline-flex; gap: 6px; margin: 0; }

form.inline input { width: 9em; margin: 0; }

form.row { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }

form.row label { margin: 0; }

form.row .primary { flex: 0 0 auto; }

.error {
  padding: 8px 10px;
  border: 1px solid #ff6b6b;
  border-radius: 6px;
  color: #ffb3b3;
}

.prose dt { margin-top: 10px; font-weight: 600; }

.prose dd { margin: 2px 0 0; max-width: 70ch; color: var(--muted); }

.policies { max-width: 70ch; }

.policies label { margin-top: 16px; }

.policies select { margin-top: 4px; }

.policies .check input { margin-right: 6px; }

.policies .primary { margin-top: 20px; padding: 8px 24px; }

.health.up { color: #7ddc8a; }

.health.down { color: #ffb3b3; }

.account { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }

.account .balance { font-variant-numeric: tabular-nums; }

body.page.narrow { max-width: 420px; }

.login label { margin-top: 12px; }

.login .primary { margin-top: 16px; padding: 8px 24px; }

.check input { margin-right: 6px; }

.orientation { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 6px; }

button[aria-pressed="true"] { border-color: var(--accent); }

button:disabled { opacity: 0.5; cursor: default; }

#window-note { margin: 8px 0 0; font-size: 12px; }

.policies .repeat { margin-top: 16px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; }

.policies .repeat label { margin-top: 8px; }
