.afm-shell {
  --afm-bg: #120f22;
  --afm-bg-2: #1b1630;
  --afm-panel: rgba(20, 15, 38, 0.92);
  --afm-border: rgba(193, 153, 255, 0.20);
  --afm-gold: #b78eff;
  --afm-gold-soft: #eadcff;
  --afm-blue: #c7b4ff;
  --afm-white: #f7f3ff;
  --afm-muted: #d6cbe8;
  --afm-line: rgba(193, 153, 255, 0.20);
  background: linear-gradient(180deg, var(--afm-bg), var(--afm-bg-2));
  color: var(--afm-white);
  border: 1px solid var(--afm-border);
  border-radius: 28px;
  padding: 1.15rem;
  box-shadow: 0 24px 62px rgba(0, 0, 0, 0.32);
  overflow: hidden;
  position: relative;
}
.afm-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(183,142,255,0.11), transparent 28%), radial-gradient(circle at bottom right, rgba(227,214,255,0.10), transparent 28%);
  pointer-events: none;
}
.afm-shell.is-preview { margin: 2.2rem 0 1rem; }

.afm-shell.is-map-only .afm-preview{display:none}
.afm-shell.is-map-only .afm-main{grid-template-columns:minmax(0,1fr)}
.afm-shell.is-map-only .afm-panel{display:none}
.afm-shell.is-preview-collapsed .afm-preview{display:none}

