/* Shared replay-player layout, timeline, log panes, and responsive controls. */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --layout-splitter-size: 8px;
  --player-split-percent: 50;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-base);
  overflow: hidden;
}

#app {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* State containers */
.state-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  gap: 16px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-input);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: gn-spin 1s linear infinite;
}

.loading-progress-bar {
  width: min(320px, calc(100vw - 48px));
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--border-subtle);
}

.loading-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--gradient-accent);
  transition: width 0.2s ease;
}

.loading-progress-text {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

#recording-password-submit.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: progress;
}

#recording-password-submit .btn-spinner {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  border: 2px solid color-mix(in srgb, currentColor 35%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: gn-spin 0.7s linear infinite;
}

/* Local alias when theme.css keyframes are unavailable (standalone always links theme). */
@keyframes gn-spin {
  to {
    transform: rotate(360deg);
  }
}

.state-container h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--danger);
  margin-bottom: 8px;
}

.state-container p {
  color: var(--text-muted);
  margin-bottom: 16px;
}

.password-panel {
  width: min(420px, calc(100vw - 48px));
  padding: 24px;
  border: 1px solid var(--border-default);
  border-radius: 12px;
  background: var(--bg-surface);
}

.password-panel h2 {
  color: var(--text-primary);
  margin-bottom: 8px;
}

.password-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.password-form label {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.password-entry-row {
  display: flex;
  gap: 8px;
}

.password-entry-row input {
  flex: 1;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--border-input);
  border-radius: 8px;
  color: var(--text-primary);
  background: var(--bg-input);
  outline: none;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.password-entry-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ghost);
}

.password-entry-row button {
  flex: 0 0 auto;
  padding: 9px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 600;
  transition:
    background 150ms ease,
    transform 80ms ease;
}

.password-entry-row button:hover {
  background: var(--accent-hover);
}

.password-entry-row button:active {
  transform: scale(0.98);
}

.password-entry-row button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.password-error {
  color: var(--danger);
  margin: 4px 0 0;
  font-size: 12px;
}

/* Always-visible product identity for OAuth branding crawlers (outside player states). */
.brand-identity {
  width: min(1080px, calc(100% - 2rem));
  margin: 20px auto 0;
  padding: 16px 20px;
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  background: var(--bg-card);
}

.brand-identity-name {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-identity-purpose {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 0.98rem;
  line-height: 1.6;
}

.brand-identity-purpose strong {
  color: var(--text-primary);
}

.brand-identity-links {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.brand-identity-links a {
  color: var(--accent);
  text-decoration: none;
}

.brand-identity-links a:hover {
  text-decoration: underline;
}

.brand-identity.is-concealed {
  display: none !important;
}

#intro-state {
  padding: 24px;
}

.intro-card {
  width: min(1080px, 100%);
  padding: 32px;
  border: 1px solid var(--border-default);
  border-radius: 20px;
  background:
    radial-gradient(circle at top right, rgba(79, 140, 255, 0.12), transparent 28%),
    linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-base) 100%);
  box-shadow: var(--shadow-lg);
}

.intro-eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bg-accent-soft);
  border: 1px solid var(--accent-subtle);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.intro-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
}

.intro-brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  flex-shrink: 0;
}

.intro-card h1,
.intro-brand-title {
  margin: 0;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.1;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-weight: 700;
}

.intro-lead {
  max-width: 820px;
  margin-top: 14px;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.6;
}

.intro-lead strong {
  color: var(--text-primary);
}

.intro-purpose {
  margin-top: 20px;
  padding: 18px 20px;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

.intro-purpose h2 {
  margin: 0 0 10px;
  color: var(--text-primary);
  font-size: 17px;
}

.intro-purpose p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.65;
}

.intro-purpose p + p {
  margin-top: 10px;
}

.intro-purpose strong {
  color: var(--text-primary);
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.intro-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--border-input);
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease;
}

.intro-link:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: var(--bg-accent-soft);
}

.intro-link-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.intro-link-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.intro-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  margin-top: 24px;
}

.intro-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.intro-panel {
  min-width: 0;
  padding: 20px;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

.intro-panel-wide {
  width: 100%;
  margin-top: 16px;
}

.intro-panel-wide p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.65;
}

.intro-panel-wide strong {
  color: var(--text-primary);
}

.intro-panel h2 {
  margin-bottom: 12px;
  color: var(--text-primary);
  font-size: 16px;
}

.intro-panel ol,
.intro-panel ul {
  padding-left: 18px;
  color: var(--text-secondary);
  line-height: 1.7;
}

.intro-panel li + li {
  margin-top: 6px;
}

.intro-panel code {
  color: var(--accent);
  background: var(--bg-accent-soft);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 12px;
}

.intro-footnote {
  margin-top: 18px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
}

.intro-footnote a {
  color: var(--accent);
  text-decoration: none;
}

.intro-footnote a:hover {
  text-decoration: underline;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 150ms ease,
    transform 80ms ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:active {
  transform: scale(0.98);
}

@media (max-width: 720px) {
  #intro-state {
    height: auto;
    min-height: 100vh;
    justify-content: flex-start;
    padding: 20px;
  }

  .intro-card {
    padding: 24px 20px;
  }

  .intro-grid,
  .intro-grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .intro-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* List container */
.list-container {
  padding: 32px;
  max-width: 800px;
  margin: 0 auto;
}

.list-container h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.recordings-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.recording-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  cursor: pointer;
  transition:
    background 150ms ease,
    border-color 150ms ease;
}

.recording-item:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.recording-info {
  flex: 1;
  min-width: 0;
}

.recording-name {
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.recording-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.recording-date {
  font-size: 12px;
  color: var(--text-dim);
}

/* Player container */
.player-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.player-container[data-layout-mode="horizontal"] {
  --layout-splitter-cursor: col-resize;
}

.player-container[data-layout-mode="vertical"] {
  --layout-splitter-cursor: row-resize;
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
  min-width: 0;
}

.player-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.player-brand-logo {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
}

.header h1 {
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1;
  white-space: nowrap;
}

/* Recorded page/web title next to the brand; CSS-only truncation. */
.player-web-title {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-web-title::before {
  content: "·";
  margin-right: 8px;
  color: var(--text-dim);
}

.header-info {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--text-muted);
}

.report-menu {
  position: relative;
  flex-shrink: 0;
}

.report-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  padding: 0;
}

.report-button .ph {
  font-size: 16px;
  line-height: 1;
}

.report-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 70;
  width: min(420px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: min(70vh, 560px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-lg);
  -webkit-overflow-scrolling: touch;
}

.report-popover.hidden {
  display: none !important;
}

.report-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-default);
}

.report-popover-title {
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.report-popover-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition:
    color 150ms ease,
    background 150ms ease,
    transform 80ms ease;
}

.report-popover-close:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.report-popover-close:active {
  transform: scale(0.96);
}

.report-popover-close .ph {
  font-size: 16px;
  line-height: 1;
}

.player-lang-toggle {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: normal;
  line-height: 1;
  min-width: 32px;
}

.player-global-actions {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 80;
  display: flex;
  align-items: center;
}

.player-global-actions .control-btn,
.player-feedback .control-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}

.player-feedback {
  --feedback-edge-inset: 16px;
  --feedback-dock-peek: 40px;
  position: fixed;
  right: var(--feedback-edge-inset);
  bottom: 16px;
  z-index: 80;
  transition: transform var(--dur-med) var(--ease-standard);
  will-change: transform;
}

