/* The live browser frame (split out of screens.css, review L9; same rules, same order). */

/* ── Live browser frame ─────────────────────────────────────── */
.browser-wrap .sheet-body {
  padding: 0;
}

.browser-view {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.bv-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-5) var(--space-3);
}

.bv-titles {
  flex: 1;
  min-width: 0;
}

.bv-title {
  margin: 0;
  overflow: hidden;
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-tight);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bv-url {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--c-ink-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bv-chip {
  flex: none;
  padding: 4px var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--c-surface-sunken);
  color: var(--c-ink-soft);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.bv-chip[data-state="user"] {
  background: var(--c-inverse);
  color: var(--c-inverse-ink);
}

.bv-chip[data-state="waiting_user"] {
  background: var(--c-attention-soft);
  color: var(--c-attention);
}

.bv-spaces {
  display: flex;
  gap: var(--space-2);
  padding: 0 var(--space-5) var(--space-3);
  overflow-x: auto;
  scrollbar-width: none;
}

.bv-space {
  flex: none;
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  font-size: var(--text-xs);
}

.bv-space[aria-selected="true"] {
  background: var(--c-inverse);
  border-color: var(--c-inverse);
  color: var(--c-inverse-ink);
}

.bv-stage {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 0;
  padding: var(--space-2) var(--space-3) 0;
}

.bv-scroll {
  max-width: 100%;
  max-height: 56vh;
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: var(--radius-md);
  scrollbar-width: none;
}

.bv-scroll::-webkit-scrollbar {
  display: none;
}

.bv-scroll[data-zoom="true"] .bv-frame {
  width: 200%;
}

.bv-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--touch);
}

.bv-zoom {
  flex: none;
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--c-ink-soft);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

.bv-frame {
  position: relative;
  margin: 0;
  aspect-ratio: 16 / 10;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--radius-md);
  background: var(--c-surface-sunken);
  touch-action: manipulation;
}

.bv-frame[data-driving="true"] {
  border-color: var(--c-inverse);
  box-shadow: 0 0 0 1px var(--c-inverse);
}

.bv-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  -webkit-user-select: none;
  user-select: none;
  pointer-events: none;
}

.bv-wait {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--c-ink-faint);
  font-size: var(--text-sm);
}

.bv-ripple {
  position: absolute;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 2px solid var(--c-overlay-ink);
  border-radius: 50%;
  background: var(--c-overlay);
  opacity: 0;
  pointer-events: none;
}

.bv-ripple[data-on="true"] {
  animation: ripple 480ms var(--ease-out);
}

@keyframes ripple {
  from {
    opacity: 0.9;
    transform: scale(0.4);
  }
  to {
    opacity: 0;
    transform: scale(1.4);
  }
}

.bv-caption {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0 var(--space-1);
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
  overflow-wrap: anywhere;
}

.bv-caption[data-gated="true"] {
  color: var(--c-danger);
}

.bv-info {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  gap: var(--space-2);
  min-height: 0;
  padding: var(--space-3) var(--space-5) 0;
  overflow-y: auto;
}

.bv-info > * {
  flex: none;
}

/* While the person drives, the page and the keys get the room. */
.browser-view[data-driving="true"] .bv-info {
  display: none;
}

.bv-wait-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 60px;
  margin-bottom: var(--space-2);
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4);
  border: 1px solid var(--c-attention);
  border-radius: var(--radius-md);
  background: var(--c-attention-soft);
  color: var(--c-attention);
  text-align: left;
}

.bv-wait-row .dot {
  background: currentColor;
}

.bv-wait-row[data-tone="danger"] {
  border-color: var(--c-danger-line);
  background: var(--c-danger-soft);
  color: var(--c-danger);
}

.bv-wait-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
  font-size: var(--text-xs);
}

.bv-wait-text b {
  font-size: var(--text-sm);
}

.bv-wait-text span {
  overflow: hidden;
  color: var(--c-ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.bv-group {
  margin: var(--space-1) 0 0;
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
}

.bv-tab {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--c-surface-sunken);
}

.bv-tab[data-active="true"] {
  box-shadow: inset 2px 0 0 var(--c-ink);
}

.bv-tab-title,
.bv-tab-url {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.bv-tab-title {
  font-size: var(--text-sm);
}

.bv-tab-url {
  color: var(--c-ink-muted);
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
}

.bv-controls {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5) var(--space-1);
}

.bv-note {
  margin: 0;
  color: var(--c-ink-muted);
  font-size: var(--text-xs);
  text-align: center;
  line-height: var(--leading-ui);
}

.bv-typing {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 4px 4px var(--space-4);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--radius-pill);
  background: var(--c-composer);
}

.bv-input {
  flex: 1;
  min-width: 0;
  min-height: var(--touch);
  border: 0;
  outline: 0;
  background: transparent;
}

.bv-keys {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: var(--touch);
  border: 1px solid var(--c-line);
  border-radius: var(--radius-md);
  background: var(--c-surface-sunken);
  font-size: var(--text-sm);
}

.key:active {
  background: var(--c-active);
}
