/* DevToolbox Connect (tools/connect.html). Site tokens only; dark mode follows them automatically. */
.cx-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.cx-page { --cx-ok: var(--ok); --cx-err: var(--err); --cx-warn: var(--warn); }
/* letterbox behind video: a fixed near-black in both themes, like any video player (the picture decides the colours) */
.cx-page { --cx-video-bg: #0b0f14; --cx-on-video: #fff; --cx-video-shade: rgba(0, 0, 0, .55); }
.cx-page .i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ------------------------------------------------------------------ hero */
.cx-hero {
  position: relative; isolation: isolate; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--space-6); align-items: center;
  padding: var(--space-7) var(--space-7); margin-bottom: var(--space-5);
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow);
}
.cx-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(60% 80% at 0% 0%, var(--glow-1), transparent 70%),
    radial-gradient(50% 70% at 100% 20%, var(--glow-2), transparent 70%),
    radial-gradient(60% 60% at 70% 110%, var(--glow-3), transparent 70%);
}
.cx-hero-text { grid-column: 1; grid-row: 1; min-width: 0; }
.cx-hero-art { grid-column: 2; grid-row: 1; }
.cx-hero > :not(.cx-hero-text):not(.cx-hero-art) { grid-column: 1 / -1; }
.cx-eyebrow {
  display: inline-flex; align-items: center; gap: 8px; margin: 0 0 var(--space-4);
  padding: 5px 12px; border-radius: 999px; font-size: .8rem; font-weight: 650; letter-spacing: .02em;
  color: var(--accent); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.cx-eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.cx-hero h1 { font-size: clamp(2rem, 4.6vw, 3.25rem); line-height: 1.06; letter-spacing: -.03em; margin: 0 0 var(--space-3); font-weight: 800; }
.cx-grad { background: linear-gradient(100deg, var(--accent), var(--accent-2) 55%, var(--accent-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cx-sub { font-size: 1.12rem; color: var(--muted); margin: 0 0 var(--space-5); max-width: 34em; }
.cx-hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.cx-hero-actions .btn { gap: 8px; }
.cx-trust { list-style: none; padding: 0; margin: var(--space-5) 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .86rem; color: var(--muted); }
.cx-trust li { display: inline-flex; align-items: center; gap: 7px; }
.cx-trust li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }

/* decorative call card */
.cx-hero-art { display: flex; justify-content: center; }
.cx-art-card {
  position: relative; width: min(100%, 340px); aspect-ratio: 1.05; border-radius: 26px;
  background: linear-gradient(160deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface-2));
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: grid; grid-template-columns: 1fr auto 1fr; grid-template-rows: 1fr auto auto; align-items: center; justify-items: center; padding: 26px 22px 20px;
}
.cx-art-peer { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.6rem; color: var(--on-accent); position: relative; }
.cx-art-peer::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid currentColor; opacity: .0; animation: cx-ring 2.4s var(--ease) infinite; }
.cx-art-a { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--on-accent); }
.cx-art-a::after { color: var(--accent); }
.cx-art-b { background: linear-gradient(135deg, var(--accent-3), var(--accent)); }
.cx-art-b::after { color: var(--accent-3); animation-delay: 1.2s; }
.cx-art-peer span { color: var(--on-accent); }
.cx-art-line { display: flex; gap: 6px; padding: 0 6px; }
.cx-art-line i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); opacity: .25; animation: cx-hop 1.4s infinite; }
.cx-art-line i:nth-child(2) { animation-delay: .2s; }
.cx-art-line i:nth-child(3) { animation-delay: .4s; }
.cx-art-wave { grid-column: 1 / -1; display: flex; align-items: center; gap: 5px; height: 40px; margin-top: 10px; }
.cx-art-wave i { width: 5px; border-radius: 4px; background: linear-gradient(var(--accent), var(--accent-2)); height: 30%; animation: cx-wave 1.1s ease-in-out infinite; }
.cx-art-wave i:nth-child(2) { animation-delay: .1s; } .cx-art-wave i:nth-child(3) { animation-delay: .25s; } .cx-art-wave i:nth-child(4) { animation-delay: .05s; }
.cx-art-wave i:nth-child(5) { animation-delay: .3s; } .cx-art-wave i:nth-child(6) { animation-delay: .15s; } .cx-art-wave i:nth-child(7) { animation-delay: .35s; }
.cx-art-label { grid-column: 1 / -1; margin: 10px 0 0; font-size: .82rem; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; }
@keyframes cx-ring { 0% { transform: scale(.9); opacity: .55; } 100% { transform: scale(1.35); opacity: 0; } }
@keyframes cx-hop { 0%, 100% { opacity: .2; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }
@keyframes cx-wave { 0%, 100% { height: 25%; } 50% { height: 95%; } }

/* ------------------------------------------------------------------ app shell */
.cx-app {
  position: relative; scroll-margin-top: 80px;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow);
  padding: var(--space-5) var(--space-6) var(--space-6); margin-bottom: var(--space-7);
}
.cx-app-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.cx-app-title { font-size: 1.05rem; margin: 0; font-weight: 700; }
.cx-status {
  display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 6px 12px 6px 10px; border-radius: 999px;
  font-size: .84rem; font-weight: 650; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  transition: background .25s, color .25s, border-color .25s;
}
.cx-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.cx-dot.ok { background: var(--ok); }
.cx-status[data-state="requesting-mic"], .cx-status[data-state="creating"], .cx-status[data-state="waiting-answer"],
.cx-status[data-state="waiting-host"], .cx-status[data-state="connecting"], .cx-status[data-state="reconnecting"] {
  color: var(--warn); background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent);
}
.cx-status[data-state="requesting-mic"] .cx-dot, .cx-status[data-state="creating"] .cx-dot, .cx-status[data-state="waiting-answer"] .cx-dot,
.cx-status[data-state="waiting-host"] .cx-dot, .cx-status[data-state="connecting"] .cx-dot, .cx-status[data-state="reconnecting"] .cx-dot {
  background: var(--warn); animation: cx-blink 1.2s ease-in-out infinite;
}
.cx-status[data-state="connected"] { color: var(--ok); background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.cx-status[data-state="connected"] .cx-dot { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 20%, transparent); }
.cx-status[data-state="failed"] { color: var(--err); background: var(--err-soft); border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.cx-status[data-state="failed"] .cx-dot { background: var(--err); }
@keyframes cx-blink { 50% { opacity: .35; } }

.cx-pane { animation: cx-in .28s var(--ease); }
@keyframes cx-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.cx-pane-title { font-size: 1.3rem; margin: 0 0 var(--space-2); letter-spacing: -.01em; outline: none; }
.cx-muted { color: var(--muted); margin: 0 0 var(--space-3); }
.cx-hint { color: var(--muted); font-size: .86rem; margin: var(--space-2) 0 0; }
.cx-opt { font-weight: 400; color: var(--muted); }
.cx-label { font-size: .84rem; color: var(--muted); display: block; margin: var(--space-4) 0 5px; font-weight: 600; }
.cx-row { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-top: var(--space-3); }
.cx-row.cx-center { justify-content: center; }
.cx-back { margin: 0 0 var(--space-3) -8px; gap: 6px; }
.cx-form { max-width: 460px; }
.cx-form input { width: 100%; }
.cx-form > .btn.large { width: 100%; margin-top: var(--space-5); gap: 8px; }
.cx-kind { display: inline-flex; }
.cx-kind button { display: inline-flex; align-items: center; gap: 6px; }
.cx-kind .i { width: 15px; height: 15px; }
.cx-soon { font-size: .7rem; font-weight: 700; padding: 1px 6px; border-radius: 999px; background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.cx-error, .cx-warn { margin: var(--space-3) 0 0; padding: 10px 12px; border-radius: var(--radius-sm); font-size: .9rem; }
.cx-error { color: var(--err); background: var(--err-soft); border: 1px solid color-mix(in srgb, var(--err) 25%, transparent); }
.cx-warn { color: var(--warn); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
.cx-note { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: .9rem; margin: var(--space-4) 0 0; }
.cx-note .i { margin-top: 2px; color: var(--accent); }
.cx-page textarea { width: 100%; min-height: 0; font-family: var(--mono, ui-monospace, monospace); font-size: .82rem; resize: vertical; word-break: break-all; }

/* start choices */
.cx-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.cx-choice {
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px; row-gap: 4px; text-align: left;
  padding: var(--space-5); border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  cursor: pointer; font: inherit; transition: border-color .2s, box-shadow .2s, transform .2s var(--ease);
}
.cx-choice:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.cx-choice:focus-visible { outline: 0; box-shadow: var(--ring); }
.cx-choice-icon { grid-row: 1 / 3; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.cx-choice-icon.alt { background: linear-gradient(135deg, var(--accent-3), var(--accent)); }
.cx-choice-icon .i { width: 22px; height: 22px; }
.cx-choice-title { font-weight: 700; font-size: 1.05rem; }
.cx-choice-text { color: var(--muted); font-size: .9rem; }

/* mic permission */
.cx-mic-wait, .cx-mic-error, .cx-end { text-align: center; padding: var(--space-5) 0; max-width: 560px; margin: 0 auto; }
.cx-pulse, .cx-big-icon { width: 76px; height: 76px; margin: 0 auto var(--space-4); border-radius: 50%; display: grid; place-items: center; }
.cx-pulse { color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent-2)); animation: cx-pulse 1.6s var(--ease) infinite; }
.cx-pulse .i, .cx-big-icon .i { width: 32px; height: 32px; }
.cx-big-icon { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.cx-big-icon.err { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 25%, transparent); }
.cx-big-icon.ok { background: var(--ok-soft); color: var(--ok); }
@keyframes cx-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 100% { box-shadow: 0 0 0 22px transparent; } }

/* invitation steps */
.cx-steps { list-style: none; padding: 0; margin: var(--space-4) 0 0; display: grid; gap: var(--space-4); }
.cx-step { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: var(--space-3); padding: var(--space-4); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.cx-step-num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 750; background: var(--accent); color: var(--on-accent); }
.cx-step.done .cx-step-num { background: var(--ok); }
.cx-step h4 { margin: 4px 0 4px; font-size: 1rem; }
.cx-field-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.cx-field-row input { flex: 1 1 260px; min-width: 0; font-family: var(--mono, ui-monospace, monospace); font-size: .82rem; }
.cx-field-row .btn, .cx-row .btn { gap: 6px; }
.cx-waiting { display: flex; align-items: center; gap: 10px; margin: var(--space-4) 0 0; color: var(--muted); font-size: .92rem; }
.cx-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--accent); animation: cx-spin .8s linear infinite; flex: none; }
@keyframes cx-spin { to { transform: rotate(360deg); } }

