/* Professional Markdown Styling - Direct CSS Implementation */

/* Base article container */
/* PROSE stays a readable column; DATA (a table) uses the page. The article itself is uncapped, so each direct
   child is capped here instead — which keeps every existing doc reading exactly as it did at max-w-3xl, and lets
   a wide table break out of it. */
.markdown-content > * {
  max-width: 48rem;
}

.markdown-content > table,
.markdown-content > .table-scroll {
  max-width: calc(100vw - 6rem);
}

.markdown-content {
  color: #f9fafb;
  line-height: 1.625;
}

/* Headings with consistent hierarchy */
.markdown-content h1 {
  font-size: 1.875rem;
  font-weight: 700;
  color: #ffffff;
  margin-top: 2rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #374151;
}

.markdown-content h1:first-child {
  margin-top: 0;
}

.markdown-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #ffffff;
  margin-top: 2rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #1f2937;
}

.markdown-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #ffffff;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
}

.markdown-content h4 {
  font-size: 1.125rem;
  font-weight: 600;
  color: #e5e7eb;
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
}

.markdown-content h5 {
  font-size: 1rem;
  font-weight: 600;
  color: #e5e7eb;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}

.markdown-content h6 {
  font-size: 0.875rem;
  font-weight: 600;
  color: #d1d5db;
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

/* Paragraphs and text blocks */
.markdown-content p {
  margin-bottom: 1rem;
  color: #d1d5db;
  line-height: 1.75;
}

.markdown-content p:last-child {
  margin-bottom: 0;
}

/* Lead paragraph styling */
.markdown-content .lead {
  font-size: 1.125rem;
  color: #9ca3af;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

/* Links with hover effects */
.markdown-content a {
  color: #60a5fa;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease-in-out;
}

.markdown-content a:hover {
  color: #93c5fd;
  text-decoration-thickness: 2px;
}

/* Emphasis and strong text */
.markdown-content em {
  font-style: italic;
  color: #e5e7eb;
}

.markdown-content strong {
  font-weight: 600;
  color: #ffffff;
}

/* Inline code styling */
.markdown-content code {
  background-color: #334155;
  color: #f472b6;
  padding: 0.125rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Monaco, Inconsolata, "Liberation Mono", "DejaVu Sans Mono", Courier, monospace;
  font-weight: 500;
  border: 1px solid #475569;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.4;
}

/* Code blocks - Enhanced with modern styling */
.markdown-content pre {
  background: linear-gradient(135deg, #020617 0%, #0f172a 100%);
  color: #e2e8f0;
  padding: 1.5rem;
  border-radius: 0.75rem;
  overflow-x: auto;
  margin: 2rem 0;
  border: 1px solid #1e293b;
  box-shadow:
    0 10px 25px -5px rgba(0, 0, 0, 0.25),
    0 10px 10px -5px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.03);
  position: relative;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Monaco, Inconsolata, "Liberation Mono", "DejaVu Sans Mono", Courier, monospace;
}

/* Add a subtle inner glow */
.markdown-content pre:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.3), transparent);
}

.markdown-content pre code {
  background-color: transparent;
  color: inherit;
  padding: 0;
  border: none;
  font-size: 0.875rem;
  font-family: inherit;
  line-height: 1.6;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  tab-size: 2;
  hyphens: none;
  display: block;
}

/* Enhanced language-specific syntax highlighting */
.markdown-content pre code.language-bash,
.markdown-content pre code.language-shell {
  color: #10b981;
}

.markdown-content pre code.language-javascript,
.markdown-content pre code.language-js,
.markdown-content pre code.language-typescript,
.markdown-content pre code.language-ts {
  color: #f59e0b;
}

.markdown-content pre code.language-ruby,
.markdown-content pre code.language-rb {
  color: #ef4444;
}

.markdown-content pre code.language-python,
.markdown-content pre code.language-py {
  color: #3b82f6;
}

.markdown-content pre code.language-yaml,
.markdown-content pre code.language-yml {
  color: #8b5cf6;
}

.markdown-content pre code.language-json {
  color: #f97316;
}

.markdown-content pre code.language-sql {
  color: #06b6d4;
}

.markdown-content pre code.language-css {
  color: #ec4899;
}

.markdown-content pre code.language-html,
.markdown-content pre code.language-xml {
  color: #84cc16;
}

