.room-launcher {
  position: fixed;
  right: 14px;
  bottom: 5px;
  z-index: 610;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(46vw, 280px);
  min-height: 27px;
  padding: 4px 12px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 600 12px var(--sans);
  cursor: pointer;
}
.room-launch-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.room-code-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr));
  gap: 8px 12px;
  align-items: center;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid var(--rule);
  border-radius: 14px;
  background: var(--surface);
}
.room-code-card .room-eyebrow { grid-column: 1 / -1; }
.room-join-code {
  font: 650 clamp(23px, 6vw, 30px) var(--mono, monospace);
  letter-spacing: .12em;
  color: var(--ink);
  user-select: all;
  white-space: nowrap;
}
.room-code-card button { min-height: 40px; padding: 8px; }
@media (max-width: 360px) {
  .room-code-card { grid-template-columns: minmax(0, 1fr); }
  .room-code-card button { width: 100%; }
}
.room-launcher:hover {
  border-color: var(--accent);
  background: var(--raised);
}
.room-connection-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-3);
  flex-shrink: 0;
}
[data-online="true"] .room-connection-dot {
  background: var(--ok);
}
.room-menu-action {
  display: flex;
  width: 100%;
  padding: 12px;
  justify-content: flex-start;
}
.room-dialog,
.room-panel {
  font: 14px/1.5 var(--sans);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  box-shadow: 0 24px 80px #0005;
  box-sizing: border-box;
}
.room-dialog {
  padding: 26px;
  position: fixed;
  inset: auto;
  top: calc(var(--room-view-top, 0px) + var(--room-view-height, 100dvh) / 2);
  left: calc(var(--room-view-left, 0px) + var(--room-view-width, 100vw) / 2);
  transform: translate(-50%, -50%);
  width: min(560px, calc(var(--room-view-width, 100vw) - 24px));
  max-width: calc(var(--room-view-width, 100vw) - 24px);
  max-height: calc(var(--room-view-height, 100dvh) - 24px);
  border-radius: 20px;
  margin: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
  animation: room-enter 0.18s ease-out;
}
.room-dialog::backdrop {
  background: #05070bac;
  backdrop-filter: blur(4px);
}
.room-dialog header,
.room-panel header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.room-eyebrow {
  font: 600 10px var(--mono);
  letter-spacing: 0.15em;
  color: var(--ink-2);
}
.room-dialog header > div,
.room-panel header > div { min-width: 0; }
.room-dialog h1 {
  font-size: 28px;
  line-height: 1.18;
  letter-spacing: -0.045em;
  margin: 8px 0 0;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.room-intro {
  color: var(--ink-2);
  margin: 12px 0 22px;
}
.room-dialog .room-close,
.room-panel .room-close {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--rule);
  background: var(--raised);
  color: var(--ink-2);
  border-radius: 10px;
  font: 24px var(--sans);
  flex-shrink: 0;
  cursor: pointer;
}
.room-tabs {
  display: flex;
  gap: 4px;
  background: var(--paper);
  padding: 4px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  margin: 0 0 20px;
}
.room-tabs button {
  flex: 1;
  min-width: 0;
  padding: 10px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font: 600 12px var(--sans);
  cursor: pointer;
}
.room-tabs button[aria-selected="true"] {
  background: var(--raised);
  color: var(--ink);
  box-shadow: 0 1px 5px #0002;
}
.room-dialog label,
.room-panel label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 14px;
}
.room-dialog input:not([type="radio"]),
.room-panel input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  margin-top: 6px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font: 400 14px var(--sans);
  outline: none;
}
.room-dialog input:focus,
.room-panel input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}
.room-presets {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.room-dialog .room-preset {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--rule);
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  background: var(--paper);
}
.room-preset:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-wash);
}
.room-preset input {
  accent-color: var(--accent);
  margin: 0;
  flex-shrink: 0;
}
.room-preset strong {
  display: block;
  font-size: 12px;
  color: var(--ink);
}
.room-preset span { min-width: 0; overflow-wrap: anywhere; }
.room-preset small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-2);
  margin-top: 3px;
  line-height: 1.45;
}
.room-error {
  color: var(--error);
  font-size: 12px;
  overflow-wrap: anywhere;
  min-height: 0;
}
.room-error:empty {
  display: none;
}
.room-fine-print,
.room-help {
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.6;
}
.room-fine-print {
  margin: 18px 0;
}
.room-dialog footer,
.room-panel footer {
  position: static;
  inset: auto;
  transform: none;
  width: auto;
  height: auto;
  pointer-events: auto;
  opacity: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}