.player-feedback.is-docked {
  transform: translateX(calc(100% - var(--feedback-dock-peek) + var(--feedback-edge-inset)));
}

.player-feedback-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-feedback-btn,
.player-feedback-dock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: var(--radius-md);
  transition:
    background var(--dur-fast) var(--ease-standard),
    border-color var(--dur-fast) var(--ease-standard),
    box-shadow var(--dur-fast) var(--ease-standard),
    opacity var(--dur-fast) var(--ease-standard),
    transform 80ms var(--ease-standard);
}

.player-feedback-btn {
  min-width: 104px;
  padding: 0 14px;
  gap: 8px;
}

.player-feedback-dock {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.player-feedback-btn .ph,
.player-feedback-dock .ph {
  font-size: 18px;
  line-height: 1;
}

.player-feedback-btn-label {
  font-size: var(--fs-sm);
  font-weight: 650;
  line-height: 1;
}

.player-feedback-btn:active,
.player-feedback-dock:active {
  transform: scale(0.96);
}

.player-feedback-btn:focus-visible,
.player-feedback-dock:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.player-feedback.is-docked .player-feedback-btn {
  opacity: 0;
  pointer-events: none;
}

.player-feedback-contact {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-primary);
  font: inherit;
  font-size: var(--fs-sm);
}

.player-feedback-contact:focus {
  outline: 2px solid var(--border-focus);
  outline-offset: 1px;
  border-color: var(--border-hover);
}

.player-feedback-contact:disabled {
  opacity: 0.7;
}

.player-feedback-popover {
  right: 0;
  top: auto;
  bottom: calc(100% + 10px);
  width: min(320px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
}

@media (max-width: 560px) {
  .player-feedback {
    --feedback-edge-inset: 12px;
    right: var(--feedback-edge-inset);
    bottom: 12px;
  }
}

/* Copied/success awareness: text + color only (no layout shift). */
.is-label-success {
  color: var(--success) !important;
}

.is-label-error {
  color: var(--danger) !important;
}

/* Busy submit (feedback): spinner stays inside the button. */
.btn.is-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: progress;
}

.btn .btn-spinner {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  border: 2px solid color-mix(in srgb, currentColor 35%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: gn-spin 0.7s linear infinite;
}

/* The replay header keeps its own language control; feedback remains available as a fixed action. */
body.player-active .player-global-actions > .player-lang-toggle {
  display: none;
}

/* Hide the floating toggle while the main player chrome is visible (header has its own). */
body:has(#player-state:not(.hidden)) .player-lang-toggle--global {
  display: none;
}

/* Main layout */
.main-layout {
  display: grid;
  grid-template-columns: minmax(320px, calc(var(--player-split-percent) * 1%)) var(
      --layout-splitter-size
    ) minmax(320px, 1fr);
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.player-container[data-layout-mode="vertical"] .main-layout {
  grid-template-columns: 1fr;
  grid-template-rows: minmax(220px, calc(var(--player-split-percent) * 1%)) var(
      --layout-splitter-size
    ) minmax(220px, 1fr);
}

/* Video section */
.video-section {
  display: flex;
  flex-direction: column;
  background: #000;
  min-height: 0;
  min-width: 0;
}

.player-container[data-layout-mode="horizontal"] .video-section {
  grid-column: 1;
  border-right: 1px solid var(--border-default);
}

.player-container[data-layout-mode="vertical"] .video-section {
  grid-column: 1;
  grid-row: 1;
  border-right: none;
  border-bottom: 1px solid var(--border-default);
}

.report-viewer {
  background: var(--bg-elevated);
}

.report-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px 14px;
  color: var(--text-secondary);
  background: transparent;
  min-height: min-content;
}

/* Activity content still scrolls inside the logs panel. */
.viewer-container.activity-viewer {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg-base);
  -webkit-overflow-scrolling: touch;
}

.report-popover::-webkit-scrollbar,
.viewer-container.activity-viewer::-webkit-scrollbar {
  width: 6px;
}

.report-popover::-webkit-scrollbar-track,
.viewer-container.activity-viewer::-webkit-scrollbar-track {
  background: transparent;
}

.report-popover::-webkit-scrollbar-thumb,
.viewer-container.activity-viewer::-webkit-scrollbar-thumb {
  background: var(--border-input);
  border-radius: 3px;
}

.report-popover::-webkit-scrollbar-thumb:hover,
.viewer-container.activity-viewer::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

.report-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.report-heading {
  min-width: 0;
}

.report-eyebrow {
  display: block;
  margin-bottom: 2px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-heading h2 {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
  word-break: break-word;
}

.report-page-link {
  flex: 0 1 auto;
  max-width: 42%;
  color: var(--accent);
  font-size: 12px;
  line-height: 1.4;
  text-align: right;
  text-decoration: none;
  word-break: break-word;
}

.report-page-link:hover {
  text-decoration: underline;
}

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.report-meta-chip {
  min-width: 0;
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--bg-card);
  font-size: 11px;
  line-height: 1.4;
  word-break: break-word;
}

.privacy-summary {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--success-border);
  border-radius: 8px;
  background: var(--bg-success-soft);
  color: var(--success-soft);
  font-size: 12px;
  line-height: 1.45;
}

.privacy-summary.hidden {
  display: none;
}

.privacy-summary-title {
  color: var(--success);
  font-weight: 700;
}

.privacy-summary-row {
  color: var(--text-secondary);
}

.report-screenshot {
  width: min(240px, 100%);
  max-height: 135px;
  object-fit: cover;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: #000;
}

.activity-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  color: var(--text-secondary);
  background: var(--bg-base);
  min-height: min-content;
}

.event-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.repro-steps {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-color, rgba(128, 128, 128, 0.2));
}

.repro-steps-title {
  padding: 2px 7px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.repro-step-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.repro-step-num {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.event-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  width: 100%;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-left: 3px solid transparent;
  border-radius: 6px;
  color: var(--text-secondary);
  background: var(--bg-base);
  cursor: pointer;
  text-align: left;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    opacity 150ms ease,
    color 150ms ease;
}

.event-item:hover {
  border-color: var(--accent);
  border-left-color: var(--accent);
  background: var(--bg-card-hover);
}

/* Playhead is at or past this event; dim events still in the future. */
.event-item.is-future {
  opacity: 0.5;
}

.event-item.active {
  border-color: var(--accent);
  border-left-color: var(--accent);
  background: var(--bg-card-hover);
  color: var(--text-primary);
  opacity: 1;
}

.event-item.active .event-time {
  color: var(--accent);
}

.event-time {
  color: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.event-label {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-container {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/*
 * Placeholder for recordings captured without video (the in-page SDK). It takes
 * the video's place rather than collapsing the section, so the console/network
 * panes keep the layout they have in a normal replay.
 */
.no-video-notice {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  color: var(--text-secondary);
}

.no-video-notice i {
  font-size: 40px;
  opacity: 0.55;
}

.no-video-notice p {
  margin: 0;
  font-size: 14px;
}

.no-video-notice .no-video-hint {
  max-width: 42ch;
  font-size: 12px;
  opacity: 0.8;
}

#video-player {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: pointer;
  background: #000;
}

#video-player.video-fit-height {
  width: auto;
  height: 100%;
}

#video-player.video-fit-width {
  width: 100%;
  height: auto;
}

.video-effects-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
}

.drawing-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 6;
}

