body,
html {
  margin: 0;
  padding: 0;
  overflow: auto;
  font-family: serif;
  background-color: black;
  color: darkred;

  --unit: 1vh;
}
* {
  box-sizing: border-box;
  outline: none;
}

/* ------------ forms ------------ */
select,
button,
label {
  cursor: pointer;
  border: 1px solid #fff2;
  font-family: serif;
}
body select * {
  color: initial;
  font-size: initial;
}
button {
  background: #fff2;
  border-radius: calc(2 * var(--unit));
  touch-action: manipulation;
  padding: 0;
}
.text-button {
  padding: 0 calc(2 * var(--unit));
  font-size: calc(2.5 * var(--unit));
  background: #0b0704;
  color: #fedfae;
}
/* remove select caret */
select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  display: flex;
  align-items: center;
  text-align: center;
  justify-content: center;
}
/* for IE10 */
select::-ms-expand {
  display: none;
}

/* hover states */
@media (hover: hover) {
  div select:hover,
  button:hover,
  .text-button:hover {
    background-color: #312b26;
  }

  .mini-h select:hover,
  .mini-v select:hover,
  .mini-h button:hover,
  .mini-v button:hover,
  .dual-buttons button:hover,
  .dual-buttons button:hover,
  .board button:hover,
  .board button.afflicted:nth-child(10):hover {
    background-color: #fff4;
  }

  .board button.afflicted:hover,
  .board .stress button.on.afflicted:hover,
  .board button:nth-child(10):hover {
    background-color: rgba(255, 0, 0, 0.7);
  }

  .radio-label:hover::after {
    position: absolute;
    content: "";
    display: block;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #fff2;
  }
}

/* ------------ cards ------------ */
.mini-h {
  height: calc(21 * var(--unit));
  width: calc(32.5 * var(--unit));
}
.mini-v {
  height: calc(32.5 * var(--unit));
  width: calc(21 * var(--unit));
}
.mini-h,
.mini-v {
  background-size: 100%;
  border-radius: calc(2 * var(--unit));
  display: flex;
  justify-content: stretch;
  align-items: stretch;
  background-repeat: no-repeat;
}
.mini-h select,
.mini-v select {
  flex: 1;
  border-radius: calc(2 * var(--unit));
  background: #fff2;
  color: transparent;
  max-width: 100%;
  width: 100%;
}

/* ------------ cards ------------ */
.dual-buttons button {
  position: absolute;
  height: 100%;
  width: 50%;
}
.dual-buttons button:first-child {
  left: 0;
  right: 50%;
  border-radius: var(--unit) 0 0 var(--unit);
}
.dual-buttons button:last-child {
  left: 50%;
  right: 0;
  border-radius: 0 var(--unit) var(--unit) 0;
}

/* ------------ header ------------ */
header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 7vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero {
  text-transform: capitalize;
}
select.hero {
  font-size: 2.5vh;
  background: #0b0704;
  color: #fedfae;
  border-radius: 2vh 0 0 2vh;
  margin-right: -1vh;
  padding-left: 1vh;
  padding-right: 2vh;
  text-align: center;
}
select.level {
  background: #0b0704;
  width: 6vh;
  height: 6vh;
  border-radius: 50%;
  text-align: center;
  color: #fedfae;
  font-size: 3vh;
  margin-right: 1vh;
}
select.hero option,
select.level optgroup,
select.level option {
  color: #fedfae;
}

header button,
select.settings {
  width: 5vh;
  height: 5vh;
  background: #0b0704;
  border-radius: 100%;
  margin-right: 1vh;
}
header button:has(+ button) {
  margin-right: 0.5vh;
}
header button,
select.settings {
  background-position: center;
  background-size: 70%;
  background-repeat: no-repeat;
}
.zoom-in {
  background-image: url(img/icons/zoom_in.svg);
}
.zoom-out {
  background-image: url(img/icons/zoom_out.svg);
}
select.settings {
  color: transparent;
  background-image: url(img/icons/settings.svg);
  font-size: unset;
}

main {
  margin-top: 7vh;
  height: calc(90 * var(--unit));
  display: flex;
  align-items: stretch;
}

/* ------------ trinkets ------------ */
.trinkets {
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-left: var(--unit);
}

.trinket {
  margin-bottom: calc(2.2 * var(--unit));
  display: flex;
  align-items: stretch;
  transform: rotate(0deg);
  transition-duration: 0.5s;
  transition-property: transform;
}
.trinket > div {
  display: flex;
  flex: 1;
}

.trinket.used {
  transform: rotate(180deg);
}
.trinket.used > div {
  transform: rotate(-180deg);
}

