:root {
  --wysi-primary: #027ffe;
  --wysi-hover: #0266cb;
  --wysi-highlight: #cce5ff ;
}

#wysi-svg-icons {
  display: none;
}

.wysi-wrapper {
  display: flex;
  flex-direction: column;
  position: relative;
  border-radius: 5px;
  font-size: 16px;
  line-height: 1.5;
  outline: 1px solid rgba(160, 160, 160, .3);
}

/* Fix for external styles interfering with the editor */
.wysi-wrapper {
  display: inline-flex;
  width: 100%;
  font-weight: normal !important;
  font-style: normal !important;
}

.wysi-wrapper:focus-within {
  outline-color: var(--wysi-primary);
}

.wysi-wrapper + textarea {
  display: none;
}

.wysi-toolbar {
  display: flex;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 5px;
  border-radius: 5px 5px 0 0;
  background-color: #eee;
  box-sizing: border-box;
}

.wysi-autohide .wysi-toolbar {
  display: none;
}

.wysi-autohide:focus-within .wysi-toolbar {
  display: flex;
  flex-wrap: nowrap;
  position: absolute;
  min-width: 100%;
  left: 50%;
  transform: translate(-50%, -100%);
  margin-top: -5px;
  border-radius: 5px;
  outline: 1px solid rgba(160, 160, 160, .3);
}

.wysi-toolbar *,
.wysi-toolbar *:before,
.wysi-toolbar *:after {
  box-sizing: inherit;
}

.wysi-toolbar button {
  display: inline-flex;
  align-items: center;
  width: auto;
  height: 30px;
  margin: 0 5px 0 0;
  padding: 0;
  border: 0;
  border-radius: 3px;
  color: #444;
  background-color: transparent;
  font-family: inherit;
  font-size: 1em;
  font-weight: 400;
  text-transform: none;
  box-shadow: none;
  cursor: pointer;
}

.wysi-popover > button,
.wysi-toolbar > button {
  justify-content: center;
  width: 30px;
}

.wysi-toolbar button:hover,
.wysi-toolbar button:focus,
.wysi-listbox button[aria-expanded="true"] {
  background-color: #fff;
}

.wysi-toolbar button[aria-pressed="true"] {
  color: var(--wysi-primary);
  background-color: var(--wysi-highlight);
}

.wysi-toolbar button[aria-pressed="true"]:hover {
  background-color: var(--wysi-highlight);
  mix-blend-mode: multiply;
}

.wysi-toolbar button * {
  pointer-events: none;
}

.wysi-toolbar svg {
  width: 1.5em;
  height: 1.5em;
  fill: currentColor;
}

.wysi-listbox {
  position: relative;
  line-height: 0;
}

.wysi-listbox > button {
  justify-content: space-between;
  width: 40px;
  padding: 0 4px 0 2px;
}

.wysi-listbox > button:after {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  transform: rotateZ(45deg);
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  box-sizing: border-box;
}

.wysi-listbox div {
  position: absolute;
  margin-top: -1px;
  z-index: 1;
  border-radius: 0 0 3px 3px;
  background-color: #fff;
  box-shadow: 0 10px 20px rgba(0, 0, 0, .15);
  overflow: hidden;
}

.wysi-listbox > button[aria-expanded="false"] + div {
  display: none;
}

.wysi-listbox div button {
  display: flex;
  width: 100%;
  height: 30px;
  padding: 0 10px;
  border-radius: 3px;
  text-align: left;
  cursor: pointer;
}

.wysi-listbox div button:focus {
  background-color: #eee;
}

/** Format tool **/
.wysi-format button {
  font-size: .875em;
}

.wysi-format > button {
  width: 120px;
  padding: 0 10px;
}

.wysi-format div {
  min-width: 160px;
  padding: 5px;
}

.wysi-format button[data-option^="h"] {
  font-weight: bold;
}

.wysi-format button[data-option="h1"] {
  font-size: 1.25em;
}

.wysi-format button[data-option="h2"] {
  font-size: 1.125em;
}

.wysi-format button[data-option="h3"] {
  font-size: 1em;
}
/** End of Format tool **/

.wysi-popover {
  position: relative;
  margin-right: 5px;
  line-height: 0;
}

.wysi-popover > button {
  margin: 0;
}

.wysi-popover > button[aria-expanded="false"] + div {
  display: none;
}

.wysi-popover div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  position: absolute;
  width: 250px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
  padding: 15px;
  border-radius: 5px;
  background-color: #fff;
  font-size: .875em;
  line-height: 1;
  box-shadow: 0 5px 25px rgba(0, 0, 0, .2);
}

