* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

button,
input,
a {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: var(--color-clear);
}

button {
  color: inherit;
}

.hm {
  min-width: 20rem;
  min-height: 100vh;
  overflow: hidden;
  color: var(--ink);
  background-color: var(--paper);
  font-family: var(--font-body);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
}

.hm a {
  color: inherit;
}

.hm button {
  border: 0;
}

.hm button,
.hm input,
.hm a {
  outline: none;
}

.hm button:focus-visible,
.hm input:focus-visible,
.hm a:focus-visible,
.hm summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.hm-ico {
  width: 1.125rem;
  height: 1.125rem;
  flex: 0 0 auto;
  stroke-width: 1.8;
}

.hm-bar {
  position: relative;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.25rem;
  padding: var(--space-2) var(--page-pad);
  border-bottom: 1px solid var(--rule);
  background: var(--paper-raised);
}

.hm-brand {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-3);
  min-height: var(--tap-min);
  text-decoration: none;
}

.hm-brand__title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
}

.hm-brand__title::before {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-inline-end: var(--space-2);
  border: 2px solid var(--moss);
  border-radius: 50% 0 50% 50%;
  content: "";
  transform: rotate(-18deg);
}

.hm-brand__sub {
  color: var(--ink-soft);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wide);
}

.hm-brand__sub:empty {
  display: none;
}

.hm-bar__actions,
.hm-lang {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.hm-lang {
  padding: var(--space-1);
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--paper-raised);
}

.hm-lang button {
  min-width: 4.4rem;
  min-height: var(--tap-min);
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--color-clear);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}

.hm-lang button[aria-pressed="true"] {
  background: var(--cat-e-soft);
  color: var(--cat-e);
  box-shadow: inset 0 0 0 1px var(--cat-e);
}

.hm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  border: 1px solid var(--cat-d) !important;
  background: var(--cat-d-soft);
  color: var(--cat-d);
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

.hm-btn:hover {
  background: var(--paper-raised);
}

.hm-hero {
  position: relative;
  z-index: 30;
  display: grid;
  width: min(72rem, calc(100% - (var(--page-pad) * 2)));
  height: 7.5rem;
  margin: 0 auto;
  padding: var(--space-2) 0;
  grid-template-columns: 6.25rem minmax(0, 1fr);
  align-items: center;
  gap: var(--space-5);
  background: var(--paper-raised);
}

.hm-hero::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 0.2rem;
  background: linear-gradient(90deg, var(--cat-a), var(--cat-b), var(--cat-c), var(--cat-d), var(--cat-e), var(--cat-f), var(--cat-g), var(--cat-h));
  content: "";
}

.hm-hero--noimage {
  grid-template-columns: minmax(0, 1fr);
}

.hm-hero__photo {
  display: block;
  width: 6.25rem;
  height: 6.25rem;
  border: 0.2rem solid var(--paper-raised);
  border-radius: var(--radius-lg) var(--radius-lg) 3.25rem var(--radius-lg);
  object-fit: cover;
  object-position: center 24%;
  box-shadow: var(--shadow-node);
}

.hm-hero__text {
  display: grid;
  min-width: 0;
  grid-template-columns: max-content minmax(0, 1fr);
  align-items: baseline;
  column-gap: var(--space-4);
}

.hm-hero__name,
.hm-hero__sub,
.hm-hero__intro,
.hm-hero__hint {
  margin: 0;
}

.hm-hero__name {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
}

.hm-hero__sub {
  color: var(--ink-soft);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
}

.hm-hero__intro {
  grid-column: 1 / -1;
  margin-top: var(--space-1);
  color: var(--cat-d);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
}

.hm-hero__hint {
  grid-column: 1 / -1;
  margin-top: var(--space-1);
  color: var(--ink-faint);
  font-size: var(--text-xs);
}

.hm-tools {
  position: relative;
  z-index: 35;
  display: flex;
  width: max-content;
  max-width: calc(100vw - (var(--page-pad) * 2));
  min-height: 3.25rem;
  margin: 0 auto var(--space-2);
  padding: var(--space-1);
  align-items: center;
  gap: var(--space-1);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper-raised);
  box-shadow: var(--shadow-node);
  transition: transform var(--motion-panel) var(--ease-out);
}

.hm[data-panel="open"] .hm-tools {
  transform: translateX(calc(var(--panel-width) / -2));
}

.hm-search {
  position: relative;
  display: flex;
  align-items: center;
  width: 12rem;
  min-height: var(--tap-min);
  padding-inline-start: var(--space-3);
  border-right: 1px solid var(--rule);
}

