
  :root {
    --selected-layer: air;
  }

  body {
    margin: 0;
  }

  main {
    position: relative;
    place-content: end center;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    height: 100dvh;
  }

  h1 {
    margin: 0;
    font-size: 30px;
  }

  h2 {
    margin: 0;
    font-size: 18px;
  }

  p { 
    max-width: 72ch; 
  }

  .supports-if {
    margin-top: 18px;
    border: 1px solid rgb(255, 73, 73);
    border-radius: 8px;
    background-color: rgb(245 73 73 / 54%);
    padding: 8px;
    color: #fff;
    @supports (z-index: if(style(--selected-layer: air) : 1; else: 0)) {
      display: none;
    }
  }

  .supports-if > p {
    margin: 0px;
    margin-top: 6px;
  }

  dialog {
    font-family: monospace;
    position: fixed;
    top: 12px;
    display: block; 
    z-index: 2;
    text-align: center;
    border-radius: 12px;
    background-color: #434343;
    padding: 32px;
    color: #FFD493;
    font-size: 16px;
    border: none;
    max-width: 90vw;

    @media (width <= 800px) {
      padding: 22px;
    }
  }

  dialog > p {
    margin: 0px;
    margin-top: 12px;
  }

  dialog > p > strong {
    color: #4BF3C8;
  }

  dialog > label {
    cursor: pointer;
    position: absolute;
    right: 16px;
    top: 16px;
    font-weight: bolder;
    font-size: 18px;
  }

  dialog:has(input:checked) {
    display: none;
  }

  input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
  }

  .grid {
    display: flex;
    flex-direction: column;
  }

  .row {
    display: flex;
  }

  .field {
    width: 40px;
    height: 40px;
    position: relative;
  }

  .field>label {
    position: absolute;
    display: block;
    width: -webkit-fill-available;
    height: -webkit-fill-available;
    opacity: 0;
    background-repeat: no-repeat;
    background-size: cover;
    outline: solid 0.5px #777;
  }

  /* This makes the inital checked element visible*/
  .field>input:checked+label {
    opacity: 1;
  }

  .field>label.air {
    z-index: if(
      style(--selected-layer: air) : 1;
      else: 0
    );
  }

  .field>label.stone {
    z-index: if(
      style(--selected-layer: stone) : 1;
      else : 0
    );
  }

  .field>label.grass {
    z-index: if(
      style(--selected-layer: grass) : 1;
      else : 0
    );
  }

  .field>label.wood {
    z-index: if(
      style(--selected-layer: wood) : 1;
      else : 0
    );
  }

  .field>label.earth {
    z-index: if(
      style(--selected-layer: earth) : 1;
      else : 0
    );
  }

  .field>label.leaves {
    z-index: if(
      style(--selected-layer: leaves) : 1;
      else : 0
    );
  }

  .layers {
    display: flex;
    position: fixed;
    right: 50%;
    transform: translateX(50%);
    bottom: 10px;
    padding: 12px;
    background-color: #434343;
    border-radius: 16px;
    z-index: 1;
  }

  .air {
    background-color: rgb(135, 206, 250);
  }

  .stone {
    background-image: url("assets/stone.png");
  }

  .grass {
    background-image: url("assets/grass.png");
  }

  .earth {
    background-image: url("assets/earth.png");
  }

  .wood {
    background-image: url("assets/wood.png");
  }

  .leaves {
    background-image: url("assets/leaves.png");
  }

  .layers>label {
    width: 50px;
    height: 50px;
    margin-right: 12px;
    border-radius: 4px;
    cursor: pointer;
    background-repeat: no-repeat;
    background-size: cover;
  }

  .layers>label:last-of-type {
    margin-right: 0px;
  }

  .layers>input:checked+label {
    outline: 2px solid #fff;
  }

  :root:has(.layers>#air-layer:checked) {
    --selected-layer: air;
  }

  :root:has(.layers>#stone-layer:checked) {
    --selected-layer: stone;
  }

  :root:has(.layers>#grass-layer:checked) {
    --selected-layer: grass;
  }

  :root:has(.layers>#earth-layer:checked) {
    --selected-layer: earth;
  }

  :root:has(.layers>#wood-layer:checked) {
    --selected-layer: wood;
  }

  :root:has(.layers>#leaves-layer:checked) {
    --selected-layer: leaves;
  }

  *,
  *::after,
  *::before {
    box-sizing: border-box;
  }
