body.page-template-page-word-matrix {
  padding: 0;
}

body.page-template-page-word-matrix #primary.nf-word-matrix-main {
  margin: 0;
  padding: 0;
  max-width: none;
  width: 100%;
}

body.page-template-page-word-matrix .nf-word-matrix-wrap {
  border-left: 0;
  border-right: 0;
  border-radius: 0;
  margin: 0;
}

.nf-word-matrix-wrap {
  background: linear-gradient(170deg, #0a1420, #0f1628 50%, #0b1220);
  color: #ecf3ff;
  border: 1px solid rgba(152, 182, 220, 0.2);
  border-radius: 14px;
  padding: 10px;
}

.nf-word-matrix-app {
  display: block;
}

.nf-word-matrix-graph-card {
  position: relative;
  border: 1px solid rgba(161, 190, 229, 0.18);
  border-radius: 12px;
  background: radial-gradient(circle at 15% 10%, rgba(68, 120, 201, 0.2), transparent 46%), rgba(10, 16, 28, 0.88);
  min-height: 780px;
  overflow: hidden;
}

.nf-word-matrix-svg {
  width: 100%;
  height: auto;
  display: block;
  min-height: 780px;
  touch-action: none;
}

.nf-word-matrix-toggle-info {
  position: absolute;
  top: 10px;
  left: 52px;
  z-index: 8;
  border: 1px solid rgba(147, 182, 233, 0.5);
  background: rgba(8, 18, 36, 0.88);
  color: #e9f3ff;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}

.nf-word-matrix-toggle-info:hover {
  background: rgba(13, 30, 58, 0.95);
}

.nf-word-matrix-menu-toggle {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 9;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(147, 182, 233, 0.5);
  background: rgba(8, 18, 36, 0.9);
  color: #e9f3ff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.nf-word-matrix-menu-toggle:hover {
  background: rgba(13, 30, 58, 0.95);
}

.nf-word-matrix-menu-panel {
  position: absolute;
  top: 52px;
  left: 10px;
  z-index: 10;
  width: min(320px, calc(100% - 20px));
  border: 1px solid rgba(161, 190, 229, 0.28);
  border-radius: 12px;
  background: rgba(6, 12, 24, 0.94);
  box-shadow: 0 14px 26px rgba(0, 0, 0, 0.34);
  transform: translateX(-112%);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
  pointer-events: none;
}

.nf-word-matrix-app.menu-open .nf-word-matrix-menu-panel {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.nf-word-matrix-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(161, 190, 229, 0.2);
}

.nf-word-matrix-menu-close {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid rgba(162, 190, 228, 0.45);
  background: rgba(22, 35, 58, 0.86);
  color: #f2f8ff;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0;
}

.nf-word-matrix-menu-list {
  max-height: min(62vh, 520px);
  overflow-y: auto;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.nf-word-matrix-menu-item {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid rgba(136, 172, 221, 0.35);
  background: rgba(17, 31, 56, 0.86);
  color: #deecff;
  border-radius: 8px;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
}

.nf-word-matrix-menu-item:hover {
  border-color: rgba(149, 202, 255, 0.7);
  background: rgba(21, 41, 71, 0.95);
}

.nf-word-matrix-menu-item-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(143, 217, 255, 0.18);
  border: 1px solid rgba(143, 217, 255, 0.45);
  font-size: 0.76rem;
}

.nf-word-matrix-menu-empty {
  margin: 8px;
  opacity: 0.8;
}

.nf-word-matrix-side {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 7;
  width: min(360px, calc(100% - 24px));
  border: 1px solid rgba(161, 190, 229, 0.24);
  border-radius: 12px;
  background: rgba(6, 12, 24, 0.88);
  padding: 10px;
  max-height: calc(100% - 20px);
  overflow-y: auto;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.nf-word-matrix-app.info-hidden .nf-word-matrix-side {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
}

.nf-word-matrix-side-title {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
}

.nf-word-matrix-selected-name {
  margin: 5px 0 10px;
  font-size: 1.12rem;
  font-weight: 800;
}

.nf-word-matrix-projects {
  display: grid;
  gap: 9px;
}

.nf-word-matrix-project-card {
  border: 1px solid rgba(167, 193, 228, 0.22);
  border-radius: 10px;
  background: rgba(18, 29, 48, 0.86);
  overflow: hidden;
}

.nf-word-matrix-project-thumb {
  background: #101826;
  border-bottom: 1px solid rgba(167, 193, 228, 0.2);
}

.nf-word-matrix-project-thumb img {
  width: 100%;
  height: 92px;
  object-fit: cover;
  display: block;
}

.nf-word-matrix-thumb-fallback {
  height: 92px;
  display: grid;
  place-items: center;
  opacity: 0.7;
  font-size: 0.82rem;
}

.nf-word-matrix-project-meta {
  padding: 8px 10px 10px;
}

.nf-word-matrix-project-title {
  font-weight: 800;
  color: #9ad5ff;
  text-decoration: none;
  line-height: 1.28;
}

.nf-word-matrix-project-title:hover {
  text-decoration: underline;
}

.nf-word-matrix-dist {
  margin-top: 6px;
  font-size: 0.82rem;
  opacity: 0.95;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.nf-word-matrix-dist-logos {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.nf-word-matrix-dist-logos img {
  width: 26px;
  height: 18px;
  object-fit: contain;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px;
}

.nf-word-matrix-dist-text {
  opacity: 0.92;
}

.nf-word-matrix-empty {
  margin: 0;
  opacity: 0.84;
}

.nf-word-matrix-muted {
  opacity: 0.72;
  font-size: 0.85rem;
}

.nf-word-matrix-name-list {
  display: grid;
  gap: 7px;
}

.nf-word-matrix-name-btn {
  border: 1px solid rgba(136, 172, 221, 0.35);
  background: rgba(17, 31, 56, 0.86);
  color: #deecff;
  border-radius: 8px;
  text-align: left;
  padding: 7px 9px;
  font-weight: 700;
  cursor: pointer;
}

.nf-word-matrix-name-btn:hover {
  border-color: rgba(149, 202, 255, 0.7);
  background: rgba(21, 41, 71, 0.95);
}

.nf-word-matrix-popup {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 11;
  width: min(620px, calc(100% - 24px));
  pointer-events: none;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}

.nf-word-matrix-popup.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.nf-word-matrix-popup-mini {
  padding: 4px 2px 2px;
}

.nf-word-matrix-popup-mini-title {
  font-size: 1rem;
  font-weight: 800;
  margin: 0 24px 8px 0;
}

.nf-word-matrix-popup-mini-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.nf-word-matrix-mini-chip {
  border: 1px solid rgba(145, 179, 224, 0.45);
  background: rgba(14, 30, 52, 0.84);
  color: #ddedff;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.76rem;
  font-weight: 700;
}

.nf-word-matrix-mini-link {
  color: #9ad5ff;
  text-decoration: none;
  border-bottom: 1px dashed rgba(154, 213, 255, 0.45);
  font-size: 0.82rem;
}

.nf-word-matrix-mini-link:hover {
  border-bottom-color: rgba(154, 213, 255, 0.9);
}

.nf-word-matrix-popup-card {
  max-height: min(78vh, 700px);
  overflow: auto;
  border: 1px solid rgba(166, 193, 232, 0.35);
  border-radius: 12px;
  background: rgba(8, 17, 33, 0.96);
  padding: 12px;
  position: relative;
  box-shadow: 0 24px 40px rgba(0, 0, 0, 0.34);
}

.nf-word-matrix-popup-close {
  position: absolute;
  right: 10px;
  top: 10px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid rgba(162, 190, 228, 0.45);
  background: rgba(22, 35, 58, 0.86);
  color: #f2f8ff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 0;
}

.nf-word-matrix-popup-header h3 {
  margin: 0 40px 4px 0;
  font-size: 1.25rem;
}

.nf-word-matrix-popup-section {
  margin-top: 10px;
}

.nf-word-matrix-popup-label {
  font-size: 0.82rem;
  opacity: 0.85;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.nf-word-matrix-title-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nf-word-matrix-title-chip {
  border: 1px solid rgba(145, 179, 224, 0.45);
  background: rgba(14, 30, 52, 0.84);
  color: #ddedff;
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
}

.nf-word-matrix-title-chip:hover {
  border-color: rgba(150, 210, 255, 0.8);
  color: #fff;
}

.nf-matrix-link {
  opacity: 0.86;
}

.nf-matrix-link.anchor-link {
  stroke-dasharray: 4 6;
  opacity: 0.58;
}

.nf-matrix-link.title-link {
  stroke-dasharray: 3 5;
}

.nf-matrix-node {
  transition: opacity 0.12s ease;
}

.nf-matrix-node.person-node {
  fill: #d2def5;
  stroke: rgba(24, 40, 70, 0.95);
  stroke-width: 2;
  cursor: grab;
  transition: stroke 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}

.nf-matrix-node.person-node:active {
  cursor: grabbing;
}

.nf-matrix-node.person-node.is-focus {
  fill: #ffd56d;
  stroke: #8d6021;
  stroke-width: 2.5;
}

.nf-matrix-node.person-node.is-key {
  fill: #75f0e7;
}

.nf-matrix-node.person-node.is-indirect {
  opacity: 0.73;
}

.nf-matrix-node.person-node:hover,
.nf-matrix-node.person-node.is-hover {
  stroke: #8fd9ff;
  filter: drop-shadow(0 0 5px rgba(143, 217, 255, 0.45));
}

.nf-matrix-node.title-node {
  fill: #ffb870;
  stroke: #6b4020;
  stroke-width: 2.8;
}

.nf-matrix-project-thumb {
  pointer-events: none;
  rx: 4px;
  ry: 4px;
}

.nf-matrix-project-title {
  fill: #d9ecff;
  font-size: 10px;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(8, 12, 22, 0.82);
  stroke-width: 3px;
  stroke-linejoin: round;
  pointer-events: none;
}

.nf-matrix-label {
  fill: #ebf5ff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  paint-order: stroke;
  stroke: rgba(8, 12, 22, 0.8);
  stroke-width: 3px;
  stroke-linejoin: round;
  user-select: none;
  transition: fill 0.15s ease, opacity 0.15s ease;
}

.nf-matrix-label.is-focus {
  font-size: 15px;
}

.nf-matrix-logo {
  cursor: pointer;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
  transition: filter 0.15s ease, opacity 0.15s ease;
}

.nf-matrix-logo:hover,
.nf-matrix-logo.is-hover {
  filter: drop-shadow(0 0 5px rgba(143, 217, 255, 0.75));
}

.nf-matrix-label:hover,
.nf-matrix-label.is-hover {
  fill: #8fd9ff;
}

.nf-matrix-count-badge {
  fill: rgba(7, 22, 43, 0.94);
  stroke: rgba(142, 178, 228, 0.75);
  stroke-width: 1.2;
  transition: stroke 0.15s ease, fill 0.15s ease;
}

.nf-matrix-count-text {
  fill: #dcf0ff;
  font-size: 9px;
  font-weight: 800;
  pointer-events: none;
  transition: fill 0.15s ease;
}

.nf-matrix-count-badge.is-hover {
  fill: rgba(19, 44, 79, 0.95);
  stroke: rgba(143, 217, 255, 0.95);
}

.nf-matrix-count-text.is-hover {
  fill: #9ad9ff;
}

@media (max-width: 1080px) {
  .nf-word-matrix-graph-card,
  .nf-word-matrix-svg {
    min-height: 640px;
  }

  .nf-word-matrix-side {
    width: min(330px, calc(100% - 20px));
  }

  .nf-word-matrix-popup {
    width: min(540px, calc(100% - 20px));
  }
}

@media (max-width: 640px) {
  .nf-word-matrix-wrap {
    padding: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .nf-word-matrix-graph-card,
  .nf-word-matrix-svg {
    min-height: 520px;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .nf-word-matrix-side {
    top: 6px;
    right: 6px;
    width: calc(100% - 12px);
    max-height: 52%;
  }

  .nf-word-matrix-toggle-info {
    top: 6px;
    left: 46px;
  }

  .nf-word-matrix-menu-toggle {
    top: 6px;
    left: 6px;
  }

  .nf-word-matrix-menu-panel {
    top: 46px;
    left: 6px;
    width: calc(100% - 12px);
  }

  .nf-word-matrix-popup {
    top: 46px;
    right: 6px;
    width: calc(100% - 12px);
  }

  .nf-matrix-label {
    font-size: 11px;
  }
}

@media (max-width: 900px) {
  body.page-template-page-word-matrix #primary.nf-word-matrix-main {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .nf-word-matrix-wrap {
    padding: 8px;
    border-radius: 0;
  }

  .nf-word-matrix-graph-card,
  .nf-word-matrix-svg {
    min-height: 72vh;
  }

  .nf-word-matrix-toggle-info {
    max-width: calc(100% - 58px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .nf-word-matrix-side {
    top: auto;
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
    max-height: min(36vh, 320px);
    padding: 9px;
  }

  .nf-word-matrix-popup {
    top: 56px;
    right: 8px;
    left: 8px;
    width: auto;
  }

  .nf-word-matrix-popup-card {
    max-height: min(58vh, 560px);
    padding: 10px;
  }

  .nf-word-matrix-popup-header h3 {
    font-size: 1.08rem;
  }

  .nf-word-matrix-project-thumb img,
  .nf-word-matrix-thumb-fallback {
    height: 76px;
  }

  .nf-word-matrix-project-meta {
    padding: 8px 9px 9px;
  }
}

@media (max-width: 640px) and (orientation: portrait) {
  .nf-word-matrix-graph-card,
  .nf-word-matrix-svg {
    min-height: 78vh;
  }

  .nf-word-matrix-side {
    max-height: min(42vh, 340px);
  }

  .nf-word-matrix-menu-panel {
    width: calc(100% - 16px);
    left: 8px;
  }

  .nf-word-matrix-projects,
  .nf-word-matrix-name-list {
    gap: 7px;
  }
}
