:root {
  --bk: #0e100f;
  --surface: #181a19;
  --surface-2: #20221f;
  --border: #34362f;
  --text: #fffce1;
  --text-dim: #b9b9a8;
  --accent: #0ae448;
  --accent-2: #abff84;
  --accent-hover: #00bae2;
  --success: #0ae448;
  --danger: #ff5c5c;

  /* aliases so any old var name that slips through still resolves */
  --bg: var(--bk);
}

* { box-sizing: border-box; }
*, *::before, *::after { max-width: 100%; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Inter Tight', -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bk);
  color: var(--text);
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  /* Soft, understated depth behind the cards — no grid, no busy pattern,
     just a faint glow so the black doesn't feel completely flat. */
  background-image:
    radial-gradient(900px 600px at 50% 0%, rgba(10,228,72,.06), transparent 65%);
  background-attachment: fixed;
  overflow-x: hidden;
}
button { font-family: inherit; }

.topline {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(14,16,15,.9);
  position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; }
.mark { height: 40px; width: auto; display: block; filter: drop-shadow(0 4px 14px rgba(0,186,226,.35)); }
.topnav { display: flex; align-items: center; gap: 22px; }
.topnav > a:not(.home-link) {
  color: var(--text-dim); font-size: 13px; font-weight: 600; text-decoration: none;
  transition: color .2s;
}
.topnav > a:not(.home-link):hover { color: var(--accent-2); }
.home-link {
  color: var(--text-dim); font-size: 14px; font-weight: 600; text-decoration: none;
  border: 1px solid var(--border); border-radius: 100px; padding: 8px 16px;
  transition: color .2s, border-color .2s;
}
.home-link:hover { color: var(--text); border-color: var(--accent-2); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent-2); margin: 0 0 14px;
}
.eyebrow::before { content: ''; width: 20px; height: 3px; background: linear-gradient(90deg, var(--accent-hover), var(--accent)); transform: skewX(-25deg); }

