/* ==========================================================================
   Chronik: Mindmap mit rotem Faden (app/chronik.js)
   ========================================================================== */
body.ck-open { overflow: hidden; }

.ck-overlay {
  --ck-bg: #0b0c0f;
  --ck-panel: rgba(18, 19, 24, 0.92);
  --ck-line: rgba(255, 255, 255, 0.1);
  --ck-text: #e8eaee;
  --ck-muted: #8b909b;
  --ck-gold: #e9c77b;
  --ck-red: #d0464a;
  position: fixed;
  inset: 0;
  z-index: 8000;
  display: flex;
  flex-direction: column;
  background: var(--ck-bg);
  color: var(--ck-text);
  font-family: var(--font-body, system-ui, sans-serif);
  outline: none;
}
.ck-overlay[hidden] { display: none; }

/* ---------- Kopfzeile ---------- */
.ck-top {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 18px;
  border-bottom: 1px solid var(--ck-line);
  background: linear-gradient(180deg, rgba(20, 21, 26, 0.98), rgba(14, 15, 19, 0.92));
}
.ck-title { display: flex; flex-direction: column; min-width: 0; }
.ck-kicker {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ck-gold);
}
.ck-title h2 {
  margin: 2px 0 0;
  font-family: "Archivo Black", Impact, sans-serif;
  font-style: italic;
  font-size: 24px;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ck-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ck-filters { display: flex; gap: 4px; flex-wrap: wrap; }

.ck-btn {
  padding: 7px 12px;
  border: 1px solid var(--ck-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ck-text);
  font-family: var(--font-display, sans-serif);
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ck-btn:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.22); }
.ck-btn:disabled { opacity: 0.35; cursor: default; }
.ck-btn.primary { background: var(--ck-gold); border-color: var(--ck-gold); color: #1a1408; }
.ck-btn.primary:hover { background: #f3d690; }
.ck-btn.danger { border-color: rgba(208, 70, 74, 0.5); color: #ffb3b5; background: rgba(208, 70, 74, 0.12); }
.ck-btn.danger:hover { background: rgba(208, 70, 74, 0.28); }

.ck-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--ck-line);
  border-radius: 999px;
  background: transparent;
  color: var(--ck-muted);
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.ck-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); opacity: 0.35; }
.ck-chip b { font-weight: 500; font-family: var(--font-mono, monospace); font-size: 10.5px; opacity: 0.7; }
.ck-chip.on { color: var(--ck-text); border-color: color-mix(in srgb, var(--c), transparent 45%); background: color-mix(in srgb, var(--c), transparent 88%); }
.ck-chip.on i { opacity: 1; box-shadow: 0 0 8px var(--c); }