.hm-search .hm-ico {
  color: var(--moss);
}

.hm-search input {
  width: 100%;
  height: 2.5rem;
  padding: 0 var(--space-3) 0 var(--space-2);
  border: 0;
  background: var(--color-clear);
  color: var(--ink);
}

.hm-search input::placeholder {
  color: var(--ink-faint);
}

.hm-search__results {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 0;
  width: 16rem;
  margin: 0;
  padding: var(--space-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--paper-raised);
  box-shadow: var(--shadow-float);
  list-style: none;
}

.hm-search__results[hidden] {
  display: none;
}

.hm-search__results li {
  display: grid;
  min-height: var(--tap-min);
  padding: var(--space-2) var(--space-3);
  align-content: center;
  border-radius: var(--radius-sm);
}

.hm-search__results li[aria-selected="true"] {
  background: var(--moss-soft);
}

.hm-search__empty {
  color: var(--ink-soft);
  font-style: italic;
  text-align: center;
}

.hm-search__label {
  font-weight: var(--weight-bold);
}

.hm-search__path {
  color: var(--ink-soft);
  font-size: var(--text-xs);
}

.hm-tool,
.hm-zoom button {
  display: inline-flex;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  padding: 0 var(--space-3);
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--color-clear);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  white-space: nowrap;
}

.hm-tool:hover,
.hm-zoom button:hover {
  background: var(--cat-b-soft);
}

.hm-tool--toggle[aria-pressed="true"] {
  background: var(--moss-soft);
  color: var(--moss-deep);
}

.hm-zoom {
  display: flex;
  border-left: 1px solid var(--rule);
}

.hm-zoom button {
  padding: 0;
  font-size: var(--text-xl);
  font-weight: var(--weight-medium);
}

.hm-stage {
  position: absolute;
  z-index: 1;
  top: 15.5rem;
  right: 0;
  bottom: 5.25rem;
  left: 0;
  overflow: hidden;
  transition: right var(--motion-panel) var(--ease-out);
}

.hm[data-panel="open"] .hm-stage {
  right: var(--panel-width);
}

