:root {
  color-scheme: dark;
  --bg: #0b0b10;
  --fg: #f2f2f2;
  --accent: #4ade80;
  --muted: #8a8a99;
  --line: #33333f;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, sans-serif;
  overscroll-behavior: none;
}

.screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  text-align: center;
}

h1 { font-size: 64px; letter-spacing: 0.2em; margin: 0 0 8px; font-weight: 800; }
h2 { margin: 0; }

button {
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  min-width: 220px;
  padding: 14px 28px;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #06210f;
}
button.secondary { background: transparent; color: var(--fg); border: 2px solid var(--line); }
button.link { background: none; color: var(--muted); min-width: 0; font-weight: 400; font-size: 16px; }
button:disabled { opacity: 0.5; }

.hint, .scan-note { color: var(--muted); margin: 0; max-width: 340px; }
.status { margin: 0; max-width: 340px; }

.code-box, .scan-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 360px;
}

.qr, video {
  width: min(88vw, 360px);
  aspect-ratio: 1;
  border-radius: 12px;
}
.qr { background: #fff; overflow: hidden; }
.qr svg { display: block; width: 100%; height: 100%; }
video { object-fit: cover; background: #000; }

textarea {
  width: 100%;
  padding: 8px;
  font: 12px ui-monospace, monospace;
  background: #16161d;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: none;
}

#game {
  position: relative;
  height: 100dvh;
  padding: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
canvas { display: block; touch-action: none; }

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(11, 11, 16, 0.82);
}
