.page-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 31px;
  font-weight: 600;
  color: var(--text);
}

.title-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  color: var(--accent);
}

.file-header {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.back-link {
  display: inline-block;
  color: var(--text);
  opacity: 0.85;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.file-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 4px;
}

/* Breadcrumb pill */
.crumb {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 7px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  color: var(--muted);
}

.crumb-file {
  color: var(--text);
  font-weight: 600;
}

.crumb-sep {
  color: var(--muted);
  opacity: 0.6;
}

/* Toolbar action buttons */
.file-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.fv-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  padding: 7px 12px;
  cursor: pointer;
  text-decoration: none;
}

.fv-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

.fv-btn:hover {
  background: var(--panel-2);
}

.fv-btn.is-active {
  color: var(--accent-text);
  background: var(--accent);
  border-color: var(--accent);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.image-panel img {
  max-width: 100%;
  border-radius: 14px;
  display: block;
}

/* Code panel */
.code-panel {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.code-lang {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}

.lang-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.code-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Row below the toolbar: scrollable code + minimap side by side */
.code-body {
  display: flex;
  align-items: stretch;
}

.code-scroll {
  flex: 1 1 auto;
  min-width: 0;
  max-height: 70vh;
  overflow: auto;
  background: var(--code-bg);
}

.code-grid {
  display: flex;
  align-items: flex-start;
  min-width: max-content;
  width: 100%;
}

.line-gutter {
  position: sticky;
  left: 0;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  padding: 16px 12px 16px 16px;
  background: var(--code-bg);
  border-right: 1px solid var(--code-line);
  color: var(--code-linenum);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.65;
  text-align: right;
  user-select: none;
}

#fvPre.wrap ~ .line-gutter,
.code-grid:has(#fvPre.wrap) .line-gutter {
  display: none;
}

.code-grid:has(#fvPre.wrap) {
  width: 100%;
}

#fvPre {
  margin: 0;
  padding: 16px 18px;
  flex: 1 1 auto;
  min-width: 0;

  font-size: 13px;
  line-height: 1.65;
  white-space: pre;
}

#fvPre.wrap {
  white-space: pre-wrap;
  word-break: break-word;
}

#fvCode {
  color: var(--code-fg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* Minimap */
.minimap {
  position: relative;
  flex: 0 0 90px;
  width: 90px;
  max-height: 70vh;
  border-left: 1px solid var(--line);
  background: color-mix(in srgb, var(--text) 3%, transparent);
  cursor: pointer;
  overflow: hidden;
}

.minimap-track {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 6px 8px;
  gap: 1px;
}

.mm-line {
  flex: 1 1 0;
  min-height: 0;
  background: var(--accent);
  border-radius: 1px;
}

.minimap-viewport {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  background: color-mix(in srgb, var(--text) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 25%, transparent);
  border-radius: 3px;
  pointer-events: none;
}

@media (max-width: 900px) {
  .minimap {
    display: none;
  }
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

/* ─────────────────────────
   Syntax theme — shifts with site light/dark theme
───────────────────────── */

:root {
  --code-bg: #fafafa;
  --code-fg: #383a42;
  --code-line: rgba(56, 58, 66, 0.12);
  --code-linenum: rgba(56, 58, 66, 0.4);
}

html[data-theme="dark"] {
  --code-bg: #282c34;
  --code-fg: #abb2bf;
  --code-line: rgba(171, 178, 191, 0.12);
  --code-linenum: rgba(171, 178, 191, 0.4);
}

.hljs-comment,
.hljs-quote {
  color: #a0a1a7;
  font-style: italic;
}

html[data-theme="dark"] .hljs-comment,
html[data-theme="dark"] .hljs-quote {
  color: #5c6370;
}

.hljs-doctag,
.hljs-keyword,
.hljs-formula {
  color: #a626a4;
}

html[data-theme="dark"] .hljs-doctag,
html[data-theme="dark"] .hljs-keyword,
html[data-theme="dark"] .hljs-formula {
  color: #c678dd;
}

.hljs-section,
.hljs-name,
.hljs-selector-tag,
.hljs-deletion,
.hljs-subst {
  color: #e45649;
}

html[data-theme="dark"] .hljs-section,
html[data-theme="dark"] .hljs-name,
html[data-theme="dark"] .hljs-selector-tag,
html[data-theme="dark"] .hljs-deletion,
html[data-theme="dark"] .hljs-subst {
  color: #e06c75;
}

.hljs-literal {
  color: #0184bb;
}

html[data-theme="dark"] .hljs-literal {
  color: #56b6c2;
}

.hljs-string,
.hljs-regexp,
.hljs-addition,
.hljs-attribute,
.hljs-meta-string {
  color: #50a14f;
}

html[data-theme="dark"] .hljs-string,
html[data-theme="dark"] .hljs-regexp,
html[data-theme="dark"] .hljs-addition,
html[data-theme="dark"] .hljs-attribute,
html[data-theme="dark"] .hljs-meta-string {
  color: #98c379;
}

.hljs-built_in,
.hljs-class .hljs-title {
  color: #c18401;
}

html[data-theme="dark"] .hljs-built_in,
html[data-theme="dark"] .hljs-class .hljs-title {
  color: #e6c07b;
}

.hljs-attr,
.hljs-variable,
.hljs-template-variable,
.hljs-type,
.hljs-selector-class,
.hljs-selector-attr,
.hljs-selector-pseudo,
.hljs-number {
  color: #986801;
}

html[data-theme="dark"] .hljs-attr,
html[data-theme="dark"] .hljs-variable,
html[data-theme="dark"] .hljs-template-variable,
html[data-theme="dark"] .hljs-type,
html[data-theme="dark"] .hljs-selector-class,
html[data-theme="dark"] .hljs-selector-attr,
html[data-theme="dark"] .hljs-selector-pseudo,
html[data-theme="dark"] .hljs-number {
  color: #d19a66;
}

.hljs-symbol,
.hljs-bullet,
.hljs-link,
.hljs-meta,
.hljs-selector-id,
.hljs-title {
  color: #4078f2;
}

html[data-theme="dark"] .hljs-symbol,
html[data-theme="dark"] .hljs-bullet,
html[data-theme="dark"] .hljs-link,
html[data-theme="dark"] .hljs-meta,
html[data-theme="dark"] .hljs-selector-id,
html[data-theme="dark"] .hljs-title {
  color: #61aeee;
}

.hljs-emphasis {
  font-style: italic;
}

.hljs-strong {
  font-weight: bold;
}

.hljs-link {
  text-decoration: underline;
}

@media (max-width: 700px) {
  .file-toolbar-row {
    flex-direction: column;
    align-items: stretch;
  }

  .file-actions {
    justify-content: flex-start;
  }
}