/* mic preview (before the call) */
.cx-precheck:empty { display: none; }
.cx-precheck { margin-top: var(--space-4); display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius); border: 1px dashed var(--border); }
.cx-precheck .cx-meter { flex: 1 1 120px; }
.cx-precheck select { flex: 0 1 260px; min-width: 0; }
.cx-precheck-label { display: inline-flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 600; }
.cx-precheck-label .i { color: var(--accent); }
.cx-meter { display: block; height: 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; min-width: 60px; }
.cx-meter i { display: block; height: 100%; width: 100%; transform-origin: left; transform: scaleX(0); background: linear-gradient(90deg, var(--ok), var(--accent)); transition: transform .08s linear; }

/* guest invite card */
.cx-invite-card { display: flex; align-items: center; gap: var(--space-4); margin-bottom: var(--space-4); }
.cx-avatar {
  --lvl: 0; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 750; color: var(--on-accent); background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 0 0 calc(var(--lvl) * 16px) color-mix(in srgb, var(--accent) 22%, transparent); transition: box-shadow .1s linear;
}
.cx-avatar.lg { width: 64px; height: 64px; font-size: 1.5rem; }
.cx-avatar.xl { width: 128px; height: 128px; font-size: 3rem; box-shadow: 0 0 0 calc(var(--lvl) * 28px) color-mix(in srgb, var(--accent) 22%, transparent), 0 20px 50px -20px color-mix(in srgb, var(--accent) 60%, transparent); }
.cx-avatar.sm { width: 36px; height: 36px; font-size: .95rem; background: linear-gradient(135deg, var(--accent-3), var(--accent)); }

