/*
 * TLexDR, episode.css
 * SPEC-159: Public Site Redesign: Episode Detail
 *
 * Layout A: sticky left rail + wide reading column.
 * Consumes tokens from base.css (SPEC-156).
 * No build step required.
 */


/* ============================================================
   EPISODE PAGE TOP (breadcrumb + title + meta)
   ============================================================ */

.ep-top {
    padding: 34px 0 24px;
}

.ep-breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
    font-family: var(--font-mono);
}

.ep-breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.ep-breadcrumb a:hover {
    color: var(--text-primary);
}

.ep-title-h1 {
    font-family: var(--font-serif);
    font-size: clamp(26px, 3.2vw, 40px);
    font-weight: 500;
    line-height: 1.15;
    color: var(--text-primary);
    margin: 0 0 16px;
    max-width: 28ch;
}

.ep-meta-row {
    display: flex;
    gap: 20px;
    color: var(--text-muted);
    font-size: 13.5px;
    font-family: var(--font-mono);
    flex-wrap: wrap;
    align-items: center;
}


/* ============================================================
   LAYOUT A GRID
   ============================================================ */

.ep-grid {
    display: grid;
    grid-template-columns: 272px 1fr;
    gap: 44px;
    align-items: start;
    padding-bottom: 80px;
}


/* ============================================================
   RAIL (left sticky column)
   ============================================================ */

.ep-rail {
    position: sticky;
    top: 84px;       /* clears the 64px header + breathing room */
    display: flex;
    flex-direction: column;
    gap: 22px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    scrollbar-width: none;   /* Firefox */
    -ms-overflow-style: none;
}

.ep-rail::-webkit-scrollbar {
    display: none;
}

/* Rail poster */
.ep-rail-poster {
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface-elevated);
}

.ep-rail-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Rail group: labelled widget */
.ep-rail-grp {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ep-rail-lbl {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-weight: 600;
}

/* Share buttons row */
.ep-rail-share {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}


/* ============================================================
   DEPTH TOGGLE  (moved to rail; same JS hooks preserved)
   ============================================================ */

/*
 * SPEC-096: reader-depth toggle.
 * Three modes -- skim / read / deep -- controlled by data-depth-mode
 * on the .episode-body wrapper. CSS hides sections that do not belong
 * in the active mode.
 *
 * The .depth-toggle class and all data-depth attributes are preserved
 * exactly so existing JS in episode_detail.html continues to work.
 */
.depth-toggle {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
}

.depth-toggle button {
    background: none;
    border: none;
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-pill);
    transition: all 0.2s var(--ease);
    font-family: var(--font-sans);
}

.depth-toggle button:hover {
    color: var(--text-primary);
}

.depth-toggle button[aria-pressed="true"] {
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 550;
}


/* ============================================================
   RAIL TOC (On this page)
   ============================================================ */

.ep-rail-toc {
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-left: 1px solid var(--border);
}

.ep-rail-toc a {
    font-size: 13.5px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 5px 0 5px 14px;
    border-left: 2px solid transparent;
    margin-left: -1px;
    transition: color 0.15s var(--ease), border-color 0.15s var(--ease);
    line-height: 1.4;
}

.ep-rail-toc a:hover,
.ep-rail-toc a.active {
    color: var(--text-primary);
    border-left-color: var(--accent);
}


/* ============================================================
   CONCEPT CHIPS  (in rail)
   ============================================================ */

.ep-rail-concepts {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.ep-rail-concepts a {
    font-size: 12.5px;
    padding: 5px 11px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-2);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s var(--ease);
    white-space: nowrap;
}

.ep-rail-concepts a:hover {
    border-color: var(--accent-line);
    color: var(--accent);
}


/* ============================================================
   READING COLUMN (right content stack)
   ============================================================ */

.ep-main {
    min-width: 0;     /* prevent grid blowout */
}


/* ============================================================
   DEPTH MODE: section visibility
   ============================================================ */

/*
 * Skim mode: show only sections tagged data-depth-skim-keep.
 * Read mode: show all sections (default).
 * Deep mode: show all sections, auto-expand transcript.
 */
.episode-body[data-depth-mode="skim"] .core-takeaways,
.episode-body[data-depth-mode="skim"] .quotes-section,
.episode-body[data-depth-mode="skim"] .insights-section,
.episode-body[data-depth-mode="skim"] .topics-section,
.episode-body[data-depth-mode="skim"] .transcript-section {
    display: none;
}

