/* ════════════════════════════════════════════════════════════════
   35-Code-Block — וייב קוד ניוז · Code Block Reader
   News presented as if reading source code.
   Monospace everywhere. Line numbers. Syntax highlighting for
   category/urgency. Comment blocks for summaries. Function
   declarations for articles. Console.log lines for news.
   Chat top styled as terminal/console window.
   LTR permitted (code is universal). VS Code dark theme inspired.
   No neon, no cyberpunk, no neomorphism.
   ════════════════════════════════════════════════════════════════ */

/* ─── Design Tokens ─── */
:root {
  /* Editor surface (VS Code Dark+ inspired) */
  --bg:           #1e1e1e;             /* editor body */
  --bg-sidebar:   #252526;             /* line-number gutter + activity bar */
  --bg-titlebar:  #3c3c3c;             /* tab title bar */
  --bg-status:    #007acc;             /* status bar accent */
  --bg-status-2:  #16825d;             /* status bar secondary */
  --bg-hover:     #2a2d2e;             /* row hover */
  --bg-active:    #37373d;             /* selected row */
  --bg-overlay:   #0e0e0e;             /* deep panels */

  /* Syntax tokens (dark+ style, but tuned for content readability) */
  --syn-keyword:  #569cd6;             /* blue — categories, const/let/function */
  --syn-string:   #ce9178;             /* orange-rose — titles */
  --syn-comment:  #6a9955;             /* green — summaries */
  --syn-number:   #b5cea8;             /* light green — IDs, dates */
  --syn-fn:       #dcdcaa;             /* yellow — function name (articles) */
  --syn-var:      #9cdcfe;             /* light blue — properties */
  --syn-type:     #4ec9b0;             /* teal — types, sources */
  --syn-urgent:   #f48771;             /* salmon-red — urgent/breaking */
  --syn-error:    #f44747;             /* red — error lines */
  --syn-tag:      #c586c0;             /* purple — tags, categories */
  --syn-meta:     #808080;             /* gray — meta info */
  --syn-bracket:  #ffd700;             /* gold — brackets */
  --syn-text:     #d4d4d4;             /* main text */
  --syn-text-soft:#cccccc;             /* slightly softer */
  --syn-text-mute:#858585;             /* dimmer */

  /* Highlighted line background (current line in editor) */
  --hl-current:   #282828;

  /* Selection */
  --selection-bg: #264f78;
  --selection-fg: #ffffff;

  /* Borders */
  --border:       #1e1e1e;
  --border-soft:  #2d2d2d;
  --border-line:  #404040;

  /* Chat (terminal-window aesthetic inside fixed bar) */
  --term-bg:      #0c0c0c;
  --term-border:  #303030;
  --term-fg:      #d4d4d4;
  --term-prompt:  #569cd6;
  --term-err:     #f44747;

  /* Chat skin overrides — accent on terminal window */
  --skin-wa-bg:   #0c0c0c;
  --skin-wa-bar:  #128c4f;
  --skin-wa-fg:   #d4d4d4;
  --skin-tg-bg:   #0c0c0c;
  --skin-tg-bar:  #0088cc;
  --skin-tg-fg:   #d4d4d4;
  --skin-ms-bg:   #0c0c0c;
  --skin-ms-bar:  linear-gradient(90deg, #0084ff 0%, #7b68ee 100%);
  --skin-ms-fg:   #d4d4d4;

  /* Fonts */
  --font-mono:    'JetBrains Mono', 'SF Mono', 'Menlo', 'Consolas', 'Courier New', monospace;

  /* Sizes */
  --line-h:       1.65em;
  --gutter-w:     56px;
  --titlebar-h:   36px;
  --statusbar-h:  24px;
  --chat-h:       124px; /* POLISHED: more compact terminal */
}

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: var(--line-h);
  color: var(--syn-text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  overscroll-behavior: none;
  direction: ltr;
  text-align: left;
}

body {
  min-height: 100vh;
  padding-top: calc(var(--chat-h) + 12px); /* POLISHED: tighter */
  padding-bottom: var(--statusbar-h);
  user-select: text;
  -webkit-user-select: text;
  -webkit-tap-highlight-color: transparent;
}

/* Force LTR globally for this prototype */
body[data-page="index"],
body[data-page="article"],
body[data-page="news"] {
  direction: ltr;
  text-align: left;
}

/* Inline Hebrew text in headlines still reverts via dir="auto" — see app.js */

/* ─── Editor chrome ─── */
.editor {
  position: relative;
  max-width: 1480px;
  margin: 0 auto;
  background: var(--bg);
  border: 1px solid var(--border-line);
  border-radius: 0;
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.35),
    0 2px 6px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

/* Tab bar */
.editor-tabs {
  display: flex;
  align-items: stretch;
  height: var(--titlebar-h);
  background: var(--bg-titlebar);
  border-bottom: 1px solid var(--border-line);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--syn-text-mute);
  user-select: none;
}