.trinket select:not(:last-child) {
  border-bottom-right-radius: 0;
  border-top-right-radius: 0;
  max-width: 50%;
  width: 50%;
}
.trinket button {
  flex: 1;
  border-bottom-left-radius: 0;
  border-top-left-radius: 0;
  max-width: 50%;
  width: 50%;
}

.trinket:nth-child(1) {
  background-image: url(img/game/trinket1.webp);
}

.trinket:nth-child(2) {
  background-image: url(img/game/trinket2.webp);
}

.trinket:nth-child(3) {
  background-image: url(img/game/trinket3.webp);
}

/* ------------ hero card ------------ */
.heroCard {
  min-width: calc(50 * var(--unit));
  background-image: url(img/game/hero.webp);
  background-size: 100%;
  position: relative;
}

.transform {
  position: absolute;
  top: calc(0.5 * var(--unit));
  left: calc(2.5 * var(--unit));
}
.clear-condition {
  position: absolute;
  top: calc(0.5 * var(--unit));
  right: var(--unit);
}
.add-condition {
  position: absolute;
  top: calc(4 * var(--unit));
  right: var(--unit);
}
.next-turn {
  position: absolute;
  top: calc(7.5 * var(--unit));
  right: var(--unit);
}

.conditions {
  position: absolute;
  z-index: 1;
  top: 12.5%;
  left: 32%;
  width: 300%;
  display: flex;
}
.stack {
  width: calc(7 * var(--unit));
  height: calc(10 * var(--unit));
  position: relative;
}
.stack .condition {
  position: absolute;
  top: 0;
}
.stack .condition:nth-child(2) {
  top: calc(1 * var(--unit));
}
.stack .condition:nth-child(3) {
  top: calc(2 * var(--unit));
}
.stack .condition:nth-child(4) {
  top: calc(3 * var(--unit));
}
.stack .condition:nth-child(5) {
  top: calc(4 * var(--unit));
}
.stack .condition:nth-child(6) {
  top: calc(5 * var(--unit));
}

.condition {
  width: calc(6 * var(--unit));
  height: calc(6 * var(--unit));
  border-radius: 100%;
  background-size: 100%;
  background-repeat: no-repeat;
  overflow: hidden;
  border: 1px solid #fff2;
}

.stunned {
  position: absolute;
  top: 27%;
  left: 30%;
  background: rgb(11 7 4 / 90%);
  padding: calc(1 * var(--unit));
  border-radius: calc(1 * var(--unit));

  color: #fedfae;
  text-align: center;
  font-size: calc(2 * var(--unit));
}

