/* Browser panel: slides in beside the chat (chat stays visible), full-screen sheet on phones.
 * Tokens only: brand/tokens.css. Type 12/13/15/17/22, radii 6/10/16/999, shadows 1 and 2, motion 200 ms. */

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.browser-button { position: relative; }
.browser-button.is-active { background: var(--ox-brand-soft); color: var(--ox-brand); }
.browser-button[hidden] { display: none; }
.browser-button .attn { position: absolute; top: 5px; right: 5px; width: 9px; height: 9px; border-radius: var(--ox-r-full);
  background: var(--ox-warn); border: 2px solid var(--ox-surface); animation: bpulse 1.6s ease-out infinite; }
.browser-button .attn[hidden] { display: none; }
@keyframes bpulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ox-warn) 55%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }

/* Dock: a column beside the page. Its width animates; the panel inside keeps its size, so nothing re-wraps mid-slide. */
.bdock {
  --bdw: clamp(420px, 45vw, 720px);
  flex: none; width: 0; min-width: 0; overflow: hidden; position: relative;
  border-left: 1px solid transparent; background: var(--ox-surface);
  transition: width var(--ox-base) var(--ox-ease), border-color var(--ox-base) var(--ox-ease);
}
.bdock.is-open { width: var(--bdw); border-left-color: var(--ox-line); }
.bpanel { position: absolute; inset: 0 auto 0 0; width: var(--bdw); display: flex; flex-direction: column; background: var(--ox-surface); color: var(--ox-ink); }

