*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: var(--rh-launcher-bg);
  color: var(--rh-text);
  font-family: var(--rh-font);
  font-size: var(--rh-font-size);
  line-height: var(--rh-line-height);
  user-select: none;
}

button,
input {
  font-family: inherit;
}

/* Outer shell — do NOT name this `.viewport` (collides with Hub `.channel.viewport`). */
.replica-frame {
  width: 100%;
  height: 100%;
  position: relative;
  background: var(--rh-launcher-bg);
  overflow: hidden;
}

.stage {
  width: var(--rh-design-w);
  height: var(--rh-design-h);
  transform-origin: top left;
  position: absolute;
  top: 0;
  left: 0;
}

.hub {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--rh-launcher-bg);
  overflow: hidden;
}

/* ---- Header / tabs ---- */

.header {
  flex: 0 0 var(--rh-header-h);
  height: var(--rh-header-h);
  background: var(--rh-header-bg);
  display: flex;
  flex-direction: row;
  align-items: stretch;
}

.logo {
  padding: 2px 20px;
  height: 100%;
  flex-grow: 0;
  flex-shrink: 0;
  padding-left: 6px;
  margin-top: 4px;
  margin-right: 32px;
  position: relative;
}

.logo .logo-image {
  width: 50px;
  height: 30px;
  background: url(reality-hub.svg);
  position: absolute;
  background-repeat: no-repeat;
  background-size: contain;
  left: 15px;
}

.tab-container {
  flex: 1;
  position: relative;
  height: var(--rh-header-h);
  display: flex;
  align-items: flex-end;
}

.replica-frame:not(.is-fullscreen) .stage {
  filter: blur(2px) brightness(0.48);
  pointer-events: none;
}

.expand-prompt {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  padding: 18px 24px;
  border: 1px solid #c3b1e1;
  border-radius: 6px;
  background: #202020e8;
  color: #c3b1e1;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.015em;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.25;
  text-align: center;
  white-space: nowrap;
  box-shadow: 0 12px 36px #0009;
}

.expand-prompt:hover {
  background: #292929f2;
  border-color: #ffffff66;
}

.expand-prompt:focus-visible,
.exit-fullscreen:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

.expand-prompt-icon {
  font-size: 42px;
  line-height: 1;
}

.replica-frame.is-fullscreen .expand-prompt {
  display: none;
}

.replica-frame.is-low-resolution .expand-prompt {
  display: none;
}

.exit-fullscreen {
  position: absolute;
  right: 40px;
  bottom: 40px;
  z-index: 140;
  display: none;
  height: 48px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 16px;
  border: 1px solid #c3b1e1;
  border-radius: 6px;
  background: #202020d9;
  color: #c3b1e1;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 0px 0px #0008;
}

.exit-fullscreen:hover {
  background: #333333f2;
}

.exit-fullscreen .material-icons-outlined {
  font-size: 28px;
}

.replica-frame.is-fullscreen .exit-fullscreen {
  display: flex;
}

.resolution-warning {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 45;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100% - 32px));
  padding: 10px 14px;
  border: 1px solid #d8a23a80;
  border-radius: 4px;
  background: #2c2418f2;
  color: #f2cf8b;
  font-size: clamp(11px, 1.8vw, 14px);
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  box-shadow: 0 8px 24px #0008;
}

.resolution-warning[hidden] {
  display: none;
}

.tab-header {
  min-width: 100px;
  max-width: 250px;
  height: 34px;
  line-height: 32px;
  padding: 0 10px;
  margin: 0 0 0 1px;
  color: var(--rh-text-tab-active);
  background: var(--rh-tab-active);
  border-radius: var(--rh-radius-tab) var(--rh-radius-tab) 0 0;
  border-top: 2px solid var(--rh-tab-accent);
  display: flex;
  align-items: center;
  white-space: nowrap;
}

.tab-title {
  flex: 1;
  color: #fff;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-right: 8px;
}

.version {
  height: var(--rh-header-h);
  line-height: 44px;
  color: var(--rh-text-version);
  font-size: 12px;
}

.user {
  width: 32px;
  height: var(--rh-header-h);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.user-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #5b7fd6;
}

.user-initials {
  position: absolute;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  pointer-events: none;
}

/* ---- Launcher pane ---- */

.launcher {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: var(--rh-launcher-bg);
}