/* ------------------------------------------------------------------ call stage */
.cx-stage {
  position: relative; min-height: 480px; border-radius: var(--radius-lg); overflow: hidden; isolation: isolate;
  display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 64px 20px 120px;
  background: radial-gradient(70% 60% at 50% 35%, var(--glow-1), transparent 70%), radial-gradient(60% 50% at 80% 100%, var(--glow-3), transparent 70%), var(--surface-2);
  border: 1px solid var(--border);
}
.cx-stage-top { position: absolute; top: 14px; left: 16px; right: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cx-timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: .92rem; padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.cx-quality { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 600; color: var(--muted); padding: 4px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); }
.cx-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.cx-bars i { width: 3px; border-radius: 2px; background: var(--border); }
.cx-bars i:nth-child(1) { height: 25%; } .cx-bars i:nth-child(2) { height: 50%; } .cx-bars i:nth-child(3) { height: 75%; } .cx-bars i:nth-child(4) { height: 100%; }
.cx-quality[data-q="good"] .cx-bars i { background: var(--ok); }
.cx-quality[data-q="fair"] .cx-bars i:nth-child(-n+3) { background: var(--warn); }
.cx-quality[data-q="poor"] .cx-bars i:nth-child(-n+1) { background: var(--err); }
.cx-remote { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.cx-remote-name { font-size: 1.4rem; font-weight: 750; margin: 18px 0 0; letter-spacing: -.01em; overflow-wrap: anywhere; }
.cx-remote-sub { margin: 0; min-height: 1.4em; color: var(--muted); font-size: .92rem; display: inline-flex; align-items: center; gap: 6px; }
.cx-remote-sub .i { width: 15px; height: 15px; color: var(--err); }
.cx-banner { margin-top: var(--space-4); max-width: 520px; text-align: center; padding: 10px 14px; border-radius: var(--radius-sm); font-size: .9rem; color: var(--warn); background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 25%, transparent); }
.cx-banner .btn { margin-left: 8px; }
.cx-sound { margin-top: var(--space-4); gap: 8px; }
.cx-local {
  position: absolute; right: 16px; bottom: 96px; display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px;
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); min-width: 150px;
}
.cx-local-info { display: grid; gap: 5px; flex: 1; }
.cx-local-name { font-size: .84rem; font-weight: 650; }
.cx-local-muted { width: 16px !important; height: 16px !important; color: var(--err); }
.cx-controls {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; gap: 12px; padding: 10px 14px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.cx-ctl {
  width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  display: grid; place-items: center; cursor: pointer; position: relative; transition: background .2s, transform .15s var(--ease), color .2s;
}
.cx-ctl:hover { background: var(--accent-soft); color: var(--accent); }
.cx-ctl:active { transform: scale(.95); }
.cx-ctl:focus-visible { outline: 0; box-shadow: var(--ring); }
.cx-ctl .i { width: 22px; height: 22px; }
.cx-ctl[aria-pressed="true"] { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.cx-ctl[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.cx-ctl.end { width: 72px; border-radius: 999px; background: var(--err); border-color: var(--err); color: var(--on-accent); }
.cx-ctl.end:hover { filter: brightness(1.08); background: var(--err); color: var(--on-accent); }
.cx-ctl-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.cx-settings {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%); width: min(92%, 380px); padding: 14px 16px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 2;
}
.cx-settings select { width: 100%; }

/* ------------------------------------------------------------------ video (phase 2) */
.cx-remote-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--cx-video-bg); z-index: 0; }
.cx-remote-video.cover { object-fit: cover; }
.cx-stage > .cx-stage-top, .cx-stage > .cx-remote, .cx-stage > .cx-banner, .cx-stage > .cx-sound, .cx-stage > .cx-local, .cx-stage > .cx-controls { z-index: 1; }
.cx-stage > .cx-remote, .cx-stage > .cx-banner, .cx-stage > .cx-sound { position: relative; }
.cx-stage > .cx-settings { z-index: 3; }
.cx-stage.has-video { background: var(--cx-video-bg); }
.cx-stage.has-video .cx-remote {
  position: absolute; top: 56px; left: 16px; flex-direction: row; gap: 8px; text-align: left; max-width: calc(100% - 32px);
  padding: 6px 12px; border-radius: 999px; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--border);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.cx-stage.has-video .cx-remote .cx-avatar { display: none; }
