*,
::before,
::after {
  box-sizing: border-box;
}

* {
  border: 0;
  border-radius: 0;
  margin: 0;
  outline: 0;
  padding: 0;
}

html,
body {
  overflow: hidden;
}

body {
  background: #ffffff;
  color: var(--color-font);
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  font-size: 0;
  line-height: 1;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

ol,
ul {
  list-style: none;
}

button,
input,
textarea {
  color: inherit;
  font-family: inherit;
}

button {
  background-color: transparent;
  cursor: pointer;
}

::-webkit-scrollbar {
  display: none;
}

:root {
  --color-font: #333333;
  --color-muted: #888888;
  --color-symbol: #646464;
  --color-input-background: #fafafa;
  --color-panel-background: #ffffff;
  --color-panel-header-background: #fafafa;
  --color-panel-shadow: #f7f7f7;
  --color-divider: #f0f0f0;
}

.LineageEditor {
  position: fixed;
  inset: 0;
  overflow: hidden;
  font-size: 13px;
}

.Stage {
  position: absolute;
  inset: 0;
}
.Stage-Canvas {
  display: block;
  cursor: grab;
}
.Stage-Canvas:active {
  cursor: grabbing;
}

.Logo {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 28px;
}
.Logo-Text {
  color: var(--color-font);
  font-family: "Noto Serif JP", "Hiragino Mincho ProN", Georgia, serif;
  font-size: 22px;
  line-height: 2;
  cursor: pointer;
  user-select: none;
}

.ApplicationMenu {
  overflow-y: scroll;
  overscroll-behavior-y: none;
  scrollbar-width: none;
  position: fixed;
  top: 56px;
  left: 0;
  bottom: 0;
  z-index: 35;
  display: none;
  flex-direction: column;
  width: 300px;
  background: var(--color-panel-background);
  border-radius: 0 8px 0 0;
}
.ApplicationMenu[data-open] {
  display: flex;
}
.ApplicationMenu-Section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 0;
}
.ApplicationMenu-Section + .ApplicationMenu-Section {
  border-top: 1px solid var(--color-divider);
}
.ApplicationMenu-Link {
  padding: 0 24px;
}
.ApplicationMenu-Link-Name {
  display: block;
  color: var(--color-font);
  font-size: 15px;
  line-height: 23px;
  text-decoration: none;
}
.ApplicationMenu-Link-Description {
  color: var(--color-muted);
  font-size: 12px;
  line-height: 20px;
}

.PanelControl {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
  padding: 0 32px;
}
.PanelControl-Item {
  display: flex;
  align-items: center;
  color: var(--color-muted);
  font-size: 13px;
  line-height: 21px;
  cursor: pointer;
  user-select: none;
}
.PanelControl-Item[data-open] {
  color: var(--color-font);
}

.PanelColumn {
  position: absolute;
  left: 0;
  top: 56px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.Panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: max-content;
  background: var(--color-panel-background);
  box-shadow: 0 0 3px 1px var(--color-panel-shadow);
  border-radius: 12px 8px 8px 8px;
  overflow: hidden;
}
.Panel[data-panel]:not([data-open]) {
  display: none;
}
.Panel[data-float] {
  position: fixed;
}
.Panel[data-edge-left] {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.Panel[data-edge-right] {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.Panel-Header {
  flex-shrink: 0;
  width: 100%;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: grab;
  user-select: none;
}
.Panel-Header:active {
  cursor: grabbing;
}
.Panel-CloseIcon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-symbol);
  cursor: pointer;
}
.Panel-CloseIcon svg {
  visibility: hidden;
}
.Panel-CloseIcon:hover svg {
  visibility: visible;
}
.Panel-Title {
  display: flex;
  align-items: center;
  height: 32px;
  background: var(--color-panel-header-background);
  color: var(--color-font);
  font-size: 11px;
  line-height: 1.5;
  border-bottom-right-radius: 12px;
}
.Panel-Title[data-end] {
  padding: 0 16px;
}
.Panel-Main {
  flex: 1;
  min-height: 0;
  overflow-y: scroll;
  overscroll-behavior-y: none;
  scrollbar-width: none;
}
.Panel-Handle {
  position: absolute;
}
.Panel-Handle[data-direction=n] {
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  cursor: ns-resize;
}
.Panel-Handle[data-direction=s] {
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  cursor: ns-resize;
}
.Panel-Handle[data-direction=e] {
  top: 0;
  right: 0;
  bottom: 0;
  width: 6px;
  cursor: ew-resize;
}
.Panel-Handle[data-direction=w] {
  top: 0;
  left: 0;
  bottom: 0;
  width: 6px;
  cursor: ew-resize;
}
.Panel-Handle[data-direction=ne] {
  top: 0;
  right: 0;
  width: 12px;
  height: 12px;
  cursor: nesw-resize;
}
.Panel-Handle[data-direction=nw] {
  top: 0;
  left: 0;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
}
.Panel-Handle[data-direction=se] {
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  cursor: nwse-resize;
}
.Panel-Handle[data-direction=sw] {
  bottom: 0;
  left: 0;
  width: 12px;
  height: 12px;
  cursor: nesw-resize;
}