.hm-stage::before,
.hm-stage::after {
  position: absolute;
  display: none;
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.hm-stage::before {
  top: 7%;
  left: 7%;
  width: 14rem;
  height: 7rem;
  transform: rotate(-18deg);
}

.hm-stage::after {
  right: 8%;
  bottom: 9%;
  width: 10rem;
  height: 5rem;
  transform: rotate(21deg);
}

.hm-world {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-width: 68rem;
  min-height: 37rem;
  transform-origin: 0 0;
  transition: transform var(--motion-expand) var(--ease-out);
}

.hm-lines {
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.hm-branch,
.hm-rel > path {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.hm-branch {
  stroke: var(--line);
  stroke-linecap: round;
}

.hm-branch[data-cat="a"] { stroke: var(--cat-a); }
.hm-branch[data-cat="b"] { stroke: var(--cat-b); }
.hm-branch[data-cat="c"] { stroke: var(--cat-c); }
.hm-branch[data-cat="d"] { stroke: var(--cat-d); }
.hm-branch[data-cat="e"] { stroke: var(--cat-e); }
.hm-branch[data-cat="f"] { stroke: var(--cat-f); }
.hm-branch[data-cat="g"] { stroke: var(--cat-g); }
.hm-branch[data-cat="h"] { stroke: var(--cat-h); }

.hm-branch[data-depth="1"] {
  stroke-width: var(--line-depth-1);
  opacity: var(--line-opacity-1);
}

.hm-branch[data-depth="2"] {
  stroke-width: var(--line-depth-2);
  opacity: var(--line-opacity-2);
}

.hm-branch[data-depth="3"] {
  stroke-width: var(--line-depth-3);
  opacity: var(--line-opacity-3);
}

.hm-branch[data-depth="4"] {
  stroke-width: var(--line-depth-4);
  opacity: var(--line-opacity-4);
}

.hm-rel > path {
  stroke: var(--relation-confirmed);
  stroke-width: var(--line-relation);
  stroke-linecap: round;
}

.hm-rel[data-kind="idea"] > path {
  stroke: var(--relation-idea);
  stroke-dasharray: 6 6;
}

.hm-rel__tag rect {
  fill: var(--paper-raised);
  stroke: var(--rule-strong);
  stroke-width: 1;
  rx: 8;
}

.hm-rel__tag text {
  fill: var(--ink);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: var(--weight-bold);
  letter-spacing: 0.02em;
}

.hm-node {
  --node-color: var(--moss);
  --node-soft: var(--moss-soft);
  position: absolute;
  z-index: 5;
  top: 0;
  left: 0;
  width: max-content;
  transition: transform var(--motion-expand) var(--ease-out), opacity var(--motion-fast) var(--ease-gentle);
}

.hm-node[data-cat="a"] { --node-color: var(--cat-a); --node-soft: var(--cat-a-soft); }
.hm-node[data-cat="b"] { --node-color: var(--cat-b); --node-soft: var(--cat-b-soft); }
.hm-node[data-cat="c"] { --node-color: var(--cat-c); --node-soft: var(--cat-c-soft); }
.hm-node[data-cat="d"] { --node-color: var(--cat-d); --node-soft: var(--cat-d-soft); }
.hm-node[data-cat="e"] { --node-color: var(--cat-e); --node-soft: var(--cat-e-soft); }
.hm-node[data-cat="f"] { --node-color: var(--cat-f); --node-soft: var(--cat-f-soft); }
.hm-node[data-cat="g"] { --node-color: var(--cat-g); --node-soft: var(--cat-g-soft); }
.hm-node[data-cat="h"] { --node-color: var(--cat-h); --node-soft: var(--cat-h-soft); }

.hm-node__body {
  position: relative;
  display: flex;
  min-height: var(--tap-min);
  align-items: center;
  gap: var(--space-2);
  border: 1px solid var(--rule-strong);
  background: var(--paper-raised);
  color: var(--ink);
  box-shadow: var(--shadow-node);
  cursor: pointer;
  text-align: left;
}

.hm-node__label {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  line-height: var(--leading-tight);
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.hm-node__sub {
  color: var(--ink-soft);
  font-size: var(--text-xs);
}

.hm-node__icon {
  width: var(--node-icon);
  height: var(--node-icon);
  flex: 0 0 auto;
  stroke-width: 1.8;
}

.hm-node__count,
.hm-node__more {
  display: inline-grid;
  width: 1.45rem;
  height: 1.45rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-pill);
  background: var(--node-soft);
  color: var(--node-color);
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
}

.hm-node__thumb {
  width: var(--node-thumb);
  height: 3.25rem;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: inset 0 0 0 1px var(--rule);
}

.hm-node[data-type="root"] .hm-node__body {
  display: grid;
  width: var(--node-root-size);
  height: var(--node-root-size);
  padding: var(--space-6) var(--node-root-pad-x) var(--space-4);
  place-content: center;
  border: 2px solid var(--moss);
  border-radius: 50% 44% 48% 42%;
  background: var(--paper-raised);
  box-shadow: var(--shadow-float);
  text-align: center;
}

.hm-node[data-type="root"] .hm-node__body::before,
.hm-node[data-type="root"] .hm-node__body::after {
  position: absolute;
  content: "";
}

.hm-node[data-type="root"] .hm-node__body::before {
  top: 0.9rem;
  left: 50%;
  width: 0.75rem;
  height: 0.75rem;
  border: 2px solid var(--focus);
  border-radius: 50% 0 50% 50%;
  transform: translateX(-50%) rotate(-28deg);
}

.hm-node[data-type="root"] .hm-node__body::after {
  inset: 0.45rem;
  border: 1px solid var(--cat-b);
  border-radius: 46% 52% 45% 50%;
  pointer-events: none;
}

.hm-node[data-type="root"] .hm-node__label {
  display: block;
  overflow: visible;
  font-family: var(--font-display);
  font-size: var(--text-root);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-tight);
  -webkit-line-clamp: unset;
}

html[lang="en"] .hm-node[data-type="root"] .hm-node__label {
  font-family: var(--font-body);
  font-size: var(--text-md);
  letter-spacing: 0;
}

.hm-node[data-type="branch"] .hm-node__body {
  min-width: 10rem;
  max-width: var(--node-branch-max);
  min-height: var(--node-branch-height);
  padding: var(--space-2) var(--node-branch-pad-x) var(--space-2) var(--space-2);
  border-color: var(--node-color);
  border-radius: var(--radius-lg) var(--radius-pill) var(--radius-pill) var(--radius-lg);
  background: var(--node-soft);
  color: var(--node-color);
  font-weight: var(--weight-bold);
  box-shadow: 0 0.35rem 0 var(--paper-muted);
}

.hm-node[data-type="branch"][data-side="left"] .hm-node__body {
  border-radius: var(--radius-pill) var(--radius-lg) var(--radius-lg) var(--radius-pill);
}

.hm-node[data-type="branch"] .hm-node__icon {
  box-sizing: content-box;
  width: var(--node-icon);
  height: var(--node-icon);
  padding: 0.42rem;
  border: 1px solid var(--node-color);
  border-radius: 50%;
  background: var(--paper-raised);
}

.hm-node[data-type="branch"] .hm-node__label {
  flex: 1;
  font-size: var(--text-md);
}

.hm-node[data-type="item"] .hm-node__body {
  max-width: var(--node-item-max);
  min-height: var(--node-item-height);
  padding: var(--space-1) var(--node-item-pad-x);
  border-color: var(--rule);
  border-left: 0.28rem solid var(--node-color);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.hm-node[data-type="item"] .hm-node__body::before {
  width: 0.5rem;
  height: 0.5rem;
  flex: 0 0 auto;
  border: 2px solid var(--paper-raised);
  border-radius: 50%;
  background: var(--node-color);
  box-shadow: 0 0 0 1px var(--node-color);
  content: "";
}

.hm-node[data-type="item"][data-side="left"] .hm-node__body {
  border-right: 0.28rem solid var(--node-color);
  border-left: 1px solid var(--rule);
  border-radius: var(--radius-md);
}

.hm-node[data-type="detail"] .hm-node__body {
  max-width: var(--node-detail-max);
  min-height: var(--node-detail-height);
  padding: var(--space-1) var(--node-detail-pad-x);
  border-color: var(--node-color);
  border-radius: var(--radius-xs);
  background: var(--paper-raised);
  font-size: var(--text-xs);
}

.hm-node[data-type="detail"] .hm-node__body::before {
  width: 0.2rem;
  height: 1.5rem;
  border-radius: var(--radius-pill);
  background: var(--node-color);
  content: "";
}

.hm-node__info {
  display: flex;
  width: max-content;
  min-width: 4rem;
  min-height: var(--tap-min);
  margin: -1px var(--space-3) 0 auto;
  padding: 0 var(--space-3);
  align-items: center;
  justify-content: center;
  border: 1px solid var(--node-color) !important;
  border-top: 0 !important;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--paper-raised);
  color: var(--node-color);
  cursor: pointer;
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  line-height: 1;
}

.hm-node[data-type="root"] .hm-node__info {
  margin-right: auto;
  border-color: var(--moss) !important;
  color: var(--moss-deep);
}

.hm-node__info:hover {
  background: var(--node-soft);
}

.hm-node[data-has-link="true"] .hm-node__body::after {
  position: absolute;
  top: 0.1rem;
  right: 0.25rem;
  color: var(--node-color);
  content: "↗";
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
  pointer-events: none;
}

.hm-node[data-selected="true"] {
  z-index: 12;
}

.hm-node[data-selected="true"] .hm-node__body {
  border-color: var(--relation-confirmed);
  box-shadow: var(--shadow-selected);
}

.hm-node[data-related="true"] .hm-node__body {
  border-color: var(--relation-confirmed);
}

.hm-node[data-related="true"] .hm-node__body::before {
  background: var(--relation-confirmed);
  box-shadow: 0 0 0 1px var(--relation-confirmed);
}

.hm-node[data-dim="true"] {
  opacity: 0.28;
}

.hm-node[data-match="true"] .hm-node__body {
  border-color: var(--focus);
  box-shadow: var(--shadow-selected);
}

.hm-node[data-entering="true"] {
  animation: hm-node-enter var(--motion-expand) var(--ease-out) both;
}

@keyframes hm-node-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

.hm-guide {
  position: fixed;
  z-index: 15;
  left: 50%;
  bottom: 1rem;
  display: none;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-pill);
  background: var(--paper-raised);
  color: var(--ink-soft);
  box-shadow: var(--shadow-node);
  font-size: var(--text-xs);
  transform: translateX(-50%);
}

.hm-guide[hidden] {
  display: none;
}

.hm-guide:empty,
.hm-guide[data-hidden="true"] {
  display: none;
}

.hm-panel {
  position: fixed;
  z-index: 50;
  top: 4.25rem;
  right: 0;
  bottom: 0;
  width: var(--panel-width);
  padding: var(--space-6);
  overflow-y: auto;
  border-left: 1px solid var(--rule);
  background: var(--paper-raised);
  box-shadow: var(--shadow-float);
  transform: translateX(102%);
  transition: transform var(--motion-panel) var(--ease-out);
}

.hm-panel[data-open="true"] {
  transform: translateX(0);
}

.hm-panel__grip {
  display: none;
}

.hm-panel__close {
  position: absolute;
  z-index: 2;
  top: var(--space-3);
  right: var(--space-3);
  display: grid;
  width: var(--tap-min);
  height: var(--tap-min);
  place-items: center;
  border-radius: 50%;
  background: var(--paper-raised);
  box-shadow: var(--shadow-node);
  cursor: pointer;
  font-size: var(--text-xl);
}

.hm-panel__media {
  margin: 0 calc(var(--space-6) * -1) var(--space-6);
}

.hm-panel__media img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.hm-panel__media figcaption {
  padding: var(--space-2) var(--space-6) 0;
  color: var(--ink-faint);
  font-size: var(--text-2xs);
}

.hm-panel__kicker {
  display: flex;
  margin: 0 0 var(--space-2);
  align-items: center;
  gap: var(--space-2);
  color: var(--cat-c);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wide);
}