.cx-stage.has-video .cx-remote-name { font-size: .95rem; margin: 0; }
.cx-stage.has-video .cx-remote-sub { font-size: .82rem; min-height: 0; }
.cx-stage.has-video .cx-remote-sub:empty { display: none; }
.cx-local-video { display: none; }
.cx-local-video.mirror, .cx-preview-video.mirror { transform: scaleX(-1); }
.cx-local.cam-on { width: 224px; min-width: 0; aspect-ratio: 16 / 9; padding: 0; overflow: hidden; display: block; background: var(--cx-video-bg); }
.cx-local.cam-on .cx-local-video { display: block; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cx-local.cam-on .cx-avatar { display: none; }
.cx-local.cam-on .cx-local-info {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 7px; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px;
  background: linear-gradient(transparent, var(--cx-video-shade)); color: var(--cx-on-video);
}
.cx-local.cam-on .cx-local-muted { position: absolute; top: 8px; right: 8px; padding: 3px; box-sizing: content-box; border-radius: 50%; background: var(--surface); }
.cx-ctl.off { background: var(--err-soft); color: var(--err); border-color: color-mix(in srgb, var(--err) 30%, transparent); }
.cx-ctl.loading { opacity: .6; cursor: progress; }
.cx-stage:fullscreen { min-height: 100vh; border-radius: 0; border: 0; }

/* ------------------------------------------------------------------ screen sharing (phase 3) */
.cx-sharing {
  display: inline-flex; align-items: center; gap: 8px; min-width: 0; padding: 3px 3px 3px 12px; border-radius: 999px;
  font-size: .84rem; font-weight: 650; color: var(--accent); background: var(--surface); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
}
.cx-sharing .i { width: 16px; height: 16px; flex: none; }
.cx-sharing > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cx-sharing .btn { height: 26px; padding: 0 12px; border-radius: 999px; }
#ctl-share[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cx-ctl:disabled { opacity: .45; cursor: not-allowed; }
.cx-ctl:disabled:hover { background: var(--surface-2); color: var(--text); }
.cx-local.screen-on .cx-local-video { object-fit: contain; }
.cx-remote-sub .i.ok { color: var(--accent); }
@media (max-width: 700px) { .cx-sharing > span { display: none; } }
.cx-stage:fullscreen .cx-settings { bottom: 100px; }

/* ------------------------------------------------------------------ group calls (phase 4): a grid of tiles */
.cx-grid { display: none; }
.cx-stage.group { min-height: min(82vh, 760px); }
.cx-stage.group > .cx-remote { display: none; }
.cx-stage.group .cx-grid {
  display: grid; position: absolute; top: 56px; left: 16px; right: 16px; bottom: 96px; z-index: 1; gap: 10px;
  grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr);
}
.cx-stage.group > .cx-banner, .cx-stage.group > .cx-sound { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); margin: 0; z-index: 2; width: max-content; max-width: calc(100% - 32px); }
.cx-tile {
  position: relative; min-width: 0; min-height: 0; overflow: hidden; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  display: flex; flex-direction: column; align-items: center; justify-content: center; transition: box-shadow .2s;
}
.cx-tile.speaking, .cx-stage.group .cx-grid > .cx-local.speaking { box-shadow: 0 0 0 3px var(--accent); }
.cx-tile-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--cx-video-bg); }
.cx-tile-video.cover { object-fit: cover; }
.cx-tile.has-video { background: var(--cx-video-bg); }
.cx-tile.has-video .cx-tile-avatar { display: none; }
.cx-tile-avatar { margin-bottom: 26px; box-shadow: 0 0 0 calc(var(--lvl, 0) * 16px) color-mix(in srgb, var(--accent) 22%, transparent); }
.cx-tile[data-link="joining"] .cx-tile-avatar, .cx-tile[data-link="relayed"] .cx-tile-avatar, .cx-tile[data-link="failed"] .cx-tile-avatar { opacity: .55; }
.cx-tile-info { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: .84rem; min-width: 0; }
.cx-tile.has-video .cx-tile-info { background: linear-gradient(transparent, var(--cx-video-shade)); color: var(--cx-on-video); padding-top: 18px; }
.cx-tile-name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cx-tile-sub { display: inline-flex; align-items: center; gap: 4px; flex: none; color: var(--muted); font-size: .78rem; white-space: nowrap; }
.cx-tile.has-video .cx-tile-sub { color: inherit; }
.cx-tile-sub .i { width: 14px; height: 14px; color: var(--err); }
.cx-tile-sub .i.ok { color: var(--accent); }
.cx-tile-sub .cx-spinner { width: 12px; height: 12px; }
.cx-tile.has-video .cx-tile-sub .i { padding: 2px; box-sizing: content-box; border-radius: 50%; background: var(--surface); }
.cx-tile[data-link="relayed"] .cx-tile-sub, .cx-tile[data-link="failed"] .cx-tile-sub { color: var(--warn); }
.cx-tile[data-link="relayed"] .cx-tile-sub .i, .cx-tile[data-link="failed"] .cx-tile-sub .i { color: var(--warn); }
.cx-grid.has-screen .cx-tile.screen { grid-column: 1 / -1; order: -1; }
.cx-grid.span-first > :first-child { grid-column: 1 / -1; }
.cx-stage:has(> #call-invite:not([hidden])) { min-height: 640px; }
/* your own tile inside the grid (in a one-to-one call it is the corner picture) */
.cx-stage.group .cx-grid > .cx-local {
  position: relative; inset: auto; width: auto; min-width: 0; min-height: 0; aspect-ratio: auto; margin: 0; padding: 0; border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: none; overflow: hidden;
}
.cx-stage.group .cx-grid > .cx-local .cx-avatar { width: 64px; height: 64px; font-size: 1.5rem; margin-bottom: 26px; }
.cx-stage.group .cx-grid > .cx-local:not(.cam-on) .cx-local-info { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; }
.cx-stage.group .cx-grid > .cx-local .cx-local-muted { position: absolute; top: 8px; right: 8px; }
.cx-stage.group .cx-grid > .cx-local.cam-on .cx-meter { display: none; }
/* the "Add people" panel (same place as Settings) */
.cx-invite-panel { width: min(92%, 460px); max-height: calc(100% - 120px); overflow: auto; }
.cx-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cx-panel-head h4 { margin: 0; font-size: 1rem; }
.cx-panel-head h4:focus { outline: 0; }
.cx-invite-panel .cx-hint { margin: 4px 0 10px; }
.cx-invite-panel label { display: block; font-weight: 650; font-size: .88rem; margin: 6px 0; }
.cx-invite-panel .cx-field-row { margin-bottom: 8px; }
.cx-invite-panel textarea { width: 100%; margin-bottom: 8px; }
.cx-invite-panel .btn { gap: 6px; }
#call-details { white-space: pre-line; }
@media (max-width: 600px) {
  .cx-stage.group { min-height: 78vh; }
  .cx-stage.group .cx-grid { top: 52px; left: 10px; right: 10px; bottom: 84px; gap: 6px; }
  .cx-tile-avatar, .cx-stage.group .cx-grid > .cx-local .cx-avatar { width: 48px; height: 48px; font-size: 1.15rem; margin-bottom: 22px; }
  .cx-tile-info { padding: 6px 8px; font-size: .78rem; }
  .cx-tile-sub { font-size: .72rem; }
  .cx-invite-panel { bottom: 84px; }
}

/* camera preview before the call */
.cx-camcheck { align-items: flex-start; }
.cx-preview-video { width: 240px; max-width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-sm); background: var(--cx-video-bg); flex: none; }
.cx-camcheck-side { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; flex: 1 1 200px; min-width: 0; }
.cx-camcheck-side select { max-width: 100%; }
.cx-camcheck-side .btn { gap: 6px; }
.cx-camcheck-side .cx-hint { margin: 0; }
.cx-settings label + select { margin-bottom: 10px; }