.markdown-content pre code.language-php {
  color: #a855f7;
}

/* Enhanced scrollbar for code blocks */
.markdown-content pre::-webkit-scrollbar {
  height: 8px;
}

.markdown-content pre::-webkit-scrollbar-track {
  background: rgba(30, 41, 59, 0.4);
  border-radius: 4px;
}

.markdown-content pre::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.markdown-content pre::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.6);
}

/* Code block with language label */
.markdown-content pre[class*="language-"]:before {
  content: attr(class);
  content: attr(data-lang);
  position: absolute;
  top: 0.75rem;
  right: 1rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
  z-index: 1;
}

/* Lists styling */
.markdown-content ul {
  list-style-type: disc;
  list-style-position: inside;
  margin-bottom: 1rem;
  color: #d1d5db;
}
.markdown-content ul.task-list {
  margin-left: 25px;
}
.markdown-content ol li {
  margin-left: 25px;
}

.markdown-content ul li {
  margin-bottom: 0.5rem;
  line-height: 1.75;
}

.markdown-content ol {
  list-style-type: decimal;
  list-style-position: inside;
  margin-bottom: 1rem;
  color: #d1d5db;
}

.markdown-content ol li {
  margin-bottom: 0.5rem;
  line-height: 1.75;
}

.markdown-content li > ul,
.markdown-content li > ol {
  margin-top: 0.5rem;
  margin-bottom: 0;
  margin-left: 1.5rem;
}

/* Nested list styling */
.markdown-content ul ul {
  list-style-type: disc;
}

.markdown-content ul ul ul {
  list-style-type: square;
}

/* Blockquotes - Enhanced ReadMe-inspired styling with comprehensive color schemes */
.markdown-content blockquote {
  position: relative;
  border-left: 4px solid #3b82f6;
  padding: 1.5rem 1.5rem 1.5rem 2rem;
  margin: 2rem 0;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-radius: 0.75rem;
  font-style: normal;
  color: #e2e8f0;
  box-shadow:
    0 4px 6px -1px rgba(0, 0, 0, 0.25),
    0 2px 4px -1px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

/* Subtle top highlight */
.markdown-content blockquote:before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(148, 163, 184, 0.2), transparent);
}

/* Quote icon */
.markdown-content blockquote:after {
  content: "💡";
  position: absolute;
  top: 1rem;
  right: 1rem;
  font-size: 1.25rem;
  opacity: 0.6;
}

.markdown-content blockquote p {
  margin-bottom: 0.75rem;
  line-height: 1.7;
  font-size: 0.95rem;
  color: #f1f5f9;
}

.markdown-content blockquote p:last-child {
  margin-bottom: 0;
}

.markdown-content blockquote p:first-child {
  font-weight: 500;
}

/* Enhanced blockquote types with comprehensive color schemes */

/* Info/Note - Blue */
.markdown-content blockquote.info,
.markdown-content blockquote.note {
  border-left-color: #60a5fa;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(59, 130, 246, 0.05) 100%);
}

.markdown-content blockquote.info:before,
.markdown-content blockquote.note:before {
  background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.3), transparent);
}

.markdown-content blockquote.info:after,
.markdown-content blockquote.note:after {
  content: "ℹ️";
}

/* Tip/Hint - Indigo */
.markdown-content blockquote.tip,
.markdown-content blockquote.hint {
  border-left-color: #818cf8;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0.05) 100%);
}

.markdown-content blockquote.tip:before,
.markdown-content blockquote.hint:before {
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.3), transparent);
}

.markdown-content blockquote.tip:after,
.markdown-content blockquote.hint:after {
  content: "💡";
}

/* Success/Congratulations - Green */
.markdown-content blockquote.success,
.markdown-content blockquote.congratulations,
.markdown-content blockquote.complete {
  border-left-color: #34d399;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, rgba(16, 185, 129, 0.05) 100%);
}

.markdown-content blockquote.success:before,
.markdown-content blockquote.congratulations:before,
.markdown-content blockquote.complete:before {
  background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.3), transparent);
}

.markdown-content blockquote.success:after,
.markdown-content blockquote.congratulations:after,
.markdown-content blockquote.complete:after {
  content: "✅";
}