.ArticlePanel {
  max-height: calc(100vh - 56px * 2);
}

.LineageEditor[data-fixed] .Panel {
  position: fixed;
  top: 56px;
  right: 0;
  left: auto;
}
.LineageEditor[data-fixed] .Panel-Header {
  cursor: default;
}

.RightLabelGrid {
  display: grid;
  grid-template-columns: max-content 1fr;
  padding: 8px 12px;
}
.RightLabelGrid-Row {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1/-1;
  align-items: center;
  min-height: 36px;
  column-gap: 8px;
}
.RightLabelGrid-Row-Label {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 12px;
  color: var(--color-font);
  font-size: 13px;
  line-height: 1.5;
}

.ColorInput,
.NumberInput,
.SideInput,
.ToggleInput {
  justify-self: start;
}

.NumberInput {
  display: flex;
  align-items: center;
}
.NumberInput-Arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  color: var(--color-symbol);
  cursor: pointer;
}
.NumberInput-Field {
  display: flex;
  align-items: center;
}
.NumberInput-Input {
  min-width: calc(2ch + 16px);
  max-width: calc(4ch + 16px);
  height: 24px;
  padding: 0 4px;
  border-radius: 2px;
  background: var(--color-input-background);
  color: var(--color-font);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}
.NumberInput-Input:focus {
  outline: none;
}
.NumberInput-Unit {
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.5;
  user-select: none;
}

.ToggleInput {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}
.ToggleInput-Option {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 10px;
  color: var(--color-font);
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
}
.ToggleInput [data-selected]::before, .ToggleInput [data-selected]::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  pointer-events: none;
}
.ToggleInput [data-selected]::before {
  left: 0;
  border-left: 1px solid var(--color-symbol);
  border-top: 1px solid var(--color-symbol);
  border-bottom: 1px solid var(--color-symbol);
  border-top-left-radius: 2px;
  border-bottom-left-radius: 2px;
}
.ToggleInput [data-selected]::after {
  right: 0;
  border-right: 1px solid var(--color-symbol);
  border-top: 1px solid var(--color-symbol);
  border-bottom: 1px solid var(--color-symbol);
  border-top-right-radius: 2px;
  border-bottom-right-radius: 2px;
}

.ColorInput {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0 12px;
}
.ColorInput-Select {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 96px;
  height: 24px;
  border-radius: 2px;
  color: #fcfcfc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
  user-select: none;
}
.ColorInput-Select[data-light] {
  color: #1f1f1f;
}
.ColorInput-Picker {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  pointer-events: none;
}

.SideInput {
  display: grid;
  grid-template-areas: ". top ." "left . right" ". bottom .";
  grid-template-columns: repeat(3, auto);
  justify-items: center;
  align-items: center;
}
.SideInput-Top {
  grid-area: top;
}
.SideInput-Right {
  grid-area: right;
}
.SideInput-Bottom {
  grid-area: bottom;
}
.SideInput-Left {
  grid-area: left;
}

.RoundNumberInput {
  display: flex;
  height: 24px;
  background: var(--color-input-background);
  border-radius: 12px;
  overflow: hidden;
}
.RoundNumberInput-Previous, .RoundNumberInput-Next {
  flex-shrink: 0;
  width: 12px;
  cursor: pointer;
}
.RoundNumberInput-Input {
  flex-shrink: 0;
  width: 32px;
  background: transparent;
  color: var(--color-font);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}
.RoundNumberInput-Input:focus {
  outline: none;
}