.editor-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  height: 100%;
  background: transparent;
  border-right: 1px solid var(--border-line);
  cursor: default;
  letter-spacing: 0.02em;
}

.editor-tab.is-active {
  background: var(--bg);
  color: var(--syn-text);
  position: relative;
}

.editor-tab.is-active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--bg-status);
}

.editor-tab-icon {
  font-size: 13px;
  line-height: 1;
}

.editor-tab-name {
  font-weight: 500;
}

.editor-tab-meta {
  font-size: 10px;
  color: var(--syn-text-mute);
  letter-spacing: 0.06em;
  margin-left: 8px;
  text-transform: uppercase;
}

.editor-window-controls {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: 0;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--syn-text-mute);
  letter-spacing: 0.04em;
}

.editor-window-controls .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.editor-window-controls .dot.r { background: #ff5f56; }
.editor-window-controls .dot.y { background: #ffbd2e; }
.editor-window-controls .dot.g { background: #27c93f; margin-inline-end: 10px; }
.editor-window-controls .label { font-weight: 500; }

/* ─── Body grid: gutter + content ─── */
.editor-body {
  display: grid;
  grid-template-columns: var(--gutter-w) 1fr;
  align-items: stretch;
  min-height: 360px; /* POLISHED: less huge, more compact */
  max-height: calc(100vh - 220px); /* POLISHED: tighter */
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-line) transparent;
}
.editor-body::-webkit-scrollbar { width: 12px; }
.editor-body::-webkit-scrollbar-track { background: transparent; }
.editor-body::-webkit-scrollbar-thumb {
  background: var(--border-line);
  border-radius: 6px;
}
.editor-body::-webkit-scrollbar-thumb:hover { background: var(--syn-meta); }

/* Gutter (line numbers) */
.gutter {
  background: var(--bg-sidebar);
  color: var(--syn-text-mute);
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: var(--line-h);
  padding: 14px 12px 60px 8px; /* POLISHED: less huge */
  border-right: 1px solid var(--border-line);
  user-select: none;
  position: sticky;
  top: 0;
}

.gutter .ln {
  display: block;
  padding: 0 4px;
  font-variant-numeric: tabular-nums;
}

.gutter .ln.is-current {
  color: var(--syn-text);
  background: var(--hl-current);
}

/* Content column */
.code {
  padding: 14px 24px 60px 20px; /* POLISHED: less bottom padding */
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: var(--line-h);
  color: var(--syn-text);
  white-space: pre;
  overflow-x: auto;
  min-width: 0;
}

.code::-webkit-scrollbar { height: 12px; }
.code::-webkit-scrollbar-track { background: transparent; }
.code::-webkit-scrollbar-thumb { background: var(--border-line); border-radius: 6px; }

.code .row {
  display: block;
  min-height: var(--line-h);
  padding: 0 0 0 4px;
}

.code .row.is-current {
  background: var(--hl-current);
  margin: 0 -24px;
  padding: 0 24px 0 28px;
  border-left: 2px solid var(--bg-status);
}

/* Inline code styles */
.code .kw   { color: var(--syn-keyword); font-weight: 500; }
.code .fn   { color: var(--syn-fn); font-weight: 500; }
.code .str  { color: var(--syn-string); }
.code .num  { color: var(--syn-number); }
.code .cmt  { color: var(--syn-comment); font-style: italic; }
.code .typ  { color: var(--syn-type); }
.code .var  { color: var(--syn-var); }
.code .tag  { color: var(--syn-tag); }
.code .urgent { color: var(--syn-urgent); font-weight: 700; }
.code .err  { color: var(--syn-error); font-weight: 700; }
.code .meta { color: var(--syn-meta); }
.code .muted{ color: var(--syn-text-mute); }
.code .soft { color: var(--syn-text-soft); }
.code .bracket { color: var(--syn-bracket); }

/* Bracket-matching emphasis on hover */
.code .row.is-current .bracket { color: var(--syn-fn); }

/* Block headings inside code */
.code .section-rule {
  color: var(--syn-meta);
  letter-spacing: 0;
  white-space: pre;
}

/* ─── Activity bar (left vertical strip on wider viewports) ─── */
.activity-bar {
  display: none;
}

@media (min-width: 1100px) {
  .editor {
    display: grid;
    grid-template-columns: 48px 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "title tabs"
      "act  body";
  }
  .editor-tabs { grid-area: title; }
  .activity-bar {
    grid-area: act;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-line);
    border-top: 0;
  }
  .editor-body { grid-area: body; }
  .ab-icon {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-left: 2px solid transparent;
    color: var(--syn-text-mute);
    font-size: 16px;
    cursor: default;
  }
  .ab-icon.is-active {
    color: var(--syn-text);
    border-left-color: var(--bg-status);
  }
}

/* ─── Status bar ─── */
.statusbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--statusbar-h);
  background: var(--bg-status);
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  user-select: none;
  z-index: 50;
}

