/* Liquid Glass styling: translucent materials over a soft wallpaper, capsule controls, system fonts. */

:root {
  color-scheme: light dark;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", var(--font);

  --accent: #007aff;
  --danger: #d70015;
  --danger-fill: rgba(255, 59, 48, .14);
  --ok: #34c759;
  --wait: #ff9f0a;
  --share: #bf5af2;

  --bg: #f2f2f7;
  --ink: #1d1d1f;
  --secondary: rgba(60, 60, 67, .74);
  --tertiary: rgba(60, 60, 67, .5);
  --hairline: rgba(60, 60, 67, .14);
  --fill: rgba(120, 120, 128, .16);
  --fill-hover: rgba(120, 120, 128, .24);
  --field: rgba(255, 255, 255, .6);
  --inset: rgba(255, 255, 255, .5);
  --glass: rgba(255, 255, 255, .58);
  --glass-edge: rgba(255, 255, 255, .75);
  --specular: rgba(255, 255, 255, .9);
  --shadow: rgba(20, 30, 60, .18);
  --shadow-soft: rgba(20, 30, 60, .06);
  --focus: rgba(0, 122, 255, .32);
  --tint-a: rgba(0, 122, 255, .22);
  --tint-b: rgba(191, 90, 242, .18);
  --tint-c: rgba(90, 200, 250, .2);
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #0a84ff;
    --danger: #ff6961;
    --danger-fill: rgba(255, 69, 58, .2);
    --ok: #30d158;

    --bg: #0a0a0d;
    --ink: #f5f5f7;
    --secondary: rgba(235, 235, 245, .68);
    --tertiary: rgba(235, 235, 245, .42);
    --hairline: rgba(235, 235, 245, .12);
    --fill: rgba(120, 120, 128, .3);
    --fill-hover: rgba(120, 120, 128, .42);
    --field: rgba(0, 0, 0, .28);
    --inset: rgba(0, 0, 0, .22);
    --glass: rgba(44, 44, 50, .55);
    --glass-edge: rgba(255, 255, 255, .13);
    --specular: rgba(255, 255, 255, .16);
    --shadow: rgba(0, 0, 0, .55);
    --shadow-soft: rgba(0, 0, 0, .3);
    --focus: rgba(10, 132, 255, .45);
    --tint-a: rgba(10, 132, 255, .3);
    --tint-b: rgba(191, 90, 242, .24);
    --tint-c: rgba(64, 200, 224, .18);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(60rem 40rem at 10% -10%, var(--tint-a), transparent 62%),
    radial-gradient(52rem 36rem at 96% 2%, var(--tint-b), transparent 60%),
    radial-gradient(64rem 40rem at 50% 112%, var(--tint-c), transparent 62%),
    var(--bg);
  background-attachment: fixed;
}

h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; margin: 0 0 4px; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.secondary { color: var(--secondary); }
.small-text { font-size: 13px; }
.center { text-align: center; }
.error { color: var(--danger); font-size: 13px; min-height: 1.45em; margin-top: 10px; text-align: center; }

/* ---------- materials ---------- */

.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(36px) saturate(180%);
  backdrop-filter: blur(36px) saturate(180%);
  border: 1px solid var(--glass-edge);
  box-shadow:
    inset 0 1px 0 var(--specular),
    0 22px 60px -18px var(--shadow),
    0 2px 6px var(--shadow-soft);
}

/* ---------- controls ---------- */

button {
  font: 500 14px/1 var(--font);
  height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--fill);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s ease, background .15s ease, filter .15s ease;
}
button:hover { background: var(--fill-hover); }
button:active { transform: scale(.97); }
button:disabled { opacity: .45; cursor: default; transform: none; }
button.primary {
  color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #fff), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), 0 1px 3px rgba(0, 40, 120, .3);
}
button.primary:hover { filter: brightness(1.07); }
button.danger { color: var(--danger); background: var(--danger-fill); }
button.danger:hover { filter: brightness(1.08); }
button.large { height: 44px; width: 100%; font-size: 16px; font-weight: 600; }
.button-link {
  display: inline-flex; align-items: center; justify-content: center;
  height: 34px; padding: 0 16px; border-radius: 999px; text-decoration: none;
  font: 600 14px/1 var(--font); color: #fff;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #fff), var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), 0 1px 3px rgba(0, 40, 120, .3);
}
.button-link:hover { filter: brightness(1.07); text-decoration: none; }
.token code, code { font: 13px ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
button.small { height: 28px; padding: 0 12px; font-size: 13px; }

label { display: block; font-size: 13px; color: var(--secondary); margin: 14px 2px 6px; }
input {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  font: 16px var(--font);
  color: var(--ink);
  background: var(--field);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  transition: box-shadow .15s ease, border-color .15s ease;
}
input::placeholder { color: var(--tertiary); }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus);
}

