/* Softer surfaces, shared by the existing FluxCP pages and the Wiki. */
:root {
  --ink: #171411; --muted: #5f5447; --teal: #79552e; --teal-dark: #5d3e1f;
  --paper: #fff8ed; --gold: #88632d; --line: #dfd2c0; --surface: #fff8ed;
  --surface-soft: #f5ebdc; --field: #fffdfa; --accent-soft: #efe1cc;
  --button-ink: #fff; --shadow: 0 12px 36px #65411c1a; color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #ffffff; --muted: #d0c3b6; --teal: #edc390; --teal-dark: #ffdab0;
  --paper: #28231f; --gold: #edc390; --line: #55493e; --surface: #28231f;
  --surface-soft: #332d27; --field: #211d1a; --accent-soft: #493a2b;
  --button-ink: #21180f; --shadow: 0 12px 36px #140d0733; color-scheme: dark;
}
/* Ready-to-use palettes retain the same accessible light/dark behavior. */
:root[data-palette="midgard"] {
  --ink:#304b78; --muted:#52688b; --teal:#456799; --teal-dark:#314f80;
  --paper:#f8faff; --surface:#f8faff; --surface-soft:#eaf0fa; --field:#fff;
  --line:#bdcce5; --accent-soft:#dce6f6; --gold:#805d20; --button-ink:#fff;
  --shadow:0 8px 28px #496a9c12;
}
:root[data-palette="ocean"] {
  --ink:#152b3a; --muted:#4a6273; --teal:#21648c; --teal-dark:#164c6d;
  --paper:#f3faff; --surface:#f3faff; --surface-soft:#e5f0f7; --field:#fff;
  --line:#c7dce9; --accent-soft:#dceef8; --gold:#316e93; --button-ink:#fff;
}
:root[data-palette="forest"] {
  --ink:#213026; --muted:#526457; --teal:#38674a; --teal-dark:#274f36;
  --paper:#f6faf1; --surface:#f6faf1; --surface-soft:#eaf0e1; --field:#fffef9;
  --line:#d0ddc7; --accent-soft:#e0ecd7; --gold:#617342; --button-ink:#fff;
}
:root[data-palette="midnight"] {
  --ink:#fff; --muted:#bccce1; --teal:#a5d5fc; --teal-dark:#d1eaff;
  --paper:#202a3c; --surface:#202a3c; --surface-soft:#29364b; --field:#192232;
  --line:#465873; --accent-soft:#334863; --gold:#aac9ef; --button-ink:#142237;
}
:root[data-palette="plum"] {
  --ink:#fff; --muted:#dbc5d7; --teal:#ecc0df; --teal-dark:#ffe0f4;
  --paper:#302332; --surface:#302332; --surface-soft:#3d2d3f; --field:#261c29;
  --line:#654b64; --accent-soft:#533c52; --gold:#e0bbcd; --button-ink:#301d2b;
}
.theme-picker { display:flex; flex-direction:column; gap:3px; font-size:10px; color:var(--muted); }
.theme-picker select { width:144px; max-width:100%; padding:8px 10px; font:600 12px "Segoe UI",sans-serif; color:var(--ink); border:1px solid var(--line); border-radius:7px; }
html { background: var(--surface-soft); }
body, body.inner { background: none; isolation: isolate; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(#ffc47712, #9d641a24), url('../img/summer-background-clear.png') center / cover no-repeat;
}
[data-theme="dark"] body::before { background-image: linear-gradient(#29201750, #2018109e), url('../img/summer-background-clear.png'); }
[data-palette="midgard"] body::before { background:linear-gradient(145deg,#f8faff,#edf2fb); }
[data-palette="midgard"] .site-header { background:linear-gradient(#e5ecfc,#cbd8ef); border-color:#9fb6db; }
[data-palette="midgard"] :is(.brand,.wiki-main h1) { font-family:Georgia,"Times New Roman",serif; }
.summer-light { display: none; }
.site-header, .hero-panel, .page-panel, .knowledge-panel {
  background: var(--surface); border-color: var(--line); box-shadow: var(--shadow);
}
.site-header { width: calc(100% - 32px); max-width: 1440px; margin-top: 16px; }
.site-header>nav:last-child { gap: 12px; }
.theme-toggle { padding: 9px 12px; gap: 7px; min-height: 38px; font-size: 12px; background: var(--surface-soft); color: var(--ink); border-color: var(--line); }
.theme-toggle:hover { background: var(--accent-soft); color: var(--ink); }
.theme-toggle[hidden] { display: none; }
.nav-button, .button, button, input[type=submit] { color: var(--button-ink); }
.nav-button:hover, .button:hover, button:hover, input[type=submit]:hover { color: var(--button-ink); }
.button-secondary, .copy-button { color: var(--teal); }
.theme-toggle, .theme-toggle:hover { color: var(--ink); }
input, select, textarea, .guide-search input { background: var(--field); border-color: var(--line); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.guide-card, .knowledge-card, .download-slot-grid>.download-link-form { background: var(--surface); border-color: var(--line); }
.guide-card:hover { border-color: var(--teal); }
.guide-badge, .guide-filters a, .card-icon, .command-line, .board-editor, .knowledge-search, .wiki-contents, .knowledge-preview, .knowledge-editor input[readonly], .wiki-formatting code, .count {
  background: var(--surface-soft); border-color: var(--line);
}
.card-icon, .guide-badge { color: var(--teal); }
.guide-filters a[aria-current] { background: var(--teal); color: var(--button-ink); }
.card-badge { color: var(--gold); background: var(--surface-soft); border-color: var(--line); }
.message, .notice { color: var(--ink); background: var(--accent-soft); border-color: var(--line); }
[data-theme="dark"] .red { color: #ffd4d7; background: #593f49; border-color: #87606b; }
.ambient-toggle, .skip-link { background: var(--surface); color: var(--teal); border-color: var(--line); }
.empty-state { border-color: var(--line); }
/* Documentation layout: topic navigation, reading column, and page contents. */
.wiki-page .knowledge-panel { display: flex; flex-direction: column; max-width: 1440px; padding: 0; margin: 24px auto 40px; width: calc(100% - 32px); overflow: clip; border-radius: 14px; }
.wiki-page h1, .wiki-page h2, .wiki-page h3 { font-family: "Segoe UI", Arial, sans-serif; font-weight: 650; letter-spacing: -.025em; }
.wiki-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.wiki-toolbar-title { color: var(--ink); font-size: 15px; font-weight: 650; text-decoration: none; }
.wiki-toolbar-title span { color: var(--teal); margin-right: 8px; }
.wiki-toolbar .guide-search { width: min(100%, 480px); margin: 0; }
.wiki-toolbar .guide-search input { font-size: 13px; padding: 9px 12px; }
.wiki-toolbar .guide-search button { padding: 9px 14px; }
.wiki-shell { flex: 1; display: grid; grid-template-columns: 240px minmax(0,1fr) 200px; align-items: start; min-height: 650px; }
.wiki-sidebar { background: var(--surface-soft); padding: 24px 16px; min-height: 100%; border-right: 1px solid var(--line); }
.wiki-sidebar>summary { display: none; }
.wiki-sidebar nav { display: block; }
.wiki-sidebar .wiki-welcome { display: block; padding: 10px 12px; margin-bottom: 22px; font-size: 13px; }
.wiki-sidebar details { margin-bottom: 22px; }
.wiki-sidebar details>summary { padding: 0 12px; color: var(--ink); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
.wiki-sidebar ul { list-style: none; margin: 10px 0 0 12px; padding: 0 0 0 10px; border-left: 1px solid var(--line); }
.wiki-sidebar li { margin: 4px 0; }
.wiki-sidebar a { color: var(--muted); text-decoration: none; font-size: 13px; line-height: 1.6; }
.wiki-sidebar li a { display: block; padding: 7px 10px; overflow-wrap: anywhere; }
.wiki-sidebar a:hover, .wiki-sidebar a[aria-current] { color: var(--teal); background: var(--accent-soft); border-radius: 6px; text-decoration: none; }
.wiki-sidebar .field-help { padding: 0 12px; font-size: 12px; }
.wiki-sidebar .wiki-add { display: block; padding: 10px 12px; color: var(--teal); border-top: 1px solid var(--line); }
.wiki-main { min-width: 0; padding: 36px 40px 44px; }
.wiki-main h1 { font-size: clamp(28px, 3vw, 40px); line-height: 1.2; margin-bottom: 18px; }
.wiki-main .eyebrow { color: var(--teal); letter-spacing: 1.4px; margin-bottom: 14px; }
.wiki-main .knowledge-heading { display: block; }
.wiki-main .knowledge-heading .button { margin-top: 18px; padding: 8px 13px; }
.wiki-main .knowledge-intro { font-size: 15px; line-height: 1.85; }
.wiki-main .knowledge-back { margin-bottom: 20px; }
.wiki-main .guide-intro-edit { display: inline-block; margin-left: 15px; }
.wiki-main .guide-section { margin-top: 34px; }
.wiki-main .guide-section-title h2 { font-size: 21px; }
.wiki-main .guide-section-title>span { font-size: 12px; }
.wiki-article-list { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.wiki-article-link { display: block; padding: 19px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.wiki-article-link strong { color: var(--ink); display: block; font-size: 16px; }
.wiki-article-link span { display: block; color: var(--muted); font-size: 13px; margin-top: 5px; }
.wiki-article-link:hover strong { color: var(--teal); }
.wiki-main .empty-state { margin-top: 30px; text-align: left; padding: 24px; background: var(--surface-soft); }
.wiki-main .empty-state h2 { font-size: 22px; }
.wiki-page .wiki-contents { position: sticky; top: 24px; padding: 30px 18px 24px; background: none; border: 0; border-left: 1px solid var(--line); border-radius: 0; margin-top: 6px; max-height: calc(100vh - 48px); overflow-y: auto; }
.wiki-contents .eyebrow { color: var(--muted); font-size: 10px; letter-spacing: .05em; }
.wiki-contents a { color: var(--muted); font-size: 12px; }
.wiki-contents a:hover, .wiki-contents a[aria-current] { color: var(--teal); }
.wiki-page .wiki-contents ol { display: block; }
.wiki-page .wiki-contents li { margin: 11px 0; }
.wiki-prose img { display: block; max-width: 100%; height: auto; margin: 24px 0; border-radius: 8px; }
.wiki-page .wiki-prose { font-size: 16px; line-height: 1.85; }
.wiki-page .wiki-prose h2 { font-size: 25px; margin: 36px 0 20px; padding-top: 25px; border-top: 1px solid var(--line); border-bottom: 0; }
.wiki-page .wiki-prose h3 { font-size: 20px; }
.wiki-upload { padding: 15px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.wiki-upload label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 8px; }
.wiki-upload input[type=file] { font-size: 12px; padding: 7px; }
.wiki-upload-status { font-size: 12px; margin: 8px 0 0; color: var(--muted); }
.wiki-sidebar .wiki-category-group { margin: 12px 0 14px 8px; }
.wiki-sidebar .wiki-category-group>summary { font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.wiki-move-link { display: inline-block; font-size: 12px; margin-left: 14px; }
.wiki-picture { margin: 25px 0; }
.wiki-picture img { width: auto; margin: 0; }
.wiki-picture figcaption { font-size: 12px; margin-top: 7px; }
.wiki-organization, .wiki-part { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; margin: 12px 0; padding: 16px 20px; }
.wiki-organization summary, .wiki-part summary { cursor: pointer; color: var(--teal); font-size: 13px; font-weight: 600; }
.wiki-organization>label { display: block; margin: 14px 0 6px; font-size: 12px; }
.parts-heading { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: baseline; margin-top: 15px; }
.parts-heading h2 { font: 600 22px/1.4 "Segoe UI",sans-serif; margin: 0; }
.wiki-part { background: var(--surface-soft); padding: 0; }
.wiki-part summary { padding: 17px 20px; }
.wiki-part summary>span { color: var(--muted); font-size: 11px; margin: 0 12px 0 3px; }
.wiki-part summary>strong { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.wiki-part-body { padding: 0 20px 20px; }
.wiki-part label { display: block; font-size: 12px; font-weight: 600; }
.wiki-part label input, .wiki-part label textarea { display: block; margin-top: 7px; }
.wiki-part textarea { font: inherit; font-size: 14px; line-height: 1.75; }
.part-actions, .part-format { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.part-format { margin: 14px 0 7px; }
.part-actions button, .part-format button, .part-picture button, [data-undo-part] { padding: 6px 10px; font-size: 11px; }
button:disabled { opacity: .45; cursor: default; }
.part-picture { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 12px; margin-top: 16px; }
.part-picture img { display: block; max-width: 100%; max-height: 260px; object-fit: contain; margin-bottom: 12px; }
.part-picture button { margin-top: 9px; }
.part-upload { margin-top: 18px; }
.part-upload input { padding: 8px; font-size: 12px; }
.part-upload .field-help { display: block; margin-top: 6px; }
[data-add-part] { width: 100%; margin: 8px 0; border-style: dashed; }
[data-text-fallback] label { display: block; font-size: 12px; font-weight: 600; }
[data-section-builder][hidden], [data-text-fallback][hidden] { display: none; }
@media (min-width: 1151px) and (max-width: 1300px) {
  .site-header .brand { font-size: 19px; } .site-header>nav:last-child { gap: 9px; }
}
@media (max-width: 1100px) {
  .wiki-shell { grid-template-columns: 210px minmax(0,1fr); }
  .wiki-page .wiki-contents { display: none; }
  .wiki-main { padding: 30px; }
}
@media (max-width: 700px) {
  .site-header .knowledge-nav { flex-wrap: wrap; justify-content: center; gap: 8px; }
  .wiki-page .knowledge-panel { width: calc(100% - 20px); margin-top: 16px; }
  .wiki-toolbar { padding: 16px; } .wiki-toolbar .guide-search { width: 100%; }
  .wiki-shell { display: block; min-height: 450px; }
  .wiki-sidebar { padding: 14px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .wiki-sidebar>summary { display: list-item; cursor: pointer; font-size: 13px; font-weight: 650; }
  .wiki-sidebar>nav { margin-top: 15px; }
  .wiki-main { padding: 25px 22px; }
  .wiki-main h1 { font-size: 29px; }
  .wiki-page .wiki-prose { font-size: 15px; }
  .wiki-main .guide-intro-edit { display: block; margin-left: 0; }
  .site-header>nav:last-child { flex-wrap: wrap; gap: 12px; }
  body::before { background-position: 32% center; }
}

/* Public monster and map reference. Shares the existing light/dark palette. */
.page-panel.mob-panel { max-width: 1160px; }
.mob-database { max-width: 1080px; margin: auto; }
.mob-database .form-heading { text-align: left; }
.mob-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 22px 0; }
.mob-tabs a { padding: 10px 16px; border: 1px solid var(--line); border-radius: 8px; }
.mob-tabs a[aria-current] { background: var(--teal); color: var(--button-ink); }
.mob-search { margin: 24px 0 10px; }
.mob-search label { display: block; margin-bottom: 8px; }
.mob-search>div { display: flex; gap: 10px; }
.mob-search input { flex: 1; min-width: 0; }
.mob-database h2 { margin-top: 32px; }
.mob-database h3 { margin-top: 28px; }
.mob-table-wrap { max-width: 100%; overflow-x: auto; margin: 15px 0; }
.mob-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.mob-table th, .mob-table td { padding: 13px 16px; border-bottom: 1px solid var(--line); text-align: left; }
.mob-table th { color: var(--muted); font-size: 12px; font-weight: 600; }
.mob-table a { font-weight: 600; }
.mob-table small { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.mob-pagination { display: flex; justify-content: center; align-items: center; gap: 24px; margin: 26px 0; }
.mob-stats { display: grid; grid-template-columns: repeat(6,1fr); gap: 12px; margin: 26px 0; }
.mob-stats>div { padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.mob-stats dt { color: var(--muted); font-size: 11px; }
.mob-stats dd { margin: 5px 0 0; font-weight: 600; }
.mob-spawns { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; padding: 0; list-style: none; }
.mob-spawns li { padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; }
.mob-spawns span { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.mob-bonuses details { border: 1px solid var(--line); border-radius: 10px; margin: 12px 0; padding: 15px; }
.mob-bonuses summary { cursor: pointer; font-weight: 600; }
.mob-bonuses summary span { float: right; font-size: 12px; font-weight: 400; color: var(--muted); }
.mob-notes { border-top: 1px solid var(--line); padding-top: 22px; margin-top: 32px; line-height: 1.7; }
.mob-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(148px,1fr)); gap: 14px; margin: 24px 0; }
.mob-card { display: flex; flex-direction: column; padding: 10px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.mob-card:hover, .mob-card:focus-visible { color: var(--ink); transform: translateY(-5px); border-color: var(--teal); box-shadow: var(--shadow); }
.mob-card-portrait { display: flex; height: 106px; justify-content: center; align-items: center; background: radial-gradient(ellipse at center,var(--accent-soft),var(--surface-soft)); border-radius: 9px; margin-bottom: 10px; }
.mob-card-portrait img { width: auto; height: auto; max-width: min(100%,110px); max-height: 96px; object-fit: contain; image-rendering: pixelated; }
.mob-card h3 { font-size: 16px; overflow-wrap: anywhere; line-height: 1.3; margin: 7px 0 12px; }
.mob-card-id, .mob-card-meta { color: var(--muted); font-size: 11px; line-height: 1.6; }
.mob-card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.mob-card-tags span { background: var(--accent-soft); color: var(--ink); padding: 3px 7px; border-radius: 5px; font-size: 10px; }
.mob-card-open { display: flex; justify-content: space-between; margin-top: auto; padding-top: 14px; color: var(--teal); font-size: 11px; font-weight: 600; }
.mob-detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.mob-detail-sprite { flex: 0 1 auto; width: auto; height: auto; max-width: 144px; max-height: 144px; object-fit: contain; image-rendering: pixelated; }
.mob-gm-tools { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin: 20px 0; }
.mob-gm-tools form, .mob-gm-tools p { margin: 0 0 8px; }
.mob-gm-tools details { margin-top: 12px; }
.mob-sprite-upload summary { cursor: pointer; font-weight: 600; color: var(--teal); }
.mob-sprite-upload form { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin-top: 14px; }
.mob-sprite-upload label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; min-width: 0; }
.mob-sprite-upload input { max-width: 100%; padding: 9px; }
.mob-sprite-upload input[type=number] { width: 150px; }
.mob-sprite-upload .field-help { flex-basis: 100%; }
@media (prefers-reduced-motion: reduce) { .mob-card { transition: none; } .mob-card:hover, .mob-card:focus-visible { transform: none; } }
@media (max-width: 700px) {
  .mob-stats { grid-template-columns: repeat(2,1fr); }
  .mob-spawns { grid-template-columns: repeat(2,1fr); }
  .mob-table th, .mob-table td { padding: 10px 8px; }
  .mob-search button { padding: 10px 15px; }
  .mob-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .mob-card { padding: 10px; }
  .mob-card h3 { font-size: 16px; overflow-wrap: anywhere; }
  .mob-card-portrait { height: 100px; }
  .mob-detail-heading { align-items: flex-start; }
  .mob-detail-sprite { max-width: 95px; max-height: 120px; }
}

/* GM section organization. */
.wiki-overview-actions { display:flex; flex-wrap:wrap; align-items:center; gap:12px; margin:20px 0; }
.wiki-overview-actions .guide-intro-edit { margin:0; }
.wiki-organizer h1 { font-size:36px; }
.wiki-organizer .field-help { line-height:1.7; }
.org-groups, .org-categories, .org-articles { min-height:48px; padding:8px; border:1px dashed var(--line); border-radius:8px; }
.org-group, .org-category { margin:10px 0; padding:14px; border:1px solid var(--line); border-radius:10px; background:var(--surface-soft); }
.org-category { background:var(--surface); }
.org-item-head, .org-article { display:flex; align-items:center; flex-wrap:wrap; gap:8px; }
.org-item-head { margin-bottom:12px; }
.org-name { flex:1 1 160px; font-size:11px; color:var(--muted); }
.org-name input { display:block; width:100%; margin-top:3px; padding:8px; color:var(--ink); }
.org-item-head button, .org-article button, [data-add-category] { padding:7px 10px; font-size:12px; gap:4px; }
.org-move { max-width:220px; padding:7px; font-size:12px; color:var(--ink); }
.org-arrows { display:flex; gap:6px; flex:none; }
.org-handle { cursor:grab; touch-action:none; user-select:none; }
.org-article { padding:10px; margin:7px 0; border:1px solid var(--line); border-radius:7px; background:var(--surface-soft); }
.org-article-title { flex:1 1 160px; overflow-wrap:anywhere; font-size:13px; }
.org-drop-target { outline:2px solid var(--teal); outline-offset:2px; }
.org-dragging { opacity:.55; }
.org-actions { position:sticky; bottom:8px; display:flex; flex-wrap:wrap; align-items:center; gap:12px; padding:15px; margin-top:20px; border:1px solid var(--line); border-radius:10px; background:var(--surface); box-shadow:var(--shadow); }
.org-actions [role=status] { font-size:12px; color:var(--muted); flex-basis:100%; }
.org-empty { color:var(--muted); font-size:12px; margin:6px; pointer-events:none; }
@media (max-width:700px) {
  .org-group, .org-category { padding:9px; }
  .org-groups, .org-categories, .org-articles { padding:4px; }
  .org-move { max-width:100%; width:100%; }
  .org-actions { position:static; }
  .wiki-overview-actions .button { padding:10px 12px; }
}
