/* Replay is read-only: the session shows only what the recording drives. View-only input stays live (drag / wheel to
   pan and zoom the board, zoom buttons, PDF download, tool-call history, transcript, materials, volume); board objects
   that take answers are inert, so a press on them pans the board instead. Anything still sent is swallowed by guard.js.
   Class names: interactive-tutor-py/frontend components/AgentTutorSession.tsx, EndLessonControl.tsx. */
.agent-board :is(a, input, textarea, select, iframe, [data-board-interactive], [data-board-interactive] *) {
  pointer-events: none !important;
}
/* Controls the student used live, and the session's own pause / voice speed (the replay bar owns the clock); hidden so
   the replay does not look like it takes input. */
.agent-session-bottom .chat-control,
.agent-composer,
.mic-control,
.end-lesson,
.left-controls button[aria-label$=" lesson"],
.speed-control,
.speed-control + .session-toolbar-divider {
  display: none !important;
}

/* Light chrome matching the tutor UI. !important: the tutor's generic button reset carries an id inside :not(). */
:root {
  --replay-side-width: 380px;
  --replay-bar-height: 64px;
  --replay-line: #e5e7eb;
  --replay-muted: #6b7280;
  --replay-text: #111827;
  --replay-accent: #2563eb;
}

/* Below the session, on <html> like the sidebar: <body> stops above it, so the bar covers none of the session. */
.replay-bar {
  position: fixed;
  left: var(--replay-side-width);
  right: 0;
  bottom: 0;
  z-index: 10000;
  height: var(--replay-bar-height);
  box-sizing: border-box;
  padding: 8px 16px;
  border-top: 1px solid var(--replay-line);
  background: #fff;
  color: var(--replay-text);
  font: 13px/1.4 system-ui, -apple-system, sans-serif;
}
.replay-controls { display: flex; gap: 10px; align-items: center; }
.replay-controls button, .replay-controls select {
  font: inherit !important;
  padding: 3px 10px !important;
  border-radius: 6px !important;
  border: 1px solid var(--replay-line) !important;
  background: #fff !important;
  color: var(--replay-text) !important;
}
.replay-bar .replay-play { min-width: 56px; background: var(--replay-accent) !important; border-color: var(--replay-accent) !important; color: #fff !important; cursor: pointer; }
.replay-play:disabled { opacity: 0.4; cursor: default; }
.replay-track { position: relative; flex: 1; height: 22px; }
.replay-range { width: 100%; margin: 0; height: 22px; accent-color: var(--replay-accent); }
.replay-markers { position: absolute; inset: 0; pointer-events: none; }
.replay-marker {
  position: absolute;
  top: 4px;
  width: 3px !important;
  height: 14px;
  padding: 0 !important;
  margin-left: -1px;
  background: #93c5fd !important;
  border-radius: 1px !important;
  pointer-events: auto;
  cursor: pointer;
}
.replay-time { font-family: ui-monospace, monospace; font-size: 12px; color: var(--replay-muted); white-space: nowrap; }
.replay-note { margin-top: 4px; min-height: 1.4em; color: var(--replay-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Sidebar: <body> is shifted right and made the containing block of the app's fixed layers (transform), so
   the app keeps its own layout in the remaining width; the sidebar lives on <html> outside it. */
body {
  margin-left: var(--replay-side-width) !important;
  width: calc(100vw - var(--replay-side-width));
  height: calc(100vh - var(--replay-bar-height));
  transform: translateZ(0);
}
.replay-resizing, .replay-resizing * { cursor: col-resize !important; user-select: none !important; }
.replay-side {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10001;
  width: var(--replay-side-width);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  background: #fff;
  color: var(--replay-text);
  font: 13px/1.5 system-ui, -apple-system, sans-serif;
  border-right: 1px solid var(--replay-line);
}
.replay-resize { position: absolute; top: 0; right: -4px; bottom: 0; width: 8px; cursor: col-resize; z-index: 1; }
.replay-resize:hover, .replay-resizing .replay-resize { background: linear-gradient(90deg, transparent 3px, var(--replay-accent) 3px, var(--replay-accent) 5px, transparent 5px); }
.replay-side-head { padding: 14px 14px 0; border-bottom: 1px solid var(--replay-line); }
.replay-side-head strong { font-size: 14px; }
.replay-side button, .replay-side select, .replay-side input {
  font: inherit !important;
  font-weight: 500 !important;
  padding: 4px 8px !important;
  border-radius: 6px !important;
  border: 1px solid var(--replay-line) !important;
  background: #fff !important;
  color: var(--replay-text) !important;
}
.replay-picker { display: flex; gap: 6px; margin-top: 10px; }
.replay-picker select { flex: none; }
.replay-picker input { flex: 1; min-width: 0; font-family: ui-monospace, monospace !important; font-size: 12px !important; }
.replay-side .replay-picker button[type="submit"] { background: var(--replay-accent) !important; border-color: var(--replay-accent) !important; color: #fff !important; }
.replay-status { margin-top: 6px; min-height: 1em; color: var(--replay-muted); font-size: 12px; }
.replay-status:empty { margin-top: 0; min-height: 0; }
.replay-speech { margin-top: 6px; color: var(--replay-muted); font-size: 12px; }
.replay-speech:empty { display: none; }
.replay-tabs { display: flex; gap: 16px; margin-top: 10px; }
.replay-side .replay-tabs button {
  padding: 6px 0 !important;
  border: 0 !important;
  border-bottom: 2px solid transparent !important;
  border-radius: 0 !important;
  background: none !important;
  color: var(--replay-muted) !important;
  transition: none !important;
}
.replay-side .replay-tabs button[aria-selected="true"] { color: var(--replay-text) !important; border-bottom-color: var(--replay-accent) !important; }
.replay-panel { flex: 1; overflow: auto; margin: 0; padding: 10px 14px 16px; }
.replay-panel[hidden] { display: none; }
.replay-stat { padding: 10px 0; border-bottom: 1px solid var(--replay-line); }
.replay-stat-label { color: var(--replay-muted); font-size: 12px; }
.replay-stat-value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.replay-stat-sub { color: var(--replay-muted); font-size: 12px; }
.replay-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.replay-side .replay-chip { padding: 1px 6px !important; font-family: ui-monospace, monospace !important; font-size: 11.5px !important; cursor: pointer; }
.replay-side .replay-chip.is-warn { color: #b45309 !important; border-color: #fcd34d !important; }
.replay-model { display: grid; grid-template-columns: minmax(0, 1fr) 70px auto; gap: 8px; align-items: center; margin-top: 6px; font-size: 12px; }
.replay-model-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.replay-model-bar { height: 6px; border-radius: 3px; background: #f3f4f6; overflow: hidden; }
.replay-model-bar i { display: block; height: 100%; background: var(--replay-accent); }
.replay-model-value { color: var(--replay-muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.replay-gap-list { padding-left: 30px; color: #b91c1c; }
.replay-gap-list li { margin: 6px 0; }

.replay-timeline { list-style: none; padding-left: 18px; position: relative; }
.replay-timeline::before { content: ""; position: absolute; left: 22px; top: 14px; bottom: 14px; width: 1px; background: var(--replay-line); }
.replay-node { position: relative; }
.replay-node::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 13px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #60a5fa;
  box-shadow: 0 0 0 3px #fff;
}
.replay-node.kind-system::before, .replay-node.kind-session::before, .replay-node.kind-materials::before { background: #9ca3af; }
.replay-node.kind-checkpoint::before { background: #10b981; }
.replay-node.kind-control::before { background: #8b5cf6; }
.replay-node.is-compacted::before { background: #f59e0b; }
.replay-node.has-error::before { background: #ef4444; }
.replay-node > details { margin-left: 16px; padding: 6px 8px; border-radius: 8px; }
.replay-node > details:hover { background: #f9fafb; }
.replay-node.is-current > details { background: #eff6ff; }
.replay-node summary {
  cursor: pointer;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 0 8px;
  align-items: baseline;
  list-style: none;
}
.replay-node summary::-webkit-details-marker { display: none; }
.replay-node-time { font-family: ui-monospace, monospace; font-size: 11.5px; color: var(--replay-muted); }
.replay-node-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.replay-node.has-error .replay-node-title { color: #b91c1c; }
.replay-node-detail { grid-column: 2 / -1; color: var(--replay-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.replay-node-detail:empty { display: none; }
.replay-side .replay-jump {
  padding: 0 6px !important;
  border: 0 !important;
  background: none !important;
  color: var(--replay-accent) !important;
  font-size: 12px !important;
  opacity: 0;
}
.replay-node summary:hover .replay-jump, .replay-node.is-current .replay-jump, .replay-node details[open] .replay-jump { opacity: 1; }
.replay-node-body { margin: 6px 0 2px 50px; font-size: 12px; }
.replay-kv { display: grid; grid-template-columns: 56px 1fr; gap: 8px; }
.replay-kv > span:first-child { color: var(--replay-muted); }
.replay-heading { margin: 8px 0 2px; color: var(--replay-muted); }
.replay-errors { margin: 6px 0; padding-left: 16px; color: #b91c1c; }
.replay-context { margin: 6px 0; padding-left: 16px; color: #92400e; }
.replay-calls { width: 100%; border-collapse: collapse; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.replay-calls th { text-align: left; font-weight: 500; color: var(--replay-muted); border-bottom: 1px solid var(--replay-line); }
.replay-calls th, .replay-calls td { padding: 3px 8px 3px 0; vertical-align: top; }
.replay-call td { font-family: ui-monospace, monospace; color: #374151; white-space: nowrap; cursor: pointer; }
.replay-call td:nth-child(2) { white-space: normal; word-break: break-all; }
.replay-call:hover td { background: #f3f4f6; }
.replay-call.not-completed td { color: #b45309; }
.replay-call-detail > td { padding: 0 0 4px; }
.replay-raw summary { display: block; cursor: pointer; font-family: ui-monospace, monospace; font-size: 11.5px; }
.replay-call-detail pre {
  max-height: 40vh;
  overflow: auto;
  margin: 4px 0;
  padding: 6px 8px;
  white-space: pre-wrap;
  word-break: break-all;
  background: #f3f4f6;
  border-radius: 6px;
  font-size: 11px;
}
.replay-raw { margin-top: 8px; }
.replay-raw summary { color: var(--replay-muted); }
.replay-raw ol { margin: 4px 0; padding-left: 18px; color: var(--replay-muted); font-family: ui-monospace, monospace; font-size: 11px; }
/* Topic state belongs to the playhead; the directory never sends classroom operations. */
.replay-mode { padding: 6px 0; font-weight: 600; }
.replay-topics { padding: 12px; }
.replay-topics p { color: #64748b; font-size: 12px; margin: 8px 0; }
.replay-topic-item { padding: 10px; border-left: 3px solid transparent; margin: 4px 0; border-radius: 4px; }
.replay-topic-item[aria-current="true"] { border-color: #2563eb; background: #eff6ff; }
.replay-topic-item small { display: block; color: #64748b; margin-top: 4px; }
