body {
  background-color: #bbb;
  font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
  font-size: 10pt;
  color: #888;
}

h1 {
  text-align:center;
  font-size: 20pt;
}

.whole-width {
  width: 317px; /* 7 * left element margin + 6 * element width + 12 * element border */
  margin-left: auto;
  margin-right: auto;
}

.element, .surge-element { /* basic element dimensions */
  width: 45px;
  height: 45px;
  border-radius: 8px;
  float: left;
  text-align: center;
  line-height: 45px; /* == height to center line vertically */
}

#dice-source .element, #attack-modifiers .element, #defense-modifiers .element,
    .surge-element { /* element styling outside target */
  border: 1px solid #555;
  cursor: alias;
}

#dice-source {
  height: 52px; /* 1 * top element margin + element height + 2 * element border */
}

#dice-source .element {
  margin: 5px 0 0 5px;
}

/* Element margins are 5px everywhere else but only 3px inside the target area */
#target {
  height: 203px; /* 5 * top element margin + 4 * element height + 8 * element border */
  text-align: center;
  line-height: 203px; /* == height to vertically center text */
  float: left;
  width: 203px; /* 5 * element left margin + 4 * element-width + 8 * element border */
  border-radius: 5px;
  background-color: #eee;
  margin: 5px;
}

#target .element {
  margin: 3px 0 0 3px;
  border: 1px solid #ddd;
  cursor: default;
}

#attack-modifiers, #defense-modifiers {
  float: left;
  width: 52px; /* == 1 * horizontal element margin + element width + 2 * element border */
}

#attack-modifiers {
  height: 213px; /* 5 * top element margin + 4 * element height + 8 * element border */
}

#attack-modifiers .element {
  margin: 5px 0 0 5px;
}

#defense-modifiers {
  height: 109px; /* == 3 * top element margin + 2 * element height + 4 * element border */
}

#defense-modifiers .element {
  margin: 5px 5px 0 0;
  border: 1px solid #555;
}

.modifier {
  background-color: #fff;
}

.element-icon {
  width: 25px;
  height: 25px;
  margin: 10px;
}

/* Surge */
.surge-source {
  height: 49px; /* 2 * vertical surge element margin + surge element height + 2 * surge element border */
  width: 254px; /* 4 * horizontal surge element margin + 3 * surge element width + 6 * surge element border + 3 * surge count width + surge label width */
  border: 1px solid #555;
  border-radius: 8px;
  background-color: #fff;
  margin: 0 0 5px 5px;
}

.surge-source .surge-element {
  margin: 1px 0 0 1px;
}

#surge-label, .surge-count, .surge-source {
  float:left;
  text-align: right;
}

#surge-label, .surge-count {
  height: 49px; /* 2 * surge element top margin + 1 * surge element height + 2 * surge element border */
  line-height: 49px; /* == height to center line vertically */
  font-weight: bold;
  /*cursor: alias;*/
}

#surge-label {
  width: 52px;
  background-color: #ccc;
  border-bottom-left-radius: 8px;
  border-top-left-radius: 8px;
}

.single-surge #surge-label-icon1 {
  width: 27px;
  height: 27px;
  margin: 11px 12px 10px 0;
  float: right;
}

.double-surge #surge-label-icon1 {
  width: 27px;
  height: 13px;
  margin: 12px 12px 0 0;
  float: right;
}

.double-surge #surge-label-icon2 {
  width: 27px;
  height: 13px;
  margin: 0 12px 10px 0;
  float: right;
}

.surge-count {
  width: 18px;
  text-align: right;
  margin: 0 1px 0 0;
}

.surge-element {
  background-color: white;
}

#compiled-surge-template {
  display: none;
}

.compiled-surge-item, .compiled-surge-label {
  width: 22px;
  height: 22px;
  float: left;
  line-height: 22px;
}

.compiled-surge {
  background-color: white;
}

.compiled-surge-item *, .compiled-surge-label * {
  float: left;
}

.compiled-surge-item img {
  width: 10px;
  height: 10px;
  margin: 6px 1px 6px 1px;
}

.single-surge .compiled-surge-cost1 {
  width: 17px;
  height: 17px;
  margin: 2px 0 1px 2px;
}

.double-surge .compiled-surge-cost1 {
  width: 17px;
  height: 7px;
  margin: 4px 0 0 2px;
}

.compiled-surge-cost2 {
  width: 17px;
  height: 7px;
  margin: 0 0 1px 2px;
}

.compiled-surge-label {
  background-color: #ccc;
  margin: 0 1px 1px 0;
  height: 21px;
  width: 21px;
  border-radius: 8px 0 4px 0;
}

/* Dice */
.red-die {
  background-color: #d62728;
}

.green-die {
  background-color: #2ca02c;
}

.blue-die {
  background-color: #1f77b4;
}

.yellow-die {
  background-color: #fff655;
}

.black-die {
  background-color: black;
}

.white-die {
  background-color: white;
}