.episode-body[data-depth-mode="skim"] [data-depth-skim-keep] {
    display: block;
}

.episode-body[data-depth-mode="skim"] [data-depth-skim-keep].quotes-section .quote:not(:first-of-type) {
    display: none;
}

/* Deep mode: auto-expand transcript */
.episode-body[data-depth-mode="deep"] .transcript-content {
    max-height: 9999px !important;
    overflow-y: auto;
}

.episode-body[data-depth-mode="deep"] .transcript-toggle [data-transcript-toggle-icon]::after {
    content: ' (expanded)';
    font-size: 11px;
    color: var(--text-muted);
}


/* ============================================================
   SPEC-086: soft paywall (teaser fade + upgrade cards + locks)
   ============================================================ */
.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.paywall-teaser { margin-bottom: 40px; }

/* The stub is already short (server-truncated); the fade only implies "more". */
.paywall-stub {
    position: relative;
    max-height: 5.5em;
    overflow: hidden;
    color: var(--text-secondary);
    line-height: 1.7;
}
.paywall-stub p { margin: 0 0 8px; }
.teaser-fade {
    position: absolute; left: 0; right: 0; bottom: 0; height: 3.5em;
    background: linear-gradient(180deg, transparent, var(--bg));
    pointer-events: none;
}

.paywall-card {
    margin: 18px 0 0;
    padding: 24px 28px;
    border: 1px solid var(--accent);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(110, 168, 254, 0.10) 0%, rgba(110, 168, 254, 0.05) 100%);
    text-align: center;
}
.paywall-card-headline {
    margin: 0 0 6px; font-size: 18px; font-weight: 600; color: var(--text-primary);
}
.paywall-card-sub { margin: 0 0 18px; font-size: 14px; color: var(--text-secondary); }
.paywall-card-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.paywall-deep-lock { margin: 0; }
.paywall-deep-meta { margin: 0 0 14px; font-size: 13px; color: var(--text-muted); text-align: center; }

/* Locked depth-toggle buttons read as upgrade affordances, not preferences. */
.depth-toggle button[data-depth-locked="true"] { opacity: 0.55; }


/* ============================================================
   CORE TAKEAWAYS
   ============================================================ */

.core-takeaways {
    background: linear-gradient(180deg, var(--accent-soft), transparent);
    border: 1px solid var(--accent-line);
    border-radius: var(--radius);
    padding: 30px 32px;
    margin-bottom: 40px;
}

.core-takeaways-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent);
    margin-bottom: 20px;
    display: block;
    font-family: var(--font-sans);
}

.core-takeaway-item {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 22px;
}

.core-takeaway-item:last-child {
    margin-bottom: 0;
}

.core-takeaway-icon {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 9px;
    flex-shrink: 0;
    box-shadow: 0 0 8px var(--accent);
}

.core-takeaway-text {
    font-size: 17px;
    line-height: 1.65;
    color: var(--text-primary);
    font-weight: 450;
    font-family: var(--font-serif);
    flex: 1;
}

.core-takeaway-text a {
    color: var(--accent);
    border-bottom: 1px solid var(--accent-line);
    text-decoration: none;
}

.timestamp-anchor {
    margin-left: 8px;
    font-size: 11px;
    color: var(--text-muted);
    text-decoration: none;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    vertical-align: middle;
    white-space: nowrap;
    font-family: var(--font-mono);
    transition: all 0.15s var(--ease);
}

.timestamp-anchor:hover {
    border-color: var(--accent-line);
    color: var(--accent);
}


/* ============================================================
   SECTION HEADINGS
   ============================================================ */

.section-header {
    font-family: var(--font-serif);
    font-size: 27px;
    font-weight: 500;
    color: var(--text-primary);
    margin: 0 0 20px;
    letter-spacing: -0.01em;
    line-height: 1.2;
    scroll-margin-top: 96px;   /* offset for sticky header + rail */
}


/* ============================================================
   DETAILED INSIGHTS (accordions)
   ============================================================ */

.insights-section {
    margin-bottom: 40px;
}

.insight-topic {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    transition: border-color 0.2s var(--ease);
}

.insight-topic:hover {
    border-color: var(--border-2);
}