/* Warning/Caution - Amber */
.markdown-content blockquote.warning,
.markdown-content blockquote.caution {
  border-left-color: #fbbf24;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(245, 158, 11, 0.05) 100%);
}

.markdown-content blockquote.warning:before,
.markdown-content blockquote.caution:before {
  background: linear-gradient(90deg, transparent, rgba(245, 158, 11, 0.3), transparent);
}

.markdown-content blockquote.warning:after,
.markdown-content blockquote.caution:after {
  content: "⚠️";
}

/* Important/Attention - Orange */
.markdown-content blockquote.important,
.markdown-content blockquote.attention {
  border-left-color: #fb923c;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.15) 0%, rgba(249, 115, 22, 0.05) 100%);
}

.markdown-content blockquote.important:before,
.markdown-content blockquote.attention:before {
  background: linear-gradient(90deg, transparent, rgba(249, 115, 22, 0.3), transparent);
}

.markdown-content blockquote.important:after,
.markdown-content blockquote.attention:after {
  content: "🔔";
}

/* Danger/Critical/Error - Red */
.markdown-content blockquote.danger,
.markdown-content blockquote.critical,
.markdown-content blockquote.error {
  border-left-color: #f87171;
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.05) 100%);
}

.markdown-content blockquote.danger:before,
.markdown-content blockquote.critical:before,
.markdown-content blockquote.error:before {
  background: linear-gradient(90deg, transparent, rgba(239, 68, 68, 0.3), transparent);
}

.markdown-content blockquote.danger:after,
.markdown-content blockquote.critical:after,
.markdown-content blockquote.error:after {
  content: "🚨";
}

/* Quote/Citation - Purple */
.markdown-content blockquote.quote,
.markdown-content blockquote.citation {
  border-left-color: #a78bfa;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0.05) 100%);
}

.markdown-content blockquote.quote:before,
.markdown-content blockquote.citation:before {
  background: linear-gradient(90deg, transparent, rgba(139, 92, 246, 0.3), transparent);
}

.markdown-content blockquote.quote:after,
.markdown-content blockquote.citation:after {
  content: "💬";
}

/* Example/Demo - Cyan */
.markdown-content blockquote.example,
.markdown-content blockquote.demo {
  border-left-color: #22d3ee;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(6, 182, 212, 0.05) 100%);
}

.markdown-content blockquote.example:before,
.markdown-content blockquote.demo:before {
  background: linear-gradient(90deg, transparent, rgba(6, 182, 212, 0.3), transparent);
}

.markdown-content blockquote.example:after,
.markdown-content blockquote.demo:after {
  content: "🔍";
}

/* Download/Resource - Teal */
.markdown-content blockquote.download,
.markdown-content blockquote.resource {
  border-left-color: #2dd4bf;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.15) 0%, rgba(20, 184, 166, 0.05) 100%);
}

.markdown-content blockquote.download:before,
.markdown-content blockquote.resource:before {
  background: linear-gradient(90deg, transparent, rgba(20, 184, 166, 0.3), transparent);
}

.markdown-content blockquote.download:after,
.markdown-content blockquote.resource:after {
  content: "📁";
}

/* Tables. The article is a readable prose column (max-w-3xl); a table is DATA and breaks out of it to the full
   page width, which is the difference between reading a nine-column tracker and scrolling it. `max-width: none`
   beats the article's cap, and the wrapper scrolls on a narrow screen instead of squashing the columns. */
.markdown-content table {
  /* A data table must never be CUT: as a block box it scrolls sideways when the doc column cannot hold it,
     instead of spilling under the on-this-page sidebar. Cells keep their natural width (nowrap below). */
  display: block;
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  background-color: #1f2937;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  margin: 1.5rem 0;
  border: 1px solid #374151;
}

.markdown-content thead {
  background-color: #111827;
}

.markdown-content th {
  padding: 0.6rem 0.7rem;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffffff;
  border-bottom: 1px solid #374151;
}

.markdown-content th,
.markdown-content td {
  /* A wrapped art key reads as two broken words ("boulderf / ist"), and a wrapped level column is noise. The
     table scrolls instead of wrapping. */
  white-space: nowrap;
}

.markdown-content td code {
  font-size: 0.75rem;
  padding: 0.1rem 0.35rem;
  /* the inline-code rule sets word-break for prose; in a table it breaks an art key into two broken words */
  white-space: nowrap;
  word-break: normal;
}