/* ---- Pairing screen ---- */
.pair-screen {
  display: grid; grid-template-columns: 1.4fr 1fr; align-items: start; justify-content: center;
  gap: 22px; max-width: 1000px; margin: 0 auto;
  min-height: calc(100vh - 73px - 90px); padding: 56px 24px;
  position: relative;
}
@media(max-width:820px){ .pair-screen{ grid-template-columns: 1fr; max-width: 520px; } }
.code-only-screen { grid-template-columns: minmax(320px, .9fr) minmax(420px, 1.1fr); align-items: center; max-width: 1120px; min-height: calc(100vh - 73px - 90px); }
@media(max-width:820px){ .code-only-screen { grid-template-columns: 1fr; max-width: 640px; } .code-visual { min-height: 330px; } }
@media(max-width:980px){ .room-actions { grid-template-columns: 1fr; } }
.code-visual { position: relative; min-height: 470px; display: grid; place-items: center; overflow: hidden; }
.code-visual::before { content: ''; position: absolute; width: 76%; height: 76%; border: 1px solid rgba(10,228,72,.15); transform: rotate(-14deg); }
.code-visual::after { content: ''; position: absolute; width: 58%; height: 58%; border: 1px solid rgba(0,186,226,.18); transform: rotate(18deg); }
.code-terminal { position: relative; z-index: 2; width: min(430px, 82%); padding: 28px 30px 24px; border: 1px solid rgba(255,252,225,.72); background: #f7f7f0; color: #252927; box-shadow: 0 26px 80px rgba(0,0,0,.4), 0 0 0 12px rgba(10,228,72,.04); transform: rotate(-3deg); }
.code-terminal::before { content: ''; position: absolute; inset: 9px; border: 1px solid rgba(37,41,39,.16); pointer-events: none; }
.terminal-head { position: relative; z-index: 1; display: flex; justify-content: space-between; color: #148d65; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.terminal-live { display: inline-flex; align-items: center; gap: 6px; color: #1198b0; }
.terminal-live i, .terminal-status i { width: 7px; height: 7px; display: inline-block; border-radius: 50%; background: #0ae448; box-shadow: 0 0 10px rgba(10,228,72,.7); animation: codeBlink 1.6s ease-in-out infinite; }
.code-cells { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin: 38px 0 26px; }
.code-cells span { display: grid; place-items: center; aspect-ratio: 1; border: 3px solid #19b988; border-radius: 10px; color: #39413b; font-size: clamp(22px, 4vw, 32px); font-weight: 600; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.terminal-status { position: relative; z-index: 1; display: flex; align-items: center; gap: 9px; margin: 0; color: #148d65; font-size: 13px; font-weight: 700; }
.terminal-line { position: relative; z-index: 1; height: 3px; margin-top: 20px; background: #19b988; }
.terminal-line-b { width: 62%; margin-top: 8px; background: #0bb0c9; }
.code-float { z-index: 3; }
@keyframes codeBlink { 0%,100% { opacity: .45; } 50% { opacity: 1; } }
.code-orbit { position: absolute; width: 68%; aspect-ratio: 1; border: 1px solid rgba(171,255,132,.26); border-radius: 50%; }
.code-orbit-back { transform: rotate(34deg) scaleY(.38); animation: codeOrbitBack 8s linear infinite; }
.code-orbit-front { border-color: rgba(0,186,226,.38); transform: rotate(-28deg) scaleY(.24); animation: codeOrbitFront 6s linear infinite reverse; }
.code-core { position: relative; z-index: 2; width: 154px; height: 154px; display: grid; place-items: center; border: 1px solid rgba(255,252,225,.5); border-radius: 24px; background: var(--surface); box-shadow: 0 0 0 12px rgba(10,228,72,.04), 0 24px 60px rgba(0,0,0,.34); transform: rotate(-8deg); }
.code-core-mark { color: var(--accent-2); font-size: 58px; font-weight: 800; line-height: 1; transform: translateY(-6px); }
.code-core-line { position: absolute; height: 3px; border-radius: 99px; background: var(--accent); left: 34px; right: 34px; }
.code-core-line-a { bottom: 36px; }
.code-core-line-b { bottom: 26px; right: 52px; background: var(--accent-hover); }
.code-core-line-c { bottom: 16px; left: 52px; background: var(--text); opacity: .65; }
.code-float { position: absolute; z-index: 3; padding: 9px 12px; border: 1px solid var(--border); border-radius: 999px; background: rgba(24,26,25,.92); color: var(--text); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.code-float-a { top: 20%; right: 9%; color: var(--accent-2); animation: codeFloatA 4s ease-in-out infinite; }
.code-float-b { left: 4%; top: 38%; color: var(--accent-hover); animation: codeFloatB 5s ease-in-out infinite; }
.code-float-c { right: 12%; bottom: 19%; color: var(--text-dim); animation: codeFloatC 4.5s ease-in-out infinite; }
.code-spark { position: absolute; z-index: 3; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 18px var(--accent); }
.code-spark-a { top: 21%; left: 21%; animation: codeSpark 2.8s ease-in-out infinite; }
.code-spark-b { right: 19%; top: 56%; background: var(--accent-hover); box-shadow: 0 0 18px var(--accent-hover); animation: codeSpark 3.4s ease-in-out .4s infinite; }
.code-spark-c { left: 26%; bottom: 19%; background: var(--accent-2); box-shadow: 0 0 18px var(--accent-2); animation: codeSpark 3s ease-in-out .8s infinite; }
@keyframes codeOrbitBack { 0%,100% { transform: rotate(34deg) scaleY(.38); } 50% { transform: rotate(214deg) scaleY(.38); } }
@keyframes codeOrbitFront { 0%,100% { transform: rotate(-28deg) scaleY(.24); } 50% { transform: rotate(152deg) scaleY(.24); } }
@keyframes codeFloatA { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes codeFloatB { 0%,100% { transform: translateX(0); } 50% { transform: translateX(8px); } }
@keyframes codeFloatC { 0%,100% { transform: translateY(0); } 50% { transform: translateY(7px); } }
@keyframes codeSpark { 0%,100% { opacity: .35; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.25); } }
.room-card { padding: 42px; }
.room-card h1 { max-width: 520px; font-size: clamp(30px, 4vw, 44px); line-height: 1.04; }
.room-card > .sub { max-width: 620px; }
.room-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-top: 22px; }
.room-create, .room-join { padding: 18px; border: 1px solid var(--border); border-radius: 16px; background: rgba(32,34,31,.55); }
.action-label { display: block; margin-bottom: 12px; color: var(--accent-2); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.room-create button { width: 100%; }
.room-create p, .room-join p { margin: 11px 0 0; color: var(--text-dim); font-size: 12px; line-height: 1.45; }
.room-join .join-row { margin-top: 0; }
.room-code-display { margin-top: 18px; padding: 20px; border: 1px solid rgba(10,228,72,.34); border-radius: 16px; background: rgba(10,228,72,.06); text-align: center; }
.room-code-label { margin: 0 0 8px; color: var(--accent-2); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.room-code-help { margin: 12px auto 0; max-width: 420px; color: var(--text-dim); font-size: 12px; line-height: 1.5; }
.privacy-line { display: flex; align-items: center; gap: 8px; margin: 20px 0 0; color: var(--text-dim); font-size: 12px; }
.privacy-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
.pair-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 24px;
  padding: 40px; width: 100%; text-align: center;
  position: relative; overflow: hidden;
}
.pair-card h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 10px; }
.pair-card h2 { font-size: 19px; font-weight: 800; letter-spacing: -.01em; margin: 0 0 6px; color: var(--text); }
.sub { color: var(--text-dim); font-size: 14px; line-height: 1.6; margin: 0 0 24px; }

/* Keep the discovery card calm and stable while devices appear. */
.grab-card {
  padding-top: 52px;
}

/* The fallback card is genuinely secondary — smaller, quieter, so the eye
   lands on the real feature first. */
.fallback-card {
  border-style: dashed;
  padding: 32px 28px;
  align-self: center;
  opacity: .92;
}
.fallback-card h2 { font-size: 16px; }


/* Auto-detected device list */
.device-empty {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: var(--text-dim); font-size: 13px; padding: 24px 0;
  flex-wrap: wrap;
}
.device-empty.hidden { display: none; }
.connection-status {
  color: var(--danger); font-size: 12px; line-height: 1.6;
  background: rgba(255,92,92,0.1); border: 1px solid rgba(255,92,92,0.4);
  border-radius: 10px; padding: 10px 14px; margin: -8px 0 18px;
}
.connection-status.hidden { display: none; }
.network-fingerprint { color: var(--text-dim); font-size: 11px; letter-spacing: 1px; margin: -10px 0 18px; }
.network-fingerprint.hidden { display: none; }
.my-name-row { display: flex; align-items: center; gap: 8px; margin: -10px 0 18px; }
.my-name-label { color: var(--text-dim); font-size: 12px; white-space: nowrap; }
.my-name-input {
  background: none; border: none; border-bottom: 1px dashed var(--border);
  color: var(--text); font-size: 13px; font-weight: 600; padding: 2px 4px;
  min-width: 120px; flex: 1;
}
.my-name-input:focus { outline: none; border-bottom-color: var(--accent); }
.stage-files-panel { display:flex; align-items:center; justify-content:space-between; gap:16px; text-align:left; margin:24px 0 20px; padding:14px 16px; border:1px solid rgba(171,255,132,.24); border-radius:14px; background:rgba(10,228,72,.045); }
.stage-files-panel strong,.stage-files-panel span { display:block; }
.stage-files-panel strong { font-size:13px; color:var(--text); margin-bottom:4px; }
.stage-files-panel span { color:var(--text-dim); font-size:12px; }
.stage-files-actions { display:flex; gap:8px; flex-shrink:0; }
.stage-files-actions button { padding:8px 11px; font-size:11px; }
.pair-hint,.fallback-help { color:var(--text-dim); font-size:11px; line-height:1.5; margin:14px auto 0; max-width:420px; }
.fallback-help { margin-top:0; text-align:left; }
.refresh-devices-btn { padding:7px 10px; font-size:11px; }
.scan-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: pulse 1.4s infinite ease-in-out;
}
@keyframes pulse { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }

.device-list { list-style: none; margin: 0 0 18px; padding: 0; text-align: left; }
.device-list.hidden { display: none; }
.device-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bk); border: 1px solid var(--border); border-radius: 14px;
  padding: 13px 15px; margin-bottom: 8px;
}
.device-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--success); flex-shrink: 0; }
.device-name { flex: 1; font-size: 13px; font-weight: 600; }
.device-connect-btn { font-size: 12px; padding: 7px 14px; }
.device-connect-btn:disabled { opacity: 0.5; cursor: default; }

button {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 100px; padding: 11px 18px; font-size: 13px; font-weight: 700;
  cursor: pointer; transition: border-color .2s, background .2s, transform .15s;
}
button:hover { border-color: var(--accent-2); }
button:active { transform: scale(.97); }
button.cta {
  background: linear-gradient(110deg, var(--accent-hover), var(--accent) 65%, var(--accent-2));
  border-color: transparent; color: var(--bk); font-weight: 800; padding: 15px; font-size: 15px; width: 100%;
}
button.cta:hover { filter: brightness(1.06); }
button.cta.hidden { display: none; }

.fallback-card { border-style: dashed; }

.pair-actions { display: flex; flex-direction: column; gap: 16px; }
.divider { display: flex; align-items: center; color: var(--text-dim); font-size: 11px; gap: 10px; font-weight: 700; letter-spacing: .05em; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.join-row { display: flex; gap: 8px; }
.join-row input {
  flex: 1; background: var(--bk); border: 1px solid var(--border); border-radius: 12px;
  padding: 12px 14px; color: var(--text); font-size: 16px; letter-spacing: 4px; text-align: center;
  font-family: inherit;
}
.join-row input:focus { outline: 0; border-color: var(--accent-2); }

.room-code-display { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--border); }
.room-code-display.hidden { display: none; }
.room-code { font-size: 38px; font-weight: 800; letter-spacing: 8px; color: var(--accent-2); margin-bottom: 10px; }
.waiting { color: var(--text-dim); font-size: 13px; }
.waiting::after {
  content: ''; display: inline-block; width: 6px; height: 6px; margin-left: 6px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.4s infinite ease-in-out;
}

.pair-error { color: var(--danger); font-size: 13px; margin-top: 16px; }
.pair-error.hidden { display: none; }
.hidden { display: none; }

.invite-dialog {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(4,6,5,.72); backdrop-filter: blur(12px);
}
.invite-dialog.hidden { display: none; }
.invite-panel {
  position: relative;
  width: min(460px, 100%); padding: 32px; border: 1px solid var(--border); border-radius: 22px;
  background: var(--surface); box-shadow: 0 24px 80px rgba(0,0,0,.5); text-align: center;
}
.dialog-dismiss {
  position: absolute; top: 14px; right: 16px; width: 34px; height: 34px;
  display: grid; place-items: center; padding: 0; border: 1px solid var(--border);
  border-radius: 50%; background: transparent; color: var(--text-dim);
  font-size: 22px; line-height: 1; cursor: pointer;
}
.dialog-dismiss:hover { color: var(--text); border-color: var(--accent-2); }
.invite-panel h2 { margin: 0 0 12px; font-size: 26px; }
.invite-message { margin: 0; color: var(--text-dim); line-height: 1.6; }
.invite-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 26px; }
.invite-actions .cta { width: 100%; }
.role-actions { grid-template-columns: 1fr 1.35fr; }
@media (max-width: 600px) {
  .invite-dialog { padding: 16px; }
  .invite-panel { padding: 26px 20px; }
  .invite-actions { grid-template-columns: 1fr; }
}

