/* Shared layout primitives for both interfaces. */

:root {
  --bg: #11141a;
  --panel: #1b1f27;
  --panel-alt: #232833;
  --border: #333a47;
  --text: #e6e9ef;
  --text-dim: #9aa4b5;
  --accent: #4c8dff;
  --danger: #ff5c5c;
  --ok: #3ecf8e;
  --topbar-height: 48px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, 'Segoe UI', sans-serif;
  overflow: hidden;
}

/* Stage: the rendered tutorial with the annotation canvas stacked on top. */
.stage {
  position: relative;
  width: 100%;
  height: 100%;
  background: #ffffff;
}

.stage__frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

/* Screencast of the shared live browser. Hidden until a session is running. */
.stage__live {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  background: #1b1f27;
  object-fit: contain;
}

.stage--live .stage__live {
  display: block;
}

/* While live, the tutorial document underneath is irrelevant. */
.stage--live .stage__frame {
  display: none;
}

.stage__live.is-interactive {
  cursor: default;
}

.stage__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* Clicks fall through to the tutorial unless drawing mode turns this on. */
  pointer-events: none;
}

/* Loading screen — shown until the first HTML capture arrives from the backend Chrome. */
.loading-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--bg);
  z-index: 100;
  transition: opacity 0.3s ease;
}

.loading-screen.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-screen__spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-screen__text {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.status-pill {
  position: fixed;
  right: 12px;
  bottom: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(17, 20, 26, 0.9);
  color: var(--text-dim);
  font-size: 12px;
  border: 1px solid var(--border);
  transition: opacity 0.2s ease;
}

.status-pill[data-status='connected'] {
  opacity: 0;
}

.status-pill[data-status='disconnected'] {
  color: var(--danger);
  border-color: var(--danger);
  opacity: 1;
}