.topic-header {
    padding: 18px 22px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.topic-title {
    font-family: var(--font-serif);
    font-size: 19px;
    font-weight: 500;
    color: var(--text-primary);
}

.topic-toggle {
    color: var(--text-muted);
    font-size: 22px;
    transition: transform 0.2s var(--ease);
    flex-shrink: 0;
}

.topic-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s var(--ease);
}

.topic-content.active {
    max-height: 1200px;
}

.topic-content-inner {
    padding: 0 22px 22px;
}

.insight-point {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    align-items: flex-start;
}

.insight-bullet {
    color: var(--accent);
    font-size: 18px;
    font-weight: 600;
    flex-shrink: 0;
    margin-top: 1px;
}

.insight-text {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
}


/* ============================================================
   GENERIC CONTENT PANELS
   ============================================================ */

.ep-panel {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 26px 30px;
    margin-bottom: 32px;
}

.ep-panel p {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 14px;
}

.ep-panel p:last-child {
    margin-bottom: 0;
}

/* Arc + surprising moments + open questions: left-accent variant */
.ep-panel-accent {
    background: var(--surface-elevated);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 24px 28px;
    margin-bottom: 32px;
}


/* ============================================================
   QUOTES SECTION
   ============================================================ */

.quotes-section {
    margin-bottom: 40px;
}

.quote {
    padding: 26px 32px;
    margin-bottom: 16px;
    background: var(--surface-elevated);
    border-left: 3px solid var(--accent-line);
    border-radius: 8px;
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--text-primary);
    line-height: 1.9;
    font-size: 18px;
    letter-spacing: 0.01em;
}


/* ============================================================
   TOPICS TAGS
   ============================================================ */

.topics-section {
    margin-bottom: 40px;
}

.topic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.topic-tag {
    padding: 8px 16px;
    background: var(--surface-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s var(--ease);
}

.topic-tag:hover {
    background: var(--accent-soft);
    border-color: var(--accent-line);
    color: var(--accent);
}


/* ============================================================
   TRANSCRIPT SECTION
   ============================================================ */

.transcript-section {
    margin-bottom: 40px;
}

.transcript-toggle {
    width: 100%;
    padding: 18px 24px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s var(--ease);
    font-family: var(--font-sans);
    text-align: left;
}

.transcript-toggle:hover {
    background: var(--accent-soft);
    border-color: var(--accent-line);
    color: var(--text-primary);
}

.transcript-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s var(--ease);
}

.transcript-content.active {
    max-height: 600px;
    overflow-y: auto;
}

.transcript-text {
    padding: 28px;
    margin-top: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-secondary);
    white-space: pre-wrap;
}


/* ============================================================
   SURPRISING MOMENTS
   ============================================================ */

.ep-moment {
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.ep-moment:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.ep-moment-speaker {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
    font-family: var(--font-sans);
}

.ep-moment-desc {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-primary);
}


/* ============================================================
   JARGON GLOSSARY
   ============================================================ */