.top-menu {
  background-color: #22222200;
  padding: 6px 0;
  height: var(--rh-topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 6px;
}

.top-menu .title {
  padding: 0 12px;
  font-style: italic;
}

.show-title {
  color: gray;
}

.status-text {
  color: var(--rh-text-dim);
}

.pipe {
  color: var(--rh-text-pipe);
}

.top-menu .right-aligned {
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-menu .right-aligned > .separator {
  width: 1px;
  height: 24px;
  background-color: var(--rh-separator);
}

.tb-btn {
  cursor: pointer;
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  color: var(--rh-icon);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

.tb-btn:hover {
  color: var(--rh-icon-hover);
}

.tb-btn.disabled {
  pointer-events: none;
  opacity: 0.5;
}

.move-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---- Grid ---- */

.grid-container {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--rh-grid-bg);
  overflow: hidden;
}

.body-wrapper {
  flex: 1;
  min-height: 0;
  background: var(--rh-body-bg);
  overflow: hidden;
}

.dgrow {
  display: grid;
  grid-template-columns: var(--rh-col-name) var(--rh-col-project) var(--rh-col-graph) minmax(0, 1fr);
  height: var(--rh-row-h);
  position: relative;
  overflow: hidden;
}

.dgrow.launcher-show {
  border-top: 2px solid var(--rh-show-border);
}

.dgrow.selected {
  background-color: var(--rh-row-selected);
}

.dgrow:not(.selected):hover {
  background-color: var(--rh-row-hover);
}

.selection-bar {
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  height: calc(100% - 1px);
  background: var(--rh-selected-bar);
  z-index: 1;
}

.cell {
  min-width: 0;
  height: 100%;
  padding: 0 10px;
  display: flex;
  align-items: center;
  position: relative;
  border-right: 1px solid var(--rh-cell-border-r);
  border-bottom: 1px solid var(--rh-cell-border-b);
}

.cell:last-child {
  border-right: none;
}

.name-cell {
  display: flex;
  gap: 4px;
  align-items: center;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.arrow {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--rh-text);
  font-size: 18px;
  line-height: 18px;
  transform: rotate(90deg);
}

.name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.name.indented {
  margin-left: var(--rh-indent);
}

.right-aligned-container {
  display: flex;
  flex: 0 0 auto;
  margin-left: auto;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.right-aligned-container .channels-container {
  margin-top: -2px;
  flex-shrink: 0;
}

.show-start-stop-btn {
  appearance: none;
  -webkit-appearance: none;
  height: 24px;
  width: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  margin: 0;
  padding: 0;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 24px;
  border-radius: var(--rh-radius-btn);
  cursor: pointer;
  background: var(--rh-stop);
}

.launch-settings-btn {
  color: var(--rh-icon-muted);
  cursor: pointer;
  width: 20px;
  height: 20px;
  font-size: 20px;
  line-height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.launch-settings-btn:hover {
  color: var(--rh-text-dim);
}

.project-graph {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 0;
}

.pg-main {
  display: flex;
  align-items: center;
  height: 22px;
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  font-size: 14px;
  min-width: 0;
}

.pg-main .label {
  min-width: 50px;
  font-style: italic;
  color: var(--rh-text-label);
  flex-shrink: 0;
}

.pg-main .pname,
.pg-main .gname,
.pg-main .lname {
  color: var(--rh-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pg-main .tilde {
  color: var(--rh-text-muted);
  flex-shrink: 0;
}

.clear-btn {
  width: 14px;
  height: 14px;
  font-size: 14px;
  line-height: 14px;
  color: var(--rh-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
}

.clear-btn:hover {
  color: #fff;
}

/* ---- Channel badges ---- */

.channels-container {
  display: flex;
  height: 19px;
  overflow: hidden;
  width: max-content;
  max-width: 100%;
  align-self: flex-start;
}

.channel {
  height: 20px;
  width: max-content;
  max-width: 200px;
  flex: 0 0 auto;
  border-radius: 2px;
  text-align: center;
  line-height: 20px;
  font-size: 12px;
  opacity: 0.8;
  display: flex;
  gap: 2px;
  align-items: center;
  padding: 0 8px;
  border-right: 1px solid var(--rh-channel-border);
}

.channel > div {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 2px;
}

.channel:first-of-type {
  padding-left: 0;
}

.channel:last-of-type {
  border-right: none;
}

.channel .symbol {
  font-family: 'Material Icons';
  font-weight: normal;
  font-style: normal;
  font-size: 12px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  color: var(--rh-program);
  flex-shrink: 0;
  width: auto;
  height: auto;
}

.channel .symbol.preview {
  color: var(--rh-preview);
}

.channel.nodos .symbol {
  font-size: 14px;
}

.channel.viewport .symbol {
  font-size: 12px;
}

.channel.dynamic .symbol {
  font-size: 16px;
}

.channel .clabel {
  margin-left: 4px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.channel.disabled {
  opacity: 1;
  mix-blend-mode: normal;
  color: var(--rh-icon-disabled);
}

.channel.disabled .symbol {
  color: var(--rh-icon-disabled);
}

/* ---- Log cell ---- */

.log-cell {
  display: flex;
  align-items: center;
  gap: 4px;
  font-style: italic;
  min-width: 0;
  width: 100%;
}

.log-ts {
  color: var(--rh-text-muted);
  flex-shrink: 0;
}

.show-log,
.engine-log {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Logs panel ---- */

.logs-split {
  flex: 0 0 168px;
  height: 168px;
  display: flex;
  flex-direction: column;
  position: relative;
  border-top: 1px solid var(--rh-splitter);
}

.logs-handle {
  width: var(--rh-logs-handle-w);
  height: var(--rh-logs-handle-h);
  background: var(--rh-logs-handle);
  position: absolute;
  z-index: 1;
  border-radius: var(--rh-radius-handle) var(--rh-radius-handle) 0 0;
  right: 70px;
  top: -23px;
  text-align: center;
  font-size: 12px;
  padding-top: 2px;
  cursor: pointer;
}

.logs-handle:hover {
  background: rgb(73, 73, 73);
}

.filter-container {
  width: 100%;
  height: var(--rh-logs-filter-h);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 6px;
  background: var(--rh-filter-bar);
  border-bottom: 1px solid #ffffff0f;
  gap: 4px;
}

.filterbox {
  width: 350px;
  height: 24px;
}

.filterbox input {
  width: 100%;
  height: 24px;
  border: none;
  border-radius: 2px;
  outline: none;
  padding: 4px 24px 4px 8px;
  background: var(--rh-filter-default);
  color: #ddd;
  font-size: 12px;
}

.filterbox input::placeholder {
  color: #989898;
}

.filterbox input:focus {
  color: #fff;
}

.filterbox.has-matches input {
  background: var(--rh-filter-found);
  color: #fff;
}

.filterbox.no-matches input {
  background: var(--rh-filter-none);
  color: #fff;
}

.scroll-btn {
  opacity: 1;
  cursor: pointer;
  font-size: 20px;
  line-height: 20px;
  width: 24px;
  height: 24px;
  border-radius: 2px;
  padding: 2px;
  background: var(--rh-scroll-btn);
  color: var(--rh-text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.log-main-container {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: var(--rh-logs-bg);
  box-sizing: border-box;
  padding: 10px;
  border-top: 6px solid var(--rh-logs-bg);
}

.log-container {
  font-size: 12px;
  font-family: var(--rh-font-mono);
  white-space: pre;
  white-space-collapse: preserve;
}

.log-line {
  margin: 0;
  padding: 0;
}

.log-line .timestamp,
.log-line .log-type-bracket,
.log-line .log-type {
  opacity: 0.6;
}

.log-line .log-type {
  display: inline-block;
  width: 64px;
  text-align: center;
}

.log-line.info {
  color: var(--rh-info);
}

.log-line.success {
  color: var(--rh-success);
}

.log-line.hidden {
  display: none;
}

.log-container .highlight {
  background-color: var(--rh-highlight-bg);
  color: var(--rh-highlight-fg);
}

/* ---- Hotspots / interaction ---- */

[data-hotspot] {
  cursor: pointer;
  outline: none;
}

.selection-bar[data-hotspot] {
  position: absolute;
}

.logs-handle[data-hotspot] {
  position: absolute;
}

.hub.is-dimmed {
  filter: brightness(0.35);
  pointer-events: none;
}

.focus-layer {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
}

.focus-layer.open {
  display: block;
}

.focus-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}

.focus-clone {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
  scrollbar-width: none;
  transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1), top 220ms cubic-bezier(0.22, 1, 0.36, 1),
    left 220ms cubic-bezier(0.22, 1, 0.36, 1);
  background: transparent;
  padding: 0;
  border-radius: 0;
  box-shadow: none;
}

.focus-clone.focus-clone--panel {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  background: #2a2a2a;
  padding: 8px 12px;
  border-radius: 4px;
}

.focus-clone::-webkit-scrollbar,
.focus-clone *::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.focus-clone .symbol {
  color: var(--rh-program);
}

.focus-clone .symbol.preview {
  color: var(--rh-preview);
}

.focus-clone,
.focus-clone .log-main-container,
.focus-clone .log-container,
.focus-clone .log-cell {
  overflow: hidden;
}

.focus-panel {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: calc(50% + 56px);
  transform: translateX(-50%);
  width: min(420px, calc(100% - 32px));
  background: #2c2c2c;
  border: 1px solid #4a4a4a;
  border-radius: 6px;
  padding: 16px 18px 14px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  color: var(--rh-text);
}

.focus-panel h2 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

.focus-panel p {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.45;
  color: #cfcfcf;
}

.focus-panel .close-btn {
  height: 28px;
  padding: 0 14px;
  border: none;
  border-radius: 2px;
  background: #399ed4;
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}

.focus-panel .close-btn:hover {
  background: #4aaddf;
}