.video-effect {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
}

.video-effect-click {
  width: 40px;
  height: 40px;
  border: 2px solid var(--accent, #58a6ff);
  background: color-mix(in srgb, var(--accent, #58a6ff) 25%, transparent);
  animation: video-effect-ripple 700ms ease-out forwards;
}

.video-effect-rclick {
  width: 44px;
  height: 44px;
  border: 2px solid #f0883e;
  box-shadow: 0 0 0 2px rgba(240, 136, 62, 0.4) inset;
  background: rgba(240, 136, 62, 0.2);
  animation: video-effect-ripple 700ms ease-out forwards;
}

@keyframes video-effect-ripple {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.3);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.6);
  }
}

.video-effect-scroll {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  font-size: 14px;
  line-height: 1;
  animation: video-effect-scroll-fade 750ms ease-out forwards;
}

.video-effect-scroll::before {
  content: "";
}

.video-effect-scroll-up::before {
  content: "\2191";
}

.video-effect-scroll-down::before {
  content: "\2193";
}

@keyframes video-effect-scroll-fade {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(-16px);
  }
}

.video-effect-key {
  width: auto;
  height: auto;
  min-width: 1.5em;
  padding: 4px 10px;
  border-radius: 6px;
  /* Anchor to bottom-right of the positioned point (stack grows upward). */
  transform: translate(-100%, -100%);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
  color: #f0f6fc;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New",
    monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
  animation: video-effect-key-fade 900ms ease-out forwards;
}

@keyframes video-effect-key-fade {
  0% {
    opacity: 1;
    transform: translate(-100%, -100%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translate(-100%, -100%) translateY(-14px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .video-effect-click,
  .video-effect-rclick {
    animation: video-effect-fade-only 700ms ease-out forwards;
  }

  .video-effect-scroll {
    animation: video-effect-fade-only 750ms ease-out forwards;
  }

  .video-effect-key {
    animation: video-effect-fade-only 900ms ease-out forwards;
  }

  @keyframes video-effect-fade-only {
    0% {
      opacity: 1;
    }
    100% {
      opacity: 0;
    }
  }
}

/* Video controls */
.video-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-default);
  flex-shrink: 0;
}

.control-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  min-height: 28px;
  transition:
    background 150ms ease,
    color 150ms ease,
    transform 80ms ease;
}

.control-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.control-btn:active {
  transform: scale(0.95);
}

.time-display {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: center;
}

/* Progress bar */
.progress-wrapper {
  flex: 1;
  min-width: 0;
  height: 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  position: relative;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--border-input);
  border-radius: 2px;
  position: relative;
  overflow: visible;
  transition: height 0.1s;
}

.progress-wrapper:hover .progress-bar {
  height: 6px;
}

.buffered-bar {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--text-dim);
  border-radius: 2px;
  pointer-events: none;
}

.played-bar {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  pointer-events: none;
}

.markers-container {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.marker {
  position: absolute;
  top: -2px;
  width: 3px;
  height: calc(100% + 4px);
  border-radius: 1px;
  opacity: 0.8;
  transform: translateX(-50%);
}

.progress-handle {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  background: var(--accent);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

.progress-wrapper:hover .progress-handle,
.progress-wrapper:active .progress-handle {
  opacity: 1;
}

.tooltip {
  position: absolute;
  bottom: 24px;
  background: var(--bg-card-hover);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  transform: translateX(-50%);
  pointer-events: none;
  white-space: nowrap;
}

/* Speed control */
.speed-control {
  position: relative;
}

.speed-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  min-width: 32px;
  text-align: center;
  transition:
    background 150ms ease,
    color 150ms ease;
}

.speed-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
}

.speed-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 4px;
  /* Solid elevated surface — not --bg-card-hover (translucent rgba). */
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  min-width: 80px;
  z-index: 100;
}

.speed-option {
  display: block;
  width: 100%;
  padding: 4px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition:
    background 150ms ease,
    color 150ms ease;
}

.speed-option:hover {
  background: var(--bg-base);
  color: var(--text-primary);
}

.speed-option.active {
  color: var(--accent);
  font-weight: 600;
}

/* Volume control */
.volume-control {
  display: flex;
  align-items: center;
  gap: 4px;
}

.layout-control-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding-left: 8px;
  border-left: 1px solid var(--border-default);
}

.layout-btn.active,
#video-fullscreen-btn.active,
#still-fullscreen-btn.active {
  background: var(--bg-card-hover);
  color: var(--accent);
}

.volume-slider {
  width: 60px;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border-input);
  border-radius: 2px;
  outline: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  background: var(--text-secondary);
  border-radius: 50%;
  cursor: pointer;
}

/* Logs panel */
.layout-splitter {
  position: relative;
  background: var(--bg-surface);
  transition: background 0.15s ease;
  cursor: var(--layout-splitter-cursor);
  outline: none;
  z-index: 2;
}

.player-container[data-layout-mode="horizontal"] .layout-splitter {
  grid-column: 2;
  min-width: var(--layout-splitter-size);
  height: 100%;
  border-left: 1px solid var(--border-default);
  border-right: 1px solid var(--border-default);
}

.player-container[data-layout-mode="vertical"] .layout-splitter {
  grid-column: 1;
  grid-row: 2;
  width: 100%;
  min-height: var(--layout-splitter-size);
  border-top: 1px solid var(--border-default);
  border-bottom: 1px solid var(--border-default);
}

.layout-splitter::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  background: var(--text-dim);
  border-radius: 999px;
  opacity: 0.55;
}

.player-container[data-layout-mode="horizontal"] .layout-splitter::before {
  width: 3px;
  height: 64px;
}

.player-container[data-layout-mode="vertical"] .layout-splitter::before {
  width: 64px;
  height: 3px;
}

.layout-splitter:hover,
.layout-splitter:focus-visible,
.player-container.is-resizing .layout-splitter {
  background: var(--bg-card-hover);
}

.layout-splitter:hover::before,
.layout-splitter:focus-visible::before,
.player-container.is-resizing .layout-splitter::before {
  background: var(--accent);
  opacity: 1;
}

/* Logs panel */
.logs-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.player-container[data-layout-mode="horizontal"] .logs-panel {
  grid-column: 3;
}

.player-container[data-layout-mode="vertical"] .logs-panel {
  grid-column: 1;
  grid-row: 3;
}

.player-container.is-video-fullscreen .header,
.player-container.is-video-fullscreen .logs-panel,
.player-container.is-video-fullscreen .layout-splitter {
  display: none;
}

.player-container.is-video-fullscreen .main-layout {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.player-container.is-video-fullscreen .video-section {
  grid-column: 1;
  grid-row: 1;
  border: none;
}

/* Tab bar */
.tab-bar {
  display: flex;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

.tab-btn {
  flex: 1;
  padding: 8px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition:
    color 150ms ease,
    border-color 150ms ease,
    background 150ms ease;
}

.tab-btn:hover {
  color: var(--text-secondary);
}

.tab-btn.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

/* Viewer container */
.viewer-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Filter bar */
.filter-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 4px;
}

.filter-buttons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-left: auto;
}

.filter-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.search-input-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 180px;
  padding: 0 8px;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  background: var(--bg-base);
  color: var(--text-dim);
  transition:
    border-color 150ms ease,
    color 150ms ease;
}

.search-input-wrap:focus-within {
  border-color: var(--accent);
  color: var(--accent);
}

