:root {
  --bg: #0d0c0b;
  --panel: #1a1816;
  --line: #2c2925;
  --text: #f3eee7;
  --muted: #9b948a;
  --accent: #ffb86b;
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 50% -10%, #221d17 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 15px/1.4 var(--font);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px;
}
.top h1 { font-size: 18px; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
.count { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #69db7c; box-shadow: 0 0 0 3px #69db7c33; }

main {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 0 24px 20px; gap: 12px;
}
.stage {
  position: relative;
  width: min(100%, calc((100vh - 150px) * 16 / 9));
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 30px 80px #0009, 0 0 0 1px var(--line);
}
.stage video { width: 100%; height: 100%; display: block; object-fit: contain; }
.waiting {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); font-size: 15px; pointer-events: none;
  transition: opacity .4s;
}
.waiting.gone { opacity: 0; }

.bar {
  width: min(100%, calc((100vh - 150px) * 16 / 9));
  display: flex; align-items: center; gap: 14px;
  color: var(--muted); font-size: 13px;
}
.host { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: 0; }
.host[hidden] { display: none; }
.host input[type=range] { flex: 1; accent-color: var(--accent); min-width: 80px; }
.time { font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }
.host:not([hidden]) ~ .spacer { display: none; }
.hint kbd {
  font: 12px var(--font); padding: 1px 6px; border-radius: 5px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
}

.btn {
  font: 500 13px var(--font); color: #1a1208; background: var(--accent);
  border: 0; border-radius: 8px; padding: 7px 14px; cursor: pointer;
  transition: transform .1s, filter .15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.btn.big { width: 100%; padding: 12px; font-size: 15px; border-radius: 10px; }

/* cursors */
.cursors { position: fixed; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.cursor { position: absolute; left: 0; top: 0; will-change: transform; transition: opacity .3s; }
.cursor.idle { opacity: .35; }
.cursor.off { opacity: 0; }
.cursor svg { display: block; filter: drop-shadow(0 1px 2px #0008); }
.tag {
  position: absolute; left: 14px; top: 18px; white-space: nowrap;
  font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  color: #111;
}
.bubble {
  position: absolute; left: 14px; top: 18px;
  max-width: 280px; width: max-content;
  padding: 7px 12px; border-radius: 4px 16px 16px 16px;
  color: #111; font-size: 15px; font-weight: 500; line-height: 1.3;
  word-wrap: break-word; box-shadow: 0 6px 20px #0006;
}
.bubble .who { display: block; font-size: 11px; font-weight: 600; opacity: .65; margin-bottom: 1px; }
.bubble.fade { animation: fade 1s ease 4s forwards; }
@keyframes fade { to { opacity: 0; transform: translateY(-4px); } }

.me { position: fixed; left: 0; top: 0; z-index: 30; pointer-events: none; }
.me[hidden] { display: none; }
.bubble.mine { pointer-events: auto; padding: 6px 10px; }
.bubble.mine input {
  font: 500 15px var(--font); color: #111; background: transparent; border: 0; outline: 0;
  width: 220px; padding: 0;
}
.bubble.mine input::placeholder { color: #0007; }

/* join gate */
.gate {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 16px;
  background: #0d0c0bcc; backdrop-filter: blur(14px);
}
.gate[hidden] { display: none; }
.card {
  width: min(380px, 100%); background: var(--panel); border-radius: 16px;
  padding: 28px; box-shadow: 0 0 0 1px var(--line), 0 40px 100px #000a;
  display: flex; flex-direction: column; gap: 10px;
}
.kicker { margin: 0; color: var(--muted); font-size: 13px; }
.card h2 { margin: 0 0 10px; font-size: 28px; letter-spacing: -0.02em; }
.card label { font-size: 13px; color: var(--muted); }
.card input {
  font: 16px var(--font); color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; outline: none;
}
.card input:focus { border-color: var(--accent); }
.small { margin: 4px 0 0; font-size: 12px; color: var(--muted); }

@media (max-width: 640px) {
  .top { padding: 12px 16px; }
  main { padding: 0 16px 16px; }
  .hint { display: none; }
}