.wound-5,
.heal-5 {
  right: 4%;
  width: calc(5 * var(--unit));
  height: calc(5 * var(--unit));
  border-radius: 100%;
  margin-right: calc(3 * var(--unit));
  padding: 0;
  border-color: #8b0000b0;
  font-size: calc(2.5 * var(--unit));
  color: red;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.wound-5 {
  position: absolute;
  top: 26%;
}
.wounds {
  position: absolute;
  top: 32%;
  right: 4%;
  width: calc(11 * var(--unit));
  height: calc(11 * var(--unit));

  display: flex;
  align-items: center;
  justify-content: center;
  color: red;
  font-size: calc(3.5 * var(--unit));

  background-image: url(img/tokens/wounds.webp);
  background-repeat: no-repeat;
  background-size: 100%;
  border-radius: 100%;
}

.heal-5 {
  position: absolute;
  top: 45%;
}

.xp {
  position: absolute;
  top: 34%;
  left: 10%;
  width: calc(9 * var(--unit));
  height: calc(7 * var(--unit));

  display: flex;
  align-items: center;
  color: #fedfae;
  font-size: calc(3.5 * var(--unit));
  padding-left: calc(1.5 * var(--unit));

  background: #0b0704;
  background-image: url(img/tokens/xp.webp);
  background-size: calc(7 * var(--unit));
  background-position: right;
  background-repeat: no-repeat;
  border-radius: var(--unit);
}

.wounds button:first-child {
  border-radius: 100% 0 0 100% / 50% 0 0 50%;
}
.wounds button:last-child {
  border-radius: 0 100% 100% 0 / 0 50% 50% 0;
}

.deaths-door {
  background-color: rgb(193 0 0 / 50%);
  animation-name: color;
  animation-duration: 1.5s;
  animation-iteration-count: infinite;
}
.death-door-chip {
  position: absolute;
  top: 69.4%;
  right: 7.7%;
  width: 16.1%;
  height: 9.1%;
}
@keyframes color {
  0% {
    background-color: rgb(193 0 0 / 50%);
  }
  50% {
    background-color: rgb(193 0 0 / 25%);
  }
  100% {
    background-color: rgb(193 0 0 / 50%);
  }
}

/* ------------ hero board ------------ */
.board {
  position: relative;
  background-image: url(img/game/board.webp);
  background-size: 100%;
  min-width: calc(76 * var(--unit));
}

.stress-count,
.stress-minus,
.stress-plus {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}
.stress-minus,
.stress-plus {
  height: calc(5 * var(--unit));
  width: calc(5 * var(--unit));
  font-size: calc(2.5 * var(--unit));
  border-radius: 100%;
  overflow: hidden;
  top: 5.2%;
}
.stress-minus {
  left: 4%;
}
.stress-plus {
  right: 3%;
}
.stress-count {
  left: 12.8%;
  top: 4%;
  height: 6.3%;
  width: 7.3%;
  background: #0004;
  font-size: calc(3.5 * var(--unit));
  border-radius: 0;
  overflow: hidden;
}
.stress-count.afflicted {
  background-color: rgb(193 0 0 / 50%);
  color: white;
}

.stress {
  position: absolute;
  left: 21.2%;
  top: 4.2%;
  height: 7.7%;
  width: 68%;
  display: flex;
}
.stress button {
  width: 8%;
  margin: 1%;
  border-radius: 1%;
}
.stress button.on {
  background-color: #dddddd;
}
.stress button.afflicted:nth-child(10) {
  background-color: rgb(193 0 0 / 50%);
}
.stress button.on.afflicted {
  background-color: darkred;
}

.ability {
  position: absolute;
}
.ability select:not(:last-child) {
  flex: 2;
  margin-right: -1px;
  border-bottom-right-radius: 0;
  border-top-right-radius: 0;
  max-width: 50%;
  width: 50%;
}
.ability select + select {
  border-bottom-left-radius: 0;
  border-top-left-radius: 0;
  max-width: 50%;
  width: 50%;
}

.ability:nth-child(1) {
  top: 23.5%;
  left: 3.9%;
}

.ability:nth-child(2) {
  top: 47.7%;
  left: 3.9%;
}

.ability:nth-child(3) {
  top: 47.7%;
  left: 47.7%;
}

.ability:nth-child(4) {
  top: 71.9%;
  left: 3.9%;
}

.ability:nth-child(5) {
  top: 71.9%;
  left: 47.7%;
}

.use-blacksmith {
  position: absolute;
  height: 4vh;
  top: 37%;
  right: 18%;
}
.clear-blacksmith {
  position: absolute;
  height: 4vh;
  top: 42%;
  right: 17%;
}

/* ------------ statuses ------------ */
.status-cards {
  display: flex;
  flex-direction: column;
}

.diseases {
  display: flex;
  margin-top: calc(10 * var(--unit));
}

.disease {
  margin-right: var(--unit);
  background-image: url(img/game/disease.webp);
}

.virtue {
  background-image: url(img/game/virtue.webp);
}

.quirks {
  display: flex;
  margin-top: calc(7 * var(--unit));
}

.quirk {
  margin-right: var(--unit);
  background-image: url(img/game/quirk.webp);
}

.overlay {
  z-index: 100;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background-color: #0006;

  display: flex;
  justify-content: center;
  align-items: center;
}

.modal {
  background-color: #0b0704;
  color: #fedfae;
  position: relative;
  padding: 4vh;
  border-radius: 2vh;
  margin: 1vh;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.modal > *:not(:last-child) {
  margin-bottom: 1vh;
}

.close-modal {
  position: absolute;
  top: 1vh;
  right: 1vh;
  width: 3vh;
  height: 3vh;
  color: #fedfae;
  background: #0b0704;
}

.modal .text {
  text-align: center;
  font-size: calc(2.5 * var(--unit));
  align-self: center;
}
.modal hr {
  flex: 1;
  margin-top: 0;
  align-self: center;
}

.modal-buttons {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: start;
  width: 45vh;
  margin-left: -1vh;
}
.modal-buttons > * {
  margin-left: 1vh;
  margin-bottom: 1vh;
}

input[type="radio"] {
  display: none;
}
.radio-label {
  height: 4vh;
  border-radius: 2vh;
  padding: 1vh;

  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(2.5 * var(--unit));
}
input[type="radio"]:checked + label {
  border-color: darkred;
  box-shadow: 0 0 0.5vh 0.5vh darkred;
}
.modal button + button {
  margin-left: 1vh;
}

.modal .condition {
  width: 6vh;
  height: 6vh;
  border-radius: 100%;
}
.modal button.stack {
  width: 6vh;
  height: 11vh;
  background-color: transparent;
  border-radius: 3vh;
  overflow: hidden;
  border: 0;
}