.search-input {
  width: 100%;
  min-width: 0;
  padding: 6px 0;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 12px;
  outline: none;
}

.search-input::placeholder {
  color: var(--text-dim);
}

.filter-btn {
  padding: 2px 8px;
  background: transparent;
  border: 1px solid var(--border-input);
  border-radius: 4px;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    color 150ms ease,
    background 150ms ease;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--text-secondary);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.network-summary {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Entries scroll */
.entries-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.entries-scroll::-webkit-scrollbar {
  width: 6px;
}

.entries-scroll::-webkit-scrollbar-track {
  background: var(--bg-base);
}

.entries-scroll::-webkit-scrollbar-thumb {
  background: var(--border-input);
  border-radius: 3px;
}

.entries-scroll::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Storage viewer */
.storage-content {
  padding: 12px;
  font-size: 12px;
}

.storage-group {
  margin-bottom: 20px;
}

.storage-group-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-base);
}

.storage-group-count {
  color: var(--text-dim);
  font-weight: 400;
}

.storage-group-rows {
  border: 1px solid var(--border-input);
  border-radius: 4px;
  overflow: hidden;
}

.storage-row {
  display: grid;
  grid-template-columns: 90px minmax(120px, 1fr) 2fr;
  gap: 8px;
  align-items: start;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-input);
}

.storage-row:last-child {
  border-bottom: none;
}

.storage-status-badge {
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  align-self: center;
}

.storage-status-added {
  color: var(--text-success, #2ea043);
}

.storage-status-removed {
  color: var(--text-error, #f85149);
}

.storage-status-changed {
  color: var(--text-warn, #d29922);
}

.storage-status-unchanged {
  color: var(--text-dim);
}

.storage-key {
  font-family: var(--font-mono, monospace);
  color: var(--text-base);
  word-break: break-all;
}

.storage-value-cell {
  font-family: var(--font-mono, monospace);
  color: var(--text-dim);
  word-break: break-all;
}

.storage-value-arrow {
  margin: 0 6px;
  color: var(--text-dim);
}

.storage-value-from {
  text-decoration: line-through;
  opacity: 0.7;
}

.storage-empty {
  padding: 10px;
  color: var(--text-dim);
  font-style: italic;
}

/* The vendored luna-json-editor defaults to `user-select: none` (it's built
   for click-to-edit interactions), but every mount in this player is a
   read-only viewer, so restore text selection for copying values. This must
   win over vendor/luna/luna-json-editor.css despite player.css loading first
   in player.html/index.html, hence the extra specificity instead of relying
   on source order. */
.luna-mount.luna-json-editor,
.luna-mount .luna-json-editor {
  user-select: text;
  -webkit-user-select: text;
}

/* Elements / DOM snapshot tree */

.elements-viewer {
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
}

.elements-toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.elements-toolbar-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.elements-search-wrap {
  display: flex;
  width: 100%;
  max-width: none;
  min-width: 0;
  box-sizing: border-box;
}

.elements-search-wrap .search-input {
  width: 100%;
  flex: 1;
  min-width: 0;
}

.elements-snapshot-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.elements-snapshot-select {
  padding: 5px 8px;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  color: var(--text-primary);
  background: var(--bg-input);
  font-size: 12px;
}

.elements-snapshot-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ghost);
}

.elements-tree {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 8px 10px;
  font-family: var(--font-mono, monospace);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-secondary);
  /* Override .entries-scroll overflow-x: hidden so deep/wide DOM lines can scroll. */
  overflow-x: auto;
  overflow-y: auto;
}

.elements-tree::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.elements-tree::-webkit-scrollbar-track {
  background: var(--bg-base);
}

.elements-tree::-webkit-scrollbar-thumb {
  background: var(--border-input);
  border-radius: 3px;
}

.elements-tree::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* Keep tag/attribute lines on one row so overflow produces a horizontal scrollbar. */
.elements-tree .dom-summary,
.elements-tree .dom-leaf,
.elements-tree .dom-close-tag {
  white-space: nowrap;
}

.dom-node {
  margin-left: 12px;
}

.dom-children {
  margin-left: 12px;
  border-left: 1px solid var(--border-subtle);
  padding-left: 6px;
}

.dom-summary {
  cursor: pointer;
  list-style: none;
}

.dom-summary::-webkit-details-marker {
  display: none;
}

.dom-summary::before {
  content: "▸";
  display: inline-block;
  width: 12px;
  color: var(--text-dim);
}

.dom-node[open] > .dom-summary::before {
  content: "▾";
}

.dom-leaf {
  margin-left: 12px;
  padding-left: 12px;
}

.dom-close-tag {
  margin-left: 0;
}

.dom-tag {
  color: var(--accent);
}

.dom-attr-name {
  color: var(--text-base);
}

.dom-attr-value {
  color: var(--success-soft, var(--text-secondary));
}

.dom-text-value {
  color: var(--text-secondary);
}

.dom-comment .dom-text-value {
  color: var(--text-dim);
  font-style: italic;
}

