#sort-root {
  #sort-container {
    display: flex;
    flex-direction: row;
    justify-content: space-evenly;
    align-items: stretch;
    width: 90vw;
    height: 90vh;
    margin-left: auto;
    margin-right: auto;
    margin-top: 1em;
  }

  button.sort-option {
    flex: 1 1;
    position: relative;
  }

  .show {
    height: 100%;
  }

  img.poster {
    object-fit: contain;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: 100%;
  }

  .title {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    position: absolute;
    bottom: 0;
    width: 100%;
    font-size: large;
  }

  @media (orientation: portrait) {
    #sort-container {
      flex-direction: column;
    }

    button.sort-option {
      height: 40vh;
    }
  }
}

#sorted-root {
  margin: 0.5em;
  ol {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16em, 1fr));
    /* need to re-add counters for grid li */
    counter-reset: ranking;
    /* avoid doubled borders by only drawing top-left border around whole grid */
    --border-style: solid 1px grey;
    border-top: var(--border-style);
    border-left: var(--border-style);
    padding: 0;
  }

  li {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    padding-left: 0.5em;
    /* avoid doubled borders by only drawing top-left border around whole grid */
    border: var(--border-style);
    border-top: 0;
    border-left: 0;
  }

  div.show {
    display: contents;
  }

  /* need to re-add counters for grid li */
  .title::before {
    counter-increment: ranking;
    content: counter(ranking) ".";
    margin-right: 0.5em;
  }

  img.poster {
    height: 6em;
  }
}

svg {
  background: #c7c7c7;
}

#setup-root {
  --pill-width: 20em;
  column-width: var(--pill-width);
  column-fill: balance;

  label {
    display: inline-flex;
    align-items: center;
    border: 1px dashed grey;
    border-radius: 10px;
    width: var(--pill-width);
    padding: 0.25em;
  }

  fieldset {
    display: inline-flex;
    flex-direction: column;
    margin-left: 0;
    padding: 0;
    border: 0;

    legend {
      margin-left: -0.125em;
    }


    & > label {
      /* inset labels under a group and draw tree lines (thanks to https://entropicthoughts.com/draw-a-tree-structure-with-only-css#rf2 ) */
      --nested-margin: 1em;
      --nested-guide-width: 1px;
      --nested-guide-style: var(--nested-guide-width) dashed grey;
      --nested-guide-lift: 0.3lh;
      --nested-guide-vert-pos: 50%;

      margin-left: var(--nested-margin);
      width: calc(var(--pill-width) - var(--nested-margin));
      position: relative;

      &::before,&::after {
        content: "";
        position: absolute;
        left: calc(-1 * var(--nested-margin) - var(--nested-guide-width));
      }
      &::before {
        border-top: var(--nested-guide-style);
        top: var(--nested-guide-vert-pos);
        width: var(--nested-margin);
        height: 0;
      }
      &::after {
        border-left: var(--nested-guide-style);
        height: 100%;
        width: 0;
        top: calc(-1 * var(--nested-guide-lift));
      }
      &:last-child::after {
        height: calc(var(--nested-guide-lift) + var(--nested-guide-vert-pos));
      }
    }
  }
}
