.section-subtitle { color: var(--muted); font-size: 13px; margin-top: 5px; }
.lore-tabs { display: inline-flex; padding: 4px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 22px; }
.lore-tabs button { border: 0; background: transparent; color: var(--muted); padding: 9px 16px; border-radius: 9px; font-weight: 700; cursor: pointer; }
.lore-tabs button.active { background: var(--card); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.image-picker { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; }
.image-preview { width: 150px; height: 100px; border: 1px dashed var(--line); border-radius: 12px; overflow: hidden; background: var(--soft); display: grid; place-items: center; color: var(--muted); font-size: 12px; }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.lore-item { display: flex; align-items: center; gap: 10px; }
.lore-item img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; flex: none; }
.lore-item div { min-width: 0; }
.lore-item b, .lore-item small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.lore-map { background: var(--card); border: 1px solid var(--line); border-radius: 15px; min-height: 540px; overflow: auto; padding: 34px 24px; }
.tree { display: inline-block; min-width: 100%; }
.tree ul { padding-top: 28px; position: relative; display: flex; justify-content: center; margin: 0; padding-left: 0; }
.tree li { list-style: none; text-align: center; position: relative; padding: 28px 10px 0; }
.tree li::before, .tree li::after { content: ''; position: absolute; top: 0; right: 50%; border-top: 1px solid var(--line); width: 50%; height: 28px; }
.tree li::after { right: auto; left: 50%; border-left: 1px solid var(--line); }
.tree li:only-child::before, .tree li:only-child::after { display: none; }
.tree li:only-child { padding-top: 0; }
.tree li:first-child::before, .tree li:last-child::after { border: 0; }
.tree li:last-child::before { border-right: 1px solid var(--line); border-radius: 0 8px 0 0; }
.tree li:first-child::after { border-radius: 8px 0 0 0; }
.tree ul ul::before { content: ''; position: absolute; top: 0; left: 50%; border-left: 1px solid var(--line); height: 28px; }
.tree > ul > li { padding-top: 0; }
.tree > ul > li::before, .tree > ul > li::after { display: none; }
.lore-node { position: relative; width: 220px; min-height: 92px; display: flex; align-items: center; gap: 11px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 13px; padding: 12px; box-shadow: var(--shadow); cursor: pointer; transition: .16s; }
.lore-node:hover { transform: translateY(-2px); border-color: var(--accent); }
.lore-node > img, .node-symbol { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; }
.node-symbol { display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 24px; }
.node-copy { min-width: 0; }
.node-copy small { display: block; color: var(--accent); font-size: 10px; text-transform: uppercase; font-weight: 800; margin-bottom: 4px; }
.node-copy b { display: block; font-size: 13px; }
.node-copy p { color: var(--muted); font-size: 11px; line-height: 1.35; margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.node-add { position: absolute; right: -7px; bottom: -7px; width: 25px; height: 25px; border-radius: 50%; border: 1px solid var(--line); background: var(--text); color: var(--panel); cursor: pointer; font-weight: 800; }
.mob-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(245px,1fr)); gap: 15px; }
.mob-card { overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); cursor: pointer; transition: .16s; }
.mob-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.mob-card > img, .mob-placeholder { width: 100%; height: 155px; object-fit: cover; }
.mob-placeholder { display: grid; place-items: center; background: linear-gradient(135deg,var(--soft),var(--accent-soft)); color: var(--accent); font-size: 44px; }
.mob-card-body { padding: 15px; }
.mob-card-body .toolbar { margin-bottom: 11px; }
.mob-card-body h3 { font-size: 16px; margin-bottom: 7px; }
.mob-card-body p { font-size: 12px; line-height: 1.5; color: var(--muted); height: 36px; overflow: hidden; }
.mob-stats { display: flex; gap: 18px; border-top: 1px solid var(--line); padding-top: 12px; margin-top: 13px; color: var(--muted); font-size: 11px; }
.mob-stats b { color: var(--text); font-size: 13px; }
.task-card > img { width: calc(100% + 24px); height: 100px; object-fit: cover; margin: -12px -12px 11px; border-radius: 10px 10px 0 0; }
.story-toolbar { position: sticky; top: 85px; z-index: 3; display: flex; gap: 5px; flex-wrap: wrap; padding: 8px; margin: 22px -8px 0; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb,var(--card) 92%,transparent); backdrop-filter: blur(12px); }
.story-toolbar button { border: 0; border-radius: 8px; background: transparent; color: var(--muted); padding: 8px 10px; font-size: 12px; font-weight: 700; cursor: pointer; }
.story-toolbar button:hover { background: var(--soft); color: var(--text); }
.story-toolbar button.active { background: var(--accent-soft); color: var(--accent); }
.tool-divider { width: 1px; min-height: 26px; align-self: center; background: var(--line); margin: 0 2px; }
.story-editor { min-height: 58vh; padding: 32px clamp(12px,6vw,80px); margin: 12px 0 8px; border: 1px solid var(--line); border-radius: 13px; outline: 0; background: color-mix(in srgb,var(--card) 97%,var(--soft)); font-family: Georgia,"Times New Roman",serif; font-size: 17px; line-height: 1.8; }
.story-editor:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.story-editor:empty::before { content: attr(data-placeholder); color: var(--muted); pointer-events: none; }
.story-editor p { margin: 0 0 1em; }
.story-editor h2 { margin: 1.4em 0 .55em; font-family: Inter,ui-sans-serif,sans-serif; font-size: 25px; line-height: 1.25; }
.story-editor h3 { margin: 1.25em 0 .5em; font-family: Inter,ui-sans-serif,sans-serif; font-size: 19px; }
.story-editor blockquote { margin: 1.2em 0; padding: 10px 18px; border-left: 3px solid var(--accent); background: var(--soft); color: var(--muted); }
.story-image { position: relative; width: min(100%,680px); margin: 26px auto; padding: 0; border: 1px solid var(--line); border-radius: 13px; overflow: visible; background: var(--soft); cursor: grab; box-shadow: var(--shadow); }
.story-image[data-size="small"] { width: 35%; }
.story-image[data-size="medium"] { width: 55%; }
.story-image[data-size="large"] { width: 75%; }
.story-image[data-size="full"] { width: 100%; }
.story-image:active { cursor: grabbing; }
.story-image img { display: block; width: 100%; max-height: 520px; object-fit: contain; border-radius: 12px 12px 0 0; background: var(--soft); }
.story-image figcaption { min-height: 38px; padding: 8px 12px; color: var(--muted); font-family: Inter,ui-sans-serif,sans-serif; font-size: 12px; text-align: center; outline: 0; }
.remove-story-image { position: absolute; top: -10px; right: -10px; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 50%; background: var(--text); color: var(--panel); font-size: 18px; cursor: pointer; box-shadow: var(--shadow); }
.story-image-tools { position: absolute; z-index: 2; top: 9px; left: 9px; display: flex; align-items: center; gap: 3px; padding: 4px; border: 1px solid var(--line); border-radius: 9px; background: color-mix(in srgb,var(--panel) 94%,transparent); font-family: Inter,ui-sans-serif,sans-serif; box-shadow: var(--shadow); opacity: 0; transform: translateY(-4px); transition: .16s; }
.story-image:hover .story-image-tools, .story-image:focus-within .story-image-tools { opacity: 1; transform: none; }
.story-image-tools span { padding: 0 5px; color: var(--muted); font-size: 10px; font-weight: 750; }
.story-image-tools button { border: 0; border-radius: 6px; background: transparent; color: var(--muted); padding: 5px 7px; font-size: 10px; font-weight: 750; cursor: pointer; }
.story-image-tools button:hover, .story-image-tools button.active { background: var(--accent-soft); color: var(--accent); }
.editor-hint { color: var(--muted); font-size: 11px; margin: 0 4px 22px; }
.modal.mob-modal { width: min(1000px,100%); }
.mob-visual-toolbar { position: relative; top: auto; margin: 0 0 8px; }
.mob-visual-editor { min-height: 380px; padding: 26px clamp(14px,5vw,60px); margin-top: 0; }
.mob-visual-editor .story-image { margin-top: 22px; margin-bottom: 22px; }
.mob-attacks-section { margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.mob-attacks-section > .toolbar { margin-bottom: 10px; }
.mob-attack-row { display: grid; gap: 13px; margin-bottom: 12px; padding: 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.mob-attack-head { display: flex; align-items: center; gap: 12px; }
.mob-attack-head .parry-toggle { margin-left: auto; display: flex; align-items: center; gap: 6px; color: var(--accent); }
.attack-runtime-hint { padding: 9px 11px; border-radius: 9px; background: var(--soft); color: var(--muted); font-size: 11px; line-height: 1.5; }
.attack-runtime-hint code { color: var(--accent); }
.mob-attack-empty { min-height: 120px; border: 1px dashed var(--line); border-radius: 12px; }
.node-edit { position: absolute; top: 5px; right: 6px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 800; letter-spacing: -2px; }
.connected-document { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.connected-document small, .map-help { color: var(--muted); font-size: 12px; }
.map-help { margin-top: 17px; line-height: 1.5; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.lore-graph-shell { position: relative; height: calc(100vh - 245px); min-height: 580px; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--card); box-shadow: var(--shadow); }
.lore-viewport { --map-grid-size: 26px; --map-grid-x: 0px; --map-grid-y: 0px; position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; background-color: var(--card); background-image: radial-gradient(circle,var(--line) 1.15px,transparent 1.2px); background-size: var(--map-grid-size) var(--map-grid-size); background-position: var(--map-grid-x) var(--map-grid-y); }
.lore-viewport:active { cursor: grabbing; }
.graph-world { position: absolute; left: 0; top: 0; width: 6000px; height: 4000px; transform-origin: 0 0; will-change: transform; }
.edge-layer { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.edge-layer marker path { fill: var(--muted); }
.graph-edge { fill: none; stroke: var(--muted); stroke-width: 2.2; opacity: .6; }
.graph-edge.relation-enemy { stroke: var(--danger); stroke-dasharray: 7 5; }
.graph-edge.relation-ally { stroke: #48a06a; }
.graph-edge.relation-located_in { stroke: var(--accent); stroke-dasharray: 3 4; }
.graph-edge.relation-reveals { stroke: #b277d5; }
.edge-layer foreignObject { overflow: visible; pointer-events: all; }
.edge-label { width: 130px; min-height: 28px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; background: var(--panel); color: var(--muted); font-size: 10px; font-weight: 800; cursor: pointer; box-shadow: 0 3px 10px rgba(0,0,0,.08); }
.edge-label:hover { color: var(--text); border-color: var(--accent); }
.graph-node { position: absolute; width: 240px; min-height: 104px; display: flex; align-items: center; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: 0 10px 25px rgba(20,25,30,.11); cursor: grab; user-select: none; touch-action: none; }
.graph-node:hover { border-color: var(--accent); box-shadow: 0 12px 30px rgba(30,30,60,.16); }
.graph-node:active { cursor: grabbing; }
.graph-node > img, .graph-node > .node-symbol { width: 62px; height: 70px; object-fit: cover; border-radius: 10px; flex: none; }
.graph-node > img, .story-image img { -webkit-user-drag: none; user-select: none; }
.graph-node .node-copy { padding-right: 5px; }
.graph-node .node-edit { top: 4px; right: 7px; }
.graph-node .node-add { right: -9px; bottom: -9px; width: 29px; height: 29px; }
.map-controls { position: absolute; z-index: 8; top: 14px; left: 14px; display: flex; align-items: center; gap: 3px; padding: 5px; border: 1px solid var(--line); border-radius: 11px; background: color-mix(in srgb,var(--panel) 94%,transparent); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.map-controls button { border: 0; border-radius: 7px; background: transparent; color: var(--text); min-width: 32px; height: 32px; padding: 0 8px; cursor: pointer; font-weight: 750; }
.map-controls button:hover { background: var(--soft); }
.map-controls span { min-width: 48px; text-align: center; color: var(--muted); font-size: 11px; font-weight: 750; }
.graph-empty { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; color: var(--muted); pointer-events: none; }
.graph-empty b, .graph-empty span { display: block; }
.graph-empty b { color: var(--text); margin-bottom: 7px; }
@media (max-width: 900px) { .lore-map { padding: 24px 12px; } }
@media (max-width: 600px) {
  .lore-tabs { display: flex; }
  .lore-tabs button { flex: 1; padding: 9px 8px; }
  .image-picker { grid-template-columns: 1fr; }
  .image-preview { width: 100%; height: 160px; }
  .mob-grid { grid-template-columns: 1fr; }
  .story-toolbar { top: 72px; }
  .story-editor { padding: 24px 14px; font-size: 16px; }
  .map-heading { align-items: flex-start; }
  .lore-graph-shell { height: calc(100vh - 280px); min-height: 520px; }
}