.dom-masked-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--bg-danger-soft, rgba(255, 99, 99, 0.18));
  color: var(--danger, #ff6363);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.dom-search-hit > .dom-summary,
.dom-leaf.dom-search-hit {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: 4px;
}

.dom-empty {
  padding: 10px;
  color: var(--text-dim);
  font-style: italic;
}

@media (max-width: 900px) {
  .main-layout {
    grid-template-columns: minmax(220px, calc(var(--player-split-percent) * 1%)) var(
        --layout-splitter-size
      ) minmax(220px, 1fr);
  }

  .filter-meta {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }

  .search-input-wrap {
    flex: 1;
    min-width: 0;
  }

  .layout-control-group {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
  }
}

/* Console entries */
.console-entry {
  display: flex;
  gap: 8px;
  padding: 4px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 12px;
  line-height: 1.5;
  align-items: flex-start;
  /* Isolate each row's layout/paint so expanding one entry (or repainting the
     active-entry highlight) doesn't force the browser to recheck siblings. */
  contain: content;
}

.console-entry .toggle-expand {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 0;
  margin: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  cursor: pointer;
}

.console-entry .toggle-expand i {
  display: flex;
  align-items: center;
  justify-content: center;
}

.console-entry .toggle-expand:hover {
  color: var(--text-secondary);
}

.console-entry:hover {
  background: var(--bg-surface);
}

.console-entry.active {
  background: var(--bg-card-hover);
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}

/* Row tint by level (JS sets console-entry + console-entry--{level}). */
.console-entry.console-entry--error,
.console-entry.error-entry {
  background: var(--bg-danger-soft, rgba(220, 38, 38, 0.08));
  border-left: 3px solid var(--danger, #ef4444);
  padding-left: 9px;
}

.console-entry.console-entry--warn {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid var(--warning, #f59e0b);
  padding-left: 9px;
}

.console-entry.console-entry--info,
.console-entry.browser-entry {
  background: rgba(79, 140, 255, 0.06);
  border-left: 3px solid var(--accent, #4f8cff);
  padding-left: 9px;
}

.console-entry.console-entry--debug {
  background: rgba(148, 163, 184, 0.06);
  border-left: 3px solid var(--text-muted, #94a3b8);
  padding-left: 9px;
}

.console-entry.browser-entry:hover,
.console-entry.console-entry--info:hover {
  background: rgba(79, 140, 255, 0.1);
}

.console-entry.error-entry:hover,
.console-entry.console-entry--error:hover {
  background: rgba(220, 38, 38, 0.12);
}

.console-entry.console-entry--warn:hover {
  background: rgba(245, 158, 11, 0.12);
}

.console-entry.expanded {
  background: var(--bg-surface);
  flex-wrap: wrap;
}

.console-entry.active-entry {
  background: var(--bg-card-hover);
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}

.console-source-location {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.console-time {
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Level badge — class names must match JS: console-level console-level-{level} */
.console-level {
  font-weight: 700;
  white-space: nowrap;
  min-width: 4.5rem;
  font-size: 10px;
  letter-spacing: 0.03em;
  line-height: 1.4;
  padding: 1px 6px;
  border-radius: 4px;
  text-align: center;
  flex-shrink: 0;
}

.console-level.console-level-log,
.console-level.log {
  color: var(--text-primary, #e2e8f0);
  background: rgba(148, 163, 184, 0.15);
}

.console-level.console-level-warn,
.console-level.warn {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.18);
}

.console-level.console-level-error,
.console-level.error {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.18);
}

.console-level.console-level-info,
.console-level.info {
  color: #93c5fd;
  background: rgba(79, 140, 255, 0.18);
}

.console-level.console-level-debug,
.console-level.debug {
  color: var(--text-muted, #94a3b8);
  background: rgba(148, 163, 184, 0.12);
}

.console-level.console-level-trace,
.console-level.trace {
  color: #a78bfa;
  background: rgba(139, 92, 246, 0.16);
}

.console-message {
  flex: 1;
  min-width: 0;
  word-break: break-all;
}

.console-entry.console-entry--error .console-message,
.console-entry.error-entry .console-message {
  color: #fecaca;
}

.console-entry.console-entry--warn .console-message {
  color: #fde68a;
}

.console-detail {
  width: 100%;
  padding: 8px 0;
  border-top: 1px solid var(--border-default);
  font-size: 11px;
  line-height: 1.6;
}

.console-detail .detail-section {
  margin-bottom: 8px;
}

.console-detail h4 {
  color: var(--accent);
  font-size: 11px;
  margin-bottom: 4px;
}

.console-detail pre {
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
  font-family: inherit;
}

.console-detail .message-pre {
  background: var(--bg-base);
  padding: 4px;
  border-radius: 4px;
}

.source-preview {
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  background: var(--bg-base);
}

.source-preview-location {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-default);
  color: var(--text-muted);
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 10px;
  overflow-wrap: anywhere;
}

.source-preview-code {
  overflow-x: auto;
  padding: 4px 0;
  font-family: "SF Mono", "Fira Code", monospace;
}

.source-preview-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  min-width: max-content;
  line-height: 1.5;
}

.source-preview-row.active {
  background: rgba(245, 158, 11, 0.08);
}

.source-preview-line {
  user-select: none;
  padding: 0 8px;
  border-right: 1px solid var(--border-default);
  color: var(--text-dim);
  text-align: right;
}

.source-preview code {
  display: block;
  padding: 0 8px;
  color: var(--text-primary);
  white-space: pre;
}

.source-preview-note {
  padding: 4px 8px 6px;
  color: var(--text-dim);
  font-size: 10px;
}

.console-detail .arg-row {
  display: flex;
  gap: 8px;
  padding: 2px 0;
}

.console-detail .arg-index {
  color: var(--text-dim);
  font-size: 10px;
}

.console-detail .arg-value {
  flex: 1;
  min-width: 0;
}

.console-detail .remote-object-stack {
  margin-top: 6px;
  padding-left: 12px;
}

.console-detail .stack-frame {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.5;
}

.console-detail .stack-frame .fn-name {
  color: var(--warning);
  font-weight: 650;
  -webkit-text-stroke: 0.25px color-mix(in srgb, currentColor 78%, var(--text-inverse));
  background: var(--bg-warning-soft);
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  padding: 0 2px;
}

.console-detail .stack-frame .location {
  color: var(--info);
  font-family: "SF Mono", "Fira Code", monospace;
  font-weight: 500;
  -webkit-text-stroke: 0.25px color-mix(in srgb, currentColor 78%, var(--text-inverse));
  background: color-mix(in srgb, var(--info) 16%, transparent);
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  padding: 0 2px;
}

.console-detail .async-boundary,
.console-detail .source-map-note {
  color: var(--text-muted);
  font-size: 10px;
}

.console-detail .async-boundary {
  font-style: italic;
}

.console-detail .console-stack-filter-toggle {
  margin-top: 6px;
  padding: 3px 8px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  color: var(--text-muted);
  background: transparent;
  font-size: 11px;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    color 150ms ease,
    background 150ms ease;
}

.console-detail .console-stack-filter-toggle.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-accent-soft);
}

.console-stack {
  padding-left: 12px;
  margin-top: 4px;
}

.console-stack .async-boundary {
  color: var(--text-muted);
  font-style: italic;
}

.console-stack .vendor-frame,
.console-stack .vendor-frame .fn-name,
.console-stack .vendor-frame .location {
  color: var(--text-muted);
  -webkit-text-stroke: 0;
  background: transparent;
}

.console-stack.hide-vendor-frames .vendor-frame {
  display: none;
}

/* Network entries */
.network-header {
  display: grid;
  grid-template-columns: 52px 1fr 48px 70px 65px;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-default);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  position: sticky;
  top: 0;
  z-index: 10;
}

.network-row {
  display: grid;
  grid-template-columns: 20px 52px 1fr 48px 70px 65px;
  gap: 8px;
  padding: 5px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  align-items: center;
  /* Isolate each row's layout/paint so expanding one entry (or repainting the
     active-row highlight) doesn't force the browser to recheck siblings. */
  contain: content;
}

.network-row .toggle-expand {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 0;
  margin: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
}

.network-row .toggle-expand i {
  display: flex;
  align-items: center;
  justify-content: center;
}

.network-row .toggle-expand:hover {
  color: var(--text-secondary);
}

.network-row:hover {
  background: var(--bg-surface);
}

.network-row.active {
  background: var(--bg-card-hover);
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}

.network-row.expanded {
  background: var(--bg-surface);
}

.col-method {
  font-weight: 600;
  color: var(--text-primary);
}

.col-url {
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  overflow: hidden;
}

.network-url-main,
.network-initiator-location {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.network-initiator-location {
  color: var(--text-dim);
  font-size: 10px;
  line-height: 1.2;
}

.col-status {
  font-weight: 600;
  text-align: center;
}

.col-status.success {
  color: var(--success);
}
.col-status.redirect {
  color: var(--warning);
}
.col-status.error {
  color: var(--danger);
}
.col-status.other {
  color: var(--text-muted);
}

.col-type {
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.col-size {
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.network-detail {
  grid-column: 1 / -1;
  padding: 10px 0;
  border-top: 1px solid var(--border-default);
  font-size: 11px;
  line-height: 1.6;
}

.network-detail .detail-section,
.ws-detail .detail-section {
  margin-bottom: 10px;
}

.network-detail h4 {
  color: var(--accent);
  font-size: 11px;
  margin-bottom: 4px;
}

.network-detail .detail-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.network-detail .detail-section-heading h4 {
  margin-bottom: 0;
}

.network-detail pre {
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
  font-family: inherit;
  background: var(--bg-base);
  padding: 8px;
  border-radius: 4px;
  max-height: 300px;
  overflow-y: auto;
}

.network-detail .response-body.binary {
  color: var(--text-dim);
  font-style: italic;
}

.network-detail .network-detail-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.network-detail .network-detail-tab {
  border: 1px solid var(--border-default);
  background: var(--bg-base);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 11px;
  line-height: 1.2;
  cursor: pointer;
  transition:
    background 120ms ease,
    color 120ms ease,
    border-color 120ms ease;
}

.network-detail .network-detail-tab:hover {
  color: var(--text-secondary);
  border-color: var(--accent);
}

.network-detail .network-detail-tab.active {
  background: var(--bg-accent-soft);
  color: var(--accent);
  border-color: var(--accent-subtle);
}

.network-detail .network-detail-panel.hidden {
  display: none;
}

.network-detail .network-detail-panel.active {
  display: block;
}

.network-detail .network-detail-panel > .detail-section:last-child {
  margin-bottom: 0;
}

.network-detail .response-code-block {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "SF Mono", "Fira Code", monospace;
  line-height: 1.55;
}

.network-detail .json-preview-toggle {
  border: 1px solid var(--accent-subtle);
  background: var(--bg-accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 11px;
  line-height: 1.2;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    color 150ms ease;
}

.network-detail .json-preview-toggle:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.network-detail .json-preview-body {
  margin-top: 6px;
  border: 1px solid var(--accent-subtle);
}

.network-detail .response-preview-card {
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  overflow: hidden;
}

.network-detail .response-preview-frame {
  width: 100%;
  min-height: 320px;
  border: none;
  background: #fff;
}

.network-detail .response-preview-media {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.network-detail .response-preview-image,
.network-detail .response-preview-video {
  max-width: 100%;
  max-height: 420px;
  border-radius: 4px;
  background: #000;
}

.network-detail .response-preview-audio {
  width: 100%;
}

.network-detail .json-preview-summary {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--border-default);
}

.network-detail .json-preview-item {
  display: grid;
  gap: 3px;
}

.network-detail .json-preview-key {
  color: var(--accent);
  font-weight: 600;
}

.network-detail .json-preview-value {
  color: var(--text-muted);
  word-break: break-word;
}

.network-detail .token-comment {
  color: var(--text-dim);
  font-style: italic;
}

.network-detail .token-keyword,
.network-detail .token-boolean {
  color: var(--accent);
}

.network-detail .token-string {
  color: var(--info-soft);
}

.network-detail .token-number {
  color: var(--accent);
}

.network-detail .token-key,
.network-detail .token-attr {
  color: var(--accent);
}

.network-detail .token-null,
.network-detail .token-operator {
  color: var(--warning);
}

.network-detail .token-tag,
.network-detail .token-selector {
  color: var(--success);
}

.network-detail .timing-info {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.network-detail .timing-item {
  color: var(--text-muted);
  font-size: 11px;
}

.network-detail .redirect-chain {
  padding: 4px 8px;
  background: var(--bg-base);
  border-radius: 4px;
}

.network-detail .redirect-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
}

.network-detail .redirect-entry .redirect-status {
  font-weight: 600;
  font-size: 11px;
}

.network-detail .redirect-entry.final .redirect-status {
  color: var(--success);
}

.network-detail .redirect-url {
  color: var(--text-muted);
  word-break: break-all;
}

.network-detail .initiator-location,
.ws-detail .initiator-location {
  color: var(--accent);
  margin-top: 4px;
}

.network-detail .initiator-filter-toggle {
  margin-top: 6px;
  padding: 3px 8px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
  color: var(--text-muted);
  background: transparent;
  font-size: 11px;
  cursor: pointer;
  transition:
    border-color 150ms ease,
    color 150ms ease,
    background 150ms ease;
}

.network-detail .initiator-filter-toggle.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg-accent-soft);
}

.network-detail .initiator-stack,
.ws-detail .initiator-stack {
  padding-left: 12px;
  margin-top: 4px;
}

.network-detail .initiator-stack.hide-vendor-frames .vendor-frame {
  display: none;
}

.network-detail .stack-frame,
.ws-detail .stack-frame {
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.5;
}

.network-detail .stack-frame .fn-name,
.ws-detail .stack-frame .fn-name {
  color: var(--warning);
  font-weight: 650;
  -webkit-text-stroke: 0.25px color-mix(in srgb, currentColor 78%, var(--text-inverse));
  background: var(--bg-warning-soft);
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  padding: 0 2px;
}

.network-detail .stack-frame .location,
.ws-detail .stack-frame .location {
  color: var(--info);
  font-family: "SF Mono", "Fira Code", monospace;
  font-weight: 500;
  -webkit-text-stroke: 0.25px color-mix(in srgb, currentColor 78%, var(--text-inverse));
  background: color-mix(in srgb, var(--info) 16%, transparent);
  border-radius: 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  padding: 0 2px;
}

.network-detail .stack-frame.vendor-frame,
.ws-detail .stack-frame.vendor-frame {
  color: var(--text-muted);
}

.network-detail .stack-frame.vendor-frame .fn-name,
.network-detail .stack-frame.vendor-frame .location,
.ws-detail .stack-frame.vendor-frame .fn-name,
.ws-detail .stack-frame.vendor-frame .location {
  color: var(--text-muted);
  -webkit-text-stroke: 0;
  background: transparent;
}

.network-detail .async-boundary,
.ws-detail .async-boundary {
  color: var(--text-muted);
  font-style: italic;
}

.network-detail .error-text {
  color: var(--danger);
}

.network-detail .copy-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.copy-btn {
  padding: 4px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition:
    background 150ms ease,
    border-color 150ms ease,
    color 150ms ease;
}

.copy-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--accent);
}

/* WebSocket section */
.websocket-section {
  border-top: 1px solid var(--border-default);
}

.websocket-section h3 {
  padding: 8px 12px;
  background: var(--bg-surface);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}

.ws-row {
  display: grid;
  grid-template-columns: 20px 1fr 80px 60px;
  gap: 8px;
  padding: 5px 12px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  align-items: center;
  /* Isolate each row's layout/paint so expanding one entry doesn't force the
     browser to recheck siblings. */
  contain: content;
}

.ws-row .toggle-expand {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 10px;
  padding: 0;
  margin: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.ws-row .toggle-expand:hover {
  color: var(--text-secondary);
}

.ws-row:hover {
  background: var(--bg-surface);
}

.ws-url {
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-frames {
  text-align: center;
  color: var(--text-muted);
}

.ws-status {
  font-weight: 600;
  text-align: right;
  font-size: 11px;
}

.ws-status.open {
  color: var(--success);
}
.ws-status.closed {
  color: var(--text-muted);
}

.ws-detail {
  grid-column: 1 / -1;
  padding: 10px 0;
  border-top: 1px solid var(--border-default);
}

.ws-detail h4 {
  color: var(--accent);
  font-size: 11px;
  margin-bottom: 4px;
}

.ws-frames-table {
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  overflow: hidden;
}

.ws-frame-row {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.ws-frame-row:last-child {
  border-bottom: none;
}

.ws-direction {
  font-weight: 600;
}

.ws-direction.sent {
  color: var(--success);
}
.ws-direction.received {
  color: var(--accent);
}

.ws-payload {
  color: var(--text-muted);
  font-size: 11px;
  word-break: break-all;
}

/* Buttons */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 150ms ease,
    transform 80ms ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-retry {
  background: var(--accent);
  color: #fff;
}

.btn-retry:hover {
  background: var(--accent-hover);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
    transition-duration: 0.01ms;
  }
}

/* Small screens: force a vertical, full-height scrolling layout.
   The whole page scrolls instead of each panel scrolling inside a fixed 100vh
   frame. The video section is capped at the viewport height; the remaining
   panel grows to its full natural height with no limit. */
@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .player-container {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  /* Drop the resizable grid and stack as a normal flow column regardless of the
     stored layout mode (the layout is locked to vertical here). */
  .main-layout,
  .player-container[data-layout-mode="horizontal"] .main-layout,
  .player-container[data-layout-mode="vertical"] .main-layout {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    grid-template-rows: none;
    overflow: visible;
  }

  /* Video section: capped at the viewport height, sized to content otherwise. */
  .player-container[data-layout-mode="horizontal"] .video-section,
  .player-container[data-layout-mode="vertical"] .video-section {
    grid-column: auto;
    grid-row: auto;
    flex: 0 0 auto;
    max-height: 100vh;
    border-right: none;
    border-bottom: 1px solid var(--border-default);
  }

  /* Logs panel: full natural height, no internal scroll cap — the page scrolls. */
  .player-container[data-layout-mode="horizontal"] .logs-panel,
  .player-container[data-layout-mode="vertical"] .logs-panel {
    grid-column: auto;
    grid-row: auto;
    flex: 1 0 auto;
    min-height: 0;
    overflow: visible;
  }

  .logs-panel .viewer-container {
    flex: 1 0 auto;
    min-height: 0;
    overflow: visible;
  }

  .logs-panel .entries-scroll {
    flex: 0 1 auto;
    overflow: visible;
  }

  /* The resize splitter and layout toggle are meaningless when locked vertical. */
  .layout-splitter,
  .layout-control-group,
  .still-layout-sep {
    display: none;
  }

  /* Still media: give the image a readable height when stacked on small screens. */
  body.presentation-still-media .still-viewport,
  #player-state.presentation-still-media .still-viewport {
    min-height: min(52vh, 420px);
    max-height: 70vh;
  }

  body.presentation-still-media .video-section,
  #player-state.presentation-still-media .video-section {
    flex: 0 0 auto;
    max-height: none;
  }
}

/*
 * No-video presentation. Placed last so it wins over the `.video-container` /
 * `.video-controls` rules above without relying on specificity ordering.
 */
body.no-video .video-container,
body.no-video .video-controls {
  display: none;
}

/*
 * Empty-evidence: no media column. Still-primary packages keep the record-like
 * two-column shell (video-section hosts #still-stage).
 */
body.presentation-empty .main-layout,
#player-state.presentation-empty .main-layout,
.player-container[data-layout-mode="horizontal"].presentation-empty .main-layout,
.player-container[data-layout-mode="vertical"].presentation-empty .main-layout {
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows: minmax(0, 1fr) !important;
}

body.presentation-empty .video-section,
#player-state.presentation-empty .video-section {
  display: none !important;
}

body.presentation-empty .layout-splitter,
#player-state.presentation-empty .layout-splitter {
  display: none !important;
}