.markdown-content td {
  padding: 0.5rem 0.7rem;
  font-size: 0.875rem;
  color: #d1d5db;
  border-bottom: 1px solid #1f2937;
}

.markdown-content tbody tr:hover {
  background-color: rgba(17, 24, 39, 0.5);
}

.markdown-content tbody tr:last-child td {
  border-bottom: none;
}

/* A tracker row that is DONE. The table cell itself gets no hook from markdown, so the generated page marks the
   tick with .motion-yes and the row is tinted from it. :has() is the whole point — without it a generated table
   would have to be raw HTML to carry a class. */
.markdown-content tbody tr:has(.motion-yes) {
  background-color: rgba(16, 185, 129, 0.08);
  box-shadow: inset 3px 0 0 #10b981;
}

.markdown-content tbody tr:has(.motion-yes):hover {
  background-color: rgba(16, 185, 129, 0.14);
}

/* A pill rather than an emoji: ✅ is not in the admin font stack and renders as a missing-glyph box. */
.markdown-content .motion-yes {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #065f46;
  background-color: #34d399;
}

/* A creature portrait in a table: the small pre-cut WebP from /assets/wiki-art, drawn at a readable height with
   its own aspect ratio kept and nothing of the row's padding around it. `pixelated` because these are sprites —
   the browser's smooth scaling turns a 60 px creature to mush. */
.markdown-content td .monster-portrait {
  height: 48px;
  width: auto;
  max-width: 64px;
  margin: 0;
  image-rendering: pixelated;
  object-fit: contain;
  display: block;
}

.markdown-content td:has(.monster-portrait) {
  padding: 0.25rem 0.5rem;
  width: 64px;
}

/* Horizontal rules */
.markdown-content hr {
  border: none;
  border-top: 1px solid #374151;
  margin: 2rem 0;
}

/* Images */
.markdown-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  margin: 1rem 0;
}

/* Image with caption */
.markdown-content figure {
  margin: 1.5rem 0;
}

.markdown-content figcaption {
  font-size: 0.875rem;
  color: #9ca3af;
  text-align: center;
  margin-top: 0.5rem;
  font-style: italic;
}

