:root {
  --bg: #07080b;
  --bg-2: #101217;
  --bg-3: #171a21;
  --ink: #f4f6fb;
  --muted: #8b93a7;
  --line: rgba(255, 255, 255, 0.08);
  --accent: #3ee0b8;
  --accent-2: #7cf0d2;
  --accent-dim: rgba(62, 224, 184, 0.14);
  --danger: #ff7a70;
  --danger-dim: rgba(255, 122, 112, 0.14);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --r: 18px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(900px 420px at 8% -10%, rgba(62, 224, 184, 0.12), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(90, 140, 255, 0.08), transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: "Instrument Sans", "Segoe UI", sans-serif;
  letter-spacing: -0.01em;
}

body { min-height: 100vh; }

#app {
  max-width: 980px;
  margin: 0 auto;
  padding: 22px 22px 56px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 40px;
}

.top-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand strong {
  display: block;
  font-size: 17px;
  font-weight: 650;
}

.brand span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(145deg, var(--accent-2), var(--accent) 60%, #149a7a);
  box-shadow: 0 0 0 4px var(--accent-dim), inset 0 1px 0 rgba(255,255,255,0.35);
  position: relative;
}

.mark::after {
  content: "";
  position: absolute;
  inset: 9px 8px 9px 16px;
  border: 2px solid #07110e;
  border-left: 0;
  border-radius: 0 7px 7px 0;
}

.kicker {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
  margin: 0 0 10px;
}

h1 {
  font-family: "Syne", "Instrument Sans", sans-serif;
  font-weight: 720;
  font-size: clamp(34px, 5.4vw, 56px);
  line-height: 1.05;
  margin: 0 0 28px;
  letter-spacing: -0.03em;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 22px;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.mode-switch button,
.card,
.ghost,
.danger,
.solid,
.join-form button {
  font: inherit;
  cursor: pointer;
}

.mode-switch button {
  text-align: left;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  transition: background 0.25s var(--ease), color 0.25s var(--ease);
}

.mode-switch button small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  opacity: 0.85;
}

.mode-switch button.on {
  background: var(--bg-3);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(62, 224, 184, 0.35);
}

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.card {
  text-align: left;
  background: var(--bg-2);
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  min-height: 210px;
  box-shadow: var(--shadow);
  transition: transform 0.28s var(--ease), border-color 0.28s var(--ease);
}

.card:hover {
  transform: translateY(-3px);
  border-color: rgba(62, 224, 184, 0.35);
}

.card .tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}

.card h2 {
  font-family: "Syne", sans-serif;
  font-weight: 700;
  font-size: 26px;
  margin: 0 0 8px;
  letter-spacing: -0.03em;
}

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

.card.share {
  background:
    linear-gradient(180deg, var(--accent-dim), transparent 42%),
    var(--bg-2);
}

.card.control {
  background:
    linear-gradient(180deg, rgba(90, 140, 255, 0.12), transparent 42%),
    var(--bg-2);
}

.hidden { display: none !important; }

.passcode {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: clamp(48px, 9vw, 84px);
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
  margin: 4px 0 8px;
  color: var(--ink);
}

.keep {
  color: var(--accent);
  line-height: 1.45;
  margin: 0 0 8px;
  font-size: 14px;
}

.status {
  color: var(--muted);
  min-height: 1.4em;
}

.preview-wrap {
  position: relative;
  margin: 20px 0;
  background: #040506;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--line);
  min-height: 52vh;
}

#hostPreview,
#hostVideo {
  display: block;
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.preview-wrap:fullscreen,
.preview-wrap:-webkit-full-screen {
  min-height: 100vh;
  background: #000;
}

.preview-wrap:fullscreen #hostVideo,
.preview-wrap:fullscreen #hostPreview {
  max-height: 100vh;
}

#hostVideo[hidden],
#remoteVideo[hidden],
#remote[hidden] {
  display: none !important;
}

.preview-hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  pointer-events: none;
}

.preview-wrap.has-frame .preview-hint { display: none; }

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ghost,
.danger,
.solid,
.join-form button {
  border-radius: 999px;
  padding: 11px 16px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  transition: background 0.2s var(--ease), transform 0.2s var(--ease);
}

.ghost:hover { background: var(--bg-3); }

.solid,
.join-form button {
  background: var(--accent);
  color: #06241c;
  border-color: transparent;
  font-weight: 700;
}

.solid:hover,
.join-form button:hover { background: var(--accent-2); }

.danger {
  border-color: transparent;
  background: var(--danger-dim);
  color: var(--danger);
}

.join-form {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 8px 0 18px;
}

#codeInput,
#settings input:not([type="checkbox"]) {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 14px;
  padding: 15px 16px;
  font: inherit;
}

#codeInput:focus,
#settings input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

#codeInput {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 34px;
  letter-spacing: 0.16em;
  width: min(420px, 100%);
  text-align: center;
}

.viewer, #view { max-width: none; }

.session-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.session-bar span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

#stage {
  position: relative;
  background: #040506;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
}

#remote,
#remoteVideo {
  display: block;
  width: 100%;
  height: 100%;
  max-height: calc(100vh - 120px);
  object-fit: contain;
  cursor: none;
  background: #000;
}

#viewHint {
  position: absolute;
  left: 16px;
  bottom: 16px;
  background: rgba(7, 8, 11, 0.82);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--muted);
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink);
  margin: 12px 0;
}

.check input { margin-top: 3px; }

dialog {
  border: 1px solid var(--line);
  background: #101217;
  color: var(--ink);
  border-radius: 20px;
  width: min(480px, 92vw);
  padding: 24px;
  box-shadow: var(--shadow);
}

dialog::backdrop { background: rgba(4, 5, 8, 0.72); }

dialog h2 {
  font-family: "Syne", sans-serif;
  margin: 0 0 16px;
}

dialog label {
  display: block;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
}

dialog label input:not([type="checkbox"]) {
  display: block;
  width: 100%;
  margin-top: 6px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.opt { color: var(--accent); }

code { font-family: "IBM Plex Mono", ui-monospace, monospace; }

.screen { animation: rise 0.45s var(--ease); }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 800px) {
  .cards, .mode-switch { grid-template-columns: 1fr; }
  .join-form { flex-direction: column; align-items: stretch; }
}
