@supports (padding: max(0px)) {
  .post {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }
}

#app-container {
  background-color: var(--ls-primary-background-color, #fff);
  position: relative;
}

#root {
  > div {
    color: var(--ls-primary-text-color, #24292e);
    font-size: var(--ls-page-text-size);
  }
}

.is-electron.is-mac .cp__sidebar-left-layout {
}

#app-container {
  display: flex;
  flex: 0 0 100%;
}

#skip-to-main {
  @apply fixed p-2 rounded;

  left: 50%;
  transform: translate(-50%, 0);
  background-color: var(--ls-secondary-background-color);
  top: -100px;
  z-index: 10000;
  transition: top 0.3s;

  &:focus {
    top: 20px;
  }
}

#left-container {
  @apply flex flex-1 flex-col relative h-screen;
}

#main-container {
    /* Hack: (overflow-y) to fix sticky header not working */
    /* To reproduce: quick creating blocks */
    overflow-y: hidden;
    position: relative;
    height: 100%;
    transition: padding-left .3s;

  &.is-left-sidebar-open {
    padding-left: 0;

    @screen sm {
      padding-left: var(--ls-left-sidebar-width);
    }
  }
}

#main-content {
  position: relative;
  height: calc(100vh - var(--ls-headbar-height));

  &-container {
    @apply p-4 sm:px-8;
    font-size: 1em;
  }
}

.left-sidebar-inner {
  position: relative;
  height: 100%;
  padding-top: 12px;
  width: var(--ls-left-sidebar-sm-width);
  overflow-y: auto;
  overflow-x: hidden;
  background-color: var(--ls-primary-background-color);
  transition: transform .3s;
  transform: translateX(-100%);
  z-index: 3;

  -webkit-font-smoothing: antialiased;

  > .wrap {
    height: calc(100vh - var(--ls-headbar-inner-top-padding) - 50px);
    margin-top: 40px;
    padding-bottom: 60px;
    width: 100%;

    > .fake-bar {
      @apply w-full px-5 pt-1 sm:hidden;

      top: -45px;
    }
  }

  .dropdown-wrapper {
    min-width: 180px;
    margin-top: 1px;

    .menu-link {
      padding: 5px 15px;
      opacity: .8;

      &:hover {
        opacity: 1;
      }
    }
  }

  .page-icon {
    @apply mr-1 align-baseline;
    width: 16px;
    height: 16px;
    text-align: center;
    display: inline-block;
    line-height: 1em;
    color: var(--ls-icon-color);
  }

  a.item {
    user-select: none;
    transition: background-color .3s;

    > .ti {
      font-size: 16px;
      margin-right: 8px;
      opacity: .6;
      position: relative;
    }

    &.active, &:active {
      background-color: var(--ls-quaternary-background-color);
    }

    &:hover {
      opacity: .8;

      .ti {
        opacity: .8;
      }
    }
  }

  .nav-content-item {
    &-inner {
      border-radius: 8px;
    }

    .header {
      @apply px-6 py-1;
      display: flex;
      justify-content: space-between;
      align-items: center;
      user-select: none;
      cursor: pointer;

      > span {
        > a {
          opacity: .4;
          padding-left: 12px;
          display: none;
          transition: none;

          &:hover {
            opacity: 1 !important;
          }

          &:last-child {
            transform: translateY(-6px) translateX(2px) rotate(90deg);
            transform-origin: center center;
            transition: .15s transform;
          }
        }
      }

      &:hover {
        background-color: var(--ls-tertiary-background-color);

        * {
          opacity: 1 !important;
        }

        > span {
          > a {
            display: block;

            &:last-child {
              display: block;
              opacity: .6;
            }
          }
        }
      }

      &:active {
        opacity: .8;
      }

      .wrap-th {
        > span {
          font-size: 11px;
          font-weight: 600;
        }
      }
    }

    .bd {
      display: none;

      ul {
        list-style: none;
        padding: 0;
        margin: 0;

        a {
          width: 100%;
          padding: 2px 24px;
          display: block;
          text-overflow: ellipsis;
          overflow: hidden;
          white-space: nowrap;
          color: var(--ls-primary-text-color);
          transition: background-color .3s;

          &:hover {
            background-color: var(--ls-quaternary-background-color);
          }

          &:active {
            opacity: .7;
          }
        }
      }
    }

    &.is-expand {
      .header > span > a {
        &:last-child {
          transform: translateY(2px) translateX(-3px);
        }
      }

      .bd {
        display: block;
      }
    }
  }

  .new-page {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 14px;

    &-link {
      background-color: var(--ls-primary-background-color);
      box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    }
  }

  @screen sm {
    padding-top: 0;
    width: var(--ls-left-sidebar-width);
    background-color: var(--ls-secondary-background-color);

    > .wrap {
      margin-top: 52px;
    }

    .new-page {
      &-link {
        background-color: var(--ls-primary-background-color);
      }
    }
  }
}