.afm-header,
.afm-toolbar,
.afm-focusbar,
.afm-main { position: relative; z-index: 2; }
.afm-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.afm-kicker {
  color: var(--afm-gold-soft);
  font-size: .88rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: .35rem;
}
.afm-title {
  margin: 0;
  font-size: clamp(1.55rem, 2vw, 2.25rem);
  line-height: 1.08;
}
.afm-subtitle {
  margin: .45rem 0 0;
  color: var(--afm-muted);
  max-width: 68ch;
}
.afm-actions,
.afm-filter-group,
.afm-panel-actions,
.afm-preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}
.afm-button,
.afm-button-link,
.afm-filter,
.afm-panel-link {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.05);
  color: var(--afm-white);
  border-radius: 999px;
  padding: .68rem .95rem;
  text-decoration: none;
  cursor: pointer;
  transition: .18s ease;
}
.afm-button:hover,
.afm-button-link:hover,
.afm-filter:hover,
.afm-panel-link:hover,
.afm-filter.is-active,
.afm-panel-link[data-variant="primary"] {
  background: rgba(183,142,255,0.16);
  border-color: rgba(193,153,255,0.34);
}
.afm-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .85rem;
  margin-bottom: .9rem;
}
.afm-search-wrap { position: relative; flex: 1 1 320px; min-width: min(100%, 280px); }
.afm-search {
  width: 100%;
  border-radius: 999px;
  padding: .92rem 1rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--afm-white);
}
.afm-search::placeholder { color: rgba(255,255,255,0.48); }
.afm-search-results {
  position: absolute;
  top: calc(100% + .4rem);
  left: 0;
  right: 0;
  background: rgba(8,12,18,0.98);
  border: 1px solid var(--afm-border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(0,0,0,0.35);
  z-index: 25;
}
.afm-search-result {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--afm-white);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: .75rem;
  text-align: left;
  padding: .85rem 1rem;
  cursor: pointer;
  align-items: start;
}
.afm-search-result:hover,
.afm-search-result:focus-visible { background: rgba(183,142,255,0.10); }
.afm-search-result.afm-search-result-mapall {
  background: rgba(183,142,255,0.10);
  border-bottom: 1px solid rgba(193,153,255,0.16);
  grid-template-columns: 1fr;
}
.afm-search-result.afm-search-result-mapall strong { color: var(--afm-gold); }
.afm-search-result strong { display:block; font-size:.98rem; line-height:1.2; }
.afm-search-result small { color: var(--afm-muted); display:block; line-height:1.28; }
.afm-search-result-main,
.afm-search-result-side { min-width: 0; }
.afm-search-result-side small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.afm-search-empty {
  display: block;
  cursor: default;
}
.afm-focusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: .85rem;
  padding: .85rem 1rem;
  border-radius: 18px;
  background: rgba(183,142,255,0.10);
  border: 1px solid rgba(193,153,255,0.20);
}
.afm-focuskicker {
  color: var(--afm-gold-soft);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.afm-focuslabel { font-weight: 700; }
.afm-focus-actions { display:flex; flex-wrap:wrap; gap:.55rem; align-items:center; justify-content:flex-end; }
.afm-main {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(300px, .86fr);
  gap: .95rem;
  align-items: stretch;
}
.afm-main.is-panel-collapsed { grid-template-columns: minmax(0, 1fr); }
.afm-main.is-panel-collapsed .afm-panel { display: none; }
.afm-canvas-wrap,
.afm-panel {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 24px;
}
.afm-canvas-wrap {
  padding: .8rem;
  position: relative;
}
.afm-hint {
  color: var(--afm-muted);
  font-size: .9rem;
  margin-bottom: .65rem;
}
.afm-canvas-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: .45rem;
  z-index: 6;
}
.afm-mini-button {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(7,11,17,0.72);
  color: var(--afm-white);
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0,0,0,0.25);
}
.afm-mini-button:hover,
.afm-mini-button.is-active { background: rgba(183,142,255,0.16); border-color: rgba(193,153,255,0.32); }
.afm-canvas {
  position: relative;
  touch-action: none;
  height: 74vh;
  min-height: 600px;
  border-radius: 20px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(4,7,10,.6), rgba(4,7,10,.88));
}
.afm-bg-stage,
.afm-bg-layer {
  position: absolute;
  inset: 0;
}
.afm-bg-image {
  background-image: linear-gradient(rgba(7,10,14,.46), rgba(7,10,14,.72)), var(--afm-chariot-bg);
  background-size: cover;
  background-position: center center;
  filter: saturate(.9) contrast(1.02);
  transform: scale(1.03);
}
.afm-bg-vignette {
  background: radial-gradient(circle at center, rgba(255,255,255,0.02), rgba(3,5,8,0.78) 82%);
}
.afm-world {
  position: absolute;
  inset: 0;
  width: 4000px;
  height: 4000px;
  transform-origin: 0 0;
  will-change: transform;
}
.afm-lines {
  position: absolute;
  inset: 0;
  width: 4000px;
  height: 4000px;
  overflow: visible;
}
.afm-lines line {
  stroke: var(--afm-line);
  stroke-width: 3;
  stroke-linecap: round;
}
.afm-nodes { position: absolute; inset: 0; }
.afm-node {
  overflow: hidden;
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(7,12,18,0.86);
  color: var(--afm-white);
  padding: .72rem .95rem;
  min-width: 132px;
  max-width: 240px;
  cursor: pointer;
  backdrop-filter: blur(16px);
  box-shadow: 0 14px 28px rgba(0,0,0,0.24);
  display: inline-flex;
  align-items: center;
  gap: .52rem;
}
.afm-node:hover,
.afm-node.is-active {
  border-color: rgba(193,153,255,0.42);
  background: rgba(24,20,42,0.94);
  box-shadow: 0 20px 34px rgba(0,0,0,0.28);
}
.afm-node.is-root-node {
  background: rgba(42, 27, 72, 0.92);
  border-color: rgba(193,153,255,0.40);
  min-width: 184px;
  box-shadow: 0 18px 40px rgba(81, 48, 141, 0.32);
}
.afm-node[data-type="search"] {
  background: rgba(27, 23, 46, 0.95);
  border-color: rgba(193,153,255,0.42);
  min-width: 200px;
}
.afm-node.afm-node-overflow {
  background: rgba(13, 17, 23, 0.92);
  border-style: dashed;
  min-width: 200px;
}
.afm-node-branch {
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(193,153,255,0.18);
  color: var(--afm-gold-soft);
  flex-shrink: 0;
}
.afm-node-label {
  font-weight: 600;
  font-size: .96rem;
  line-height: 1.2;
  text-align: left;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}
