[Question]
  [
# Task
Your task is to draw these beautiful oak trees:
```
1 ->
 @@@
@@@@@
@|.|@
_|_|_
2 ->
   @@
 @@@@@@
@@@@@@@@
@@| .|@@
  |  |
__|__|__
3 ->
   @@@@@
 @@@@@@@@@
@@@@@@@@@@@
@@@|   |@@@
  @|  .|@
   |   |
___|___|___
4 ->
      @@
   @@@@@@@@
 @@@@@@@@@@@@
@@@@@@@@@@@@@@
@@@@|    |@@@@
  @@|   .|@@
    |    |
    |    |
____|____|____
5 ->
      @@@@@
   @@@@@@@@@@@
 @@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@
@@@@@|     |@@@@@
  @@@|    .|@@@
     |     |
     |     |
     |     |
_____|_____|_____
6 ->
      @@@@@@@@
   @@@@@@@@@@@@@@
 @@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@
@@@@@@|      |@@@@@@
  @@@@|      |@@@@
     @|     .|@
      |      |
      |      |
      |      |
______|______|______
```
(that one sandbox commenter felt were similar to women with curly hair!)
The trees are allowed to be surrounded by any extra whitespace your solution creates *as long as that doesn't break the tree*, of course.
# Algorithm
As per the examples above, we take `n` to represent the width of the trunk and the specs of the tree will be given in terms of that.
Given `n`:
1. the height of the trunk is `n + 1`;
2. the width of the trunk in space characters is `n`;
3. the top row of the trunk is `n` times the character `@`, followed by `|`, `n` times the space character , another vertical pipe `|` and then `n` times `@`.
4. from the reference row up to the top of the crown, we only use `@` as follows:
	* there is one row with the same width as the reference row and each subsequent row above is shortened by one `@` than the previous shortening;
5. from the reference row downwards, we chop 2 `@` from each side and then each row we go down, we chop one more `@` than the previous row;
6. the last trunk row that is surrounded by a `@` has a `.` immediately to the left of the right vertical pipe `|`;
7. the bottom most row has the underscore `_` in all the tree width, except where the trunk vertical pipes `|` are.
  
[Answer]
# JavaScript (ES8), ~~215 ... 199~~ 197 bytes
```
f=(n,k=(W=3*n+2)**.5-.5|0,x=.5-k-(W-n)**.5,R=(n,k)=>S=''.padEnd(n,'.@_'[k]))=>k+n+2?(w=k*-~k/2,k<0?(x>0?s=R(n,k+n+3):R(w+=~k,s=R(n-1)+R(1,~~x))+R(n-w,1))+`|${s}|`+S:R(w)+R(W-w*2,1))+`
`+f(n,k-1):''
```
[Try it online!](https://tio.run/##XYzNboJQEIX3PsVdNLn/FDB2oY500xfABYumKUTE2GvmGmkKicir07l019V8Od@Z81X9VO3hdr5@W/T1cZoaEGgciAKWCnUqlYpWNloNsemByFlRWJxTk89VCbs9cB5dq/oNa0p49PrJ392HJOM0bWSiA6fs6J5T47ZxJvpdnLWQh2/yS7nORadhdGYObSJ1LhIzjr0MhLYzCVE5PN3bx1DqfegHU9hOpX9uUeom7NHzmvOp8TeBDFiyYci2dF8ItJbsvmDs4LH1l2N08SfBETjTDOXmn6A1SeFj@gU "JavaScript (Node.js) – Try It Online")
or [Test it online!](https://tio.run/##jVPBjtowEL3zFbOoku04TpPQvQCGvZRbL3Dg0FZLREI3NXWQk22QFvLrdCZZFqqiVU8ev/fmvZEz@Zn8Tsq1y3eVskWanbZZBTPQYEFP4KUHQEDug/GhrBwSjI0Q3RSOG7yFPuR0jMCABzGMYYCnBQkxQVKDlLlojeBsACxw2S5LKm4ECtnD2/2tF1Tn1/LfLMMDmyn4@G94REljsLcD5buJlpJa7EAhV0piImIwSmKOhIhCYEoiGKKQXfXdcsS5zxO/DsKv/W@nvoOin7ik0DwKcjG62LPHmz7/h75O67Lq2dnutY@njebWN5ov9cCzMhaeF9yr4P4Q@nuNlVF8qWyL@vNWKvRkoRkLdkn62aaIsODhkX013wUyRqLHlNfaeKoxH2PfjMMp30/Caann1I38QAznvJa6MX4LqkjIOY/8ptkLqqyq/Qir1eHDS3k8rOSC9MQsVe3FHddbyQ35YfOQsRPti@0WxcJYQxyGIZX4ZKrhX5LqKXCJTYtfXODSfRLd@uQbvqG3udMaZlicl2pd2LLYZsG2@MH7syTfZiltJP0x0MeXtO0n@VtHRjfg2QWunlxRQz9zrnD9bm2OvWstWzyv11lZ3jFx@gM) against an ungolfed, straightforward implementation
### How?
We define \$H\$ as the height of the upper part of the crown (where the width is increasing) and \$h\$ as the height of the lower part (where the width is decreasing).
*Example for \$n=6\$:*
[![heights](https://i.stack.imgur.com/qmYSy.png)](https://i.stack.imgur.com/qmYSy.png)
We have:
$$H\_n=\left\lfloor\sqrt{3n+2}+\frac{1}{2}\right\rfloor$$
and:
$$h\_n=\left\lfloor\sqrt{2n+2}-\frac{1}{2}\right\rfloor$$
By computing these values beforehand, we can draw the tree from top to bottom with a single loop, which is implemented here as a recursive function.
The total height of the tree is \$H\_n+n+1\$. We use a counter \$k\$ going from \$H\_n-1\$ to \$-n-1\$.
```
 3 | ......@@@@@@@@       | upper crown
 2 | ...@@@@@@@@@@@@@@    |
 1 | .@@@@@@@@@@@@@@@@@@  |
 0 | @@@@@@@@@@@@@@@@@@@@ |
---+----------------------+-------------
-1 | @@@@@@|      |@@@@@@ | lower crown
-2 | ..@@@@|      |@@@@   |
-3 | .....@|     .|@      |
---+----------------------+-------------
-4 |       |      |       | trunk only
-5 |       |      |       |
-6 |       |      |       |
---+----------------------+-------------
-7 | ______|______|______ | roots
```
The number of leading spaces for the upper part of the crown is the \$k\$-th triangular number:
$$T\_k=\frac{k\times(k+1)}{2}$$
The number of leading spaces for the lower part of the crown is given by:
$$\frac{(k+1)\times(k-2)}{2}=T\_k-k-1$$
### Commented
```
f = (                         // f is a recursive function taking:
  n,                          //   n = input
  k = (W = 3 * n + 2)         //   W = 3n + 2 = total width of the tree
      ** .5 - .5 | 0,         //   k = counter, initialized to floor(sqrt(W) - 1/2)
  x = .5 - k - (W - n) ** .5, //   x = 1/2 - k - sqrt(W - n)
  R = (n, k) =>               //   R is a helper function returning and saving in S:
    S =                       //     a character identified with k ('.', '@', '_' or
      ''.padEnd(n, '.@_'[k])  //     a space) repeated n times
) =>                          //
  k + n + 2 ?                 // if k is not equal to -n - 2:
    ( w = k * -~k / 2,        //   initialize w to the k-th triangular number
      k < 0 ?                 //   if k is negative:
        ( x > 0 ?             //     if x is positive (trunk only or roots):
            s =               //       set s to:
              R(n, k + n + 3) //         '_' * n if k = -n - 1, or space * n otherwise
          :                   //     else (lower crown):
            R(                //       append ...
              w += ~k,        //         ... w - k - 1 spaces
              s = R(n - 1) +  //         and set s to n - 1 spaces followed by
                  R(1, ~~x)   //         '.' if floor(x) = 0, or another space otherwise
            ) +               //
            R(n - w, 1)       //       append '@' * (n - w)
        ) +                   //
        `|${s}|` +            //     append s surrounded by '|' characters
        S                     //     append S
      :                       //   else (upper crown):
        R(w) +                //     append w spaces
        R(W - w * 2, 1)       //     append '@' * (W - 2w)
    ) +                       //
    `\n` +                    //   append a line-feed
    f(n, k - 1)               //   append the result of a recursive call with k - 1
  :                           // else:
    ''                        //   stop recursion
```
[Answer]
# [Python 3](https://docs.python.org/3/), ~~249~~ \$\cdots\$ ~~211~~ 210 bytes
Saved ~~6~~ \$\cdots\$ ~~17~~ 18 bytes thanks to [Kevin Cruijssen](https://codegolf.stackexchange.com/users/52210/kevin-cruijssen)!!! 
```
def f(n):
 i=j=1
 t,y,e,w,s,x,S=[],n*'_','|',0,3*n+2,n*' ',n
 while s>1:t=[w*' '+s*'@']+t;s-=2*i;w+=i;i+=1
 while S>0:j+=1;t+=[x[S:]+S*'@'+e+x[1:]+'. '[S>j]+e+S*'@'];S-=j
 return t+[(x+e)*2]*(n-j+1)+[(y+e)*2+y]
```
[Try it online!](https://tio.run/##jVTbjqIwGL7vU/xhLji0mkH3kEBq@gS7F1wSYjRTZsoaNNCNuss@u9sDWJhhdkcB@398/Q5GPF3ly7Fe325PvIQyqMMEgaAVjRFIciWcnElLLiSjeUHqyN/6xO988kjWUY1XGgGf1AjOL@LAod3EiaT5WaO4jXzmF1im7YKuIpGeMRWpwFrZsrPNY1KpOZWY5pc8Swqc6T2Y40seq8lfgp9nm6pQiLlTpNmCVggaLn82NUicBxfMw2hVREG9qHAcKuRqEHwtbpK3sgUKv1GcQI48YIx5BHmMDYtu2ZnFtlNvtSgIWlkqgKUAc2w2Xneg9loKdOowMkpFH1Zp7ZTYROyVnhuVDnQDF/TY5wPjMZhoC3Nan0@DjwsNMFYG9tZqBtEOxn7wN4hraTPYENNp2@exF5vq8yQVexNsLttsvDFoLG3Ge0gLLt33NkRzSf81b@@5@6uN/@V1/NkG75R4r8cEtxn6Mq7NBL8H7lH3c7iXGLX6D7IdlRw@bNk/6KE8NiBA1NDs6mcexOSr@id40HuleoLKQIR20ry95sn@tn6dGlHLYB@6DebRy0XxkU2ihN3hEJiT0r1h74jh/xKnQHuTQS8MZ4KGidXyvv/wQsQPLR@Ab0cJGrz9BQ "Python 3 – Try It Online")
**Before golfing**
```
def f(n):
    w=s=3*n+2
    t=[]
    i=1
    while s>1:
        t=[' '*((w-s)//2)+'@'*s]+t
        s-=2*i
        i+=1
    b=s=n
    i=2
    while s>0:
        t+=[(n-s)*' '+s*'@'+'|'+~-n*' '+'. '[s-i>0]+'|'+s*'@']
        s-=i
        b-=1
        i+=1
    while b:
        t+=[n*' '+'|'+n*' '+'|']
        b-=1
    t+=[n*'_'+'|'+n*'_'+'|'+n*'_']
    return t
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), ~~78~~ 71 bytes
```
Ｎθ≔×¹·⁵⊕θηＷ›ηⅈ«↑Ｐ×⁻ηⅈ@Ｍⅉ←»Ｊ⁰θ×θ_Ｐ×⊘⁺³θ_↑⊕θ⸿Ｗ›θⅈ«Ｐ×⁻θⅈ@Ｍ⁺²ⅉ¹»Ｊθⅉ↗‖ＯＯ﹪θ².
```
[Try it online!](https://tio.run/##bZBRS8MwFIWf118R@pRAHG6iD/NFn3RidYwJDgSp3d0aSNMkTeqD@NvjbdZJoXsK3HvOyfluUea2qHMZwlJp71589QWWGnab3DeNOCi6ERU0dDa95mSpCgsVKAc7VDBOSpR9l0ICoQ8WcofOkpN3yhgjP8kkq1ugizeNqknmpRPaCuX6xEwo35zknKR3KYu6zrOlOFk8w97h6Dd58pXe1PSSk67XahBi0PgZjaP8x1y22HMl8Zerzsn@tccELDZCOu3SD5uO2cyQ7TyPOcsTS8w52cbVbAhljlME6I@1Foeyw17DXkLhXluwMtf9Q7N652V0zQdtp1g2hJtw0co/ "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
Ｎθ
```
Input `n`.
```
≔×¹·⁵⊕θη
```
Calculate the half width of the reference row.
```
Ｗ›ηⅈ«
```
While there is still canopy left to print, ...
```
↑
```
... move up a line, ...
```
Ｐ×⁻ηⅈ@
```
... print some canopy, ...
```
Ｍⅉ←»
```
... and move to the start of the next row of canopy.
```
Ｊ⁰θ
```
Jump to the left side of the base.
```
×θ_
```
Print the left side of the base.
```
Ｐ×⊘⁺³θ_
```
Print half of the middle of the base, allowing space for the trunk.
```
↑⊕θ
```
Print the trunk.
```
⸿
```
Move to the beginning of the reference row.
```
Ｗ›θⅈ«
```
While there is still foliage to print, ...
```
Ｐ×⁻θⅈ@
```
... print some foliage, ...
```
Ｍ⁺²ⅉ¹»
```
... and adjust the width of the foliage according to the number of lines of foliage already printed.
```
Ｊθⅉ↗
```
Move to the mirror location of the `.`.
```
‖ＯＯ﹪θ²
```
Reflect the half tree drawn so far to almost complete the tree and also move the cursor to the location of the `.`.
```
.
```
Complete the tree.
[Answer]
# Java 11, ~~282~~ 273 bytes
```
n->{String r="",y="_".repeat(n),e="|",N="\n",S=" ",q=S.repeat(n-1),z;int i=1,w=0,s=3*n+2;for(;s>1;s-=2*i,w+=i++)r=S.repeat(w)+"@".repeat(s)+N+r;for(i=1,s=n;s>0;s-=i)r+=S.repeat(n-s)+(z="@".repeat(s))+e+q+(s>++i?S:".")+e+z+N;return r+((q+=S+e)+q+N).repeat(n-i+1)+y+e+y+e+y;}
```
Port of [*@Noodle9*'s Python answer](https://codegolf.stackexchange.com/a/201746/52210), after I helped him golf it a bit.  
-9 bytes thanks to *@Arnauld*.
[Try it online.](https://tio.run/##vVffb9owEH7vX3HzU1KHqHRvZG4zaZ1UaeOFx7aKsuBO7qgL@VHWAn87u/xw7JAQBJpKSWzfne@@77tAzVP4Gg6epn@20SxMEvgZCrk6AxAy5fFjGHEY50uASRoL@RsiCz0gbQ@NmzO8JWmYigjGIIHBVg6uVlVkzAhx3hgJiBvzOQ9TS9oOZ2RNnDEj95I4E0aAOAs2qQMGQ9t59/IKgg2dJbtwEvb5XNJL7/EltrzkauglA3Z5LpwlZYJSO9ablzYlfl0rsemYxsW2PFXCJO6@yHcLO6ZmSYy03lljq005XVAruaJUXE9GxCW55Z2OvZinWSwhppa1wCyU2xg4tnU2QYc2fcPo4vI2Wy8XaZ79mqFIlVavL2IKzyi0VUp19wChbaqMBv53zqOUT1FUyZe1fUXA9/176fvlsHbXOARr/CNOkeHgi@CV7wVfJfH1bA2YMHfCGt@YGRPn7@OS@0b@Rgm1wOSwLqMgXxQsoChaVs1rFtcxhRUxAF0M/N3arXVetEBTwinWSoUSUo7JnAcVuPJ2NER/B2UbaAdWbSpQlIArxKXJVYoqpAr2vlVQU6jupzDpINPJp5uSYS1hVbwUsYa1wl/Z1DNTM6oJ9qwDg60ajmRdMVe5m6QBOviB38d7v6OCrSSpNdlxKFmUWT@7mrrW4lhL0NCqHk8TrVu3vdL1qNcnYMOnqNQqahlbvlrJ2mN@pgxdDKn@my3YUVhPTtZ6r9x9iveLfkD3prump8U31O9w6wZop2t@9huimUp@jDVo9caYndAm838WtBu1t3kH@newhYe7uBOhVTBaafayM8JoZ9tvkDacxrd6U/1GUz7YHnR025ySjVe0vjhtlodXD8QXNrzAAU@pq@rBmLwlKX92X7LUneN5Lp1Ji9zKeZaOgFBheyqsOkDzJJul@QHQxVO39raTlJF9Eeo4eScGwweXL7Jwlqht10AmWRRxPuVTAgjl@9fbHzffPsGNOoNiJgQJIhkBnttpI1lf1cq3KX4rbLb/AA)
**Explanation:**
```
n->{                     // Method with integer parameter and String return-type
  String r="",           //  Result-String, starting empty
    y="_".repeat(n),     //  Temp-String `y`, consisting of the input amount of "_"
    e="|",               //  Temp-String `e`, containing "|"
    N="\n",              //  Temp-String `N`, containing a newline
    S=" ",               //  Temp-String `S`, contain a space
    q=S.repeat(n-1),     //  Temp-String `q`, consisting of the input-1 amount of spaces
    z;                   //  Temp-String `z`, uninitialized
  int i=1,               //  Integer `i`, starting at 1
    w=0,                 //  Integer `w`, starting at 0
    s=3*n+2;             //  Integer `s`, starting at 3 times the input + 2
  for(;s>1               //  Continue looping as long as `s` is larger than 1:
      ;                  //    After every iteration:
       s-=2*i,           //     Decrease `s` by `i` twice
       w+=i              //     Increase `w` by `i`
           ++)           //     And increase `i` by 1
     r=S.repeat(w)       //   Prepend `w` amount of spaces;
       +"@".repeat(s)    //   `s` amount of "@";
       +N                //   and a newline
         +r;             //   to the result-String
  for(i=1,               //  Reset `i` to 1
      s=n;               //  Reset `s` to the input
      s>0;               //  Continue looping as long as `s` is larger than 0:
      s-=i)              //    After every iteration: decrease `s` by `i`
    r+=                  //   Append the result-String with:
       S.repeat(n-s)     //    The input minus `s` amount of spaces;
       +(z="@".repeat(s))//    `s` amount of "@";
       +e                //    a "|";
       +q                //    the input-1 amount of spaces;
       +(s>++i?          //    If `s` is larger than `i+1`
                         //    (by first increasing `i` by 1 with `++i`)
          S              //     a space;
         :               //    Else:
          ".")           //     a ".";
       +e                //    a "|";
       +z                //    the input minus `s` amount of spaces again;
       +N;               //    and a newline character
  return r               //  After both loops: return the result-String,
          +              //  appended with:
           ((q+=S+e)     //   `q` with an additional space and "|" appended
                    +q   //   twice
                      +N)//   and a newline
           .repeat(n-i+1)//   Repeated `n-i+1` amount of times
          +y+e+y+e       //   As well as two times `y` and "|"
                  +y;}   //   And an additional third `y`
```
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), ~~106~~ ~~105~~ ~~103~~ ~~99~~ ~~97~~ ~~95~~ ~~93~~ 92 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
$×0I>;úR©«D1s∍ILηOD¦<‚vyvDðyL<ǝ}r}r)ʒ1å}`'.I>ǝ)DJ0¢Iα®иIú0'_I×ì¬®¦∍«)˜IÉi.ºëº}»T„@|‡I≠i'.ð.;
```
[Try it online](https://tio.run/##AZAAb/9vc2FiaWX//yTDlzBJPjvDulLCqcKrRDFz4oiNSUzOt09EwqY84oCadnl2RMOweUw8x519cn1yKcqSMcOlfWAnLkk@x50pREowwqJJzrHCrtC4ScO6MCdfScOXw6zCrMKuwqbiiI3CqynLnEnDiWkuwrrDq8K6fcK7VOKAnkB84oChSeKJoGknLsOwLjv//zY) or [verify the first 10 test cases](https://tio.run/##AaMAXP9vc2FiaWX/VEUiSW5wdXQ6ICI/Tiwx/07DlzBOPjvDulLCqcKrRDFz4oiNTkzOt09EwqY84oCadnl2RMOweUw8x519cn1yKcqSMcOlfWAnLk4@x50pREowwqJOzrHCrtC4TsO6MCdfTsOXw6zCrMKuwqbiiI3CqynLnE7DiWkuwrrDq8K6fcK7VOKAnkB84oChTuKJoGknLsOwLjv/fSzCtj//).
**Explanation:**
```
$                # Push 1 and the input-integer
 ×               # Pop both, and push a string consisting of the input amount of "1"s
  0              # Push a 0
   I>;           # Push the (input+1)/2
      ú          # Prepend that many spaces to the "0" (truncates decimals)
       R         # Reverse it so the spaces are trailing
        ©        # Store it in variable `®` (without popping)
         «       # Append it to the string of 1s
D                # Duplicate it
 1               # Push a 1
  s              # Swap the two values on the stack
   ∍             # Extend the "1" to a size equal to the string-length
    IL           # Push a list in the range [1, input]
      η          # Get the prefixes of this list
       O         # And sum each inner prefix
        D        # Duplicate this list of integer
         |       # Remove the leading 1
          <      # Decrease each value by 1
           ‚     # And pair the two lists together
v                # Loop over this pair of list of integers:
 yv              #  Inner loop `y` over each of those lists of integers:
   D             #   Duplicate the string at the top of the stack
     yL          #   Push a list in the range [1, `y`]
       <         #   Decrease it by 1 to make it [0, `y`)
    ð   ǝ        #   And replace the characters at those indices with a space
  }r             #  After the inner loop: reverse all values on the stack
}r               # After the outer loop: reverse all values on the stack
  )              # And wrap all values on the stack into a list
   ʒ             # Filter this list by:
    1å           #  Only keep lines which contain a "1"
   }`            # After the filter: Push all values separated to the stack again
     '.I>ǝ      '# Replace the space at index input+1 with a "."
          )      # And re-wrap all values on the stack into a list again
D                # Duplicate this list of lines
 J               # Join them all together
  0¢             # Count the amount of "0"s in this string
    Iα           # Get the absolute difference with the input
      ®и         # Repeat `®` (the "|" with trailing spaces) that many times as list
        Iú       # Prepend the input amount of spaces to each string
0                # Push a 0
 '_I×ì          '# Prepend the input amount of "_"
      ¬          # Push its first character (without popping), which is a "_"
       ®¦∍       # Repeat it the length of `®` - 1 amount of times
          «      # Append it to the "0" with leading "_"
)                # Wrap all values on the stack into a list again
 ˜               # Flatten it
  IÉi            # If the input is odd:
     .º          #  Mirror each line with the last character overlapping
    ë            # Else:
     º           #  Mirror each line without overlap
}»               # After the if-else: join all lines by newlines
  T              # Push 10
   „@|           # Push string "@|"
      ‡          # Transliterate all "1" to "@" and all "0" to "|"
  I≠i            # If the input is NOT 1:
     '.ð.;      '#  Replace the first "." with a space
                 # (after which the result is output implicitly)
```
`r)ʒ1å}`'.I>ǝ)D` could alternatively be `)ʒþà}ć'.N>ǝšÂs` for the same byte-count.
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), ~~86~~ ~~81~~ ~~77~~ 67 bytes
```
Î×2.ø$×.ø©DSdJD.ΓN>·.$}`r[D¬≠#NÌF¦¨]\\0'..;R®1K¹;.D®TS'_:).c2Ý… @|‡
```
[Try it online!](https://tio.run/##AWQAm/9vc2FiaWX//8OOw5cyLsO4JMOXLsO4wqlEU2RKRC7Ok04@wrcuJH1gcltEwqziiaAjTsOMRsKmwqhdXFwwJy4uO1LCrjFLwrk7LkTCrlRTJ186KS5jMsOd4oCmIEB84oCh//82 "05AB1E – Try It Online")
~~-5~~ ~~-9~~ -19 @ Kevin Cruijssen, thanks!
---
This is some unorthodox stuff, definitely not my best answer... It's been awhile, I'm rusty.
Also tried to use some of the new commands like `Δ` which did not go as planned, and I had to use a global register. Still trying to golf that whole part out.
---
For the purpose of the explanation `I` will mean input for the duration.
```
[       Code      ] #     [        Explanation        ]
====================#========================================
$                   # Push 1 and I.
 3*Ì                # (3 * I) + 2
    ×               # "1" repeat (3 * I) + 2 times.
     Ð              # Triplicate.
====================# Setting up the first line of the bottom crown.
¹x                  # Push I and 2I.
  ‚                 # [I, 2I]
   >                # [I + 1, 2I + 1]
    o               # [2 ^ (I + 1), 2 ^ (2I + 1)]
     ¥              # 2 ^ (I + 1) - 2 ^ (2I + 1)
      b             # Convert to binary (I=2: 11000)
       -            # Subtract from previous value (I=2: 11111111-11000=11100111)
        н           # Remove from array (get first element)
====================# Setting up the first line of the bottom crown.
¹                   # Push I.
 x>‚                # [I, 2I + 1)
    o               # [2 ^ I, 2 ^ (2I + 1)]
     b              # Convert to binary (I=2: [100,100000])
      O             # Sum (I=2: 100100)
       +            # Add to previous (I=2: 11200211)
        ©ˆ          # Store in register, push to global array.
====================# Setting up the first line of the top crown.
ˆ                   # Push the line of 1's that starts the top crown.
====================# Creating the top crown.
Δ                   # Until this code stops changing the value...
 N>·                # (Iteration + 1) * 2
    .$              # Remove (Iteration + 1) * 2 characters
      Dˆ            # Dupe and push to global array.
        }¯R`        # Push global array reversed, flatten.
====================# Creating the bottom crown.
[                   # Infinite loop...
 D¬≠#               # Duplicate last value, break if it doesn't start with 1.
     NÌ             # (2 * Iteration) + 1
       F¦¨          # Loop (2 * Iteration) + 1 time and remove head/tail.
          ]\\       # End loop, remove 2 values. 
====================# Adding the knot of the tree.
0'..;               # Find and replace first 0 with a period.
     R              # Reverse it from the left side to the right.       
====================# Creating the trunk.
®                   # Push the register.
 1K                 # Remove the extra leaves (1's).
   ¹;.D             # Push I/2 copies of this. 
====================# Creating the ground.
®                   # Push register for bottom
 TS'_:              # Replace all leaves (1's) and spaces (0's) with '_' (3's)
====================# Pulling it all together.
)                   # Wrap stack to array.
 .c                 # Center.
   2Ý               # Push [0,1,2].
     … @|           # Push " @|".
         ‡          # Replace 0 with ' ', 1 with '@' and 2 with '|'.
====================# Done!
```
*working on updating the explanation, I am on my cell phone at the moment.*
[Answer]
# [Perl 5](https://www.perl.org/), 215 bytes
```
$n=pop;$y=$n*3+2;while($y>0){$_=$"x$x.'@'x$y.$/.$_;$x+=++$z;$y-=2*$z}print;$i=$x=$n++;$k=2;while($n--){$_=$"x$j.'@'x$i.'|'.$"x$x.'|'.'@'x$i.$"x$j;$k>=$i?($i&&s/ \|@/.|@/,$i=0,$j=$x):($i-=$k,$j+=$k++);$n||y/ /_/;say}
```
[Try it online!](https://tio.run/##PY1hqgIxDISvIjK4rrHtqghiiXqBdwNh8YdgVbrFFWx1vbo1@MQfYZJM5kvYX87znOE5NMEiMfxoRlN7O7jzfoi0qsoHakY/IupiU0QkDaNRW0RiItwlpHg6wv0ZLs5fLRwjCobI4sQ/klfqRzr@k5wuukJ/0dJ9l58Lya4Ybj2EGwxa09t2G6OlxoKvxjjKj3IppmKcZCQRotLCd10yPVMb2@7SM@e8eDXh6hrfZvU319WkegM "Perl 5 – Try It Online")
Takes size of tree as single command-line argument. 
I'm sure it can probably be improved.
Ungolfed:
```
$n = pop;                                   # get tree size from command line
## Crown section ##
$x = 0;                                     # initial number of leading spaces to print
$y = $n * 3 + 2;                            # initial number of @s to print
$z = 0;                                     # used for increment/decrement value
while($y > 0)                               # build from bottom up as long as we have @s to add
{       
        $_ = ' 'x$x . '@'x$y . "\n" . $_;   # new row of crown, prepended to existing crown
        $z++;                               # increase increment/decrement counter
        $x += $z;                           # increase leading spaces for next row
        $y -= 2*$z;                         # decrease number of @s for next row
}
print;                                      # print the crown (don't use say to avoid extra LF)
## Trunk section ##
$x = $n++;                                  # width of trunk
$i = $x;                                    # number of @s before/after trunk
$j = 0;                                     # number of leading/trailing spaces
$k = 2;                                     # number of leading/trailing @s to remove in next row
while($n--)                                 # build each row of the trunk
{
        $_ = ' 'x$j . '@'x$i . '|' . ' 'x$x 
           . '|' . '@'x$i . ' 'x$j;         # new row of trunk
        if($k >= $i) {                      # if next row won't have any @s
                s/ \|@/.|@/ if($i);         # set dot in trunk for last row with any @s
                $i=0;                       # no @s in next row
                $j=$x;                      # spaces in next row equal to trunk width
        }
        else {                              
                $i -= $k;                   # reduce @s for next row
                $j += $k;                   # increase spaces for next row
                $k++;                       # increase increment/decrement counter
        }
        if($n == 0) {                       # if this is the last row
                y/ /_/;                     # replace spaces with underscores
        }
        say;                                # print the row
}
```
]