:root { --panel: 262px; }
body.node-selected { --panel: 410px; }
#side { width: var(--panel); touch-action: pan-y; scrollbar-color: #4a3f3a #17141a; }
#top { right: calc(var(--panel) + 28px); }
#jump { max-width: 210px; background: var(--card); color: var(--ink); border: 1.5px solid var(--line); border-radius: 8px; padding: 4px 8px; font: inherit; }
#layer-box summary, .profile-editor > summary, .entry-editor > summary, .node-editor > summary { cursor: pointer; color: #b8ad9f; }
#layer-box summary { font-size: 15px; }
#layer-box[open] summary { margin-bottom: 6px; }
.dossier-heading { position: relative; padding-right: 32px; margin: 2px 0 14px; }
.dossier-heading h2 { font-weight: 400; font-size: 27px; margin: 0 0 3px; color: #efe6d2; }
.dossier-heading > span { font-size: 14px; color: var(--dim); }
.dossier-heading button { position: absolute; right: 0; top: 0; font-size: 21px; line-height: 1; }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.gallery .media-card { padding: 0 0 7px; overflow: hidden; text-align: left; white-space: normal; background: #100f12; border-radius: 8px; }
.media-card img { width: 100%; aspect-ratio: 3 / 2; object-fit: contain; display: block; background: #242126; }
.media-card > span:not(.profile-badge) { display: block; padding: 7px 8px 4px; font-size: 14px; line-height: 1.2; }
.profile-badge { display: inline-block; width: fit-content; font-size: 11px; line-height: 1.25; color: #b8ad9f; border: 1px solid #63544b; border-radius: 4px; padding: 2px 5px; }
.profile-badge.idea { border-style: dashed; color: #d3b58c; }
.profile-badge.canon { color: #91b8a4; border-color: #45685a; }
.media-card .profile-badge { margin-left: 8px; }
.profile-section { margin-top: 20px; }
.profile-section h3 { font-size: 18px; font-weight: 400; margin: 0 0 8px; color: #d6c4ae; }
.profile-fact { border-left: 2px solid #45685a; padding: 2px 0 5px 10px; margin: 10px 0; }
.profile-fact.idea { border-left-style: dashed; border-left-color: #786344; }
.profile-fact strong { display: block; font-weight: 400; margin-top: 6px; color: #e6d6c1; }
.profile-fact p, .profile-summary { white-space: pre-wrap; overflow-wrap: anywhere; margin: 6px 0; font-size: 16px; line-height: 1.45; }
.profile-fact small, .viewer-caption small { display: block; color: var(--dim); font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.profile-editor, .node-editor { margin: 18px 0 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.entry-editor { border: 1px solid var(--line); padding: 8px; margin-top: 8px; border-radius: 6px; }
.entry-editor summary { font-size: 14px; overflow-wrap: anywhere; }
.entry-editor button { margin-top: 8px; font-size: 13px; }
.profile-empty { color: var(--dim); font-size: 14px; margin: 10px 0; }
.image-viewer { width: min(1320px, 96vw); max-width: 96vw; max-height: 95vh; padding: 12px; background: #17141a; color: var(--ink); border: 1.5px solid #786658; border-radius: 12px; touch-action: pan-y; overflow: auto; }
.image-viewer::backdrop { background: rgba(0,0,0,.85); }
.viewer-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.viewer-toolbar [data-close] { margin-left: auto; }
.image-viewer > img { display: block; width: 100%; height: min(70vh, 820px); object-fit: contain; background: #0d0c0f; }
.viewer-caption { margin-top: 10px; line-height: 1.4; }
.viewer-caption strong { font-weight: 400; font-size: 18px; }
.viewer-caption p { margin: 6px 0; }
@media (max-width: 900px) and (min-width: 701px) { body.node-selected { --panel: 340px; } #top b { font-size: 20px; } }
@media (max-width: 700px) {
  #side { width: auto; max-height: 64vh; }
  body.node-selected #side { max-height: 65vh; }
  #top { right: 10px; gap: 5px; }
  #top b { font-size: 19px; }
  #jump { max-width: 165px; font-size: 14px; }
  .dossier-heading h2 { font-size: 24px; }
  .image-viewer { padding: 8px; }
  .image-viewer > img { height: 58vh; }
}