.ck-close {
  width: 36px;
  height: 36px;
  border: 1px solid var(--ck-line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  color: var(--ck-text);
  font-size: 15px;
  cursor: pointer;
}
.ck-close:hover { background: rgba(208, 70, 74, 0.25); border-color: rgba(208, 70, 74, 0.6); }
.ck-close.small { width: 28px; height: 28px; font-size: 12px; }

/* ---------- Buehne ---------- */
.ck-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  cursor: grab;
  background-color: var(--ck-bg);
  background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1.2px);
  touch-action: none;
}
.ck-stage.panning { cursor: grabbing; }
.ck-layer { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.ck-svg { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; }

/* Roter Faden */
.ck-thread { stroke: var(--ck-red); stroke-width: 6; stroke-linecap: round; fill: none; }
.ck-thread-glow { stroke: rgba(208, 70, 74, 0.35); stroke-width: 26; stroke-linecap: round; fill: none; filter: blur(8px); }
.ck-thread-arrow { stroke: var(--ck-red); stroke-width: 6; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* Verbindungen */
.ck-edge-hit { stroke: transparent; stroke-width: 16; fill: none; cursor: pointer; }
.ck-edge-line { stroke: rgba(233, 199, 123, 0.55); stroke-width: 2; fill: none; pointer-events: none; transition: stroke 0.15s, opacity 0.2s; }
.ck-edge:hover .ck-edge-line,
.ck-edge.sel .ck-edge-line { stroke: var(--ck-gold); stroke-width: 3; }
.ck-edge.gm-only .ck-edge-line { stroke: rgba(181, 123, 224, 0.7); stroke-dasharray: 7 6; }
.ck-edge.dim { opacity: 0.15; }
.ck-edge-label {
  fill: #f3dda4;
  font-size: 13px;
  font-family: var(--font-body, sans-serif);
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--ck-bg);
  stroke-width: 5px;
  stroke-linejoin: round;
  pointer-events: none;
}
.ck-temp { stroke: var(--ck-gold); stroke-width: 2; stroke-dasharray: 6 5; }

/* Knoten */
.ck-node {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
  max-width: 230px;
  padding: 8px 14px 8px 8px;
  transform: translate(-50%, -50%);
  border: 1px solid color-mix(in srgb, var(--c), transparent 55%);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(28, 30, 37, 0.96), rgba(18, 19, 24, 0.96));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  cursor: pointer;
  user-select: none;
  transition: opacity 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.ck-node:hover { border-color: var(--c); }
.ck-node.sel { border-color: var(--c); box-shadow: 0 0 0 2px color-mix(in srgb, var(--c), transparent 40%), 0 14px 40px rgba(0, 0, 0, 0.55); }
.ck-node.dim { opacity: 0.25; }
.ck-node.drop { box-shadow: 0 0 0 3px var(--ck-gold), 0 0 30px rgba(233, 199, 123, 0.4); }
.ck-node.gm-only { border-style: dashed; background: linear-gradient(180deg, rgba(36, 28, 44, 0.96), rgba(22, 18, 28, 0.96)); }

.ck-node.station {
  min-width: 190px;
  border-color: color-mix(in srgb, var(--c), transparent 25%);
  border-width: 2px;
  box-shadow: 0 0 0 4px rgba(11, 12, 15, 1), 0 12px 34px rgba(0, 0, 0, 0.5);
}
.ck-station-no {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--ck-red);
  color: #fff;
  font-family: var(--font-mono, monospace);
  font-size: 11.5px;
  font-weight: 600;
  box-shadow: 0 0 0 3px var(--ck-bg);
}
.ck-node.k-event .ck-station-no { background: var(--ck-gold); color: #1a1408; }

.ck-avatar {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--c), transparent 80%) center / cover no-repeat;
  border: 2px solid color-mix(in srgb, var(--c), transparent 30%);
  color: var(--c);
  font-size: 16px;
}
.ck-text { display: flex; flex-direction: column; min-width: 0; }
.ck-kind {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--c), white 25%);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ck-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ck-gm {
  position: absolute;
  top: -8px;
  right: -8px;
  padding: 2px 6px;
  border-radius: 8px;
  background: #b57be0;
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.ck-handle {
  position: absolute;
  right: -7px;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  border-radius: 50%;
  background: var(--ck-gold);
  border: 3px solid var(--ck-bg);
  cursor: crosshair;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
}
.ck-node:hover .ck-handle,
.ck-node.sel .ck-handle { opacity: 1; }
.ck-handle:hover { transform: scale(1.3); }

/* ---------- Seitenleiste ---------- */
.ck-drawer {
  position: absolute;
  top: 70px;
  right: 14px;
  bottom: 14px;
  z-index: 4;
  width: min(340px, calc(100vw - 28px));
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
  border: 1px solid var(--ck-line);
  border-top: 3px solid var(--c, var(--ck-gold));
  border-radius: 16px;
  background: var(--ck-panel);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.ck-drawer[hidden] { display: none; }
.ck-d-head { display: flex; align-items: center; justify-content: space-between; }
.ck-d-kind { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--c, var(--ck-gold)); }
.ck-d-image { height: 140px; border-radius: 10px; background: center / cover no-repeat; }
.ck-d-title { margin: 0; font-size: 20px; line-height: 1.2; }
.ck-d-sub { margin: -4px 0 0; color: var(--ck-muted); font-size: 13px; }
.ck-d-author { margin: 0; color: var(--ck-muted); font-size: 12px; font-style: italic; }
.ck-d-text { white-space: pre-wrap; font-size: 13.5px; line-height: 1.55; color: #cfd2d8; max-height: 260px; overflow-y: auto; }
.ck-d-muted { margin: 0; color: var(--ck-muted); font-size: 12px; }
.ck-d-section { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--ck-line); }
.ck-d-label { margin: 0; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ck-muted); }
.ck-d-row { display: flex; gap: 6px; }
.ck-d-row .ck-btn { flex: 1; }

