:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #cbd5e1;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --danger: #dc2626;
  --ok: #16a34a;
  --toolbar: rgba(15, 23, 42, 0.92);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120;
    --card: #111827;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --border: #334155;
    --accent: #3b82f6;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
.view { min-height: 100%; }

/* Connect screen */
#connect-view { display: flex; align-items: center; justify-content: center; padding: 16px; }
.card {
  width: 100%; max-width: 400px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 28px 24px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
h1 { margin: 0; font-size: 26px; display: flex; align-items: center; gap: 10px; }
.logo { width: 34px; height: 34px; flex: none; }
.brand { height: 40px; width: auto; flex: none; color: var(--text); }
.sub { margin: 4px 0 20px; color: var(--muted); }
label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 6px; }
input {
  width: 100%; font-size: 18px; padding: 11px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text);
}
#remote-id { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 1px; font-size: 22px; }
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button {
  font: inherit; cursor: pointer; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--accent-text); padding: 11px 16px;
}
button:disabled { opacity: 0.6; cursor: default; }
#connect-btn { width: 100%; margin-top: 20px; font-size: 17px; font-weight: 600; }
.status { min-height: 1.4em; margin: 14px 0 0; font-size: 15px; }
.status.error { color: var(--danger); }
.hint { font-size: 13px; color: var(--muted); margin: 14px 0 0; }

