/* BASE STYLES ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ */

  :root {
    --color-black: hsl(0 0% 13%);
    --color-light-gray: hsl(0 0% 84%);
    --color-verdigris: hsl(175, 34%, 55%);
    --color-gunmetal: hsl(196, 53%, 17%);
  }

  body {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
      'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
      sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: #fff;
    color: var(--color-black);
  } 

  main {
    /* border: 1px dashed lightblue; */
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: 100dvh;
    max-height: 100dvh;
    width: 100dvw;
    margin: auto;
    position: relative;
    text-align: center;
  }

  main > div {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
  }

  * {
    box-sizing: border-box;
  }

  h1, h2, h3, h4, h5, h6 {
    margin: 0;
    padding: 0;
  }

  input, select, textarea {
    border: 1px solid var(--color-gunmetal);
    border-radius: 5px;
    padding: 0.5rem 1rem;
  }

  button {
    border: none;
    border-radius: 5px;
    cursor: pointer;
    padding: 0.5rem 1rem;
  }

  @media screen and ( min-width: 768px ) {
    
    main {
      max-height: 600px;
      max-width: 300px;

    }
  }

/* UTILITY STYLES --------------------------------------------------------------------------------------------------------------------------------------------------------------------- */

  .hidden { display: none; }
  .text-center { text-align: center; }

/* DICE ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */

  #dice {
    background-color: #ddd;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    width: 100%;
    padding: 1rem;
  }

  .die {
    border-radius: 5px;
    box-sizing: border-box;
    cursor: pointer;
    padding: .5rem;
    position: relative;    
  }

  .die:not([data-die="100"]) {
    width: 20%;
  }

  .die[data-die="100"] {
    width: 34%;
  }

  .die:not([data-count="0"])::before {
    content: attr(data-count);
    position: absolute;
    top: 0;
    left: 0;
    border-radius: 50%;
    font-size: .5rem;
    width: 1rem;
    height: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background-color: seagreen;
    color: #fff;
  }


/* RESULTS ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */

  #roll-log-container {
    /* height: 50%;
    max-height: 50%; */
    display: flex;
    flex-grow: 1;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  #roll-log-container[data-roll-name]:not([data-roll-name='']):not([data-roll-name=' '])::before {
    background-color: palegoldenrod;
    box-sizing: border-box;
    content: attr(data-roll-name);
    font-size: .85rem;
    font-weight: 500;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    padding: .5rem 1rem;
    width: calc(100% - 2rem);
  }

  #roll-log {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: end;
    gap: .5rem;
    height: 100%;
    width: 100%;
    max-height: 100%;
    padding: .5rem 1rem;
  }

  #roll-log > div:empty:not(#roll-modifier-log) {
    display: none;
  }

  #roll-log > div {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    position: relative;
  }

  #roll-log > div[data-die-log]::before {
    aspect-ratio: 1 / 1;
    background-color: var(--color-black);
    content: '';
    display: block;
    opacity: .5;
    width: 1rem;
    height: 1rem;
  }

  #roll-log > div[data-die-log="4"]::before {
    width: .8rem;
    height: .8rem;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  }

  #roll-log > div[data-die-log="6"]::before {
    width: .8rem;
    height: .8rem;
    clip-path: polygon(5% 5%, 5% 95%, 95% 95%, 95% 5%);
  }

  #roll-log > div[data-die-log="8"]::before {
    clip-path: polygon(
      50% 5%,   /* Top point */
      100% 50%, /* Right point */
      50% 95%, /* Bottom point */
      0% 50%    /* Left point */
    );
  }
  
  #roll-log > div[data-die-log="10"]::before {
    clip-path: polygon(
      50% 0%,   /* Top point */
      95% 50%, /* Right point */
      50% 100%, /* Bottom point */
      5% 50%    /* Left point */
    );
  }

  #roll-log > div[data-die-log="12"]::before {
    clip-path: polygon(
      50% 0%,        /* Top point */
      100% 38.2%,    /* Top-right */
      81% 100%,      /* Bottom-right */
      19% 100%,      /* Bottom-left */
      0% 38.2%       /* Top-left */
    );
  }

  #roll-log > div[data-die-log="20"]::before {
    clip-path: polygon(
      50% 0%,     /* Top center */
      100% 25%,   /* Top-right */
      100% 75%,   /* Bottom-right */
      50% 100%,   /* Bottom center */
      0% 75%,     /* Bottom-left */
      0% 25%      /* Top-left */
    );
  }

  #roll-log > div[data-die-log="100"]::before {
    aspect-ratio: 1 / 2;
    height: 1.25;
    width: 2.5rem;
    clip-path: polygon(
      10% 50%,    /* Left point */
      30% 0%,   /* Top point */
      50% 50%, /* Middle point */
      70% 0%, /* Top point */
      90% 50%, /* Right point */
      70% 100%, /* Bottom point */
      50% 50%, /* Middle point */
      30% 100% /* Bottom point */
    );
  }

  #roll-sum-container {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #roll-sum-container > #modify-up,
  #roll-sum-container > #modify-down {
    cursor: pointer;
    flex-grow: 1;
  }

  #roll-sum {
    box-sizing: border-box;
    font-size: 3rem;
    font-weight: bold;
    padding: 1.5rem 1rem;
    min-height: 6.5rem;
    min-width: 50%;
  }


/* MENU ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */

  #menu {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: .5rem 1rem;
  }

  #menu > span {
    background-color: var(--color-black);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    font-size: 1.5rem;
    padding: .5rem;
  }

/* MODALS ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- */

  dialog {
    border: none;
    border-radius: 3px;
    padding: 1rem;
  }

  dialog::backdrop {
    background: hsl(0 0 0 / .7);
  }

  dialog > form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  dialog.saved-rolls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  dialog.saved-rolls > .saved-roll {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    font-weight: 500;
  }

  dialog.saved-rolls > .saved-roll > .actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
  }

  dialog.saved-rolls > .saved-roll > .actions > .action {
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    padding: .25rem;
  }

  dialog.saved-rolls > .saved-roll > .actions > .action.delete {
    background-color: darkred;
    color: #fff;
  }

  dialog.saved-rolls > .saved-roll > .actions > .action.reroll {
    background-color: green;
    color: #fff;
  }