/* ---------- sign-in and guest sheets ---------- */

.sheet {
  width: min(100% - 32px, 392px);
  margin: 12vh auto 0;
  padding: 34px 28px 22px;
  border-radius: 30px;
}
.sheet h1, .sheet .lede { text-align: center; }
.sheet .lede { color: var(--secondary); margin: 6px 0 12px; }
.sheet form button.large, .sheet .stack button.large { margin-top: 20px; }
.stack { display: grid; gap: 10px; }
.stack button.large + button.large { margin-top: 0; }
.footnote { text-align: center; font-size: 13px; margin: 18px 0; color: var(--secondary); }

/* Company logos sit on a white plate: the artwork has an opaque white background. */
.brand-plate {
  width: fit-content;
  margin: 0 auto 16px;
  padding: 10px 16px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 10px 24px -12px var(--shadow);
}
.brand-plate img { display: block; max-width: 100%; height: auto; }
.family { width: min(100% - 32px, 392px); margin: 16px auto 32px; text-align: center; }
.family .brand-plate { width: 100%; padding: 10px 12px; margin-bottom: 10px; border-radius: 18px; }
.family p { font-size: 12px; color: var(--secondary); }
.sheet h1 + section, .sheet h1 + form { margin-top: 6px; }
.prompt-title { font-size: 19px; font-weight: 600; letter-spacing: -.01em; text-align: center; margin-top: 14px; }
.prompt-body { color: var(--secondary); font-size: 14px; text-align: center; margin: 8px 0 6px; }
.steps { margin: 10px 0 6px; padding-left: 22px; font-size: 14px; display: grid; gap: 10px; }
.steps strong { font-weight: 600; }
#method .prompt-body { margin: 0 0 8px; }

/* ---------- console ---------- */

