:root {
  /* surfaces — warm cream */
  --bg: #faf7ef;
  --bg-subtle: #f0eee6;
  --surface: #ffffff;
  --border: #e2ddce;
  --border-muted: #ece7d9;
  --shadow: 0 1px 2px rgba(26, 19, 0, .05), 0 1px 3px rgba(26, 19, 0, .04);
  --shadow-hover: 0 4px 14px rgba(26, 19, 0, .12);
  /* text */
  --text: #1a1300;
  --muted: #6c6658;              /* WCAG AA on cream & white (was #8a8578, ~3.4:1) */
  --link: #a85c08;               /* AA as text on white/cream (was #b8670b, ~4.2:1) */
  /* accent — burnt orange / amber */
  --accent: #a85c08;
  --accent-hover: #8f4e06;
  --accent-fg: #ffffff;
  --accent-soft: rgba(168, 92, 8, .10);
  --focus: rgba(168, 92, 8, .32);
  /* dark top nav */
  --nav-bg: #1a1300;
  --nav-fg: #f5f1e6;
  --nav-muted: #b8b0a0;
  --nav-border: rgba(0, 0, 0, .5);
  /* diff palette (readable on cream, warm hunk header) */
  --add-bg: #e7f7e2; --add-gutter: #cdeec3; --add-fg: #256029;
  --del-bg: #fbe7e4; --del-gutter: #f6d2cd; --del-fg: #9a2b1e;
  --hunk-bg: #fdf1db; --hunk-fg: #a85c08;
  --badge-add: #3f8f2e; --badge-del: #c23a26; --badge-mod: #a85c08;

  font-size: 15px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #17150f;
  --bg-subtle: #1f1c15;
  --surface: #201d16;
  --border: #3a352b;
  --border-muted: #2a2720;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --shadow-hover: 0 4px 16px rgba(0,0,0,.5);
  --text: #f0eee6;
  --muted: #a89f8d;
  --link: #f0a94a;
  --accent: #e0912f;
  --accent-hover: #f3a834;
  --accent-fg: #17150f;
  --accent-soft: rgba(224,145,47,.14);
  --focus: rgba(224,145,47,.4);
  --nav-bg: #0e0d0c;
  --nav-fg: #f5f1e6;
  --nav-muted: #a89f8d;
  --nav-border: rgba(0,0,0,.6);
  --add-bg: #132a1c; --add-gutter: #1c3f28; --add-fg: #7ee0a0;
  --del-bg: #2e1618; --del-gutter: #4a1f23; --del-fg: #ffa7ae;
  --hunk-bg: #2b2413; --hunk-fg: #f0a94a;
  --badge-add: #2ea043; --badge-del: #f85149; --badge-mod: #d29922;
  color-scheme: dark;
}

