:root {
  --color-font: #1f1f1f;
  --color-muted: #888888;
  --color-icon: #999999;
  --color-input-background: #f3f3f3;
  --color-panel-background: #ffffff;
  --color-panel-header-background: #fafafa;
  --color-hover: #f2f2f2;
  --color-selected: #f3f3f3;
  --color-invalid: #d0473d;
}

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

body {
  background: #ffffff;
  color: var(--color-font);
  font-family: BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDGothic", meiryo, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

button {
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

input {
  font: inherit;
}

:focus-visible {
  outline: 1px solid var(--color-muted);
  outline-offset: 1px;
}

.ArticleStage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #ffffff;
  color: var(--color-font);
  font-size: 13px;
}
.ArticleStage[data-fixed] .SinglePanel {
  position: fixed;
  top: 56px;
  right: 0;
  left: auto;
}
.ArticleStage[data-fixed] .SinglePanel-Header {
  cursor: default;
}

.Scene-Canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.MatrixLogo {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  height: 56px;
  padding: 0 28px;
}
.MatrixLogo a {
  color: var(--color-font);
  font-size: 22px;
  line-height: 2;
  text-decoration: none;
}

.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;
  text-decoration: none;
  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;
  flex-wrap: wrap;
  align-items: flex-start;
  max-height: calc(100vh - 56px);
}

.SinglePanel {
  position: static;
  width: max-content;
  background: var(--color-panel-background);
  border-radius: 12px 8px 8px 8px;
  box-shadow: 0 0 3px 1px #f7f7f7;
  overflow: hidden;
}
.SinglePanel[data-panel]:not([data-open]) {
  display: none;
}
.SinglePanel[data-float] {
  position: fixed;
}
.SinglePanel[data-edge-left] {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
.SinglePanel[data-edge-right] {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.SinglePanel[data-panel=explanation] {
  position: fixed;
  top: 56px;
  right: 0;
  left: auto;
  max-height: calc(100vh - 56px * 2);
}
.SinglePanel-Header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 32px;
  cursor: grab;
  user-select: none;
}
.SinglePanel-Header:active {
  cursor: grabbing;
}
.SinglePanel-CloseIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--color-muted);
  cursor: pointer;
}
.SinglePanel-CloseIcon svg {
  width: 8px;
  height: 8px;
  visibility: hidden;
}
.SinglePanel-CloseIcon:hover svg {
  visibility: visible;
}
.SinglePanel-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;
}
.SinglePanel-Title[data-end] {
  padding: 0 16px;
}

.SceneInput {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 12px;
}
.SceneInput-Times {
  display: flex;
  align-items: center;
  padding-bottom: 18px;
  color: var(--color-muted);
}

.SceneMatrix {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.SceneMatrix-Label {
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1.5;
}
.SceneMatrix-Grid {
  display: grid;
  grid-template-columns: repeat(2, 56px);
  gap: 4px;
}
.SceneMatrix-Grid[data-single] {
  grid-template-columns: repeat(1, 56px);
}
.SceneMatrix-Zero {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  color: var(--color-muted);
  font-size: 15px;
}
.SceneMatrix-Cell {
  height: 32px;
  padding: 0 4px;
  border-radius: 2px;
  background: var(--color-input-background);
  color: var(--color-font);
  font-size: 15px;
  text-align: center;
}
.SceneMatrix-Cell:focus {
  outline: none;
}
.SceneMatrix-Cell[data-invalid] {
  color: var(--color-invalid);
}

.SceneEquation {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
}
.SceneEquation-Row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.SceneEquation-Cell {
  width: 52px;
  height: 32px;
  padding: 0 4px;
  border-radius: 2px;
  background: var(--color-input-background);
  color: var(--color-font);
  font-size: 15px;
  text-align: center;
}
.SceneEquation-Cell:focus {
  outline: none;
}
.SceneEquation-Cell[data-invalid] {
  color: var(--color-invalid);
}
.SceneEquation-Variable {
  font-style: italic;
  font-size: 15px;
}
.SceneEquation-Operator {
  padding: 0 2px;
  color: var(--color-muted);
  font-size: 13px;
}

.SceneSample {
  display: flex;
  flex-direction: column;
  padding: 8px 4px;
}
.SceneSample-Option {
  display: flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  color: var(--color-font);
  font-size: 13px;
  border-radius: 2px;
  white-space: nowrap;
}
.SceneSample-Option:hover {
  background-color: var(--color-hover);
}

.SceneControl {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 24px;
}

.SceneStep {
  min-width: 44px;
  color: var(--color-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.SceneStatus {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.SceneButton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 2px;
  color: var(--color-font);
}
.SceneButton:hover {
  background-color: var(--color-hover);
}
.SceneButton[data-primary] {
  background-color: var(--color-selected);
}
.SceneButton:disabled {
  opacity: 0.3;
  cursor: default;
}
.SceneButton:disabled:hover {
  background-color: transparent;
}

.StepperInput {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 8px;
}
.StepperInput-Arrow {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 2px;
  color: var(--color-icon);
  cursor: pointer;
}
.StepperInput-Arrow:hover {
  background-color: var(--color-hover);
}
.StepperInput-Arrow[data-disabled] {
  opacity: 0.3;
  cursor: default;
}
.StepperInput-Arrow[data-disabled]:hover {
  background-color: transparent;
}
.StepperInput-Track {
  display: grid;
  justify-items: center;
  min-width: 40px;
}
.StepperInput-Option {
  grid-area: 1/1;
  display: flex;
  align-items: center;
  gap: 2px;
  visibility: hidden;
  color: var(--color-font);
  font-size: 12px;
  white-space: nowrap;
  user-select: none;
}
.StepperInput-Option[data-selected] {
  visibility: visible;
}

.ArticleText {
  overflow-y: scroll;
  overscroll-behavior-y: none;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 320px;
  max-height: calc(100vh - 56px * 2 - 32px);
  padding: 16px 18px;
}
.ArticleText h1 {
  color: var(--color-font);
  font-size: 18px;
  font-weight: 500;
  line-height: 26px;
}
.ArticleText p {
  color: var(--color-font);
  font-size: 15px;
  line-height: 26px;
}
.ArticleText-Hint {
  color: var(--color-muted);
  font-size: 13px;
  line-height: 21px;
}

.TopicList {
  display: flex;
  flex-direction: column;
  width: 260px;
  padding: 8px 4px;
}
.TopicList-Item {
  display: flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 12px;
  color: var(--color-font);
  font-size: 13px;
  line-height: 1.6;
  border-radius: 2px;
  text-decoration: none;
}
.TopicList-Item:hover {
  background-color: var(--color-hover);
}
.TopicList-Item[data-active] {
  background-color: var(--color-selected);
}