.afm-node-count {
  margin-left: auto;
  font-size: .76rem;
  color: var(--afm-gold-soft);
  opacity: .88;
}
.afm-node.is-cluster-node {
  min-width: 152px;
  max-width: 220px;
  background: rgba(34, 26, 58, 0.92);
  border-color: rgba(193,153,255,0.26);
}
.afm-node.is-leaf-node,
.afm-node[data-type="post"] {
  min-width: 0;
  max-width: 176px;
  padding: .54rem .74rem;
  background: rgba(20, 16, 34, 0.88);
  border-color: rgba(193,153,255,0.20);
  box-shadow: 0 10px 22px rgba(0,0,0,0.22);
}
.afm-node.is-leaf-node .afm-node-label,
.afm-node[data-type="post"] .afm-node-label {
  font-size: .82rem;
  -webkit-line-clamp: 3;
}
.afm-node.is-leaf-node .afm-node-branch,
.afm-node[data-type="post"] .afm-node-branch {
  width: 1.2rem;
  height: 1.2rem;
}
.afm-preview {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  width: min(430px, calc(100% - 2rem));
  background: rgba(8,12,18,0.88);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  padding: .9rem 1rem;
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 34px rgba(0,0,0,0.28);
  z-index: 6;
}
.afm-preview-media,
.afm-panel-media {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}
.afm-preview-media {
  margin: -.1rem 0 .75rem;
  max-height: 150px;
}
.afm-panel-media {
  max-height: 180px;
}
.afm-preview-image,
.afm-panel-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.afm-preview-kicker,
.afm-panel-kicker {
  color: var(--afm-gold-soft);
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .74rem;
  margin-bottom: .25rem;
}
.afm-preview-title,
.afm-panel-title {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.15;
}
.afm-preview-text,
.afm-panel-text {
  color: var(--afm-muted);
  margin-top: .45rem;
  line-height: 1.45;
}
.afm-panel { padding: .9rem; }
.afm-panel-inner { display: flex; flex-direction: column; gap: .75rem; }
.afm-panel-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .8rem;
}
.afm-panel-close {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: var(--afm-white);
  cursor: pointer;
}
.afm-panel-meta { color: var(--afm-gold-soft); font-size: .9rem; }
.afm-panel-section-title {
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--afm-gold-soft);
  margin-bottom: 0;
}
.afm-panel-children-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  margin-bottom: .45rem;
}
.afm-panel-children-count {
  color: var(--afm-gold-soft);
  font-size: .84rem;
}
.afm-panel-children-filter-wrap {
  display: block;
  margin-bottom: .55rem;
}
.afm-panel-children-filter {
  width: 100%;
  border-radius: 999px;
  padding: .72rem .9rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--afm-white);
}
.afm-panel-children-filter::placeholder {
  color: rgba(255,255,255,0.44);
}
.afm-panel-children-note {
  color: var(--afm-muted);
  font-size: .85rem;
  margin-bottom: .55rem;
}
.afm-panel-children {
  display: grid;
  gap: .55rem;
  max-height: min(54vh, 760px);
  overflow-y: auto;
  padding-right: .15rem;
}
.afm-panel-empty {
  color: var(--afm-muted);
  padding: .7rem .15rem;
}
.afm-preview-note {
  display: inline-flex;
  align-items: center;
  padding: .55rem .8rem;
  border-radius: 999px;
  color: var(--afm-gold-soft);
  background: rgba(183,142,255,0.10);
  border: 1px solid rgba(193,153,255,0.20);
}
.afm-child-item {
  width: 100%;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  background: rgba(255,255,255,0.035);
  color: var(--afm-white);
  padding: .75rem .8rem;
  text-align: left;
  cursor: pointer;
}
.afm-child-item:hover { border-color: rgba(193,153,255,0.26); background: rgba(183,142,255,0.08); }
.afm-child-top {
  display: flex;
  justify-content: space-between;
  gap: .65rem;
  align-items: baseline;
}
.afm-child-label { font-weight: 600; }
.afm-child-meta { color: var(--afm-gold-soft); font-size: .78rem; }
.afm-child-text {
  display: block;
  color: var(--afm-muted);
  margin-top: .28rem;
  font-size: .9rem;
  line-height: 1.38;
}