.cp__sidebar-left-layout {
  position: fixed;
  width: 0;
  top: var(--ls-headbar-inner-top-padding);
  left: 0;
  z-index: var(--ls-z-index-level-5);
  transition: width 1.2s;

  a {
    color: var(--ls-primary-text-color);
  }

  > .shade-mask {
    background-color: rgba(0, 0, 0, .5);
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    z-index: -1;
    opacity: 0;
    transition: opacity .1s;
    touch-action: none;
  }

  &.is-open {
    transition: none;
    width: 100%;

    .left-sidebar-inner {
      transform: translateX(0);
      overflow: visible;
    }

    > .shade-mask {
      opacity: 1;
      z-index: 1;
    }
  }

  &:before {
    content: " ";
    height: 3rem;
    background-color: var(--ls-primary-background-color);
    position: fixed;
    left: 0;
    top: 0;
    opacity: 1;
    z-index: 5;
  }

  @screen sm {
    width: 0;
    z-index: var(--ls-z-index-level-1);

    &:before {
      background-color: var(--ls-secondary-background-color);
      width: 0;
      overflow: hidden;
    }

    &.is-open {
      width: var(--ls-left-sidebar-width);
    }

    > .shade-mask {
      display: none;
    }
  }
}

.ls-left-sidebar-open {
  .cp__header > .r {
    display: none;
  }

  @screen sm {
    .cp__header > .r {
      display: flex;
    }
  }
}

.ls-wide-mode {
  .cp__sidebar-main-content {
    max-width: var(--ls-main-content-max-width-wide);
  }
}

html[data-theme='dark'] {
  #left-sidebar {
    > .shade-mask {
      background-color: rgba(0, 0, 0, .15);
    }
  }
}

.settings-modal {
  margin: -15px;
}

.cp__sidebar-main-layout {
  background-color: var(--ls-primary-background-color);
}

.cp__sidebar-main-content {
  width: 100%;
  max-width: var(--ls-main-content-max-width);
  flex: 1;

  h1.title {
    padding-right: 15px;
  }
}

.cp__sidebar-help {
  &-docs {
    @apply ml-2 mt-1;

    td {
      word-break: break-all;
    }

    th {
      width: 80%;
    }
  }

  &-btn {
    @apply fixed bottom-4 right-8;

    > .inner {
      @apply font-bold
      rounded-full h-8 w-8 flex items-center justify-center font-bold
      opacity-70 hover:opacity-100 select-none cursor-help;

      background-color: var(--ls-secondary-background-color);
    }
  }
}

.cp__right-sidebar {
  z-index: var(--ls-z-index-level-1);
  transition: width 0.3s;
  background-color: var(--ls-secondary-background-color, #d8e1e8);

  &.closed {
    width: 0 !important;
  }

  &.open {
    width: var(--ls-right-sidebar-width);
    max-width: 60vw;
  }

  &-scollable {
    min-height: 100%;
    overflow-y: scroll;
  }

  &-inner {
    padding-top: 0;
    position: relative;

    .resizer {
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      width: 4px;
      user-select: none;
      cursor: col-resize !important;
    }
  }

  &-settings {
    @apply flex flex-row;
    margin-bottom: 0;
    margin-top: 0;
    overflow: auto;

    &-btn {
      display: block;
      white-space: nowrap;
    }
  }

  &-topbar {
    position: sticky;
    position: -webkit-sticky;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--ls-secondary-background-color, #d8e1e8);
    z-index: 999;
    user-select: none;
    -webkit-app-region: drag;

    a, svg {
      -webkit-app-region: no-drag;
    }
  }

  .page {
    margin-top: 0;
  }

  .non-block-editor textarea,
  pre,
  pre.code {
    margin: 0;
    padding: 0;
    font-size: 90%;
    background: none;
  }

  .references {
    margin-left: 12px;
  }

  .sidebar-item {
    @apply p-4;

    .close {
      transform: scale(0.8);
      transition: transform 0.1s;

      &:hover {
        transform: scale(1);
      }
    }
  }
}

.cp__sidebar-main-content[data-is-full-width='true'] {
  max-width: 100vw;
}

.cp__sidebar-main-content[data-is-global-graph-pages='true'] {
  padding: 0;
}

@supports not (overflow-y: overlay) {
  .scrollbar-spacing {
    overflow-y: auto;
  }
}

@supports (overflow-y: overlay) {
  .scrollbar-spacing {
    overflow-y: overlay;
  }
}

.favorites li.dragging-target {
  border-left: 5px solid green;
}

.full-height-without-header {
  height: calc(100vh - var(--ls-headbar-height) - 4rem);
}