/* Download ("Загрузить node-4 Desk") */
button.secondary {
  width: 100%; margin-top: 18px; background: transparent; color: var(--accent);
  border: 1px solid var(--accent); font-weight: 600;
}
.dl-manual { display: block; margin-top: 8px; text-align: center; font-size: 14px; color: var(--accent); }
.download-panel { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.dl-detected { margin: 0 0 10px; font-size: 15px; }
.dl-actions { display: flex; flex-direction: column; gap: 8px; }
.dl-link { color: var(--accent); word-break: break-word; }
.dl-link.primary {
  display: block; text-align: center; text-decoration: none; font-weight: 600;
  background: var(--accent); color: var(--accent-text); border-radius: 8px; padding: 11px 16px;
}
.dl-status { margin: 0 0 8px; min-height: 0; }
.dl-note { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.dl-note a, .dl-all a { color: var(--accent); }
.dl-all { margin-top: 10px; font-size: 14px; }
.dl-mac { margin-top: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; }
.dl-mac p { margin: 0 0 8px; color: var(--muted); }
.dl-mac p:last-child { margin-bottom: 0; }
.dl-mac .dl-mac-title { color: var(--text); font-weight: 600; font-size: 15px; }
.dl-mac-cmd { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin: 0 0 10px; }
.dl-mac-cmd code {
  align-self: stretch; padding: 8px 10px; border-radius: 8px; background: var(--bg);
  font-size: 13px; word-break: break-all; user-select: all;
}
.dl-mac-cmd button { width: auto; padding: 6px 14px; font-size: 14px; }
.dl-all ul { margin: 8px 0 0; padding-left: 18px; }
.dl-all li { margin: 4px 0; }

/* Session screen */
#session-view { position: fixed; inset: 0; display: flex; flex-direction: column; background: #000; }
#toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top));
  background: var(--toolbar); color: #e2e8f0; font-size: 14px;
  z-index: 3;
}
.tb-id { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 600; }
.tb-stats { color: #94a3b8; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.spacer { flex: 1; }
.tb-btn { background: #1e293b; color: #e2e8f0; padding: 6px 10px; font-size: 14px; }
.tb-btn.danger { background: var(--danger); color: #fff; }
.tb-btn.on { background: var(--accent); }
.tb-select { background: #1e293b; color: #e2e8f0; border: 0; border-radius: 8px; padding: 6px 8px; font-size: 13px; max-width: 180px; }
#body { flex: 1; min-height: 0; display: flex; }
#stage { position: relative; flex: 1; min-height: 0; }
#screen, #screen-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; background: #000;
}
#screen {
  touch-action: none; user-select: none; -webkit-user-select: none;
  cursor: default; outline: none;
}
#screen.picture-hidden { opacity: 0; }
#screen-canvas { pointer-events: none; }

/* A message from the remote computer (e.g. why input does not get through). */
.notice {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: min(560px, calc(100% - 24px)); z-index: 4;
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--toolbar); color: #f1f5f9; font-size: 14px; line-height: 1.4;
  border-left: 3px solid #f59e0b; border-radius: 8px; padding: 10px 10px 10px 14px;
  box-shadow: 0 8px 24px rgba(2, 6, 23, 0.35);
}
.notice span { flex: 1; }
.notice .notice-act { background: #2563eb; color: #fff; border-radius: 8px; padding: 6px 12px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.notice button { background: transparent; color: #cbd5e1; padding: 0 4px; font-size: 14px; }

/* File panel */
#files-panel {
  width: 340px; flex: none; background: var(--card); color: var(--text);
  border-left: 1px solid var(--border); display: flex; flex-direction: column; z-index: 3;
}
.fp-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.fp-head .tb-btn { background: var(--border); color: var(--text); }
.fp-path { padding: 6px 12px; font-size: 12px; color: var(--muted); word-break: break-all; border-bottom: 1px solid var(--border); }
.fp-list { flex: 1; min-height: 0; overflow: auto; }
.fp-row { display: flex; align-items: center; gap: 8px; padding: 7px 12px; cursor: default; border-bottom: 1px solid var(--bg); }
.fp-row:hover { background: var(--bg); }
.fp-row.dir { cursor: pointer; }
.fp-row .fp-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-row .fp-size { color: var(--muted); font-size: 12px; }
.fp-row .fp-get { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 3px 8px; font-size: 12px; cursor: pointer; }
.fp-icon { width: 18px; text-align: center; }
.fp-drop { margin: 10px 12px; padding: 14px; border: 2px dashed var(--border); border-radius: 8px; font-size: 13px; color: var(--muted); text-align: center; }
.fp-drop.over { border-color: var(--accent); color: var(--text); }
.fp-pick { color: var(--accent); cursor: pointer; text-decoration: underline; }
.fp-transfers { max-height: 160px; overflow: auto; padding: 0 12px 10px; }
.fp-xfer { font-size: 12px; margin-top: 8px; }
.fp-xfer .fp-bar { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; margin-top: 3px; }
.fp-xfer .fp-bar span { display: block; height: 100%; background: var(--accent); width: 0; }
.fp-xfer.err { color: var(--danger); }
.fp-xfer.done .fp-bar span { background: var(--ok); }
@media (max-width: 700px) {
  #files-panel { position: absolute; inset: 0; width: auto; }
}
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(2, 6, 23, 0.72); color: #f1f5f9; z-index: 2; padding: 16px; text-align: center;
}
.overlay-box { max-width: 420px; }
.overlay form { display: flex; gap: 8px; margin-top: 12px; }
.overlay input { font-size: 16px; }
.spinner {
  width: 36px; height: 36px; margin: 0 auto 14px;
  border: 3px solid rgba(255,255,255,0.25); border-top-color: #fff; border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.ime { position: fixed; left: -1000px; top: 0; width: 10px; height: 10px; opacity: 0; }
@media (pointer: fine) { #btn-keyboard { display: none; } }

.opt { color: #8a94a6; font-weight: 400; font-size: 0.85em; }

.overlay-action {
  margin-top: 14px; border: 0; border-radius: 9px; padding: 10px 14px;
  background: var(--accent); color: #fff; font: inherit; cursor: pointer;
}
.overlay-action:hover { filter: brightness(1.08); }
/* Always-visible build version. Kept above the session/file UI and out of the input path. */
.app-version {
  position: fixed; right: 10px; bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 20; pointer-events: none; user-select: none;
  padding: 3px 6px; border-radius: 5px;
  background: rgba(2, 6, 23, 0.62); color: rgba(255, 255, 255, 0.82);
  font: 11px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.2px;
}

.app-version.clickable { pointer-events: auto; cursor: pointer; }
.app-version.clickable:hover { background: rgba(2, 6, 23, 0.8); color: #fff; }
#session-view:not(.hidden) ~ .app-version { pointer-events: none; }

/* downloads.html: every agent build, chosen by hand */
.downloads-page { display: flex; justify-content: center; padding: 16px; }
.downloads-page .card { max-width: 760px; }
.dl-back { font-size: 14px; color: var(--accent); }
.dl-group { margin: 22px 0 0; font-size: 18px; }
.dl-item {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center;
  padding: 12px 0; border-top: 1px solid var(--border);
}
.dl-item h3 { margin: 0; font-size: 16px; }
.dl-item p { margin: 0; font-size: 14px; color: var(--muted); }
.dl-item .dl-meta { grid-column: 1 / -1; font-size: 12px; color: var(--muted); word-break: break-all; }
.dl-item a.dl-get {
  background: var(--accent); color: var(--accent-text); border-radius: 8px; padding: 8px 14px;
  text-decoration: none; font-weight: 600; white-space: nowrap;
}
.dl-item .dl-none { font-size: 14px; color: var(--muted); white-space: nowrap; }
.dl-item.mine { background: color-mix(in srgb, var(--accent) 8%, transparent); border-radius: 8px; padding: 12px 10px; }
@media (max-width: 520px) {
  .dl-item { grid-template-columns: 1fr; }
  .dl-item a.dl-get, .dl-item .dl-none { justify-self: start; }
}

/* connect.html in the site's style (site.css is loaded first): dark theme, the site header,
   the form and "Мои компьютеры" side by side. The session screen keeps its own look. */
body.cx {
  --bg: #070b16; --card: #0f1626; --text: #e6edf7; --muted: #9fb0cc; --border: #26324a;
  --accent: #3b82f6; --danger: #ef4444;
  color-scheme: dark;
  background:
    radial-gradient(1000px 650px at 78% -5%, rgba(37, 99, 235, .32), transparent 60%),
    radial-gradient(800px 560px at 5% 30%, rgba(6, 182, 212, .12), transparent 60%),
    #070b16;
  background-repeat: no-repeat;
}
body.cx #connect-view { display: block; padding: 0 40px; }
/* В сеансе картинка на весь экран: место под полосу прокрутки не нужно. */
html:has(#session-view:not(.hidden)) { scrollbar-gutter: auto; }
body.cx .nav .btn.current { box-shadow: 0 0 0 2px rgba(147, 197, 253, .55), 0 0 28px rgba(59, 130, 246, .45); }
.cx-main { display: grid; grid-template-columns: minmax(300px, 400px) 1fr; gap: 28px; align-items: start; padding: 16px 0 60px; }
body.cx .card {
  max-width: none; padding: 28px; border-radius: 20px;
  background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .09);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}
body.cx .card h1.plain { display: block; font-size: 34px; line-height: 1.1; margin: 0 0 8px; }
body.cx .card h2 { margin: 0 0 10px; font-size: 22px; }
body.cx .sub { color: var(--muted); margin: 0 0 18px; }
body.cx #connect-view input:not([type=search]) { background: rgba(0, 0, 0, .35); border-color: rgba(255, 255, 255, .12); border-radius: 10px; padding: 12px 14px; }
body.cx #connect-view input:focus { outline: none; border-color: var(--accent); }
body.cx #connect-btn {
  border-radius: 12px; padding: 13px 16px; color: #fff;
  background: linear-gradient(135deg, var(--accent), #06b6d4); box-shadow: 0 0 28px rgba(59, 130, 246, .4);
}
body.cx button.secondary { color: var(--text); border-color: rgba(255, 255, 255, .16); background: rgba(255, 255, 255, .05); border-radius: 12px; padding: 12px 16px; }
body.cx .dl-manual, body.cx .dl-link { color: #93c5fd; }
body.cx .status.error { color: #fca5a5; }
.mine-teaser { margin: 18px 0 22px; display: flex; flex-direction: column; gap: 10px; filter: blur(2px); opacity: .45; pointer-events: none; }
.mine .panel-head { margin-bottom: 12px; }
.mine-search {
  width: 100%; margin: 0 0 12px; padding: 10px 14px; border-radius: 10px; font: inherit; font-size: 15px;
  color: var(--text); background: rgba(0, 0, 0, .3); border: 1px solid rgba(255, 255, 255, .1); outline: none;
}
.mine-search:focus { border-color: var(--accent); }
.m-row {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; border-radius: 12px; text-align: left;
  background: rgba(17, 26, 46, .8); border: 1px solid #1e293b; color: var(--text); font: inherit; cursor: pointer;
}
.m-row:hover, .m-row:focus-visible { border-color: rgba(59, 130, 246, .55); outline: none; }
.m-name { flex: 1; min-width: 0; }
.m-name b { margin-right: 6px; }
.m-name .os { margin-right: 4px; }
.m-os { display: inline-flex; width: 18px; height: 18px; margin: 0 5px 0 1px; vertical-align: -4px; color: #9fb0cc; }
.m-os svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.m-os.windows { color: #60a5fa; }
.m-os.linux { color: #fbbf24; }
.m-os.macos { color: #cbd5e1; }
.m-os.android { color: #4ade80; }
.m-name .os.own { background: rgba(34, 197, 94, .15); color: #4ade80; }
.m-name small { display: block; color: var(--muted); font-size: 12.5px; }
.m-ver { display: inline-block; margin-left: 8px; padding: 1px 6px; border-radius: 999px; background: rgba(100, 116, 139, .16); color: #94a3b8; font-size: 11px; }
.m-ver.old { background: rgba(245, 158, 11, .14); color: #fbbf24; }
.m-ver.unknown { color: #64748b; }
.m-row .b-st { width: auto; }
.m-go { flex: none; width: 34px; padding: 0; height: 30px; font-size: 22px; line-height: 1; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; background: #2563eb; color: #fff; font-weight: 700; }
.m-go.off { background: #1e293b; color: #475569; }
.m-upd { flex: none; width: 32px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid rgba(245, 158, 11, .45); background: rgba(245, 158, 11, .12); color: #fbbf24; font-size: 20px; font-weight: 700; cursor: pointer; }
.m-upd:hover, .m-upd:focus-visible { background: rgba(245, 158, 11, .22); border-color: #f59e0b; color: #fde68a; outline: none; }
.m-upd.off { opacity: .45; }
#mine-note a { color: #93c5fd; }
/* Groups and notes («Про») */
#mine-filters { flex-wrap: wrap; }
#mine-filters .sw, .m-gh .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: 0; }
#mine-rows { display: flex; flex-direction: column; gap: 6px; }
.m-gh { display: flex; align-items: center; gap: 2px; margin: 10px 2px 2px; font-size: 13px; color: #9fb0cc; cursor: pointer; user-select: none; }
.m-gh:first-child { margin-top: 0; }
.m-gh b { font-weight: 600; }
.m-gh .cnt { color: #64748b; margin-left: 8px; }
.m-gh .ln { flex: 1; height: 1px; background: #1e293b; margin: 0 10px; }
.m-gh .ar { color: #64748b; }
.m-note { display: block; margin-top: 2px; color: #a5b4cf; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-note::before { content: "✎ "; color: #64748b; }
.m-ic { flex: none; width: 30px; height: 28px; border-radius: 8px; border: 1px solid #26324a; display: inline-flex; align-items: center; justify-content: center; color: #9fb0cc; font-size: 14px; }
.m-ic:hover { color: #fff; border-color: rgba(59, 130, 246, .6); }
@media (max-width: 900px) {
  .cx-main { grid-template-columns: 1fr; }
  body.cx #connect-view { padding: 0 16px; }
  body.cx .nav { flex-wrap: wrap; gap: 12px 16px; }
  body.cx .nav nav { order: 3; flex-basis: 100%; overflow-x: auto; gap: 18px; }
  body.cx .nav .nav-account { margin-left: auto; }
}

/* File panel: new folder, rename, delete */
.fp-head .spacer { flex: 1; }
.fp-head { gap: 6px; }
.fp-tool, .fp-op { display: inline-flex; align-items: center; justify-content: center; }
.fp-tool svg { width: 18px; height: 18px; }
.fp-tool:disabled { opacity: .35; }
.fp-ops { display: inline-flex; gap: 2px; opacity: 0; }
.fp-row:hover .fp-ops, .fp-row:focus-within .fp-ops { opacity: 1; }
@media (hover: none) { .fp-ops { opacity: 1; } }
.fp-op { background: transparent; color: var(--muted); padding: 3px; border-radius: 6px; }
.fp-op:hover { background: var(--border); color: var(--text); }
.fp-op.danger:hover { color: var(--danger); }
.fp-op svg { width: 16px; height: 16px; }

/* Chat panel */
#chat-panel {
  width: 300px; flex: none; background: var(--card); color: var(--text);
  border-left: 1px solid var(--border); display: flex; flex-direction: column; z-index: 3;
}
.chat-log { flex: 1; min-height: 0; overflow: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-empty { color: var(--muted); font-size: 13px; margin: 0; }
.chat-msg { max-width: 85%; align-self: flex-start; padding: 7px 10px; border-radius: 12px 12px 12px 4px; background: var(--border); font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.mine { align-self: flex-end; border-radius: 12px 12px 4px 12px; background: var(--accent); color: #fff; }
.chat-msg small { display: block; font-size: 11px; opacity: .7; margin-top: 2px; text-align: right; }
.chat-form { display: flex; gap: 6px; padding: 10px 12px 30px; border-top: 1px solid var(--border); }
.chat-form input { flex: 1; min-width: 0; font-size: 15px; padding: 8px 10px; }
.chat-form button { padding: 8px 12px; }
@media (max-width: 700px) {
  #chat-panel { position: absolute; inset: 0; width: auto; }
}
#mine-guest .btn + .muted { margin-top: 12px; }
.m-name { overflow-wrap: anywhere; }
@media (max-width: 640px) {
  body.cx .site-logo { height: 28px; }
  body.cx .nav .btn.small { padding: 9px 12px; font-size: 13px; }
  body.cx .nav { gap: 10px; }
  .m-row { flex-wrap: wrap; row-gap: 2px; }
  .m-row .m-name { flex-basis: calc(100% - 80px); }
  .m-row .b-st { order: 5; flex-basis: 100%; text-align: left; padding-left: 24px; font-size: 12px; }
}

/* ---------------------------------------------------------------- phones and tablets
   body.touchui: no mouse (iPhone, iPad, Android in the browser). The session works like
   the Android app: «Касание / Тачпад» under the picture, extra keys above the keyboard,
   a menu sheet, the picture full screen in landscape. */
.m-only, .m-land { display: none !important; }
body.touchui .m-only { display: inline-flex !important; }
body.touchui .m-bar.m-only { display: flex !important; }
body.touchui .m-hide,
body.touchui #btn-clip, body.touchui #btn-files, body.touchui #btn-chat,
body.touchui #btn-keyboard, body.touchui #monitor-select { display: none !important; }
body.touchui #toolbar { gap: 8px; padding: 6px 10px; padding-top: max(6px, env(safe-area-inset-top)); }
body.touchui #toolbar .tb-btn { min-width: 40px; height: 40px; justify-content: center; align-items: center; font-size: 18px; border-radius: 11px; }
body.touchui .tb-id { font-size: 15px; white-space: nowrap; }
body.touchui .tb-stats { min-width: 0; flex: 1; }
body.touchui #session-view:not(.hidden) ~ .app-version { display: none; }
#btn-menu { position: relative; }
#btn-menu.dot::after { content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: #3b82f6; }
#screen, #screen-canvas { transform-origin: 0 0; }

.m-bar {
  flex: none; gap: 10px; align-items: center; z-index: 3;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(15, 23, 42, 0.96);
}
.m-seg { flex: 1; display: flex; background: #1e293b; border-radius: 12px; padding: 3px; }
.m-seg button { flex: 1; padding: 10px 0; border-radius: 9px; background: none; color: #94a3b8; font-weight: 600; font-size: 15px; }
.m-seg button.on { background: #2563eb; color: #fff; }
.m-ib { min-width: 46px; height: 46px; justify-content: center; align-items: center; font-size: 19px; border-radius: 12px; }

.m-cursor {
  position: absolute; z-index: 4; width: 18px; height: 26px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 26'%3E%3Cpath d='M1 1v19l5-5 4 9 3-1.4-4-8.6h7z' fill='%23fff' stroke='%23000' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .5));
}
.m-hint {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 5;
  background: rgba(15, 23, 42, 0.93); color: #cbd5e1; border-radius: 14px; padding: 12px 14px; font-size: 13px; line-height: 1.45;
}
.m-hint b { display: block; color: #fff; font-size: 14px; margin-bottom: 2px; }
.m-hint small { display: block; color: #64748b; margin-top: 6px; }

.m-keys {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: #111827; padding: 6px 6px 7px; border-top: 1px solid #1f2937;
}
.m-krow { display: flex; gap: 5px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.m-krow + .m-krow { margin-top: 5px; }
.m-krow::-webkit-scrollbar { display: none; }
.m-krow button {
  flex: none; min-width: 42px; height: 36px; padding: 0 9px; border-radius: 8px;
  background: #334155; color: #f1f5f9; font-size: 13px; font-weight: 600;
}
.m-krow button.on { background: #2563eb; }

.m-sheet { position: fixed; inset: 0; z-index: 40; }
.m-dim { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
.m-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 82vh; overflow-y: auto;
  background: #0f172a; color: #e2e8f0; border-top: 1px solid #1e293b; border-radius: 22px 22px 0 0;
  padding: 8px 10px calc(14px + env(safe-area-inset-bottom));
}
@media (min-width: 600px) { .m-panel { left: 50%; width: 520px; margin-left: -260px; } }
.m-grab { width: 40px; height: 4px; border-radius: 2px; background: #334155; margin: 2px auto 10px; }
.m-title { color: #64748b; font-size: 12.5px; padding: 0 10px 4px; font-family: ui-monospace, Menlo, monospace; }
.m-item {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 10px; border-radius: 10px;
  background: none; color: inherit; font: inherit; font-size: 16px; text-align: left;
}
.m-item:active { background: #1e293b; }
.m-item i { width: 26px; text-align: center; font-style: normal; color: #94a3b8; }
.m-item .m-r { margin-left: auto; color: #64748b; }
.m-item.danger { color: #f87171; }
.m-item.danger i { color: #f87171; }
.m-badge { background: #2563eb; color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 7px; }
.m-monb { margin-left: auto; display: flex; gap: 6px; }
.m-monb button { min-width: 36px; height: 32px; border-radius: 8px; border: 1px solid #334155; background: none; color: #e2e8f0; padding: 0; }
.m-monb button.on { background: #1e3a8a; border-color: #2563eb; }

/* Landscape: the picture takes the screen; the bar comes back with the tab at the top. */
.m-tab { display: none; }
body.m-landscape #toolbar { display: none; }
body.m-landscape.m-bars #toolbar { display: flex; position: absolute; top: 0; left: 0; right: 0; z-index: 6; }
body.m-landscape .m-tab {
  display: block; position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: 5;
  background: rgba(0, 0, 0, 0.6); color: #e2e8f0; border-radius: 0 0 10px 10px; padding: 4px 16px; font-size: 12px;
}
body.m-landscape .m-tab::after { content: "▾ Панель"; }
body.m-landscape.m-bars .m-tab { display: none; }
body.m-landscape .m-bar {
  position: absolute; z-index: 5; left: calc(12px + env(safe-area-inset-left)); bottom: 12px;
  background: rgba(0, 0, 0, 0.55); border-radius: 14px; padding: 4px;
}
body.m-landscape .m-seg { flex: none; width: 230px; }
body.m-landscape .m-land { display: inline-flex !important; }
body.m-landscape .m-hint { left: auto; right: calc(12px + env(safe-area-inset-right)); width: 360px; bottom: 70px; }

/* iPhone/iPad in Safari: install hint on the connect page */
.m-install {
  display: flex; align-items: center; gap: 12px; margin: 10px 0 0; padding: 10px 12px; border-radius: 14px;
  background: rgba(59, 130, 246, 0.12); border: 1px solid rgba(59, 130, 246, 0.35); color: #dbeafe; font-size: 13.5px;
}
.m-install img { border-radius: 10px; flex: none; }
.m-install b { display: block; color: #fff; font-size: 14.5px; }
.m-install button { margin-left: auto; background: none; border: 0; color: #93c5fd; font-size: 17px; padding: 6px; }
.m-share {
  display: inline-block; width: 14px; height: 17px; vertical-align: -3px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 18' fill='none' stroke='%2393c5fd' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.5 7H2v10h10V7H9.5M7 1v10M4 4l3-3 3 3'/%3E%3C/svg%3E") no-repeat;
}

/* Connect page without an account (connect.html) */
.guest-gate { display: flex; flex-direction: column; gap: 12px; margin: 8px 0 14px; }
.guest-gate p { margin: 0; line-height: 1.5; }
.guest-gate .btn { display: block; text-align: center; padding: 12px 16px; border-radius: 10px; font-weight: 700; color: #fff; text-decoration: none; background: var(--accent, #2563eb); }

/* «Мои компьютеры»: the ⋮ menu of a row and the «Да / Нет» dialog */
.m-more { font-size: 18px; line-height: 1; }
.m-menu { position: absolute; z-index: 60; min-width: 170px; padding: 6px; border-radius: 12px; background: #0f172a; border: 1px solid #26324a; box-shadow: 0 12px 30px rgba(0, 0, 0, .45); display: flex; flex-direction: column; }
.m-menu button { text-align: left; padding: 9px 12px; border: 0; border-radius: 8px; background: none; color: #e2e8f0; font: inherit; font-size: 14px; cursor: pointer; }
.m-menu button:hover { background: #1e293b; }
.m-menu button.danger { color: #fca5a5; }
.m-pw-show { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.m-pw-show code { min-width: 150px; padding: 9px 11px; border-radius: 8px; background: #111827; border: 1px solid #334155; letter-spacing: .08em; }
.m-danger-btn { background: #dc2626 !important; color: #fff !important; }

/* Toolbar icons; the full-screen button shows «enter» or «leave» */
.tb-btn svg { display: block; }
#btn-fullscreen .fs-exit, #btn-fullscreen.fs-on .fs-enter { display: none; }
#btn-fullscreen.fs-on .fs-exit { display: inline-flex; }
#btn-keyboard, #btn-fullscreen, #btn-menu { display: inline-flex; align-items: center; justify-content: center; }

/* Phones and tablets: one translucent bar at the top over the picture (the bottom one is
   gone): ID and speed, the «Касание / Тачпад» switch, keyboard, full screen, ⋮, ✕. */
body.touchui #toolbar {
  position: absolute; top: 0; left: 0; right: 0;
  background: rgba(15, 23, 42, 0.55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  padding-left: max(10px, env(safe-area-inset-left)); padding-right: max(10px, env(safe-area-inset-right));
}
body.touchui #toolbar .tb-btn { background: rgba(30, 41, 59, 0.7); }
body.touchui #toolbar .tb-btn.danger { background: var(--danger); }
.m-switch { position: relative; display: none; flex: none; height: 40px; padding: 3px; border-radius: 12px; background: rgba(30, 41, 59, 0.75); }
body.touchui .m-switch { display: inline-flex !important; }
.m-switch::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 40px; height: 34px; border-radius: 9px; background: #2563eb;
  transition: transform .18s ease;
}
.m-switch[data-mode="pad"]::before { transform: translateX(40px); }
.m-switch button { position: relative; z-index: 1; width: 40px; height: 34px; padding: 0; border: 0; background: none; color: #94a3b8; display: inline-flex; align-items: center; justify-content: center; }
.m-switch button.on { color: #fff; }
body.touchui .tb-stats { font-size: 11px; }
@media (max-width: 420px) { body.touchui .tb-stats { display: none; } }
body.m-landscape #toolbar { display: none; }
body.m-landscape.m-bars #toolbar { display: flex; }
.m-item i svg { display: block; margin: 0 auto; }

/* The session panel on a computer: icon buttons as in the program (chat, files, clipboard,
   sound, Ctrl+Alt+Del | speed readout, full screen, pin, end). */
.tb-btn.tb-ico { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 34px; padding: 0; border-radius: 10px; background: transparent; }
.tb-btn.tb-ico:hover { background: rgba(255, 255, 255, 0.09); }
.tb-btn.tb-ico.on { background: var(--accent); color: #fff; }
.tb-btn.tb-ico.danger { background: var(--danger); color: #fff; margin-left: 2px; }
.tb-btn.tb-ico.danger:hover { background: #ef4444; }
.tb-count { position: absolute; top: 1px; right: 1px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 15px; text-align: center; }
.tb-sep { width: 1px; height: 20px; margin: 0 2px; background: rgba(255, 255, 255, 0.14); }
body:not(.touchui):not(.stats-on) .tb-stats { display: none; }
#btn-pin { display: none; }
body.fs #btn-pin { display: inline-flex; }
body.touchui #btn-stats, body.touchui #btn-pin, body.touchui #btn-cad, body.touchui .tb-sep, body.touchui .tb-count { display: none !important; }

/* Full screen on a computer: the panel is a dock at the top centre that slides out when the
   pointer comes to the top edge; a thin tab shows where it is. Pinned, it stays. */
body.fs #toolbar {
  position: absolute; top: 8px; left: 50%; z-index: 7;
  transform: translate(-50%, calc(-100% - 16px)); transition: transform .18s ease;
  padding: 6px 8px; gap: 4px; border-radius: 16px;
  background: rgba(20, 22, 25, 0.94); border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}
body.fs #toolbar .spacer { display: none; }
body.fs #toolbar .tb-id { padding: 0 6px 0 4px; }
body.fs.fs-show #toolbar, body.fs.fs-pinned #toolbar { transform: translate(-50%, 0); }
body.fs:not(.fs-show):not(.fs-pinned) #session-view::before {
  content: ""; position: absolute; top: 0; left: 50%; z-index: 6; transform: translateX(-50%);
  width: 72px; height: 5px; border-radius: 0 0 5px 5px; background: rgba(255, 255, 255, 0.35);
}