.browser-note { grid-column: 1 / -1; color: var(--text-dim); font-size: 12px; max-width: 460px; text-align: center; margin: 0 auto; }

/* ---- Air Grab stage ---- */
.stage { position: relative; width: 100vw; height: calc(100dvh - 73px); min-height: 0; overflow: hidden; background: #000; }
#video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
#ringCanvas { position: absolute; inset: 0; pointer-events: none; }

.top-bar {
  position: absolute; top: 16px; left: 16px; right: 16px;
  display: flex; align-items: center; gap: 10px; z-index: 10;
  background: rgba(14,16,15,0.6); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: 14px; padding: 9px 14px;
  padding-right: 112px;
}
.top-bar button { background: var(--accent); color: var(--bk); border-color: transparent; font-weight: 800; }
.camera-mode-label { color: var(--text-dim); font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.top-bar #addMoreBtn { background: var(--surface-2); color: var(--text); border-color: var(--border); font-size: 11px; padding: 8px 11px; margin-left: 8px; }
.top-bar button:hover { background: var(--accent-2); }
.staged-summary { font-size: 12px; color: var(--text-dim); margin-left: auto; font-weight: 600; }

#exitBtn {
  position: absolute; top: 16px; right: 16px; z-index: 11;
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(14,16,15,0.82); border: 1px solid rgba(255,255,255,.28);
  color: var(--text); border-radius: 10px; padding: 9px 13px; font-size: 12px; font-weight: 800;
  box-shadow: 0 8px 24px rgba(0,0,0,.24); transition: background .2s, border-color .2s, transform .2s;
}
#exitBtn:hover { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.55); transform: translateY(-1px); }
.exit-icon { font-size: 19px; line-height: .7; font-weight: 400; }

.gesture-status {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 10; background: rgba(14,16,15,0.65); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--border); border-radius: 999px; padding: 9px 20px;
  font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--text);
}

