* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html {
  background-color: light-dark(#fafafa, #1b1b1d);
  --background-color: light-dark(#fafafa, #1b1b1d);
  color: light-dark(#6a6a6a, #e3e3e3);
  --color-border: light-dark(#ddd, #606770);
  color-scheme: light dark;
  &[data-theme="light"] {
    color-scheme: light;
  }
  &[data-theme="dark"] {
    color-scheme: dark;
  }
  font-family:
    -apple-system, system-ui, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", Arial,
    sans-serif;
  font-size: 12px;
  line-height: 1.25;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  margin: 0;
}

#root,
.playground-container {
  height: 100%;
  display: flex;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

header {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  height: 30px;
  padding: 11px 27px;
  background-color: #1a2b34;
  color: #e0e0e0;
  position: relative;
  z-index: 20;
}

@media (max-width: 400px) {
  header {
    padding: 10px;
  }

  .github-button {
    display: none;
  }
}

header a,
header a:visited,
header a:focus,
header a:active,
header a:hover {
  color: #fff;
  text-decoration: none;
}

.theme-icon {
  padding-block: 2px;
}

.editors-container {
  display: flex;
  flex: 1;
  min-height: 0;
}

.editors {
  display: flex;
  flex-flow: row wrap;
  flex: 1;
}

.editor {
  box-sizing: border-box;
  display: flex;
  flex: 1 1 100%;
  position: relative;
  border-bottom: 1px solid var(--color-border);
}

.disabled-output-panel {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  text-align: center;
}

.disabled-output-panel .explanation {
  font-size: 16px;
  max-width: 400px;
  color: darkred;
}

.disabled-output-panel .btn {
  font-size: 22px;
  padding: 10px 20px;
}

.editor {
  position: relative;
}

/* display as 2x2 grid */
@media (min-width: 800px) {
  .options-container {
    border-right: 0;
  }

  .editor {
    flex-basis: 50%;
    border-left: 1px solid var(--color-border);
    margin-left: -1px;
  }
}

/* display as four columns */
@media (min-width: 1200px) {
  .editor {
    flex-basis: 25%;
  }
}

.editor.loading {
  opacity: 0;
}

.editor__name {
  color: #fff;
  position: absolute;
  inset-inline-start: 0;
  inset-block-end: 0;
  background: #000;
  opacity: 0.4;
  padding: 0.25em 0.5em;
  pointer-events: none;
  border-start-end-radius: 4px;
}

.bottom-bar {
  position: relative;
}

.bottom-bar-buttons {
  z-index: 10;
  padding: 8px;
  display: flex;
  float: left;
}

.bottom-bar-buttons-right {
  float: right;
}

.bottom-bar-buttons > * + * {
  margin-left: 9px;
}

@media (max-width: 799px) {
  .bottom-bar-buttons {
    top: auto;
    bottom: 100%;
    padding: 2px;
  }

  .bottom-bar-buttons > * + * {
    margin-left: 2px;
  }
}

.options-container {
  display: none;
  box-sizing: border-box;
  width: 225px;
  overflow-y: auto;
  border-bottom: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  flex: 0 1 auto;
}

.options-container.open {
  display: block;
}

.options {
  display: flex;
  flex-direction: column;
  max-height: 100%;
  overflow: auto;
}

.sub-options {
  flex: 1;
  padding: 15px 0 10px;
  border-bottom: 1px solid var(--color-border);
}

.sub-options:last-child {
  border: 0;
}

.sub-options > summary {
  font-size: 14px;
  font-weight: bold;
  padding-bottom: 5px;
  cursor: pointer;
}

.sub-options > summary:focus {
  outline: 0;
}

.sub-options > * {
  margin-left: 10px;
}

label {
  font-family:
    Consolas,
    Courier New,
    Courier,
    monospace;
  margin: 10px 0;
  display: block;
}

input[type="number"] {
  max-width: 40px;
}

/* Copied from the GitHub button styling. */
.btn {
  box-sizing: content-box;
  display: inline-block;
  height: 18px;
  padding: 0 5px;
  border-radius: 0.25em;
  background-image: linear-gradient(
    to bottom,
    light-dark(#fafbfc, #090a11),
    light-dark(#e4ebf0, #000)
  );
  color: light-dark(#24292e, #fff);
  border: 1px solid var(--color-border);
  font-size: 11px;
  line-height: 18px;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  position: relative;
}

.btn:enabled:is(:hover, :active) {
  border-color: light-dark(#afb1b2, #6f7b81);
}

.btn:enabled:hover {
  background-color: light-dark(#e6ebf1, #2c3a44);
  background-image: linear-gradient(
    to bottom,
    light-dark(#f0f3f6, #1a2b34),
    light-dark(#dce3ec, #090a11)
  );
}

.btn:enabled:active {
  background-color: light-dark(#e9ecef, #1a2b34);
  background-image: none;
  box-shadow: inset 0 0.15em 0.3em rgba(27, 31, 35, 0.15);
}

.btn:disabled {
  opacity: 0.5;
}

.tooltip {
  position: absolute;
  z-index: 6;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 4px;
  padding: 0.4em 0.8em;
  background-color: #000;
  color: #fff;
  border-radius: 0.4em;
  pointer-events: none;
}

.tooltip::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom: none;
  border-top-color: #000;
}

.cm-editor {
  height: 100%;
  background-color: var(--background-color) !important;
}

.cm-editor .cm-scroller {
  font-family:
    Consolas,
    Monaco,
    Andale Mono,
    Ubuntu Mono,
    monospace;
  line-height: 1.6;
}

.cm-editor.cm-focused {
  outline: none;
}

.cm-content {
  position: relative;
}

.cm-editor .cm-gutters {
  border-right: 1px solid var(--color-border);
  background: #f7f7f7;
}

.cm-gutter {
  padding-inline-start: 5px;
  padding-inline-end: 3px;
}

.cm-overlay-highlight {
  background-color: rgba(255, 220, 120, 0.45);
}

.cm-foldGutter .cm-gutterElement {
  cursor: pointer;
}

html[data-theme="dark"] .cm-overlay-highlight {
  background-color: rgba(255, 220, 120, 0.32);
}

html[data-theme="dark"] .cm-gutters {
  background-color: #121212;
  border-right-color: transparent;
  color: #424242;
}

.version-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5em;
  flex: 1;
}
.version-link {
  opacity: 0.5;
}

.header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-wrapper {
  display: flex;
  align-items: center;
}
.logo-wrapper h1 {
  font-size: 20px;
  display: block;
  font-family: inherit;
  font-weight: 400;
  line-height: 18px;
  position: relative;
  margin: 0;
}
.logo {
  height: 34px;
  margin-right: 10px;
}
.links {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.github-button span {
  display: flex;
}