/* Ranged */
#ranged {
  float: left;
  height: 104px; /* == dice target height - defense modifiers height */
  width: 52px; /* == defense element width */
}

.ranged-button {
  width: 45px; /* == element width */
  height: 30px;
  border: 1px solid #555;
  text-align: center;
  line-height: 30px; /* == height for vertical text center */
  font-weight: bold;
  background-color: #fdae6b;
  float: left;
  border-radius: 8px;
  cursor: default;
  -webkit-user-select: none;
}

#ranged-plus {
  margin-top:3px;
}

#ranged-minus {
  margin-bottom:3px;
}

#ranged-value {
  width: 45px; /* == element width */
  height: 24px;
  font-weight: bold;
  text-align: center;
  line-height: 24px; /* == height for vertical text center */
  margin: 5px 0 5px 0;
  float: left;
  font-size:140%;
  cursor: default;
  position: relative;
  color: #081133;
}

#ranged-value::after {
  content: "";
  background-image: url("icons/ranged.svg");
  background-repeat: no-repeat;
  background-size: 55px 28px;
  opacity: 0.3;
  top: -3px;
  left: -5px;
  bottom: -3px;
  right: 0;
  position: absolute;
  z-index: -1;
}

/* chart */
#chart {
  margin: 5px 5px 0 5px;
  border-radius: 5px;
  height: 180px;
  clear: both;
  background-color: #eee;
}

.tooltip-damage, .tooltip-surge {
  width: 10px;
  height: 11px;
}

.tooltip-damage {
  margin: 0 1px -1px 0;
}

.tooltip-surge {
  margin: 0 1px -1px 2px;
}

/* Clearing */
#clear {
  background-color: #fdae6b;
  margin: 2px 0 0 4px;
  border: 1px solid #555;
  cursor: default;
  width: 45px;
  height: 45px;
  border-radius: 8px;
  float: left;
  text-align: center;
  line-height: 45px; /* == height to center line vertically */
}

/* Pinning */
#pin {
  background-color: #fdae6b;
  margin: 6px 0 0 5px; /* margin top == margin top for .pinned plus border difference */
  border: 1px solid #555;
  cursor: default;
  width: 45px;
  height: 45px;
  border-radius: 8px;
  float: left;
  text-align: center;
  line-height: 45px; /* == height to center line vertically */
}

#pin.disabled {
  background-color: #a77347;
  color: #444;
}

#pinned-area {
  overflow-x: auto;
  white-space: nowrap;
  height: 58px; /* 1 * top element margin + element height + 2 * element border + 2 * element shadow */
  width: 260px; /* 5 * element width + 5 * element left margin + 10 * element border */
}

.pinned {
  background-color: #eee;
  margin: 5px 5px 0 5px;
  border: 2px solid #eee;
  width: 45px;
  height: 45px;
  border-radius: 3px;
  text-align: center;
  line-height: 45px; /* == height to center line vertically */
  display: inline-block;
  cursor: alias;
}

.pinned-element {
  margin: 1px 0 0 1px;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  float: left;
  text-align: center;
  line-height: 8px;
}

.pinned-element img {
  width: 5px;
  height: 5px;
  margin: 2px;
}

.pinned-element .compiled-surge-item, .pinned-element .compiled-surge-label {
  width: 5px;
  height: 5px;
  float: left;
  line-height: 5px;
  font-size: 4pt;
}

.pinned-element .compiled-surge-item img {
  width: 2px;
  height: 2px;
  margin: 1px 0 1px 0;
}

.pinned-element .single-surge .compiled-surge-cost1 {
  width: 4px;
  height: 4px;
  margin: 0;
}

.pinned-element .double-surge .compiled-surge-cost1 {
  width: 4px;
  height: 2px;
  margin: 1px 0 0 0;
}

.pinned-element .compiled-surge-cost2 {
  width: 4px;
  height: 2px;
  margin: 0;
}

.pinned-element .compiled-surge-label {
  margin: 0;
  height: 5px;
  width: 5px;
  border-radius: 2px 0 1px 0;
}

.pinned-range {
  font-size: 8pt;
  font-weight: bold;
  background-color: #fff;
  height: 12px;
  width: 12px;
  position: relative;
  line-height: 12px;
  margin: 0;
  float: left;
  display: inline-block;
  border-radius: 1px;
}

.pinned-active {
  box-shadow: 0 0 5px black;
}

.pinned-inactive {}

/* Combining */
#combine-area {
  height: 59px; /* 2 * top element margin + element height + 2 * element border */
  background: #eee;
  border-radius: 5px;
  border: 0 solid #a55194;
  text-align: center;
  line-height: 59px; /* == height to vertically center text */
  margin: 1px 5px 0 5px;
}

.combined {
  float: left;
  margin-left: 6px; 
}


#credits {
  font-size: 8pt;
  color: #888;
  text-align: center;
  margin-top: 10px;
}

#credits a {
  color: #666;
}

#credits div {
  margin: 0 0 5px 0;
}