.hm-panel__title {
  margin: 0 0 var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.hm-panel__meta {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  margin: 0 0 var(--space-5);
  padding: var(--space-3) 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  row-gap: var(--space-2);
}

.hm-panel__meta dt {
  color: var(--ink-soft);
  font-size: var(--text-xs);
}

.hm-panel__meta dd {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
}

.hm-status {
  display: inline-flex;
  min-height: 1.6rem;
  padding: 0 var(--space-2);
  align-items: center;
  border-radius: var(--radius-pill);
  font-size: var(--text-2xs);
  font-weight: var(--weight-bold);
}

.hm-status[data-status="active"] { background: var(--status-active-soft); color: var(--status-active); }
.hm-status[data-status="done"] { background: var(--status-done-soft); color: var(--status-done); }
.hm-status[data-status="idea"] { background: var(--status-idea-soft); color: var(--status-idea); }

.hm-panel__desc {
  margin: 0 0 var(--space-5);
  color: var(--ink-soft);
  line-height: var(--leading-normal);
}

.hm-panel__links {
  display: flex;
  margin-bottom: var(--space-6);
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.hm-sitelink {
  display: inline-flex;
  min-height: var(--tap-min);
  padding: 0 var(--space-4);
  align-items: center;
  gap: var(--space-2);
  border: 1px solid var(--moss);
  border-radius: var(--radius-pill);
  background: var(--moss-soft);
  color: var(--moss-deep) !important;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  text-decoration: none;
}

.hm-sitelink__note {
  color: var(--ink-faint);
  font-size: var(--text-2xs);
}

.hm-panel__rel h3 {
  margin: 0 0 var(--space-3);
  font-family: var(--font-display);
  font-size: var(--text-lg);
}

.hm-panel__rel ul {
  display: grid;
  margin: 0;
  padding: 0;
  gap: var(--space-2);
  list-style: none;
}

.hm-relitem,
.hm-relitem button {
  width: 100%;
}

.hm-relitem button,
.hm-relitem:not(:has(button)) {
  position: relative;
  display: grid;
  min-height: var(--tap-min);
  padding: var(--space-2) 4.75rem var(--space-2) var(--space-4);
  align-content: center;
  border: 1px solid var(--rule);
  border-left: 0.25rem solid var(--relation-confirmed);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  cursor: pointer;
  text-align: left;
}

.hm-relitem[data-kind="idea"] button,
.hm-relitem[data-kind="idea"]:not(:has(button)) {
  border-left-style: dashed;
  border-left-color: var(--relation-idea);
}

.hm-relitem__to {
  font-weight: var(--weight-bold);
}

.hm-relitem__label {
  color: var(--ink-soft);
  font-size: var(--text-xs);
}

.hm-relitem__kind {
  position: absolute;
  top: 50%;
  right: var(--space-3);
  color: var(--ink-faint);
  font-size: var(--text-2xs);
  transform: translateY(-50%);
}

.hm-panel__path {
  margin-top: var(--space-6);
  color: var(--ink-faint);
  font-size: var(--text-xs);
}

.hm-list {
  position: absolute;
  z-index: 20;
  top: 15.5rem;
  right: 0;
  bottom: 5.25rem;
  left: 0;
  padding: var(--space-8) max(var(--page-pad), calc((100vw - 60rem) / 2));
  overflow-y: auto;
  background: var(--paper);
}

.hm-list[hidden] {
  display: none;
}

.hm-list__title {
  margin: 0 0 var(--space-6);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--moss);
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  line-height: var(--leading-tight);
}

.hm-tree,
.hm-tree ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.hm-tree > li {
  border-top: 0;
}

.hm-tree summary,
.hm-tree__leaf {
  display: flex;
  min-height: var(--tap-min);
  padding: var(--space-3) var(--space-2);
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid var(--rule);
}

.hm-tree summary {
  cursor: pointer;
  font-weight: var(--weight-bold);
}

.hm-tree details[open] > summary {
  background: var(--paper-muted);
  color: var(--moss-deep);
}

.hm-tree__leaf {
  font-weight: var(--weight-medium);
}

.hm-tree__label {
  min-width: 0;
  flex: 1;
}

.hm-tree ul {
  margin-left: var(--space-6);
  padding-left: var(--space-4);
  border-left: 1px solid var(--line);
}

.hm-tree p {
  margin: var(--space-2) var(--space-2) var(--space-3);
}

.hm-tree__role {
  color: var(--moss-deep);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

.hm-tree__desc {
  max-width: 48rem;
  color: var(--ink-soft);
}

.hm-tree__rels {
  display: grid;
  margin: var(--space-3) var(--space-2) var(--space-4) !important;
  padding: 0 !important;
  gap: var(--space-2);
  border: 0 !important;
}

.hm-tree__rels li {
  padding: var(--space-2) var(--space-3);
  border-left: 0.2rem solid var(--relation-confirmed);
  background: var(--paper-raised);
  color: var(--ink-soft);
  font-size: var(--text-xs);
}

.hm-tree__rels li[data-kind="idea"] {
  border-left-color: var(--relation-idea);
  border-left-style: dashed;
}

.hm-tree a,
.hm-tree button {
  display: inline-flex;
  min-height: var(--tap-min);
  align-items: center;
}

.hm-foot {
  position: fixed;
  z-index: 25;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  min-height: 5.25rem;
  padding: var(--space-2) var(--page-pad);
  grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1fr);
  align-items: center;
  gap: clamp(var(--space-2), 1.2vw, var(--space-4));
  border-top: 1px solid var(--rule);
  background: var(--paper-raised);
}

.hm-legend {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--ink-soft);
  font-size: var(--text-2xs);
}