.afm-preview-notes,
.afm-panel-notes {
  margin-top: .7rem;
}
.afm-notes-wrap {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  background: rgba(255,255,255,0.03);
  padding: .78rem .86rem;
}
.afm-notes-top {
  display:flex;
  justify-content:space-between;
  gap:.6rem;
  align-items:baseline;
}
.afm-notes-title {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--afm-gold-soft);
}
.afm-notes-meta,
.afm-notes-summary,
.afm-note-date,
.afm-note-more {
  color: var(--afm-muted);
  font-size: .82rem;
}
.afm-notes-summary { margin-top:.34rem; line-height:1.35; }
.afm-reaction-bar { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:.55rem; margin-top:.58rem; padding:.5rem .58rem; border:1px solid rgba(255,255,255,0.05); border-radius:12px; background:rgba(255,255,255,0.02); }
.afm-reaction-count { color: var(--afm-muted); font-size:.82rem; }
.afm-notes-actions { display:flex; flex-wrap:wrap; gap:.5rem; margin-top:.6rem; }
.afm-note-list { display:grid; gap:.55rem; margin-top:.65rem; }
.afm-note-card {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  background: rgba(255,255,255,0.028);
  padding: .68rem .74rem;
}
.afm-note-head { display:flex; justify-content:space-between; gap:.55rem; flex-wrap:wrap; margin-bottom:.22rem; }
.afm-note-alias { color: var(--afm-white); font-weight:600; }
.afm-note-scripture { color: var(--afm-gold-soft); font-size:.8rem; }
.afm-note-body { color: var(--afm-white); line-height:1.42; font-size:.92rem; }
.afm-note-form { display:grid; gap:.55rem; margin-top:.7rem; }
.afm-note-hp { position:absolute !important; left:-9999px !important; opacity:0 !important; pointer-events:none !important; height:1px !important; width:1px !important; }
.afm-note-textarea,
.afm-note-input {
  width:100%;
  border-radius: 14px;
  padding: .72rem .82rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--afm-white);
}
.afm-note-grid { display:grid; grid-template-columns:repeat(2, minmax(0,1fr)); gap:.55rem; }
.afm-note-form-actions { display:flex; flex-wrap:wrap; gap:.5rem; }
.afm-note-message { color: var(--afm-gold-soft); font-size:.85rem; min-height:1.2em; }

.afm-canvas.is-dragging,
.afm-canvas.is-dragging * { cursor: grabbing !important; }
.afm-filter-group { overflow-x: auto; scrollbar-width: thin; }
.afm-filter-group::-webkit-scrollbar { height: 6px; }
.afm-filter-group::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.16); border-radius: 999px; }

@media (max-width: 1100px) {
  .afm-main { grid-template-columns: minmax(0, 1fr); }
  .afm-panel { order: 2; }
  .afm-preview { width: min(100%, calc(100% - 2rem)); }
}

@media (max-width: 782px) {
  .afm-shell { padding: .95rem; border-radius: 22px; }
  .afm-header,
  .afm-toolbar,
  .afm-focusbar { flex-direction: column; align-items: stretch; }
  .afm-actions { width: 100%; }
  .afm-actions .afm-button,
  .afm-focusbar .afm-button { width: 100%; }
  .afm-focus-actions { width:100%; }
  .afm-reaction-bar { align-items:stretch; }
  .afm-filter-group { flex-wrap: nowrap; padding-bottom: .2rem; }
  .afm-canvas { min-height: 620px; height: 76vh; }
  .afm-canvas-controls { top: .6rem; right: .6rem; }
  .afm-mini-button { width: 2rem; height: 2rem; }
  .afm-node {
  overflow: hidden;
    min-width: 104px;
    max-width: 164px;
    padding: .5rem .68rem;
    font-size: .86rem;
  }
  .afm-node-label { font-size: .84rem; }
  .afm-preview {
    left: .55rem;
    right: .55rem;
    bottom: .55rem;
    width: auto;
    padding: .68rem .72rem;
    border-radius: 15px;
  }
  .afm-preview-media { max-height: 72px; margin-bottom: .42rem; }
  .afm-panel { padding: .72rem; border-radius: 18px; }
  .afm-panel-media { max-height: 86px; }
  .afm-preview-title,
  .afm-panel-title { font-size: 1rem; }
  .afm-preview-text,
  .afm-panel-text { font-size: .92rem; line-height: 1.34; }
  .afm-note-grid { grid-template-columns: 1fr; }
  .afm-note-card { padding: .58rem .65rem; }
  .afm-panel-children { max-height: 34vh; }
  .afm-node.afm-node-overflow { min-width: 160px; }
  .afm-panel {
    position: fixed;
    left: .55rem;
    right: .55rem;
    bottom: .55rem;
    top: auto;
    z-index: 40;
    max-height: 64vh;
    overflow: auto;
    border-radius: 20px;
    background: rgba(8,12,18,0.97);
  }
  .afm-main.is-panel-collapsed .afm-panel { display: none; }
  .afm-panel-title { font-size: 1.05rem; }
}

