/* Kirat replay of recorded runs: the main page (#replay and the
   recordings in #receipts) and the audience pages (/for/*).
   Needs the colour tokens of assets/site.css or assets/segments.css. */

  /* ---------------- Transcript (result of a run) ---------------- */
  .transcript { border: 1px solid var(--deep-line); }
  .tr-head { padding: 16px 20px; border-bottom: 1px solid var(--deep-line); }
  .tr-q { font-family: 'Archivo', sans-serif; font-weight: 600; font-size: 17px; }
  .tr-meta { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--deep-muted); margin-top: 7px; letter-spacing: 0.04em; }
  .vote { display: grid; grid-template-columns: 140px 1fr; gap: 20px; padding: 19px 22px; border-bottom: 1px solid var(--deep-line); }
  .vote:last-child { border-bottom: 0; }
  .vote-who { font-family: 'IBM Plex Mono', monospace; font-size: 12px; }
  .vote-who b { display: block; color: var(--deep-ink); font-weight: 600; }
  .vote-who span { color: var(--deep-muted); }
  .vote-body { font-size: 15px; line-height: 1.6; color: #B7C7CC; }
  .vote-pos { display: block; color: var(--deep-ink); font-weight: 500; margin-bottom: 5px; }
  .dissent { border-left: 2px solid var(--red); }
  .dissent .vote-pos { color: #F0846A; }
  .chip {
    display: inline-block; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px;
    letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 7px;
    border: 1px solid currentColor; margin-top: 6px;
  }
  .vote-body .chip { display: table; margin-top: 10px; }
  @media (max-width: 620px) { .vote { grid-template-columns: 1fr; gap: 8px; } }
  .tr-votes { display: flex; flex-wrap: wrap; gap: 8px 26px; padding: 14px 20px; border-bottom: 1px solid var(--deep-line); font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; color: var(--deep-muted); }
  .tr-votes b { color: var(--deep-ink); font-weight: 600; margin-right: 6px; }
  .receipts-foot { margin-top: 26px; font-size: 14.5px; color: var(--deep-muted); font-style: italic; }
  @media (max-width: 620px) {
    .transcript .tr-head, .tr-votes { padding-inline: 16px; }
    .vote { padding: 16px; }
  }

  /* ---------------- REPLAY (dark band, assets/replay.js) ---------------- */
  .rp-picks { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 30px; }
  .rp-picks[hidden] { display: none; }
  .rp-pick {
    text-align: left; background: none; border: 1px solid var(--deep-line); color: var(--deep-muted);
    padding: 12px 14px 13px; cursor: pointer; font: inherit;
    display: flex; flex-direction: column; justify-content: flex-start;
  }
  .rp-pick b { display: block; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 500; margin-bottom: 5px; }
  .rp-pick span { display: block; font-family: 'Archivo', sans-serif; font-weight: 600; font-size: 14.5px; line-height: 1.35; color: var(--deep-ink); }
  .rp-pick:hover { border-color: var(--deep-muted); }
  .rp-pick[aria-pressed="true"] { border-color: #7FC5D8; background: rgba(127, 197, 216, 0.10); }
  .rp-pick[aria-pressed="true"] b { color: #7FC5D8; }
  .rp-tools-label { margin: 30px 0 0; font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #7FC5D8; }
  .rp-tools-label[hidden] { display: none; }
  .rp-tools { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin-top: 10px; border-bottom: 1px solid var(--deep-line); }
  .rp-tools[hidden], .rp-tpanel[hidden] { display: none; }
  .rp-tool {
    text-align: left; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--deep-muted);
    padding: 11px 14px 10px; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: 3px;
  }
  .rp-tool code { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: inherit; }
  .rp-tool span { font-family: 'Archivo', sans-serif; font-weight: 600; font-size: 14px; }
  .rp-tool:hover { color: var(--deep-ink); }
  .rp-tool[aria-pressed="true"] { color: var(--deep-ink); border-bottom-color: #7FC5D8; }
  .rp-tool[aria-pressed="true"] code { color: #7FC5D8; }
  .rp-tool:focus-visible { outline: 2px solid #7FC5D8; outline-offset: -2px; }
  .rp-tpanel + .rp-tpanel { margin-top: 40px; }
  .rp-js .rp-tpanel + .rp-tpanel { margin-top: 0; }
  .rp-intro { color: var(--deep-ink); font-size: 15.5px; line-height: 1.6; margin: 24px 0 0; max-width: 760px; }
  .rp-tpanel > .transcript { margin-top: 18px; }
  .rp-codehead { padding: 14px 20px 0; margin: 0; }
  .rp-code {
    margin: 8px 0 0; padding: 12px 20px 16px; max-height: 300px; overflow: auto; white-space: pre;
    font-family: 'IBM Plex Mono', monospace; font-size: 12px; line-height: 1.65; color: var(--deep-ink);
    background: rgba(127, 197, 216, 0.06); border-top: 1px solid var(--deep-line); border-bottom: 1px solid var(--deep-line);
  }
  .rp-list { list-style: none; margin: 0; padding: 0; }
  .rp-item { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 18px; padding: 16px 22px; border-bottom: 1px solid var(--deep-line); }
  .rp-item:last-child { border-bottom: 0; }
  .rp-own { border-left: 2px solid #7FC5D8; }
  .rp-rank { font-family: 'IBM Plex Mono', monospace; font-size: 20px; font-weight: 600; color: var(--deep-ink); line-height: 1.2; }
  .rp-sev { align-self: start; justify-self: start; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; padding: 2px 7px; border: 1px solid currentColor; color: var(--deep-muted); }
  .rp-sev-critical { color: #F0846A; }
  .rp-sev-high { color: #E8B98A; }
  .rp-sev-medium { color: #7FC5D8; }
  .rp-title { font-family: 'Archivo', sans-serif; font-weight: 600; font-size: 16px; color: var(--deep-ink); margin: 0; }
  .rp-headline { font-family: 'Archivo', sans-serif; font-weight: 600; font-size: 19px; color: var(--deep-ink); margin: 0; }
  .rp-meta { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; color: var(--deep-muted); margin: 4px 0 0; letter-spacing: 0.02em; }
  .rp-text { font-size: 15px; line-height: 1.6; color: #B7C7CC; margin: 6px 0 0; max-width: none; }
  .rp-text b { color: var(--deep-ink); font-weight: 500; }
  .rp-fix { color: var(--deep-muted); }
  .rp-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rp-fig { margin: 0; padding: 18px 20px 20px; }
  .rp-fig + .rp-fig { border-left: 1px solid var(--deep-line); }
  .rp-fig img { display: block; width: 100%; height: auto; }
  .rp-fig figcaption { display: flex; align-items: baseline; gap: 12px; margin: 12px 0 2px; }
  .rp-fig figcaption .rp-meta { margin: 0; }
  .rp-pick:focus-visible, .rp-again:focus-visible { outline: 2px solid #7FC5D8; outline-offset: 2px; }
  .rp-stage { margin-top: 18px; }
  .rp-session + .rp-session { margin-top: 28px; }
  .rp-session[hidden] { display: none; }
  .rp-ctx { font-size: 14px; line-height: 1.6; color: var(--deep-muted); margin: 10px 0 0; max-width: none; }
  .rp-ctx b { color: var(--deep-ink); font-weight: 500; }
  .rp-note { margin-top: 16px; padding-left: 12px; border-left: 2px solid #7FC5D8; }
  .rp-why { display: block; }
  .rp-wait { display: none; font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; color: var(--deep-muted); }
  .rp-wait::after { content: '...'; display: inline-block; width: 0; overflow: hidden; vertical-align: bottom; animation: rp-dots 1.2s steps(4) infinite; }
  .vote.is-waiting .rp-wait { display: block; }
  .vote.is-waiting .vote-pos, .vote.is-waiting .rp-why, .vote.is-waiting .chip, .vote.is-waiting .vote-who span { display: none; }
  .rp-js .rp-step:not(.is-waiting):not(.is-hidden) { animation: rp-in 0.35s ease-out; }
  .rp-step.is-hidden { visibility: hidden; }
  .rp-out { border-bottom: 0; }
  .rp-out b { color: #7FC5D8; }
  .rp-controls { margin-top: 14px; }
  .rp-controls[hidden] { display: none; }
  .rp-again {
    background: none; border: 0; padding: 0; cursor: pointer; color: #7FC5D8;
    font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; letter-spacing: 0.04em;
    text-decoration: underline; text-underline-offset: 3px;
  }
  @keyframes rp-dots { to { width: 1.3em; } }
  @keyframes rp-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
  @media (max-width: 900px) {
    .rp-picks { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rp-tools { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  }
  @media (max-width: 620px) {
    .rp-pick { padding: 10px 10px 11px; }
    .rp-pick span { font-size: 13.5px; }
    .rp-tools { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .rp-tool { padding: 10px 10px 9px; }
    .rp-item { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 14px 16px; }
    .rp-codehead { padding-inline: 16px; }
    .rp-code { padding-inline: 16px; }
    .rp-figs { grid-template-columns: minmax(0, 1fr); }
    .rp-fig { padding: 16px; }
    .rp-fig + .rp-fig { border-left: 0; border-top: 1px solid var(--deep-line); }
  }

  /* Each recording reads like a conversation in Claude: on the left the
     chat (request, Claude asking Kirat, Claude's answer) in Claude's light
     look, on the right what happens behind the scenes: exactly what Claude
     sent to Kirat and what came back. */
  .rp-session {
    display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 22px; align-items: start;
    padding: 22px; border: 1px solid var(--deep-line); border-radius: 10px;
  }
  .rp-app {
    position: sticky; top: 84px; overflow: hidden; border: 1px solid #E3DFD3; border-radius: 12px;
    background: #FAF9F5; color: #1F1E1D; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3);
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  }
  .rp-app-bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: #F0EEE6; border-bottom: 1px solid #E3DFD3; }
  .rp-app-bar i { width: 10px; height: 10px; border-radius: 50%; background: #D9D5C9; }
  .rp-app-bar span { margin-left: 10px; font-size: 13px; font-weight: 600; color: #3D3D3A; }
  .rp-thread { display: grid; gap: 16px; padding: 22px 22px 6px; min-height: 240px; align-content: start; }
  .rp-user { justify-self: end; max-width: 88%; }
  .rp-say { margin: 0; max-width: none; padding: 11px 15px; border-radius: 14px; background: #F0EEE6; color: #1F1E1D; font-size: 15.5px; line-height: 1.5; }
  .rp-use {
    justify-self: start; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 9px; margin: 0; max-width: none;
    padding: 7px 12px; border: 1px solid #E3DFD3; border-radius: 8px; background: #fff; font-size: 13px; color: #6B6A64;
  }
  .rp-use::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #D97757; }
  .rp-use code { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; font-weight: 600; color: #1F1E1D; }
  .rp-reply { font-family: ui-serif, Georgia, Cambria, 'Times New Roman', serif; font-size: 16.5px; line-height: 1.6; color: #1F1E1D; }
  .rp-reply p { margin: 0 0 10px; max-width: none; }
  .rp-reply ol { margin: 0 0 10px; padding-left: 22px; }
  .rp-reply li { margin: 4px 0; }
  .rp-reply b { font-weight: 700; }
  .rp-compose {
    margin: 6px 14px 14px; max-width: none; padding: 12px 14px; border: 1px solid #E3DFD3; border-radius: 12px;
    background: #fff; color: #9A988F; font-size: 14px;
  }
  .rp-bg { min-width: 0; }
  .rp-bg-h {
    margin: 0 0 10px; max-width: none; font-family: 'IBM Plex Mono', monospace; font-size: 11px;
    letter-spacing: 0.1em; text-transform: uppercase; color: var(--deep-muted);
  }
  .rp-call { border: 1px solid var(--deep-line); border-radius: 10px; background: rgba(0, 0, 0, 0.16); overflow: hidden; }
  .rp-call-h {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0; padding: 10px 16px;
    border-bottom: 1px solid var(--deep-line); max-width: none;
  }
  .rp-call-h code { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; font-weight: 600; color: #7FC5D8; }
  .rp-call-h span { font-size: 13.5px; color: var(--deep-muted); }
  .rp-call .tr-head { display: flex; flex-direction: column; padding: 12px 16px 14px; border-bottom: 0; }
  .rp-call .tr-head > .rp-ctx:first-of-type { margin-top: 0; }
  .rp-call .rp-ctx { font-size: 13.5px; }
  .rp-call .tr-meta { order: 9; margin-top: 12px; font-size: 10.5px; }
  .rp-call .rp-codehead { padding: 0 16px; margin: 0; }
  .rp-call .rp-code { border-bottom: 0; margin-top: 8px; padding-inline: 16px; max-height: 220px; }
  .rp-bg > .transcript { margin-top: 14px; border-radius: 10px; background: rgba(0, 0, 0, 0.12); }
  .rp-bg .vote { grid-template-columns: 112px minmax(0, 1fr); gap: 14px; padding: 16px 18px; }
  .rp-bg .rp-item { grid-template-columns: 78px minmax(0, 1fr); gap: 14px; padding: 14px 18px; }
  .rp-bg .rp-figs { grid-template-columns: minmax(0, 1fr); }
  .rp-bg .rp-fig + .rp-fig { border-left: 0; border-top: 1px solid var(--deep-line); }
  .rp-res-h {
    margin: 0; max-width: none; padding: 11px 18px; border-bottom: 1px solid var(--deep-line);
    font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: #7FC5D8;
  }
  .rp-js .rp-call.is-hidden { visibility: hidden; }
  @media (max-width: 900px) {
    .rp-session { grid-template-columns: minmax(0, 1fr); }
    .rp-app { position: static; }
    .rp-thread { min-height: 0; }
  }
  @media (max-width: 620px) {
    .rp-session { padding: 12px; gap: 16px; }
    .rp-thread { padding: 16px 14px 4px; }
    .rp-say { font-size: 15px; }
    .rp-reply { font-size: 16px; }
    .rp-bg .vote, .rp-bg .rp-item { grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 14px 16px; }
    .rp-res-h { padding-inline: 16px; }
  }

  /* Replay controls with JavaScript: two numbered steps. Step 1 is a
     segmented control (the tools), step 2 a row of folder tabs that sit
     on the recording they open, so it is clear what is playing. */
  .rp-js .inner { counter-reset: rp-step; }
  .rp-js .rp-tools-label, .rp-js .rp-tpanel:not([hidden]) .rp-intro {
    counter-increment: rp-step; display: flex; align-items: baseline; gap: 12px;
  }
  .rp-js .rp-tools-label::before, .rp-js .rp-tpanel:not([hidden]) .rp-intro::before {
    content: counter(rp-step); flex: 0 0 auto; display: inline-grid; place-items: center;
    width: 24px; height: 24px; border-radius: 50%; border: 1px solid #7FC5D8; color: #7FC5D8;
    font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 600; letter-spacing: 0;
    transform: translateY(-1px);
  }
  .rp-js .rp-tools-label { margin-top: 34px; font-size: 12.5px; }
  .rp-js .rp-tools {
    display: flex; gap: 4px; margin-top: 14px; padding: 4px; border: 1px solid var(--deep-line);
    border-radius: 12px; background: rgba(255, 255, 255, 0.025);
  }
  .rp-js .rp-tools[hidden] { display: none; }
  .rp-js .rp-tool {
    flex: 1 1 0; min-width: 0; border: 0; border-radius: 8px; padding: 11px 14px 12px; gap: 4px;
    transition: background-color .15s, color .15s;
  }
  .rp-js .rp-tool span { font-size: 15px; color: var(--deep-ink); }
  .rp-js .rp-tool code { font-size: 11.5px; color: var(--deep-muted); }
  .rp-js .rp-tool:hover { background: rgba(127, 197, 216, 0.09); }
  .rp-js .rp-tool[aria-pressed="true"] { background: #7FC5D8; }
  .rp-js .rp-tool[aria-pressed="true"] span, .rp-js .rp-tool[aria-pressed="true"] code { color: var(--deep); }
  .rp-js .rp-tool:focus-visible { outline-offset: 2px; }
  .rp-js .rp-intro { margin-top: 30px; }
  .rp-js .rp-picks { gap: 6px; margin-top: 16px; align-items: stretch; }
  .rp-js .rp-pick {
    position: relative; border: 1px solid var(--deep-line); border-bottom: 0; border-radius: 10px 10px 0 0;
    background: rgba(255, 255, 255, 0.012); padding: 12px 14px 14px; transition: background-color .15s;
  }
  .rp-js .rp-pick span { color: var(--deep-muted); font-weight: 500; }
  .rp-js .rp-pick:hover { background: rgba(127, 197, 216, 0.09); border-color: var(--deep-line); }
  .rp-js .rp-pick:hover span { color: var(--deep-ink); }
  .rp-js .rp-pick[aria-pressed="true"] {
    z-index: 1; margin-bottom: -1px; background: #183A44; background: var(--rp-raised);
    border-color: var(--rp-edge); box-shadow: inset 0 3px 0 #7FC5D8;
  }
  .rp-js .rp-pick[aria-pressed="true"] span { color: var(--deep-ink); font-weight: 600; }
  .rp-js .rp-pick:focus-visible { outline-offset: -3px; }
  .rp-js .rp-stage { margin-top: 0; }
  /* The active tab and its recording share one raised surface. */
  .rp-js { --rp-raised: color-mix(in srgb, var(--deep), #fff 9%); --rp-edge: rgba(127, 197, 216, 0.38); }
  .rp-js .rp-session {
    background: #183A44; background: var(--rp-raised); border-color: var(--rp-edge);
    border-radius: 0 0 10px 10px; box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  }
  .rp-js .transcript.is-hidden { visibility: hidden; }
  @media (max-width: 900px) {
    .rp-js .rp-tools { flex-wrap: wrap; }
    .rp-js .rp-tool { flex: 1 1 30%; }
    /* The tabs scroll sideways instead of stacking into a wall of buttons. */
    .rp-js .rp-picks {
      display: flex; overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity;
    }
    .rp-js .rp-picks::-webkit-scrollbar { display: none; }
    .rp-js .rp-pick { flex: 0 0 auto; width: 210px; scroll-snap-align: start; }
  }
  @media (max-width: 620px) {
    .rp-js .rp-tool { flex: 1 1 40%; padding: 10px 12px 11px; }
    .rp-js .rp-tool span { font-size: 14px; }
    .rp-js .rp-pick { width: 168px; padding: 10px 12px 12px; }
  }

  /* Audience pages: one recording per tool, so the tools pick the
     recording directly and it has no tabs above it. */
  .rp-single .rp-stage { margin-top: 18px; }
  .rp-js.rp-single .rp-stage { margin-top: 16px; }
  .rp-js.rp-single .rp-session { border-radius: 10px; }
  .rp-js.rp-single .rp-tools-label { counter-increment: none; display: block; }
  .rp-js.rp-single .rp-tools-label::before { content: none; }
  .rp-single .rp-tpanel + .rp-tpanel { margin-top: 48px; }
  .rp-js.rp-single .rp-tpanel + .rp-tpanel { margin-top: 0; }
  .rp-js.rp-single .rp-tool span { line-height: 1.35; }