body.presentation-empty .logs-panel,
#player-state.presentation-empty .logs-panel,
.player-container[data-layout-mode="horizontal"].presentation-empty .logs-panel,
.player-container[data-layout-mode="vertical"].presentation-empty .logs-panel {
  grid-column: 1 / -1 !important;
  grid-row: 1 / -1 !important;
  width: 100%;
  max-width: none;
  min-width: 0;
  flex: 1 1 auto;
}

/* Still-primary media: hide raw video chrome; show still stage. */
body.presentation-still-media .video-container,
body.presentation-still-media .video-controls,
#player-state.presentation-still-media .video-container,
#player-state.presentation-still-media .video-controls {
  display: none !important;
}

body.presentation-still-media .still-stage,
#player-state.presentation-still-media .still-stage {
  /* Override .hidden { display: none !important } when still-primary. */
  display: flex !important;
}

body.presentation-still-media .dom-stage:not(.hidden),
#player-state.presentation-still-media .dom-stage:not(.hidden) {
  display: none !important;
}

body.presentation-screenshot .tab-bar.hidden,
#player-state.presentation-screenshot .tab-bar.hidden {
  display: none !important;
}

/* ===== Still stage (annotated image in media column) =====
 * Shares the same main-layout grid as recording: columns when
 * data-layout-mode=horizontal, rows when vertical; small screens force stack
 * via the max-width:720px rules above.
 */