.statusbar .sb-cluster {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 12px;
  background: var(--bg-status);
}

.statusbar .sb-cluster.is-right {
  margin-inline-start: auto;
  background: var(--bg-status-2);
}

.statusbar .sb-cluster:hover {
  filter: brightness(1.1);
}

.statusbar .sb-icon {
  margin-inline-end: 6px;
  font-size: 11px;
}

.statusbar a, .statusbar a:visited {
  color: inherit;
  text-decoration: none;
}

.statusbar .sb-nav a {
  display: inline-flex;
  align-items: center;
  height: 100%;
  padding: 0 12px;
  font-weight: 500;
  border-right: 1px solid rgba(255, 255, 255, 0.18);
}

.statusbar .sb-nav a.is-active {
  background: rgba(255, 255, 255, 0.15);
}

.statusbar .sb-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* ─── Minimap (right-side abstract representation) ─── */
.minimap {
  display: none;
}

@media (min-width: 1280px) {
  .editor-body {
    grid-template-columns: var(--gutter-w) 1fr 88px;
  }
  .minimap {
    display: block;
    grid-column: 3;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border-line);
    padding: 16px 8px;
    overflow: hidden;
    position: relative;
  }
  .minimap-strip {
    position: absolute;
    inset: 16px 8px;
    background:
      linear-gradient(180deg,
        var(--syn-comment) 0 2px,
        transparent 2px 8px,
        var(--syn-keyword) 8px 10px,
        transparent 10px 14px,
        var(--syn-fn) 14px 16px,
        transparent 16px 22px,
        var(--syn-string) 22px 24px,
        transparent 24px 30px,
        var(--syn-comment) 30px 32px,
        transparent 32px 40px,
        var(--syn-keyword) 40px 42px,
        transparent 42px 48px,
        var(--syn-tag) 48px 50px,
        transparent 50px 60px,
        var(--syn-comment) 60px 62px,
        transparent 62px 72px,
        var(--syn-fn) 72px 74px,
        transparent 74px 82px,
        var(--syn-urgent) 82px 84px,
        transparent 84px 90px,
        var(--syn-meta) 90px 92px,
        transparent 92px 100px
      );
    opacity: 0.6;
  }
}

