body.theme-dark {
  --cm-panel-bg: var(--color-base-00);
}
body.theme-light {
  --cm-panel-bg: color-mix(
    in srgb,
    var(--color-base-05) 55%,
    var(--color-base-10) 45%
  );
}
body {
  --cm-font-size: calc(var(--font-ui-small) + 0.809015px);
}

body.flexcyon-flex-max-mode,
body.flexcyon-vim-mode-text-enable:not(.flexcyon-status-text-enable-color) {
  .markdown-source-view.mod-cm6 .cm-panels.cm-panels-bottom {
    border-top: unset;
    padding-top: 6px;
  }

  .markdown-source-view.mod-cm6
    .cm-editor
    .cm-scroller:not(.cm-vimMode)
    .cm-sizer:has(+ .cm-vimCursorLayer)::before {
    content: var(--flexcyon-vim-insert-text);
    bottom: var(--flexcyon-vim-bottom-positioning);
    left: var(--flexcyon-vim-left-positioning);
    position: fixed;
    background-color: var(--cm-panel-bg);
    color: var(--text-muted);
    height: 30px;
    padding: 0px 8px;
    font-size: var(--cm-font-size);
    font-family: var(--font-interface);
    z-index: 2;
  }

  .markdown-source-view.mod-cm6
    .cm-editor
    .cm-scroller.cm-vimMode:not(:has(+ .cm-panels))
    .cm-sizer:has(+ .cm-vimCursorLayer)::before {
    content: var(--flexcyon-vim-normal-text);
    position: fixed;
    background-color: var(--cm-panel-bg);
    bottom: var(--flexcyon-vim-bottom-positioning);
    left: var(--flexcyon-vim-left-positioning);
    height: 30px;
    color: var(--text-muted);
    padding: 0px 8px;
    font-size: var(--cm-font-size);
    font-family: var(--font-interface);
    z-index: 2;
  }

  .cm-panels .cm-panel div div:not(.cm-vim-message) span:first-child {
    bottom: var(--flexcyon-vim-bottom-positioning);
    left: 75px;
  }

  .cm-panels .cm-panel {
    background-color: var(--color-base-00);
    padding-top: 5px;
    font-weight: 500;
  }

  .cm-panels input {
    transform: translateY(-4px);
    font-size: 0.9rem;
    z-index: 16;
  }

  .cm-editor
    > .cm-scroller
    + .cm-panels
    .cm-panel
    div
    div:not(.cm-vim-message)::before {
    content: var(--flexcyon-vim-command-text);
    bottom: var(--flexcyon-vim-bottom-positioning);
    padding-right: 4px;
    font-size: var(--cm-font-size);
    font-family: var(--font-interface);
  }

  .cm-editor > .cm-scroller + .cm-panels .cm-panel div {
    color: var(--text-muted);
  }

  div.cm-vim-message {
    color: var(--color-red) !important;
    font-weight: bold;
  }
}

body.flexcyon-vim-mode-text-enable.flexcyon-status-text-enable-color {
  .markdown-source-view.mod-cm6 .cm-panels.cm-panels-bottom {
    border-top: unset;
    padding-top: 6px;
  }

  .cm-editor
    .cm-scroller:not(.cm-vimMode)
    .cm-sizer:has(+ .cm-vimCursorLayer)::before {
    content: var(--flexcyon-vim-insert-text);
    bottom: var(--flexcyon-vim-bottom-positioning);
    left: var(--flexcyon-vim-left-positioning);
    position: fixed;
    color: var(--text-accent);
    height: 30px;
    padding: 0px 8px;
  }

  .cm-editor
    .cm-scroller.cm-vimMode:not(:has(+ .cm-panels))
    .cm-sizer:has(+ .cm-vimCursorLayer)::before {
    content: var(--flexcyon-vim-normal-text);
    position: fixed;
    bottom: var(--flexcyon-vim-bottom-positioning);
    left: var(--flexcyon-vim-left-positioning);
    height: 30px;
    color: var(--color-purple);
    font-family: var(--font-interface);
    padding: 0px 8px;
  }

  .cm-panels .cm-panel div div:not(.cm-vim-message) span:first-child {
    bottom: var(--flexcyon-vim-bottom-positioning);
    left: 75px;
  }

  .cm-panels .cm-panel {
    background-color: var(--color-base-00);
    padding-top: 5px;
    font-weight: 500;
  }

  .cm-panels input {
    transform: translateY(-4px);
    font-size: 0.9rem;
    z-index: 16;
  }

  .cm-editor
    > .cm-scroller
    + .cm-panels
    .cm-panel
    div
    div:not(.cm-vim-message)::before {
    content: var(--flexcyon-vim-command-text);
    bottom: var(--flexcyon-vim-bottom-positioning);
    color: var(--color-blue);
    padding-right: 4px;
  }

  .cm-editor > .cm-scroller + .cm-panels .cm-panel div {
    color: var(--text-muted);
  }

  div.cm-vim-message {
    // Blame inline styling :v
    color: var(--color-red) !important;
    font-weight: bold;
  }
}

body.is-mobile.flexcyon-vim-mode-text-enable {
  .cm-editor
    .cm-scroller:not(.cm-vimMode)
    .cm-sizer:has(+ div + div + .cm-vimCursorLayer)::before {
    content: var(--flexcyon-vim-insert-text);
    bottom: var(--flexcyon-vim-bottom-positioning);
    left: var(--flexcyon-vim-left-positioning);
    position: fixed;
    height: 30px;
    padding-left: 4px;
  }

  .cm-editor
    .cm-scroller.cm-vimMode:not(:has(+ .cm-panels))
    .cm-sizer:has(+ div + div + .cm-vimCursorLayer)::before {
    content: var(--flexcyon-vim-normal-text);
    position: fixed;
    bottom: var(--flexcyon-vim-bottom-positioning);
    left: var(--flexcyon-vim-left-positioning);
    height: 30px;
    padding-left: 4px;
  }
}

body.flexcyon-status-style-angled {
  .cm-editor
    .cm-scroller:not(.cm-vimMode)
    .cm-sizer:has(+ .cm-vimCursorLayer)::before,
  .cm-editor
    .cm-scroller.cm-vimMode:not(:has(+ .cm-panels))
    .cm-sizer:has(+ .cm-vimCursorLayer)::before {
    background-color: var(--color-base-25);
    transform: skewX(-22.5deg);
  }

  .cm-panels .cm-panel {
    background-color: var(--color-base-05);
  }
}

body.flexcyon-status-style-card {
  .cm-editor
    .cm-scroller:not(.cm-vimMode)
    .cm-sizer:has(+ .cm-vimCursorLayer)::before,
  .cm-editor
    .cm-scroller.cm-vimMode:not(:has(+ .cm-panels))
    .cm-sizer:has(+ .cm-vimCursorLayer)::before {
    border-radius: var(--flexcyon-callout-radix);
    border: 2px solid var(--color-base-20);
    margin: 0px 8px;
    line-height: 30px;
  }

  .markdown-source-view.mod-cm6
    .cm-panels.cm-panels-bottom
    .cm-panel.cm-vim-panel {
    border-radius: var(--flexcyon-callout-radix);
    border: 2px solid var(--color-base-20);
    margin: 0px 8px;
  }
  div:has(.cm-vim-panel) + .status-bar {
    margin-bottom: 50px;
  }
}