.toolbar {
  position: sticky; top: 12px; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: min(100% - 24px, 1000px);
  margin: 12px auto 0;
  padding: 8px 8px 8px 14px;
  border-radius: 999px;
}
.brandmark { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.brandmark img { border-radius: 7px; }
.toolbar-right { display: flex; align-items: center; gap: 12px; font-size: 13px; }

.console {
  width: min(100% - 24px, 1000px);
  margin: 18px auto 40px;
  display: grid; gap: 18px;
}
.columns { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.panel { border-radius: 26px; padding: 22px; }
.panel > .secondary { margin-bottom: 16px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.well {
  margin-top: 18px;
  padding: 18px 16px 16px;
  border-radius: 18px;
  text-align: center;
  background: color-mix(in srgb, var(--accent) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.code {
  font: 600 36px/1.1 var(--rounded);
  font-variant-numeric: tabular-nums;
  letter-spacing: .04em;
  margin-bottom: 8px;
}
.well .row { justify-content: center; margin-top: 12px; }

.list {
  list-style: none; margin: 12px 0 0; padding: 0 14px;
  background: var(--inset);
  border: 1px solid var(--hairline);
  border-radius: 16px;
}
.list:empty { display: none; }
.list li {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 48px; padding: 9px 0;
  border-top: 1px solid var(--hairline);
  font-size: 14px;
}
.list li:first-child { border-top: 0; }
.list + p, .list + button, .list + p + button { margin-top: 14px; }

.pill { display: inline-flex; align-items: center; gap: 6px; margin-left: 8px; font-size: 13px; color: var(--secondary); }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tertiary); }
.pill.pending::before { background: var(--wait); }
.pill.joined::before { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }

/* ---------- viewer ---------- */

.viewer { padding: 10px; }
.stage {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 72vh;
  width: 100%;
  overflow: hidden;
  border-radius: 17px;
  background: radial-gradient(80% 80% at 50% 40%, #1c1c22, #050507);
}
.stage:fullscreen { border-radius: 0; max-height: none; }
.stage video { width: 100%; height: 100%; object-fit: contain; display: block; }
.stage-chip {
  position: absolute;
  display: flex; align-items: center; gap: 8px;
  color: #fff;
  background: rgba(40, 40, 46, .58);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), 0 10px 30px rgba(0, 0, 0, .4);
  border-radius: 999px;
}
.stage-status { top: 12px; left: 12px; height: 32px; padding: 0 14px 0 12px; font-size: 13px; font-weight: 500; max-width: 38%; overflow: hidden; }
.stage-status #viewer-status { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Top-centre so it never covers the remote taskbar or Start menu, and fades out when the
   mouse is still (revealed again on movement). */
.stage-controls {
  top: 12px; left: 50%; transform: translateX(-50%); padding: 6px;
  transition: opacity .25s ease, transform .25s ease;
}
.stage-controls.hidden { opacity: 0; transform: translateX(-50%) translateY(-10px); pointer-events: none; }
.stage-tabs { top: 12px; right: 12px; padding: 4px; gap: 4px; }
.stage:focus { outline: none; }
.stage[data-control="true"] video { cursor: none; }  /* the remote cursor is drawn into the video */
.stage[data-control="true"] { box-shadow: 0 0 0 3px var(--accent); }
.token {
  margin: 10px 0 2px;
  font: 13px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  word-break: break-all;
  user-select: all;
}
.list li strong { font-weight: 600; }
.list li .secondary { margin-left: 8px; }
.panel > .list + .secondary, .panel > .list + .secondary + button { margin-top: 14px; }
.stage-chip button.active, .stage-chip button.active:hover { color: #000; background: #fff; }
.stage-chip button { color: #fff; background: rgba(255, 255, 255, .14); }
.stage-chip button:hover { background: rgba(255, 255, 255, .24); }
.stage-chip button.danger { color: #fff; background: #ff453a; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #8e8e93; flex: none; }
.stage[data-live="true"] .dot { background: var(--ok); }

/* ---------- notch indicator shown to the guest ---------- */

.island {
  position: fixed; left: 50%; top: -14px; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  height: 54px; padding: 14px 8px 0 16px; /* the extra 14px above hides the spring overshoot */
  color: #fff; background: #000;
  border-radius: 0 0 22px 22px;
  font: 500 13px/1 var(--font);
  white-space: nowrap;
  transform: translate(-50%, -110%);
  transition: transform .6s cubic-bezier(.2, 1.35, .4, 1), box-shadow .3s ease;
}
/* The shadow belongs to the visible state only, or it would peek below the top edge while hidden. */
.island.show { transform: translate(-50%, 0); box-shadow: 0 10px 30px rgba(0, 0, 0, .3); }
/* The small outward curves where a notch meets the top edge. */
.island::before, .island::after { content: ""; position: absolute; top: 14px; width: 10px; height: 10px; }
.island::before { left: -10px; background: radial-gradient(circle at 0 100%, transparent 9.5px, #000 10px); }
.island::after { right: -10px; background: radial-gradient(circle at 100% 100%, transparent 9.5px, #000 10px); }
.island button { height: 26px; padding: 0 12px; font-size: 12px; font-weight: 600; color: #fff; background: #ff453a; }
.island button:hover { background: #ff6961; }
.island[data-live="true"] .dot { background: var(--share); animation: pulse 1.8s ease-out infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(191, 90, 242, .7); }
  100% { box-shadow: 0 0 0 9px rgba(191, 90, 242, 0); }
}

/* The same indicator inside a floating always-on-top window (Chrome and Edge). */
body.pip { background: #000; display: grid; place-items: center; min-height: 100vh; overflow: hidden; }
body.pip .island { position: static; transform: none; height: auto; padding: 0 8px 0 12px; box-shadow: none; transition: none; }
body.pip .island::before, body.pip .island::after { display: none; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
