:root {
  color-scheme: dark light;
  --bg: #0e1116;
  --fg: #e8ebf0;
  --muted: #9aa4b2;
  --accent: #4c8dff;
  --panel: #181d25;
  --border: #2a313c;
  --danger: #ff6b6b;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f3f5f8; --fg: #151a22; --muted: #5d6877; --panel: #ffffff; --border: #d5dae2; --accent: #1f6feb; --danger: #c62828; }
}
* { box-sizing: border-box; }
/* Something marked hidden is never shown, whatever display a rule gives it (a toolbar button is display: inline-flex, for example). */
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}
/* Home screen: a deep-blue sidebar and one main card, in the layout people know from remote-support tools. */
.panel { --side: #1a2a8c; --side-active: #2f46c8; display: flex; min-height: 100vh; }
.side { flex: 0 0 15.5rem; display: flex; flex-direction: column; gap: 1.25rem; padding: 1.1rem .9rem; background: var(--side); color: #fff; }
.brand { display: flex; align-items: center; gap: .6rem; padding: 0 .35rem 1rem; border-bottom: 1px solid rgba(255, 255, 255, .22); font-size: 1.2rem; font-weight: 700; letter-spacing: -.01em; }
.logo { width: 2rem; height: 2rem; flex: none; }
.nav { display: grid; gap: .25rem; }
.nav-item { display: flex; align-items: center; gap: .7rem; padding: .7rem .8rem; border-radius: 10px; color: rgba(255, 255, 255, .85); }
.nav-item svg { width: 1.3rem; height: 1.3rem; flex: none; }
a.nav-item { text-decoration: none; }
a.nav-item:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.nav-item.active { background: var(--side-active); color: #fff; font-weight: 600; }
.account { margin-top: auto; display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; padding: .65rem .7rem; border-radius: 12px; background: rgba(255, 255, 255, .1); }
.account[hidden] { display: none; }
.account[hidden] + .side-note { margin-top: auto; }
.avatar { flex: none; display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: #fff; color: var(--side); font-weight: 700; }
.who { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.who strong, .who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who strong { font-size: .88rem; }
.who small { font-size: .74rem; color: rgba(255, 255, 255, .7); }
#signout { flex: 1 0 100%; margin: .15rem 0 0; padding: .35rem .65rem; font-size: .78rem; font-weight: 600; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .3); }
#signout:hover { background: rgba(255, 255, 255, .28); }
.side-note { margin: .9rem .35rem .25rem; font-size: .78rem; line-height: 1.45; color: rgba(255, 255, 255, .7); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.strip { margin: 0; padding: .7rem 1.5rem; text-align: center; font-size: .85rem; color: var(--muted); background: color-mix(in srgb, var(--accent) 9%, var(--bg)); }
.card { width: min(100% - 3rem, 44rem); margin: 2.5rem auto 0; padding: 1.75rem 1.75rem 1.5rem; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; }
.ready { display: flex; align-items: center; gap: .5rem; margin: auto 0 0; padding: .8rem 1.5rem; border-top: 1px solid var(--border); font-size: .85rem; color: var(--muted); }
.ready .dot { width: .55rem; height: .55rem; border-radius: 50%; background: #3dbb5d; }
@media (max-width: 700px) {
  .panel { flex-direction: column; }
  .side { flex: none; flex-direction: row; align-items: center; padding: .7rem .9rem; }
  .brand { padding: 0; border: 0; font-size: 1.05rem; }
  .nav, .side-note { display: none; }
  .account { margin: 0 0 0 auto; padding: .35rem .5rem; flex-wrap: nowrap; }
  #signout { flex: none; margin: 0; }
  .who { display: none; }
  .card { width: calc(100% - 2rem); margin-top: 1.25rem; padding: 1.25rem 1rem; }
  .strip { padding: .6rem 1rem; }
}
.panel[hidden], #stage[hidden], form[hidden], #hosts[hidden], #retry[hidden] { display: none; }
h1 { font-size: 1.5rem; font-weight: 600; margin: 0 0 .5rem; }
#message { color: var(--muted); margin: 0 0 1rem; min-height: 3em; }
#message.error { color: var(--danger); }
input.code { font: 600 1.4rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .15em; text-transform: uppercase; text-align: center; }
form + form { margin-top: .5rem; }
form label + input + label { margin-top: .75rem; }
#hosts { display: grid; gap: .6rem; margin-bottom: .5rem; }
#hosts button.host {
  display: flex; align-items: center; gap: .9rem; width: 100%; margin: 0; padding: .8rem 1rem; text-align: left;
  color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 12px; transition: border-color .12s, background .12s;
}
#hosts button.host:hover, #hosts button.host:focus-visible { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--bg)); }
.host svg { width: 1.9rem; height: 1.9rem; flex: none; color: var(--accent); }
.host-text { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.host-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.host-text small { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .8rem; }
.host-text small::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: #3dbb5d; }
.host-text small.off::before { background: #98a1ae; }
.host-go { padding: .4rem .9rem; border-radius: 8px; color: #fff; background: var(--accent); font-size: .85rem; font-weight: 600; }
#hosts button.host.offline .host-go { background: #7d8796; }
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .25rem; }
input {
  width: 100%; padding: .65rem .75rem; font: inherit; letter-spacing: .08em;
  color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
}
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button {
  margin-top: .75rem; padding: .6rem 1rem; font: inherit; cursor: pointer;
  color: #fff; background: var(--accent); border: 0; border-radius: 8px;
}
#stage { position: fixed; inset: 0; background: #000; overflow: hidden; cursor: none; }
/* Protocol 3e: the computer leaves its pointer out of the picture and the pointer here takes its shape, so there is one pointer and it
   never lags. (Without it, the pointer here is hidden over the picture and a quick ghost arrow bridges the picture's delay.) */
#stage.local-pointer { cursor: default; }
#stage.local-pointer:not(.drawing):not(.view-only) #screen { cursor: var(--remote-pointer, default); }
/* The picture is sized and placed by script (zoom and scroll), so it can be larger than the window. */
#screen { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: fill; background: #000; outline: none; will-change: transform; }
#mini {
  position: absolute; right: 12px; bottom: 12px; overflow: hidden; background: #000; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .55); border-radius: 6px; box-shadow: 0 2px 10px rgba(0, 0, 0, .5); opacity: .92; touch-action: none;
}
#mini[hidden] { display: none; }
#mini video { display: block; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
#mini-view { position: absolute; pointer-events: none; border: 2px solid #4c8dff; background: rgba(76, 141, 255, .2); box-sizing: border-box; }
#hint {
  position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); max-width: min(90vw, 36rem); cursor: default;
  padding: .55rem .9rem; border-radius: 8px; background: rgba(14, 17, 22, .92); color: #e8ebf0; font-size: .85rem; text-align: center;
}
#hint[hidden] { display: none; }
.bar {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: .5rem;
  padding: .4rem .75rem; background: rgba(14, 17, 22, .85); color: #e8ebf0; font-size: .8rem;
  transform: translateY(-100%); transition: transform .15s; cursor: default;
}
.bar:hover, .bar:focus-within, #stage.show-bar .bar, #stage.menu-open .bar { transform: none; }
.bar button { margin: 0; padding: .25rem .6rem; font-size: .8rem; background: #2c3441; }
.spacer { flex: 1; }
/* Buttons that belong together are joined into one control; groups are told apart by a thin divider. */
.bar button { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 1.9rem; border-radius: 7px; }
.bar button:hover { background: #38414f; }
.bar .icon { width: 2.1rem; padding: .25rem; position: relative; }
.bar .seg { gap: 0; background: #2c3441; border-radius: 7px; overflow: hidden; }
.bar .seg button { background: transparent; border-radius: 0; }
.bar .seg button + button { border-left: 1px solid rgba(255, 255, 255, .09); }
.bar .seg button:hover { background: #38414f; }
.sep { width: 1px; align-self: stretch; margin: .2rem .15rem; background: rgba(255, 255, 255, .14); }
.bar button[aria-pressed="true"] { background: #3d63c9; }
.bar .badge { position: absolute; top: 1px; right: 1px; min-width: .95rem; height: .95rem; padding: 0 .2rem; border-radius: 999px; background: #e5484d; color: #fff; font-size: .65rem; line-height: .95rem; text-align: center; box-sizing: border-box; }
.bar .badge[hidden] { display: none; }
#disconnect { background: #8f2f35; }
#disconnect:hover { background: #b23a41; }
.fs-in, .fs-out { display: inline-flex; }
.fs-out, #fullscreen[data-on] .fs-in { display: none; }
#fullscreen[data-on] .fs-out { display: inline-flex; }
#picker-name { overflow: hidden; text-overflow: ellipsis; max-width: 11rem; }
.bar > * { flex-shrink: 0; }
.bar > #stats { flex-shrink: 1; min-width: 0; }
@media (max-width: 1100px) { #picker-name { max-width: 7rem; } }
@media (max-width: 900px) { #stats, #picker-name { display: none; } }
@media (max-width: 620px) { #zoom-group, .bar .sep { display: none; } }
.group { display: flex; align-items: center; gap: .25rem; }
.group[hidden] { display: none; }
.check { display: flex; align-items: center; gap: .25rem; margin: 0 0 0 .5rem; font-size: .8rem; color: #e8ebf0; white-space: nowrap; }
.check input { width: auto; margin: 0; }
#zoom-fit { min-width: 3.4rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* The screen menu is drawn by the page, so it behaves the same in every browser and stays attached to the toolbar. */
.picker { position: relative; }
.picker[hidden] { display: none; }
#picker-button { max-width: 16rem; white-space: nowrap; }
#picker-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 10; margin: 0; padding: .25rem; list-style: none;
  min-width: 17rem; max-height: 60vh; overflow: auto; background: #1c222b; border: 1px solid #3a4352; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .5);
}
#picker-menu[hidden] { display: none; }
#picker-menu li { padding: .4rem .6rem .4rem 1.5rem; border-radius: 6px; cursor: pointer; font-size: .85rem; white-space: nowrap; color: #e8ebf0; position: relative; }
#picker-menu li:hover, #picker-menu li:focus { background: #2f3b4d; outline: none; }
#picker-menu li[aria-selected="true"]::before { content: "✓"; position: absolute; left: .5rem; }
/* What can be done with all the screens at once (the apps only), under the list of screens. */
#picker-menu li.action { padding-left: .6rem; color: #a9c1ff; }
#picker-menu li.action.first { margin-top: .3rem; padding-top: .6rem; border-top: 1px solid #3a4352; border-radius: 0 0 6px 6px; }
#stats { font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-reduced-motion: reduce) { .bar { transition: none; } }

#google { margin-top: .75rem; }
#link-box[hidden] { display: none; }
#link-box button { margin-top: .75rem; margin-right: .5rem; }
#hosts button.host.offline { opacity: .75; }
.devgroup { margin: 0 0 1.25rem; }
.devgroup h3, #recent h3 { margin: 0 0 .5rem; font-size: .75rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.devgroup .hint { margin: 0 0 .5rem; font-size: .82rem; color: var(--muted); }
.devgroup .stack { display: grid; gap: .5rem; }
.devgroup details { margin-top: .5rem; }
.devgroup summary { cursor: pointer; padding: .4rem .1rem; font-size: .85rem; color: var(--muted); }
.devgroup details[open] summary { margin-bottom: .5rem; }
.host-text small.idline { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.host-text small.idline::before { display: none; }
#recent { margin-top: 1.5rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
#recent[hidden] { display: none; }
.recent-head { display: flex; justify-content: space-between; align-items: baseline; }
.linklike { margin: 0; padding: 0; background: none; color: var(--muted); font-size: .8rem; text-decoration: underline; }
#recent-list { display: grid; gap: .4rem; }
#recent-list button { display: flex; justify-content: space-between; width: 100%; margin: 0; padding: .55rem .8rem; color: var(--fg); background: var(--bg); border: 1px solid var(--border); border-radius: 10px; text-align: left; }
#recent-list button:hover { border-color: var(--accent); }
#recent-list .id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; font-weight: 600; }
#recent-list .when { color: var(--muted); font-size: .82rem; }

/* Side panel: files and chat */
#tools {
  position: absolute; top: 2.4rem; right: 0; bottom: 0; width: min(22rem, 100vw); display: flex; flex-direction: column;
  background: rgba(14, 17, 22, .94); color: #e8ebf0; font-size: .85rem; cursor: default; z-index: 5; overflow: hidden;
}
#tools[hidden], #tools [hidden] { display: none; }
#tools header { display: flex; align-items: center; justify-content: space-between; padding: .5rem .75rem; border-bottom: 1px solid #2c3441; }
#tools button { margin: 0; padding: .3rem .6rem; font-size: .85rem; background: #2c3441; color: inherit; border: 0; border-radius: 6px; cursor: pointer; }
#tools button:hover { background: #38414f; }
#tools .note { color: #9aa3b2; margin: .5rem 0; }
#tools ul { list-style: none; margin: 0; padding: 0; }
#transfers li { display: grid; gap: .2rem; padding: .35rem 0; border-bottom: 1px solid #222a35; }
#transfers li.failed span { color: #ff8a8a; }
#transfers progress { width: 100%; height: .4rem; }
#chat-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
#chat-log { flex: 1; overflow-y: auto; padding: .75rem; display: flex; flex-direction: column; gap: .4rem; }
#chat-log div { max-width: 85%; padding: .35rem .6rem; border-radius: 10px; overflow-wrap: anywhere; }
#chat-log .me { align-self: flex-end; background: #2b5cd6; }
#chat-log .them { align-self: flex-start; background: #2c3441; }
#chat-form { display: flex; gap: .4rem; padding: .6rem; border-top: 1px solid #2c3441; }
#chat-form input { flex: 1; min-width: 0; padding: .4rem .6rem; font: inherit; color: inherit; background: #0b0e12; border: 1px solid #2c3441; border-radius: 6px; }
#stage.dropping { outline: 3px dashed #5b8cff; outline-offset: -6px; }
#rec { color: #ff6b6b; font-weight: 600; letter-spacing: .02em; }
#rec[hidden] { display: none; }
#btn-record[aria-pressed="true"] { background: #7a2630; }
#btn-black[aria-pressed="true"] { background: #7a2630; }
#btn-sound[aria-pressed="true"] { background: #1f6f43; }
#print-section select { width: 100%; margin-bottom: .4rem; padding: .35rem; font: inherit; color: inherit; background: #0b0e12; border: 1px solid #2c3441; border-radius: 6px; }
#btn-draw[aria-pressed="true"] { background: #7a5a00; }
#stage.drawing, #stage.drawing video { cursor: crosshair; }
/* A screen that cannot be controlled has no pointer in its picture, so the viewer's own stays visible. */
#stage.view-only, #stage.view-only video { cursor: default; }

/* Settings dialog */
#settings { width: min(34rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 0; color: #e8ebf0; background: #1c222b; border: 1px solid #3a4352; border-radius: 12px; box-shadow: 0 16px 48px rgba(0, 0, 0, .6); font-size: .9rem; cursor: default; }
#settings::backdrop { background: rgba(0, 0, 0, .55); }
#settings header { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; border-bottom: 1px solid #2c3441; position: sticky; top: 0; background: #1c222b; }
#settings h2 { margin: 0; font-size: 1.05rem; }
#settings h3 { margin: 0 0 .25rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: #9aa3b2; }
#settings section { padding: .85rem 1rem; border-bottom: 1px solid #2c3441; }
#settings section:last-child { border-bottom: 0; }
#settings .row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .45rem 0; margin: 0; }
#settings .row[hidden], #settings section[hidden], #settings button[hidden] { display: none; }
#settings .note { display: block; margin: .15rem 0 0; color: #9aa3b2; font-size: .8rem; }
#settings .row.check input { width: 1.1rem; height: 1.1rem; flex: none; }
#settings button { margin: 0; padding: .35rem .8rem; font: inherit; color: inherit; background: #2c3441; border: 0; border-radius: 6px; cursor: pointer; flex: none; }
#settings button:hover { background: #38414f; }
#settings-close { font-size: 1.2rem; padding: .1rem .6rem; }
#settings .check { margin: 0; font-size: inherit; white-space: normal; color: inherit; }
#settings .row > div, #settings .row > span { min-width: 0; }
@media (max-width: 760px) {
  .bar { flex-wrap: wrap; row-gap: .35rem; }
  #stats, .spacer { display: none; }
}
#locked {
  position: absolute; left: 50%; top: 3.2rem; transform: translateX(-50%); max-width: min(92vw, 40rem); padding: .55rem .9rem;
  background: rgba(122, 90, 0, .94); color: #fff6dc; border-radius: 8px; font-size: .85rem; line-height: 1.35; z-index: 4; cursor: default;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5);
}
#locked[hidden] { display: none; }
#locked button { margin: 0 0 0 .5rem; padding: .25rem .7rem; font: inherit; color: #3a2a00; background: #ffe9a8; border: 0; border-radius: 6px; cursor: pointer; }
#locked button[hidden] { display: none; }
#unlock-dialog { width: min(24rem, calc(100vw - 2rem)); padding: 1rem; color: #e8ebf0; background: #1c222b; border: 1px solid #3a4352; border-radius: 12px; box-shadow: 0 16px 48px rgba(0, 0, 0, .6); font-size: .9rem; }
#unlock-dialog::backdrop { background: rgba(0, 0, 0, .55); }
#unlock-dialog h2 { margin: 0 0 .4rem; font-size: 1.05rem; }
#unlock-dialog .note { margin: 0 0 .7rem; color: #9aa3b2; font-size: .8rem; }
#unlock-password { width: 100%; box-sizing: border-box; padding: .5rem .6rem; font: inherit; color: inherit; background: #0b0e12; border: 1px solid #2c3441; border-radius: 6px; }
#unlock-status { min-height: 1.2rem; margin: .5rem 0; font-size: .85rem; }
#unlock-status.bad { color: #ff8a8a; }
#unlock-dialog .buttons { display: flex; justify-content: flex-end; gap: .5rem; }
#unlock-dialog button { margin: 0; padding: .4rem .9rem; font: inherit; color: inherit; background: #2c3441; border: 0; border-radius: 6px; cursor: pointer; }
#unlock-go { background: #2b5cd6 !important; }
#black-scope, #quality { margin-top: .3rem; padding: .3rem .4rem; font: inherit; color: inherit; background: #0b0e12; border: 1px solid #2c3441; border-radius: 6px; }
#black-scope:disabled { opacity: .55; }
#quality { margin-top: .3rem; padding: .3rem .4rem; font: inherit; color: inherit; background: #0b0e12; border: 1px solid #2c3441; border-radius: 6px; }

/* The drawing palette: on the picture itself, so everything is at hand while drawing. */
#draw-palette {
  position: absolute; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: .6rem;
  padding: .45rem .7rem; background: rgba(14, 17, 22, .92); color: #e8ebf0; font-size: .85rem; border: 1px solid #3a4352; border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .55); cursor: default; max-width: 96vw; flex-wrap: wrap; justify-content: center;
}
#draw-palette[hidden] { display: none; }
#draw-palette .label { font-weight: 600; color: #ffd60a; }
#draw-palette .swatches, #draw-palette .sizes { display: inline-flex; align-items: center; gap: .3rem; }
#draw-palette button { margin: 0; padding: .3rem .7rem; font: inherit; color: inherit; background: #2c3441; border: 0; border-radius: 999px; cursor: pointer; }
#draw-palette button:hover { background: #38414f; }
#draw-palette .swatches button { width: 1.6rem; height: 1.6rem; padding: 0; border: 2px solid transparent; border-radius: 50%; }
#draw-palette .swatches button[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 2px #2b5cd6; }
#draw-palette .sizes button[aria-pressed="true"] { background: #2b5cd6; }
#draw-palette .done { background: #2b5cd6; font-weight: 600; }
#draw-palette .done:hover { background: #3d6ee8; }
#draw-palette .swatch-red { background: #ff3b30; }
#draw-palette .swatch-yellow { background: #ffd60a; }
#draw-palette .swatch-green { background: #30d158; }
#draw-palette .swatch-blue { background: #0a84ff; }
#draw-palette .swatch-white { background: #ffffff; }
#draw-palette { width: max-content; }
#stage.drawing #hint { bottom: 5.2rem; }
@media (max-width: 640px) { #draw-palette { border-radius: 16px; } }
#draw-palette .fade { display: inline-flex; align-items: center; gap: .35rem; }
#draw-palette .fade select { padding: .25rem .4rem; font: inherit; color: inherit; background: #2c3441; border: 0; border-radius: 999px; }

/* Connecting with an ID and a temporary password */
.tabs { display: flex; gap: .25rem; margin: 0 0 1rem; border-bottom: 1px solid var(--border); }
.tabs[hidden] { display: none; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; margin-bottom: -1px; padding: .55rem .9rem; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer; }
.tabs button:hover { color: var(--fg); }
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); }
.guest { margin-top: .25rem; }
.guest[hidden] { display: none; }
.guest h2 { font-size: 1.05rem; margin: 0 0 .25rem; }
.guest .note, #login-form .note { margin: 0 0 .75rem; font-size: .82rem; color: var(--muted); }
.guest input { font: 600 1.15rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.guest label + input + label { margin-top: .75rem; }

/* People panel: who is connected, and who has control */
#people { width: min(30rem, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 0; color: #e8ebf0; background: #1c222b; border: 1px solid #3a4352; border-radius: 12px; box-shadow: 0 16px 48px rgba(0, 0, 0, .6); font-size: .9rem; cursor: default; }
#people::backdrop { background: rgba(0, 0, 0, .55); }
#people header { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; border-bottom: 1px solid #2c3441; }
#people h2 { margin: 0; font-size: 1.05rem; }
#people h3 { margin: 0 0 .25rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: #9aa3b2; }
#people section { padding: .85rem 1rem; border-bottom: 1px solid #2c3441; }
#people section:last-child { border-bottom: 0; }
#people section[hidden], #people [hidden] { display: none; }
#people .note { display: block; margin: .15rem 0 .5rem; color: #9aa3b2; font-size: .8rem; }
#people ul { list-style: none; margin: 0; padding: 0; max-height: 16rem; overflow-y: auto; }
#people li { display: flex; align-items: center; gap: .5rem; padding: .4rem 0; border-bottom: 1px solid #262d38; }
#people li:last-child { border-bottom: 0; }
#people .who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#people .tag { flex: none; padding: .05rem .45rem; border-radius: 999px; font-size: .7rem; background: #2c3441; color: #c3cad6; }
#people .tag.control { background: #1d5c3a; color: #c9f2d9; }
#people .tag.admin { background: #3b3a78; color: #dcdcff; }
#people button { margin: 0; padding: .3rem .7rem; font: inherit; color: inherit; background: #2c3441; border: 0; border-radius: 6px; cursor: pointer; flex: none; }
#people button:hover { background: #38414f; }
#people .people-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
#people-close { font-size: 1.2rem; padding: .1rem .6rem; }
.bar #btn-people.asking { box-shadow: 0 0 0 2px #e5a50a inset; }

/* Someone is asking for control: a card the person in charge cannot miss, with the answer on it. */

/* File Transfer: this computer on the left, the other computer on the right, the queue underneath. Always dark, like the toolbar. */
#files-dialog {
  --fm-bg: #1c222b; --fm-pane: #151a21; --fm-line: #2f3745; --fm-text: #e8ebf0; --fm-muted: #9aa3b2; --fm-hover: #232b37; --fm-select: #2b4a85; --fm-accent: #4c8dff;
  width: min(1180px, calc(100vw - 2rem)); height: min(780px, calc(100vh - 2rem)); max-width: none; max-height: none; padding: 0; margin: auto;
  color: var(--fm-text); background: var(--fm-bg); border: 1px solid #3a4352; border-radius: 12px; box-shadow: 0 16px 48px rgba(0, 0, 0, .6); font-size: .85rem;
}
#files-dialog[open] { display: flex; flex-direction: column; }
#files-dialog::backdrop { background: rgba(0, 0, 0, .55); }
#files-dialog button { font: inherit; color: inherit; cursor: pointer; }
#files-dialog button:disabled { opacity: .45; cursor: default; }
#files-dialog svg { flex: none; }
.fm-head { display: flex; align-items: baseline; gap: .6rem; padding: .7rem .9rem .6rem; border-bottom: 1px solid var(--fm-line); }
.fm-head h2 { margin: 0; font-size: 1.05rem; }
.fm-sub { flex: 1; color: var(--fm-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-x { align-self: center; width: 1.8rem; height: 1.8rem; margin: 0; padding: 0; font-size: 1.3rem; line-height: 1; background: transparent; border: 0; border-radius: 6px; }
.fm-x:hover { background: var(--fm-hover); }
.fm-panes { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; padding: .6rem .9rem 0; }
.fm-pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--fm-pane); border: 1px solid var(--fm-line); border-radius: 8px; overflow: hidden; }
.fm-pane.dropping { outline: 2px dashed var(--fm-accent); outline-offset: -3px; }
.fm-title { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .45rem .6rem; background: #1a2029; border-bottom: 1px solid var(--fm-line); }
.fm-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-bar { display: flex; align-items: center; gap: .4rem; padding: .35rem .5rem; border-bottom: 1px solid var(--fm-line); }
.fm-crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: .15rem; overflow: hidden; }
.fm-crumb { max-width: 12rem; margin: 0; padding: .15rem .4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: transparent; border: 0; border-radius: 5px; }
.fm-crumb:hover { background: var(--fm-hover); }
.fm-crumb[aria-current] { font-weight: 600; cursor: default; }
.fm-crumb[aria-current]:hover { background: transparent; }
.fm-sep { color: var(--fm-muted); }
.fm-tools { display: flex; gap: .15rem; }
.fm-tools button { display: grid; place-items: center; width: 1.9rem; height: 1.7rem; margin: 0; padding: 0; background: transparent; border: 0; border-radius: 6px; }
.fm-tools button:hover:not(:disabled) { background: var(--fm-hover); }
.fm-tools button[hidden] { display: none; }
.fm-note { min-height: 1.4rem; padding: .15rem .65rem; color: var(--fm-muted); font-size: .78rem; }
.fm-note:empty { display: none; }
.fm-note.error, .fm-status.error { color: #ff8f8f; }
.fm-columns { display: grid; grid-template-columns: minmax(0, 1fr) 5rem 9.5rem; padding: 0 .5rem; border-bottom: 1px solid var(--fm-line); font-size: .74rem; color: var(--fm-muted); text-transform: uppercase; letter-spacing: .03em; }
.fm-col { margin: 0; padding: .3rem .4rem; text-align: left; background: transparent; border: 0; white-space: nowrap; }
.fm-col-size { text-align: right; }
.fm-col.sorted { color: var(--fm-text); }
.fm-col.sorted::after { content: " " attr(data-arrow); font-size: .6rem; }
.fm-list { flex: 1 1 auto; min-height: 0; margin: 0; padding: .2rem .35rem; list-style: none; overflow-y: auto; outline: none; }
.fm-list[hidden] { display: none; }
.fm-list:focus-visible { box-shadow: inset 0 0 0 2px #3b6fd0; }
.fm-row { display: grid; grid-template-columns: 1.4rem minmax(0, 1fr) 5rem 9.5rem; align-items: center; padding: .22rem .1rem; border-radius: 5px; cursor: default; user-select: none; -webkit-user-select: none; }
.fm-row:hover { background: var(--fm-hover); }
.fm-row[aria-selected="true"] { background: var(--fm-select); }
.fm-row.dir .fm-icon { color: #f0c36a; }
.fm-icon { display: grid; place-items: center; color: var(--fm-muted); }
.fm-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 .3rem; }
.fm-size { text-align: right; color: var(--fm-muted); padding-right: .5rem; font-variant-numeric: tabular-nums; }
.fm-date { color: var(--fm-muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fm-row[aria-selected="true"] .fm-size, .fm-row[aria-selected="true"] .fm-date { color: #cfdcf5; }
.fm-empty { padding: 1rem; color: var(--fm-muted); text-align: center; list-style: none; }
.fm-edit-cell { grid-column: 2 / 5; padding: 0 .3rem; }
.fm-edit { width: 100%; margin: 0; padding: .15rem .35rem; font: inherit; color: var(--fm-text); background: #0f1319; border: 1px solid var(--fm-accent); border-radius: 4px; outline: none; }
.fm-confirm { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; padding: .4rem .65rem; background: #3a2323; border-bottom: 1px solid #5a3030; }
.fm-confirm span { flex: 1; min-width: 10rem; }
.fm-confirm button { margin: 0; padding: .25rem .7rem; background: #2c3441; border: 0; border-radius: 6px; }
.fm-confirm button.danger { background: #c0392b; color: #fff; }
.fm-placeholder { flex: 1 1 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .6rem; padding: 1.5rem; text-align: center; color: var(--fm-muted); }
.fm-placeholder p { max-width: 24rem; margin: 0; }
.fm-action { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .5rem .6rem; border-top: 1px solid var(--fm-line); background: #1a2029; }
.fm-hint { color: var(--fm-muted); font-size: .78rem; }
#files-dialog .fm-primary { display: inline-flex; align-items: center; gap: .45rem; margin: 0; padding: .45rem 1.1rem; font-weight: 600; color: #fff; background: #2f6fe0; border: 0; border-radius: 7px; }
#files-dialog .fm-primary:hover:not(:disabled) { background: #3f7ff0; }
#files-dialog .fm-placeholder button:not(.fm-primary) { margin: 0; padding: .4rem .9rem; background: #2c3441; border: 0; border-radius: 6px; display: inline-flex; gap: .4rem; align-items: center; }
#files-dialog .fm-link { display: inline-flex; align-items: center; gap: .35rem; margin: 0; padding: .15rem .45rem; color: #8db4ff; background: transparent; border: 0; border-radius: 5px; font-size: .8rem; }
#files-dialog .fm-link:hover:not(:disabled) { background: var(--fm-hover); }
.fm-status { min-height: 1.3rem; margin: 0; padding: .3rem .9rem 0; color: var(--fm-muted); font-size: .8rem; }
.fm-status:empty { display: none; }
.fm-queue { flex: 0 0 auto; max-height: 11rem; display: flex; flex-direction: column; margin: .5rem .9rem 0; background: var(--fm-pane); border: 1px solid var(--fm-line); border-radius: 8px; overflow: hidden; }
.fm-queue > header { display: flex; align-items: center; gap: .6rem; padding: .35rem .6rem; background: #1a2029; border-bottom: 1px solid var(--fm-line); }
.fm-queue > header .fm-link { margin-left: auto; }
.fm-summary { color: var(--fm-muted); font-size: .78rem; }
.fm-queue-empty { margin: 0; padding: .7rem .8rem; color: var(--fm-muted); }
.fm-queue-empty[hidden] { display: none; }
#fm-transfers { margin: 0; padding: 0; list-style: none; overflow-y: auto; }
.fm-t { display: grid; grid-template-columns: 1.4rem minmax(0, 1.4fr) minmax(0, 1.2fr) 4.5rem minmax(9rem, 1.3fr) 1.9rem; align-items: center; gap: .3rem; padding: .25rem .6rem; border-bottom: 1px solid #222a35; }
.fm-t:last-child { border-bottom: 0; }
.fm-t > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-t-icon { display: grid; place-items: center; color: var(--fm-muted); }
.fm-t.active .fm-t-icon { color: var(--fm-accent); }
.fm-t-where, .fm-t-size { color: var(--fm-muted); }
.fm-t-status { display: flex; flex-direction: column; gap: .15rem; color: var(--fm-muted); }
.fm-t.done .fm-t-status { color: #7fd69a; }
.fm-t.failed .fm-t-status { color: #ff8f8f; white-space: normal; }
.fm-t.cancelled .fm-t-status { color: var(--fm-muted); }
.fm-t progress { width: 100%; height: .35rem; }
#files-dialog .fm-t-cancel { display: grid; place-items: center; width: 1.6rem; height: 1.6rem; margin: 0; padding: 0; background: transparent; border: 0; border-radius: 5px; }
#files-dialog .fm-t-cancel:hover { background: var(--fm-hover); }
.fm-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem .9rem .75rem; }
#print-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; color: var(--fm-muted); }
#print-row[hidden] { display: none; }
#print-row select { max-width: 14rem; padding: .25rem .4rem; font: inherit; color: var(--fm-text); background: #0f1319; border: 1px solid var(--fm-line); border-radius: 6px; }
#print-row button { margin: 0; padding: .3rem .7rem; background: #2c3441; border: 0; border-radius: 6px; }
.fm-foot .fm-primary { margin-left: auto; }
@media (max-width: 820px) {
  #files-dialog { width: calc(100vw - 1rem); height: calc(100vh - 1rem); }
  .fm-panes { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
  .fm-columns, .fm-row { grid-template-columns: 1.4rem minmax(0, 1fr) 4.5rem; }
  .fm-col-modified, .fm-date { display: none; }
  .fm-t { grid-template-columns: 1.4rem minmax(0, 1fr) minmax(7rem, 1fr) 1.9rem; }
  .fm-t-where, .fm-t-size { display: none; }
}

/* "So-and-so is asking for control": a pop-up over everything, for the person in charge. */
#ask-dialog { width: min(24rem, calc(100vw - 2rem)); padding: 1.1rem 1.2rem; color: #e8ebf0; background: #1c222b; border: 1px solid #e5a50a; border-radius: 12px; box-shadow: 0 16px 48px rgba(0, 0, 0, .6); }
#ask-dialog::backdrop { background: rgba(0, 0, 0, .55); }
#ask-dialog h2 { margin: 0 0 .4rem; font-size: 1.05rem; overflow-wrap: anywhere; }
#ask-dialog .note { margin: 0 0 .5rem; color: #9aa3b2; font-size: .85rem; }
#ask-dialog .buttons { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .8rem; }
#ask-dialog button { margin: 0; padding: .45rem 1rem; font: inherit; color: inherit; background: #2c3441; border: 0; border-radius: 6px; cursor: pointer; }
#ask-dialog button:hover { background: #38414f; }
#ask-dialog button.give { background: #1f6feb; color: #fff; }
#ask-dialog button.give:hover { background: #3a82f2; }

/* The invitation: the ID and the password always shown, copied and sent together. */
#people .invite-card { margin-top: .4rem; padding: .75rem .85rem; background: #151a21; border: 1px solid #3a4352; border-radius: 10px; }
#people .invite-pair { display: grid; grid-template-columns: auto 1fr; gap: .2rem 1rem; margin: 0 0 .5rem; }
#people .invite-pair > div { display: contents; }
#people .invite-pair dt { align-self: center; color: #9aa3b2; font-size: .8rem; }
#people .invite-pair dd { margin: 0; font-size: 1.55rem; font-weight: 700; letter-spacing: .1em; font-variant-numeric: tabular-nums; user-select: all; -webkit-user-select: all; }
#people .invite-card .note { margin: 0; }
#people button.primary { background: #1f6feb; color: #fff; }
#people button.primary:hover { background: #3a82f2; }
#people button.primary:disabled { background: #2c3441; color: #9aa3b2; cursor: default; }
#people .tag.asking { background: #5c4510; color: #ffe2a3; }
#people li.asking { background: rgba(229, 165, 10, .08); border-radius: 6px; padding-left: .4rem; padding-right: .4rem; }
.bar #btn-ask.takeback { background: #8a5a00; }
.bar #btn-ask.takeback:hover { background: #a36b00; }
.bar #btn-ask:disabled { opacity: .7; cursor: default; }

/* The page inside the app's own window for one computer: no sidebar, just the connection. */
.app-session .side { display: none; }
.app-session .panel { justify-content: center; }
/* The way out of the connect form when a session in the app's window ended or could not start: back to the app's own screen. */
.app-back { display: none; align-self: flex-start; margin: .8rem 0 0 1.5rem; padding: .45rem .9rem; font: inherit; font-size: .9rem; color: inherit; background: #2c3441; border: 0; border-radius: 8px; cursor: pointer; }
.app-session .app-back:not([hidden]) { display: inline-block; }
.app-back:hover { background: #38414f; }

/* ---------- The launcher design (home screen) ----------
   Calm neutral surfaces; blue means you, orange is the one main action; glass only on the top bar and the footer; flat colours, no gradients.
   Light and dark follow the system. These rules come last so they replace the older sidebar layout; the live session view above is untouched. */
.panel {
  --l-bg: #f4f5f9; --l-panel: #ffffff; --l-line: #e3e6ee; --l-ink: #12163a; --l-mute: #667089; --l-field: #f7f8fb;
  --l-blue: #2563eb; --l-blue-s: #e6eeff; --l-orange: #fb923c; --l-tint-b: #b9d2ff; --l-tint-o: #ffd0a3;
  --l-glass: #ffffffb3; --l-rim: #ffffffd9; --l-shadow: #1b2a6a14;
  flex-direction: column; position: relative; overflow: hidden; background: var(--l-bg); color: var(--l-ink);
}
@media (prefers-color-scheme: dark) {
  .panel {
    --l-bg: #0e1118; --l-panel: #161a25; --l-line: #272d3c; --l-ink: #eef1f8; --l-mute: #8f99b3; --l-field: #1b2030;
    --l-blue: #79a9ff; --l-blue-s: #1c2849; --l-tint-b: #1d3a8a; --l-tint-o: #7a4311; --l-glass: #161a2599; --l-rim: #ffffff26; --l-shadow: #00000040;
  }
}
.panel::before, .panel::after { content: ""; position: absolute; z-index: 0; border-radius: 76px; pointer-events: none; }
.panel::before { left: -90px; top: -90px; width: 420px; height: 380px; border-radius: 96px; background: var(--l-tint-b); }
.panel::after { right: -110px; bottom: -90px; width: 440px; height: 380px; border-radius: 96px; background: var(--l-tint-o); }
.panel > * { position: relative; z-index: 1; }
.side { flex: none; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .6rem 1.1rem; padding: .6rem 1.4rem; background: var(--l-glass); color: var(--l-ink); border-bottom: 1px solid var(--l-line);
  backdrop-filter: blur(16px) saturate(1.25); -webkit-backdrop-filter: blur(16px) saturate(1.25); box-shadow: inset 0 -1px 0 var(--l-rim); }
.brand { padding: 0; border: 0; gap: .8rem; font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; color: var(--l-ink); }
.logo { width: 2.8rem; height: 2.8rem; }
.nav { display: flex; gap: 2px; margin: 0 auto; padding: 3px; border-radius: 99px; background: color-mix(in srgb, var(--l-panel) 55%, transparent); border: 1px solid var(--l-line); }
.nav-item { padding: .38rem .95rem; border-radius: 99px; color: var(--l-mute); font-size: .85rem; font-weight: 600; white-space: nowrap; }
.nav-item svg { display: none; }
a.nav-item:hover { background: none; color: var(--l-ink); }
.nav-item.active { background: var(--l-panel); color: var(--l-ink); box-shadow: 0 1px 3px #0003; }
.account { margin: 0; padding: 0; background: none; flex-wrap: nowrap; gap: .5rem; }
.account[hidden] + .side-note { margin: 0; }
.avatar { width: 1.9rem; height: 1.9rem; background: var(--l-blue-s); color: var(--l-blue); font-size: .8rem; }
.who { display: none; }
#signout { flex: none; margin: 0; padding: .3rem .8rem; font-size: .8rem; color: var(--l-ink); background: transparent; border: 1px solid var(--l-line); }
#signout:hover { background: color-mix(in srgb, var(--l-ink) 7%, transparent); }
.side-note { display: none; }
.main { background: none; }
.strip { background: none; border-bottom: 1px solid var(--l-line); color: var(--l-mute); padding: .55rem 1.5rem; }
.card { width: min(100% - 3rem, 40rem); margin: 2.2rem auto 0; padding: 1.6rem 1.6rem 1.4rem; background: color-mix(in srgb, var(--l-panel) 58%, transparent); color: var(--l-ink); border: 1px solid color-mix(in srgb, var(--l-line) 60%, transparent); border-radius: 20px; backdrop-filter: blur(22px) saturate(1.35); -webkit-backdrop-filter: blur(22px) saturate(1.35); box-shadow: inset 0 1px 0 var(--l-rim), 0 10px 30px var(--l-shadow); }
.card h1 { text-align: center; font-size: 1.55rem; font-weight: 650; letter-spacing: -.01em; margin-bottom: .9rem; }
#message { color: var(--l-mute); text-align: center; }
.card label { color: var(--l-mute); font-weight: 600; }
.card input { background: var(--l-field); color: var(--l-ink); border: 1px solid var(--l-line); border-radius: 12px; padding: .7rem .9rem; }
.card input:focus-visible { outline: 2px solid var(--l-blue); outline-offset: 1px; }
.card button { background: var(--l-orange); color: #2a1203; border-radius: 12px; font-weight: 650; padding: .65rem 1.2rem; }
.card button:hover { filter: brightness(1.06); }
.card form button[type="submit"], #google, #retry { width: 100%; }
.tabs { justify-content: center; gap: 2px; width: max-content; max-width: 100%; margin: 0 auto 1.2rem; padding: 3px; border: 1px solid var(--l-line); border-radius: 99px; background: var(--l-field); }
.card .tabs button { margin: 0; padding: .4rem 1rem; border: 0; border-radius: 99px; background: none; color: var(--l-mute); font-weight: 600; font-size: .85rem; }
.card .tabs button:hover { color: var(--l-ink); filter: none; }
.card .tabs button[aria-selected="true"] { background: var(--l-panel); color: var(--l-ink); box-shadow: 0 1px 3px #0003; border: 0; }
#hosts button.host { background: var(--l-field); border: 1px solid var(--l-line); color: var(--l-ink); border-radius: 14px; margin: 0; }
#hosts button.host:hover, #hosts button.host:focus-visible { background: var(--l-blue-s); border-color: transparent; filter: none; }
.host svg { color: var(--l-blue); }
.host-text small { color: var(--l-mute); }
.host-go { background: var(--l-orange); color: #2a1203; }
#hosts button.host.offline .host-go { background: var(--l-line); color: var(--l-mute); }
.devgroup h3, #recent h3 { color: var(--l-mute); }
#recent { border-top: 1px solid var(--l-line); }
#recent-list button { background: var(--l-field); border: 1px solid var(--l-line); color: var(--l-ink); border-radius: 12px; margin: 0; }
#recent-list button:hover { background: var(--l-blue-s); border-color: transparent; filter: none; }
#recent-list .when, .guest .note, #login-form .note { color: var(--l-mute); }
.linklike { background: none !important; color: var(--l-mute) !important; }
#link-box button { width: auto; }
.ready { color: var(--l-mute); border-top: 1px solid var(--l-line); background: var(--l-glass); backdrop-filter: blur(16px) saturate(1.25); -webkit-backdrop-filter: blur(16px) saturate(1.25); box-shadow: inset 0 1px 0 var(--l-rim); }
@media (max-width: 700px) {
  .side { padding: .6rem 1rem; }
  .nav { order: 3; width: 100%; margin: 0; justify-content: space-between; overflow-x: auto; }
  .account { margin-left: auto; }
  .card { width: calc(100% - 2rem); margin-top: 1.2rem; padding: 1.2rem 1rem; }
}