.still-stage {
  display: none;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  background: var(--bg-base, #0f1115);
}

/* Fill the media cell in both split orientations. */
.player-container[data-layout-mode="horizontal"] .still-stage,
.player-container[data-layout-mode="vertical"] .still-stage {
  min-height: 0;
}

.player-container[data-layout-mode="vertical"] .still-viewport {
  min-height: 200px;
}

.still-viewport {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  cursor: grab;
  background:
    repeating-conic-gradient(var(--bg-surface, #1a1d24) 0% 25%, var(--bg-base, #0f1115) 0% 50%) 50%
    / 16px 16px;
}

.still-viewport.is-panning {
  cursor: grabbing;
}

.still-transform {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-origin: center center;
  will-change: transform;
}

/*
 * Aspect box matching shot.viewport (set in JS). Image uses contain (letterbox
 * if needed); overlay is inset:0 on the same figure so annotation 0..1 coords
 * stay aligned with the image box (same geometry idea as Screenshots tab).
 */
.still-figure {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  width: min(100%, calc(100% * var(--still-aspect, 1.6)));
  height: auto;
  aspect-ratio: var(--still-aspect, 16 / 10);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  flex: 0 1 auto;
  background: var(--bg-base, #0f1115);
}

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

.still-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.still-overlay svg {
  width: 100%;
  height: 100%;
  display: block;
}

.still-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08));
  background: var(--bg-surface, #161a22);
  flex: 0 0 auto;
}

.still-layout-control-group {
  margin-left: auto;
}

.still-toolbar .layout-btn.active {
  color: var(--accent, #6ea8fe);
}

.still-zoom-label,
.still-shot-label {
  min-width: 3.25rem;
  text-align: center;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary, #9aa3b2);
}

.still-toolbar-sep {
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: var(--border-subtle, rgba(255, 255, 255, 0.12));
}

.still-caption-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 16px;
  padding: 8px 12px 10px;
  border-top: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.06));
  background: var(--bg-surface, #161a22);
}

.still-caption-row.hidden {
  display: none;
}

.still-caption {
  margin: 0;
  font-size: 13px;
  color: var(--text-primary, #e8ecf1);
  flex: 1 1 auto;
  min-width: 0;
}

.still-caption.is-placeholder {
  color: var(--text-secondary, #9aa3b2);
  font-style: italic;
}

.still-url {
  font-size: 12px;
  color: var(--accent, #6ea8fe);
  text-decoration: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.still-url:hover {
  text-decoration: underline;
}

body.presentation-screenshot .screenshot-figure,
#player-state.presentation-screenshot .screenshot-figure {
  max-width: 100%;
  max-height: min(78vh, 900px);
  width: auto;
  margin-inline: auto;
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

body.presentation-screenshot .screenshot-image,
#player-state.presentation-screenshot .screenshot-image {
  width: 100%;
  height: 100%;
  object-fit: fill;
  background: var(--bg-elevated, #0f1115);
}

/* ===== Screenshots tab / stage ===== */
.screenshots-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.screenshot-stage {
  display: flex;
  flex-direction: column;
  gap: 18px;
  width: 100%;
}

.screenshot-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.screenshot-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.screenshot-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.screenshot-nav-btn:not(:disabled):hover {
  border-color: var(--border-strong, var(--border-subtle));
  background: var(--bg-elevated, var(--bg-card));
}

.screenshot-nav-label {
  min-width: 4.5rem;
  color: var(--text-secondary);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.screenshot-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  background: var(--bg-card);
}

.screenshot-report-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.screenshot-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.screenshot-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent, #5b8cff) 18%, transparent);
  color: var(--accent, #8eb0ff);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.screenshot-caption {
  margin: 0;
  color: var(--text-primary);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
}

.screenshot-caption.is-placeholder {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 500;
  font-style: italic;
}

.screenshot-page-title {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.screenshot-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.screenshot-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: var(--bg-elevated, var(--bg-base));
  color: var(--text-secondary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.screenshot-url-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
}

.screenshot-url-link {
  min-width: 0;
  flex: 1 1 12rem;
  color: var(--text-secondary);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-decoration: none;
}

.screenshot-url-link:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

.screenshot-url-action {
  flex: 0 0 auto;
  padding: 4px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}

.screenshot-url-action:hover {
  color: var(--text-primary);
  border-color: var(--border-strong, var(--border-subtle));
  background: var(--bg-elevated, transparent);
}

/*
 * The overlay is positioned against the figure, not the image, so annotations
 * stay aligned when the image is letterboxed by `object-fit` at a viewport
 * ratio that does not match the container.
 */
.screenshot-figure {
  position: relative;
  width: 100%;
  height: auto;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-base);
}

.screenshot-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.screenshot-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.screenshot-overlay svg {
  width: 100%;
  height: 100%;
}

.screenshot-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 160px;
  padding: 24px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.screenshot-meta {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.screenshot-annotations-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
}

.screenshot-annotations-heading,
.screenshot-section-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
}

.screenshot-annotation-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 12px;
}

.screenshot-annotation-list li.is-redaction {
  color: var(--danger);
}

.screenshot-empty-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.instant-replay-card {
  margin-top: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent, #5b8cff);
  border-radius: 10px;
  background: var(--bg-card);
}

/* ---------- Instant Replay DOM stage (structural lookback) ---------- */
.dom-stage {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  background: var(--bg-base, #0f1115);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  overflow: hidden;
}

.dom-stage.hidden {
  display: none;
}

.dom-stage-frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 200px;
  border: 0;
  background: #fff;
}

.dom-stage-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

.dom-stage-scrubber {
  flex: 1 1 auto;
  min-width: 80px;
  height: 18px;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  background: transparent;
  box-shadow: none;
  accent-color: var(--accent, #4f8cff);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.dom-stage-scrubber::-webkit-slider-runnable-track {
  height: 6px;
  border: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border-default) 88%, transparent);
}

.dom-stage-scrubber::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -4px;
  border: none;
  border-radius: 50%;
  background: var(--accent, #4f8cff);
  cursor: pointer;
}

.dom-stage-scrubber::-moz-range-track {
  height: 6px;
  border: none;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border-default) 88%, transparent);
}