/* ═════════════════════════════════════════════════════════════
   CHAT — TOP, fixed, "terminal/console window"
════════════════════════════════════════════════════════════ */
#chat-host {
  position: fixed;
  top: 0.5rem; /* POLISHED: tighter */
  left: 50%;
  transform: translateX(-50%);
  z-index: 9000;
  width: min(1480px, calc(100% - 24px));
  direction: ltr;
}

.chat-bar {
  display: flex;
  flex-direction: column;
  background: var(--term-bg);
  border: 1px solid var(--term-border);
  border-radius: 6px;
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.55),
    0 2px 6px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  overflow: hidden;
  height: var(--chat-h);
}

/* Terminal title bar */
.chat-titlebar {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 30px;
  padding: 0 14px;
  background: #1f1f1f;
  border-bottom: 1px solid var(--term-border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--syn-text-mute);
  user-select: none;
  flex-shrink: 0;
}

.chat-titlebar-dots {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.chat-titlebar-dots .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #4a4a4a;
}
.chat-titlebar-dots .dot.r { background: #ff5f56; }
.chat-titlebar-dots .dot.y { background: #ffbd2e; }
.chat-titlebar-dots .dot.g { background: #27c93f; }

.chat-titlebar-name {
  font-weight: 600;
  color: var(--syn-text);
  letter-spacing: 0.04em;
}

.chat-titlebar-sep {
  width: 1px;
  height: 14px;
  background: var(--term-border);
}

.chat-titlebar-meta {
  display: inline-flex;
  gap: 14px;
  color: var(--syn-text-mute);
  font-size: 10.5px;
}

.chat-titlebar-meta b {
  color: var(--syn-fn);
  font-weight: 600;
}

.chat-titlebar-status {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--syn-text-mute);
  font-size: 10.5px;
}

.chat-titlebar-status .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #27c93f;
  box-shadow: 0 0 6px rgba(39, 201, 63, 0.6);
  animation: live-pulse 1.5s infinite ease-in-out;
}
@keyframes live-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* Terminal body */
.chat-body {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  flex: 1;
  min-height: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--term-fg);
  background: var(--term-bg);
}

/* Brand cluster (left) */
.chat-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-inline-end: 1px solid var(--term-border);
  background: rgba(255, 255, 255, 0.025);
  min-width: 200px;
}

.chat-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--bg-status);
  color: #ffffff;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  border-radius: 4px;
  letter-spacing: -0.04em;
}

.chat-head-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.chat-head-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--syn-text);
  letter-spacing: 0.01em;
}

.chat-head-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--syn-text-mute);
}

.chat-head-status .live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #27c93f;
  box-shadow: 0 0 4px rgba(39, 201, 63, 0.5);
}

.chat-subs {
  font-weight: 700;
  color: var(--syn-fn);
}

.chat-typing-status {
  font-style: italic;
  color: var(--syn-keyword);
}

/* Messages area */
.chat-messages {
  position: relative;
  overflow: hidden;
  padding: 8px 12px;
  background: var(--term-bg);
  min-width: 0;
}

.chat-messages-track {
  position: absolute;
  inset: 8px 12px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.45;
}

.chat-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 1px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-line.is-urgent {
  color: var(--syn-urgent);
}

.chat-prompt {
  color: var(--term-prompt);
  flex-shrink: 0;
}

.chat-tag {
  color: var(--syn-tag);
  font-weight: 600;
  flex-shrink: 0;
  min-width: 64px;
}

.chat-time {
  color: var(--syn-text-mute);
  flex-shrink: 0;
  min-width: 42px;
}