.incoming-banner {
  position: absolute; bottom: 68px; left: 50%; transform: translateX(-50%);
  z-index: 10; background: rgba(10,228,72,0.14); color: var(--text);
  border: 1px solid rgba(10,228,72,0.5); border-radius: 999px;
  padding: 9px 20px; font-size: 13px; font-weight: 600; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.incoming-banner.hidden { display: none; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 13px 20px; border-radius: 14px; font-size: 13px; font-weight: 600; z-index: 20;
}
.toast.hidden { display: none; }

.grab-pulse { --c1:#3f9bff; --c2:#a6ecff; position:absolute; left:var(--gx,50%); top:var(--gy,50%); width:var(--orb-size,120px); height:var(--orb-size,120px); margin:calc(var(--orb-size,120px) / -2); z-index:9; pointer-events:none; }
.grab-pulse i { position:absolute; inset:0; border-radius:50%; box-sizing:border-box; opacity:0; }
.grab-pulse .gb-aura { inset:-80%; background:radial-gradient(circle,rgba(166,236,255,.95) 0%,rgba(63,155,255,.6) 26%,rgba(63,155,255,.2) 48%,transparent 70%); filter:blur(8px); mix-blend-mode:screen; }
.grab-pulse .gb-ring { border:7px solid #fff; box-shadow:0 0 18px var(--c2),0 0 46px var(--c1),inset 0 0 16px var(--c2); }
.grab-pulse .gb-ring-2 { border-width:4px; border-color:var(--c2); }
.grab-pulse .gb-ring-3 { border-width:2px; border-color:var(--c1); }
.grab-pulse .gb-core { inset:27%; background:radial-gradient(circle at 38% 32%,#fff 0%,#c8f0ff 32%,var(--c1) 100%); box-shadow:0 0 22px #fff,0 0 60px var(--c1),0 0 110px var(--c1); }
.grab-pulse .gb-flash { border:5px solid #fff; box-shadow:0 0 30px var(--c2); }
.grab-pulse.hidden { display: none; }
.grab-pulse.playing .gb-aura { animation:gb-aura 1.4s ease-in forwards,gb-hold 1.2s ease-in-out 1.4s infinite; }
.grab-pulse.playing .gb-ring { animation:gb-ring 1.05s cubic-bezier(.6,0,.3,1) forwards; }
.grab-pulse.playing .gb-ring-2 { animation-delay:.14s; }
.grab-pulse.playing .gb-ring-3 { animation-delay:.28s; }
.grab-pulse.playing .gb-core { animation:gb-core 1.4s ease-out forwards,gb-pulse 1.2s ease-in-out 1.4s infinite; }
.grab-pulse.playing .gb-flash { animation:gb-flash 1.4s ease-out forwards; }
@keyframes gb-aura { 0%{transform:scale(1.8);opacity:0}40%{opacity:.6}75%{transform:scale(.45);opacity:1}82%{transform:scale(.62)}100%{transform:scale(.5);opacity:.9} }
@keyframes gb-hold { 0%,100%{transform:scale(.5);opacity:.8}50%{transform:scale(.64);opacity:1} }
@keyframes gb-ring { 0%{transform:scale(2.7);opacity:0}15%{opacity:1}85%{opacity:1}100%{transform:scale(.28);opacity:0} }
@keyframes gb-core { 0%,70%{transform:scale(0);opacity:0}76%{transform:scale(1.3);opacity:1}86%{transform:scale(.92);opacity:1}100%{transform:scale(1);opacity:1} }
@keyframes gb-pulse { 0%,100%{transform:scale(1);opacity:1}50%{transform:scale(1.09);opacity:1} }
@keyframes gb-flash { 0%,72%{transform:scale(.3);opacity:0}75%{transform:scale(.5);opacity:1}100%{transform:scale(2.3);opacity:0} }

.orb-burst {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 15;
  background: radial-gradient(circle at var(--ox,50%) var(--oy,50%), rgba(255,255,255,.12) 0, rgba(255,255,255,.035) 16%, rgba(255,255,255,0) 38%);
  opacity: 0;
  overflow: hidden;
}
.orb-burst.hidden { display: none; }
.orb-burst.playing { animation: bloomWash 2.8s ease-out forwards; }
.orb-core,.orb-halo,.orb-shockwave,.orb-flash { position: absolute; left: var(--ox,50%); top: var(--oy,50%); pointer-events: none; }
.orb-core { width: var(--orb-size,64px); height: var(--orb-size,64px); margin: calc(var(--orb-size,64px) / -2); border-radius: 50%; opacity: 0; background: radial-gradient(circle, rgba(255,255,255,.3) 0, rgba(255,255,255,.1) 48%, transparent 72%); border: max(6px, calc(var(--orb-size,64px) * .085)) solid #fff; box-shadow: 0 0 28px rgba(255,255,255,1), inset 0 0 22px rgba(255,255,255,.5), 0 0 96px rgba(166,220,255,.9); z-index: 4; }
.orb-halo { width: var(--bloom-size,1200px); height: var(--bloom-size,1200px); margin: calc(var(--bloom-size,1200px) / -2); border-radius: 50%; opacity: 0; background: radial-gradient(circle, rgba(255,255,255,.24) 0 7%, rgba(221,244,255,.1) 18%, rgba(255,255,255,0) 52%); filter: blur(5px); z-index: 1; }
.orb-shockwave { width: var(--bloom-size,1200px); height: var(--bloom-size,1200px); margin: calc(var(--bloom-size,1200px) / -2); border: clamp(3px, .32vw, 6px) solid rgba(255,255,255,.98); border-radius: 50%; opacity: 0; box-shadow: 0 0 34px rgba(255,255,255,.9), inset 0 0 30px rgba(255,255,255,.42); z-index: 3; }
.orb-shockwave-b { border-color: rgba(196,234,255,.64); }
.orb-flash { inset: 0; background: radial-gradient(circle at var(--ox,50%) var(--oy,50%), rgba(255,255,255,.8) 0, rgba(255,255,255,.24) 8%, rgba(255,255,255,0) 34%); opacity: 0; z-index: 5; }
.orb-burst.playing .orb-core { animation: receiveCore 2.8s cubic-bezier(.2,.8,.2,1) forwards; }
.orb-burst.playing .orb-halo { animation: receiveHalo 2.8s ease-out forwards; }
.orb-burst.playing .orb-shockwave-a { animation: receiveRing 1.5s cubic-bezier(.2,.8,.2,1) .42s forwards; }
.orb-burst.playing .orb-shockwave-b { animation: receiveRing 1.5s cubic-bezier(.2,.8,.2,1) .62s forwards; }
.orb-burst.playing .orb-flash { animation: receiveFlash 1.3s ease-out .45s forwards; }
@keyframes bloomWash { 0% { opacity: 0; } 14% { opacity: 1; } 42% { opacity: .82; } 100% { opacity: 0; } }
@keyframes receiveCore { 0% { transform: scale(2.5); opacity: 0; } 16% { transform: scale(.9); opacity: 1; } 28% { transform: scale(1.06); } 36% { transform: scale(1); } 78% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.04); opacity: 0; } }
@keyframes receiveHalo { 0% { transform: scale(.3); opacity: 0; } 18% { transform: scale(.95); opacity: 1; } 40% { transform: scale(1.12); opacity: .85; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes receiveRing { 0% { transform: scale(.012); opacity: .9; } 100% { transform: scale(1); opacity: 0; } }
@keyframes receiveFlash { 0% { transform: scale(.3); opacity: 0; } 15% { transform: scale(.5); opacity: .9; } 100% { transform: scale(2.3); opacity: 0; } }

@media (max-width: 700px) {
  .top-bar { top: 10px; left: 10px; right: 10px; gap: 7px; padding: 7px 9px; padding-right: 9px; }
  .top-bar button { padding: 8px 10px; font-size: 12px; }
  .staged-summary { min-width: 0; max-width: 42%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #exitBtn { top: 10px; right: 10px; padding: 8px 10px; font-size: 11px; }
  .gesture-status { bottom: 14px; max-width: calc(100vw - 28px); padding: 8px 14px; font-size: 12px; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .grab-pulse.playing, .grab-pulse.playing *, .orb-burst.playing, .orb-burst.playing * { animation-duration: .01ms; }
}

/* ---- Receive screen: what replaces the camera the instant a catch is
   confirmed, so the camera never lingers or "hangs" through the transfer ---- */
.receive-screen {
  display: flex; align-items: center; justify-content: center;
  position:relative; overflow:hidden;
  width: 100vw; min-height: 0; height: calc(100dvh - 73px); background: radial-gradient(circle at 50% 40%, rgba(0,186,226,.09), transparent 42%), var(--bk);
}
.receive-screen.hidden { display: none; }
.receive-screen::before,.receive-screen::after { content:''; position:absolute; border:1px solid rgba(171,255,132,.12); border-radius:50%; pointer-events:none; }
.receive-screen::before { width:min(72vw,760px); aspect-ratio:1; }
.receive-screen::after { width:min(46vw,480px); aspect-ratio:1; border-color:rgba(0,186,226,.13); }
.receive-card {
  position:relative; z-index:1; background:rgba(24,26,25,.92); border: 1px solid var(--border); border-radius: 24px;
  padding: 56px 64px; width: min(620px, calc(100% - 40px)); min-height:360px; display:flex; flex-direction:column; justify-content:center; text-align: center;
}
.receive-card::before { content: ''; display: block; width: 42px; height: 3px; margin: 0 auto 22px; border-radius: 99px; background: linear-gradient(90deg, var(--accent-hover), var(--accent)); }
.receive-kicker { color: var(--accent-2); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 18px; }
.receive-icon { font-size: 54px; line-height:1; margin-bottom: 22px; }
.receive-card h2 { font-size: clamp(28px,4vw,44px); font-weight: 800; letter-spacing:-.03em; margin: 0 0 24px; }
.progress-track { background: var(--bk); border: 1px solid var(--border); border-radius: 999px; height: 8px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent-hover), var(--accent)); width: 0%; transition: width .2s ease; }
.receive-sub { color: var(--text-dim); font-size: 15px; margin: 16px 0 0; }
.receive-card .cta { margin-top: 32px; min-height:56px; font-size:16px; }
.receive-card .cta.hidden { display: none; }

/* ---- App footer (only on the pairing screen; hidden during camera/receive) ---- */
.app-footer {
  display: flex; align-items: center; justify-content: center; gap: 18px; flex-wrap: wrap;
  padding: 24px; border-top: 1px solid var(--border); color: var(--text-dim);
  font-size: 13px; font-weight: 600;
}
.app-footer span { margin-right: auto; }
.app-footer a { color: var(--text-dim); }
.app-footer a:hover { color: var(--accent-2); }
body:has(#grabScreen:not(.hidden)) .app-footer,
body:has(#receiveScreen:not(.hidden)) .app-footer { display: none; }
html:has(#grabScreen:not(.hidden)),
html:has(#receiveScreen:not(.hidden)),
body:has(#grabScreen:not(.hidden)),
body:has(#receiveScreen:not(.hidden)) { overflow: hidden; height: 100dvh; }

@media (max-width: 600px) {
  .topline { padding: 13px 16px; }
  .topnav { gap: 10px; }
  .topnav > a:not(.home-link) { display: none; }
  .home-link { padding: 7px 11px; font-size: 12px; }
  .pair-screen { width: 100%; max-width: none; padding: 32px 16px 44px; gap: 16px; }
  .code-only-screen { min-height: calc(100vh - 66px); padding-top: 24px; }
  .code-visual { min-height: 260px; }
  .code-core { width: 112px; height: 112px; border-radius: 18px; }
  .code-core-mark { font-size: 42px; }
  .code-float { font-size: 8px; padding: 7px 9px; }
  .room-card { padding: 28px 20px; }
  .room-actions { grid-template-columns: 1fr; }
  .pair-card { border-radius: 18px; padding: 28px 20px; }
  .grab-card { padding-top: 34px; }
  .stage-files-panel { align-items:stretch; flex-direction:column; }
  .stage-files-actions { width:100%; }
  .stage-files-actions button { flex:1; }
  .join-row { flex-wrap: wrap; }
  .join-row input { min-width: 0; width: 100%; }
  .join-row button { width: 100%; }
  .browser-note { padding-inline: 8px; }
  .receive-screen { min-height: 0; height: calc(100dvh - 66px); }
  .receive-card { width: calc(100% - 32px); min-height: 0; padding: 34px 22px 30px; border-radius: 20px; }
  .receive-card h2 { font-size: clamp(25px, 8vw, 34px); line-height: 1.05; }
  .receive-sub { line-height: 1.45; }
  .app-footer { padding: 20px 16px; justify-content: flex-start; gap: 14px; }
  .app-footer span { width: 100%; margin-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .code-orbit-back, .code-orbit-front, .code-float-a, .code-float-b, .code-float-c, .terminal-live i, .terminal-status i { animation: none; }
}

@media (max-width: 700px) {
  .camera-mode-label { display: none; }
  .staged-summary { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top-bar #addMoreBtn { margin-left: 0; font-size: 10px; padding: 7px 8px; }
  .top-bar { padding-right: 112px; }
}
