:root {
  color-scheme: light;
  --chrome: #f3f4f6;
  --chrome-2: #e5e7eb;
  --panel: #ffffff;
  --panel-subtle: #f8fafc;
  --line: #c5ced8;
  --line-strong: #96a3b3;
  --text: #24272d;
  --muted: #667085;
  --blue: #2f63b7;
  --blue-soft: #d8e7ff;
  --green: #26845b;
  --orange: #a45d18;
  --red: #c2413c;
  --editor: #f8fafc;
  --gutter: #eef2f6;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  background: #d7dee7;
  color: var(--text);
}

button {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

button:hover {
  border-color: var(--blue);
}

button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.app {
  width: 100%;
  height: 100dvh;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

.mode {
  display: inline-grid;
  place-items: center;
  height: 24px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: var(--panel-subtle);
  color: var(--blue);
  font-size: 12px;
  line-height: 1;
}

.workspace {
  --editor-width: clamp(360px, 42vw, 640px);
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, var(--editor-width)) 1px minmax(0, 1fr);
  background: #d7dee7;
}

.editor-pane {
  min-width: 0;
  min-height: 0;
  position: relative;
  background: var(--editor);
  overflow: hidden;
}

.splitter {
  min-height: 0;
  position: relative;
  z-index: 6;
  background: #b7c1cd;
  cursor: col-resize;
}

.splitter::before {
  content: "";
  position: absolute;
  inset: 0 -3px;
}

.splitter:hover,
.splitter:focus-visible {
  background: #8ea4bf;
  outline: none;
}

.editor {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--editor);
}

.source {
  position: absolute;
  inset: 0;
  min-width: 100%;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.source {
  background: #f9fbfd;
  color: var(--text);
  overflow: hidden;
}

.source .cm-editor {
  width: 100%;
  height: 100% !important;
  min-height: 0;
}

.cm-scroller::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.cm-scroller {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

.source-line {
  display: block;
  min-height: 1.5em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.error-line {
  background: rgba(194, 65, 60, 0.09);
  box-shadow: inset 2px 0 0 var(--red);
}

.tok-paren {
  color: #8490a1;
}

.tok-form {
  color: var(--green);
  font-weight: 650;
}

.tok-key {
  color: var(--blue);
}

.tok-number {
  color: var(--orange);
}

.tok-string {
  color: #7c5a00;
}

.tok-comment {
  color: #8a94a3;
}

.tok-symbol {
  color: #1f2937;
}

.preview-pane {
  min-width: 0;
  min-height: 0;
  position: relative;
  background: #ffffff;
  overflow: hidden;
}

.file-input {
  display: none;
}

.viewport-hud {
  position: absolute;
  z-index: 5;
  left: 12px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  max-width: min(520px, calc(100% - 28px));
  color: #596675;
  font-size: 12px;
  line-height: 1;
  pointer-events: none;
}

.viewport-hud.is-error {
  color: var(--red);
}

.hud-status {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.feature-history {
  position: absolute;
  z-index: 5;
  top: 10px;
  left: 10px;
  display: grid;
  gap: 1px;
  width: min(210px, calc(100% - 20px));
  max-height: calc(100% - 64px);
  overflow: auto;
  border: 1px solid rgba(128, 141, 156, 0.46);
  background: rgba(241, 245, 249, 0.78);
  backdrop-filter: blur(3px);
}

.feature-history:empty {
  display: none;
}

.history-step {
  display: block;
  width: 100%;
  height: 22px;
  padding: 0 7px;
  border: 0;
  border-left: 2px solid transparent;
  background: transparent;
  color: #3f4b5a;
  font-size: 12px;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-step.is-active {
  border-left-color: var(--blue);
  background: rgba(216, 231, 255, 0.72);
  color: #1e4d8f;
}

.history-clear {
  color: var(--blue);
}

.viewer {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.viewer:active {
  cursor: grabbing;
}

.sketch-viewer,
.sketch-viewer:active {
  cursor: default;
}

.axis-viewer {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 78px;
  height: 78px;
  pointer-events: auto;
  cursor: pointer;
}

.error {
  margin: 0;
  padding: 14px;
  color: var(--red);
  white-space: pre-wrap;
}

@media (max-width: 980px) {
  .workspace {
    --editor-width: min(54vw, 520px);
  }
}

@media (max-width: 620px) {
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, 48dvh) 1px minmax(0, 1fr);
  }

  .editor-pane {
    grid-row: 3;
  }

  .splitter {
    grid-row: 2;
    cursor: row-resize;
  }

  .splitter::before {
    inset: -3px 0;
  }

  .preview-pane {
    grid-row: 1;
  }
}