.chat-text {
  color: var(--syn-text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-line.is-urgent .chat-text {
  color: var(--syn-urgent);
  font-weight: 600;
}

.chat-line .urgent-tag {
  color: var(--syn-error);
  font-weight: 700;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

/* Typing indicator (terminal cursor) */
.chat-typing {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 1px 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--syn-text-mute);
}

.chat-typing.is-on {
  display: flex;
}

.chat-typing-prompt {
  color: var(--term-prompt);
}

.chat-typing-cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--term-prompt);
  box-shadow: 0 0 4px rgba(86, 156, 214, 0.5);
  animation: cursor-blink 1.05s steps(2, start) infinite;
  vertical-align: -2px;
}

@keyframes cursor-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Input cluster */
.chat-input {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-inline-start: 1px solid var(--term-border);
  background: rgba(255, 255, 255, 0.02);
  min-width: 220px;
}

.chat-input-prompt {
  color: var(--term-prompt);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}

.chat-input-field {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--syn-text-mute);
  background: transparent;
  border: 0;
  outline: 0;
  padding: 2px 0;
  letter-spacing: 0.01em;
  cursor: text;
}

.chat-input-cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background: var(--term-prompt);
  box-shadow: 0 0 4px rgba(86, 156, 214, 0.5);
  animation: cursor-blink 1.05s steps(2, start) infinite;
}

/* Skin switcher */
.chat-skin {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px;
  border-inline-start: 1px solid var(--term-border);
  background: rgba(255, 255, 255, 0.025);
}

.skin-btn {
  width: 26px;
  height: 22px;
  border: 1px solid var(--term-border);
  background: var(--bg-sidebar);
  color: var(--syn-text-mute);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  border-radius: 3px;
  letter-spacing: 0;
}

.skin-btn.active {
  background: var(--bg-status);
  border-color: var(--bg-status);
  color: #ffffff;
}

/* Skin palette overrides */
.chat-bar.skin-wa .chat-titlebar { border-bottom: 2px solid var(--skin-wa-bar); }
.chat-bar.skin-tg .chat-titlebar { border-bottom: 2px solid var(--skin-tg-bar); }
.chat-bar.skin-ms .chat-titlebar {
  border-bottom: 2px solid transparent;
  background-image: linear-gradient(90deg, rgba(0, 132, 255, 0.2) 0%, rgba(123, 104, 238, 0.2) 100%), linear-gradient(#1f1f1f, #1f1f1f);
}

.chat-bar.skin-wa .skin-btn.active { background: var(--skin-wa-bar); border-color: var(--skin-wa-bar); }
.chat-bar.skin-tg .skin-btn.active { background: var(--skin-tg-bar); border-color: var(--skin-tg-bar); }
.chat-bar.skin-ms .skin-btn.active {
  background: linear-gradient(90deg, #0084ff 0%, #7b68ee 100%);
  border-color: transparent;
}

.chat-bar.skin-wa .chat-line.is-urgent { color: #ff8a80; }
.chat-bar.skin-tg .chat-line.is-urgent { color: #ffd180; }
.chat-bar.skin-ms .chat-line.is-urgent { color: #ff80ab; }

/* ─── Hover row in code ─── */
.code .row {
  cursor: default;
  white-space: pre;
}

.code a.row-link {
  color: inherit;
  text-decoration: none;
  display: block;
  cursor: pointer;
  white-space: pre;
}

.code a.row-link:hover {
  background: var(--bg-hover);
  margin: 0 -24px;
  padding: 0 24px 0 28px;
}

/* Blockquote / article preview when row is clicked */
.code-preview {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(720px, calc(100% - 40px));
  max-height: 80vh;
  background: var(--bg);
  border: 1px solid var(--bg-status);
  border-radius: 4px;
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.6),
    0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 9100;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.code-preview.is-open {
  display: flex;
}

.code-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-titlebar);
  border-bottom: 1px solid var(--border-line);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--syn-text-mute);
}

.code-preview-name {
  color: var(--syn-text);
  font-weight: 600;
}

.code-preview-close {
  background: transparent;
  border: 0;
  color: var(--syn-text-mute);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 2px 6px;
}

.code-preview-close:hover {
  color: var(--syn-error);
}

.code-preview-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 24px;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--syn-text);
}