.ep-gloss-entry {
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.ep-gloss-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.ep-gloss-term {
    font-family: var(--font-serif);
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.ep-gloss-def {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}


/* ============================================================
   REFERENCES
   ============================================================ */

.ep-ref {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.ep-ref:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.ep-ref-heading {
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.ep-ref-links {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ep-ref-link {
    padding: 5px 11px;
    background: var(--accent-soft);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 12.5px;
    color: var(--accent);
    text-decoration: none;
    transition: all 0.15s var(--ease);
}

.ep-ref-link:hover {
    background: rgba(var(--accent-rgb), 0.2);
    border-color: var(--accent-line);
}


/* ============================================================
   CHAT PANEL
   ============================================================ */

.ep-chat-box {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
}

.ep-chat-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.ep-chat-row {
    display: flex;
    gap: 10px;
}

.ep-chat-row input {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border-2);
    color: var(--text-primary);
    border-radius: var(--radius-pill);
    padding: 12px 16px;
    font-family: var(--font-sans);
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

.ep-chat-row input:focus {
    border-color: var(--accent-line);
    box-shadow: 0 0 0 3px var(--accent-soft);
}


/* ============================================================
   CITE PANEL
   ============================================================ */

.ep-cite-tabs {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.cite-tab {
    font-size: 12.5px;
    padding: 5px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-primary);
    cursor: pointer;
    font-family: var(--font-sans);
    transition: all 0.15s var(--ease);
}

.cite-tab:hover {
    border-color: var(--border-2);
    color: var(--accent);
}


/* ============================================================
   RELATED EPISODES  (SPEC-188: grouped-by-connection, self-contained)
   Renders templates/_related_episodes.html. Deliberately does NOT depend
   on home.css / the _episode_card.html macro (the old bug: those styles
   are not loaded on the episode page, so the cards rendered unstyled).
   ============================================================ */

.rel {
    margin-top: 48px;
}

.rel .section-header {
    margin-bottom: 4px;
}

.rel-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 22px;
}

.rel-group {
    margin-bottom: 26px;
}

.rel-group:last-child {
    margin-bottom: 0;
}

.rel-glabel {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.rel-glabel b {
    color: var(--text-primary);
    font-weight: 600;
}

.rel-gic {
    flex: none;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    border: 1px solid var(--accent-line);
    color: var(--accent);
    font-size: 13px;
}

.rel-items {
    display: flex;
    flex-direction: column;
}

.rel-item {
    display: grid;
    grid-template-columns: 54px 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 11px 8px;
    border-top: 1px solid var(--border-subtle);
    text-decoration: none;
    color: inherit;
    transition: background .15s var(--ease);
}

.rel-item:hover {
    background: var(--surface-elevated);
}

.rel-av {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-2);
}

.rel-av img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rel-av--empty {
    background: var(--surface-3);
}

.rel-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.rel-title {
    font-family: var(--font-serif);
    font-size: 16.5px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
    transition: color .2s var(--ease);
}

.rel-item:hover .rel-title {
    color: var(--accent);
}

.rel-reason {
    font-size: 12px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rel-dur {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-muted);
    white-space: nowrap;
}


/* ============================================================
   DISCLAIMER SECTION
   ============================================================ */

.ep-disclaimer {
    margin-top: 48px;
    padding: 22px 26px;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
}


/* ============================================================
   RESPONSIVE BREAKPOINTS
   ============================================================ */

/* Medium: rail collapses to a compact utility bar */
@media (max-width: 1024px) {
    .ep-grid {
        grid-template-columns: 220px 1fr;
        gap: 28px;
    }

    .ep-rail-toc {
        display: none;   /* TOC moves to mobile-toc at this breakpoint */
    }
}

/* Small: full single-column stack */
@media (max-width: 768px) {
    .ep-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .ep-rail {
        position: static;
        max-height: none;
        overflow: visible;
        gap: 14px;
    }

    .ep-rail-poster,
    .ep-rail-toc,
    .ep-rail-concepts {
        display: none;
    }

    .ep-rail-grp:has(.depth-toggle),
    .ep-rail-grp:has(.ep-rail-share) {
        /* keep share + depth visible on mobile */
        display: flex;
    }

    .ep-title-h1 {
        max-width: 100%;
    }
}

/* =========================================================================
   SPEC-191: grounded chat (hybrid UI). Ported from design-prototypes/
   chat-hybrid.html + chat-proto.css. All scoped under #chatPanel. The local
   aliases below let the ported component rules use the prototype's variable
   names while resolving to base.css tokens (same accent/surface/text values).
   ========================================================================= */
#chatPanel{
  --text: var(--text-primary); --text-2: var(--text-secondary); --text-3: var(--text-muted);
  --surface-2: var(--surface); --pill: var(--radius-pill);
  --serif: var(--font-serif); --sans: var(--font-sans); --mono: var(--font-mono);
  --ease: cubic-bezier(.22,.61,.36,1);
  --good-rgb:120,200,160; --warn-rgb:235,180,120;
}
#chatPanel .chat-thread{display:flex;flex-direction:column;gap:22px;margin:18px 0}
#chatPanel .msg{display:flex;flex-direction:column;gap:6px}
#chatPanel .msg.user{align-items:flex-end}
#chatPanel .bubble-user{background:var(--accent);color:var(--accent-ink);padding:12px 18px;border-radius:18px 18px 4px 18px;max-width:85%;font-size:15px;font-weight:450}
#chatPanel .answer{background:var(--surface-2);border:1px solid var(--border);border-radius:4px 18px 18px 18px;padding:18px 20px}
#chatPanel .answer .who{display:flex;align-items:center;gap:9px;margin-bottom:10px}
#chatPanel .answer .who .ai{width:24px;height:24px;border-radius:7px;display:grid;place-items:center;background:linear-gradient(140deg,var(--accent),rgba(var(--accent-rgb),.6));color:var(--accent-ink);font-size:13px;font-weight:700}
#chatPanel .answer .who .lbl{font-size:12px;color:var(--text-3);font-family:var(--mono)}
#chatPanel .answer .who .grounded{margin-left:auto;font-size:11px;font-family:var(--mono);color:rgb(var(--good-rgb));border:1px solid rgba(var(--good-rgb),.4);border-radius:var(--pill);padding:2px 9px}
#chatPanel .answer .who .grounded.no{color:rgb(var(--warn-rgb));border-color:rgba(var(--warn-rgb),.4)}
#chatPanel .prose{font-size:15.5px;line-height:1.72;color:var(--text)}
#chatPanel .prose p{margin-bottom:13px}
#chatPanel .prose p:last-child{margin-bottom:0}
#chatPanel .prose strong{color:var(--text);font-weight:600}
#chatPanel .prose em{color:var(--text-2)}
#chatPanel .cursor{display:inline-block;width:8px;height:18px;background:var(--accent);margin-left:2px;vertical-align:text-bottom;animation:chatblink 1s steps(2) infinite;border-radius:1px}
@keyframes chatblink{0%,50%{opacity:1}51%,100%{opacity:0}}
@media (prefers-reduced-motion:reduce){#chatPanel .cursor{animation:none}}
#chatPanel .cite-chip{display:inline-flex;align-items:center;justify-content:center;min-width:18px;height:18px;padding:0 5px;margin:0 1px;font-family:var(--mono);font-size:11px;font-weight:600;line-height:1;color:var(--accent);background:var(--accent-soft);border:1px solid var(--accent-line);border-radius:5px;cursor:pointer;vertical-align:super;transition:all .15s}
#chatPanel .cite-chip:hover,#chatPanel .cite-chip.active{background:var(--accent);color:var(--accent-ink)}
#chatPanel .inline-sources{margin-top:14px;display:flex;flex-direction:column;gap:9px}
#chatPanel .src-row{display:none}
#chatPanel .src-row.open{display:block;animation:chatslide .22s var(--ease)}
@keyframes chatslide{from{opacity:0;transform:translateY(-5px)}to{opacity:1;transform:none}}
#chatPanel .src-toggle{display:inline-flex;align-items:center;gap:8px;font-family:var(--mono);font-size:12px;color:var(--text-3);background:none;border:1px dashed var(--border-2);border-radius:var(--pill);padding:5px 12px;cursor:pointer;margin-top:12px}
#chatPanel .src-toggle:hover{color:var(--accent);border-color:var(--accent-line)}
#chatPanel .src{display:block;background:var(--surface-2);border:1px solid var(--border);border-radius:11px;padding:14px 16px;transition:all .2s var(--ease)}
#chatPanel .src:hover{border-color:var(--border-2)}
#chatPanel .src.flash{border-color:var(--accent-line);box-shadow:0 0 0 3px var(--accent-soft)}
#chatPanel .src .src-top{display:flex;align-items:center;gap:9px;margin-bottom:8px}
#chatPanel .src .num{flex:none;width:20px;height:20px;border-radius:6px;display:grid;place-items:center;font-family:var(--mono);font-size:11px;font-weight:700;background:var(--accent-soft);color:var(--accent);border:1px solid var(--accent-line)}
#chatPanel .src .kind{font-family:var(--mono);font-size:10.5px;text-transform:uppercase;letter-spacing:.08em;color:var(--text-3)}
#chatPanel .src .ts{margin-left:auto;font-family:var(--mono);font-size:11px;color:var(--accent);border:1px solid var(--accent-line);border-radius:5px;padding:2px 8px;white-space:nowrap;text-decoration:none}
#chatPanel .src .ts:hover{background:var(--accent-soft)}
#chatPanel .src .snippet{font-family:var(--serif);font-size:15px;line-height:1.55;color:var(--text);font-style:italic;margin-bottom:9px}
#chatPanel .src .src-meta{font-size:12.5px;color:var(--text-2);display:flex;gap:6px;align-items:baseline;flex-wrap:wrap}
#chatPanel .src .src-meta .spk{color:var(--text);font-weight:500}
#chatPanel .src .src-meta .epttl{color:var(--text-3)}
#chatPanel .src .src-open{display:inline-block;margin-top:9px;font-family:var(--mono);font-size:11.5px;color:var(--accent)}
#chatPanel .honesty-tag{display:inline-flex;align-items:center;gap:7px;font-family:var(--mono);font-size:11px;color:rgb(var(--warn-rgb));text-transform:uppercase;letter-spacing:.06em}
#chatPanel .followups{display:flex;flex-wrap:wrap;gap:8px;margin-top:14px}
#chatPanel .followups .fu{font-size:13px;padding:8px 14px;border-radius:var(--pill);border:1px solid var(--border-2);background:rgba(255,255,255,.03);color:var(--text-2);cursor:pointer;text-align:left;font-family:var(--sans);transition:all .18s}
#chatPanel .followups .fu:hover{border-color:var(--accent-line);color:var(--accent);background:var(--accent-soft)}
#chatPanel .followups .fu::before{content:"\2192 \00a0";color:var(--text-3)}
#chatPanel .chat-status{display:flex;align-items:center;gap:10px;color:var(--text-3);font-size:13px;font-family:var(--mono);padding:6px 0}
#chatPanel .chat-status .spin{width:13px;height:13px;border:2px solid var(--border-2);border-top-color:var(--accent);border-radius:50%;animation:chatspin .7s linear infinite}
@keyframes chatspin{to{transform:rotate(360deg)}}
#chatPanel .composer{display:flex;gap:10px;align-items:center}
#chatPanel .composer input{flex:1;background:var(--bg);border:1px solid var(--border-2);color:var(--text);border-radius:var(--pill);padding:14px 18px;font-family:var(--sans);font-size:14.5px;outline:none}
#chatPanel .composer input:focus{border-color:var(--accent-line);box-shadow:0 0 0 3px var(--accent-soft)}
#chatPanel .composer input::placeholder{color:var(--text-3)}
#chatPanel .composer input:disabled{opacity:.6}
#chatPanel .chat-hint{font-size:11.5px;color:var(--text-3);margin-top:9px;font-family:var(--mono)}
#chatPanel .chat-error{color:rgb(var(--warn-rgb));font-size:13px;margin-top:8px}
#chatPanel .chat-error button{margin-left:8px;background:none;border:1px solid var(--accent-line);color:var(--accent);border-radius:var(--pill);padding:3px 12px;cursor:pointer;font-size:12px}
#chatPanel .feedback{display:flex;align-items:center;gap:6px;margin-top:14px;padding-top:12px;border-top:1px solid var(--border)}
#chatPanel .feedback .fb{background:none;border:1px solid var(--border);border-radius:7px;color:var(--text-3);cursor:pointer;padding:4px 9px;font-size:13px;transition:all .15s}
#chatPanel .feedback .fb:hover{color:var(--text);border-color:var(--border-2)}
#chatPanel .feedback .fb.on{color:var(--accent);border-color:var(--accent-line);background:var(--accent-soft)}
#chatPanel .feedback .fb-lbl{font-size:11px;color:var(--text-3);font-family:var(--mono);margin-right:2px}
#chatPanel .chat-explore{margin-top:20px;border-top:1px solid var(--border);padding-top:16px}
#chatPanel .chat-explore .rail-lbl{font-size:11px;text-transform:uppercase;letter-spacing:.12em;color:var(--text-3);margin-bottom:10px}
#chatPanel .chat-explore .chips{display:flex;flex-wrap:wrap;gap:7px}
#chatPanel .chat-explore .chips a{font-size:12px;padding:5px 11px;border-radius:var(--pill);border:1px solid var(--border-2);background:rgba(255,255,255,.03);color:var(--text-2);text-decoration:none}
#chatPanel .chat-explore .chips a:hover{border-color:var(--accent-line);color:var(--accent)}
#chatPanel .chat-demo-note{font-size:12px;color:var(--text-3);font-family:var(--mono);margin:6px 0 14px}
#chatPanel .chat-clear{margin-left:10px;background:none;border:none;color:var(--text-3);cursor:pointer;font-family:var(--mono);font-size:11px;text-decoration:underline;padding:0}
#chatPanel .chat-clear:hover{color:var(--accent)}