.hm-legend__item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}

.hm-legend__line {
  display: inline-block;
  width: 2rem;
  border-top: 2px solid var(--relation-confirmed);
}

.hm-legend__line[data-kind="idea"] {
  border-top-color: var(--relation-idea);
  border-top-style: dashed;
}

.hm-back,
.hm-cta {
  display: inline-flex;
  min-height: var(--tap-min);
  padding: var(--space-1) var(--space-3);
  align-items: center;
  gap: var(--space-2);
  border-bottom: 1px solid var(--rule-strong);
  color: var(--moss-deep) !important;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  text-decoration: none;
}

.hm-back {
  color: var(--ink-soft) !important;
}

.hm-cta {
  border-bottom-color: var(--moss);
  font-family: var(--font-display);
}

.hm-cta span {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
}

.hm-sample {
  display: grid;
  width: clamp(14rem, 22vw, 18.5rem);
  min-height: 3.75rem;
  padding: var(--space-1) var(--space-3) var(--space-1) var(--space-1);
  grid-template-columns: 3.25rem minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--paper-raised);
  color: var(--ink) !important;
  box-shadow: var(--shadow-node);
  text-decoration: none;
}

.hm-sample__photo {
  display: block;
  width: 3.25rem;
  height: 3.25rem;
  object-fit: cover;
  object-position: center 28%;
  border-radius: 50%;
}

