html {
  min-width: 320px;
  background: #000;
}

body {
  box-sizing: border-box;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 15px;
  overflow-x: hidden;
}

html.crystal {
  background: radial-gradient(125% 125% at 29% 12%, #000000 0%, #161616 50%, #333333 100%) fixed;
}

#hydra-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.crystal #hydra-canvas {
  opacity: 0;
  transition: opacity 0.8s ease-out;
}

.crystal #hydra-canvas.is-ready {
  opacity: 1;
}

.js.crystal #source {
  visibility: hidden;
}

.editor-container {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: calc(100vh - 30px);
  min-height: calc(100dvh - 30px);
  display: flex;
  flex-direction: column;
}

#source {
  display: block;
  width: 100%;
  min-height: calc(100dvh - 30px);
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: #f2f4f8;
  font: 18px/1.4 monospace;
  resize: none;
}

.CodeMirror.cm-s-tomorrow-night-eighties {
  height: auto;
  background: transparent;
  color: #f2f4f8;
  font: 18px/1.4 monospace;
}

.CodeMirror {
  width: fit-content;
  max-width: 100%;
  pointer-events: none;
}

.cm-s-tomorrow-night-eighties .CodeMirror-line > span {
  background-color: rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}

.cm-s-tomorrow-night-eighties div.CodeMirror-selected,
.cm-s-tomorrow-night-eighties.CodeMirror-focused div.CodeMirror-selected {
  background: transparent;
}

.CodeMirror .CodeMirror-selectedtext {
  background-color: rgba(255, 128, 57, 0.45);
}

.CodeMirror pre.CodeMirror-line:has(.cm-comment) {
  font-size: clamp(12px, 4.2vw, 40px) !important;
  line-height: 1.35 !important;
}

.cm-s-tomorrow-night-eighties span.cm-comment {
  color: #78a9ff;
}

.cm-s-tomorrow-night-eighties span.cm-variable,
.cm-s-tomorrow-night-eighties span.cm-variable-2,
.cm-s-tomorrow-night-eighties span.cm-def {
  color: #be95ff;
}

.cm-s-tomorrow-night-eighties span.cm-property,
.cm-s-tomorrow-night-eighties span.cm-attribute {
  color: #08bdba;
}

.cm-s-tomorrow-night-eighties span.cm-number,
.cm-s-tomorrow-night-eighties span.cm-atom {
  color: #3ddbd9;
}

.cm-s-tomorrow-night-eighties span.cm-string {
  color: #25be6a;
}

.cm-s-tomorrow-night-eighties span.cm-keyword,
.cm-s-tomorrow-night-eighties span.cm-operator {
  color: #ff7eb6;
}

.cm-s-tomorrow-night-eighties span.cm-bracket {
  color: #f2f4f8;
}

.cm-s-tomorrow-night-eighties span.cm-error {
  background: none;
  color: #ee5396;
}

.CodeMirror .cm-comment {
  font-size: inherit !important;
  line-height: inherit !important;
}

.source-link {
  margin: auto 4px 0;
  padding-top: 16px;
  font: 18px/1.4 monospace;
  color: #f2f4f8;
}

.source-link a {
  color: #ee5396;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.source-link a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

@media (max-width: 700px) {
  body {
    padding: 8px;
  }

  .editor-container {
    min-height: calc(100vh - 16px);
    min-height: calc(100dvh - 16px);
  }

  .CodeMirror {
    width: calc(100dvw - 16px) !important;
    max-width: calc(100dvw - 16px) !important;
    box-sizing: border-box;
  }

  .CodeMirror-sizer {
    padding-right: 0 !important;
    border-right-width: 0 !important;
  }

  .CodeMirror pre.CodeMirror-line:not(:has(.cm-comment)) {
    font-size: 14px !important;
    line-height: 1.4 !important;
  }

  .CodeMirror pre.CodeMirror-line:has(.cm-comment) {
    font-size: clamp(17px, 6vw, 40px) !important;
  }

  .source-link {
    font-size: 14px;
  }
}
