/* 28-desktop-songbrain.css — Desktop Studio · Song Brain → 1:1 with the handoff
   ─────────────────────────────────────────────────────────────────────────
   Desktop revamp (founder, 2026-06-16). Re-skins the GUIDED right rail
   (#v9SongBrain) to be a 1:1 reproduction of the design handoff's `.rail-r`
   (Chat screen.html / tokens.css). updateSongBrain() emits the mock markup;
   this file is the mock's right-rail CSS lifted VERBATIM (values copied, not
   re-picked), scoped to #v9SongBrain so it can't leak.

   To guarantee identical contrast/spacing/fonts, the mock's own tokens.css
   values are redefined locally on #v9SongBrain — every rule below resolves to
   the handoff's exact numbers regardless of how the app defines tokens
   elsewhere.

   Scope: >=1024px + body.session-active #v9SongBrain. Mobile + Freeform rail
   untouched. Linked LAST. No prompts/schemas/model-facing content. */

@media (min-width: 1024px) {

  /* ── Mock tokens, scoped to the rail (from tokens.css) ── */
  body.session-active #v9SongBrain {
    --font-display: 'Cormorant Garamond', Georgia, serif;
    --font-body:    'Outfit', -apple-system, sans-serif;
    --font-lyric:   'Fraunces', 'Cormorant Garamond', Georgia, serif;
    --font-mono:    'DM Mono', ui-monospace, Menlo, monospace;
    --t1: #e7dfc6; --t2: #b9b09a; --t3: #808080; --t4: #555555;
    --gold: rgb(var(--gold-rgb)); --gold-50: rgba(var(--gold-rgb),0.50); --sage: rgb(var(--sage-rgb));
    --hair: rgba(var(--ivory-rgb),0.08); --line: rgba(var(--ivory-rgb),0.13);
    /* --dt-* inherited from the canonical ramp in 01-tokens.css (migration 2026-06-19);
       the rail-scoped copy (matching values) was removed to keep one source. */
    padding: 0;
  }

  /* ── Header — eyebrow + serif title + live sub ── */
  body.session-active #v9SongBrain .sb-header {
    padding: 20px 22px 14px; border-bottom: 1px solid var(--hair);
  }
  body.session-active #v9SongBrain .sb-title {
    font-family: var(--font-mono); font-weight: 400; font-style: normal;
    font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
    color: var(--t3); margin-bottom: 6px;
  }
  body.session-active #v9SongBrain .sb-subtitle {
    font-family: var(--font-display); font-style: italic; font-weight: 400;
    font-size: 22px; line-height: 1.1; color: var(--t1); letter-spacing: 0; text-transform: none;
  }
  body.session-active #v9SongBrain .sb-subtitle.untitled { color: var(--t3); }
  body.session-active #v9SongBrain .sb-sub {
    display: flex; align-items: center; gap: 8px; margin-top: 6px;
    font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--t3);
  }
  body.session-active #v9SongBrain .sb-sub .live {
    width: 6px; height: 6px; border-radius: 999px; background: var(--sage); box-shadow: 0 0 6px rgba(var(--sage-rgb),0.55);
  }
  body.session-active #v9SongBrain .sb-collapse {
    position: absolute; top: 18px; right: 18px;
    width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
    color: var(--t3); border-radius: 8px; background: transparent; border: 0; cursor: pointer;
    transition: color 0.2s ease, background 0.2s ease;
  }
  body.session-active #v9SongBrain .sb-collapse:hover { color: var(--t1); background: var(--dt-float); }
  body.session-active #v9SongBrain .sb-collapse svg { width: 15px; height: 15px; }

  /* ── Brain/Song tabs ── */
  body.session-active #v9SongBrain .sb-tabs {
    display: grid; grid-template-columns: 1fr 1fr; gap: 2px; padding: 3px; margin: 14px 22px 0;
    background: var(--dt-well); border: 1px solid var(--hair); border-radius: 10px;
  }
  body.session-active #v9SongBrain .sb-tab {
    padding: 8px; border-radius: 7px; cursor: pointer; background: transparent; border: 0;
    font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--t3);
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    transition: background 0.2s ease, color 0.2s ease;
  }
  body.session-active #v9SongBrain .sb-tab:hover { color: var(--t2); }
  body.session-active #v9SongBrain .sb-tab.active { background: var(--dt-raised); color: var(--t1); }
  body.session-active #v9SongBrain .sb-tab .ct { font-size: 9.5px; color: var(--t4); letter-spacing: 0.1em; }
  body.session-active #v9SongBrain .sb-tab.active .ct { color: var(--gold); }

  /* ── Scroll + sections ── */
  body.session-active #v9SongBrain .rail-r-scroll { padding: 6px 0 24px; }
  body.session-active #v9SongBrain .sb-section { padding: 18px 22px; border-bottom: 1px solid var(--hair); }
  body.session-active #v9SongBrain .sb-section:last-child { border-bottom: 0; }
  body.session-active #v9SongBrain .sb-section .head {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
  }
  body.session-active #v9SongBrain .sb-section .head .label {
    font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--t3);
  }
  body.session-active #v9SongBrain .sb-section .head .right {
    font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--t3);
    display: inline-flex; align-items: center; gap: 6px;
  }

  /* ── Phase timeline ── */
  body.session-active #v9SongBrain .phases { display: flex; flex-direction: column; gap: 0; position: relative; }
  body.session-active #v9SongBrain .phase {
    display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 12px; padding: 10px 0; position: relative;
  }
  body.session-active #v9SongBrain .phase + .phase::before {
    content: ""; position: absolute; left: 11px; top: -8px; width: 2px; height: 18px; background: var(--hair);
  }
  body.session-active #v9SongBrain .phase[data-state="done"] + .phase::before { background: rgba(var(--sage-rgb),0.4); }
  body.session-active #v9SongBrain .phase .node {
    width: 22px; height: 22px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--dt-surface);
    display: inline-flex; align-items: center; justify-content: center; color: var(--t4); transition: all 0.2s ease; position: relative;
  }
  body.session-active #v9SongBrain .phase[data-state="done"] .node { border-color: rgba(var(--sage-rgb),0.55); background: rgba(var(--sage-rgb),0.12); color: var(--sage); }
  body.session-active #v9SongBrain .phase[data-state="active"] .node {
    border-color: var(--gold); background: var(--gold); color: #1a1200;
    box-shadow: 0 0 0 4px rgba(var(--gold-rgb),0.12), 0 0 16px -2px rgba(var(--gold-rgb),0.5);
  }
  body.session-active #v9SongBrain .phase[data-state="active"] .node::after {
    content: ""; position: absolute; inset: -6px; border-radius: 999px; border: 1px solid rgba(var(--gold-rgb),0.25);
    animation: sb-phase-ring 2.4s cubic-bezier(0.45,0,0.55,1) infinite;
  }
  body.session-active #v9SongBrain .phase .node svg { width: 12px; height: 12px; }
  body.session-active #v9SongBrain .phase .name { font-family: var(--font-body); font-weight: 500; font-size: 14.5px; color: var(--t2); letter-spacing: -0.003em; }
  body.session-active #v9SongBrain .phase[data-state="active"] .name { color: var(--t1); }
  body.session-active #v9SongBrain .phase[data-state="done"] .name { color: var(--t2); }
  body.session-active #v9SongBrain .phase[data-state="todo"] .name { color: var(--t3); }
  body.session-active #v9SongBrain .phase .sub {
    font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--t3); margin-top: 2px;
  }
  body.session-active #v9SongBrain .phase .step {
    font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--t4);
  }
  @keyframes sb-phase-ring { 0%,100% { transform: scale(1); opacity: .7 } 50% { transform: scale(1.18); opacity: 0 } }

  /* ── DNA grid ── */
  body.session-active #v9SongBrain .dna { display: grid; grid-template-columns: 84px 1fr; row-gap: 12px; column-gap: 12px; align-items: center; }
  body.session-active #v9SongBrain .dna .row { display: contents; }
  body.session-active #v9SongBrain .dna .k { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--t3); }
  body.session-active #v9SongBrain .dna .v {
    font-family: var(--font-body); font-size: 14.5px; color: var(--t1); font-style: italic;
    display: inline-flex; align-items: center; gap: 8px; letter-spacing: -0.003em;
  }
  body.session-active #v9SongBrain .dna .v .pen { color: var(--t4); opacity: 0; transition: opacity 0.2s ease; display: inline-flex; }
  body.session-active #v9SongBrain .dna .row:hover .pen { opacity: 1; }
  body.session-active #v9SongBrain .dna .v .pen svg { width: 11px; height: 11px; }

  /* ── Session log ── */
  body.session-active #v9SongBrain .history-card {
    display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 12px;
    background: var(--dt-well); border: 1px solid var(--hair);
  }
  body.session-active #v9SongBrain .history-card .what { font-family: var(--font-body); font-size: 13.5px; color: var(--t1); }
  body.session-active #v9SongBrain .history-card .when { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--t3); }

  /* ── Manuscript / Song tab ── */
  body.session-active #v9SongBrain .manuscript { padding: 14px 20px 32px; display: flex; flex-direction: column; gap: 18px; }
  body.session-active #v9SongBrain .ref-card { background: var(--dt-well); border: 1px solid var(--hair); border-radius: 14px; overflow: hidden; }
  body.session-active #v9SongBrain .ref-tabs { display: grid; grid-template-columns: 1fr 1fr; }
  body.session-active #v9SongBrain .ref-tab {
    padding: 11px 12px; cursor: pointer; background: transparent; border: 0; border-bottom: 1px solid var(--hair);
    font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--t3);
    transition: color 0.2s ease, background 0.2s ease;
  }
  body.session-active #v9SongBrain .ref-tab:hover { color: var(--t1); }
  body.session-active #v9SongBrain .ref-tab.active { color: var(--t1); background: var(--dt-raised); border-bottom-color: transparent; }
  body.session-active #v9SongBrain .ref-body { padding: 14px 16px 16px; }
  body.session-active #v9SongBrain .ref-title { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 18px; line-height: 1.2; color: var(--t1); margin-bottom: 6px; }
  body.session-active #v9SongBrain .ref-desc { font-family: var(--font-body); font-size: 13px; line-height: 1.55; color: var(--t2); }
  body.session-active #v9SongBrain .structure-pills { display: flex; flex-wrap: wrap; gap: 6px; }
  body.session-active #v9SongBrain .structure-pills .pill {
    padding: 4px 9px; border-radius: 999px; background: var(--dt-surface); border: 1px solid var(--hair); color: var(--t2);
    font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.18em; text-transform: uppercase;
  }
  body.session-active #v9SongBrain .structure-pills .pill.done { color: var(--sage); border-color: rgba(var(--sage-rgb),0.30); background: rgba(var(--sage-rgb),0.06); }
  body.session-active #v9SongBrain .structure-pills .pill.now  { color: var(--gold); border-color: rgba(var(--gold-rgb),0.35); background: rgba(var(--gold-rgb),0.06); }
  body.session-active #v9SongBrain .structure-pills .pill.todo { color: var(--t3); }
  body.session-active #v9SongBrain .ms-lyrics { display: flex; flex-direction: column; gap: 28px; padding: 8px 6px 4px; }
  body.session-active #v9SongBrain .ms-section { display: flex; flex-direction: column; gap: 8px; }
  body.session-active #v9SongBrain .ms-label { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--t4); font-weight: 300; }
  body.session-active #v9SongBrain .ms-active .ms-label { color: var(--gold-50); }
  body.session-active #v9SongBrain .ms-pending .ms-label { color: var(--t4); opacity: 0.6; }
  body.session-active #v9SongBrain .ms-lines { display: flex; flex-direction: column; gap: 1px; }
  body.session-active #v9SongBrain .ms-line {
    margin: 0; font-family: var(--font-lyric); font-weight: 300; font-style: italic; font-size: 15px; line-height: 1.75;
    color: var(--t2); letter-spacing: 0.01em; text-wrap: pretty;
  }
  body.session-active #v9SongBrain .ms-active .ms-line { color: var(--t1); }
  body.session-active #v9SongBrain .ms-pending .ms-line { color: var(--t4); }
  body.session-active #v9SongBrain .ms-empty { font-family: var(--font-lyric); font-style: italic; font-size: 13px; color: var(--t4); min-height: 4px; font-weight: 300; }
  body.session-active #v9SongBrain .ms-line.cursor::after {
    content: "▎"; color: var(--gold-50); margin-left: 4px; animation: sb-caret-blink 1.4s steps(1) infinite;
    font-family: var(--font-body); font-size: 13px; vertical-align: -1px; font-style: normal;
  }
  @keyframes sb-caret-blink { 50% { opacity: 0; } }
}