.afm-shell.is-embed{padding:1rem;border-radius:0;border:none;box-shadow:none;min-height:100vh;background:linear-gradient(180deg,#061018,#0b1219)}
.afm-shell.is-embed .afm-header{margin-bottom:.75rem}
.afm-shell.is-embed .afm-title{font-size:clamp(1.2rem,2vw,1.7rem)}
.afm-shell.is-embed .afm-subtitle{max-width:52ch;font-size:.95rem}
.afm-shell.is-embed .afm-canvas{height:68vh;min-height:560px}
.afm-preview-actions .afm-button{font-size:.88rem}
.afm-panel-actions .afm-panel-link{font-weight:600}
.afm-launcher-btn{backdrop-filter:blur(14px)}
@media (max-width:782px){.afm-shell.is-embed{padding:.75rem}.afm-shell.is-embed .afm-canvas{height:64vh;min-height:480px}}

@media (max-width: 782px) {
  .afm-search-result {
    grid-template-columns: 1fr;
  }
}

.afm-related{display:flex;flex-direction:column;gap:.55rem;width:100%;padding-top:.2rem}
.afm-related-title{font-size:.72rem;letter-spacing:.08em;text-transform:uppercase;color:var(--afm-muted);font-weight:700}
.afm-related-chips{display:flex;flex-wrap:wrap;gap:.45rem}
.afm-related-chip{border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.05);color:var(--afm-text);border-radius:999px;padding:.42rem .72rem;font-size:.82rem;line-height:1.1;cursor:pointer;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.afm-related-chip:hover{border-color:rgba(214,176,74,.34);background:rgba(214,176,74,.12)}
.afm-related-preview{margin-top:.15rem}
.afm-related-panel{margin-top:.1rem}
@media (max-width: 782px){
  .afm-related-chips{overflow-x:auto;flex-wrap:nowrap;padding-bottom:.15rem}
  .afm-related-chip{font-size:.78rem;padding:.38rem .62rem}
}

@media (max-width: 782px){
  .afm-shell.is-map-only .afm-toolbar, .afm-shell.is-map-only .afm-focusbar { display:none; }
  .afm-shell.is-map-only .afm-canvas { min-height: 72vh; height: 72vh; }
}

.afm-note-cta{background:linear-gradient(180deg,#f8e58d 0%,#b78eff 100%) !important;border-color:rgba(214,176,74,.72) !important;color:#111827 !important;font-weight:800;box-shadow:0 10px 24px rgba(214,176,74,.2)}
.afm-note-cta:hover{background:linear-gradient(180deg,#fff0a8 0%,#dfb548 100%) !important;border-color:rgba(214,176,74,.9) !important;color:#111827 !important;transform:translateY(-1px)}
.afm-note-cta:disabled{opacity:.65;transform:none;box-shadow:none}

.afm-node[data-type="scripture-branch"]{background:rgba(33,22,6,.92);border-color:rgba(255,220,120,.32)}
.afm-node[data-type="scripture"]{background:rgba(12,20,10,.9);border-color:rgba(154,224,160,.22)}
.afm-node[data-type="scripture"]:hover,.afm-node[data-type="scripture"].is-active{border-color:rgba(154,224,160,.42);background:rgba(14,28,16,.95)}


.snp-shell .afm-node-label{letter-spacing:.01em}
.snp-shell .afm-panel,.snp-shell .afm-canvas-wrap{backdrop-filter:blur(10px)}
.snp-shell .afm-node.is-active{box-shadow:0 0 0 1px rgba(234,220,255,.35), 0 16px 38px rgba(84,54,140,.38)}