/* end screen */
.cx-end .btn { gap: 6px; }

/* ------------------------------------------------------------------ landing sections */
.cx-section { margin: 0 0 var(--space-8); }
.cx-section > h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); letter-spacing: -.02em; margin: 0 0 var(--space-5); }
.cx-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
@media (min-width: 1100px) { .cx-features { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.cx-feature { padding: var(--space-5); border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); transition: transform .2s var(--ease), box-shadow .2s; }
.cx-feature:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.cx-feature h3 { font-size: 1.02rem; margin: var(--space-3) 0 6px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cx-feature p { margin: 0; color: var(--muted); font-size: .92rem; }
.cx-f-icon { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.cx-f-icon.t1 { background: var(--t1-soft); color: var(--t1); } .cx-f-icon.t2 { background: var(--t2-soft); color: var(--t2); }
.cx-f-icon.t3 { background: var(--t3-soft); color: var(--t3); } .cx-f-icon.t4 { background: var(--t4-soft); color: var(--t4); }
.cx-f-icon.t5 { background: var(--t5-soft); color: var(--t5); } .cx-f-icon.t6 { background: var(--t6-soft); color: var(--t6); } .cx-f-icon.t7 { background: var(--t7-soft); color: var(--t7); }
.cx-f-icon.t8 { background: var(--t8-soft); color: var(--t8); }
.cx-tag { font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.cx-tag.ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.cx-how { list-style: none; padding: 0; margin: 0 0 var(--space-4); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); counter-reset: none; }
.cx-how li { padding: var(--space-5); border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); position: relative; }
.cx-how h3 { font-size: 1rem; margin: var(--space-3) 0 6px; }
.cx-how p { margin: 0; color: var(--muted); font-size: .92rem; }
.cx-how-num { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 750; background: var(--accent-soft); color: var(--accent); }
.cx-how-note { max-width: 62em; font-size: .94rem; }
.cx-privacy-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.cx-privacy-grid > div { padding: var(--space-4) var(--space-5); border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; border-top: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.cx-privacy-grid h3 { font-size: .98rem; margin: 0 0 6px; }
.cx-privacy-grid p { margin: 0; color: var(--muted); font-size: .9rem; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 900px) {
  .cx-hero { grid-template-columns: minmax(0, 1fr); padding: var(--space-6) var(--space-5); }
  .cx-hero-art { display: none; }
  .cx-features, .cx-privacy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .cx-hero { padding: var(--space-5) var(--space-4); border-radius: var(--radius); }
  .cx-hero-actions .btn { flex: 1 1 100%; justify-content: center; }
  .cx-sub { font-size: 1rem; }
  .cx-app { padding: var(--space-4); border-radius: var(--radius); }
  .cx-choices, .cx-features, .cx-privacy-grid, .cx-how { grid-template-columns: minmax(0, 1fr); }
  .cx-step { grid-template-columns: minmax(0, 1fr); padding: var(--space-3); }
  .cx-step-num { width: 28px; height: 28px; font-size: .9rem; }
  .cx-field-row .btn { flex: 1 1 auto; justify-content: center; }
  .cx-stage { min-height: 68vh; padding: 64px 12px 170px; }
  .cx-avatar.xl { width: 104px; height: 104px; font-size: 2.4rem; }
  .cx-local { left: 12px; right: 12px; bottom: 96px; }
  .cx-local.cam-on { left: auto; width: 108px; aspect-ratio: 3 / 4; }
  .cx-local.cam-on .cx-meter { display: none; }
  .cx-controls { bottom: 14px; gap: 8px; padding: 8px 10px; }
  .cx-ctl { width: 48px; height: 48px; }
  .cx-ctl .i { width: 20px; height: 20px; }
  .cx-ctl.end { width: 60px; }
  .cx-stage.has-video .cx-remote { left: 12px; top: 52px; max-width: calc(100% - 24px); }
  .cx-preview-video { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .cx-page *, .cx-page *::before, .cx-page *::after { animation: none !important; transition: none !important; }
}
/* phones: the bar must fit inside the call area (about 320 px); what doesn't fit goes into More (connect-app.js fitControls) */
@media (max-width: 600px) {
  .cx-controls { gap: 4px; padding: 7px 8px; }
  .cx-ctl { width: 42px; height: 42px; }
  .cx-ctl.end { width: 52px; }
}

/* ------------------------------------------------------------------ chat (phase 5) */
/* computers: a column on the right of the stage (the picture and grid make room); phones: a sheet over the stage */
.cx-ctl .cx-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-size: .72rem; font-weight: 750; line-height: 20px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.cx-chat {
  position: absolute; top: 56px; right: 16px; bottom: 96px; width: 340px; z-index: 3; display: flex; flex-direction: column;
  padding: 12px 12px 10px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.cx-chat[hidden] { display: none; }
.cx-chat .cx-panel-head { padding: 0 2px 8px; border-bottom: 1px solid var(--border); }
.cx-chat-log { list-style: none; margin: 0; padding: 8px 2px; flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; }
.cx-chat-log:empty { display: none; }
.cx-chat-empty { flex: 1 1 auto; margin: 0; padding: 16px 8px; color: var(--muted); font-size: .86rem; text-align: center; display: grid; place-items: center; }
.cx-msg { max-width: 86%; align-self: flex-start; display: flex; flex-direction: column; gap: 2px; }
.cx-msg.mine { align-self: flex-end; align-items: flex-end; }
.cx-msg.cont { margin-top: -3px; }
.cx-msg.cont .cx-msg-meta { display: none; }
.cx-msg-meta { display: flex; gap: 6px; align-items: baseline; font-size: .74rem; color: var(--muted); padding: 0 4px; }
.cx-msg-name { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.cx-msg-text {
  padding: 7px 11px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border);
  font-size: .9rem; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere;
}
.cx-msg.theirs .cx-msg-text { border-top-left-radius: 4px; }
.cx-msg.mine .cx-msg-text { background: var(--accent); border-color: var(--accent); color: var(--on-accent); border-top-right-radius: 4px; }
.cx-msg.mine.cont .cx-msg-text, .cx-msg.theirs.cont .cx-msg-text { border-radius: 14px; }
.cx-msg-text a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.cx-msg-status { display: inline-flex; align-items: center; gap: 3px; font-size: .72rem; color: var(--muted); padding: 0 4px; }
.cx-msg-status .i { width: 12px; height: 12px; }
.cx-msg-status[data-s="delivered"] { color: var(--ok); }
.cx-msg-status[data-s="failed"] { color: var(--err); }
.cx-msg-sys { align-self: center; font-size: .76rem; color: var(--muted); padding: 2px 10px; border-radius: 999px; background: var(--surface-2); }
.cx-chat-typing { margin: 0; min-height: 1.3em; font-size: .78rem; color: var(--muted); font-style: italic; padding: 0 4px; }
.cx-chat .cx-error { margin: 4px 0; font-size: .84rem; }
.cx-chat-form { display: flex; gap: 8px; align-items: flex-end; padding-top: 6px; }
.cx-chat-form textarea { font: inherit; font-size: .92rem; flex: 1 1 auto; min-width: 0; resize: none; min-height: 40px; max-height: 120px; line-height: 1.35; padding: 9px 11px; }
.cx-chat-form .btn.icon { width: 40px; height: 40px; flex: none; }
.cx-chat-count { margin: 4px 2px 0; font-size: .76rem; }
.cx-chat-peek {
  position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 2; max-width: min(92%, 420px);
  padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  color: var(--text); font: inherit; font-size: .88rem; text-align: left; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cx-chat-peek:hover { border-color: var(--accent); }
.cx-chat-peek:focus-visible { outline: 0; box-shadow: var(--ring); }
/* ------------------------------------------------------------------ files (phase 6) */
.cx-chat-form > .btn.icon.ghost { width: 40px; height: 40px; flex: none; color: var(--muted); }
.cx-chat-form > .btn.icon.ghost:hover { color: var(--text); }
.cx-msg.cx-file-msg { max-width: 92%; width: 92%; }
.cx-file {
  display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 9px 10px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.cx-msg.theirs .cx-file { border-top-left-radius: 4px; }
.cx-msg.mine .cx-file { border-color: var(--accent); border-top-right-radius: 4px; }
.cx-msg.cont .cx-file { border-radius: 14px; }
.cx-file-row { display: flex; gap: 10px; align-items: center; min-width: 0; }
.cx-file-icon { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.cx-file-icon .i { width: 18px; height: 18px; }
.cx-file-info { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.cx-file-name { font-weight: 650; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-file-sub { font-size: .76rem; color: var(--muted); line-height: 1.35; overflow-wrap: anywhere; }
.cx-file[data-s="ok"] .cx-file-sub { color: var(--ok); }
.cx-file[data-s="err"] .cx-file-sub { color: var(--err); }
.cx-file-bar { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; }
.cx-file-bar > span { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--accent); border-radius: inherit; transition: width .2s linear; }
.cx-file-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cx-file-actions[hidden] { display: none; }
.cx-file-actions .btn { gap: 5px; }
.cx-file-actions .btn .i { width: 15px; height: 15px; }
.cx-file-preview { border-radius: 10px; overflow: hidden; background: var(--surface); line-height: 0; }
.cx-file-preview[hidden] { display: none; }
.cx-file-preview img { display: block; width: 100%; max-height: 220px; object-fit: contain; }
.cx-drop {
  position: absolute; inset: 10px; z-index: 5; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center;
  border: 2px dashed var(--accent); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text); font-weight: 650; text-align: center; padding: 16px; pointer-events: none;
}
.cx-drop[hidden] { display: none; }
.cx-drop .i { width: 34px; height: 34px; color: var(--accent); }
.cx-end-files { margin: var(--space-5) auto 0; max-width: 460px; text-align: left; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.cx-end-files h4 { margin: 0 0 8px; font-size: .95rem; }
.cx-end-files ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cx-end-files li { display: flex; gap: 10px; align-items: center; min-width: 0; }
.cx-end-files .btn { flex: none; }
.cx-end-files .cx-hint { margin: 10px 0 0; }
.cx-end-files + .cx-row { margin-top: var(--space-5); }

@media (min-width: 901px) {
  /* the call keeps its full picture next to the chat */
  .cx-stage.chat-open { padding-right: 372px; }
  .cx-stage.chat-open .cx-remote-video { width: calc(100% - 356px); }
  .cx-stage.chat-open > .cx-local { right: 372px; }
  .cx-stage.chat-open .cx-stage-top { right: 372px; }
  .cx-stage.chat-open.group .cx-grid { right: 372px; }
  .cx-stage.chat-open .cx-settings, .cx-stage.chat-open .cx-chat-peek { left: calc(50% - 178px); }
}
@media (max-width: 900px) {
  .cx-chat { left: 12px; right: 12px; width: auto; }
}
@media (max-width: 600px) {
  .cx-chat { top: 50px; left: 8px; right: 8px; bottom: 76px; }
  .cx-chat-peek { bottom: 84px; }
  .cx-ctl .cx-badge { top: -5px; right: -5px; }
}

/* "More" menu: call buttons that don't fit in the bar (narrow screens) move here, with their names shown */
.cx-more {
  position: absolute; right: 12px; bottom: 96px; z-index: 4; display: flex; flex-direction: column; gap: 2px; min-width: 210px; padding: 6px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
}
.cx-more .cx-ctl { width: auto; height: 44px; border-radius: 10px; border-color: transparent; background: transparent; display: flex; align-items: center; gap: 12px; padding: 0 12px; font: inherit; font-size: .92rem; text-align: left; }
.cx-more .cx-ctl:hover { background: var(--accent-soft); }
.cx-more .cx-ctl:active { transform: none; }
.cx-more .cx-ctl-label { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
.cx-more .cx-ctl[aria-expanded="true"], .cx-more .cx-ctl[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }
@media (max-width: 600px) { .cx-more { bottom: 84px; right: 8px; } }
