/* Ported verbatim from Breckly/demo/assets/css/remote.css. Change a value here only to match the reference. */
/* Remote control: the terminal (assets/js/terminal.js) and remote desktop
   (assets/js/remotedesktop.js) components, and the Endpoint remote control screens
   (assets/js/endpoint-remote.js). The terminal stays on an Ink ground in both themes. */

/* ---------- Terminal ---------- */

.term {
  --term-size: 12.5px;
  position: relative; display: flex; flex-direction: column; min-height: 0; overflow: hidden;
  border-radius: var(--r-lg); border: 1px solid #1B2652; background: #0A1230; color: #DCE3F5; container-type: inline-size;
}
[data-theme="dark"] .term { background: #050B1C; border-color: var(--line); }
.term-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-height: 40px; padding: 5px 6px 5px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.04); font-size: 12px; color: #AEB8D1;
}
.term-state .status.online { color: #3DD598; }
.term-state .status.degraded { color: #FFC14D; }
.status.ended { color: #8C97B5; }
.term-title { font: 500 11.5px var(--font-data); color: #DCE3F5; }
.term-rec, .rd-rec { display: inline-flex; align-items: center; gap: 5px; }
.term-rec .icon { color: #FF6B7F; }
.term-time { color: #8C97B5; }
.term-tools { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.term-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-width: 28px; height: 28px; padding: 0 7px;
  border: 0; border-radius: 7px; background: transparent; color: #C5CEE6; font: 700 11.5px var(--font-ui); cursor: pointer;
}
.term-btn:hover { background: rgba(255, 255, 255, 0.09); color: #FFFFFF; }
.term-btn:focus-visible { outline: 2px solid var(--p-accent-dk); outline-offset: 1px; }
.term-btn.end { margin-left: 4px; border: 1px solid rgba(255, 255, 255, 0.18); }
.term-btn.end:hover { border-color: #FF6B7F; color: #FFB3BE; background: rgba(255, 107, 127, 0.1); }
.term-find {
  display: flex; align-items: center; gap: 6px; padding: 5px 6px 5px 12px; color: #AEB8D1; font-size: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.06);
}
.term-find[hidden] { display: none; }
.term-find input {
  flex: 1; min-width: 0; height: 27px; padding: 0 9px; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 7px;
  background: rgba(0, 0, 0, 0.25); color: #FFFFFF; font: 12px var(--font-data); outline: none;
}
.term-find input:focus { border-color: var(--p-accent-dk); }
.term-alert {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; font-size: 12px; color: #FFD27A;
  background: rgba(255, 193, 77, 0.1); border-bottom: 1px solid rgba(255, 193, 77, 0.22);
}
.term-alert[hidden] { display: none; }
.term-out {
  flex: 1 1 auto; min-height: 0; overflow: auto; padding: 10px 14px; outline: none;
  font: var(--term-size) / 1.55 var(--font-data); white-space: pre-wrap; overflow-wrap: anywhere;
}
.term-out:focus-visible { box-shadow: inset 0 0 0 2px var(--p-accent-dk); }
.tl { min-height: 1.55em; }
.tl.cmd { color: #FFFFFF; }
.tp { color: #7FB0FF; font-weight: 600; }
.tl.sys { display: flex; align-items: center; gap: 8px; color: #8C97B5; font-style: italic; }
.tl.ok { color: #6EE7B7; }
.tl.err { color: #FF8A9B; }
.tl.warn { color: #FFD27A; }
.tl.dim { color: #8C97B5; }
.term-out mark { border-radius: 2px; background: rgba(255, 193, 77, 0.32); color: inherit; }
.term-out mark.cur { background: #FFC14D; color: #061641; }
.term-line { display: flex; align-items: baseline; min-height: 1.55em; }
.term-line[hidden] { display: none; }
.term-line .tp { flex: none; white-space: nowrap; }
.term-line input {
  flex: 1; min-width: 0; margin: 0 0 0 1ch; padding: 0; border: 0; outline: none; background: transparent;
  color: #FFFFFF; font: inherit; line-height: inherit; caret-color: var(--p-glow); caret-shape: block;
}
.term-line input:disabled { opacity: 0.45; }
.term:focus-within { border-color: color-mix(in oklab, var(--p-accent-dk) 55%, #1B2652); }
.term-ended {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 16px;
  background: rgba(5, 10, 28, 0.72); backdrop-filter: blur(1.5px);
}
.term-ended > div {
  display: grid; justify-items: center; gap: 5px; max-width: 360px; padding: 18px 22px; text-align: center;
  border-radius: var(--r-lg); border: 1px solid rgba(255, 255, 255, 0.1); background: #111B3E; color: #C5CEE6; font-size: 12.5px;
  box-shadow: 0 20px 50px -18px rgba(0, 0, 0, 0.7);
}
.term-ended strong { color: #FFFFFF; font-size: 15px; }
.term-ended-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: rgba(61, 213, 152, 0.16); color: #3DD598; }
.term-ended-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 8px; }
.term:fullscreen { border-radius: 0; }

/* ---------- Remote desktop ---------- */

.rd-host { display: flex; flex-direction: column; min-height: 0; }
.rd-host > * { flex: 1 1 auto; min-height: 0; }
.rd-panel-card { display: grid; place-items: center; padding: 22px 16px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); }
.rd-start { display: grid; justify-items: center; gap: 10px; max-width: 470px; text-align: center; }
.rd-start h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.rd-start p { font-size: 13px; line-height: 1.5; color: var(--ink-2); }
.rd-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.rd-ic.ok { background: color-mix(in oklab, var(--ok-mark) 13%, var(--surface)); color: var(--ok); }
.rd-ic.crit { background: color-mix(in oklab, var(--crit-mark) 10%, var(--surface)); color: var(--crit); }
.rd-modes { text-align: left; }
.rd-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.rd-ring { position: relative; display: grid; place-items: center; width: 54px; height: 54px; color: var(--accent); }
.rd-ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.rd-ring circle { fill: none; stroke: var(--sunken); stroke-width: 2.6; }
[data-theme="dark"] .rd-ring circle { stroke: var(--line); }
.rd-ring .rd-ring-run { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 100; animation: rd-count 120s linear forwards; }
.rd-steps { display: grid; gap: 9px; margin: 2px 0 0; padding: 0; list-style: none; text-align: left; font-size: 13px; color: var(--ink-3); }
.rd-steps li { display: flex; align-items: center; gap: 8px; }
.rd-steps .done { color: var(--ok); }
.rd-steps .run { color: var(--ink); font-weight: 600; }
.rd-steps .spin { color: var(--accent); }
/* Connection stepper of a live session (kit .stepper look, laid out vertically). */
.rd-connect { display: grid; justify-items: center; gap: 12px; max-width: 420px; text-align: center; }
.rd-connect h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.rd-connect-steps { flex-direction: column; flex-wrap: nowrap; align-items: flex-start; gap: 0; text-align: left; }
.rd-connect-steps li { position: relative; align-items: flex-start; padding-bottom: 12px; }
.rd-connect-steps li:last-child { padding-bottom: 0; }
.rd-connect-steps li + li::before { content: none; }
.rd-connect-steps li:not(:last-child)::after {
  content: ""; position: absolute; left: 10.25px; top: 24px; bottom: 0; width: 1.5px; border-radius: 1px; background: var(--line-strong);
}
.rd-connect-steps li.done:not(:last-child)::after { background: var(--ok-mark); }
.rd-connect-steps .n { flex: none; }
.rd-connect-steps .fail { color: var(--crit); }
.rd-connect-steps .fail .n { border-color: var(--crit); color: var(--crit); }
/* A refusal waiting on an action (the usage, a right, a rule, the licence): the waiting tone, never the critical one. */
.rd-connect-steps .held { color: var(--ink); }
.rd-connect-steps .held .n { border-color: var(--wait-mark); color: var(--wait); }
.rd-connect-label { display: grid; gap: 3px; min-width: 0; }
.rd-connect-title { line-height: 22px; }
.rd-connect-label small { margin-left: 6px; font-size: 12px; font-weight: 500; color: var(--ink-3); }
.rd-connect-why { max-width: 340px; font-size: 13px; font-weight: 400; line-height: 1.5; color: var(--ink-2); }
.rd-connect-steps .fail .rd-connect-why { color: var(--crit); }
.rd-connect-act { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 3px; font-size: 13px; font-weight: 400; color: var(--ink-2); }
.rd-connect-act select.field { width: auto; min-width: 168px; }
.rd-connect-act a { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; color: var(--accent); }
.rd-connect-act a:hover { text-decoration: underline; text-underline-offset: 3px; }
.rd-connect-error { max-width: 380px; font-size: 13px; line-height: 1.5; color: var(--crit); }
.rd-connect .rd-btns { margin-top: 2px; }

.rd { display: flex; flex-direction: column; min-height: 0; overflow: hidden; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); container-type: inline-size; }
.rd-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.rd-meta { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-3); }
/* The bar holds still while its figures tick: fixed tabular slots, both states in one cell, « Recorded » keeps its room. */
.rd-meta .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rd-time { display: inline-block; min-width: 5ch; }
.rd-lat, .rd-fps { display: inline-block; }
.rd-lat { min-width: 7ch; text-align: right; }
.rd-fps { min-width: 5ch; }
.rd-state { display: inline-grid; }
.rd-state > .status { grid-area: 1 / 1; justify-self: start; }
.rd-state > .rd-off, .rd-meta > .rd-off { visibility: hidden; }
.rd-rec .icon { color: var(--crit-mark); }
.rd-mode button { display: inline-flex; align-items: center; gap: 5px; }
.rd-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-left: auto; }
.rd-btn {
  position: relative; display: inline-flex; align-items: center; gap: 5px; height: 29px; padding: 0 8px;
  border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font: 600 12px var(--font-ui); cursor: pointer;
}
.rd-btn:hover:not(:disabled) { background: var(--sunken); color: var(--ink); }
.rd-btn[aria-pressed="true"] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent); }
.rd-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.rd-select { display: inline-flex; align-items: center; gap: 3px; height: 29px; padding: 0 2px 0 8px; border-radius: var(--r-sm); border: 1px solid var(--line); color: var(--ink-2); }
.rd-select select { height: 27px; border: 0; background: transparent; color: var(--ink); font: 600 12px var(--font-ui); cursor: pointer; }
.rd-select select option { color: #0B1633; }
.rd-unread { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--p-accent); box-shadow: 0 0 0 2px var(--surface); }
.rd-unread[hidden] { display: none; }
.rd-body { position: relative; flex: 1 1 auto; min-height: 0; display: flex; }
.rd-stage {
  position: relative; flex: 1 1 auto; min-width: 0; min-height: 220px; display: grid; place-items: center; overflow: hidden;
  padding: 12px; background: #0B1230; container-type: size;
}
[data-theme="dark"] .rd-stage { background: #040916; }
.rd[data-scale="actual"] .rd-stage { place-items: safe center; overflow: auto; overscroll-behavior: contain; }
.rd-stage:fullscreen { padding: 0; background: #000000; }

/* The mock remote screen scales with its width (container units). */
.rd-screen {
  --cx: 52%; --cy: 58%;
  position: relative; width: min(100cqw, 100cqh * 16 / 9); aspect-ratio: 16 / 9; overflow: hidden; outline: none;
  border-radius: 6px; box-shadow: 0 14px 40px -14px rgba(0, 0, 0, 0.65); container-type: inline-size; user-select: none;
}
.rd[data-scale="actual"] .rd-screen { width: 1280px; }
/* The mock screen draws its own cursor; a live picture keeps the operator's real pointer. */
.rd[data-mode="Control"] .rd-screen:not([data-rd-stream]) { cursor: none; }
.rd[data-mode="Control"] .rd-screen[data-rd-stream] { cursor: default; }
.rd[data-mode="View only"] .rd-screen[data-rd-stream] { cursor: not-allowed; }
/* Where the last pointer position sent lands on a live picture, until the stream carries the remote cursor. */
.rd-mark {
  display: none; position: absolute; z-index: 9; left: var(--mx, 50%); top: var(--my, 50%); width: 11px; height: 11px;
  border: 1.5px solid #FFFFFF; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none;
  box-shadow: 0 0 0 1px rgba(6, 22, 65, 0.65), 0 1px 3px rgba(0, 0, 0, 0.45);
}
.rd[data-mode="Control"] .rd-screen.rd-marked .rd-mark { display: block; }
.rd-screen:focus-visible { box-shadow: 0 0 0 3px var(--p-accent-dk), 0 14px 40px -14px rgba(0, 0, 0, 0.65); }
.rd[data-state="reconnecting"] .rd-screen { filter: grayscale(0.85) brightness(0.65); }
.rd-wall { position: absolute; inset: 0; background: linear-gradient(135deg, #0B3D91 0%, #1E6FD9 58%, #7CC0FF 100%); }
.rd-screen.macos .rd-wall { background: linear-gradient(160deg, #2E2466 0%, #9C4F8E 55%, #F0A35E 100%); }
.rd-screen.linux .rd-wall { background: linear-gradient(150deg, #1B2B3A 0%, #2F5A66 60%, #5FA8A0 100%); }
.rd-banner {
  position: absolute; z-index: 6; top: 1.4cqw; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 0.6cqw;
  padding: 0.55cqw 1.3cqw; border-radius: 99px; background: rgba(6, 22, 65, 0.86); color: #FFFFFF; font: 600 1.15cqw var(--font-ui); white-space: nowrap;
}
.rd-banner .icon { width: 1.3cqw; height: 1.3cqw; }
.rd-screen.macos .rd-banner, .rd-screen.linux .rd-banner { top: 3.6cqw; }
.rd-win { position: absolute; z-index: 1; overflow: hidden; border-radius: 0.7cqw; background: #FFFFFF; box-shadow: 0 1.6cqw 3cqw -1cqw rgba(0, 0, 0, 0.45); }
.rd-win.front { z-index: 4; }
.rd-win.w1 { left: 6%; top: 12%; width: 46%; height: 60%; }
.rd-win.w2 { left: 42%; top: 34%; width: 38%; height: 44%; z-index: 2; }
.rd-win.w3 { left: 57%; top: 10%; width: 36%; height: 32%; z-index: 3; }
.rd-win.w4 { left: 7%; top: 10%; width: 86%; height: 74%; }
.rd-win-bar { display: flex; align-items: center; gap: 0.55cqw; height: 3.2cqw; padding: 0 1.1cqw; background: #EEF2F8; color: #3A4664; font: 600 1.15cqw var(--font-ui); }
.rd-win-bar i { flex: none; width: 0.95cqw; height: 0.95cqw; border-radius: 50%; background: #C9D3E6; }
.rd-screen.macos .rd-win-bar i:nth-child(1) { background: #FF5F57; }
.rd-screen.macos .rd-win-bar i:nth-child(2) { background: #FEBC2E; }
.rd-screen.macos .rd-win-bar i:nth-child(3) { background: #28C840; }
.rd-win-bar span { overflow: hidden; margin-left: 0.6cqw; white-space: nowrap; text-overflow: ellipsis; }
.rd-win-body { position: absolute; inset: 3.2cqw 0 0; padding: 1.3cqw; }
.rd-mail p { display: flex; align-items: center; gap: 1cqw; margin: 0 0 0.9cqw; padding: 0.35cqw 0.6cqw; border-radius: 0.5cqw; font: 600 1.1cqw var(--font-ui); color: #26325C; }
.rd-mail p.on { background: #E8F0FF; }
.rd-mail b { flex: none; width: 10cqw; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rd-mail span { flex: 1; height: 0.8cqw; border-radius: 0.4cqw; background: #E2E7F0; }
.rd-files { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.3cqw; }
.rd-files b { aspect-ratio: 1.25; border-radius: 0.6cqw; background: #FFD27A; }
.rd-files b.doc { background: #C9D9F5; }
.rd-note { color: #1B2440; font: 1.35cqw / 1.5 var(--font-data); white-space: pre-wrap; overflow-wrap: anywhere; }
.rd-caret { display: inline-block; width: 0.16cqw; height: 1.5cqw; margin-left: 0.1cqw; vertical-align: -0.28cqw; background: #1B2440; animation: rd-blink 1s steps(2, jump-none) infinite; }
.rd-web-head { height: 3cqw; margin-bottom: 1.3cqw; border-radius: 0.5cqw; background: #E8F0FF; }
.rd-web-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.3cqw; }
.rd-web-cards b { height: 7cqw; border-radius: 0.6cqw; border: 1px solid #E2E7F0; background: #F4F7FC; }
.rd-web-bars { display: flex; align-items: flex-end; gap: 1.3cqw; height: 20cqw; margin-top: 1.6cqw; }
.rd-web-bars i { flex: 1; border-radius: 0.4cqw 0.4cqw 0 0; background: #0A5CFF; opacity: 0.78; }
.rd-taskbar, .rd-panel, .rd-menubar { position: absolute; z-index: 5; left: 0; right: 0; display: flex; align-items: center; gap: 1cqw; padding: 0 1.4cqw; }
.rd-taskbar { bottom: 0; height: 4cqw; background: rgba(10, 18, 48, 0.84); }
.rd-taskbar span { width: 2.3cqw; height: 2.3cqw; border-radius: 0.5cqw; background: rgba(255, 255, 255, 0.28); }
.rd-taskbar .start { background: #4F8DFF; }
.rd-taskbar .on { box-shadow: 0 0.5cqw 0 -0.3cqw #7FB0FF; }
.rd-taskbar em, .rd-panel em, .rd-menubar em { margin-left: auto; color: #FFFFFF; font: 600 1.2cqw var(--font-ui); font-style: normal; }
.rd-panel { top: 0; height: 2.7cqw; background: rgba(0, 0, 0, 0.6); }
.rd-panel span, .rd-menubar span { width: 6cqw; height: 0.9cqw; border-radius: 0.45cqw; background: rgba(255, 255, 255, 0.45); }
.rd-menubar { top: 0; height: 2.6cqw; background: rgba(255, 255, 255, 0.32); }
.rd-dock { position: absolute; z-index: 5; left: 50%; bottom: 1cqw; transform: translateX(-50%); display: flex; gap: 0.9cqw; padding: 0.8cqw 1.2cqw; border-radius: 1.4cqw; background: rgba(255, 255, 255, 0.34); }
.rd-dock span { width: 3cqw; height: 3cqw; border-radius: 0.8cqw; background: rgba(255, 255, 255, 0.8); }
.rd-cursor, .rd-ucursor { position: absolute; z-index: 8; pointer-events: none; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.55)); }
.rd-cursor svg, .rd-ucursor svg { width: 1.8cqw; height: 1.8cqw; stroke-width: 1.5; }
.rd-cursor { left: var(--cx); top: var(--cy); transform: translate(-22%, -16%); }
.rd-cursor svg { fill: #FFFFFF; stroke: #0B1633; }
.rd-ucursor { display: none; left: 30%; top: 40%; animation: rd-wander 9s ease-in-out infinite; }
.rd-ucursor svg { fill: #FFD27A; stroke: #061641; }
.rd[data-mode="View only"] .rd-cursor { display: none; }
.rd[data-mode="View only"] .rd-ucursor { display: block; }
.rd-ripple { position: absolute; z-index: 7; width: 3.2cqw; height: 3.2cqw; margin: -1.6cqw 0 0 -1.6cqw; border-radius: 50%; border: 2px solid #FFFFFF; pointer-events: none; animation: rd-ripple 0.55s ease-out forwards; }
.rd-hint {
  position: absolute; z-index: 9; left: 50%; bottom: 7cqw; transform: translateX(-50%); padding: 0.7cqw 1.5cqw; border-radius: 99px;
  background: rgba(6, 22, 65, 0.9); color: #FFFFFF; font: 600 1.3cqw var(--font-ui); white-space: nowrap; opacity: 0; pointer-events: none;
}
.rd-hint.show { animation: rd-hint 1.5s ease forwards; }
.rd-drop {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 6px; padding: 16px;
  background: rgba(5, 10, 28, 0.55); color: #FFFFFF; font-size: 13px; text-align: center;
}
.rd-drop[hidden] { display: none; }
.rd-drop strong { font-size: 15px; }
.rd-drop .spin { width: 20px; height: 20px; color: #FFC14D; }
.rd-chat { flex: none; display: flex; flex-direction: column; width: 264px; min-height: 0; border-left: 1px solid var(--line); background: var(--surface); }
.rd-chat[hidden] { display: none; }
.rd-chat header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.rd-msgs { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 10px 12px; list-style: none; font-size: 12.5px; }
.rd-msgs li { max-width: 88%; padding: 7px 10px; border-radius: 12px 12px 12px 4px; background: var(--sunken); line-height: 1.4; }
.rd-msgs li span { display: block; margin-bottom: 2px; font-size: 11px; font-weight: 700; color: var(--ink-3); }
.rd-msgs li.me { align-self: flex-end; border-radius: 12px 12px 4px 12px; background: var(--accent-soft); }
.rd-msgs li.sys { align-self: center; max-width: none; padding: 0; background: none; color: var(--ink-3); font-size: 11.5px; }
.rd-say { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.rd-say input { flex: 1; min-width: 0; height: 31px; padding: 0 10px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font: 13px var(--font-ui); }
.rd-say input:focus { outline: 2px solid var(--accent-line); outline-offset: 0; border-color: var(--accent); }

/* Live viewer (M13): the stream's canvas at the picture's own ratio, the remote cursor drawn from its shape, the stats overlay,
   the keyboard capture strip, the toolbar's menus and full screen on the whole viewer. Not in the demo, which has no live
   stream; tokens and sizes follow the bar, the popovers and the menu lines. */
.rd-menu { display: contents; }
/* A live or recorded picture: the frame takes the picture's own ratio (--rd-ratio, set from its size) and, in « Ajuster », the
   largest size that fits the stage both ways, centred, the stage showing around it as letterbox bars; clicks there reach nothing.
   « 100 % » draws one remote pixel per screen pixel (--rd-natural) and the stage scrolls; in View only a drag moves it too. */
.rd-screen[data-rd-stream], .rd-screen[data-rd-picture] {
  flex: none; aspect-ratio: var(--rd-ratio, 1.7778); width: min(100cqw, calc(100cqh * var(--rd-ratio, 1.7778))); max-width: none; background: #000000;
}
.rd[data-scale="actual"] .rd-screen[data-rd-stream], .rd[data-scale="actual"] .rd-screen[data-rd-picture] { width: var(--rd-natural, 1280px); }
.rd[data-scale="actual"][data-mode="View only"] .rd-screen[data-rd-stream] { cursor: grab; }
.rd-stage.rd-panning, .rd-stage.rd-panning * { cursor: grabbing !important; }
.rd-scale button .icon { color: var(--ink-3); }
.rd-scale button[aria-pressed="true"] .icon { color: var(--accent); }
.rd-osd div:not(.rd-osd-more) + .rd-osd-more { margin-top: 4px; padding-top: 4px; border-top: 1px solid rgba(255, 255, 255, 0.16); }
.rd-osd:has(.rd-osd-more) { grid-template-columns: minmax(76px, max-content) auto; column-gap: 10px; }
.rd-osd:has(.rd-osd-more) div { grid-column: 1 / -1; grid-template-columns: subgrid; }
.rd-canvas { position: absolute; inset: 0; overflow: hidden; }
.rd-canvas-pic { display: block; width: 100%; height: 100%; object-fit: contain; background: #000000; }
.rd-osd {
  position: absolute; z-index: 9; top: 10px; left: 10px; display: grid; gap: 2px; margin: 0; padding: 8px 10px; border-radius: var(--r-md);
  background: rgba(6, 22, 65, 0.84); color: #FFFFFF; font: 500 11.5px/1.45 var(--font-data); pointer-events: none;
}
.rd-osd div { display: grid; grid-template-columns: 76px auto; gap: 10px; }
.rd-osd dt { color: rgba(255, 255, 255, 0.62); font-family: var(--font-ui); font-weight: 600; }
.rd-osd dd { margin: 0; white-space: nowrap; }
.rd-kb {
  position: absolute; z-index: 10; bottom: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px;
  max-width: calc(100% - 24px); padding: 5px 5px 5px 11px; border-radius: 99px; background: rgba(6, 22, 65, 0.9); color: #FFFFFF;
  font: 600 12px var(--font-ui); box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.6);
}
.rd-kb > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rd-kb-btn {
  flex: none; height: 24px; padding: 0 10px; border-radius: 99px; border: 1px solid rgba(255, 255, 255, 0.38); background: transparent;
  color: #FFFFFF; font: 600 12px var(--font-ui); cursor: pointer;
}
.rd-kb-btn:hover, .rd-kb-btn:focus-visible { background: rgba(255, 255, 255, 0.14); outline: none; }
.rd-pop { width: 280px; max-width: calc(100vw - 16px); }
.rd-pop-head { display: block; padding: 6px 8px 4px; font-size: 11.5px; font-weight: 600; color: var(--ink-3); }
.rd-pop-note { display: flex; align-items: flex-start; gap: 6px; padding: 2px 8px 6px; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
.rd-pop-note .icon { flex: none; margin-top: 2px; color: var(--ok); }
.rd-pop-note.warn .icon { color: var(--wait); }
.rd-pop-actions { display: flex; justify-content: flex-end; padding: 0 8px 4px; }
.rd-fkeys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 0 8px 4px; }
.rd-fkey {
  height: 28px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font: 600 11.5px var(--font-data); cursor: pointer;
}
.rd-fkey:hover, .rd-fkey:focus-visible { background: var(--sunken); color: var(--ink); outline: none; }
.rd-combo-row { display: flex; gap: 6px; padding: 0 8px 4px; }
.rd-combo-row .field { flex: 1 1 auto; min-width: 0; height: 30px; }
.rd-combo-error { padding: 0 8px 4px; font-size: 12px; color: var(--crit); }
.rd-soon-btn { border-style: dashed; color: var(--ink-3); }
.rd-soon-tag { margin-left: auto; padding: 1px 7px; border-radius: 99px; background: var(--sunken); color: var(--ink-3); font-size: 11px; font-weight: 600; }
.menu-line:disabled { cursor: not-allowed; color: var(--ink-3); }
.menu-line:disabled:hover { background: none; }
.rd-soon-list { margin: 0; padding: 0 8px 6px 26px; font-size: 13px; line-height: 1.6; color: var(--ink); }
.rd-clip {
  max-height: 140px; overflow: auto; margin: 0 8px 6px; padding: 8px; border-radius: var(--r-sm); background: var(--sunken);
  font: 12px/1.5 var(--font-data); white-space: pre-wrap; overflow-wrap: anywhere;
}
.rd-creds .lb-list { max-height: 240px; overflow: auto; }
.rd-cred { display: grid; min-width: 0; text-align: left; }
.rd-cred b { overflow: hidden; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.rd-cred small { overflow: hidden; color: var(--ink-3); font-size: 11.5px; white-space: nowrap; text-overflow: ellipsis; }
.rd-host:fullscreen { background: #000000; }
.rd-host:fullscreen > .rd { height: 100%; border: 0; border-radius: 0; }
.rd-host:fullscreen .rd-stage { padding: 0; background: #000000; }

/* Narrow frames keep one or two toolbar rows: labels give way to icons. */
@container (max-width: 640px) {
  .rd-btn span, .rd-meta .rd-stats, .rd-meta .rd-rec, .rd-mode button .icon, .rd-scale button .icon { display: none; }
  .rd-kb > span { display: none; }
  .rd-tools { margin-left: 0; }
}
@container (max-width: 520px) {
  .term-title, .term-time { display: none; }
  .term-btn[data-term="smaller"], .term-btn[data-term="bigger"] { display: none; }
}

@keyframes rd-count { to { stroke-dashoffset: 100; } }
@keyframes rd-blink { 50% { opacity: 0; } }
@keyframes rd-ripple { from { transform: scale(0.3); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }
@keyframes rd-hint { 0% { opacity: 0; } 12%, 75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes rd-wander { 0%, 100% { left: 30%; top: 40%; } 25% { left: 62%; top: 22%; } 50% { left: 70%; top: 58%; } 75% { left: 40%; top: 66%; } }

/* ---------- Remote control screens ---------- */

.rc-console { position: relative; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.rc-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rc-tabs { display: flex; gap: 6px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.rc-tab {
  display: inline-flex; flex: none; align-items: center; gap: 7px; height: 34px; padding: 0 4px 0 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 600 12.5px var(--font-ui); white-space: nowrap;
}
.rc-tab > a { display: inline-flex; align-items: center; gap: 7px; color: inherit; text-decoration: none; }
.rc-tab[data-current] { border-color: var(--accent-line); background: var(--accent-soft); color: var(--ink); }
.rc-tab .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok-mark); }
.rc-tab .dot.ended { background: var(--line-strong); }
.rc-tab .dot.waiting { background: var(--wait-mark); }
.rc-tab .icon-btn { width: 24px; height: 24px; }
.rc-top .rc-tools { display: flex; gap: 6px; margin-left: auto; }
.rc-main { flex: 1 1 auto; min-height: 0; display: flex; gap: 12px; }
.rc-main > .term, .rc-main > .rd-host, .rc-main > .rd { flex: 1 1 auto; min-width: 0; }
.rc-side { flex: none; display: flex; flex-direction: column; gap: 12px; width: 280px; min-height: 0; overflow: auto; }
.rc-side .panel { flex: none; }
.rc-device { display: flex; align-items: center; gap: 10px; }
.rc-device strong { display: block; font-size: 14px; }
.rc-device span { font-size: 12px; color: var(--ink-3); }
.rc-links { display: flex; flex-wrap: wrap; gap: 6px; }
.rc-snips { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.rc-snip {
  width: 100%; padding: 6px 9px; border-radius: 7px; border: 1px solid var(--line); background: var(--sunken); color: var(--ink);
  font: 12px var(--font-data); text-align: left; cursor: pointer;
}
.rc-snip:hover:not(:disabled) { border-color: var(--accent-line); background: var(--accent-soft); }
.rc-snip:disabled { opacity: 0.5; cursor: not-allowed; }
.rc-who { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; font-size: 12.5px; }
.rc-who li { display: flex; align-items: center; gap: 8px; }
.rc-who .av { width: 26px; height: 26px; font-size: 10.5px; background: linear-gradient(135deg, var(--p-deep), var(--p-mid)); }
.rc-demo { font-size: 12px; color: var(--ink-3); }

.rc-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 12px; align-items: start; }
.rc-search { position: relative; display: block; }
.rc-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.rc-search input { width: 100%; padding-left: 32px; }
.rc-list { margin: 8px 0 0; padding: 0; list-style: none; }
.rc-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.rc-list li:first-child { border-top: 0; }
.rc-list .who { flex: 1; min-width: 0; }
.rc-list .who strong { display: block; font-size: 13px; }
.rc-list .who span { display: block; overflow: hidden; font-size: 12px; color: var(--ink-3); white-space: nowrap; text-overflow: ellipsis; }
.rc-list .btns { display: flex; flex: none; gap: 6px; }
.rc-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.rc-card { display: grid; gap: 8px; align-content: start; padding: 10px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); color: inherit; text-decoration: none; }
a.rc-card:hover { border-color: var(--accent-line); }
.rc-thumb { position: relative; overflow: hidden; aspect-ratio: 16 / 9; border-radius: 8px; background: #0A1230; }
.rc-thumb .rd-screen { width: 100%; border-radius: 0; box-shadow: none; }
.rc-thumb.term-thumb { padding: 30px 11px 9px; color: #DCE3F5; font: 10px / 1.55 var(--font-data); white-space: pre-wrap; overflow: hidden; }
.rc-thumb .live { position: absolute; top: 6px; left: 6px; z-index: 9; display: inline-flex; align-items: center; gap: 5px; padding: 2px 7px; border-radius: 99px; background: rgba(6, 22, 65, 0.86); color: #FFFFFF; font-size: 10.5px; font-weight: 700; }
.rc-thumb .live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #3DD598; }
.rc-caption {
  position: absolute; z-index: 9; left: 50%; bottom: 6cqw; transform: translateX(-50%); display: flex; gap: 0.8cqw; align-items: center;
  max-width: 80%; padding: 0.8cqw 1.6cqw; border-radius: 99px; background: rgba(6, 22, 65, 0.9); color: #FFFFFF; font: 600 1.4cqw var(--font-ui); white-space: nowrap;
}
.rc-caption time { color: #9FB7E8; font-family: var(--font-data); }
.rc-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-3); }
.rc-card-meta strong { color: var(--ink); font-size: 13px; }

.rc-player { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 8px 12px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); }
.rc-player input[type="range"] { flex: 1 1 200px; min-width: 120px; accent-color: var(--p-accent); }
.rc-player .num { font-size: 12px; color: var(--ink-2); }
.rc-events { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; font-size: 12.5px; }
.rc-events button { display: flex; gap: 10px; width: 100%; padding: 6px 8px; border: 0; border-radius: 7px; background: none; color: var(--ink-2); text-align: left; cursor: pointer; }
.rc-events button:hover { background: var(--sunken); }
.rc-events time { flex: none; width: 42px; color: var(--ink-3); font: 11.5px var(--font-data); }
.rc-events .past { color: var(--ink); }
.rc-events .now { background: var(--accent-soft); color: var(--ink); font-weight: 600; }

@media (max-width: 1100px) {
  .rc-side { display: none; }
  .rc-console.side-open .rc-side {
    position: absolute; z-index: 20; top: 46px; right: 0; bottom: 0; display: flex; padding: 0 0 0 12px;
    background: var(--bg); box-shadow: -16px 0 30px -24px rgba(6, 22, 65, 0.5);
  }
  .rc-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 1101px) { .rc-side-toggle { display: none; } }
@media (max-width: 1100px) {
  .rc-replay-main { flex-direction: column; }
  .rc-replay-main > .term, .rc-replay-main > .rd { min-height: 240px; }
  .rc-replay-main .rc-events-side { display: flex; width: auto; max-height: 34%; }
}
@media (max-width: 860px) {
  .rd-chat { position: absolute; z-index: 10; top: 0; right: 0; bottom: 0; box-shadow: var(--shadow-pop); }
  .rc-list li { flex-wrap: wrap; }
  .rc-list .btns { width: 100%; padding-left: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .rd-ucursor, .rd-caret { animation: none; }
}

/* Device tabs (endpoint-device.js) host the same components. */
.ep-remote { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.ep-remote > .term, .ep-remote > .rd-host { flex: 1 1 auto; min-height: 0; }
.ep-remote-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; }

/* Gallery specimens (brandpages.js). */
.rc-spec { display: flex; flex-direction: column; height: 300px; }
.rc-spec.tall { height: 440px; }
.rc-spec > .term, .rc-spec > .rd-host { flex: 1 1 auto; min-height: 0; }
