/* Palime Knowledge Map — structured temporal swimlane UI */
.km-root { position: relative; width: 100%; height: calc(100vh - 60px); min-height: 600px;
  background: radial-gradient(ellipse at 50% 30%, #0c1018 0%, #06070c 100%); overflow: hidden; color: #cdd5e0; }
.km-scene { position: absolute; inset: 0; }
.km-svg { width: 100%; height: 100%; display: block; }

.km-era-label { fill: #aeb9c9; font: 600 14px Inter, Arial, sans-serif; }
.km-era-sub { fill: #5a6577; font: 11px Inter, Arial, sans-serif; }
.km-lane-label { fill: #8b97a8; font: 600 14px Inter, Arial, sans-serif; }
.km-node-label { fill: #e7edf4; font: 12px Inter, Arial, sans-serif; pointer-events: none; }
.km-node { transition: opacity .2s; }
.km-node.km-sel rect { stroke-width: 2.4; filter: drop-shadow(0 0 6px currentColor); }
.km-edges path { transition: opacity .2s; }
.km-dim-y { fill: #6b7686; }

/* top bar */
.km-top { position: absolute; top: 12px; left: 16px; right: 16px; height: 40px; display: flex;
  align-items: center; gap: 14px; z-index: 5; pointer-events: none; }
.km-top > * { pointer-events: auto; }
.km-title { display: flex; flex-direction: column; line-height: 1.1; }
.km-title b { font-size: 15px; color: #eef2f7; }
.km-title span { font-size: 11px; color: #6b7686; }
.km-cambtns { display: flex; gap: 6px; margin-left: 10px; }
.km-btn { background: rgba(20,26,38,.8); border: 1px solid #2a3342; color: #b8c2d0;
  padding: 6px 12px; border-radius: 8px; font-size: 12px; cursor: pointer; }
.km-btn:hover { border-color: #3d6ea5; }
.km-btn.active { background: #1f2c44; border-color: #4f86c6; color: #fff; }
.km-search { margin-left: auto; width: 240px; background: rgba(20,26,38,.85); border: 1px solid #2a3342;
  color: #cdd5e0; padding: 7px 12px; border-radius: 8px; font-size: 13px; }

/* right card */
.km-card { position: absolute; top: 64px; right: 16px; width: 268px; max-height: calc(100% - 150px);
  overflow: auto; background: rgba(12,16,24,.96); border: 1px solid #28303f; border-radius: 12px;
  padding: 16px; z-index: 6; box-shadow: 0 10px 40px rgba(0,0,0,.5); }
.km-card-x { position: absolute; top: 10px; right: 12px; background: none; border: none; color: #6b7686;
  font-size: 20px; cursor: pointer; line-height: 1; }
.km-card-name { font-size: 18px; font-weight: 700; color: #f1f4f8; padding-right: 18px; }
.km-card-meta { font-size: 12px; color: #8b97a8; margin-top: 2px; }
.km-card-year { font-size: 12px; color: #aeb9c9; margin-top: 4px; }
.km-card-tags { margin-top: 8px; }
.km-tagchip { display: inline-block; background: #1a2436; border: 1px solid #2c3a52; color: #9fc0e8;
  font-size: 11px; padding: 2px 8px; border-radius: 10px; margin: 2px 3px 0 0; }
.km-card-sec { margin-top: 14px; }
.km-card-sec-t { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #5f6b7c; margin-bottom: 5px; }
.km-card-rel { display: block; color: #cdd5e0; text-decoration: none; font-size: 13px; padding: 4px 8px;
  border-radius: 6px; background: rgba(255,255,255,.025); margin-bottom: 4px; }
.km-card-rel:hover { background: rgba(79,134,198,.18); }
.km-card-actions { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.km-card-path { background: #c0392b; border: none; color: #fff; padding: 9px; border-radius: 8px; font-size: 13px; cursor: pointer; font-weight: 600; }
.km-card-open { text-align: center; background: rgba(255,255,255,.05); border: 1px solid #2a3342; color: #cdd5e0;
  padding: 9px; border-radius: 8px; font-size: 13px; text-decoration: none; }

/* timeline */
.km-timeline { position: absolute; bottom: 34px; left: 16px; right: 300px; height: 36px; z-index: 5;
  background: rgba(12,16,24,.7); border: 1px solid #222a38; border-radius: 8px; }
.km-tl-track { position: relative; height: 100%; }
.km-tl-tick { position: absolute; top: 10px; transform: translateX(-50%); font-size: 11px; color: #6b7686; }

/* legend */
.km-legend { position: absolute; bottom: 8px; left: 16px; right: 16px; font-size: 11px; color: #5f6b7c; z-index: 5; }


/* 3D windowed navigator */
.km-canvas { position: absolute; inset: 0; display: block; }
.km3d-hud { position: absolute; top: 14px; left: 0; right: 0; text-align: center; z-index: 5;
  display: flex; align-items: center; justify-content: center; gap: 8px; pointer-events: none; }
.km3d-hud > * { pointer-events: auto; }
.km3d-nav { background: rgba(12,16,24,.85); border: 1px solid #28303f; color: #b8c2d0; width: 30px; height: 30px;
  border-radius: 50%; font-size: 17px; cursor: pointer; line-height: 1; }
.km3d-nav:hover { border-color: #4f86c6; color: #fff; }
.km3d-hint { position: absolute; bottom: 78px; left: 0; right: 0; text-align: center; font-size: 11px; color: #5a6577; z-index: 5; }
.km3d-winlabel { display: inline-block; background: rgba(12,16,24,.8); border: 1px solid #28303f;
  border-radius: 20px; padding: 6px 18px; font-size: 13px; color: #aeb9c9; }
.km3d-scrub { position: absolute; bottom: 18px; left: 24px; right: 24px; height: 52px; z-index: 5;
  background: rgba(10,14,22,.82); border: 1px solid #222a38; border-radius: 10px; cursor: pointer; }
.km3d-scrub-bars { position: absolute; inset: 0 0 18px 0; }
.km3d-scrub-bars i { position: absolute; bottom: 0; width: 3px; background: linear-gradient(#5a7fb0,#2c3e5a);
  transform: translateX(-50%); border-radius: 2px; }
.km3d-scrub-axis { position: absolute; bottom: 2px; left: 0; right: 0; height: 14px; }
.km3d-scrub-axis span { position: absolute; transform: translateX(-50%); font-size: 10px; color: #6b7686; }
.km3d-scrub-win { position: absolute; top: 0; bottom: 16px; background: rgba(79,134,198,.16);
  border-left: 1px solid rgba(120,170,230,.5); border-right: 1px solid rgba(120,170,230,.5); pointer-events: none; }
.km3d-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: #e8554e; transform: translateX(-50%);
  box-shadow: 0 0 8px #e8554e; }

.km3d-toolbar { position: absolute; top: 12px; left: 14px; right: 14px; z-index: 8; display: grid;
  grid-template-columns: minmax(132px, 1fr) minmax(98px, 132px) minmax(132px, 180px) minmax(160px, 240px) auto;
  align-items: end; gap: 8px; pointer-events: none; }
.km3d-toolbar > * { pointer-events: auto; }
.km3d-title { display: flex; flex-direction: column; gap: 2px; color: #f4f1ea; line-height: 1.1; }
.km3d-title b { font-size: 15px; }
.km3d-title span { font-size: 11px; color: #9a9387; }
.km3d-toolbar label { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 10px; color: #8d98a7;
  text-transform: uppercase; letter-spacing: .04em; }
.km3d-toolbar select, .km3d-toolbar input, .km3d-reset { width: 100%; height: 34px; border-radius: 8px;
  border: 1px solid rgba(142,151,164,.28); background: rgba(14,16,22,.84); color: #e7edf4; padding: 0 10px;
  font-size: 13px; outline: none; }
.km3d-toolbar select:focus, .km3d-toolbar input:focus, .km3d-reset:focus { border-color: #d99b42; }
.km3d-reset { width: auto; min-width: 104px; cursor: pointer; background: rgba(72,42,36,.78); color: #fff3e1; }
.km3d-reset:hover { border-color: #e1aa50; }
.km3d-pathinfo { margin-top: 4px; font-size: 11px; color: #8d98a7; }
.km3d-search-results { position: absolute; top: 58px; right: 126px; width: min(280px, calc(100vw - 32px)); max-height: 280px;
  overflow: auto; z-index: 11; border: 1px solid rgba(142,151,164,.32); background: rgba(10,12,17,.96);
  border-radius: 8px; padding: 6px; box-shadow: 0 18px 52px rgba(0,0,0,.45); }
.km3d-search-results button { display: block; width: 100%; border: 0; border-radius: 6px; background: transparent;
  color: #e7edf4; text-align: left; padding: 8px 9px; font-size: 13px; cursor: pointer; }
.km3d-search-results button:hover { background: rgba(225,170,80,.14); }
.km3d-status { position: absolute; top: 66px; left: 50%; transform: translateX(-50%); z-index: 7; color: #c7d0de;
  font-size: 12px; background: rgba(10,12,17,.7); border-radius: 8px; padding: 6px 10px; }
.km3d-status:empty { display: none; }
.km3d-empty { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6; max-width: 360px;
  border: 1px solid rgba(142,151,164,.22); background: rgba(11,14,20,.86); color: #d6dde7; border-radius: 8px;
  padding: 16px 18px; text-align: center; font-size: 14px; line-height: 1.45; pointer-events: none; }
.km3d-card { position: absolute; top: 64px; right: 14px; z-index: 10; width: min(320px, calc(100vw - 28px));
  max-height: calc(100% - 148px); overflow: auto; border: 1px solid rgba(142,151,164,.32); border-radius: 8px;
  background: rgba(10,12,17,.96); color: #e7edf4; padding: 12px; box-shadow: 0 18px 52px rgba(0,0,0,.5); }
.km3d-card-x { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.42); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.km3d-card-img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px;
  background: #171b22; margin-bottom: 10px; }
.km3d-card-type { color: #e1aa50; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.km3d-card h2 { margin: 4px 0 5px; font-size: 20px; line-height: 1.15; color: #fff; letter-spacing: 0; }
.km3d-card-meta { color: #9ca7b6; font-size: 12px; margin-bottom: 9px; }
.km3d-card p { margin: 0 0 10px; color: #cdd5df; font-size: 13px; line-height: 1.45; }
.km3d-card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 12px; }
.km3d-card-tags span { border: 1px solid rgba(114,214,163,.26); color: #a9eac8; border-radius: 999px;
  padding: 3px 7px; font-size: 11px; }
.km3d-card-link { display: block; text-align: center; border-radius: 8px; padding: 9px 10px; text-decoration: none;
  background: #a83d35; color: #fff; font-weight: 650; font-size: 13px; }

@media (max-width: 820px) {
  .km-root { height: calc(100vh - 54px); min-height: 620px; }
  .km3d-toolbar { grid-template-columns: 1fr 1fr; align-items: end; }
  .km3d-title { grid-column: 1 / -1; }
  .km3d-search-wrap { grid-column: 1 / -1; }
  .km3d-reset { width: 100%; }
  .km3d-hud { top: 218px; }
  .km3d-search-results { top: 166px; left: 14px; right: 14px; width: auto; }
  .km3d-card { top: auto; left: 14px; right: 14px; bottom: 84px; width: auto; max-height: 42%; }
  .km3d-hint { bottom: 78px; padding: 0 16px; }
  .km3d-scrub { left: 12px; right: 12px; }
}

/* 2026 knowledge-map redesign: editorial timeline shell over one 3D scene */
.km-root {
  background:
    linear-gradient(90deg, rgba(4, 7, 11, .97) 0 168px, transparent 168px),
    linear-gradient(180deg, #070a0f 0%, #0b1018 52%, #070a0f 100%);
}

.km-root::before {
  content: "";
  position: absolute;
  inset: 108px 0 86px 0;
  z-index: 1;
  pointer-events: none;
  border-top: 1px solid rgba(140, 151, 164, .14);
  border-bottom: 1px solid rgba(140, 151, 164, .14);
  background:
    linear-gradient(90deg, rgba(6,10,15,.94) 0 168px, rgba(6,10,15,.20) 168px 100%);
}

.km-canvas {
  z-index: 2;
}

.km3d-grid {
  position: absolute;
  z-index: 3;
  top: 108px;
  right: 0;
  bottom: 86px;
  left: 168px;
  pointer-events: none;
}

.km3d-grid-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.km3d-grid-ticks,
.km3d-grid-lanes {
  position: absolute;
  inset: 0;
}

.km3d-grid-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(112, 126, 146, .16);
}

.km3d-grid-tick.is-major {
  background: rgba(164, 178, 200, .25);
}

.km3d-grid-tick b {
  position: absolute;
  top: 10px;
  left: 8px;
  color: #6f7a8b;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.km3d-grid-tick i {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 1px;
  background: currentColor;
  opacity: .18;
}

.km3d-grid-lanes {
  display: grid;
  grid-template-rows: repeat(var(--km-lane-count), minmax(0, 1fr));
}

.km3d-grid-lanes span {
  border-bottom: 1px solid rgba(140, 151, 164, .12);
  background: linear-gradient(180deg, rgba(255,255,255,.018), transparent 42%);
}

.km3d-grid-cursor {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(232, 85, 78, .78);
  box-shadow: 0 0 18px rgba(232, 85, 78, .45);
}

.km3d-toolbar {
  top: 0;
  left: 0;
  right: 0;
  min-height: 108px;
  padding: 18px 20px 14px 22px;
  grid-template-columns: minmax(230px, 1fr) 118px 166px minmax(190px, 236px) 118px;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid rgba(140,151,164,.14);
  background: linear-gradient(180deg, rgba(5,8,12,.97), rgba(5,8,12,.72));
  backdrop-filter: blur(12px);
}

.km3d-title b {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 2.1vw, 32px);
  font-weight: 600;
  letter-spacing: 0;
}

.km3d-title span {
  color: #8d98a7;
}

.km3d-toolbar select,
.km3d-toolbar input,
.km3d-reset {
  background: rgba(12, 17, 25, .88);
  border-color: rgba(123, 137, 157, .24);
  border-radius: 5px;
}

.km3d-reset {
  border-color: rgba(232,85,78,.38);
  background: rgba(62, 27, 24, .64);
}

.km3d-search-results {
  top: 76px;
  right: 154px;
}

.km3d-hud {
  top: 18px;
  z-index: 9;
  width: min(280px, 28vw);
  left: 50%;
  right: auto;
  transform: translateX(-50%);
}

.km3d-winlabel {
  min-width: 148px;
  border: 0;
  background: transparent;
  color: #f5efe8;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(28px, 2.8vw, 38px);
  line-height: 1;
  padding: 0 14px;
  white-space: nowrap;
}

.km3d-pathinfo {
  display: none;
}

.km3d-nav {
  width: 38px;
  height: 38px;
  border-color: rgba(140,151,164,.34);
  background: rgba(7,10,15,.74);
}

.km3d-lanes {
  --km-lane-count: 5;
  position: absolute;
  z-index: 7;
  left: 0;
  top: 109px;
  bottom: 86px;
  width: 168px;
  display: grid;
  grid-template-rows: repeat(var(--km-lane-count), minmax(0, 1fr));
  border-right: 1px solid rgba(140,151,164,.14);
  background: rgba(5, 8, 12, .62);
  pointer-events: none;
}

.km3d-lane {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid rgba(140,151,164,.10);
}

.km3d-lane-icon {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(140,151,164,.26);
  border-radius: 50%;
  color: #aeb8c7;
  font-size: 14px;
}

.km3d-lane b {
  display: block;
  color: #e6ebf2;
  font-size: 13px;
  line-height: 1.15;
  font-weight: 650;
}

.km3d-lane small {
  display: block;
  margin-top: 4px;
  color: #7b8798;
  font-size: 10px;
}

.km3d-scrub {
  left: 0;
  right: 0;
  bottom: 0;
  height: 86px;
  border-radius: 0;
  border-width: 1px 0 0 0;
  border-color: rgba(140,151,164,.16);
  background: linear-gradient(180deg, rgba(8,11,17,.82), rgba(5,8,12,.98));
}

.km3d-scrub-line {
  position: absolute;
  left: 96px;
  right: 96px;
  top: 38px;
  height: 1px;
  background: linear-gradient(90deg, rgba(232,85,78,.3), rgba(230,176,91,.72), rgba(110,128,150,.32));
}

.km3d-scrub-axis {
  position: absolute;
  left: 96px;
  right: 96px;
  top: 16px;
  bottom: 16px;
  height: auto;
}

.km3d-scrub-tick {
  position: absolute;
  top: 0;
  width: 54px;
  height: 50px;
  transform: translateX(-50%);
  border: 0;
  background: transparent;
  color: #7f8999;
  cursor: pointer;
  padding: 0;
}

.km3d-scrub-tick i {
  position: absolute;
  left: 50%;
  top: 18px;
  width: 7px;
  height: 7px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #6e7c8f;
  box-shadow: 0 0 0 1px rgba(5,8,12,.9);
}

.km3d-scrub-tick span {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  white-space: nowrap;
  max-width: 86px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 10px;
  font-weight: 650;
}

.km3d-scrub-tick:hover,
.km3d-scrub-tick.is-major:hover {
  color: #f3efe7;
}

.km3d-scrub-tick.is-major i {
  width: 8px;
  height: 8px;
  background: #aeb8c7;
}

.km3d-playhead {
  top: 18px;
  bottom: 16px;
  z-index: 2;
  background: #e8554e;
  box-shadow: 0 0 0 1px rgba(232,85,78,.24), 0 0 18px rgba(232,85,78,.72);
}

.km3d-card {
  top: 124px;
  right: 8px;
  width: min(330px, calc(100vw - 24px));
  max-height: calc(100% - 220px);
  border-color: rgba(140,151,164,.28);
  background: rgba(7,10,15,.96);
}

.km3d-card-img {
  width: 116px;
  max-width: 45%;
  aspect-ratio: 3 / 4;
  float: left;
  margin: 2px 14px 10px 0;
}

.km3d-card-type {
  color: #e8554e;
}

.km3d-card h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 600;
}

.km3d-card-facts {
  clear: both;
  display: grid;
  gap: 6px;
  margin: 12px 0;
}

.km3d-card-facts div {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 10px;
}

.km3d-card-facts dt {
  color: #6f7a8b;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.km3d-card-facts dd {
  margin: 0;
  color: #d8e0ea;
  font-size: 12px;
}

.km3d-card-relations {
  clear: both;
  margin: 12px 0;
}

.km3d-card-relations h3 {
  margin: 0 0 6px;
  color: #7a8494;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.km3d-card-relations button {
  display: grid;
  width: 100%;
  gap: 2px;
  margin: 0 0 5px;
  padding: 7px 8px;
  border: 1px solid rgba(140,151,164,.14);
  border-radius: 5px;
  background: rgba(255,255,255,.025);
  color: #dce4ee;
  text-align: left;
  cursor: pointer;
}

.km3d-card-relations button:hover {
  border-color: rgba(232,85,78,.36);
  background: rgba(232,85,78,.08);
}

.km3d-card-relations b {
  color: #e6b05b;
  font-size: 11px;
  font-weight: 650;
}

.km3d-card-relations span {
  color: #aeb8c7;
  font-size: 12px;
}

.km3d-card-link {
  clear: both;
  background: #a83d35;
  border-radius: 5px;
}

.km3d-status {
  top: 116px;
}

.km3d-empty {
  z-index: 7;
}

.km3d-hint {
  bottom: 92px;
}

@media (max-width: 920px) {
  .km-root::before {
    inset: 210px 0 86px 0;
  }

  .km3d-toolbar {
    grid-template-columns: 1fr 1fr;
    min-height: 204px;
    padding: 12px;
  }

  .km3d-title,
  .km3d-search-wrap {
    grid-column: 1 / -1;
  }

  .km3d-hud {
    top: 222px;
    width: min(340px, calc(100vw - 24px));
  }

  .km3d-search-results {
    top: 208px;
    left: 12px;
    right: 12px;
    width: auto;
  }

  .km3d-winlabel {
    min-width: 0;
    font-size: 28px;
  }

  .km3d-lanes {
    top: 282px;
    bottom: 86px;
    width: 118px;
  }

  .km3d-grid {
    top: 282px;
    left: 118px;
    bottom: 86px;
  }

  .km3d-lane {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 0 8px;
  }

  .km3d-lane-icon {
    display: none;
  }

  .km3d-lane b {
    font-size: 11px;
  }

  .km3d-card {
    top: auto;
    left: 8px;
    right: 8px;
    bottom: 88px;
    width: auto;
    max-height: 45%;
  }

  .km3d-scrub-line,
  .km3d-scrub-axis {
    left: 42px;
    right: 42px;
  }
}