/* dark syntax tokens (GitHub-dark-ish, high contrast on the dark ground) */
:root[data-theme="dark"] .t-kw    { color: #ff7b72; }
:root[data-theme="dark"] .t-type  { color: #ffa657; }
:root[data-theme="dark"] .t-s     { color: #a5d6ff; }
:root[data-theme="dark"] .t-num   { color: #79c0ff; }
:root[data-theme="dark"] .t-c     { color: #8b949e; }
:root[data-theme="dark"] .t-macro { color: #d2a8ff; }
:root[data-theme="dark"] .t-attr  { color: #8b949e; }
:root[data-theme="dark"] .t-life  { color: #ffa657; }
:root[data-theme="dark"] .line-thread,
:root[data-theme="dark"] .line-composer { background: #23201a; }
:root[data-theme="dark"] .dline:hover .ln { background: #3a2f1a; }

* { box-sizing: border-box; }

html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- top nav ---------------- */
.topnav {
  flex: none;
  display: flex; align-items: center; gap: 20px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--nav-border);
  background: var(--nav-bg);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--nav-fg); font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand b { font-weight: 700; }
.brand span { font-weight: 500; letter-spacing: .2px; }
.brand-mark { display: block; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.topnav-links { display: flex; align-items: center; gap: 18px; margin-left: auto; font-size: 14px; }
.topnav-links a { color: var(--nav-muted); }
.topnav-links a:hover { color: var(--nav-fg); text-decoration: none; }
.theme-toggle {
  background: transparent; border: 1px solid var(--nav-muted); color: var(--nav-fg);
  width: 30px; height: 30px; border-radius: 50%; font-size: 14px; line-height: 1; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.theme-toggle:hover { border-color: var(--nav-fg); background: rgba(255,255,255,.08); }
.signin { background: var(--accent); color: var(--accent-fg) !important; padding: 6px 12px; border-radius: 8px; font-weight: 600; }
.signin:hover { background: var(--accent-hover); text-decoration: none; }
.auth-user { display: flex; align-items: center; gap: 8px; color: var(--nav-fg); }
.auth-user img { border-radius: 50%; display: block; }
.auth-user a { color: var(--nav-muted); font-size: 13px; }

/* note threads (issue-backed notes) */
.notes-wrap { padding: 4px 0 0; }
.thread { padding: 14px 16px; border-bottom: 1px solid var(--border-muted); }
.thread-title { font-weight: 600; margin-bottom: 10px; }
.thread-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.note { display: flex; gap: 10px; }
.note-av { border-radius: 50%; flex: none; }
.note-main { flex: 1; min-width: 0; }
.note-head { font-size: 13px; margin-bottom: 2px; }
.note-head a { text-decoration: none; }
.note-body { font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.composer textarea { width: 100%; font-family: inherit; font-size: 13.5px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; resize: vertical; }
.composer textarea:focus { outline: 3px solid var(--focus); border-color: var(--accent); }
.composer-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.composer-row .as { font-size: 12.5px; margin-left: auto; }
.composer-status { font-size: 12px; margin-top: 6px; min-height: 14px; }

#view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

/* ---------------- shared ---------------- */
.loading, .empty { color: var(--muted); padding: 40px; text-align: center; font-size: 14px; }
.spinner { color: var(--muted); padding: 18px; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.spinner::before {
  content: ""; flex: none; width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: cd-spin .7s linear infinite;
}
@keyframes cd-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner::before { animation-duration: 2.2s; } }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; }

button {
  font-family: inherit; font-size: 14px; cursor: pointer;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
}
button:hover { background: var(--bg-subtle); }
button.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); font-weight: 600; }
button.primary:hover { background: var(--accent-hover); }

input[type=search], input[type=text], select {
  font-family: inherit; font-size: 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; width: 100%;
}
input:focus, select:focus, button:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--accent);
}
/* keyboard focus for the non-native interactive elements (tabs, tree rows) */
.tab:focus-visible, .file-row:focus-visible, .tree-folder:focus-visible {
  outline: 2px solid var(--accent); outline-offset: -2px;
}

/* ================ LANDING ================ */
.landing { max-width: 1120px; width: 100%; margin: 0 auto; padding: 32px 22px 60px; }
.hero { text-align: center; padding: 32px 0 10px; }
.hero-logo { display: block; width: 104px; height: 104px; margin: 0 auto 16px; border-radius: 50%; object-fit: cover; box-shadow: var(--shadow-hover); }
/* the logo PNG has a baked cream disc; frame it in dark mode so it reads as intentional, not a sticker */
:root[data-theme="dark"] .hero-logo { box-shadow: 0 0 0 1px var(--border), var(--shadow-hover); }
:root[data-theme="dark"] .brand-mark { box-shadow: 0 0 0 1px rgba(255,255,255,.08); }
.hero h1 { font-size: 40px; margin: 0 0 6px; letter-spacing: -.5px; }
.hero h1 b { color: var(--accent); }
.hero p { color: var(--muted); font-size: 15px; margin: 0; }

.search-hero { max-width: 660px; margin: 26px auto 8px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 2px solid var(--border);
  border-radius: 12px; padding: 6px 6px 6px 14px; box-shadow: var(--shadow);
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--focus); }
.search-box svg { color: var(--muted); flex: none; }
.search-box input {
  border: none; outline: none; background: transparent; font-size: 16px; padding: 8px 4px; flex: 1;
}
.search-box button.primary { border-radius: 8px; padding: 9px 20px; flex: none; }

.columns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 44px; }
.column h2 {
  text-align: left; color: var(--accent); font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .09em;
  margin: 0 0 14px; padding-bottom: 9px; border-bottom: 1px solid var(--border);
}
.card-list { display: flex; flex-direction: column; gap: 12px; }

.crate-card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px; color: var(--text);
  box-shadow: var(--shadow); transition: border-color .12s, box-shadow .12s;
}
.crate-card:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-hover); }
.crate-card .head { display: flex; align-items: baseline; gap: 8px; }
.crate-card .name { font-weight: 700; font-size: 15px; }
.crate-card .ver { color: var(--muted); font-size: 13px; }
.crate-card .cubes { margin-left: auto; color: var(--accent); flex: none; }
.crate-card .desc {
  color: var(--muted); font-size: 13px; margin-top: 6px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ================ SEARCH RESULTS ================ */
.results { max-width: 760px; width: 100%; margin: 0 auto; padding: 26px 22px 60px; }
.results .back { font-size: 14px; color: var(--muted); }
.results h2 { font-size: 20px; margin: 14px 0 18px; }
.result-row {
  display: block; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 10px; color: var(--text); background: var(--surface); box-shadow: var(--shadow);
}
.result-row:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow-hover); }
.result-row .head { display: flex; align-items: baseline; gap: 8px; }
.result-row .name { font-weight: 700; }
.result-row .meta { color: var(--muted); font-size: 13px; }
.result-row .desc { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* static SEO / no-JS landing content (replaced by the app when JS runs) */
.seo-content { max-width: 760px; margin: 28px auto 0; line-height: 1.65; }
.seo-content h2 { font-size: 21px; margin: 30px 0 10px; }
.seo-content h3 { font-size: 16px; margin: 22px 0 6px; }
.seo-content p { margin: 0 0 12px; color: var(--text); }
.seo-content ul { margin: 0 0 14px; padding-left: 20px; }
.seo-content li { margin: 5px 0; }
.seo-content code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: var(--bg-subtle); border: 1px solid var(--border-muted); border-radius: 5px; padding: 1px 5px; }
.seo-links { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding-left: 0 !important; }
.seo-links li { margin: 0; }
.seo-links a {
  display: inline-block; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 5px 13px; font-size: 13px; font-weight: 600;
}
.seo-links a:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }
.seo-cta { margin-top: 18px; font-weight: 600; }