.hm-sample__text {
  display: block;
  min-width: 0;
  line-height: var(--leading-tight);
}

.hm-sample__text strong,
.hm-sample__text small {
  display: block;
  overflow-wrap: anywhere;
}

.hm-sample__text strong {
  color: var(--moss-deep);
  font-family: var(--font-display);
  font-size: var(--text-sm);
}

.hm-sample__text small {
  margin-top: 0.125rem;
  color: var(--ink-soft);
  font-size: var(--text-2xs);
}

.hm-back:hover,
.hm-cta:hover {
  border-bottom-color: var(--moss-deep);
  color: var(--moss-deep) !important;
}

.hm-sample:hover {
  border-color: var(--moss);
  box-shadow: none;
}

.hm-foot__note {
  margin: 0;
  color: var(--ink-faint);
  font-size: var(--text-2xs);
  text-align: right;
}

.hm-dialog {
  width: min(42rem, calc(100vw - (var(--space-4) * 2)));
  max-height: calc(100vh - (var(--space-4) * 2));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-lg);
  background: var(--paper-raised);
  color: var(--ink);
  box-shadow: var(--shadow-float);
  font-family: var(--font-body);
}

.hm-dialog::backdrop {
  background: var(--overlay);
}

.hm-dialog form {
  display: grid;
  max-height: calc(100vh - (var(--space-4) * 2));
  padding: var(--space-6);
  overflow-y: auto;
  gap: var(--space-4);
}