.wysi-popover div:before {
  content: '';
  display: block;
  position: absolute;
  width: 10px;
  height: 6px;
  left: 50%;
  top: -6px;
  transform: translateX(-50%);
  border-style: solid;
  border-width: 0 5px 6px 5px;
  border-color: transparent;
  border-bottom-color: #fff;
}

.wysi-popover label {
  width: 100%;
  margin-bottom: 8px;
  font-size: 1em;
}

.wysi-popover span {
  display: block;
  width: 100%;
  margin-bottom: 5px;
  line-height: 1.5;
}

.wysi-popover input[type] {
  width: 100%;
  height: 26px;
  margin: 0;
  padding: 0 10px;
  border: 1px solid #ccc;
  border-radius: 13px;
  color: #444;
  background-color: transparent;
  font-family: inherit;
  font-size: inherit;
  box-sizing: inherit;
  box-shadow: none;
}

.wysi-popover div button {
  height: 26px;
  margin: 15px 0 0 5px;
  padding: 0 15px;
  border: 1px solid #ccc;
  border-radius: 13px;
  font-size: .9em;
}

.wysi-popover div button:hover,
.wysi-popover div button:focus {
  background-color: #ddd;
}

.wysi-popover div button:last-of-type {
  border: 0;
  color: #fff;
  background-color: var(--wysi-primary);
}

.wysi-popover div button:last-of-type:hover,
.wysi-popover div button:last-of-type:focus {
  background-color: var(--wysi-hover);
}

.wysi-popover div button[data-action="unlink"] {
  margin: 15px auto 0 0;
  padding: 0 4px;
}

.wysi-segmented {
  display: flex;
  position: relative;
  width: 100%;
  height: 26px;
  margin: 0 0 8px 0;
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 13px;
  align-items: center;
  overflow: hidden;
}

.wysi-segmented:focus-within {
  outline: 2px solid var(--wysi-primary);
}

.wysi-segmented legend {
  position: absolute;
  opacity: 0;
}

.wysi-segmented input {
  position: absolute;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  left: 0;
  top: 0;
  opacity: 0;
  pointer-events: none;
}

.wysi-segmented input + label {
  position: relative;
  display: block;
  margin: 0;
  z-index: 1;
  font-size: .875em;
  text-align: center;
  line-height: 26px;
  cursor: pointer;
}

.wysi-segmented input:checked + label {
  color: #333;
  background-color: var(--wysi-highlight);
}

.wysi-separator {
  width: 5px;
  height: 30px;
  margin-right: 10px;
  border-right: 1px solid #ccc;
}

.wysi-newline {
  flex-basis: 100%;
}

.wysi-editor {
  min-height: 200px;
  max-height: 200px;
  padding: 1em;
  outline: none;
  overflow: auto;
}

.wysi-autogrow .wysi-editor {
  max-height: none !important;
}

.wysi-editor > :first-child {
  margin-top: 0;
}

.wysi-editor blockquote {
  margin-left: 0;
  margin-right: 0;
  padding-left: 1.5em;
  padding-right: 1.5em;
  border-left: 3px solid #ccc;
  font-style: italic;
}

.wysi-editor img:hover,
.wysi-editor img.wysi-selected {
  outline: 3px solid #ddd;
}

.wysi-editor img:hover {
  outline-color: #bbb;
}

.wysi-wrapper:focus-within img.wysi-selected {
  outline-color: var(--wysi-primary);
}

/** Dark mode **/

.wysi-darkmode .wysi-toolbar {
  color: #fff;
  background-color: #222;
}

.wysi-darkmode .wysi-toolbar button:not([aria-pressed=true]) {
  color: #ddd;
}

.wysi-darkmode .wysi-listbox button[aria-expanded=true],
.wysi-darkmode .wysi-toolbar > button:focus,
.wysi-darkmode .wysi-toolbar > button:hover,
.wysi-darkmode .wysi-toolbar > div > button:focus,
.wysi-darkmode .wysi-toolbar > div > button:hover {
  background-color: #444;
}

.wysi-darkmode .wysi-toolbar button[aria-pressed=true]:hover {
  background-color: var(--wysi-highlight);
  mix-blend-mode: difference;
}

.wysi-darkmode .wysi-listbox div,
.wysi-darkmode .wysi-popover div {
  background-color: #444;
}

.wysi-darkmode .wysi-listbox div button:focus {
  background-color: #222;
}

.wysi-darkmode .wysi-popover div:before {
  border-bottom-color: #444;
}

.wysi-darkmode .wysi-popover div button:not(:last-of-type):hover,
.wysi-darkmode .wysi-popover div button:not(:last-of-type):focus {
  color: #444;
}

.wysi-darkmode .wysi-separator {
  border-color: #444;
}

.wysi-autohide.wysi-darkmode:focus-within .wysi-toolbar {
  outline-color: #111;
}