/* about page */
.about { line-height: 1.65; }
.about h2 { margin: 14px 0 16px; }
.about h3 { margin: 26px 0 8px; font-size: 16px; }
.about p { margin: 0 0 12px; }
.about-list { margin: 0 0 12px; padding-left: 20px; }
.about-list li { margin: 4px 0; }

/* ================ COMPARE VIEW ================ */
.compare { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }

.cmp-bar {
  flex: none; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 20px; border-bottom: 1px solid var(--border-muted); background: var(--bg-subtle);
}
.cmp-bar .crate-name { font-size: 18px; font-weight: 700; }
.cmp-bar .crate-name a { color: var(--text); }
.cmp-vers { display: flex; align-items: center; gap: 8px; }
.cmp-vers .arrow { color: var(--muted); }

/* filterable version combobox (replaces native <select>) */
.ver-picker { position: relative; }
.ver-trigger {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
  min-width: 132px; max-width: 220px; font-family: inherit; font-size: 14px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.ver-trigger:hover { background: var(--surface); border-color: var(--accent); }
.ver-trigger .ver-cur { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ver-trigger .ver-caret { color: var(--muted); font-size: 10px; flex: none; }
.ver-trigger[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.ver-pop {
  position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; width: max-content;
  min-width: 100%; max-width: 280px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-hover); padding: 6px;
}
.ver-filter {
  width: 100%; font-family: inherit; font-size: 13px; margin-bottom: 6px;
  background: var(--bg-subtle); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px;
}
.ver-filter:focus { outline: 2px solid var(--focus); border-color: var(--accent); }
.ver-list { list-style: none; margin: 0; padding: 0; max-height: 264px; overflow-y: auto; }
.ver-opt {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 6px 9px; border-radius: 6px; cursor: pointer; font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.ver-opt:hover, .ver-opt.active { background: var(--accent-soft); }
.ver-opt.sel { font-weight: 700; color: var(--accent); }
.ver-yanked {
  flex: none; font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--badge-del); border: 1px solid var(--badge-del); border-radius: 10px; padding: 0 5px;
}
.ver-empty { padding: 8px 9px; color: var(--muted); font-size: 13px; }
.cmp-bar .swap { padding: 8px 10px; line-height: 1; }
.cmp-bar .summary { margin-left: auto; color: var(--muted); font-size: 13px; }
.cmp-bar .summary b { color: var(--text); }
/* "Files" drawer toggle — desktop shows the tree permanently, so hide it there */
.files-toggle { display: none; align-items: center; gap: 6px; font-weight: 600; padding: 7px 11px; }
.files-toggle[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.cmp-body { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: 340px 1fr; }
.cmp-side { border-right: 1px solid var(--border-muted); min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.cmp-main { min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

.side-search { flex: none; padding: 10px 12px; border-bottom: 1px solid var(--border-muted); }
.file-summary { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 14px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--border-muted); }
.file-summary .fs-toggle {
  margin-left: auto; flex: none; background: none; border: none; padding: 2px 4px;
  font: inherit; color: var(--link); cursor: pointer; border-radius: 6px;
}
.file-summary .fs-toggle:hover { text-decoration: underline; background: none; }
.file-list { flex: 1 1 auto; overflow-y: auto; min-height: 0; }

.file-row {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px;
  border-bottom: 1px solid var(--border-muted); cursor: pointer; font-size: 13px;
}
.file-row:hover { background: var(--bg-subtle); }
.file-row.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.file-row .path { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; }
.file-row.unchanged .path { color: var(--muted); }
.file-row .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row.unchanged .fname { color: var(--muted); }

/* directory tree */
.tree-folder {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px 7px 8px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--border-muted); user-select: none;
}
.tree-folder:hover { background: var(--bg-subtle); }
.tree-folder .chev { width: 11px; flex: none; color: var(--muted); font-size: 10px; transition: transform .12s; }
.tree-folder.collapsed .chev { transform: rotate(-90deg); }
.tree-folder .fname { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat { font-variant-numeric: tabular-nums; font-size: 12px; flex: none; }
.stat .a { color: var(--add-fg); }
.stat .d { color: var(--del-fg); }

.badge {
  font-size: 10px; padding: 1px 6px; border-radius: 20px; color: #fff; font-weight: 700;
  text-transform: uppercase; letter-spacing: .03em; flex: none;
}
.badge.added { background: var(--badge-add); }
.badge.removed { background: var(--badge-del); }
.badge.modified { background: var(--badge-mod); }

.match-line { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); padding: 2px 14px 2px 22px; cursor: pointer; }
.match-line:hover { background: var(--bg-subtle); }
.match-line b { color: var(--accent); font-weight: 700; }

/* tabs */
.tabs { flex: none; display: flex; gap: 2px; padding: 8px 14px 0; border-bottom: 1px solid var(--border-muted); background: var(--bg-subtle); }
.tab { padding: 8px 14px; border: 1px solid transparent; border-bottom: none; border-radius: 8px 8px 0 0; cursor: pointer; color: var(--muted); font-size: 14px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); background: var(--bg); border-color: var(--border-muted); border-bottom-color: var(--bg); margin-bottom: -1px; font-weight: 600; }
.tabpanes { flex: 1 1 auto; overflow-y: auto; min-height: 0; }
.tabpane { display: none; }
.tabpane.active { display: block; }

.pad { padding: 12px 16px; }

/* diff */
.diff { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.55; }
.file-head { padding: 10px 16px; border-bottom: 1px solid var(--border-muted); display: flex; align-items: center; gap: 8px; }
.hunk-header { color: var(--hunk-fg); background: var(--hunk-bg); padding: 3px 16px; border-top: 1px solid var(--border-muted); border-bottom: 1px solid var(--border-muted); }
.dline { display: flex; white-space: pre; }
.dline .ln { width: 44px; text-align: right; padding: 0 8px; color: var(--muted); user-select: none; flex: none; }
.dline .tx { padding: 0 8px; flex: 1; }
.dline .tx { color: var(--text); }
.dline.add { background: var(--add-bg); }
.dline.add .ln { background: var(--add-gutter); }
.dline.del { background: var(--del-bg); }
.dline.del .ln { background: var(--del-gutter); }
.dline .sign { width: 14px; flex: none; text-align: center; color: var(--muted); }

/* syntax tokens (readable on white + the pale add/del backgrounds) */
.t-kw    { color: #cf222e; }
.t-type  { color: #953800; }
.t-s     { color: #0a3069; }
.t-num   { color: #0550ae; }
.t-c     { color: #6e7781; font-style: italic; }
.t-macro { color: #8250df; }
.t-attr  { color: #6e7781; }
.t-life  { color: #953800; }

/* inline line comments */
.cmt-hint { color: var(--muted); font-size: 12px; font-weight: 400; }
.dline:hover .ln { cursor: pointer; color: var(--accent); background: #fbe9cf; }
.dline.has-comments { box-shadow: inset 3px 0 0 var(--accent); }
.line-thread, .line-composer {
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  white-space: normal;
  background: #fff8ec;
  border-top: 1px solid var(--border-muted);
  border-bottom: 1px solid var(--border-muted);
  padding: 10px 14px 10px 56px;
}
.line-thread .note { margin-bottom: 8px; }
.line-thread .reply-c { font-size: 12px; padding: 4px 10px; }
.line-composer textarea { width: 100%; max-width: 640px; font-family: inherit; font-size: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; resize: vertical; }
.line-composer textarea:focus { outline: 3px solid var(--focus); border-color: var(--accent); }
.line-composer .composer-row { display: flex; gap: 8px; margin-top: 8px; max-width: 640px; }
.line-composer button { font-size: 13px; }

/* unified/split view toggle */
.view-toggle { margin-left: auto; display: inline-flex; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; flex: none; }
.view-toggle button { border: none; border-radius: 0; padding: 4px 11px; font-size: 12px; background: var(--surface); color: var(--muted); }
.view-toggle button.active { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.view-toggle button:not(.active):hover { background: var(--bg-subtle); color: var(--text); }

/* split (side-by-side) diff */
.diff { overflow-x: auto; }
.diff.split .drow { display: flex; }
.diff.split .dside { display: flex; flex: 1 1 50%; min-width: 0; border-right: 1px solid var(--border-muted); }
.diff.split .dside:last-child { border-right: none; }
.diff.split .dside .ln { width: 40px; text-align: right; padding: 0 6px; color: var(--muted); user-select: none; flex: none; }
.diff.split .dside .tx { padding: 0 8px; flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-word; }
.diff.split .dside.del { background: var(--del-bg); }
.diff.split .dside.del .ln { background: var(--del-gutter); }
.diff.split .dside.add { background: var(--add-bg); }
.diff.split .dside.add .ln { background: var(--add-gutter); }
.diff.split .dside.empty { background: var(--bg-subtle); }
.diff.split .dside.has-comments { box-shadow: inset 3px 0 0 var(--accent); }
.diff.split .dside[data-anchor]:hover .ln { cursor: pointer; color: var(--accent); background: #fbe9cf; }
:root[data-theme="dark"] .diff.split .dside[data-anchor]:hover .ln { background: #3a2f1a; }

/* GitHub header icon */
.gh-link { color: var(--nav-muted); display: inline-flex; align-items: center; }
.gh-link:hover { color: var(--nav-fg); }

/* --- mobile / dynamic sizing --- */
@media (max-width: 560px) {
  :root { font-size: 14px; }
  .topnav { gap: 10px; padding: 10px 12px; }
  .topnav-links { gap: 12px; }
  .signin { padding: 6px 10px; }
  .sm-hide { display: none; }           /* shorten "Sign in with GitHub" -> "Sign in" */
  .cmt-hint { display: none; }          /* keep the file header tidy on phones */
  .file-head { flex-wrap: wrap; }
  .hero { padding: 20px 0 8px; }
  .hero h1 { font-size: 30px; }
  .hero p { font-size: 14px; }
  .search-box { padding: 5px 5px 5px 12px; }
  .search-box input { font-size: 15px; }
  .search-box button.primary { padding: 9px 14px; }
  .landing, .results { padding-left: 16px; padding-right: 16px; }
  .cmp-bar { padding: 10px 14px; gap: 8px; }
  .cmp-bar .summary { margin-left: 0; width: 100%; }
  .auth-user span { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 400px) {
  .brand span { display: none; }        /* logo-only brand on very small screens */
}

/* github */
.commit { padding: 12px 16px; border-bottom: 1px solid var(--border-muted); }
.commit .summary-line { font-weight: 600; }
.commit .meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.pill { display: inline-block; background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 20px; padding: 1px 9px; font-size: 12px; margin: 2px 4px 2px 0; }

/* notes */
.note-block { padding: 14px 16px; max-width: 720px; }
.note-block label { display: block; color: var(--muted); font-size: 13px; margin: 0 0 6px; }
.note-block textarea {
  width: 100%; font-family: inherit; font-size: 13.5px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; resize: vertical;
}
.note-block textarea:focus { outline: 3px solid var(--focus); border-color: var(--accent); }
.note-status { font-size: 12px; color: var(--muted); margin: 6px 0 16px; height: 14px; }

/* responsive */
@media (max-width: 900px) {
  .columns { grid-template-columns: 1fr; }
  .cmp-body { grid-template-columns: 1fr; }
  .cmp-side { border-right: none; border-bottom: 1px solid var(--border-muted); }
  /* keep the version bar + tabs in reach while scrolling the stacked layout */
  .cmp-bar { position: sticky; top: 0; z-index: 6; }
  .tabs { position: sticky; top: 0; z-index: 5; }
  /* the file tree is a drawer: collapsed by default so the diff owns the screen */
  .files-toggle { display: inline-flex; }
  .compare:not(.show-files) .cmp-side { display: none; }
  .compare.show-files .cmp-side { display: flex; max-height: 62vh; }
}

/* side-by-side diff is unreadable in a ~160px column — force unified on phones */
@media (max-width: 700px) {
  .view-toggle { display: none; }
}