.hm-dialog h2,
.hm-dialog h3 {
  margin: 0;
  font-family: var(--font-display);
  line-height: var(--leading-tight);
}

.hm-dialog h2 {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--moss);
  font-size: var(--text-2xl);
}

.hm-dialog form > label {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  align-items: center;
  gap: var(--space-3);
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

.hm-dialog select {
  width: 100%;
  min-height: var(--tap-min);
  padding: 0 var(--space-3);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sm);
  background: var(--paper-raised);
  color: var(--ink);
  font: inherit;
}

.hm-dialog__qr {
  display: grid;
  max-height: 14rem;
  margin: 0;
  padding: var(--space-4);
  overflow-y: auto;
  gap: var(--space-1);
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
  background: var(--paper);
}

.hm-dialog__qr legend {
  padding: 0 var(--space-2);
  color: var(--moss-deep);
  font-weight: var(--weight-bold);
}

.hm-dialog__qr label {
  display: flex;
  min-height: 2.5rem;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}

.hm-dialog__qr input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--moss);
}

.hm-dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.hm-dialog__actions .hm-btn:first-child {
  border: 1px solid var(--rule-strong);
  background: var(--paper-raised);
  color: var(--ink);
}

.hm-dialog__ready {
  padding-top: var(--space-4);
  border-top: 1px solid var(--rule);
}

.hm-dialog__ready h3 {
  font-size: var(--text-lg);
}

.hm-dialog__ready ul {
  display: grid;
  margin: var(--space-3) 0 0;
  padding: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  list-style: none;
}

.hm-dialog__ready a {
  display: flex;
  min-height: var(--tap-min);
  padding: var(--space-2) var(--space-3);
  align-items: center;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  color: var(--moss-deep);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  text-decoration: none;
}

