:root {
  color-scheme: dark;
  --bg: #141414;
  --fg: #d8d8d8;
  --muted: #8a8a8a;
  --btn: #2a2a2a;
  --btn-hover: #3a3a3a;
  --accent: #4a8cff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left));
}

#stage {
  position: relative;
  width: min(100%, calc((100vh - 150px) * 4 / 3));
  min-width: 280px;
  aspect-ratio: 4 / 3;
  background: #000;
}

#screen {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: default;
}

#name-input {
  position: absolute;
  background: #fff;
  color: #000;
  border: 1px solid #000;
  border-radius: 0;
  padding: 0 2px;
  font: bold 16px Arial, Helvetica, sans-serif;
  outline: none;
}

#loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 20px;
  background: #000;
}
#loading[hidden] { display: none; }

#toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

#toolbar button {
  background: var(--btn);
  color: var(--fg);
  border: 1px solid #444;
  border-radius: 4px;
  padding: 5px 10px;
  font: inherit;
  cursor: pointer;
}
#toolbar button:hover { background: var(--btn-hover); }
#toolbar button[aria-pressed="true"] { border-color: var(--accent); color: #fff; }
#toolbar button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

#help, #legal {
  max-width: 800px;
  margin: 0;
  text-align: center;
  color: var(--muted);
}
#legal { font-size: 12px; }
#legal a { color: inherit; }

body.fullscreen #toolbar,
body.fullscreen #help,
body.fullscreen #legal { display: none; }
body.fullscreen #stage { width: min(100vw, 100vh * 4 / 3); }