.dom-stage-scrubber::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: none;
  border-radius: 50%;
  background: var(--accent, #4f8cff);
  cursor: pointer;
}

.dom-stage-time {
  flex: 0 0 auto;
  min-width: 3.5em;
  color: var(--text-secondary);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.dom-stage-url {
  flex: 0 1 28%;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dom-stage-hint {
  margin: 0;
  padding: 4px 10px 8px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.35;
}

.video-section.is-dom-stage .video-container,
.video-section.is-dom-stage .video-controls {
  display: none;
}

.instant-replay-open-btn {
  margin-top: 8px;
}

.empty-evidence-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40vh;
  padding: 32px 24px;
  text-align: center;
}

.empty-evidence-panel.hidden {
  display: none;
}

.empty-evidence-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
}

.empty-evidence-hint {
  margin: 0;
  max-width: 36rem;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
}

/* Integrations (GitHub / Jira issues + AI) inside the report popover. */
.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.integrations-status {
  margin-top: 10px;
  font-size: 12px;
  color: var(--text-muted);
  word-break: break-all;
}

.integrations-status.is-error {
  color: var(--danger);
}

.integrations-status.is-success {
  color: var(--success, #4caf50);
}

.integrations-status a {
  color: var(--accent);
}

.ai-result {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm, 8px);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  max-height: 280px;
  overflow-y: auto;
}

/* Credentials dialog — Jira + AI BYOK stored in localStorage only. */
.integrations-dialog {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--overlay-scrim, rgba(0, 0, 0, 0.55));
}

.integrations-dialog.hidden {
  display: none;
}

.integrations-dialog-panel {
  width: min(430px, 94vw);
  max-height: 86vh;
  overflow-y: auto;
  padding: 18px;
  border: 1px solid var(--border-default);
  border-radius: 12px;
  background: var(--bg-card);
  box-shadow: var(--shadow-lg, 0 12px 40px rgba(0, 0, 0, 0.4));
}

.integrations-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.integrations-dialog-header h3 {
  margin: 0;
  font-size: 15px;
  color: var(--text-primary);
}

.integrations-section h4 {
  margin: 12px 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.integrations-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.integrations-field input,
.integrations-field select {
  padding: 7px 9px;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  background: var(--bg-input, var(--bg-card));
  color: var(--text-primary);
  font: inherit;
}

.integrations-field input:focus,
.integrations-field select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ghost);
}

.integrations-hint {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
}

.integrations-dialog-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.integrations-save-status {
  font-size: 12px;
  color: var(--success, #4caf50);
}

/* Comments thread inside the report popover. */
.report-comments {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.comments-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  margin-bottom: 10px;
}

.comments-empty {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
}

.comment-row {
  padding: 8px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--bg-card);
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 11px;
}

.comment-author {
  font-weight: 600;
  color: var(--text-primary);
}

.comment-when {
  color: var(--text-muted);
}

.comment-pin {
  margin-left: auto;
  padding: 1px 7px;
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  font-size: 11px;
  cursor: pointer;
}

.comment-pin:hover {
  border-color: var(--accent);
}

.comment-body {
  margin: 0;
  font-size: 13px;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.comments-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comments-input {
  padding: 7px 9px;
  border: 1px solid var(--border-input);
  border-radius: 6px;
  background: var(--bg-input, var(--bg-card));
  color: var(--text-primary);
  font: inherit;
  font-size: 12px;
  resize: vertical;
}

.comments-input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-ghost);
}

.comments-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.comments-pin {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Video frame annotation dialog (blur rectangles → PNG). */
.annotate-dialog {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--overlay-scrim, rgba(0, 0, 0, 0.55));
}

.annotate-dialog.hidden {
  display: none;
}

.annotate-dialog-panel {
  width: min(900px, 96vw);
  max-height: 90vh;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--border-default);
  border-radius: 12px;
  background: var(--bg-card);
}

.annotate-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.annotate-dialog-header h3 {
  margin: 0;
  font-size: 15px;
  color: var(--text-primary);
}

.annotate-hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.annotate-canvas {
  display: block;
  width: 100%;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
}

.annotate-dialog-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.annotated-frame-card {
  margin-top: 16px;
}

.annotated-frame-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
}

.annotated-frame-caption {
  font-size: 13px;
  color: var(--text-secondary);
}

.annotated-frame-image {
  display: block;
  width: 100%;
}