@media (max-width: 767px) {
  .hm {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .hm-bar {
    min-height: 4rem;
    padding: var(--space-2) var(--space-3);
  }

  .hm-brand {
    display: grid;
    min-width: 0;
    flex: 1 1 auto;
    gap: 0;
    align-content: center;
  }

  .hm-brand__title {
    overflow: hidden;
    font-size: var(--text-sm);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hm-brand__title::before {
    width: 0.4rem;
    height: 0.4rem;
    margin-inline-end: var(--space-1);
  }

  .hm-brand__sub {
    padding-left: 0.9rem;
    font-size: var(--text-2xs);
  }

  .hm-lang {
    gap: 0;
  }

  .hm-lang button {
    width: var(--tap-min);
    min-width: var(--tap-min);
    padding: 0;
    font-size: var(--text-2xs);
  }

  .hm-bar__actions {
    flex: 0 0 auto;
    gap: var(--space-1);
  }

  .hm-btn {
    width: var(--tap-min);
    padding: 0;
  }

  .hm-btn span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .hm-hero {
    width: calc(100% - (var(--space-3) * 2));
    height: 7.5rem;
    padding: var(--space-2) 0;
    grid-template-columns: 5.25rem minmax(0, 1fr);
    gap: var(--space-3);
  }

  .hm-hero--noimage {
    grid-template-columns: minmax(0, 1fr);
  }

  .hm-hero__photo {
    width: 5.25rem;
    height: 6.25rem;
    border-radius: var(--radius-md) var(--radius-md) 2.75rem var(--radius-md);
  }

  .hm-hero__text {
    display: block;
  }

  .hm-hero__name {
    overflow-wrap: anywhere;
    font-size: var(--text-xl);
  }

  .hm-hero__sub {
    font-size: var(--text-2xs);
  }

  .hm-hero__intro {
    margin-top: var(--space-1);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    line-height: var(--leading-tight);
  }

  .hm-hero__hint {
    margin-top: var(--space-1);
    font-size: var(--text-2xs);
    line-height: var(--leading-tight);
  }

  .hm-tools {
    display: grid;
    width: calc(100% - (var(--space-3) * 2));
    max-width: none;
    min-height: 6.5rem;
    margin-bottom: 0;
    grid-template-columns: repeat(6, max-content);
    grid-template-rows: var(--tap-min) var(--tap-min);
    align-content: center;
    overflow-x: auto;
    border-radius: var(--radius-md);
    scrollbar-width: none;
  }

  .hm[data-panel="open"] .hm-tools {
    transform: none;
  }

  .hm-tools::-webkit-scrollbar {
    display: none;
  }

  .hm-search {
    position: sticky;
    z-index: 2;
    left: 0;
    width: calc(100vw - (var(--space-3) * 2) - (var(--space-1) * 2));
    flex: 0 0 auto;
    grid-row: 1;
    grid-column: 1 / -1;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
    background: var(--paper-raised);
  }

  .hm-tool {
    flex: 0 0 auto;
    padding: 0 var(--space-2);
  }

  .hm-zoom {
    flex: 0 0 auto;
  }

  .hm-tool span {
    font-size: var(--text-2xs);
  }

  .hm-stage,
  .hm[data-panel="open"] .hm-stage {
    position: relative;
    top: auto;
    right: 0;
    bottom: auto;
    height: 74rem;
    overflow: auto;
    overscroll-behavior: contain;
  }

  .hm-world {
    width: 100%;
    min-width: 24.375rem;
    min-height: 74rem;
  }

  .hm-node[data-type="root"] .hm-node__body {
    width: 9.5rem;
    height: 7rem;
    border-radius: 48% 44% 48% 42%;
  }

  .hm-node[data-type="branch"] .hm-node__body {
    min-width: 12.5rem;
    max-width: 18rem;
  }

  .hm-node[data-type="item"] .hm-node__body {
    max-width: 17rem;
  }

  .hm-node__thumb {
    width: 3.75rem;
    height: 2.75rem;
  }

  .hm-guide {
    display: block;
    top: 18.4rem;
    bottom: auto;
  }

  .hm-panel {
    top: auto;
    left: 0;
    width: 100%;
    height: 78vh;
    max-height: 46rem;
    padding: var(--space-5) var(--space-5) var(--space-8);
    border-top: 1px solid var(--rule);
    border-left: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    transform: translateY(102%);
  }

  .hm-panel[data-open="true"] {
    transform: translateY(0);
  }

  .hm-panel[data-snap="half"] {
    height: 48vh;
  }

  .hm-panel__grip {
    display: block;
    width: 3rem;
    height: 0.25rem;
    margin: calc(var(--space-3) * -1) auto var(--space-4);
    border-radius: var(--radius-pill);
    background: var(--rule-strong);
  }

  .hm-panel__close {
    top: var(--space-3);
    right: var(--space-3);
  }

  .hm-panel__media {
    margin: 0 calc(var(--space-5) * -1) var(--space-4);
  }

  .hm-panel__media img {
    aspect-ratio: 16 / 9;
  }

  .hm-panel__media figcaption {
    padding: var(--space-1) var(--space-5) 0;
  }

  .hm-panel__title {
    font-size: var(--text-xl);
  }

  .hm-panel__meta {
    margin-bottom: var(--space-4);
  }

  .hm-list {
    top: 18rem;
    bottom: 11rem;
    padding: var(--space-5) var(--space-4);
  }

  .hm-foot {
    position: static;
    height: 11rem;
    min-height: 0;
    padding: var(--space-2) var(--space-3);
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: min-content;
    align-content: center;
    gap: var(--space-1);
    overflow-y: auto;
  }

  .hm-legend {
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
  }

  .hm-back,
  .hm-cta,
  .hm-sample {
    width: 100%;
  }

  .hm-back,
  .hm-cta {
    padding-inline: var(--space-2);
  }

  .hm-sample {
    min-height: 3.75rem;
  }

  .hm-foot__note {
    text-align: left;
  }

  .hm-branch[data-depth="1"] {
    stroke-width: 2.5px;
    opacity: 0.68;
  }

  .hm-branch[data-depth="2"] {
    stroke-width: 1.8px;
    opacity: 0.58;
  }

  .hm-branch[data-depth="3"],
  .hm-branch[data-depth="4"] {
    stroke-width: 1.25px;
    opacity: 0.48;
  }

  .hm-dialog form {
    padding: var(--space-5);
  }

  .hm-dialog form > label {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }

  .hm-dialog__ready ul {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hm *,
  .hm *::before,
  .hm *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
