:root {
  color-scheme: dark;
  --bg: #0d0e10;
  --fg: #eceae4;
  --muted: #9a978f;
  --line: #3a3934;
  --accent: #e7c75a;
  --pad: rgba(255, 255, 255, 0.16);
  --pad-down: rgba(255, 255, 255, 0.38);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  overscroll-behavior: none;
}

body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

/* Launcher screens */

.screen {
  max-width: 30rem;
  margin: 0 auto;
  padding: max(2rem, 6vh) 1rem 2rem;
}

.screen h1 {
  margin: 0 0 0.35rem;
  font-size: 1.7rem;
  font-weight: 700;
}

.screen p {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.5;
}

.big {
  display: block;
  width: 100%;
  margin: 0 0 0.75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
  background: #1b1c1f;
  color: var(--fg);
  font-size: 1.1rem;
  font-weight: 600;
  text-align: left;
}

.big small {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.big.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #17140a;
}

.big.primary small {
  color: #4b4228;
}

.big:disabled {
  opacity: 0.5;
}

.row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin: 0 0 1rem;
}

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

.row input {
  flex: 1;
  min-width: 0;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: #151619;
  color: var(--fg);
  font: inherit;
}

.status {
  min-height: 1.5rem;
  margin: 0 0 1rem;
  color: var(--fg);
}

.status.error {
  color: #ff8f7a;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: underline;
}

/* Game view */

.stage {
  position: fixed;
  inset: 0;
  background: #000;
  touch-action: none;
}

.stage canvas,
.stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.pill {
  position: absolute;
  top: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.3rem 0.75rem;
  border-radius: 1rem;
  background: rgba(0, 0, 0, 0.55);
  color: var(--fg);
  font-size: 0.85rem;
  pointer-events: none;
  transition: opacity 0.6s;
  white-space: nowrap;
}

.pill.quiet {
  opacity: 0;
}

/* On-screen gamepad */

.pad {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pad-stick-zone {
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 0;
  width: 48%;
  pointer-events: auto;
  touch-action: none;
}

.pad-stick {
  position: absolute;
  border-radius: 50%;
  background: var(--pad);
  pointer-events: none;
}

.pad-knob {
  position: absolute;
  left: 30%;
  top: 30%;
  width: 40%;
  height: 40%;
  border-radius: 50%;
  background: var(--pad-down);
}

.pad-face {
  position: absolute;
  right: max(1.2rem, env(safe-area-inset-right));
  bottom: 1.2rem;
  width: min(40vmin, 15rem);
  height: min(40vmin, 15rem);
}

.pad-btn {
  position: absolute;
  width: 34%;
  height: 34%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--pad);
  color: rgba(255, 255, 255, 0.85);
  font-size: min(2.6vmin, 0.8rem);
  pointer-events: auto;
  touch-action: none;
}

.pad-btn.down {
  background: var(--pad-down);
}

.pad-jump {
  left: 33%;
  bottom: 0;
}

.pad-tag {
  left: 33%;
  top: 0;
}

.pad-action {
  left: 0;
  top: 33%;
}

.pad-special {
  right: 0;
  top: 33%;
}

.pad-start {
  left: 50%;
  top: 0.5rem;
  width: auto;
  height: auto;
  transform: translateX(-50%) translateY(2rem);
  padding: 0.35rem 0.9rem;
  border-radius: 1rem;
}
