:root {
  --bg: #0e1116;
  --panel: #171b22;
  --line: #262c36;
  --fg: #e6e9ef;
  --muted: #8b94a5;
  --accent: #4f8cff;
  --danger: #e05260;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  display: grid;
  place-items: center;
}

.hidden { display: none !important; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px;
  width: min(420px, 92vw);
  text-align: center;
}

h1 { margin: 0 0 4px; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.hint { margin: 0 0 20px; color: var(--muted); font-size: 13px; }

#join-form { display: flex; gap: 8px; }

#code {
  flex: 1;
  padding: 11px 14px;
  background: #0e1116;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--fg);
  font: 600 17px/1 ui-monospace, "SF Mono", Consolas, monospace;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
}
#code:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

button {
  padding: 11px 18px;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  color: #fff;
  font: 600 14px/1 inherit;
  cursor: pointer;
}
button:disabled { opacity: 0.5; cursor: default; }
button.danger { background: var(--danger); }

.toggle {
  display: flex; align-items: center; gap: 8px;
  margin-top: 18px; color: var(--muted); font-size: 12px;
}
.toggle em { font-style: normal; opacity: 0.7; }

#status { margin: 16px 0 0; min-height: 1.5em; color: var(--muted); font-size: 13px; }
#status.error { color: var(--danger); }

/* --- Stage --- */
#stage { display: grid; gap: 12px; place-items: center; padding: 16px; }

#screen-wrap {
  position: relative;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
  line-height: 0;
}

#screen {
  display: block;
  max-height: calc(100vh - 110px);
  max-width: 100vw;
  touch-action: none;      /* we translate pointer events ourselves */
  cursor: crosshair;
}

#controls { display: flex; align-items: center; gap: 8px; }
#controls button { padding: 9px 16px; background: var(--panel); border: 1px solid var(--line); }
#controls button.danger { background: var(--danger); border-color: var(--danger); }

.link-info {
  margin: 0 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--muted);
  font: 500 11px/1.6 ui-monospace, Consolas, monospace;
}

#screen { object-fit: contain; }

.app-link { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.app-link a { color: var(--accent); text-decoration: none; }
.app-link a:hover { text-decoration: underline; }
.app-link .dim { display: block; margin-top: 3px; opacity: 0.6; font-size: 11px; }
.app-link .alt { display: inline-block; margin-top: 10px; }
