/* Generated by control-plane/scripts/build-live-viewer-client.ts. Do not edit. */
/* BCTRL viewer input digest: b1bb23b423fc003e34dd366ea3b4766de5413ad7b0659c023f7bc14677331688 */
  * { margin: 0; padding: 0; box-sizing: border-box; }
  :root {
    --bg: #181512;            /* header + page chrome (single flat surface) */
    --inset: #101110;         /* recessed fields (url bar) and the viewport well */
    --surface-raised: #2a231c; /* active tab, hovers */
    --panel: rgba(28, 25, 22, 0.92); /* menus + dropdowns (card color, blurred) */
    --hairline: #332c24;
    --border-strong: #4a4037;
    --text: #ece7de;
    --text-muted: #a89c8b;
    --text-faint: #6b6155;
    --accent: #aa9c82;
    --accent-soft: rgba(170, 156, 130, 0.16);
    --accent-border: rgba(170, 156, 130, 0.42);
    --ok: #46c06e;
    --warn: #e8b13f;
    --danger: #e5534b;
    --shadow-panel: 0 12px 32px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.3);
  }
  html {
    height: 100%;
  }
  body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
  }
  #bctrl-live-root {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }

  /* Shared focus treatment — every interactive control gets the same ring. */
  button:focus-visible {
    outline: 2px solid var(--accent-border);
    outline-offset: -2px;
  }

  .tab-spinner {
    width: 12px;
    height: 12px;
    border: 2px solid var(--text-faint);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: bctrl-tab-spin 0.8s linear infinite;
  }
  @keyframes bctrl-tab-spin { to { transform: rotate(360deg); } }


  /* Initial viewport overlay: chrome remains visible while the first actual
   * video frame arrives. It sits below the terminal overlay. */
  #startup-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--inset);
    color: var(--text-muted);
    font-size: 13px;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.18s ease;
  }
  #startup-overlay.hidden {
    opacity: 0;
    pointer-events: none;
  }
  #startup-overlay .startup-spinner {
    width: 26px;
    height: 26px;
    border-width: 3px;
  }
  @media (prefers-reduced-motion: reduce) {
    #startup-overlay {
      transition: none;
    }
    #startup-overlay .startup-spinner {
      animation: none;
    }
  }


  /* ── Toolbar (same flat surface as the tab strip, hairline below) ── */
  #toolbar {
    display: var(--bctrl-live-control-display, flex);
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    background: var(--bg);
    border-bottom: 1px solid var(--hairline);
    flex-shrink: 0;
  }
  .toolbar-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 7px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s, color 0.1s;
  }
  .toolbar-btn:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); }
  .toolbar-btn:disabled,
  .toolbar-btn:disabled:hover {
    background: none;
    color: var(--text-faint);
    cursor: default;
  }
  .toolbar-btn svg { width: 18px; height: 18px; }

  #connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-faint);
    flex-shrink: 0;
    margin-left: 8px;
    transition: background 0.2s;
  }
  #connection-dot.connected { background: var(--ok); }
  #connection-dot.connecting { background: var(--warn); }

  /* Right-side toolbar buttons, pushed away from the connection dot. */
  .toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
  }
  .toolbar-btn { position: relative; }
  .badge-dot {
    display: none;
    position: absolute;
    top: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
  }
  .badge-dot.active { display: block; }

  /* Toggle buttons (control, sync) — plain icons that light up in the
   * warm accent when on. Same shape as every other toolbar button. */
  .toolbar-btn.toggle.active,
  .toolbar-btn.toggle.active:hover {
    color: var(--accent);
    background: var(--accent-soft);
  }

  /* Styled hover tooltips (data-tip) — explain toggle state in theme-matched
   * text instead of an OS-default title bubble. */
  .toolbar-btn[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: max-content;
    max-width: 260px;
    padding: 7px 10px;
    border-radius: 8px;
    border: 1px solid var(--hairline);
    background: var(--panel);
    backdrop-filter: blur(12px);
    color: var(--text);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.5;
    text-align: left;
    white-space: normal;
    box-shadow: var(--shadow-panel);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s ease;
    z-index: 200;
  }
  .toolbar-btn[data-tip]:hover::after {
    opacity: 1;
    transition-delay: 0.4s;
  }

  /* ── Live viewport ── */
  #canvas-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: var(--inset);
  }

  #context-menu-layer {
    position: absolute;
    inset: 0;
    z-index: 20;
  }
  #context-menu-overlay {
    position: absolute;
    min-width: 180px;
    max-width: min(360px, calc(100% - 12px));
    max-height: calc(100% - 12px);
    overflow-y: auto;
    padding: 4px;
    border: 1px solid var(--hairline);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow-panel);
  }
  .context-menu-item {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    padding: 7px 8px;
    text-align: left;
  }
  .context-menu-item:hover:not(:disabled) { background: var(--surface-raised); }
  .context-menu-item:disabled { color: var(--text-faint); cursor: default; }
  .context-menu-item kbd { color: var(--text-muted); font: inherit; font-size: 11px; }
  .context-menu-separator { height: 1px; margin: 4px 2px; background: var(--hairline); }
  #viewer-video,
  #viewer-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }
  #viewer-video {
    background: var(--inset);
  }
  #viewer-canvas {
    z-index: 1;
    background: transparent;
    cursor: not-allowed;
    touch-action: none;
  }
  .remote-cursor {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 3;
    color: #fff;
    font: 700 22px/1 system-ui, sans-serif;
    text-shadow: 0 1px 2px #000, 1px 0 1px #000, -1px 0 1px #000;
    pointer-events: none;
    contain: layout paint style;
    will-change: transform, opacity;
  }
  .remote-cursor-default-arrow,
  .remote-cursor-pointer-hand,
  .remote-cursor-text-beam {
    display: block;
    overflow: visible;
  }
  .remote-cursor-wait,
  .remote-cursor-progress {
    animation: remote-cursor-spin 850ms linear infinite;
  }
  .remote-cursor-custom {
    position: absolute;
    max-width: none;
    transform-origin: top left;
  }
  @keyframes remote-cursor-spin {
    to { rotate: 1turn; }
  }
  #pointer-lock-prompt {
    position: absolute;
    inset: 0;
    z-index: 21;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(10, 12, 16, 0.48);
    backdrop-filter: blur(2px);
  }
  .pointer-lock-card {
    display: grid;
    width: min(360px, 100%);
    gap: 10px;
    padding: 18px;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-panel);
    color: var(--text);
  }
  .pointer-lock-card span {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.45;
  }
  .pointer-lock-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
  }
  .pointer-lock-actions button {
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid var(--accent);
    border-radius: 7px;
    background: var(--accent);
    color: var(--accent-contrast);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
  }
  .pointer-lock-actions button.secondary {
    border-color: var(--hairline);
    background: var(--surface-raised);
    color: var(--text);
  }


  /* Runtime-rooted native file chooser. The modal never exposes host paths;
   * it shows only Chromium-issued opaque item tokens and local upload input. */
  #file-dialog-layer {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(8, 8, 8, 0.68);
    backdrop-filter: blur(5px);
  }
  #file-dialog {
    width: min(560px, 100%);
    max-height: min(680px, calc(100vh - 40px));
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-panel);
  }
  #file-dialog header,
  #file-dialog footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  #file-dialog header strong { font-size: 14px; font-weight: 600; }
  #file-dialog footer { justify-content: flex-end; }
  #file-dialog footer button {
    min-width: 76px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--hairline);
    border-radius: 7px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
  }
  #file-dialog footer button.primary {
    border-color: var(--accent-border);
    background: var(--accent-soft);
    color: var(--accent);
  }
  #file-dialog button:disabled { opacity: 0.45; cursor: default; }
  .file-dialog-list {
    min-height: 80px;
    max-height: 320px;
    overflow-y: auto;
    border: 1px solid var(--hairline);
    border-radius: 8px;
  }
  .file-dialog-list > p { padding: 24px; color: var(--text-muted); text-align: center; }
  .file-dialog-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 7px 10px;
    cursor: pointer;
  }
  .file-dialog-item + .file-dialog-item { border-top: 1px solid var(--hairline); }
  .file-dialog-item:hover { background: rgba(255, 255, 255, 0.04); }
  .file-dialog-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .file-dialog-item small { color: var(--text-muted); }
  .file-dialog-save,
  .file-dialog-upload { display: flex; flex-direction: column; gap: 7px; color: var(--text-muted); font-size: 12px; }
  .file-dialog-save input,
  .file-dialog-upload input {
    min-height: 34px;
    padding: 6px 9px;
    border: 1px solid var(--hairline);
    border-radius: 7px;
    background: var(--inset);
    color: var(--text);
  }
  #file-dialog progress { width: 100%; accent-color: var(--accent); }
  .file-dialog-error { color: var(--danger); font-size: 12px; }

  
  #js-dialog-layer {
    position: var(--js-dialog-position, fixed);
    inset: 0;
    z-index: var(--js-dialog-z-index, 300);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--js-dialog-backdrop, rgba(8, 8, 8, 0.68));
    backdrop-filter: blur(5px);
    pointer-events: var(--js-dialog-pointer-events, auto);
  }
  #js-dialog {
    width: min(460px, 100%);
    max-height: var(--js-dialog-max-height, min(80vh, calc(100vh - 40px)));
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-panel);
  }
  #js-dialog header { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
  #js-dialog header strong { font-size: 14px; font-weight: 600; }
  .js-dialog-origin {
    color: var(--text-muted);
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 55%;
  }
  .js-dialog-body { display: flex; flex-direction: column; gap: 10px; }
  .js-dialog-message {
    margin: 0;
    color: var(--text);
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 40vh;
    overflow-y: auto;
  }
  .js-dialog-input {
    min-height: 34px;
    padding: 6px 9px;
    border: 1px solid var(--hairline);
    border-radius: 7px;
    background: var(--inset);
    color: var(--text);
  }
  #js-dialog footer { display: flex; justify-content: flex-end; gap: 8px; }
  #js-dialog footer button {
    min-width: 76px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--hairline);
    border-radius: 7px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
  }
  #js-dialog footer button.primary {
    border-color: var(--accent-border);
    background: var(--accent-soft);
    color: var(--accent);
  }
  #js-dialog button:disabled,
  #js-dialog input:disabled { opacity: 0.6; cursor: default; }


  
  #http-auth-layer {
    position: var(--http-auth-position, fixed);
    inset: 0;
    z-index: var(--http-auth-z-index, 302);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 72px 20px 20px;
    background: var(--http-auth-backdrop, rgba(8, 8, 8, 0.5));
    backdrop-filter: blur(4px);
    pointer-events: var(--http-auth-pointer-events, auto);
  }
  #http-auth {
    width: min(480px, 100%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-panel);
  }
  #http-auth header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
  }
  #http-auth header strong { font-size: 14px; font-weight: 600; }
  #http-auth header small {
    max-width: 55%;
    overflow: hidden;
    color: var(--text-muted);
    font-size: 11px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .http-auth-body { display: flex; flex-direction: column; gap: 10px; }
  .http-auth-body p {
    margin: 0;
    color: var(--text);
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
  .http-auth-body .http-auth-warning { color: var(--warn); }
  .http-auth-body form { display: flex; flex-direction: column; gap: 10px; }
  .http-auth-body label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--text-muted);
    font-size: 11px;
  }
  .http-auth-body input {
    min-height: 34px;
    padding: 6px 9px;
    border: 1px solid var(--hairline);
    border-radius: 7px;
    background: var(--inset);
    color: var(--text);
    font-size: 13px;
  }
  #http-auth footer { display: flex; justify-content: flex-end; gap: 8px; }
  #http-auth footer button {
    min-width: 76px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--hairline);
    border-radius: 7px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
  }
  #http-auth footer button.primary {
    border-color: var(--accent-border);
    background: var(--accent-soft);
    color: var(--accent);
  }
  #http-auth button:disabled,
  #http-auth input:disabled { opacity: 0.6; cursor: default; }

  
  #print-layer {
    position: absolute;
    inset: 0;
    z-index: 42;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgb(0 0 0 / 28%);
    pointer-events: auto;
  }
  #print-dialog {
    width: min(440px, calc(100vw - 36px));
    overflow: hidden;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 12px;
    color: #f5f6f7;
    background: #25272b;
    box-shadow: 0 18px 60px rgb(0 0 0 / 45%);
  }
  #print-dialog header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px 12px;
  }
  #print-dialog header strong { font-size: 16px; font-weight: 600; }
  #print-dialog header small {
    overflow: hidden;
    color: #b9bec8;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .print-dialog-body {
    display: grid;
    gap: 14px;
    padding: 4px 18px 18px;
  }
  .print-dialog-body > label:first-child {
    display: grid;
    gap: 7px;
    font-size: 12px;
    color: #c9ccd2;
  }
  .print-dialog-body input:not([type="checkbox"]) {
    box-sizing: border-box;
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #555b65;
    border-radius: 6px;
    color: #fff;
    background: #181a1e;
  }
  .print-dialog-option { display: flex; align-items: center; gap: 8px; }
  #print-dialog footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 18px 16px;
  }
  #print-dialog footer button {
    min-width: 80px;
    padding: 8px 14px;
    border: 1px solid #5b6069;
    border-radius: 6px;
    color: #f5f6f7;
    background: #35383e;
  }
  #print-dialog footer button.primary {
    border-color: #5b8def;
    background: #3267d6;
  }
  #print-dialog button:disabled,
  #print-dialog input:disabled { opacity: 0.6; cursor: default; }

  
  #display-capture-layer {
    position: absolute;
    inset: 0;
    z-index: 43;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgb(0 0 0 / 32%);
    pointer-events: auto;
  }
  #display-capture-dialog {
    width: min(560px, calc(100vw - 36px));
    max-height: min(680px, calc(100vh - 36px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgb(255 255 255 / 18%);
    border-radius: 12px;
    color: #f5f6f7;
    background: #25272b;
    box-shadow: 0 18px 60px rgb(0 0 0 / 45%);
  }
  #display-capture-dialog header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px 12px;
  }
  #display-capture-dialog header strong { font-size: 16px; font-weight: 600; }
  #display-capture-dialog header small,
  .display-capture-source small { color: #b9bec8; }
  .display-capture-sources {
    display: grid;
    gap: 8px;
    overflow: auto;
    padding: 4px 18px 14px;
  }
  .display-capture-source {
    display: grid;
    gap: 4px;
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #4b5059;
    border-radius: 8px;
    color: #f5f6f7;
    text-align: left;
    background: #303339;
  }
  .display-capture-source:hover:not(:disabled) {
    border-color: #6f8fc9;
    background: #383d46;
  }
  .display-capture-source span,
  .display-capture-source small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .display-capture-audio {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px 12px;
    color: #d5d8de;
    font-size: 13px;
  }
  #display-capture-dialog footer {
    display: flex;
    justify-content: flex-end;
    padding: 0 18px 16px;
  }
  #display-capture-dialog footer button {
    min-width: 80px;
    padding: 8px 14px;
    border: 1px solid #5b6069;
    border-radius: 6px;
    color: #f5f6f7;
    background: #35383e;
  }
  #display-capture-dialog button:disabled,
  #display-capture-dialog input:disabled { opacity: 0.6; cursor: default; }

  
  #notification-layer {
    position: absolute;
    z-index: 301;
    top: 12px;
    right: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: min(380px, calc(100% - 24px));
    max-height: calc(100% - 24px);
    overflow: auto;
    pointer-events: none;
  }

  .remote-notification {
    overflow: hidden;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-panel);
    color: var(--text);
    pointer-events: auto;
  }
  .remote-notification header {
    display: flex;
    align-items: flex-start;
  }
  .remote-notification .notification-body {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 13px 14px;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
  }
  .remote-notification .notification-body:not(:disabled) { cursor: pointer; }
  .remote-notification strong {
    max-width: 100%;
    overflow: hidden;
    font-size: 13px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .remote-notification small,
  .remote-notification span {
    color: var(--text-muted);
    font-size: 11px;
  }
  .remote-notification p {
    margin: 3px 0 0;
    font-size: 12px;
    line-height: 1.4;
    overflow-wrap: anywhere;
  }
  .remote-notification .notification-dismiss {
    width: 34px;
    height: 34px;
    margin: 5px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
  }
  .remote-notification footer {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 0 12px 12px;
  }
  .remote-notification footer form {
    display: flex;
    flex: 1 1 100%;
    gap: 6px;
  }
  .remote-notification footer input {
    min-width: 0;
    flex: 1;
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--hairline);
    border-radius: 7px;
    background: var(--inset);
    color: var(--text);
  }
  .remote-notification footer button {
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--accent-border);
    border-radius: 7px;
    background: var(--accent-soft);
    color: var(--accent);
    cursor: pointer;
  }
  .remote-notification button:disabled,
  .remote-notification input:read-only { opacity: 0.65; cursor: default; }

  
  #autofill-layer {
    position: absolute;
    inset: 0;
    z-index: 42;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 64px 14px 14px;
    pointer-events: auto;
  }
  #autofill-popup {
    width: min(560px, calc(100% - 28px));
    max-height: min(560px, calc(100% - 78px));
    overflow: auto;
    color: #202124;
    background: #fff;
    border: 1px solid rgba(60, 64, 67, 0.22);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(60, 64, 67, 0.3);
  }
  #autofill-popup nav {
    display: flex;
    gap: 2px;
    padding: 8px;
    border-bottom: 1px solid #e8eaed;
  }
  #autofill-popup nav button {
    flex: 1;
    min-width: 0;
    padding: 7px 10px;
    color: #5f6368;
    background: transparent;
    border: 0;
    border-radius: 6px;
  }
  #autofill-popup nav button.selected {
    color: #1967d2;
    background: #e8f0fe;
  }
  #autofill-popup > input {
    width: calc(100% - 16px);
    margin: 8px;
    padding: 8px 10px;
    border: 1px solid #dadce0;
    border-radius: 7px;
    outline: none;
  }
  #autofill-popup > input:focus { border-color: #1a73e8; }
  .autofill-panels { display: flex; overflow-x: auto; }
  .autofill-panel {
    flex: 0 0 100%;
    min-width: 0;
    padding: 4px 0;
  }
  .autofill-panel + .autofill-panel { border-left: 1px solid #e8eaed; }
  .autofill-panel > button {
    display: flex;
    width: 100%;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    color: inherit;
    text-align: left;
    background: transparent;
    border: 0;
  }
  .autofill-panel > button:hover,
  .autofill-panel > button:focus,
  .autofill-panel > button.selected {
    background: #f1f3f4;
    outline: none;
  }
  .autofill-panel > button:disabled { color: #9aa0a6; }
  .autofill-copy { display: grid; min-width: 0; gap: 2px; }
  .autofill-copy strong,
  .autofill-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .autofill-copy small { color: #5f6368; }
  .autofill-progress {
    width: 14px;
    height: 14px;
    border: 2px solid #dadce0;
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: autofill-spin 0.8s linear infinite;
  }
  .autofill-empty { margin: 0; padding: 16px; color: #5f6368; }
  .autofill-recording-placeholder { padding: 18px; }
  .autofill-recording-placeholder p { margin: 8px 0; }
  .autofill-recording-placeholder small { color: #5f6368; }
  @keyframes autofill-spin { to { transform: rotate(360deg); } }


  
  #find-bar {
    position: absolute;
    z-index: 13;
    top: 8px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    width: min(420px, calc(100% - 20px));
    min-height: 38px;
    padding: 5px 6px 5px 10px;
    border: 1px solid var(--hairline);
    border-radius: 9px;
    background: var(--panel);
    box-shadow: var(--shadow-panel);
    backdrop-filter: blur(12px);
  }
  #find-bar input {
    min-width: 80px;
    flex: 1;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
  }
  .find-bar-status {
    min-width: 58px;
    color: var(--text-muted);
    font-size: 12px;
    text-align: right;
    white-space: nowrap;
  }
  #find-bar button {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
  }
  #find-bar button:hover {
    background: var(--surface-raised);
    color: var(--text);
  }


  #clipboard-notice {
    position: fixed;
    z-index: 320;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    max-width: min(480px, calc(100% - 32px));
    padding: 9px 13px;
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    box-shadow: var(--shadow-panel);
    font-size: 12px;
    pointer-events: none;
  }
  #clipboard-notice.actionable {
    display: flex;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
  }
  #clipboard-notice button {
    border: 1px solid var(--accent-border);
    border-radius: 6px;
    padding: 4px 9px;
    background: var(--surface-raised);
    color: var(--text);
    cursor: pointer;
    font: inherit;
  }
  #clipboard-notice.error {
    border-color: color-mix(in srgb, var(--danger) 55%, transparent);
    color: var(--danger);
  }

  #permission-prompt-layer {
    position: fixed;
    inset: 0;
    z-index: 301;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 72px 20px 20px;
    background: rgba(8, 8, 8, 0.42);
    backdrop-filter: blur(3px);
  }
  #permission-prompt {
    width: min(480px, 100%);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-panel);
  }
  #permission-prompt header strong { font-size: 14px; font-weight: 600; }
  .permission-prompt-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    color: var(--text);
    font-size: 13px;
  }
  .permission-prompt-body ul {
    margin: 0;
    padding-left: 20px;
    line-height: 1.5;
  }
  .permission-prompt-body fieldset {
    display: flex;
    gap: 16px;
    margin: 0;
    padding: 10px;
    border: 1px solid var(--hairline);
    border-radius: 8px;
  }
  .permission-prompt-body legend {
    padding: 0 5px;
    color: var(--text-muted);
    font-size: 11px;
  }
  .permission-prompt-body label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  #permission-prompt footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
  }
  #permission-prompt footer button {
    min-width: 76px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--hairline);
    border-radius: 7px;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
  }
  #permission-prompt footer button.primary {
    border-color: var(--accent-border);
    background: var(--accent-soft);
    color: var(--accent);
  }
  #permission-prompt button:disabled { opacity: 0.6; cursor: default; }

  /* End-of-run overlay: terminal state over the viewport. Sits above the
   * startup overlay and blocks input to the dead canvas.
   * Solid by default (nothing was ever streamed); with a frozen final
   * frame on the canvas it dims and blurs that frame instead, keeping the
   * run's last moment ghosted behind the card. */
  #end-overlay {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px;
    background: var(--inset);
    text-align: center;
    animation: bctrl-end-fade 0.35s ease;
  }
  #end-overlay.has-frame {
    background: rgba(16, 17, 16, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
  /* Ended run: the viewer bar stays as a snapshot of the last moment,
   * readable but inert.  */
  .run-ended #toolbar {
    pointer-events: none;
  }
  .end-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-soft);
    border: 1px solid var(--accent-border);
    color: var(--accent);
    margin-bottom: 10px;
  }
  .end-icon svg {
    width: 24px;
    height: 24px;
    stroke-width: 1.75;
  }
  .end-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text);
    letter-spacing: 0.01em;
  }
  .end-description {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 340px;
  }
  .end-run-id {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    padding: 4px 12px;
    border-radius: 999px;
    border: 1px solid var(--hairline);
    background: var(--bg);
    color: var(--text-faint);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
  }
  .end-run-id svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
  }
  .end-run-id:hover {
    color: var(--text-muted);
    border-color: var(--border-strong);
  }
  .end-run-id.copied {
    color: var(--ok);
  }
  @keyframes bctrl-end-fade { from { opacity: 0; } }

  /* ── Dropdown Panels ── */
  .dropdown-panel {
    display: none;
    position: absolute;
    top: 0;
    right: 8px;
    width: 320px;
    max-height: 400px;
    background: var(--panel);
    backdrop-filter: blur(12px);
    border: 1px solid var(--hairline);
    border-radius: 12px;
    box-shadow: var(--shadow-panel);
    z-index: 100;
    overflow: hidden;
    flex-direction: column;
  }
  .dropdown-panel.open { display: flex; }
  .dropdown-header {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    border-bottom: 1px solid var(--hairline);
    flex-shrink: 0;
  }
  .dropdown-body {
    overflow-y: auto;
    flex: 1;
    padding: 4px 0;
  }
  .dropdown-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
  }

  /* ── Download Items ── */
  .download-item {
    padding: 10px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .download-item + .download-item {
    border-top: 1px solid var(--hairline);
  }
  .download-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .download-filename {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .download-action {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
  }
  .download-action:hover,
  .download-action:focus-visible {
    color: var(--text);
    background: var(--surface-raised);
  }
  .download-action:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
  }
  .download-action svg {
    width: 16px;
    height: 16px;
  }
  .download-progress-row {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .download-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--hairline);
    border-radius: 2px;
    overflow: hidden;
  }
  .download-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
  }
  .download-status {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
  }
  .download-status.done { color: var(--ok); }
  .download-status.canceled { color: var(--danger); }

  /* ── Tool input items ── */
  .tool-input-item {
    padding: 12px 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 6px 12px;
    align-items: center;
  }
  .tool-input-item + .tool-input-item {
    border-top: 1px solid var(--hairline);
  }
  .tool-input-message {
    grid-column: 1 / -1;
    color: var(--text);
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
  }
  .tool-input-meta {
    color: var(--text-muted);
    font-size: 12px;
    min-width: 0;
  }
  .tool-input-done {
    border: 1px solid var(--accent-border);
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 7px;
    height: 28px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
  }
  .tool-input-done:hover {
    background: rgba(229, 160, 64, 0.2);
  }
  .tool-input-secret {
    grid-column: 1 / -1;
    display: grid;
    gap: 8px;
  }
  .tool-input-field {
    display: grid;
    gap: 4px;
    color: var(--text-muted);
    font-size: 12px;
  }
  .tool-input-field input {
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--hairline);
    border-radius: 7px;
    background: var(--inset);
    color: var(--text);
    font: inherit;
    font-size: 13px;
  }
  .tool-input-secret .tool-input-submit {
    justify-self: end;
    border: 1px solid var(--accent-border);
    background: var(--accent-soft);
    color: var(--accent);
    border-radius: 7px;
    height: 28px;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
  }
  .tool-input-secret .tool-input-submit:disabled { opacity: 0.5; cursor: default; }

  /* ── Selkies runtimes: the stream fills the page, the bar floats over it.
   * Everything sits on the bottom edge: the top of the picture is the
   * runtime's own tab strip and omnibox, which people click. ── */
  body.selkies #bctrl-live-root { position: relative; }
  #selkies-stage {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: var(--inset);
  }
  #selkies-stage video,
  #overlayInput {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
  }
  #selkies-stage video { object-fit: contain; background: var(--inset); }
  /* Pointer, touch and keyboard input land on this transparent field over the
   * picture; it hosts IME composition and shows the browser's cursor. */
  #overlayInput { opacity: 0; caret-color: transparent; outline: none; }
  /* Focused to open a phone's on-screen keyboard. */
  #keyboard-input-assist {
    position: absolute;
    left: -9999px;
    top: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
  }
  body.selkies #toolbar.floating {
    position: absolute;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 50;
    padding: 4px 6px;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    background: var(--panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-panel);
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
  }
  body.selkies #toolbar.floating.revealed {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
  body.selkies #toolbar.floating #connection-dot { display: none; }
  body.selkies #toolbar.floating .toolbar-right { gap: 2px; margin-left: 0; }
  /* Tooltips open upward from a bottom bar. */
  body.selkies #toolbar.floating .toolbar-btn[data-tip]::after {
    top: auto;
    bottom: calc(100% + 10px);
  }
  #viewer-controls {
    position: absolute;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: calc(100% - 24px);
    pointer-events: none;
  }
  body.selkies #viewer-controls #toolbar.floating { position: relative; right: auto; bottom: auto; flex-shrink: 0; }
  .viewer-input-status {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 42px;
    padding: 6px 10px;
    border: 1px solid var(--hairline);
    border-radius: 12px;
    background: var(--panel);
    backdrop-filter: blur(12px);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.4;
    pointer-events: auto;
  }
  .viewer-input-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
  .viewer-input-dot.active { background: var(--ok); }
  .viewer-input-status button {
    padding: 4px 8px;
    border: 1px solid var(--accent-border);
    border-radius: 6px;
    background: var(--accent-soft);
    color: var(--text);
    font: inherit;
    cursor: pointer;
  }
  .viewer-input-status button.quiet { background: transparent; border-color: var(--hairline); color: var(--text-muted); }
  .viewer-input-status button:disabled { opacity: .5; cursor: wait; }
  .viewer-input-status button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .viewer-input-hint, .viewer-input-notice { color: var(--text-faint); }
  .viewer-input-notice { flex-basis: 100%; }
  #selkies-panels {
    position: absolute;
    right: 4px;
    bottom: calc(66px + env(safe-area-inset-bottom));
    z-index: 60;
  }
  body.selkies .dropdown-panel {
    top: auto;
    bottom: 0;
    max-width: calc(100vw - 24px);
  }
  .startup-play {
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--text);
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
  }
  .startup-play:hover { background: rgba(170, 156, 130, 0.28); }
  #control-strip {
    position: absolute;
    bottom: calc(14px + env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 55;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 5px 5px 12px;
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    background: var(--panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-panel);
    color: var(--text);
    font-size: 12px;
    white-space: nowrap;
  }
  .control-strip-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ok);
  }
  #control-strip button,
  .tool-input-take-control button {
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--text);
    padding: 4px 11px;
    font-size: 12px;
    cursor: pointer;
  }
  #control-strip button:hover,
  .tool-input-take-control button:hover:not(:disabled) { background: rgba(170, 156, 130, 0.28); }
  .tool-input-take-control button:disabled { opacity: 0.5; cursor: default; }
  #control-elsewhere {
    position: absolute;
    right: 14px;
    bottom: calc(66px + env(safe-area-inset-bottom));
    z-index: 45;
    padding: 5px 10px;
    border-radius: 8px;
    background: var(--panel);
    color: var(--text-muted);
    font-size: 11px;
  }
  .tool-input-take-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--hairline);
    color: var(--text-muted);
    font-size: 12px;
  }
  #toast-stack {
    position: absolute;
    left: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    z-index: 70;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: calc(100vw - 24px);
  }
  .toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 10px 9px 14px;
    border: 1px solid var(--hairline);
    border-radius: 10px;
    background: var(--panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-panel);
    color: var(--text-muted);
    font-size: 12px;
  }
  .toast-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .toast-text strong { color: var(--text); font-weight: 500; }
  .toast-action {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
  }
  /* Files panel (Selkies): uploads above, downloads below. */
  .files-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 6px;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .files-section-downloads {
    border-top: 1px solid var(--hairline);
    margin-top: 6px;
  }
  .files-upload-button {
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--text);
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
  }
  .files-upload-button:hover { background: rgba(170, 156, 130, 0.28); }
  .files-hint {
    padding: 0 16px 8px;
    color: var(--text-faint);
    font-size: 12px;
    line-height: 1.45;
  }
  .files-empty {
    padding: 4px 16px 8px;
    color: var(--text-muted);
    font-size: 13px;
  }
  .files-dismiss {
    margin-left: auto;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
  }
  #drop-overlay {
    position: absolute;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    background: rgba(16, 17, 16, 0.55);
    border: 2px dashed var(--accent-border);
    color: var(--text);
    font-size: 15px;
  }
  #drop-overlay > div {
    padding: 12px 20px;
    border-radius: 12px;
    background: var(--panel);
    box-shadow: var(--shadow-panel);
    pointer-events: none;
  }
  /* Touch: bigger targets; hover tooltips never show. */
  @media (pointer: coarse) {
    body.selkies #toolbar.floating .toolbar-btn { width: 40px; height: 40px; }
    body.selkies #toolbar.floating .toolbar-btn[data-tip]::after { display: none; }
  }
  /* Narrow screens: the strip and toasts stack above the bar. */
  @media (max-width: 640px) {
    #control-strip {
      left: 12px;
      transform: none;
      bottom: calc(66px + env(safe-area-inset-bottom));
    }
    #toast-stack { bottom: calc(110px + env(safe-area-inset-bottom)); }
  }
  @media (prefers-reduced-motion: reduce) {
    body.selkies #toolbar.floating { transition: none; }
  }