/* Keyboard keys */
.markdown-content kbd {
  background-color: #1f2937;
  color: #e5e7eb;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.875rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Monaco, Inconsolata, "Liberation Mono", "DejaVu Sans Mono", Courier, monospace;
  border: 1px solid #4b5563;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

/* Mark/highlight text */
.markdown-content mark {
  background-color: #92400e;
  color: #fef3c7;
  padding: 0 0.25rem;
  border-radius: 0.25rem;
}

/* Strikethrough */
.markdown-content del,
.markdown-content s {
  text-decoration: line-through;
  color: #6b7280;
}

/* Subscript and superscript */
.markdown-content sub {
  font-size: 0.75rem;
  vertical-align: sub;
}

.markdown-content sup {
  font-size: 0.75rem;
  vertical-align: super;
}

/* Definition lists */
.markdown-content dl {
  margin: 1rem 0;
}

.markdown-content dt {
  font-weight: 600;
  color: #ffffff;
  margin-top: 1rem;
}

.markdown-content dt:first-child {
  margin-top: 0;
}

.markdown-content dd {
  margin-left: 1rem;
  color: #d1d5db;
  margin-top: 0.25rem;
}

/* Details/Summary (collapsible content) */
.markdown-content details {
  background-color: #1f2937;
  border-radius: 0.75rem;
  padding: 1rem;
  margin: 1rem 0;
  border: 1px solid #374151;
}

.markdown-content summary {
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  transition: color 0.2s ease-in-out;
}

.markdown-content summary:hover {
  color: #60a5fa;
}

.markdown-content details[open] summary {
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #374151;
}

/* Footnotes */
.markdown-content .footnotes {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #374151;
  font-size: 0.875rem;
}

.markdown-content .footnotes ol {
  color: #9ca3af;
}

/* Task lists (checkboxes) */
.markdown-content input[type="checkbox"] {
  margin-right: 0.5rem;
  border-radius: 0.25rem;
  border: 1px solid #4b5563;
  color: #2563eb;
}

.markdown-content input[type="checkbox"]:focus {
  ring: 2px solid #3b82f6;
}

.markdown-content ul li.task-list-item {
  list-style: none;
}

/* Alerts/Callouts */
.markdown-content .alert {
  padding: 1rem;
  border-radius: 0.5rem;
  margin: 1.5rem 0;
  border-left: 4px solid;
}

.markdown-content .alert-info {
  background-color: rgba(59, 130, 246, 0.1);
  border-left-color: #3b82f6;
  color: #93c5fd;
}

.markdown-content .alert-warning {
  background-color: rgba(245, 158, 11, 0.1);
  border-left-color: #f59e0b;
  color: #fbbf24;
}

.markdown-content .alert-danger {
  background-color: rgba(239, 68, 68, 0.1);
  border-left-color: #ef4444;
  color: #f87171;
}

.markdown-content .alert-success {
  background-color: rgba(34, 197, 94, 0.1);
  border-left-color: #22c55e;
  color: #4ade80;
}

/* Print styles */
@media print {
  .markdown-content {
    color: black;
  }
  
  .markdown-content pre {
    background-color: #f3f4f6;
    color: black;
    border: 1px solid #d1d5db;
  }
  
  .markdown-content code {
    background-color: #f3f4f6;
    color: black;
  }
  
  .markdown-content a {
    color: black;
    text-decoration: underline;
  }
}
/* Responsive adjustments */
@media (max-width: 640px) {
  .markdown-content h1 {
    font-size: 1.5rem;
  }
  
  .markdown-content h2 {
    font-size: 1.25rem;
  }
  
  .markdown-content pre {
    font-size: 0.8rem;
    padding: 1rem;
    margin: 1.5rem -1rem;
    border-radius: 0.5rem;
    border-left: none;
    border-right: none;
  }
  
  .markdown-content pre code {
    line-height: 1.5;
  }
  
  .markdown-content pre::-webkit-scrollbar {
    height: 6px;
  }
  
  .markdown-content code {
    font-size: 0.8rem;
    padding: 0.1rem 0.375rem;
  }
  
  .markdown-content blockquote {
    margin: 1.5rem -1rem;
    padding: 1rem 1rem 1rem 1.5rem;
    border-radius: 0.5rem;
    border-left: none;
    border-right: none;
  }
  
  .markdown-content blockquote:after {
    top: 0.75rem;
    right: 0.75rem;
    font-size: 1rem;
  }
  
  .markdown-content table {
    font-size: 0.75rem;
  }
}

/* Enhanced medium screen adjustments */
@media (min-width: 641px) and (max-width: 1024px) {
  .markdown-content pre {
    font-size: 0.85rem;
    padding: 1.25rem;
  }
}

/* Focus styles for accessibility */
.markdown-content a:focus,
.markdown-content summary:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
  border-radius: 0.25rem;
}

/* Smooth scrolling for anchor links */
.markdown-content [id] {
  scroll-margin-top: 2rem;
}
.markdown-content .welcome-documentation a, .markdown-content .welcome-documentation h3, .markdown-content .welcome-documentation p {
  text-decoration: none !important;
}

/* ==========================================================================
   Wiki guides (.guide-prose) — player-facing reading pages
   --------------------------------------------------------------------------
   Added by the guide article (app/views/wiki/guide.html.erb) next to .markdown-content, so the admin doc viewer,
   the news posts and the achievements page keep their look. Everything here is scoped to `.guide-prose` and reads
   the semantic tokens (--surface, --line, --accent, --muted, --warn, --fg) only. The `body ` prefix lifts each rule
   above `.portal .markdown-content x` in the bronze retone of tailwind/application.css, which loads later.
   Markup conventions live in Wiki::Guide: a `> **Tip:** ...` blockquote is a callout, a `<details markdown="1">`
   block is a collapsible "for veterans" section, and the h2 headings feed the "On this page" list.
   ========================================================================== */

body .guide-prose.markdown-content {
  font-size: 1rem;
  line-height: 1.7;
  /* Anchor jumps land below the sticky site header. */
}
body .guide-prose.markdown-content [id] { scroll-margin-top: 6rem; }

/* A comfortable measure for prose (about 70 characters); tables and figures keep the column's width. */
body .guide-prose.markdown-content > p,
body .guide-prose.markdown-content > ul,
body .guide-prose.markdown-content > ol,
body .guide-prose.markdown-content > blockquote,
body .guide-prose.markdown-content > details { max-width: 44rem; }