.ck-input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--ck-line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--ck-text);
  font: inherit;
  font-size: 14px;
}
.ck-input:focus { outline: none; border-color: color-mix(in srgb, var(--c, var(--ck-gold)), transparent 30%); }
input.ck-d-title { font-size: 18px; font-weight: 600; }
.ck-d-body { resize: vertical; line-height: 1.5; }

.ck-d-link { display: flex; align-items: stretch; gap: 4px; }
.ck-d-link-go {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--ck-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--ck-text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.ck-d-link-go:hover { border-color: color-mix(in srgb, var(--c), transparent 40%); }
.ck-d-link-go i { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--c); }
.ck-d-link-go em { color: #f3dda4; font-style: normal; font-size: 12px; margin-left: auto; }
.ck-d-link.gm-only .ck-d-link-go { border-style: dashed; border-color: rgba(181, 123, 224, 0.5); }
.ck-d-link-del {
  width: 32px;
  border: 1px solid var(--ck-line);
  border-radius: 10px;
  background: transparent;
  color: var(--ck-muted);
  cursor: pointer;
}
.ck-d-link-del:hover { color: #ffb3b5; border-color: rgba(208, 70, 74, 0.55); }

.ck-switch { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.ck-switch small { color: var(--ck-muted); font-size: 11.5px; margin-left: auto; }
.ck-switch input { position: absolute; opacity: 0; pointer-events: none; }
.ck-switch span {
  position: relative;
  width: 36px;
  height: 20px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.2s;
}
.ck-switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
}
.ck-switch input:checked + span { background: var(--c, var(--ck-gold)); }
.ck-switch input:checked + span::after { transform: translateX(16px); }
.ck-switch input:focus-visible + span { outline: 2px solid var(--ck-gold); outline-offset: 2px; }

/* ---------- Kleinteile ---------- */
.ck-hint {
  position: absolute;
  left: 50%;
  bottom: 14px;
  z-index: 2;
  max-width: calc(100vw - 32px);
  padding: 7px 14px;
  transform: translateX(-50%);
  border: 1px solid var(--ck-line);
  border-radius: 999px;
  background: rgba(14, 15, 19, 0.85);
  color: var(--ck-muted);
  font-size: 12px;
  text-align: center;
  pointer-events: none;
}
.ck-pop {
  position: absolute;
  z-index: 6;
  width: 290px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(233, 199, 123, 0.4);
  border-radius: 14px;
  background: var(--ck-panel);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
}
.ck-pop[hidden] { display: none; }
.ck-pop-title { margin: 0; font-size: 13px; color: var(--ck-muted); }
.ck-pop-actions { display: flex; justify-content: flex-end; gap: 6px; }
.ck-check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ck-toast {
  position: absolute;
  left: 50%;
  top: 80px;
  z-index: 7;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--ck-gold);
  color: #1a1408;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.ck-toast[hidden] { display: none; }

@media (max-width: 640px) {
  .ck-top { padding: 10px 16px; }
  .ck-hint { display: none; }
  .ck-drawer { top: auto; left: 16px; right: 16px; width: auto; max-height: 60vh; }
}

@media (prefers-reduced-motion: no-preference) {
  .ck-overlay:not([hidden]) { animation: ck-in 0.35s cubic-bezier(0.16, 1, 0.3, 1); }
  .ck-drawer:not([hidden]) { animation: ck-drawer-in 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
  .ck-thread-glow { animation: ck-glow 3.5s ease-in-out infinite alternate; }
}
@keyframes ck-in { from { opacity: 0; transform: scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes ck-drawer-in { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes ck-glow { from { opacity: 0.6; } to { opacity: 1; } }

/* Autor im Archiv */
.realm-entry-author {
  display: block;
  margin: -2px 0 6px;
  color: var(--parchment-muted, #8b909b);
  font-size: 11.5px;
  font-style: italic;
}