.room-dialog footer a {
  font-size: 12px;
  color: var(--ink-2);
}
.room-dialog button.room-primary,
.room-panel button.room-primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: var(--accent);
}
.room-dialog footer button,
.room-panel button:not(.room-close):not([role="tab"]) {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  font: 600 12px var(--sans);
  border: 1px solid var(--rule);
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--raised);
  color: var(--ink);
  cursor: pointer;
}
.room-dialog button:disabled,
.room-panel button:disabled {
  opacity: 0.5;
  cursor: wait;
}
.room-wide {
  width: 100%;
}
.room-panel {
  position: fixed;
  z-index: 10500;
  right: 12px;
  top: var(--room-panel-top, 96px);
  bottom: 42px;
  width: min(368px, calc(100vw - 24px));
  border-radius: 18px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: room-enter 0.18s ease-out;
}
.room-panel[hidden],
.room-focus-pill[hidden],
.room-recovery[hidden] {
  display: none;
}
.room-panel h2 {
  font-size: 20px;
  letter-spacing: -0.025em;
  line-height: 1.3;
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.room-self {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--ink-2);
  margin: 10px 0 16px;
}
#roomPanelContent {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
  flex: 1;
  padding-right: 4px;
}
.room-panel > header, .room-panel > .room-tabs { flex-shrink: 0; }
.room-panel footer {
  flex-shrink: 0;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
}
.room-panel footer button { flex: 1 1 110px; min-height: 44px; }
.room-member {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}
.room-member strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}
.room-member small {
  display: block;
  font-size: 10px;
  color: var(--ink-2);
}
.room-avatar {
  display: grid;
  place-items: center;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-wash);
  color: var(--ink);
  font-weight: 600;
}
.room-member-actions {
  grid-column: 2;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.room-panel .room-member-actions button {
  padding: 6px 8px;
  font-size: 10px;
}
.room-policy {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}
.room-panel .room-danger {
  color: var(--error) !important;
}
.room-connection {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  max-width: 40vw;
  font: 500 10px var(--mono);
  color: var(--ink-2);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
  z-index: 600;
}
.room-recovery {
  position: fixed;
  z-index: 640;
  left: 50%;
  bottom: 45px;
  transform: translateX(-50%);
  padding: 10px 14px;
  border: 1px solid var(--error);
  background: var(--surface);
  color: var(--ink);
  border-radius: 12px;
  font: 500 12px var(--sans);
  max-width: calc(100vw - 32px);
  cursor: pointer;
}
.room-focus-pill {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  position: fixed;
  z-index: 610;
  right: 24px;
  top: var(--room-panel-top, 96px);
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  font: 500 12px var(--mono);
  cursor: pointer;
}
.room-workspace:has(.room-panel:not([hidden])) .room-focus-pill {
  visibility: hidden;
}
.room-workspace:not(.toolbar-location-down) #notebookPageNav {
  bottom: 42px;
}
.room-focus {
  text-align: center;
  padding: 22px 0 12px;
}
.room-focus output {
  display: block;
  font: 400 52px var(--mono);
  letter-spacing: -0.05em;
  line-height: 1.4;
  color: var(--ink);
}
.room-focus p {
  font-size: 12px;
  color: var(--ink-2);
}
.room-intention {
  text-align: center;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.room-chat-log {
  min-height: 60px;
  max-height: 40dvh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.room-message {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.room-message strong {
  font-size: 10px;
  color: var(--ink-2);
}
.room-message p {
  font-size: 13px;
  line-height: 1.6;
  margin: 4px 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.room-chat-form {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  margin-top: 12px;
  align-items: center;
}
.room-chat-form input {
  margin: 0;
  flex: 1;
}
#roomPanelContent:has(.room-chat-form) { display: flex; flex-direction: column; }
#roomPanelContent .room-chat-log { flex: 1; max-height: none; }
.room-chat-form button { flex-shrink: 0; }
.room-notice {
  position: fixed;
  z-index: 13000;
  left: 50%;
  bottom: 48px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  width: max-content;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 12px 16px;
  font: 12px/1.5 var(--sans);
  box-shadow: 0 8px 32px #0004;
}
.room-text-button {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}
.room-cursor {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 580;
  pointer-events: none;
  color: var(--draw);
  will-change: transform;
  display: flex;
  align-items: flex-start;
  gap: 4px;
}
.room-cursor[hidden] {
  display: none;
}
.room-cursor span {
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--rule);
  font: 500 10px var(--sans);
  color: var(--ink);
}
.room-sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.room-workspace [data-menu-group="document"],
.room-workspace [data-menu-group="import"],
.room-workspace .menu-current-notebook {
  display: none !important;
}
@keyframes room-enter {
  from {
    opacity: 0;
    translate: 0 8px;
  }
  to {
    opacity: 1;
    translate: 0 0;
  }
}
@media (max-width: 600px) {
  .room-dialog {
    padding: 18px;
    max-height: calc(var(--room-view-height, 100dvh) - 24px);
  }
  .room-dialog h1 {
    font-size: 24px;
  }
  .room-presets {
    gap: 6px;
  }
  .room-dialog .room-preset {
    padding: 10px;
    gap: 6px;
  }
  .room-panel {
    top: 82px;
    bottom: 42px;
    padding: 16px;
    border-radius: 16px;
  }
  .room-connection {
    left: 12px;
    transform: none;
    max-width: 44vw;
    font-size: 9px;
    bottom: 10px;
  }
  .room-workspace .room-connection {
    bottom: 38px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 90vw;
    background: var(--surface);
    padding: 3px 8px;
    border-radius: 6px;
  }
  .room-launcher {
    max-width: 47vw;
  }
  .room-notice {
    font-size: 11px;
  }
  .room-fine-print {
    font-size: 10px;
  }
}
@media (max-width: 600px) {
  .room-dialog input:not([type="radio"]), .room-panel input { font-size: 16px; }
  .room-panel .room-close, .room-dialog .room-close { width: 40px; height: 40px; }
}
.room-compact-height .room-panel { padding: 12px; }
.room-compact-height .room-panel h2 { font-size: 16px; -webkit-line-clamp: 1; margin-top: 0; }
.room-compact-height .room-panel header .room-eyebrow { display: none; }
.room-compact-height .room-self { margin: 4px 0 8px; }
.room-compact-height .room-panel .room-tabs { margin-bottom: 8px; }
.room-compact-height .room-panel .room-tabs button { padding-block: 7px; min-height: 36px; }
.room-compact-height .room-panel footer { margin-top: 8px; padding-top: 8px; }
.room-compact-height .room-panel footer button { min-height: 40px; padding: 8px; }
.room-compact-height .room-focus { padding: 8px 0; }
.room-compact-height .room-focus output { font-size: 40px; }
.room-compact-height .room-chat-log { min-height: 24px; }
.room-compact-height .room-panel .room-close { width: 32px; height: 32px; }
@media (max-width: 300px) { .room-presets { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) {
  .room-dialog,
  .room-panel {
    animation: none;
  }
  .room-dialog::backdrop {
    backdrop-filter: none;
  }
}