body .guide-prose.markdown-content h2 {
  font-size: 1.375rem;
  margin-top: 2.75rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.45rem;
}
body .guide-prose.markdown-content h2:first-child { margin-top: 0; }
body .guide-prose.markdown-content h3 {
  font-size: 1.0625rem;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  font-variant-caps: normal;
  letter-spacing: 0;
}
body .guide-prose.markdown-content p { margin-bottom: 0.9rem; }

/* Lists: the shared sheet draws bullets inside the box and indents every ordered item by hand. */
body .guide-prose.markdown-content ul,
body .guide-prose.markdown-content ol {
  list-style-position: outside;
  padding-left: 1.4rem;
  margin-bottom: 1rem;
}
body .guide-prose.markdown-content ol li { margin-left: 0; }
body .guide-prose.markdown-content li { margin-bottom: 0.35rem; padding-left: 0.15rem; }
body .guide-prose.markdown-content li::marker { color: var(--accent); font-weight: 600; }
body .guide-prose.markdown-content li > p { margin-bottom: 0.4rem; }

/* Links read as links without the heavy underline of the shared sheet. */
body .guide-prose.markdown-content a { text-decoration-thickness: 1px; text-underline-offset: 3px; }

/* Keys and short literals. Monospace stays reserved for code and keys. */
body .guide-prose.markdown-content kbd { padding: 0.1rem 0.45rem; font-size: 0.8125rem; white-space: nowrap; }

/* Tables: the shared sheet already makes a table its own horizontal scroller; here they read tighter and let a
   first column breathe, and long text cells wrap (the shared sheet keeps cells on one line). */
body .guide-prose.markdown-content table { margin: 1.25rem 0 1.5rem; }
body .guide-prose.markdown-content th,
body .guide-prose.markdown-content td { white-space: normal; vertical-align: top; }
body .guide-prose.markdown-content td:first-child,
body .guide-prose.markdown-content th:first-child { white-space: nowrap; }
body .guide-prose.markdown-content td { padding: 0.55rem 0.8rem; line-height: 1.5; }
body .guide-prose.markdown-content td:last-child { min-width: 8rem; }
body .guide-prose.markdown-content th { padding: 0.55rem 0.8rem; white-space: nowrap; }
body .guide-prose.markdown-content td > code { white-space: nowrap; }
body .guide-prose.markdown-content tbody tr:nth-child(even) { background-color: color-mix(in srgb, var(--surface-2) 55%, transparent); }

/* Callouts: `> **Tip:** ...`, `> **Heads up:** ...`, `> **The short version:** ...` (Wiki::Guide tags them). */
body .guide-prose.markdown-content blockquote.callout {
  position: static;
  margin: 1.4rem 0;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0.5rem;
  background: var(--surface);
  box-shadow: none;
  overflow: visible;
}
body .guide-prose.markdown-content blockquote.callout::before,
body .guide-prose.markdown-content blockquote.callout::after { content: none; display: none; }
body .guide-prose.markdown-content blockquote.callout p { margin-bottom: 0.5rem; font-size: 0.9375rem; line-height: 1.6; font-weight: 400; }
body .guide-prose.markdown-content blockquote.callout p:last-child { margin-bottom: 0; }
body .guide-prose.markdown-content blockquote.callout > p:first-child > strong:first-child {
  display: inline-block;
  margin-right: 0.15rem;
  color: var(--accent);
  font-weight: 600;
}
body .guide-prose.markdown-content blockquote.callout--warn { border-left-color: var(--warn); }
body .guide-prose.markdown-content blockquote.callout--warn > p:first-child > strong:first-child { color: var(--warn); }
/* The summary opens a guide: one step up in weight so it is the first thing read. */
body .guide-prose.markdown-content blockquote.callout--summary {
  margin-top: 0;
  padding: 1rem 1.25rem;
  border-left-width: 4px;
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}
body .guide-prose.markdown-content blockquote.callout--summary p { font-size: 1.0625rem; line-height: 1.65; }