.bpanel-head { flex: none; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--ox-line); }
.bpanel-ic { flex: none; width: 36px; height: 36px; border-radius: var(--ox-r-md); display: grid; place-items: center; background: var(--ox-brand); color: var(--ox-surface); }
.bpanel-title { flex: 1; min-width: 0; }
.bpanel-title h2 { margin: 0; font-size: var(--ox-t-md); font-weight: var(--ox-heading-weight); letter-spacing: var(--ox-heading-tracking); outline: none; }
.bpanel-task { margin: 1px 0 0; font-size: var(--ox-t-sm); color: var(--ox-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bpanel-body > * { flex: none; }
.bpanel-body { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 18px; background: var(--ox-bg); }

/* Banner (login, your turn, confirm, result) sits above the live view so it is the first thing seen. */
.bbanner { display: grid; gap: 10px; }
.bbanner.is-empty { display: none; }
.bnote { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--ox-r-md); background: var(--ox-surface); border: 1px solid var(--ox-line); }
.bnote > svg { margin-top: 2px; }
.bnote > div { flex: 1; min-width: 0; }
.bnote b { display: block; font-size: var(--ox-t-base); font-weight: 600; }
.bnote p { margin: 2px 0 0; font-size: var(--ox-t-sm); color: var(--ox-ink-2); line-height: 1.5; }
.bnote.is-warn { background: var(--ox-warn-soft); border-color: color-mix(in srgb, var(--ox-warn) 28%, transparent); }
.bnote.is-warn > svg { color: var(--ox-warn-ink); }
.bbanner-alt { justify-self: start; }

.bresult { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border-radius: var(--ox-r-lg); background: var(--ox-surface); border: 1px solid var(--ox-line); box-shadow: var(--ox-shadow-1);
  animation: bin var(--ox-base) var(--ox-ease); }
.bresult > div { flex: 1; min-width: 0; }
.bresult b { display: block; font-size: var(--ox-t-base); font-weight: 600; }
.bresult p { margin: 3px 0 0; font-size: var(--ox-t-sm); color: var(--ox-ink-2); line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
.bresult a { margin-top: 8px; display: inline-flex; align-items: center; gap: 5px; font-size: var(--ox-t-sm); font-weight: 600; color: var(--ox-accent); text-decoration: none; }
.bresult a:hover { text-decoration: underline; }
.bresult-ic { flex: none; width: 32px; height: 32px; border-radius: var(--ox-r-full); display: grid; place-items: center; background: var(--ox-surface-2); color: var(--ox-ink-2); }
.bresult.is-ok .bresult-ic { background: var(--ox-ok-soft); color: var(--ox-ok-ink); }
.bresult.is-danger .bresult-ic { background: var(--ox-danger-soft); color: var(--ox-danger-ink); }
@keyframes bin { from { opacity: 0; transform: translateY(6px); } }

/* Confirm card: the one thing that stops an outward action. */
.bconfirm {
  display: grid; gap: 10px; padding: 18px; border-radius: var(--ox-r-lg); background: var(--ox-surface);
  border: 1.5px solid var(--ox-brand); box-shadow: var(--ox-shadow-2); outline: none; animation: bin var(--ox-base) var(--ox-ease);
}
.bconfirm:focus-visible { box-shadow: 0 0 0 3px var(--ox-brand-soft), var(--ox-shadow-2); }
.bconfirm-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: var(--ox-t-xs); font-weight: 600; color: var(--ox-accent); }
.bconfirm-q { margin: 0; font-size: var(--ox-t-lg); font-weight: var(--ox-heading-weight); letter-spacing: var(--ox-heading-tracking); line-height: 1.25; overflow-wrap: anywhere; }
.bconfirm-d { margin: 0; font-size: var(--ox-t-sm); color: var(--ox-ink-2); }
.bconfirm-actions { display: flex; gap: 10px; margin-top: 8px; }
.bconfirm-go { flex: 1.5; height: 46px; font-size: var(--ox-t-base); }
.bconfirm-no { flex: 1; height: 46px; font-size: var(--ox-t-base); }
.bconfirm-kbd { display: none; margin-left: 4px; font-family: var(--ox-mono); font-size: var(--ox-t-xs); font-weight: 500; padding: 1px 6px; border-radius: var(--ox-r-sm);
  border: 1px solid rgba(255, 255, 255, 0.35); color: rgba(255, 255, 255, 0.85); }
.bconfirm:focus-within .bconfirm-kbd { display: inline-block; }
.bconfirm.is-busy { opacity: 0.7; }

/* Live view */
.bview { border: 1px solid var(--ox-line-2); border-radius: var(--ox-r-md); background: var(--ox-surface); box-shadow: var(--ox-shadow-1); overflow: hidden; }
.bview-bar { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-bottom: 1px solid var(--ox-line); background: var(--ox-surface); color: var(--ox-ink-3); }
.bview-url { flex: 1; min-width: 0; font-size: var(--ox-t-sm); color: var(--ox-ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bview-tag { flex: none; display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: var(--ox-r-full); background: var(--ox-accent-soft); color: var(--ox-accent); font-size: var(--ox-t-xs); font-weight: 600; }
.bview-tag[hidden] { display: none; }
.bview-stage { position: relative; width: min(100%, calc(52dvh * var(--ar, 1.6))); aspect-ratio: var(--ar, 1.6); margin: 0 auto; background: var(--ox-surface-2); transition: box-shadow var(--ox-fast) var(--ox-ease); }
.bview-stage.is-control { box-shadow: inset 0 0 0 2px var(--ox-accent); }
.bview-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; outline: none; touch-action: none; transition: opacity var(--ox-base) var(--ox-ease); }
.bview-stage.has-frame .bview-canvas { opacity: 1; }
.bview-stage.is-control .bview-canvas { cursor: default; }
.bview-canvas:focus-visible { outline: 2px solid var(--ox-accent); outline-offset: -2px; }
.bview-kbd { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; }
.bview-veil { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 8px; padding: 16px; text-align: center; pointer-events: none; color: var(--ox-ink-2); font-size: var(--ox-t-sm); }
.bview-veil.is-solid { background: var(--ox-surface-2); }
.bview-veil.is-empty { display: none; }
.bview-veil b { font-size: var(--ox-t-base); color: var(--ox-ink); }
.bview-skel { position: absolute; inset: 0; border-radius: 0; }
.bview-wait { position: relative; display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border-radius: var(--ox-r-full); background: var(--ox-surface); box-shadow: var(--ox-shadow-1); }
.bview-chip { position: absolute; right: 10px; bottom: 10px; display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: var(--ox-r-full);
  background: color-mix(in srgb, var(--ox-brand) 88%, transparent); color: var(--ox-surface); font-size: var(--ox-t-xs); font-weight: 600; }
.bview-chip .spinner { width: 12px; height: 12px; border-color: rgba(255,255,255,.35); border-top-color: var(--ox-surface); }
.bview-hint { margin: -4px 2px 0; font-size: var(--ox-t-xs); color: var(--ox-ink-3); }
.bview-hint[hidden] { display: none; }

/* Controls */
.bctl { display: flex; align-items: center; gap: 8px; }
.bctl[hidden] { display: none; }
.bctl-gap { flex: 1; }
.bctl-stop { color: var(--ox-danger-ink); }
.bctl-stop:hover { background: var(--ox-danger-soft); color: var(--ox-danger-ink); }
.bctl-kbd[hidden] { display: none; }

/* Steps */
.bsteps-wrap { display: grid; gap: 8px; }
.bsteps-wrap h3 { margin: 0; font-size: var(--ox-t-xs); font-weight: 600; letter-spacing: 0.02em; color: var(--ox-ink-3); }
.bsteps { list-style: none; margin: 0; padding: 4px 0; display: grid; border: 1px solid var(--ox-line); border-radius: var(--ox-r-md); background: var(--ox-surface); max-height: 260px; overflow-y: auto; }
.bstep { display: flex; align-items: flex-start; gap: 10px; padding: 8px 12px; font-size: var(--ox-t-sm); color: var(--ox-ink-2); line-height: 1.45; animation: bin var(--ox-base) var(--ox-ease); }
.bstep-mark { flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: var(--ox-r-full); display: grid; place-items: center; background: var(--ox-ok); color: var(--ox-surface); }
.bstep-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bstep-at { flex: none; font-size: var(--ox-t-xs); color: var(--ox-ink-3); font-variant-numeric: tabular-nums; }
.bstep.is-now { color: var(--ox-ink); font-weight: 600; }
.bstep.is-now .bstep-mark, .bstep.is-wait .bstep-mark { background: transparent; }
.bstep .spinner { width: 14px; height: 14px; border-width: 2px; }
.bstep-pause { width: 10px; height: 10px; border-radius: var(--ox-r-full); background: var(--ox-warn); }
.bstep.is-wait { color: var(--ox-ink); font-weight: 600; }
.bstep.is-failed { color: var(--ox-danger-ink); }
.bstep.is-failed .bstep-mark { background: var(--ox-danger); }
.bstep.is-stopped .bstep-mark { background: var(--ox-ink-3); }
.bstep.is-quiet { color: var(--ox-ink-3); }
.bstep-skel { height: 14px; width: 70%; }
.bstep:nth-child(2) .bstep-skel { width: 52%; }
.bstep:nth-child(3) .bstep-skel { width: 61%; }

/* Phone and small tablets: a full-screen sheet over the page. Pinned to the left edge, not the right:
   a page with a sideways scroll widens the layout viewport, and a sheet anchored to its right edge
   would slide the whole panel (and its Close button) off the screen. */
@media (max-width: 800px) {
  .bdock {
    --bdw: 100vw; position: fixed; z-index: 65; inset: 0 auto 0 0; width: 100vw; border-left: 0;
    transform: translateX(100%); visibility: hidden; transition: transform var(--ox-base) var(--ox-ease), visibility 0s linear var(--ox-base);
  }
  .bdock.is-open { width: 100vw; transform: none; visibility: visible; transition: transform var(--ox-base) var(--ox-ease), visibility 0s; }
  .bpanel { width: 100%; padding-bottom: env(safe-area-inset-bottom); }
  .bpanel-head { padding-top: calc(10px + env(safe-area-inset-top)); }
  .bpanel-body { padding: 12px 12px 18px; }
  .bview-stage { width: 100%; }
  .bconfirm { padding: 16px; }
  .bconfirm-kbd { display: none !important; }
  .bctl .btn { height: 42px; }
  .bpanel .icon-button { width: 40px; height: 40px; }
}