.ViewControl {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  display: flex;
  align-items: center;
}

.PlayButton {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  color: var(--color-symbol);
  cursor: pointer;
}

.PreviewScale {
  display: flex;
  align-items: center;
}
.PreviewScale-Arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  color: var(--color-symbol);
  cursor: pointer;
}
.PreviewScale-Field {
  display: flex;
  align-items: center;
}
.PreviewScale-Input {
  width: 48px;
  height: 24px;
  padding: 0 4px;
  border-radius: 2px;
  background: var(--color-input-background);
  color: var(--color-font);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}
.PreviewScale-Input:focus {
  outline: none;
}
.PreviewScale-Unit {
  color: var(--color-font);
  font-size: 12px;
  line-height: 1.5;
  user-select: none;
}

.ActionList {
  display: flex;
  flex-direction: column;
  padding: 8px 6px;
}

.ActionItem {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 30px;
  padding: 0 12px;
  color: var(--color-font);
  font-size: 13px;
  line-height: 1.5;
  border-radius: 2px;
  cursor: pointer;
  user-select: none;
}

.SourceBlock {
  padding: 8px 12px;
}

.SourceInput {
  width: 260px;
  height: 240px;
  padding: 10px;
  border-radius: 2px;
  background: var(--color-input-background);
  color: var(--color-font);
  font-family: "Noto Serif JP", "Hiragino Mincho ProN", Georgia, serif;
  font-size: 14px;
  line-height: 1.8;
  white-space: pre;
  overflow: auto;
  resize: none;
  tab-size: 4;
}
.SourceInput:focus {
  outline: none;
}

.CategoryPanel,
.ArticleListPanel {
  overflow-y: scroll;
  overscroll-behavior-y: none;
  scrollbar-width: none;
  position: fixed;
  display: none;
  flex-direction: column;
  width: max-content;
  max-width: 280px;
  background: var(--color-panel-background);
  box-shadow: 0 0 3px 1px var(--color-panel-shadow);
  border-radius: 8px;
  overflow-x: hidden;
}
.CategoryPanel[data-open],
.ArticleListPanel[data-open] {
  display: flex;
}

.TopicList {
  display: flex;
  flex-direction: column;
  padding: 8px 6px;
}
.TopicList-Item {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  height: 30px;
  padding: 0 12px;
  color: var(--color-font);
  font-size: 13px;
  line-height: 1.5;
  border-radius: 2px;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}
.TopicList-Item[data-selected] {
  background: var(--color-panel-header-background);
}
.TopicList-Item[data-active] {
  font-weight: 500;
}
.TopicList-Empty {
  padding: 10px 14px;
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.6;
}

.ArticleBlock {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 320px;
  padding: 16px 18px;
}
.ArticleBlock h1 {
  color: var(--color-font);
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
}
.ArticleBlock-Heading {
  color: var(--color-font);
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
}
.ArticleBlock-Body {
  color: #474747;
  font-size: 13px;
  line-height: 21px;
}
.ArticleBlock-List {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ArticleBlock-List li {
  position: relative;
  padding-left: 16px;
  color: #474747;
  font-size: 13px;
  line-height: 21px;
}
.ArticleBlock-List li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9.5px;
  width: 2px;
  height: 2px;
  background-color: var(--color-muted);
  border-radius: 50%;
}
.ArticleBlock a {
  color: var(--color-font);
  text-decoration: underline;
}
.ArticleBlock-Cite {
  color: var(--color-muted);
  font-size: 11px;
  line-height: 1;
  vertical-align: super;
}
.ArticleBlock-Cite a {
  text-decoration: none;
}
.ArticleBlock-Cite a:hover {
  text-decoration: underline;
}
.ArticleBlock-Reference {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ArticleBlock-Reference-Item {
  display: flex;
  gap: 6px;
  color: var(--color-muted);
  font-size: 12px;
  line-height: 19px;
  scroll-margin: 12px 0;
}
.ArticleBlock-Reference-Number {
  flex: none;
}

.TextBlock {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 260px;
  padding: 16px 18px;
}
.TextBlock h1 {
  color: var(--color-font);
  font-size: 16px;
  font-weight: 500;
  line-height: 24px;
}
.TextBlock p {
  color: #474747;
  font-size: 13px;
  line-height: 21px;
}