/* Collapsible blocks for the rules a veteran wants and a newcomer can skip. */
body .guide-prose.markdown-content details {
  margin: 1.25rem 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
}
body .guide-prose.markdown-content details > summary {
  position: relative;
  padding: 0.7rem 1rem 0.7rem 2.4rem;
  list-style: none;
  cursor: pointer;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--fg);
}
body .guide-prose.markdown-content details > summary::-webkit-details-marker { display: none; }
body .guide-prose.markdown-content details > summary::before {
  content: "";
  position: absolute;
  left: 1rem;
  top: 50%;
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-70%) rotate(-45deg);
  transition: transform 0.15s ease;
}
body .guide-prose.markdown-content details[open] > summary::before { transform: translateY(-70%) rotate(45deg); }
body .guide-prose.markdown-content details[open] > summary {
  margin-bottom: 0;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--line);
}
body .guide-prose.markdown-content details > :not(summary) { margin-left: 1rem; margin-right: 1rem; max-width: none; }
body .guide-prose.markdown-content details > summary + * { margin-top: 0.9rem; }
body .guide-prose.markdown-content details > :last-child { margin-bottom: 1rem; }
body .guide-prose.markdown-content details table { margin-left: 0; }

/* Images and figures inside a guide stay inside the column and drop the shared drop shadow. */
body .guide-prose.markdown-content img { box-shadow: none; }

/* ---- "On this page" ---------------------------------------------------- */
.guide-toc { position: sticky; top: 6rem; max-height: calc(100vh - 8rem); overflow-y: auto; padding-left: 1rem; border-left: 1px solid var(--line); }
.guide-toc__list { margin: 0.6rem 0 0; padding: 0; list-style: none; }
.guide-toc__list li { margin: 0; }
.guide-toc__list a {
  display: block;
  padding: 0.3rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s, background-color 0.15s;
}
.guide-toc__list a:hover { color: var(--accent); background-color: color-mix(in srgb, var(--accent) 8%, transparent); }
.guide-toc-inline { border: 1px solid var(--line); border-radius: 0.5rem; background: var(--surface); }
.guide-toc-inline__summary {
  padding: 0.65rem 1rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--fg);
}
.guide-toc-inline[open] .guide-toc-inline__summary { border-bottom: 1px solid var(--line); }
.guide-toc-inline .guide-toc__list { margin: 0; padding: 0.4rem 0.5rem 0.6rem; }
.guide-toc-inline .guide-toc__list a { font-size: 0.9375rem; padding: 0.4rem 0.6rem; }

@media (max-width: 640px) {
  body .guide-prose.markdown-content { font-size: 0.9688rem; }
  body .guide-prose.markdown-content h2 { font-size: 1.25rem; }
  body .guide-prose.markdown-content blockquote.callout { margin-left: 0; margin-right: 0; border-radius: 0.5rem; border-right: 1px solid var(--line); }
  body .guide-prose.markdown-content td,
  body .guide-prose.markdown-content th { padding: 0.5rem 0.6rem; }
}

/* ---- Guide art: the Castle War header and the castle nameplates ---- */
.guide-hero { margin: 0 0 1.75rem; text-align: center; }
.guide-hero img { display: inline-block; width: 100%; max-width: 26rem; height: auto; margin: 0; border-radius: 0; box-shadow: none; }
.guide-castles { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: 0.85rem; margin: 1.25rem 0 1.5rem; max-width: 100%; }
.markdown-content .guide-castle { margin: 0; padding: 0.85rem 1rem; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 0.5rem; background: var(--surface); }
.guide-castle img { display: block; width: 100%; height: auto; margin: 0 0 0.55rem; border-radius: 0; box-shadow: none; }
.guide-castle figcaption { margin: 0; text-align: left; font-style: normal; font-size: 0.875rem; line-height: 1.5; color: var(--muted); }
.guide-factions { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin: 1.5rem 0; max-width: 100%; }
.markdown-content .guide-faction { margin: 0; overflow: hidden; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 0.5rem; background: var(--surface); }
.guide-faction img { display: block; width: 100%; aspect-ratio: 1627 / 669; object-fit: cover; margin: 0; border-radius: 0; box-shadow: none; }
.guide-faction figcaption { margin: 0; padding: 0.75rem 1rem 0.9rem; text-align: left; font-style: normal; font-size: 0.875rem; line-height: 1.5; color: var(--muted); }
.guide-faction figcaption strong { display: block; margin-bottom: 0.15rem; font-size: 1.0625rem; font-weight: 600; color: var(--fg); }
.guide-faction--jotun { border-top-color: var(--line-strong); }