.code-preview-body h2 {
  font-size: 16px;
  margin: 0 0 8px 0;
  color: var(--syn-fn);
}

.code-preview-body .eyebrow {
  color: var(--syn-keyword);
  font-weight: 600;
  letter-spacing: 0.04em;
  font-size: 11px;
  margin-bottom: 6px;
}

.code-preview-body .meta {
  color: var(--syn-text-mute);
  font-size: 11.5px;
  margin-bottom: 16px;
}

.code-preview-body .excerpt {
  color: var(--syn-text);
  border-left: 2px solid var(--bg-status);
  padding-left: 12px;
  margin: 12px 0;
  background: var(--hl-current);
  margin-left: -12px;
  padding: 8px 12px 8px 16px;
  font-style: italic;
}

.code-preview-body p {
  margin: 0 0 10px 0;
}

.code-preview-body .tldr {
  background: rgba(86, 156, 214, 0.08);
  border-left: 3px solid var(--syn-keyword);
  padding: 8px 12px;
  margin: 12px 0;
  color: var(--syn-keyword);
  font-weight: 500;
}

.code-preview-body .takeaways {
  border-left: 3px solid var(--syn-tag);
  padding: 6px 12px;
  margin: 12px 0;
}

.code-preview-body .takeaways ul {
  margin: 6px 0 0 16px;
  padding: 0;
}

.code-preview-body .sources {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--border-line);
  color: var(--syn-text-mute);
  font-size: 11.5px;
}

.code-preview-body .sources a {
  color: var(--syn-type);
  text-decoration: underline dotted;
  display: block;
  margin: 4px 0;
}

/* ─── Article page: function callouts ─── */
.code .row.fn-decl {
  color: var(--syn-fn);
  font-weight: 600;
}

.code .row.fn-name {
  color: var(--syn-fn);
}

.code .row .type-decl {
  color: var(--syn-type);
}

/* ─── News page: console.log emphasis ─── */
.code .row.log {
  color: var(--syn-text);
}

.code .row.log.is-breaking {
  color: var(--syn-error);
  font-weight: 600;
}

.code .row.log.is-high {
  color: var(--syn-urgent);
  font-weight: 500;
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  .chat-titlebar-status .live-dot,
  .chat-typing-cursor,
  .chat-input-cursor {
    animation: none !important;
  }
}

/* ─── Mobile / narrow ─── */
@media (max-width: 760px) {
  body { padding-top: calc(var(--chat-h) + 36px); }
  .chat-bar { height: auto; }
  .chat-body { grid-template-columns: 1fr; }
  .chat-brand, .chat-input, .chat-skin {
    border: 0;
    border-top: 1px solid var(--term-border);
    min-width: 0;
  }
  .editor-tabs { font-size: 11px; }
  .editor-tab { padding: 0 10px; }
  .editor-window-controls { display: none; }
  .code { font-size: 12.5px; padding: 12px 14px 200px 14px; white-space: pre; }
  .gutter { font-size: 11px; padding: 12px 6px 200px 4px; }
  .code .row.is-current, .code a.row-link:hover { margin: 0 -14px; padding: 0 14px 0 18px; }
}

@media (max-width: 420px) {
  .code { font-size: 11.5px; }
  .gutter { font-size: 10.5px; }
}

/* ─── Print: just text ─── */
@media print {
  #chat-host, .statusbar, .editor-tabs, .gutter, .minimap, .activity-bar { display: none; }
  .editor { box-shadow: none; border: 0; }
  .editor-body { display: block; max-height: none; overflow: visible; }
  .code { white-space: pre-wrap; word-break: break-word; }
}
